Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion controller/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
android:exported="false"
android:configChanges="orientation|screenSize"
android:hardwareAccelerated="true"
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"/>
android:theme="@style/Theme.K2Go"/> <!-- ADFA-4886: Material 3 DayNight + app typography for the WebView chrome -->

<activity
android:name="com.journeyapps.barcodescanner.CaptureActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import android.graphics.Bitmap;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.content.Intent;
import android.os.Handler;
Expand Down Expand Up @@ -95,14 +95,14 @@ protected void onCreate(Bundle savedInstanceState) {
webView.setGestureLogging(BuildConfig.DEBUG);

LinearLayout bottomNav = findViewById(R.id.bottomNav);
Button btnHandle = findViewById(R.id.btnHandle); // The new handle
Button btnHideNav = findViewById(R.id.btnHideNav); // Button to close
ImageButton btnHandle = findViewById(R.id.btnHandle); // The new handle
ImageButton btnHideNav = findViewById(R.id.btnHideNav); // Button to close

Button btnBack = findViewById(R.id.btnBack);
Button btnHome = findViewById(R.id.btnHome);
Button btnReload = findViewById(R.id.btnReload);
Button btnExit = findViewById(R.id.btnExit);
Button btnForward = findViewById(R.id.btnForward);
ImageButton btnBack = findViewById(R.id.btnBack);
ImageButton btnHome = findViewById(R.id.btnHome);
ImageButton btnReload = findViewById(R.id.btnReload);
ImageButton btnExit = findViewById(R.id.btnExit);
ImageButton btnForward = findViewById(R.id.btnForward);

// --- NAV BAR (auto-hide after inactivity) ---
// Visible on entry; hides after AUTO_HIDE_MS with no interaction, measured from the LAST
Expand Down Expand Up @@ -206,14 +206,16 @@ public boolean shouldOverrideUrlLoading(WebView view, android.webkit.WebResource
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
vm.setLoading(true);
btnReload.setText("✕"); // Change to Stop
btnReload.setImageResource(R.drawable.ic_stop); // Change to Stop
btnReload.setContentDescription(getString(R.string.k2go_nav_stop));
}

@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
vm.setLoading(false);
btnReload.setText("↻"); // Back to Reload
btnReload.setImageResource(R.drawable.ic_refresh); // Back to Reload
btnReload.setContentDescription(getString(R.string.k2go_nav_reload));
view.getSettings().setCacheMode(android.webkit.WebSettings.LOAD_DEFAULT);

// Touch diagnostics + best-effort MapLibre pitch enablement.
Expand All @@ -228,13 +230,15 @@ public void onReceivedError(WebView view, android.webkit.WebResourceRequest requ
super.onReceivedError(view, request, error);
if (request.isForMainFrame()) {
String customErrorHtml = "<html><body style='background-color:#1A1A1A;color:#FFFFFF;text-align:center;padding-top:50px;font-family:sans-serif;'>"
+ "<h2>⚠️ Connection Failed</h2>"
+ "<p>Unable to reach the secure environment.</p>"
+ "<p style='color:#888;font-size:12px;'>Error: " + error.getDescription() + "</p>"
+ "<h2>⚠️ " + getString(R.string.k2go_portal_error_title) + "</h2>"
+ "<p>" + getString(R.string.k2go_portal_error_body) + "</p>"
+ "<p style='color:#888;font-size:12px;'>"
+ getString(R.string.k2go_portal_error_detail, error.getDescription()) + "</p>"
+ "</body></html>";
view.loadData(customErrorHtml, "text/html", "UTF-8");
vm.setLoading(false);
btnReload.setText("↻");
btnReload.setImageResource(R.drawable.ic_refresh);
btnReload.setContentDescription(getString(R.string.k2go_nav_reload));
}
}
});
Expand Down
16 changes: 16 additions & 0 deletions controller/app/src/main/res/drawable/bg_nav_handle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- ADFA-4886: collapsed-bar handle. The visible tab (the bar's own colorSurfaceContainer surface
with rounded top corners) is drawn only in the bottom strip via a top inset, so the button can
be a full 48dp-tall touch target (a11y minimum) while still looking like a slim peeking tab. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="20dp">
<shape android:shape="rectangle">
<solid android:color="?attr/colorSurfaceContainer" />
<corners
android:topLeftRadius="14dp"
android:topRightRadius="14dp"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp" />
</shape>
</item>
</layer-list>
7 changes: 7 additions & 0 deletions controller/app/src/main/res/drawable/ic_arrow_right.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:height="24dp"
android:viewportWidth="24" android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path android:fillColor="#FF000000"
android:pathData="M12,4l-1.41,1.41L16.17,11H4v2h12.17l-5.58,5.59L12,20l8,-8z"/>
</vector>
7 changes: 7 additions & 0 deletions controller/app/src/main/res/drawable/ic_expand_more.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:height="24dp"
android:viewportWidth="24" android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path android:fillColor="#FF000000"
android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z"/>
</vector>
7 changes: 7 additions & 0 deletions controller/app/src/main/res/drawable/ic_fullscreen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:height="24dp"
android:viewportWidth="24" android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path android:fillColor="#FF000000"
android:pathData="M7,14H5v5h5v-2H7v-3zM5,10h2V7h3V5H5v5zM17,17h-3v2h5v-5h-2v3zM14,5v2h3v3h2V5h-5z"/>
</vector>
7 changes: 7 additions & 0 deletions controller/app/src/main/res/drawable/ic_nav_grabber.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp" android:height="24dp"
android:viewportWidth="32" android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path android:fillColor="#FF000000"
android:pathData="M8,10h16a2,2 0 0 1 0,4h-16a2,2 0 0 1 0,-4z"/>
</vector>
7 changes: 7 additions & 0 deletions controller/app/src/main/res/drawable/ic_refresh.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:height="24dp"
android:viewportWidth="24" android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path android:fillColor="#FF000000"
android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z"/>
</vector>
7 changes: 7 additions & 0 deletions controller/app/src/main/res/drawable/ic_stop.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:height="24dp"
android:viewportWidth="24" android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path android:fillColor="#FF000000"
android:pathData="M6,6h12v12H6z"/>
</vector>
117 changes: 66 additions & 51 deletions controller/app/src/main/res/layout/activity_portal.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/colorBackground">
android:background="?attr/colorSurface">

