4897da571d
Wizard step 3 — 'Do you have a Bluetooth smart scale?':
- New question card with two buttons shown first:
✅ Yes → reveal gateway status card + bottom nav buttons
➡️ No → save KEY_HAS_SCALE=false, skip to web view
- KEY_HAS_SCALE pref controls whether the gateway is auto-launched
both after wizard completion and on every subsequent app start
- checkGatewayStatus(): uses string resources (multilingual)
- checkGatewayUpdate(): fetches GitHub release, compares version;
if gateway needs an update shows '📥 Update Scale Gateway' button
that triggers triggerApkDownload() (full PackageInstaller flow)
- onResume step-3 re-check only fires when status card is visible
(i.e. user already answered 'Yes') — handles return from install
Multi-language: strings.xml added for EN (default), IT, DE
strings: wizard_step3_question/yes/no, wizard_gateway_installed/
not_installed/checking/up_to_date/update_available/update_detail,
btn_back/launch/launch_no_scale/download_gateway/update_gateway
526 lines
23 KiB
XML
526 lines
23 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
android:background="#0f172a">
|
|
|
|
<!-- Splash screen (shown briefly on launch) -->
|
|
<LinearLayout
|
|
android:id="@+id/splashContainer"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
android:orientation="vertical"
|
|
android:gravity="center"
|
|
android:visibility="visible">
|
|
|
|
<ImageView
|
|
android:layout_width="120dp"
|
|
android:layout_height="120dp"
|
|
android:src="@drawable/ic_launcher_foreground"
|
|
android:layout_marginBottom="24dp"
|
|
android:contentDescription="EverShelf" />
|
|
|
|
<TextView
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:text="EverShelf"
|
|
android:textColor="#f1f5f9"
|
|
android:textSize="32sp"
|
|
android:textStyle="bold"
|
|
android:layout_marginBottom="8dp" />
|
|
|
|
<TextView
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:text="Smart Pantry Manager"
|
|
android:textColor="#64748b"
|
|
android:textSize="16sp"
|
|
android:layout_marginBottom="48dp" />
|
|
|
|
<ProgressBar
|
|
android:layout_width="32dp"
|
|
android:layout_height="32dp"
|
|
android:indeterminateTint="#7c3aed" />
|
|
</LinearLayout>
|
|
|
|
<!-- Setup wizard container -->
|
|
<ScrollView
|
|
android:id="@+id/wizardContainer"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
android:visibility="gone"
|
|
android:fillViewport="true">
|
|
|
|
<LinearLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="vertical"
|
|
android:gravity="center_horizontal"
|
|
android:paddingStart="32dp"
|
|
android:paddingEnd="32dp"
|
|
android:paddingTop="48dp"
|
|
android:paddingBottom="48dp">
|
|
|
|
<!-- Step indicator -->
|
|
<LinearLayout
|
|
android:id="@+id/stepIndicator"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="horizontal"
|
|
android:layout_marginBottom="40dp"
|
|
android:gravity="center" />
|
|
|
|
<!-- Step 1: Welcome -->
|
|
<LinearLayout
|
|
android:id="@+id/step1"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="vertical"
|
|
android:gravity="center_horizontal"
|
|
android:visibility="visible">
|
|
|
|
<ImageView
|
|
android:layout_width="96dp"
|
|
android:layout_height="96dp"
|
|
android:src="@drawable/ic_launcher_foreground"
|
|
android:layout_marginBottom="16dp"
|
|
android:contentDescription="EverShelf" />
|
|
|
|
<TextView
|
|
android:id="@+id/wizardTitle"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:text="Welcome to\nEverShelf Kiosk"
|
|
android:textColor="#f1f5f9"
|
|
android:textSize="28sp"
|
|
android:textStyle="bold"
|
|
android:gravity="center"
|
|
android:lineSpacingExtra="4dp"
|
|
android:layout_marginBottom="16dp" />
|
|
|
|
<TextView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:text="Turn this tablet into a dedicated kitchen panel for your smart pantry. Always-on display with built-in smart scale support."
|
|
android:textColor="#94a3b8"
|
|
android:textSize="16sp"
|
|
android:gravity="center"
|
|
android:lineSpacingExtra="6dp"
|
|
android:layout_marginBottom="48dp" />
|
|
|
|
<!-- Feature highlights -->
|
|
<LinearLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="vertical"
|
|
android:layout_marginBottom="48dp">
|
|
|
|
<TextView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:text="📺 Full-screen kiosk mode"
|
|
android:textColor="#cbd5e1"
|
|
android:textSize="15sp"
|
|
android:paddingTop="8dp"
|
|
android:paddingBottom="8dp" />
|
|
|
|
<TextView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:text="⚖️ Bluetooth scale via Gateway app"
|
|
android:textColor="#cbd5e1"
|
|
android:textSize="15sp"
|
|
android:paddingTop="8dp"
|
|
android:paddingBottom="8dp" />
|
|
|
|
<TextView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:text="🔋 Always-on, screen never sleeps"
|
|
android:textColor="#cbd5e1"
|
|
android:textSize="15sp"
|
|
android:paddingTop="8dp"
|
|
android:paddingBottom="8dp" />
|
|
|
|
<TextView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:text="📷 Barcode scanning from WebView"
|
|
android:textColor="#cbd5e1"
|
|
android:textSize="15sp"
|
|
android:paddingTop="8dp"
|
|
android:paddingBottom="8dp" />
|
|
</LinearLayout>
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/btnGetStarted"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="56dp"
|
|
android:text="Get Started"
|
|
android:textSize="17sp"
|
|
android:textAllCaps="false"
|
|
android:backgroundTint="#7c3aed" />
|
|
</LinearLayout>
|
|
|
|
<!-- Step 2: Server URL -->
|
|
<LinearLayout
|
|
android:id="@+id/step2"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="vertical"
|
|
android:gravity="center_horizontal"
|
|
android:visibility="gone">
|
|
|
|
<TextView
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:text="🌐"
|
|
android:textSize="48sp"
|
|
android:layout_marginBottom="16dp" />
|
|
|
|
<TextView
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:text="Connect to EverShelf"
|
|
android:textColor="#f1f5f9"
|
|
android:textSize="24sp"
|
|
android:textStyle="bold"
|
|
android:layout_marginBottom="8dp" />
|
|
|
|
<TextView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:text="Enter the URL of your EverShelf server. This is the same address you use in your browser."
|
|
android:textColor="#94a3b8"
|
|
android:textSize="15sp"
|
|
android:gravity="center"
|
|
android:lineSpacingExtra="4dp"
|
|
android:layout_marginBottom="32dp" />
|
|
|
|
<TextView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:text="Server URL"
|
|
android:textColor="#cbd5e1"
|
|
android:textSize="13sp"
|
|
android:textStyle="bold"
|
|
android:layout_marginBottom="8dp" />
|
|
|
|
<EditText
|
|
android:id="@+id/wizardUrl"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:hint="https://192.168.1.100/dispensa/"
|
|
android:inputType="textUri"
|
|
android:textColor="#f1f5f9"
|
|
android:textColorHint="#475569"
|
|
android:background="@drawable/input_background"
|
|
android:padding="16dp"
|
|
android:textSize="16sp"
|
|
android:singleLine="true"
|
|
android:layout_marginBottom="12dp" />
|
|
|
|
<TextView
|
|
android:id="@+id/urlStatus"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:text=""
|
|
android:textSize="13sp"
|
|
android:visibility="gone"
|
|
android:layout_marginBottom="12dp" />
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/btnTestUrl"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="48dp"
|
|
android:text="🔗 Test Connection"
|
|
android:textSize="15sp"
|
|
android:textAllCaps="false"
|
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
|
android:strokeColor="#334155"
|
|
android:textColor="#94a3b8"
|
|
android:layout_marginBottom="24dp" />
|
|
|
|
<TextView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:text="💡 Tip: Copy the exact URL from your browser address bar — including the path (e.g. /dispensa/)."
|
|
android:textColor="#64748b"
|
|
android:textSize="13sp"
|
|
android:lineSpacingExtra="2dp"
|
|
android:background="@drawable/tip_background"
|
|
android:padding="14dp"
|
|
android:layout_marginBottom="32dp" />
|
|
|
|
<LinearLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="horizontal"
|
|
android:gravity="center">
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/btnStep2Back"
|
|
android:layout_width="0dp"
|
|
android:layout_height="48dp"
|
|
android:layout_weight="1"
|
|
android:text="Back"
|
|
android:textSize="15sp"
|
|
android:textAllCaps="false"
|
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
|
android:strokeColor="#334155"
|
|
android:textColor="#94a3b8"
|
|
android:layout_marginEnd="12dp" />
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/btnStep2Next"
|
|
android:layout_width="0dp"
|
|
android:layout_height="48dp"
|
|
android:layout_weight="2"
|
|
android:text="Next →"
|
|
android:textSize="15sp"
|
|
android:textAllCaps="false"
|
|
android:backgroundTint="#7c3aed" />
|
|
</LinearLayout>
|
|
</LinearLayout>
|
|
|
|
<!-- Step 3: Scale Setup -->
|
|
<LinearLayout
|
|
android:id="@+id/step3"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="vertical"
|
|
android:gravity="center_horizontal"
|
|
android:visibility="gone">
|
|
|
|
<TextView
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:text="⚖️"
|
|
android:textSize="48sp"
|
|
android:layout_marginBottom="16dp" />
|
|
|
|
<TextView
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:text="@string/wizard_step3_title"
|
|
android:textColor="#f1f5f9"
|
|
android:textSize="24sp"
|
|
android:textStyle="bold"
|
|
android:layout_marginBottom="8dp" />
|
|
|
|
<TextView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:text="@string/wizard_step3_description"
|
|
android:textColor="#94a3b8"
|
|
android:textSize="15sp"
|
|
android:gravity="center"
|
|
android:lineSpacingExtra="4dp"
|
|
android:layout_marginBottom="24dp" />
|
|
|
|
<!-- Scale question card — shown first, hidden after answer -->
|
|
<LinearLayout
|
|
android:id="@+id/scaleQuestionLayout"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="vertical"
|
|
android:background="@drawable/card_background"
|
|
android:padding="20dp"
|
|
android:layout_marginBottom="16dp">
|
|
|
|
<TextView
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:text="@string/wizard_step3_question"
|
|
android:textColor="#f1f5f9"
|
|
android:textSize="17sp"
|
|
android:textStyle="bold"
|
|
android:gravity="center"
|
|
android:layout_marginBottom="20dp" />
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/btnScaleYes"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="52dp"
|
|
android:text="@string/wizard_step3_yes"
|
|
android:textSize="15sp"
|
|
android:textAllCaps="false"
|
|
android:backgroundTint="#059669"
|
|
android:layout_marginBottom="10dp" />
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/btnScaleNo"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="52dp"
|
|
android:text="@string/wizard_step3_no"
|
|
android:textSize="15sp"
|
|
android:textAllCaps="false"
|
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
|
android:strokeColor="#334155"
|
|
android:textColor="#94a3b8" />
|
|
</LinearLayout>
|
|
|
|
<!-- Scale status card — shown after user answers "Yes" -->
|
|
<LinearLayout
|
|
android:id="@+id/scaleStatusCard"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="vertical"
|
|
android:background="@drawable/card_background"
|
|
android:padding="20dp"
|
|
android:layout_marginBottom="16dp"
|
|
android:visibility="gone">
|
|
|
|
<TextView
|
|
android:id="@+id/scaleStatusIcon"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:text="🔍"
|
|
android:textSize="32sp"
|
|
android:layout_gravity="center"
|
|
android:layout_marginBottom="8dp" />
|
|
|
|
<TextView
|
|
android:id="@+id/scaleStatusText"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:text="Checking..."
|
|
android:textColor="#cbd5e1"
|
|
android:textSize="16sp"
|
|
android:gravity="center"
|
|
android:layout_marginBottom="4dp" />
|
|
|
|
<TextView
|
|
android:id="@+id/scaleStatusDetail"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:text=""
|
|
android:textColor="#64748b"
|
|
android:textSize="13sp"
|
|
android:gravity="center" />
|
|
</LinearLayout>
|
|
|
|
<!-- Bottom nav (Back / Launch) — hidden until user answers the question -->
|
|
<LinearLayout
|
|
android:id="@+id/step3BottomButtons"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="horizontal"
|
|
android:gravity="center"
|
|
android:layout_marginTop="16dp"
|
|
android:visibility="gone">
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/btnStep3Back"
|
|
android:layout_width="0dp"
|
|
android:layout_height="48dp"
|
|
android:layout_weight="1"
|
|
android:text="@string/btn_back"
|
|
android:textSize="15sp"
|
|
android:textAllCaps="false"
|
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
|
android:strokeColor="#334155"
|
|
android:textColor="#94a3b8"
|
|
android:layout_marginEnd="12dp" />
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/btnFinish"
|
|
android:layout_width="0dp"
|
|
android:layout_height="56dp"
|
|
android:layout_weight="2"
|
|
android:text="@string/btn_launch"
|
|
android:textSize="16sp"
|
|
android:textAllCaps="false"
|
|
android:backgroundTint="#059669" />
|
|
</LinearLayout>
|
|
|
|
<!-- Install/Update gateway button — shown by checkGatewayStatus() as needed -->
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/btnSkipScale"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:textSize="14sp"
|
|
android:textAllCaps="false"
|
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
|
android:strokeColor="#7c3aed"
|
|
android:textColor="#a78bfa"
|
|
android:layout_marginTop="12dp"
|
|
android:visibility="gone" />
|
|
</LinearLayout>
|
|
|
|
</LinearLayout>
|
|
</ScrollView>
|
|
|
|
<!-- WebView (shown after setup) -->
|
|
<WebView
|
|
android:id="@+id/webView"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
android:visibility="gone" />
|
|
|
|
<!-- Settings gear (shown after setup, over WebView) -->
|
|
<ImageButton
|
|
android:id="@+id/btnSettings"
|
|
android:layout_width="44dp"
|
|
android:layout_height="44dp"
|
|
android:layout_gravity="bottom|start"
|
|
android:layout_marginBottom="70dp"
|
|
android:layout_marginStart="8dp"
|
|
android:background="@android:color/transparent"
|
|
android:src="@android:drawable/ic_menu_manage"
|
|
android:alpha="0.12"
|
|
android:contentDescription="Settings"
|
|
android:scaleType="centerInside"
|
|
android:visibility="gone" />
|
|
|
|
<!-- ── Update banner (shown at the TOP when a new version is available) ── -->
|
|
<LinearLayout
|
|
android:id="@+id/updateBanner"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_gravity="top"
|
|
android:orientation="horizontal"
|
|
android:background="#1e293b"
|
|
android:paddingStart="16dp"
|
|
android:paddingEnd="8dp"
|
|
android:paddingTop="10dp"
|
|
android:paddingBottom="10dp"
|
|
android:gravity="center_vertical"
|
|
android:visibility="gone">
|
|
|
|
<TextView
|
|
android:id="@+id/tvUpdateMessage"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:layout_weight="1"
|
|
android:textColor="#fbbf24"
|
|
android:textSize="13sp"
|
|
android:text=""
|
|
android:drawablePadding="6dp" />
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/btnInstallUpdate"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginStart="8dp"
|
|
android:text="⬇ Scarica"
|
|
android:textSize="12sp"
|
|
android:textColor="#1e293b"
|
|
android:backgroundTint="#fbbf24"
|
|
style="@style/Widget.MaterialComponents.Button" />
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/btnDismissUpdate"
|
|
android:layout_width="36dp"
|
|
android:layout_height="36dp"
|
|
android:layout_marginStart="4dp"
|
|
android:text="✕"
|
|
android:textSize="14sp"
|
|
android:textColor="#94a3b8"
|
|
android:backgroundTint="@android:color/transparent"
|
|
style="@style/Widget.MaterialComponents.Button.TextButton" />
|
|
|
|
</LinearLayout>
|
|
|
|
</FrameLayout>
|