[Modify]切换分区后切换对应数据
This commit is contained in:
@@ -192,6 +192,21 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
|||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 让页面重新执行生命周期
|
||||||
|
* @param context
|
||||||
|
* @param extras
|
||||||
|
*/
|
||||||
|
public static void startNewTask(Context context, Intent extras) {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setClass(context, MainActivity.class);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
if (extras != null) {
|
||||||
|
intent.putExtras(extras);
|
||||||
|
}
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true 如果处理了跳转
|
* @return true 如果处理了跳转
|
||||||
*/
|
*/
|
||||||
@@ -588,11 +603,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
|||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onAreaChangeEvent(AreaChangeEvent event) {
|
public void onAreaChangeEvent(AreaChangeEvent event) {
|
||||||
toast(getString(R.string.succeeded_in_switching_the_partition));
|
toast(getString(R.string.succeeded_in_switching_the_partition));
|
||||||
start(this);
|
startNewTask(this, null);
|
||||||
if (mMainTabLayout != null) {
|
|
||||||
mMainTabLayout.select(MainTabType.TAB_TYPE_HOME);
|
|
||||||
mMainTabLayout.postDelayed(() -> EventBus.getDefault().post(new RefreshHomeDataEvent()), 500);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
Reference in New Issue
Block a user