<!-- WebView (Web page content handles its own background,
but you can force a dark theme in Java using WebSettings.setForceDark) -->
Expand All @@ -11,98 +12,112 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />

<Button
<!-- ADFA-4886: nav chrome uses Material 3 vector icons + theme attributes (system day/night)
instead of emoji/glyph text buttons. Icon-only buttons carry a contentDescription. -->
<!-- Collapsed-bar handle: a Material 3 tab of the bar's own surface with a drag grabber,
so it reads as the nav bar peeking from the bottom edge rather than a separate button. -->
<ImageButton
android:id="@+id/btnHandle"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_width="56dp"
android:layout_height="48dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:alpha="0.8"
android:background="?android:attr/colorButtonNormal"
android:padding="0dp"
android:stateListAnimator="@null"
android:text="⌃"
android:textColor="?android:attr/textColorPrimary"
android:textSize="18sp" />
android:background="@drawable/bg_nav_handle"
android:contentDescription="@string/k2go_nav_show_bar"
android:elevation="8dp"
android:paddingTop="20dp"
android:scaleType="center"
app:tint="?attr/colorOnSurfaceVariant"
app:srcCompat="@drawable/ic_nav_grabber" />

<LinearLayout
android:id="@+id/bottomNav"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="?android:attr/colorBackgroundFloating"
android:background="?attr/colorSurfaceContainer"
android:orientation="vertical"
android:visibility="invisible"
android:elevation="8dp">

<Button
<ImageButton
android:id="@+id/btnHideNav"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="?android:attr/selectableItemBackground"
android:text="⌄"
android:textSize="20sp"
android:textColor="?android:attr/textColorSecondary"
android:stateListAnimator="@null" />
android:background="?attr/selectableItemBackground"
android:contentDescription="@string/k2go_nav_hide_bar"
android:padding="4dp"
android:scaleType="fitCenter"
app:tint="?attr/colorOnSurfaceVariant"
app:srcCompat="@drawable/ic_expand_more" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="8dp">

<Button
<ImageButton
android:id="@+id/btnBack"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:layout_weight="1"
android:text="◀"
android:textSize="20sp"
style="?android:attr/buttonBarButtonStyle"
android:textColor="?android:attr/textColorPrimary" />
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/k2go_nav_back"
android:padding="12dp"
android:scaleType="fitCenter"
app:tint="?attr/colorOnSurface"
app:srcCompat="@drawable/ic_arrow_left" />

