AutoBundler_Compiler

Android AutoBundler library

Лицензия

Лицензия

Категории

Категории

Auto Библиотеки уровня приложения Code Generators
Группа

Группа

sk.teamsoft
Идентификатор

Идентификатор

autobundler-compiler
Последняя версия

Последняя версия

0.3.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

AutoBundler_Compiler
Android AutoBundler library
Ссылка на сайт

Ссылка на сайт

https://github.com/Team-SOFTsk/AutoBundler
Система контроля версий

Система контроля версий

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

Скачать autobundler-compiler

Как подключить последнюю версию

<!-- 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"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
sk.teamsoft : autobundler-annotations jar 0.3.1
com.google.auto : auto-common jar 0.8
com.squareup : javapoet jar 1.8.0

Модули Проекта

Данный проект не имеет модулей.

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

Версии библиотеки

Версия
0.3.1