├── 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 │ │ │ │ ├── fragment_test.xml │ │ │ │ ├── activity_main.xml │ │ │ │ └── activity_test.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ ├── java │ │ │ └── zlc │ │ │ │ └── season │ │ │ │ └── bracerapp │ │ │ │ ├── TestAdapter.kt │ │ │ │ ├── MainActivity.kt │ │ │ │ ├── Util.kt │ │ │ │ ├── ParamsViewModel.kt │ │ │ │ ├── MutableParamsFragment.kt │ │ │ │ ├── ParamsDialog.kt │ │ │ │ ├── MutableParamsDialog.kt │ │ │ │ ├── ParamsFragment.kt │ │ │ │ ├── ParamsActivity.kt │ │ │ │ └── MutableParamsActivity.kt │ │ └── AndroidManifest.xml │ └── test │ │ └── java │ │ └── zlc │ │ └── season │ │ └── bracerapp │ │ └── ExampleUnitTest.kt ├── proguard-rules.pro └── build.gradle ├── bracer ├── .gitignore ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── zlc │ │ └── season │ │ └── bracer │ │ ├── ActivityIntentHolder.kt │ │ ├── IntentParams.kt │ │ ├── BundleParams.kt │ │ ├── ActivityParams.kt │ │ ├── StateHandleParams.kt │ │ ├── FragmentParams.kt │ │ ├── Bracer.kt │ │ ├── Optional.kt │ │ └── Util.kt ├── proguard-rules.pro └── build.gradle ├── bracer.png ├── usage.png ├── settings.gradle ├── jitpack.yml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── CHANGELOG.md ├── gradle.properties ├── gradlew.bat ├── README.zh.md ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /bracer/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /bracer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ssseasonnn/Bracer/HEAD/bracer.png -------------------------------------------------------------------------------- /usage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ssseasonnn/Bracer/HEAD/usage.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':bracer' 2 | rootProject.name='BracerApp' 3 | -------------------------------------------------------------------------------- /bracer/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | jdk: openjdk11 2 | install: 3 | - ./gradlew build :Bracer:publishToMavenLocal -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | BracerApp 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ssseasonnn/Bracer/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ssseasonnn/Bracer/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ssseasonnn/Bracer/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ssseasonnn/Bracer/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ssseasonnn/Bracer/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ssseasonnn/Bracer/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ssseasonnn/Bracer/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/ssseasonnn/Bracer/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/ssseasonnn/Bracer/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/ssseasonnn/Bracer/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/ssseasonnn/Bracer/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jan 08 14:03:50 CST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | .idea 4 | /local.properties 5 | /.idea/caches 6 | /.idea/libraries 7 | /.idea/modules.xml 8 | /.idea/workspace.xml 9 | /.idea/navEditor.xml 10 | /.idea/assetWizardSettings.xml 11 | .DS_Store 12 | /build 13 | /captures 14 | .externalNativeBuild 15 | .cxx 16 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/zlc/season/bracerapp/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package zlc.season.bracerapp 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 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | ## [1.0.5] - 2022-03 5 | ### Added 6 | - Remove unnecessary reflection 7 | 8 | ## [1.0.4] - 2021-07-20 9 | ### Added 10 | - Remove kotlin-android-extension 11 | 12 | ## [1.0.3] - 2020-01-13 13 | ### Added 14 | - Migrate to AndroidX 15 | 16 | ## [1.0.2] - 2020-01-11 17 | ### Added 18 | - Support full type 19 | - Support default value 20 | 21 | ## [1.0.1] - 2020-01-09 22 | ### Added 23 | - Add mutableParams 24 | - Support custom key 25 | 26 | ## [1.0.0] - 2020-01-08 27 | ### First version 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | -------------------------------------------------------------------------------- /app/src/main/java/zlc/season/bracerapp/TestAdapter.kt: -------------------------------------------------------------------------------- 1 | package zlc.season.bracerapp 2 | 3 | import android.app.Activity 4 | import android.content.Intent 5 | import android.os.Bundle 6 | import androidx.fragment.app.Fragment 7 | import zlc.season.bracer.params 8 | 9 | class TestAdapter( 10 | val activity: Activity, 11 | val fragment: Fragment, 12 | val intent: Intent, 13 | val bundle: Bundle 14 | ) { 15 | val paramFromActivity by activity.params() 16 | val paramFromFragment by fragment.params() 17 | val paramFromIntent by intent.params() 18 | val paramFromBundle by bundle.params() 19 | 20 | fun test(){ 21 | val string by activity.params() 22 | } 23 | } -------------------------------------------------------------------------------- /bracer/src/main/java/zlc/season/bracer/ActivityIntentHolder.kt: -------------------------------------------------------------------------------- 1 | package zlc.season.bracer 2 | 3 | import android.app.Activity 4 | import android.content.Intent 5 | 6 | object ActivityIntentHolder { 7 | private val intentsMap = mutableMapOf() 8 | 9 | @Synchronized 10 | fun createIntent(activity: Activity): Intent { 11 | var intent = intentsMap[activity] 12 | if (intent == null) { 13 | intent = Intent() 14 | intentsMap[activity] = intent 15 | } 16 | return intent 17 | } 18 | 19 | @Synchronized 20 | fun deleteIntent(activity: Activity) { 21 | intentsMap.remove(activity) 22 | } 23 | 24 | fun getIntent(activity: Activity): Intent? { 25 | return intentsMap[activity] 26 | } 27 | } -------------------------------------------------------------------------------- /bracer/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 | -------------------------------------------------------------------------------- /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 | 23 | -keep class * implements java.io.Serializable { *; } -------------------------------------------------------------------------------- /app/src/main/java/zlc/season/bracerapp/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package zlc.season.bracerapp 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | import zlc.season.bracer.startActivity 6 | import zlc.season.bracerapp.databinding.ActivityMainBinding 7 | 8 | class MainActivity : AppCompatActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | val binding = ActivityMainBinding.inflate(layoutInflater) 12 | setContentView(binding.root) 13 | 14 | binding.button.setOnClickListener { 15 | startActivity { 16 | customParams = CustomParams1() 17 | } 18 | } 19 | 20 | binding.button2.setOnClickListener { 21 | startActivity { 22 | byteParams = 1 23 | intParams = 123 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /app/src/main/java/zlc/season/bracerapp/Util.kt: -------------------------------------------------------------------------------- 1 | package zlc.season.bracerapp 2 | 3 | import java.io.Serializable 4 | 5 | val listParam = listOf("AAA", "BBB", "CCC") 6 | val arrayParam = arrayOf("AAA", "BBB", "CCC") 7 | val mapParam = mapOf( 8 | "A" to "AAA", 9 | "B" to "BBB", 10 | "C" to "CCC" 11 | ) 12 | 13 | data class CustomParams1( 14 | var a: String = "", 15 | var b: Int = 0, 16 | var c: Boolean = false 17 | ) : Serializable { 18 | override fun toString(): String { 19 | return """{a=$a,b=$b,c=$c}""" 20 | } 21 | } 22 | 23 | class CustomParams2 : Serializable { 24 | var str: String = "" 25 | var int: Int = 0 26 | var boolean: Boolean = false 27 | var list: List = emptyList() 28 | var map: Map = emptyMap() 29 | var array: Array = emptyArray() 30 | 31 | override fun toString(): String { 32 | return """ 33 | {str=$str,int=$int,boolean=$boolean,list=$list,map=$map,array=${array.asList()}} 34 | """.trimIndent() 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /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 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | # Kotlin code style for this project: "official" or "obsolete": 18 | kotlin.code.style=official 19 | android.useAndroidX=true 20 | android.enableJetifier=true 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 |