<!-- ADFA-4887: repurposed as a Fullscreen toggle (no in-WebView home page anymore).
Material 3 icon + contentDescription land in ADFA-4886. -->
<Button
<!-- ADFA-4887: repurposed as a Fullscreen toggle (no in-WebView home page anymore). -->
<ImageButton
android:id="@+id/btnHome"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:layout_weight="1"
android:text="⛶"
android:textSize="20sp"
style="?android:attr/buttonBarButtonStyle"
android:textColor="?android:attr/textColorPrimary" />
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/k2go_nav_fullscreen"
android:padding="12dp"
android:scaleType="fitCenter"
app:tint="?attr/colorOnSurface"
app:srcCompat="@drawable/ic_fullscreen" />

<Button
<ImageButton
android:id="@+id/btnReload"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:layout_weight="1"
android:text="↻"
android:textSize="20sp"
style="?android:attr/buttonBarButtonStyle"
android:textColor="?android:attr/textColorPrimary" />
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/k2go_nav_reload"
android:padding="12dp"
android:scaleType="fitCenter"
app:tint="?attr/colorOnSurface"
app:srcCompat="@drawable/ic_refresh" />

<Button
<ImageButton
android:id="@+id/btnExit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:layout_weight="1"
android:text="✖"
android:textSize="20sp"
style="?android:attr/buttonBarButtonStyle"
android:textColor="#D32F2F" /> <!-- Red is universal alert color -->
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/k2go_nav_exit"
android:padding="12dp"
android:scaleType="fitCenter"
app:tint="@color/k2go_nav_exit"
app:srcCompat="@drawable/ic_close_24" /> <!-- Red is the universal alert color -->

<Button
<ImageButton
android:id="@+id/btnForward"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:layout_weight="1"
android:text="▶"
android:textSize="20sp"
style="?android:attr/buttonBarButtonStyle"
android:textColor="?android:attr/textColorPrimary" />
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/k2go_nav_forward"
android:padding="12dp"
android:scaleType="fitCenter"
app:tint="?attr/colorOnSurface"
app:srcCompat="@drawable/ic_arrow_right" />
</LinearLayout>

</LinearLayout>
</RelativeLayout>
</RelativeLayout>
4 changes: 4 additions & 0 deletions controller/app/src/main/res/values/colors_k2go.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@
<color name="k2go_cover_6">#4A5568</color> <!-- slate -->
<color name="k2go_band_library">#2E9E5B</color> <!-- green band: already in your books -->
<color name="k2go_band_selected">#4A504E</color> <!-- gray band: selected to add -->

<!-- ADFA-4886: WebView nav "Exit" tint. Red is the universal alert/exit color; kept fixed in
both light and dark (no values-night override) so the exit affordance always reads the same. -->
<color name="k2go_nav_exit">#D32F2F</color>
</resources>
14 changes: 14 additions & 0 deletions controller/app/src/main/res/values/strings_k2go.xml
Original file line number Diff line number Diff line change
Expand Up @@ -529,4 +529,18 @@
<string name="k2go_fqr_delete" translatable="false">Delete</string>
<string name="k2go_fqr_deleted" translatable="false">Deleted “%1$s”</string>
<string name="k2go_fqr_delete_failed" translatable="false">Delete failed</string>

<!-- ADFA-4886: WebView nav bar (icon-only buttons) contentDescription + error page.
translatable=false until the l10n pass, matching the rest of this file. -->
<string name="k2go_nav_back" translatable="false">Back</string>
<string name="k2go_nav_forward" translatable="false">Forward</string>
<string name="k2go_nav_fullscreen" translatable="false">Fullscreen</string>
<string name="k2go_nav_reload" translatable="false">Reload</string>
<string name="k2go_nav_stop" translatable="false">Stop loading</string>
<string name="k2go_nav_exit" translatable="false">Exit</string>
<string name="k2go_nav_show_bar" translatable="false">Show navigation bar</string>
<string name="k2go_nav_hide_bar" translatable="false">Hide navigation bar</string>
<string name="k2go_portal_error_title" translatable="false">Connection Failed</string>
<string name="k2go_portal_error_body" translatable="false">Unable to reach the secure environment.</string>
<string name="k2go_portal_error_detail" translatable="false">Error: %1$s</string>
</resources>