Skip to content
An android library that automatically binds data carried by the Intent or Bundle.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper chore(all) upgrade the JDK version to java 8 Jun 17, 2019
intentlife feat(module'intentlife'): add new feature for support third-part help… Jun 25, 2019
intentlife_annotation chore(all) upgrade the JDK version to java 8 Jun 17, 2019
intentlife_compiler feat(module'intentlife'and'intentlife_compiler') finish feature of lo… Jun 22, 2019
sample
.gitignore fix(module'intentlife'): fix about control debuging. Jun 24, 2019
LICENSE Initial commit Jun 16, 2019
README.cn.md
README.md docs('README.cn.md'and 'README.md'): update description of library Jun 25, 2019
build.gradle Ready for package. Jun 16, 2019
gradle.properties Commit project. Jun 16, 2019
gradlew Commit project. Jun 16, 2019
gradlew.bat Commit project. Jun 16, 2019
settings.gradle

README.md

IntentLife

English | 简体中文

License platform jitpack Latest RepoSize CoreSize

Description

An android library that automatically binds data carried by the Intent or Bundle.

Download from Gradle

Add to your root build.gradle:

    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }

Add the dependency:

    dependencies {
          implementation 'com.github.ausboyue.IntentLife:intentlife:v1.0.3'
          annotationProcessor 'com.github.ausboyue.IntentLife:intentlife_compiler:v1.0.3'
    }

Get Started

ActivityA jump to ActivityB

  • ActivityA edit code maybe as below:
        User user = new User();
        user.setUserId("9527");
        user.setName("Cheny");
        user.setJob("android developer");

        Intent intent = new Intent(activityA, ActivityB.class);
        intent.putExtra("key_user", user);
        startActivity(intent);
  • ActivityB edit code as below:
public class ActivityB extends AppCompatActivity {
    @BindIntentKey("key_user")
    User mUser;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_secend);
        //  IntentLife inject
        IntentLife.bind(this);
        
        TextView tv_user_name = findViewById(R.id.tv_user_name);
        tv_user_name.setText(
                "Hello , I am " + mUser.getName()
                        + ".\nMy job is " + mUser.getJob() + ".");
    }
}

Framework support

Type of data

  • Support java eight basic data types and their arrays and collections
  • Classes that support the implementation of the Serializable interface
  • Support for classes that implement Parcelable interfaces and their arrays and collections
  • Support all data types supported by android Bundle

Interface scenario

  • Support jump between Activities
  • Support loading Fragments
  • Support for use in any class that needs to use data, such as the Presenter class in MVP design

Prompt

The target field should not have the private modifier, otherwise the data will not be bound with field.

Bugs Report

If you find any bug when using it, please contact me. Thanks for helping me making better.

About Author

Cheny - @ausboyue on GitHub, @www.icheny.cn

Other

Please give me some time to update the documentation ^_^

You can’t perform that action at this time.