├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ ├── activity_news_list.xml │ │ │ │ ├── fragment_msg.xml │ │ │ │ ├── fragment_test.xml │ │ │ │ ├── activity_news_detail.xml │ │ │ │ └── activity_main.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── kaixuan │ │ │ │ └── windowtree │ │ │ │ ├── WindowTag.kt │ │ │ │ ├── KotlinCommon.kt │ │ │ │ ├── MyApp.kt │ │ │ │ ├── activity │ │ │ │ ├── EmptyActivity.kt │ │ │ │ ├── BaseActivity.kt │ │ │ │ ├── NewsDetailActivity.kt │ │ │ │ └── NewsListActivity.kt │ │ │ │ ├── fragment │ │ │ │ ├── dynamic │ │ │ │ │ └── GoodFriendDynamicFragment.kt │ │ │ │ ├── DynamicFragment.kt │ │ │ │ ├── VipFragment.kt │ │ │ │ ├── ContactsFragment.kt │ │ │ │ └── MainFragment.kt │ │ │ │ └── MainActivity.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── kaixuan │ │ │ └── windowtree │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── kaixuan │ │ └── windowtree │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── windowtree_annotation ├── .gitignore ├── src │ └── main │ │ └── java │ │ └── com │ │ └── kaixuan │ │ └── windowtree_annotation │ │ ├── MyClass.java │ │ ├── model │ │ ├── WindowData.java │ │ └── WindowMeta.java │ │ ├── annotation │ │ ├── WindowTypeAnnotation.java │ │ └── Window.java │ │ └── enums │ │ └── WindowType.java └── build.gradle ├── windowtree_compiler ├── .gitignore ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── kaixuan │ └── compiler │ └── WindowProcessor.java ├── windowtree_library ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── kaixuan │ │ │ └── windowtreelibrary │ │ │ ├── model │ │ │ └── UnReadCountEvent.kt │ │ │ ├── template │ │ │ ├── IMain.java │ │ │ ├── IJumpAdapter.kt │ │ │ ├── IWindowTreeLoad.java │ │ │ └── ILogger.java │ │ │ ├── util │ │ │ ├── Consts.kt │ │ │ ├── WindowTreeUtil.kt │ │ │ ├── TextUtils.java │ │ │ ├── DefaultLogger.java │ │ │ └── ClassUtils.java │ │ │ ├── thread │ │ │ ├── DefaultThreadFactory.java │ │ │ └── DefaultPoolExecutor.java │ │ │ ├── adapter │ │ │ └── DefaultJumpAdapter.kt │ │ │ ├── WindowTree.kt │ │ │ └── WindowInfo.kt │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── kaixuan │ │ │ └── windowtreelibrary │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── kaixuan │ │ └── windowtreelibrary │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── codeStyles │ ├── codeStyleConfig.xml │ └── Project.xml ├── vcs.xml ├── runConfigurations.xml ├── gradle.xml └── misc.xml ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /windowtree_annotation/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /windowtree_compiler/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /windowtree_library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':windowtree_library', ':windowtree_compiler', ':windowtree_annotation' 2 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | WindowTree 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiXuan666/WindowTree/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /windowtree_library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | WindowTreeLibrary 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiXuan666/WindowTree/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiXuan666/WindowTree/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiXuan666/WindowTree/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiXuan666/WindowTree/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiXuan666/WindowTree/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiXuan666/WindowTree/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiXuan666/WindowTree/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiXuan666/WindowTree/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiXuan666/WindowTree/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiXuan666/WindowTree/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /windowtree_annotation/src/main/java/com/kaixuan/windowtree_annotation/MyClass.java: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtree_annotation; 2 | 3 | public class MyClass { 4 | } 5 | -------------------------------------------------------------------------------- /windowtree_library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /windowtree_annotation/src/main/java/com/kaixuan/windowtree_annotation/model/WindowData.java: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtree_annotation.model; 2 | 3 | public class WindowData { 4 | } 5 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/com/kaixuan/windowtree/WindowTag.kt: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtree 2 | 3 | 4 | class WindowTag( 5 | var unReadMsgCount : Int = 0, 6 | var pageAuthority : Long = 0 7 | ){ 8 | 9 | } 10 | -------------------------------------------------------------------------------- /windowtree_annotation/src/main/java/com/kaixuan/windowtree_annotation/annotation/WindowTypeAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtree_annotation.annotation; 2 | 3 | 4 | public @interface WindowTypeAnnotation { 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches/build_file_checksums.ser 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | .DS_Store 9 | /build 10 | /captures 11 | .externalNativeBuild 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/kaixuan/windowtree/KotlinCommon.kt: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtree 2 | 3 | import android.widget.Toast 4 | 5 | 6 | fun showToast(msg : String){ 7 | Toast.makeText(MyApp.instance,msg,Toast.LENGTH_SHORT).show() 8 | } 9 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /windowtree_library/src/main/java/com/kaixuan/windowtreelibrary/model/UnReadCountEvent.kt: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtreelibrary.model 2 | 3 | import com.kaixuan.windowtreelibrary.WindowInfo 4 | 5 | data class UnReadCountEvent(val fromWindowInfo: WindowInfo<*>,val change : Int) -------------------------------------------------------------------------------- /windowtree_library/src/main/java/com/kaixuan/windowtreelibrary/template/IMain.java: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtreelibrary.template; 2 | 3 | import java.util.Map; 4 | 5 | public interface IMain { 6 | 7 | public Map> getAllGeneratedFile(); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /windowtree_library/src/main/java/com/kaixuan/windowtreelibrary/template/IJumpAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtreelibrary.template 2 | 3 | import android.content.Context 4 | import com.kaixuan.windowtreelibrary.WindowInfo 5 | 6 | interface IJumpAdapter{ 7 | 8 | fun jump(formContext: Context, to: WindowInfo<*>) : Boolean 9 | 10 | } -------------------------------------------------------------------------------- /windowtree_library/src/main/java/com/kaixuan/windowtreelibrary/template/IWindowTreeLoad.java: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtreelibrary.template; 2 | 3 | import com.kaixuan.windowtreelibrary.WindowInfo; 4 | 5 | public interface IWindowTreeLoad { 6 | 7 | public void loadWindowTree(WindowInfo currentWindowInfo) throws ClassNotFoundException; 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/kaixuan/windowtree/MyApp.kt: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtree 2 | 3 | import android.app.Application 4 | 5 | class MyApp : Application() { 6 | 7 | companion object { 8 | lateinit var instance : MyApp; 9 | } 10 | 11 | override fun onCreate() { 12 | super.onCreate() 13 | instance = this 14 | } 15 | } -------------------------------------------------------------------------------- /windowtree_library/src/main/java/com/kaixuan/windowtreelibrary/util/Consts.kt: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtreelibrary.util 2 | 3 | class Consts{ 4 | companion object { 5 | @JvmField 6 | val TAG = "WindowTree" 7 | val GENERATE_FILE_PATH = "com.kaixuan.windowtree.windows" 8 | val GENERATE_FILE_NAME_END = "\$Gen" 9 | } 10 | } -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/kaixuan/windowtree/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtree 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /windowtree_library/src/test/java/com/kaixuan/windowtreelibrary/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtreelibrary; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/kaixuan/windowtree/activity/EmptyActivity.kt: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtree.activity 2 | 3 | import android.support.v7.app.AppCompatActivity 4 | import android.os.Bundle 5 | import com.kaixuan.windowtree.R 6 | import com.kaixuan.windowtree_annotation.annotation.Window 7 | import com.kaixuan.windowtreelibrary.mWindowInfo 8 | 9 | @Window(parentClassName = "com.kaixuan.windowtree.MainActivity",name = "空白界面",index = 2) 10 | class EmptyActivity : BaseActivity() { 11 | 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | setContentView(R.layout.fragment_test) 15 | supportActionBar!!.title = mWindowInfo.name 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /windowtree_annotation/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java-library' 2 | apply plugin: 'com.novoda.bintray-release' 3 | dependencies { 4 | implementation fileTree(dir: 'libs', include: ['*.jar']) 5 | } 6 | 7 | sourceCompatibility = "7" 8 | targetCompatibility = "7" 9 | tasks.withType(Javadoc) { 10 | options.encoding = "UTF-8" 11 | } 12 | //添加 13 | publish { 14 | repoName = rootProject.repoName 15 | artifactId = 'windowtree-annotation' 16 | userOrg = rootProject.userOrg 17 | groupId = rootProject.groupId 18 | uploadName = rootProject.uploadName 19 | publishVersion = rootProject.publishVersion 20 | desc = rootProject.desc 21 | website = rootProject.website 22 | licences = rootProject.licences 23 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_news_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/kaixuan/windowtree/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtree 2 | 3 | import android.support.test.InstrumentationRegistry 4 | import android.support.test.runner.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("com.kaixuan.windowtree", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /windowtree_library/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # Kotlin code style for this project: "official" or "obsolete": 15 | kotlin.code.style=official 16 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | -------------------------------------------------------------------------------- /windowtree_compiler/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java-library' 2 | apply plugin:'java' 3 | apply plugin: 'com.novoda.bintray-release' 4 | dependencies { 5 | implementation fileTree(dir: 'libs', include: ['*.jar']) 6 | implementation 'com.google.auto.service:auto-service:1.0-rc3' 7 | implementation project(path: ':windowtree_annotation') 8 | implementation 'com.squareup:javapoet:1.8.0' 9 | } 10 | 11 | sourceCompatibility = "7" 12 | targetCompatibility = "7" 13 | tasks.withType(Javadoc) { 14 | options.encoding = "UTF-8" 15 | } 16 | //添加 17 | publish { 18 | repoName = rootProject.repoName 19 | artifactId = 'windowtree-compiler' 20 | userOrg = rootProject.userOrg 21 | groupId = rootProject.groupId 22 | uploadName = rootProject.uploadName 23 | publishVersion = rootProject.publishVersion 24 | desc = rootProject.desc 25 | website = rootProject.website 26 | licences = rootProject.licences 27 | } -------------------------------------------------------------------------------- /windowtree_library/src/androidTest/java/com/kaixuan/windowtreelibrary/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtreelibrary; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.kaixuan.windowtreelibrary.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /windowtree_library/src/main/java/com/kaixuan/windowtreelibrary/template/ILogger.java: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtreelibrary.template; 2 | 3 | import com.kaixuan.windowtreelibrary.util.Consts; 4 | 5 | /** 6 | * Logger 7 | * 8 | * @author 正纬 Contact me. 9 | * @version 1.0 10 | * @since 16/5/16 下午5:39 11 | */ 12 | public interface ILogger { 13 | 14 | boolean isShowLog = false; 15 | boolean isShowStackTrace = false; 16 | String defaultTag = Consts.TAG; 17 | 18 | void showLog(boolean isShowLog); 19 | 20 | void showStackTrace(boolean isShowStackTrace); 21 | 22 | void debug(String tag, String message); 23 | 24 | void info(String tag, String message); 25 | 26 | void warning(String tag, String message); 27 | 28 | void error(String tag, String message); 29 | 30 | void monitor(String message); 31 | 32 | boolean isMonitorMode(); 33 | 34 | String getDefaultTag(); 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/kaixuan/windowtree/activity/BaseActivity.kt: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtree.activity 2 | 3 | import android.os.Bundle 4 | import android.support.v7.app.AppCompatActivity 5 | import android.util.Log 6 | 7 | open class BaseActivity : AppCompatActivity(){ 8 | 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | Log.i(this.javaClass.simpleName,"onCreate") 12 | } 13 | 14 | override fun onStart() { 15 | super.onStart() 16 | Log.i(this.javaClass.simpleName,"onStart") 17 | } 18 | 19 | override fun onResume() { 20 | super.onResume() 21 | Log.i(this.javaClass.simpleName,"onResume") 22 | } 23 | 24 | override fun onPause() { 25 | super.onPause() 26 | Log.i(this.javaClass.simpleName,"onPause") 27 | } 28 | 29 | override fun onStop() { 30 | super.onStop() 31 | Log.i(this.javaClass.simpleName,"onStop") 32 | } 33 | 34 | override fun onDestroy() { 35 | super.onDestroy() 36 | Log.i(this.javaClass.simpleName,"onDestroy") 37 | } 38 | } -------------------------------------------------------------------------------- /app/src/main/java/com/kaixuan/windowtree/fragment/dynamic/GoodFriendDynamicFragment.kt: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtree.fragment.dynamic 2 | 3 | import android.os.Bundle 4 | import android.support.v4.app.Fragment 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import com.kaixuan.windowtree.R 9 | import com.kaixuan.windowtreelibrary.mWindowInfo 10 | import kotlinx.android.synthetic.main.fragment_msg.* 11 | 12 | class GoodFriendDynamicFragment : Fragment() { 13 | var mView : View? = null 14 | 15 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? = 16 | mView ?: inflater.inflate(R.layout.fragment_msg,container,false).apply { mView = this } 17 | 18 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 19 | updateMsgCount() 20 | mWindowInfo.setEventListener { sender, sendData -> 21 | mWindowInfo.unReadMsgCount++ 22 | updateMsgCount() 23 | } 24 | } 25 | 26 | fun updateMsgCount(){ 27 | tv_msg_tips.text = "我有${mWindowInfo.unReadMsgCount}条未读消息" 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /windowtree_annotation/src/main/java/com/kaixuan/windowtree_annotation/annotation/Window.java: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtree_annotation.annotation; 2 | 3 | import com.kaixuan.windowtree_annotation.model.WindowData; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | @Target({ElementType.TYPE}) 11 | @Retention(RetentionPolicy.CLASS) 12 | public @interface Window { 13 | 14 | /** 15 | * 16 | * @return 父class 17 | */ 18 | Class parentClass() default Window.class; 19 | 20 | /** 21 | * 22 | * @return 父class完整类名,该属性和parentClass只需要任选实现一个即可,该属性便于模块化场景下无法直接引用目标类的情况 23 | */ 24 | String parentClassName() default ""; 25 | 26 | /** 27 | * 功能名称 可空 28 | * @return 29 | */ 30 | String name() default ""; 31 | 32 | /** 33 | * 该窗口是父节点的第几个子窗口 34 | * @return 35 | */ 36 | int index() default 0; 37 | 38 | /** 39 | * 该窗口在你的项目中,页面权限id是多少 40 | * 该值默认为-1时,即该页面无权限控制,任何人都允许加载 41 | * @return 42 | */ 43 | long pageAuthority() default -1; 44 | } 45 | -------------------------------------------------------------------------------- /windowtree_library/src/main/java/com/kaixuan/windowtreelibrary/util/WindowTreeUtil.kt: -------------------------------------------------------------------------------- 1 | package com.kaixuan.windowtreelibrary.util 2 | 3 | import android.content.Context 4 | import com.kaixuan.windowtreelibrary.WindowInfo 5 | import com.kaixuan.windowtreelibrary.WindowTree 6 | 7 | class WindowTreeUtil{ 8 | 9 | companion object { 10 | 11 | fun findKeyByValue(map: Map,value : V): K? { 12 | return map.entries.find { it.value == value }?.key 13 | } 14 | 15 | fun findContextByInfo(windowInfo: WindowInfo<*>): Context? { 16 | val findKeyByValue = findKeyByValue(WindowTree.instance.weakHashMap, windowInfo) ?: return null 17 | return getContext(findKeyByValue) 18 | } 19 | 20 | fun getContext(any: Any): Context? { 21 | when(any){ 22 | is android.app.Activity -> return any 23 | is android.app.Fragment -> return any.activity 24 | is android.support.v4.app.Fragment -> return any.context 25 | is android.view.View -> return any.context 26 | is android.app.Dialog -> return any.context 27 | is android.widget.PopupWindow -> return any.contentView.context 28 | else -> return null 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_msg.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 17 | 23 |