Restore thread in two column/row mode

This commit is contained in:
M66B 2023-08-03 10:34:54 +02:00
parent 32c7e06781
commit 6333c47f7f
1 changed files with 18 additions and 1 deletions

View File

@ -160,6 +160,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
private boolean searching = false;
private int lastBackStackCount = 0;
private Snackbar lastSnackbar = null;
private Intent lastThread = null;
static final int PI_UNIFIED = 1;
static final int PI_WHY = 2;
@ -719,9 +720,17 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
!getIntent().hasExtra(Intent.EXTRA_PROCESS_TEXT))
init();
if (savedInstanceState != null)
lastThread = null;
if (savedInstanceState != null) {
drawerToggle.setDrawerIndicatorEnabled(savedInstanceState.getBoolean("fair:toggle"));
Intent thread = savedInstanceState.getParcelable("fair:thread");
if (thread != null && content_pane != null) {
getSupportFragmentManager().popBackStack("thread", FragmentManager.POP_BACK_STACK_INCLUSIVE);
onViewThread(thread);
}
}
checkFirst();
checkBanner();
checkCrash();
@ -791,6 +800,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
outState.putParcelable("fair:intent", getIntent());
outState.putBoolean("fair:toggle", drawerToggle == null || drawerToggle.isDrawerIndicatorEnabled());
outState.putBoolean("fair:searching", searching);
outState.putParcelable("fair:thread", lastThread);
super.onSaveInstanceState(outState);
}
@ -1337,9 +1347,13 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
boolean close_pane = prefs.getBoolean("close_pane", !Helper.isSurfaceDuo());
boolean thread = "thread".equals(getSupportFragmentManager().getBackStackEntryAt(count - 1).getName());
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.content_pane);
int visibility = (!thread || fragment == null ? (close_pane ? View.GONE : View.INVISIBLE) : View.VISIBLE);
content_separator.setVisibility(visibility);
content_pane.setVisibility(visibility);
if (!thread)
lastThread = null;
}
}
}
@ -1933,6 +1947,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
String action = intent.getAction();
if (action != null) {
lastThread = null;
if (action.startsWith("unified")) {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
getSupportFragmentManager().popBackStack("unified", 0);
@ -2420,6 +2436,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
}
private void onViewThread(Intent intent) {
lastThread = intent;
boolean found = intent.getBooleanExtra("found", false);
if (lastSnackbar != null && lastSnackbar.isShown())