当前位置: 首页>>代码示例>>Java>>正文


Java TiPresenter.detachView方法代码示例

本文整理汇总了Java中net.grandcentrix.thirtyinch.TiPresenter.detachView方法的典型用法代码示例。如果您正苦于以下问题:Java TiPresenter.detachView方法的具体用法?Java TiPresenter.detachView怎么用?Java TiPresenter.detachView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.grandcentrix.thirtyinch.TiPresenter的用法示例。


在下文中一共展示了TiPresenter.detachView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testManageViewSubscription_InOnDetachView_ShouldThrow

import net.grandcentrix.thirtyinch.TiPresenter; //导入方法依赖的package包/类
@Test
public void testManageViewSubscription_InOnDetachView_ShouldThrow() throws Exception {
    final TiPresenter presenter = new TiPresenter() {

        private RxTiPresenterDisposableHandler mSubscriptionHandler =
                new RxTiPresenterDisposableHandler(this);

        @Override
        protected void onDetachView() {
            super.onDetachView();
            mSubscriptionHandler.manageViewDisposable(Observable.just("test").subscribe());
        }
    };
    presenter.create();
    presenter.attachView(mView);

    try {
        presenter.detachView();
        fail("did not throw");
    } catch (Throwable e) {
        assertThat(e.getMessage(), containsString("no view"));
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:RxTiPresenterDisposableHandlerTest.java

示例2: testManageViewSubscription_InOnDetachView_ShouldThrow

import net.grandcentrix.thirtyinch.TiPresenter; //导入方法依赖的package包/类
@Test
public void testManageViewSubscription_InOnDetachView_ShouldThrow() throws Exception {
    final TiPresenter presenter = new TiPresenter() {

        private RxTiPresenterDisposableHandler mSubscriptionHandler =
                new RxTiPresenterDisposableHandler(this);

        @Override
        protected void onDetachView() {
            super.onDetachView();
            mSubscriptionHandler.manageViewDisposable(Observable.just("test").subscribe());
        }
    };
    presenter.create();
    presenter.attachView(mView);

    try {
        presenter.detachView();
        fail("did not throw");
    } catch (Throwable e) {
        assertThat(e).hasMessageContaining("no view");
    }
}
 
开发者ID:grandcentrix,项目名称:ThirtyInch,代码行数:24,代码来源:RxTiPresenterDisposableHandlerTest.java

示例3: onActivityFinished

import net.grandcentrix.thirtyinch.TiPresenter; //导入方法依赖的package包/类
@Override
public void onActivityFinished(final Activity activity, final String hostId) {
    // First remove the scope, and don't leak it when the Activity got finished
    final PresenterScope scope = mScopes.remove(hostId);
    unregisterActivityObserver(activity);

    TiLog.d(TAG, "Activity is finishing, free remaining presenters " + activity);
    if (scope != null) {
        for (final Map.Entry<String, TiPresenter> entry : scope.getAllMappings()) {
            final String presenterId = entry.getKey();
            final TiPresenter presenter = entry.getValue();

            // when the presenter is not destroyed yet, destroy it.
            if (!presenter.isDestroyed()) {
                if (presenter.isViewAttached()) {
                    presenter.detachView();
                }
                if (!presenter.isDestroyed()) {
                    presenter.destroy();
                }
            }
            scope.remove(presenterId);
        }
    }

    printRemainingPresenter();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:PresenterSavior.java


注:本文中的net.grandcentrix.thirtyinch.TiPresenter.detachView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。