App 2.27.0: full-width Overview, a button hides the navigation
A small button in the Overview's top-right corner hides the app's sidebar (or bottom bar) and brings it back; only on the Overview, remembered, swiping still works. Emulator only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
This commit is contained in:
@@ -182,7 +182,14 @@ public class MainActivity extends AppCompatActivity {
|
||||
// by the tick even when their page is off screen.
|
||||
pager.setOffscreenPageLimit(panes.length - 1);
|
||||
pager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@Override public void onPageSelected(int position) { markCurrentPage(position); }
|
||||
@Override public void onPageSelected(int position) {
|
||||
markCurrentPage(position);
|
||||
applyOverviewFullScreen(position);
|
||||
}
|
||||
});
|
||||
findViewById(R.id.overview_fullscreen).setOnClickListener(v -> {
|
||||
prefs.edit().putBoolean(PREF_OVERVIEW_FULLSCREEN, !prefs.getBoolean(PREF_OVERVIEW_FULLSCREEN, false)).apply();
|
||||
applyOverviewFullScreen(pager.getCurrentItem());
|
||||
});
|
||||
|
||||
for (int i = 0; i < TAB_IDS.length; i++) {
|
||||
@@ -192,6 +199,25 @@ public class MainActivity extends AppCompatActivity {
|
||||
findViewById(TAB_IDS[i]).setOnClickListener(v -> pager.setCurrentItem(index, false));
|
||||
}
|
||||
markCurrentPage(pager.getCurrentItem());
|
||||
applyOverviewFullScreen(pager.getCurrentItem());
|
||||
}
|
||||
|
||||
/** Whether the Overview hides the navigation (the button in its corner). */
|
||||
static final String PREF_OVERVIEW_FULLSCREEN = "overview_fullscreen";
|
||||
|
||||
/**
|
||||
* The Overview full screen: the navigation hidden while the Overview is the page and the
|
||||
* driver chose it; every other page always has its navigation, and swiping still works.
|
||||
* The button only shows on the Overview, its icon saying what a tap does.
|
||||
*/
|
||||
private void applyOverviewFullScreen(int position) {
|
||||
boolean overview = position == 0;
|
||||
boolean full = overview && prefs.getBoolean(PREF_OVERVIEW_FULLSCREEN, false);
|
||||
findViewById(R.id.nav_bar).setVisibility(full ? View.GONE : View.VISIBLE);
|
||||
android.widget.ImageButton button = findViewById(R.id.overview_fullscreen);
|
||||
button.setVisibility(overview ? View.VISIBLE : View.GONE);
|
||||
button.setImageResource(full ? R.drawable.ic_fullscreen_exit : R.drawable.ic_fullscreen);
|
||||
button.setContentDescription(getString(full ? R.string.overview_fullscreen_exit : R.string.overview_fullscreen_enter));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user