• Stars
    star
    122
  • Rank 292,031 (Top 6 %)
  • Language
    Java
  • Created over 8 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ease your code, easy go!

AutoGo AutoGo

Download Android Arsenal
AutoGo is a library that bases on the Compile-time annotation just like the butterKnife and dagger. In other word, it will generate some code automatically according to the annotations you add during compiling to emancipate us from boilerplate code.

Setup

In project root build.gradle:

    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }

In app module build.gradle:

    apply plugin: 'com.neenbedankt.android-apt'
    dependencies {
        compile 'com.tellh:autogo-core:1.0.4'
        apt 'com.tellh:autogo-compiler:1.0.4'
    }

Usage

  • StartActivity in the awesome way.
    Use the @IntentValue to annotate the fields of the target activity. like this:
public class TargetActivity extends AppCompatActivity {
    //the annotated field should not be private
    @IntentValue("myName") String name;
    @IntentValue int age;
    @IntentValue ArrayList<String> friends;
    ......
}

Then make project(Ctrl+F9).
Now, in your SrcActivity you can start the TargetActivity just like this:

        AutoGo.from(SrcActivity.this)
                .gotoTargetActivity()
                .age(18)
                .myName("tlh")
                .friends(friends)
                .go();

This code will put the data into an Intent and start activity for you. In the TargetActivity can receive the data through this code:

AutoGo.assign(this);

Pretty awesome, right?

  • Save and restore data with sharedPreference in the awesome way.
    Use @SharePrefs to annotate the fields of your class :
public class Sample{
    @SharePrefs("customKey")
    String desc;
    @SharePrefs
    Person me;
    ......
}

Whenever you want to sava the data, just Call:

        AutoGo.save(this);

Then whenever your want to restore the data to assign the field in your class, just call:

        AutoGo.restore(this);
  • Save and restore data with Bundle in the awesome way.
    Use @BundleValue to annotate the fields of your class :
    @BundleValue
    Long activityLaunchTime;

Whenever you want to sava the data, just Call:

    protected void onSaveInstanceState(android.os.Bundle outState) {
        AutoGo.save(this, outState);
        ......
    }

Then whenever your want to restore the data to assign the field in your class, just call:

    protected void onRestoreInstanceState(android.os.Bundle savedInstanceState) {
        AutoGo.restore(this, savedInstanceState);
        ......
    }

Improve

If you have some problem or advice, pleace don't hesitate to raise an issue.
Just have fun and hope this will lessen your code :)

Update

  • In version 1.0.4, add Autogo#goForResult(int requestCode)、setter and getter of Intent. Thanks contribution from @registernet .

License

Apache Version 2.0

Copyright 2016 TellH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License

More Repositories

1

GitClub

An elegent Android Client for Github. 不仅仅是Github客户端,而且是一个发现优秀Github开源项目的app
Java
658
star
2

RecyclerTreeView

TreeView implement in Android with RecyclerView.
Java
638
star
3

RecyclerStickyHeaderView

Sticky header view or suspending view for RecyclerView.
Java
347
star
4

Android_PullToRefreshLibrary_Collection

Android下拉刷新开源库集锦,提供源码用于学习和研究
Java
240
star
5

FragmentLazyLoading

仿微信的Viewpager-Fragment惰性加载,延迟加载,lazy-loading
Java
70
star
6

NoListAdapter

A more elegant and easy way to build an multifunctional adapter for ListView or RecyclerView in Android.
Java
37
star
7

RecyclerViewDemo

Demo for study RecyclerView
Java
36
star
8

RxJavaDemo

学习RxJava
Java
33
star
9

Interview-Note

This is my campus interview note for Android. 我的校招Android面试笔记
25
star
10

AccessInline

An Android gradle plugin to inline methods that start with the prefix 'access$' in bytecode.
Java
20
star
11

Android-Simple-Common-PullToRefreshLayout

This is a light-weight Android PullToRefreshLayout, can be applied to any scrollable view.
Java
20
star
12

FloatingActionButtonPro

Extend from FloatingActionButton for Android
Java
8
star
13

HuffmanExtract

哈夫曼压缩,对应博文:http://blog.csdn.net/TellH/article/details/51285750
C++
8
star
14

AndroidStudioTemplate

Generate Template Files automatically in your Android Studio project.
FreeMarker
4
star
15

AlgorithmStudy

算法Demo
Java
4
star
16

AndroidLibraryLatestVersion

Check out Latest Version of some common libraries in Android developing.
1
star
17

AndroidUnitTestPractice

Android单元测试实践
Java
1
star
18

LearningCompile

探索编译原理
HTML
1
star