Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sk.teamsoft:autobundler-compiler

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sk.teamsoft:autobundler-compiler

Android AutoBundler library

  • 0.3.1
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

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.

FAQs

Package last updated on 10 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc