use of com.cjsoftware.library.core.ObjectRegistry in project ucsFramework by cjsoftware-lib.
the class AbstractPreservableDialogFragment method onSaveInstanceState.
// endregion
// region Android Lifecycle
@CallSuper
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
ObjectRegistry objectRegistry = getObjectRegistry();
outState.putString(STATE_PRESERVATION_MANAGER_KEY, objectRegistry.put(mStatePreservationManager));
}
use of com.cjsoftware.library.core.ObjectRegistry in project ucsFramework by cjsoftware-lib.
the class AbstractPreservableDialogFragment method restoreViewStateManager.
// endregion
// region Private helper methods
private StatePreservationManager restoreViewStateManager(Bundle savedState) {
StatePreservationManager statePreservationManager = null;
ObjectRegistry objectRegistry = getObjectRegistry();
String statePreservationHandlerKey = savedState.getString(STATE_PRESERVATION_MANAGER_KEY);
if (statePreservationHandlerKey != null) {
statePreservationManager = objectRegistry.get(statePreservationHandlerKey);
}
return statePreservationManager;
}
use of com.cjsoftware.library.core.ObjectRegistry in project ucsFramework by cjsoftware-lib.
the class AbstractSmvpActivity method restorePresenterStack.
/**
* Attempt to restore and update a saved presenter and model stack. Returns the updated stack if successful or a
* newly created and initialized one if failed to restore.
*/
@NonNull
private PresenterT restorePresenterStack(Bundle savedInstanceState) {
PresenterT presenter = null;
// Obtain the object registry key from the saved instance bundle
String presenterKey = savedInstanceState.getString(SAVED_PRESENTER_STACK_KEY);
// If we got one, attempt to restore from the object registry
if (presenterKey != null) {
ObjectRegistry objectRegistry = getObjectRegistry();
presenter = objectRegistry.get(presenterKey);
}
if (presenter != null) {
// If we got a restored presenter & model stack, ask for a model updater
ModelEstablisher<ModelT> modelUpdater = createModelUpdater(savedInstanceState);
// Ask the presenter to call the updater if it exists.
if (modelUpdater != null) {
presenter.onInitializeModel(modelUpdater);
}
// Ask the presenter to update itself
presenter.onUpdate();
} else {
// If we failed to update, create an initialize a new presenter and model stack.
presenter = createPresenterStack();
}
return presenter;
}
use of com.cjsoftware.library.core.ObjectRegistry in project ucsFramework by cjsoftware-lib.
the class AbstractPreservableActivity method restoreViewStateManager.
// endregion
// region private helper methods
private StatePreservationManager restoreViewStateManager(Bundle savedState) {
StatePreservationManager uiStatePreservationManager = null;
ObjectRegistry objectRegistry = getObjectRegistry();
String statePreservationHandlerKey = savedState.getString(STATE_PRESERVATION_MANAGER_KEY);
if (statePreservationHandlerKey != null) {
uiStatePreservationManager = objectRegistry.get(statePreservationHandlerKey);
}
return uiStatePreservationManager;
}
use of com.cjsoftware.library.core.ObjectRegistry in project ucsFramework by cjsoftware-lib.
the class AbstractPreservableFragment method onSaveInstanceState.
// endregion
// region Android Lifecycle
@CallSuper
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
ObjectRegistry objectRegistry = getObjectRegistry();
outState.putString(STATE_PRESERVATION_MANAGER_KEY, objectRegistry.put(mStatePreservationManager));
}
Aggregations