App 2.34.1: a tab to leave the Overview's full screen beside the car's sidebar
Without the app's own full screen, the car's sidebar takes the left edge and a swipe from there never reaches the app. A small tab at the app's left edge now brings the navigation back, by a tap or a swipe from it. In the app's full screen the handle and edge swipe stay as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
This commit is contained in:
@@ -192,6 +192,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
applyOverviewFullScreen(position);
|
||||
}
|
||||
});
|
||||
findViewById(R.id.edge_tab).setOnClickListener(v -> leaveOverviewFullScreen());
|
||||
findViewById(R.id.overview_fullscreen).setOnClickListener(v -> {
|
||||
prefs.edit().putBoolean(PREF_OVERVIEW_FULLSCREEN, !prefs.getBoolean(PREF_OVERVIEW_FULLSCREEN, false)).apply();
|
||||
applyOverviewFullScreen(pager.getCurrentItem());
|
||||
@@ -221,12 +222,22 @@ public class MainActivity extends AppCompatActivity {
|
||||
boolean overview = position == 0;
|
||||
overviewFull = overview && prefs.getBoolean(PREF_OVERVIEW_FULLSCREEN, false);
|
||||
findViewById(R.id.nav_bar).setVisibility(overviewFull ? View.GONE : View.VISIBLE);
|
||||
findViewById(R.id.edge_handle).setVisibility(overviewFull ? View.VISIBLE : View.GONE);
|
||||
// The way back: the edge swipe with a faint handle in the app's full screen; with the
|
||||
// car's bars shown its sidebar takes the left edge, so a tab to tap (or swipe from).
|
||||
boolean appFull = UploadSettings.fullScreen(prefs);
|
||||
findViewById(R.id.edge_handle).setVisibility(overviewFull && appFull ? View.VISIBLE : View.GONE);
|
||||
findViewById(R.id.edge_tab).setVisibility(overviewFull && !appFull ? View.VISIBLE : View.GONE);
|
||||
findViewById(R.id.overview_fullscreen).setVisibility(overview ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
|
||||
/** The swipe in from the left edge, set up with this screen's density. */
|
||||
private EdgeSwipe edgeSwipe;
|
||||
/** Back to the navigation: the edge swipe or the tab. */
|
||||
private void leaveOverviewFullScreen() {
|
||||
prefs.edit().putBoolean(PREF_OVERVIEW_FULLSCREEN, false).apply();
|
||||
applyOverviewFullScreen(((ViewPager2) findViewById(R.id.content)).getCurrentItem());
|
||||
}
|
||||
|
||||
/** The swipe in from the left edge, set up with this screen's density; null until first used. */
|
||||
private EdgeSwipe edgeSwipe, tabSwipe;
|
||||
/** The rest of a touch that became the edge swipe: kept from the page underneath. */
|
||||
private boolean swallowTouch;
|
||||
|
||||
@@ -247,21 +258,23 @@ public class MainActivity extends AppCompatActivity {
|
||||
if (edgeSwipe == null) {
|
||||
float density = getResources().getDisplayMetrics().density;
|
||||
edgeSwipe = new EdgeSwipe(48 * density, 64 * density);
|
||||
// With the car's sidebar beside the app, the swipe starts on the tab instead.
|
||||
tabSwipe = new EdgeSwipe(56 * density, 64 * density);
|
||||
}
|
||||
EdgeSwipe swipe = UploadSettings.fullScreen(prefs) ? edgeSwipe : tabSwipe;
|
||||
if (action == android.view.MotionEvent.ACTION_DOWN) {
|
||||
edgeSwipe.down(ev.getX(), ev.getY());
|
||||
} else if (action == android.view.MotionEvent.ACTION_MOVE && edgeSwipe.move(ev.getX(), ev.getY())) {
|
||||
swipe.down(ev.getX(), ev.getY());
|
||||
} else if (action == android.view.MotionEvent.ACTION_MOVE && swipe.move(ev.getX(), ev.getY())) {
|
||||
android.view.MotionEvent cancel = android.view.MotionEvent.obtain(ev);
|
||||
cancel.setAction(android.view.MotionEvent.ACTION_CANCEL);
|
||||
super.dispatchTouchEvent(cancel);
|
||||
cancel.recycle();
|
||||
swallowTouch = true;
|
||||
prefs.edit().putBoolean(PREF_OVERVIEW_FULLSCREEN, false).apply();
|
||||
applyOverviewFullScreen(((ViewPager2) findViewById(R.id.content)).getCurrentItem());
|
||||
leaveOverviewFullScreen();
|
||||
return true;
|
||||
} else if (action == android.view.MotionEvent.ACTION_UP
|
||||
|| action == android.view.MotionEvent.ACTION_CANCEL) {
|
||||
edgeSwipe.up();
|
||||
swipe.up();
|
||||
}
|
||||
}
|
||||
return super.dispatchTouchEvent(ev);
|
||||
@@ -1185,6 +1198,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
fullScreenSwitch.setOnCheckedChangeListener((btn, checked) -> {
|
||||
prefs.edit().putBoolean(UploadSettings.KEY_FULL_SCREEN, checked).apply();
|
||||
applyFullScreen();
|
||||
applyOverviewFullScreen(((ViewPager2) findViewById(R.id.content)).getCurrentItem());
|
||||
});
|
||||
clearCarPlayFullScreen();
|
||||
liveTelemetrySwitch = servicePane.findViewById(R.id.abrp_upload_switch);
|
||||
|
||||
Reference in New Issue
Block a user