AutoBundler_Compiler

Android AutoBundler library

License

License

Categories

Categories

Auto Application Layer Libs Code Generators
GroupId

GroupId

sk.teamsoft
ArtifactId

ArtifactId

autobundler-compiler
Last Version

Last Version

0.3.1
Release Date

Release Date

Type

Type

jar
Description

Description

AutoBundler_Compiler
Android AutoBundler library
Project URL

Project URL

https://github.com/Team-SOFTsk/AutoBundler
Source Code Management

Source Code Management

https://github.com/Team-SOFTsk/AutoBundler

Download autobundler-compiler

How to add to project

<!-- https://jarcasting.com/artifacts/sk.teamsoft/autobundler-compiler/ -->
<dependency>
    <groupId>sk.teamsoft</groupId>
    <artifactId>autobundler-compiler</artifactId>
    <version>0.3.1</version>
</dependency>
// https://jarcasting.com/artifacts/sk.teamsoft/autobundler-compiler/
implementation 'sk.teamsoft:autobundler-compiler:0.3.1'
// https://jarcasting.com/artifacts/sk.teamsoft/autobundler-compiler/
implementation ("sk.teamsoft:autobundler-compiler:0.3.1")
'sk.teamsoft:autobundler-compiler:jar:0.3.1'
<dependency org="sk.teamsoft" name="autobundler-compiler" rev="0.3.1">
  <artifact name="autobundler-compiler" type="jar" />
</dependency>
@Grapes(
@Grab(group='sk.teamsoft', module='autobundler-compiler', version='0.3.1')
)
libraryDependencies += "sk.teamsoft" % "autobundler-compiler" % "0.3.1"
[sk.teamsoft/autobundler-compiler "0.3.1"]

Dependencies

compile (3)

Group / Artifact Type Version
sk.teamsoft : autobundler-annotations jar 0.3.1
com.google.auto : auto-common jar 0.8
com.squareup : javapoet jar 1.8.0

Project Modules

There are no modules declared in this project.

AutoBundler

Android AutoBundler library

Download Maven Central

Description

AutoBundler is a library for Android applications, which removes boilerplate code from your activities and fragments. The library handles typical actions with saving instance state. So implementing your own onSaveInstanceState and onRestoreInstanceState with hundreds of LOC is a history now.

Usage

All you need to do to make AutoBundler work, is to add annotations to specified fields. Then you can call store/restore actions with one line for all your properties. That's all.

public class MainActivity extends Activity {
    @KeepState int mId;
    @KeepState String mName;
    @KeepState double mValue;
    @KeepState(mode = AutoBundler.MODE_ONRESTORE) EditText mEditText;
    
    @Override protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.my_layout);
        AutoBundler.restore(this, savedInstanceState, AutoBundler.MODE_ONCREATE);
        ...
    }
    
    @Override protected void onRestoreInstanceState(Bundle savedInstanceState) {
        super.onRestoreInstanceState(savedInstanceState);
        AutoBundler.restore(this, savedInstanceState, AutoBundler.MODE_ONRESTORE);
    }
    
    @Override protected void onSaveInstanceState(Bundle outState) {
        AutoBundler.save(this, outState);
        super.onSaveInstanceState(outState);
    }
}

AutoBundler supports basic classes, but you can also define your own class, which can either implement Parcelable or IFieldHandler interface. You can then specify the exact algorithm used to save and restore object values.

@KeepState DataObject mParcel;
@KeepState CustomObject mCustom;

...

class DataObject implements Parcelable {...}

class CustomObject implements IFieldHandler {
        ...
        
        @Override
        public void storeValue(Field field, Object object, Bundle bundle) throws IllegalAccessException {
            bundle.putString(field.getName(), data);
        }

        @Override
        public void readValue(Field field, Object object, Bundle bundle) throws IllegalAccessException {
            data = bundle.getString(field.getName());
        }
    }

License

Released under Apache v2 license

Contact

Team-SOFT s.r.o.

sk.teamsoft

Team-SOFT s.r.o.

Team-SOFT s.r.o. is a company, which focuses on complex enterprise solutions and ERP systems for small and medium-sized companies

Versions

Version
0.3.1