當前位置: 首頁>>代碼示例>>Java>>正文


Java PresenterStorage類代碼示例

本文整理匯總了Java中nucleus.factory.PresenterStorage的典型用法代碼示例。如果您正苦於以下問題:Java PresenterStorage類的具體用法?Java PresenterStorage怎麽用?Java PresenterStorage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PresenterStorage類屬於nucleus.factory包,在下文中一共展示了PresenterStorage類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPresenter

import nucleus.factory.PresenterStorage; //導入依賴的package包/類
/**
 * {@link ViewWithPresenter#getPresenter()}
 */
@SuppressWarnings("all")
public P getPresenter() {
    if (presenterFactory != null && presenter == null) {
        if (bundle != null)
            presenter = PresenterStorage.INSTANCE.getPresenter(bundle.getString(PRESENTER_ID_KEY));

        if (presenter == null) {
            presenter = presenterFactory.createPresenter();
            // 添加到PresenterStorage中,已添加OnDestroyListener,當銷毀時從Storage內移除,注意調用就是了
            PresenterStorage.INSTANCE.add(presenter);
            presenter.create(bundle == null ? null : bundle.getBundle(PRESENTER_KEY));
        }else{
            presenter.restore();
        }
        bundle = null;
    }
    return presenter;
}
 
開發者ID:caifeile,項目名稱:FlowGeek,代碼行數:22,代碼來源:PresenterLifecycleDelegate.java

示例2: onSaveInstanceState

import nucleus.factory.PresenterStorage; //導入依賴的package包/類
/**
 * {@link android.app.Activity#onSaveInstanceState(Bundle)}, {@link android.app.Fragment#onSaveInstanceState(Bundle)}, {@link android.view.View#onSaveInstanceState()}.
 */
public Bundle onSaveInstanceState() {
    Bundle bundle = new Bundle();
    getPresenter();
    // 有可能不需要presenter
    if (presenter != null) {

        // 保存presenter內需要保存的值
        Bundle presenterBundle = new Bundle();
        presenter.save(presenterBundle);
        bundle.putBundle(PRESENTER_KEY, presenterBundle);

        // 保存presenter在storage的key
        bundle.putString(PRESENTER_ID_KEY, PresenterStorage.INSTANCE.getId(presenter));
    }
    return bundle;
}
 
開發者ID:caifeile,項目名稱:FlowGeek,代碼行數:20,代碼來源:PresenterLifecycleDelegate.java

示例3: getPresenter

import nucleus.factory.PresenterStorage; //導入依賴的package包/類
/**
 * {@link ViewWithPresenter#getPresenter()}
 */
public P getPresenter() {
    if (presenterFactory != null) {
        if (presenter == null && bundle != null)
            presenter = PresenterStorage.INSTANCE.getPresenter(bundle.getString(PRESENTER_ID_KEY));

        if (presenter == null) {
            presenter = presenterFactory.createPresenter();
            PresenterStorage.INSTANCE.add(presenter);
            presenter.create(bundle == null ? null : bundle.getBundle(PRESENTER_KEY));
        }
        bundle = null;
    }
    return presenter;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:PresenterLifecycleDelegate.java

示例4: onSaveInstanceState

import nucleus.factory.PresenterStorage; //導入依賴的package包/類
/**
 * {@link android.app.Activity#onSaveInstanceState(Bundle)}, {@link android.app.Fragment#onSaveInstanceState(Bundle)}, {@link android.view.View#onSaveInstanceState()}.
 */
public Bundle onSaveInstanceState() {
    Bundle bundle = new Bundle();
    getPresenter();
    if (presenter != null) {
        Bundle presenterBundle = new Bundle();
        presenter.save(presenterBundle);
        bundle.putBundle(PRESENTER_KEY, presenterBundle);
        bundle.putString(PRESENTER_ID_KEY, PresenterStorage.INSTANCE.getId(presenter));
    }
    return bundle;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:PresenterLifecycleDelegate.java


注:本文中的nucleus.factory.PresenterStorage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。