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:
+2
-2
@@ -34,8 +34,8 @@ android {
|
||||
applicationId "com.stinnesbeck.nilsmg4"
|
||||
minSdk 27
|
||||
targetSdk 36
|
||||
versionCode 133
|
||||
versionName "2.34.0"
|
||||
versionCode 134
|
||||
versionName "2.34.1"
|
||||
|
||||
// Nothing about the server ships in the APK: its URL and ingest token are entered in
|
||||
// the app's Server tab (ServerConfig), and the database is only reachable by the server.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- The tab at the left edge of the Overview when the car's own bars are shown: a small dark
|
||||
tongue, rounded on the inside, inside its larger touch area. -->
|
||||
<inset xmlns:android="http://schemas.android.com/apk/res/android" android:insetRight="12dp">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#CC1B1D1E" />
|
||||
<stroke android:width="1dp" android:color="@color/ev_outline" />
|
||||
<corners android:topRightRadius="12dp" android:bottomRightRadius="12dp" />
|
||||
</shape>
|
||||
</inset>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Points into the screen: the Overview's tab that brings the navigation back. -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:pathData="M9,6 L15,12 L9,18" android:fillColor="@android:color/transparent"
|
||||
android:strokeColor="@color/ev_text_secondary" android:strokeWidth="2" android:strokeLineCap="round" android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
@@ -22,10 +22,12 @@
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
<LinearLayout android:layout_width="0dp" android:layout_weight="1" android:layout_height="match_parent" android:orientation="vertical">
|
||||
<!-- The pages, and over them in full screen the handle that says "swipe in from here". -->
|
||||
<!-- The pages, and over them in the Overview's full screen the way back: a faint handle at the edge
|
||||
in the app's full screen, a tab when the car's own sidebar takes the edge. -->
|
||||
<FrameLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1">
|
||||
<androidx.viewpager2.widget.ViewPager2 android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent" />
|
||||
<View android:id="@+id/edge_handle" android:layout_width="5dp" android:layout_height="96dp" android:layout_gravity="start|center_vertical" android:layout_marginStart="4dp" android:background="@drawable/bg_edge_handle" android:alpha="0.35" android:visibility="gone" />
|
||||
<ImageButton android:id="@+id/edge_tab" android:layout_width="48dp" android:layout_height="96dp" android:layout_gravity="start|center_vertical" android:background="@drawable/bg_edge_tab" android:src="@drawable/ic_chevron_right" android:paddingEnd="16dp" android:paddingStart="4dp" android:scaleType="center" android:visibility="gone" android:contentDescription="@string/overview_fullscreen_exit" />
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/app_root" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:background="@color/ev_background">
|
||||
<com.evsuite.abrp.PremiumBackdropView android:layout_width="match_parent" android:layout_height="match_parent"/>
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
|
||||
<!-- The pages, and over them in full screen the handle that says "swipe in from here". -->
|
||||
<!-- The pages, and over them in the Overview's full screen the way back: a faint handle at the edge
|
||||
in the app's full screen, a tab when the car's own sidebar takes the edge. -->
|
||||
<FrameLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1">
|
||||
<androidx.viewpager2.widget.ViewPager2 android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent"/>
|
||||
<View android:id="@+id/edge_handle" android:layout_width="5dp" android:layout_height="96dp" android:layout_gravity="start|center_vertical" android:layout_marginStart="4dp" android:background="@drawable/bg_edge_handle" android:alpha="0.35" android:visibility="gone"/>
|
||||
<ImageButton android:id="@+id/edge_tab" android:layout_width="48dp" android:layout_height="96dp" android:layout_gravity="start|center_vertical" android:background="@drawable/bg_edge_tab" android:src="@drawable/ic_chevron_right" android:paddingEnd="16dp" android:paddingStart="4dp" android:scaleType="center" android:visibility="gone" android:contentDescription="@string/overview_fullscreen_exit"/>
|
||||
</FrameLayout>
|
||||
<LinearLayout android:id="@+id/nav_bar" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="8dp" android:background="@drawable/bg_sidebar">
|
||||
<com.google.android.material.button.MaterialButton android:id="@+id/tabVehicle" style="@style/Widget.EV.NavTab.Compact" android:layout_width="0dp" android:layout_height="76dp" android:layout_weight="1" android:text="@string/tab_vehicle" app:icon="@drawable/ic_tab_vehicle"/>
|
||||
|
||||
@@ -132,6 +132,7 @@
|
||||
<string name="overview_style_mg">MG</string>
|
||||
<string name="accent_not_used">%1$s has its own colours. To change the accent colour, pick a style that uses it.</string>
|
||||
<string name="overview_fullscreen_enter">Overview full screen: hide the navigation</string>
|
||||
<string name="overview_fullscreen_exit">Show the navigation again</string>
|
||||
<string name="overview_style_minimal">Minimal</string>
|
||||
<string name="overview_style_terminal">Terminal</string>
|
||||
<string name="accent_original">Original</string>
|
||||
|
||||
Reference in New Issue
Block a user