本文整理汇总了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"));
}
}
示例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");
}
}
示例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();
}