# AutoPage **Repository Path**: dileber/AutoPage ## Basic Information - **Project Name**: AutoPage - **Description**: Android activity easy jump - **Primary Language**: Kotlin - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-03-25 - **Last Updated**: 2021-09-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ![](https://img.shields.io/badge/JitPack-1.0.8-green) ![](https://img.shields.io/badge/JCenter-1.0.4-yellowgreen) ![](https://img.shields.io/badge/code-kotlin-red) ![](https://img.shields.io/badge/Android%20Arsenal-AutoPage-yellow) ![](https://img.shields.io/badge/author-smartbackme-blue) # AutoPage Version number v1.0.2 Fast jump tool supporting kotlin & Java 1. Support serializable large object transfer 2. Support multi process activity jump code address: [Version number v1.0.2](https://github.com/smartbackme/AutoPage/tree/v1.0.2) Document address: [Version number v1.0.2](https://github.com/smartbackme/AutoPage/blob/v1.0.2/README.md) chinese Document address: [中文文档地址 版本 v1.0.2](https://github.com/smartbackme/AutoPage/blob/v1.0.2/README-zh.md) Version number v1.0.8 Update content: (quick jump tool specially designed for kotlin. If your project only supports Java language, please do not use this version) 1. The code adopts kotlin syntax 2. Support default value function 3. The serializable data transmission is no longer supported, but the Parcelable large object transmission with better performance is used instead 4. Support multi process activity jump 5. Reduce the memory occupation and improve the recyclable memory # AutoPage v1.0.8 If you think it's good, gives me a star Android activity easy jump [中文说明](https://github.com/smartbackme/AutoPage/blob/master/README-zh.md) [日本語](https://github.com/smartbackme/AutoPage/blob/master/README-jp.md) Every time activity or fragment jumps to pass value, are you tired of parameter passing. If you have too much data, your code will be miserable, even in a good design. So today I recommend a tool for you Compare with the original jump # Comparison: 1. Comparison of jump modes ``` Intenti=new Intent(this,MainActivity.class); startActivity(i); ``` vs ``` ApMainActivity.newInstance().start(this) ``` ``` //send Intenti=new Intent(this,MainActivity.class); Bundle bundle = new Bundle(); bundle.putInt("message", "123"); i.putExtra("Bundle", bundle); startActivity(i); //back String s=bundle.getString("message",""); ``` vs ``` //send ApMainActivity.newInstance().apply { message = "123" } .start(this) //back AutoJ.inject(this); ``` Parcelable send ```bash //send ApAllDataActivity.newInstance().apply { message = "123" myData = MyData("hfafas",true,21) } .start(this) //back AutoJ.inject(this); ``` # AutoPage Android activity easy jump # must 1. androidx 2. kotlin & java # Support transport type All basic types supported by bundles (except ShortArray) All of the following types are supported. If the type is not the following, a kapt error may be reported ```bash :Parcelable String Long Int Boolean Char Byte Float Double Short CharSequence CharArray IntArray LongArray BooleanArray DoubleArray FloatArray ByteArray ArrayList ArrayList ArrayList ArrayList<:Parcelable> Array<:Parcelable> ``` #########use######### Since jcenter service will be abandoned after May 1, the project will be migrated to jitpack, and the version number will be changed to 1.0.8 at the same time project : build.gradle ``` buildscript { repositories { maven { url 'https://www.jitpack.io' } } ``` config your module kotlin kapt Your project must support @Parcelize annotation, that is, you must add application plugin: 'kotlin Android extensions' ``` apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' android { androidExtensions { experimental = true } } kapt com.github.smartbackme.AutoPage:autopage-processor:1.0.8 implementation com.github.smartbackme.AutoPage:autopage:1.0.8 ``` **point** 1. @AutoPage in class or field 2. Ap suffix *kotlin:* 1. filed must have @JvmField and @AutoPage 2. onCreate method must have AutoJ.inject(this) *java:* 1. filed must have @AutoPage 2. onCreate method must have AutoJ.inject(this) #########for Activity usage######### ## example one simple jump to activity ``` @AutoPage class SimpleJump1Activity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_simple_jump1) } } ``` then ``` ApSimpleJump1Activity.newInstance().start(this) ``` ## example two simple jump to activity and message ``` class MainActivity2 : AppCompatActivity() { @AutoPage @JvmField var message:String? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main2) AutoJ.inject(this) findViewById(R.id.text).text = message } } ``` then ``` ApMainActivity2.newInstance().apply { message = "123" } .start(this) ``` ## example three: jump to activity and result ``` @AutoPage class SimpleJumpResultActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_simple_jump_result) } override fun onBackPressed() { var intent = Intent() intent.putExtra("message","123") setResult(RESULT_OK,intent) super.onBackPressed() } } ``` then ``` ApSimpleJumpResultActivity.newInstance().apply { requestCode = 1 }.start(this) ``` ## example four: Parcelable pojo ''' @Parcelize data class MyData(var message:String,var hehehe: Boolean,var temp :Int):Parcelable ''' ``` class AllDataActivity : AppCompatActivity() { @AutoPage @JvmField var myData:MyData? = null @AutoPage @JvmField var message:String? = "this is default value" override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_all_data) AutoJ.inject(this) Toast.makeText(this,myData?.toString()+message,Toast.LENGTH_LONG).show() } } ``` then ``` ApAllDataActivity.newInstance().apply { message = "123" myData = MyData("hfafas",true,21) ``` ## example five: default value ``` class DefaultValueActivity : AppCompatActivity() { @AutoPage @JvmField var message:String? = "this is default value" override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_default_value) AutoJ.inject(this) // var args = intent.getParcelableExtra("123") findViewById