Giter Site home page Giter Site logo

intentlife's Introduction

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.4'
          annotationProcessor 'com.github.ausboyue.IntentLife:intentlife_compiler:v1.0.4'
    }

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 ^_^

intentlife's People

Contributors

ausboyue avatar

Stargazers

Tianhao Fu avatar Kogel avatar  avatar mr zhang avatar mimi avatar qmmm61 avatar Loen avatar Tom avatar StanleyXiao avatar  avatar  avatar 胖子雷神 avatar  avatar  avatar nodyang avatar  avatar  avatar aeasringnar avatar xxxgod avatar  avatar 李虎头 avatar YuJie Wang avatar HuanXiang avatar  avatar  avatar  avatar ydong avatar ingramchen avatar 西行寺幽幽子 avatar  avatar FairyEver avatar yolo3 avatar Joy Zhang avatar Bacchus avatar AnFrank avatar  avatar YIDA avatar wushuangluanwu avatar  avatar Yolo avatar cnobody avatar tanling avatar whichard avatar zhoaxiaofa avatar  avatar Wayne avatar Jiawei Liu avatar Ziran Gong avatar Mr.James Wong avatar Chris avatar  avatar  avatar ibonway avatar Deng-Ping Fan avatar Lin。 avatar Haibo avatar  avatar jorian avatar Taisite avatar  avatar 顾与苏夜 avatar  avatar Rinkowei avatar  avatar fatdoge avatar  avatar  avatar Choice avatar chase avatar onlineCui avatar flyfire avatar zhuxiaoyu avatar 萧十一郎 avatar  avatar yishuinanfeng avatar YOGURTS avatar  avatar  avatar 小鬼难缠 avatar Afer avatar  avatar yanxuwen avatar Mr. li avatar 萌新小前端 avatar shuleisanshi avatar Double Sun avatar yaya2212 avatar  avatar dujiang avatar  avatar zhaoLiang123 avatar  avatar Yanke Hu avatar  avatar  avatar  avatar kobe0824 avatar Owe avatar Terrorblade avatar XiaoL avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.