All Projects → mukeshsolanki → Prevailer-orientation-support-library-for-Android

mukeshsolanki / Prevailer-orientation-support-library-for-Android

Licence: MIT license
Prevailer is a simple android library that helps in preserving object instances across orientation change in android and is JAVA 8 and MVP ready.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Prevailer-orientation-support-library-for-Android

Preservely
Lightweight Android lib preserving objects instances during orientation changes
Stars: ✭ 22 (+29.41%)
Mutual labels:  mvp, loader, orientation-changes
Alligator
Alligator is a modern Android navigation library that will help to organize your navigation code in clean and testable way.
Stars: ✭ 287 (+1588.24%)
Mutual labels:  fragments, mvp
Wanandroid
WanAndroid客户端,项目基于 Material Design + MVP +dagger2 + RxJava + Retrofit + Glide + greendao 等架构进行设计实现,极力打造一款 优秀的玩Android https://www.wanandroid.com 客户端,是一个不错的Android应用开发学习参考项目
Stars: ✭ 223 (+1211.76%)
Mutual labels:  fragments, mvp
Marvel
Marvel Characters Android Application Assigned by smava GmbH
Stars: ✭ 227 (+1235.29%)
Mutual labels:  fragments, mvp
WanAndroidMaster
根据 http://www.wanandroid.com 提供api ,编写 包含 Material Design + MVP + Rxjava2 + Retrofit + Glide项目
Stars: ✭ 74 (+335.29%)
Mutual labels:  mvp
sirius
Modern coffeescript/javascript framework
Stars: ✭ 20 (+17.65%)
Mutual labels:  mvp
autoload
Aplus Framework Autoload Library
Stars: ✭ 18 (+5.88%)
Mutual labels:  loader
react-nested-loader
The easiest way to manage loaders/errors inside a button. NOT an UI lib.
Stars: ✭ 62 (+264.71%)
Mutual labels:  loader
EdgeMvp
一个MVP架构利器。自动生成接口文件,且不需要实现接口。
Stars: ✭ 56 (+229.41%)
Mutual labels:  mvp
webpack-image-srcset-loader
Generate srcset string from image
Stars: ✭ 28 (+64.71%)
Mutual labels:  loader
MVPFrame
Android MVPFrame Simple Demo. and Recycler lazy load data
Stars: ✭ 72 (+323.53%)
Mutual labels:  mvp
webpack-modernizr-loader
Get your modernizr build bundled with webpack, use modernizr with webpack easily
Stars: ✭ 35 (+105.88%)
Mutual labels:  loader
GithubApp-android-architecture
Let's learn a deep look at the Android architecture
Stars: ✭ 16 (-5.88%)
Mutual labels:  mvp
Spring-Boot-Application-Template
Spring Boot Web App, Flyway, MySQL, H2DB, Bootstrap, Thymeleaf, JWT, Swagger, API Rate Limiting, Docker, RBAC, i18n
Stars: ✭ 90 (+429.41%)
Mutual labels:  fragments
core
An advanced and highly optimized Java library to build frameworks: it's useful for scanning class paths, generating classes at runtime, facilitating the use of reflection, scanning the filesystem, executing stringified source code and much more...
Stars: ✭ 100 (+488.24%)
Mutual labels:  loader
ngx-loaders-css
Loaders.css component for Angular X
Stars: ✭ 13 (-23.53%)
Mutual labels:  loader
MVPDemo
MVP 封装
Stars: ✭ 81 (+376.47%)
Mutual labels:  mvp
ReadnBuyAndroidApp
Android app developed at the Vanhackathon for Shopify's challenge. Coded with Kotlin, RxJava and MVP.
Stars: ✭ 13 (-23.53%)
Mutual labels:  mvp
pe-loader
A Windows PE format file loader
Stars: ✭ 81 (+376.47%)
Mutual labels:  loader
Reader
📚 MVP + Volley + Gson, 内容包含了糗事百科,煎蛋,和内涵段子
Stars: ✭ 60 (+252.94%)
Mutual labels:  mvp

Prevailer - Orientation Support Android



Prevailer is a simple android library that helps in preserving object instances across orientation change in android and is JAVA 8 and MVP ready.

How to use

Integrating the project is simple a refined all you need to do is follow the below steps

  • Add the JitPack repository to your build file. Add it in your root build.gradle at the end of repositories:
allprojects {
  repositories {
    ...
    maven { url "https://jitpack.io" }
  }
}
  • Add the dependency
dependencies {
        compile 'com.github.mukeshsolanki:Prevailer-orientation-support-library-for-Android:1.0.2'
}
  • In your Activity / Fragment onCreate call
Prevailer.init(
		this, // activity instance
		23, // unique id of loader used
		new PrevailerFactory<ObjectToBePreserved>() { // factory for the instance that should be preserved
		    @Override
		    public ObjectToBePreserved create() {
		        return new MyTypeToBePreserved();
		    }
		},
		new Prevailer.OnInstanceReloadedAction<ObjectToBePreserved>() {
		    @Override
		    public void performAction(MyTypeToBePreserved instance) {
          // do what needs to be done when reloaded
		    }
		},
		new Prevailer.OnInstanceDestroyedAction() {
		    @Override
		    public void performAction() {
          // do what needs to be done when destroyed
		    }
		}
);
  • Use with JAVA 8
Prevailer.init(this, 23,
                (PrevailerFactory<MyTypeToBePreserved>) () -> new ObjectToBePreserved(),
                (Prevailer.OnInstanceReloadedAction<ObjectToBePreserved>) instance -> {
                    // do what needs to be done when reloaded
                },
                (Prevailer.OnInstanceDestroyedAction) () -> {
                    // do what needs to be done when destroyed
                }
);

Why do we need Prevailer

The need for prevailer has been around from a very long time the developers in the android community have been fighting this issue from a really long time. Prevailer works with MVP approach making development easy in case where the presenters had to be maintained or kept alive when the orientation changed.

How does it work

Prevailer uses Android Loader API under the hood. On Android platform, Loaders framework provides API for asynchronous data loading in Activity or Fragment. However, Loaders has special property of preserving instance of the handled object when it's reloaded. Prevailer benefits from that to provide simple way of caching (preserving) instances of objects that mustn't be destroyed during orientation changes. Preserved instances are destroyed when the activity holding them is abandoned and no longer used.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].