fix: scale indicator, logo crop, gateway LAN IP, setup spacing

webapp:
- Scale indicator: replace plain green dot with ⚖️ emoji + colored
  status badge (green/amber/grey/red); icon fades out when disconnected;
  tap shows a toast with device name + battery level
- Logo images: crop excess transparent padding from logo.png and
  logo_icon.png so content fills the frame at small display sizes
- style.css: reworked .scale-status-indicator CSS for emoji+badge

kiosk:
- SetupActivity: use device's real LAN IP for scale_gateway_url
  (was hardcoded 127.0.0.1 — only worked if server and kiosk run on
  the same machine); added getDeviceLanIp() helper (prefers wlan/eth)
- activity_setup.xml: reduce welcome step padding/margins so step 1
  fits on screen without scrolling; text sizes slightly reduced
- activity_setup.xml: fix feature bullet 'Bilancia Bluetooth via
  Gateway app' → 'Bilancia BLE integrata (nessuna app esterna)'
- strings.xml (en + it): rewrite all wizard_gateway_* strings to
  reflect integrated BLE service instead of external gateway APK
- ic_logo.png: regenerated at all densities from cropped source
This commit is contained in:
dadaloop82
2026-05-05 17:47:54 +00:00
parent a5094920bf
commit 7ea5505a0d
14 changed files with 126 additions and 55 deletions
@@ -866,7 +866,10 @@ class SetupActivity : AppCompatActivity() {
val body = buildString {
append("{\"screensaver_enabled\":$screensaver")
if (hasScale) {
append(",\"scale_enabled\":true,\"scale_gateway_url\":\"ws://127.0.0.1:8765\"")
// Use the tablet's actual LAN IP so the EverShelf server
// (potentially on a different machine) can reach the gateway.
val lanIp = getDeviceLanIp() ?: "127.0.0.1"
append(",\"scale_enabled\":true,\"scale_gateway_url\":\"ws://$lanIp:8765\"")
}
append("}")
}
@@ -886,4 +889,32 @@ class SetupActivity : AppCompatActivity() {
setResult(RESULT_OK)
finish()
}
/**
* Returns the device's best LAN IPv4 address (Wi-Fi/Ethernet preferred).
* Skips loopback, VPN tunnels, and cellular interfaces.
*/
private fun getDeviceLanIp(): String? {
val skipPrefixes = listOf("tun", "ppp", "rmnet", "pdp", "v4-", "v6-", "ccmni", "sit", "gre")
var fallback: String? = null
try {
val ifaces = NetworkInterface.getNetworkInterfaces() ?: return null
while (ifaces.hasMoreElements()) {
val intf = ifaces.nextElement()
if (!intf.isUp || intf.isLoopback) continue
val name = intf.name.lowercase()
if (skipPrefixes.any { name.startsWith(it) }) continue
for (addr in intf.interfaceAddresses) {
val ip = addr.address
if (ip is java.net.Inet4Address && !ip.isLoopbackAddress) {
val ipStr = ip.hostAddress ?: continue
// Wi-Fi/Ethernet first
if (name.startsWith("wlan") || name.startsWith("eth")) return ipStr
if (fallback == null) fallback = ipStr
}
}
}
} catch (_: Exception) {}
return fallback
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 KiB

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 KiB

After

Width:  |  Height:  |  Size: 386 KiB

@@ -55,8 +55,8 @@
android:gravity="center_horizontal"
android:paddingStart="28dp"
android:paddingEnd="28dp"
android:paddingTop="32dp"
android:paddingBottom="40dp">
android:paddingTop="16dp"
android:paddingBottom="24dp">
<!-- ════════════════════════════════════════════
STEP 0 — Language selection
@@ -139,7 +139,7 @@
android:src="@drawable/ic_logo"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:layout_marginBottom="20dp"
android:layout_marginBottom="10dp"
android:contentDescription="EverShelf" />
<TextView
@@ -147,19 +147,19 @@
android:layout_height="wrap_content"
android:text="EverShelf Kiosk"
android:textColor="#f1f5f9"
android:textSize="30sp"
android:textSize="28sp"
android:textStyle="bold"
android:gravity="center"
android:layout_marginBottom="8dp" />
android:layout_marginBottom="4dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="La tua dispensa smart in cucina"
android:textColor="#7c3aed"
android:textSize="16sp"
android:textSize="15sp"
android:gravity="center"
android:layout_marginBottom="28dp" />
android:layout_marginBottom="16dp" />
<!-- What is EverShelf -->
<TextView
@@ -167,10 +167,10 @@
android:layout_height="wrap_content"
android:text="Trasforma il tuo tablet in un pannello da cucina sempre attivo. Gestisci la dispensa, scansiona i prodotti, ricevi suggerimenti intelligenti — tutto dal tuo server di casa."
android:textColor="#94a3b8"
android:textSize="15sp"
android:textSize="14sp"
android:gravity="center"
android:lineSpacingExtra="4dp"
android:layout_marginBottom="28dp" />
android:lineSpacingExtra="3dp"
android:layout_marginBottom="16dp" />
<!-- Privacy card (highlighted) -->
<LinearLayout
@@ -178,8 +178,8 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/card_background"
android:padding="20dp"
android:layout_marginBottom="24dp">
android:padding="16dp"
android:layout_marginBottom="16dp">
<TextView
android:layout_width="wrap_content"
@@ -265,9 +265,8 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/tip_background"
android:padding="16dp"
android:layout_marginBottom="32dp">
android:padding="14dp"
android:layout_marginBottom="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -289,7 +288,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="⚖️ Bilancia Bluetooth via Gateway app"
android:text="⚖️ Bilancia BLE integrata (nessuna app esterna)"
android:textColor="#cbd5e1"
android:textSize="14sp"
android:paddingTop="4dp"
@@ -17,21 +17,21 @@
<string name="setup_exit_cancel">Continua</string>
<!-- Wizard Step 3: Bilancia smart -->
<string name="wizard_step3_title">Bilancia Smart (Opzionale)</string>
<string name="wizard_step3_description">Per usare una bilancia da cucina Bluetooth, devi installare l\'app EverShelf Scale Gateway separatamente.</string>
<string name="wizard_step3_title">Bilancia Smart</string>
<string name="wizard_step3_description">EverShelf Kiosk include un gateway Bluetooth integrato — nessuna app esterna necessaria. Seleziona la tua bilancia qui sotto.</string>
<string name="wizard_step3_question">Hai una bilancia smart Bluetooth?</string>
<string name="wizard_step3_yes">✅ Sì, ho una bilancia</string>
<string name="wizard_step3_no">➡️ No, salta questo passaggio</string>
<!-- Messaggi stato gateway -->
<string name="wizard_gateway_installed">Scale Gateway installato</string>
<string name="wizard_gateway_installed_detail">Verrà avviato in background quando procedi.</string>
<string name="wizard_gateway_not_installed">Scale Gateway non installato</string>
<string name="wizard_gateway_not_installed_detail">Installa l\'app Scale Gateway per usare una bilancia Bluetooth.</string>
<string name="wizard_gateway_checking">Controllo aggiornamenti</string>
<string name="wizard_gateway_up_to_date">Scale Gateway è aggiornato.</string>
<string name="wizard_gateway_update_available">Aggiornamento disponibile per Scale Gateway</string>
<string name="wizard_gateway_update_detail">Tocca il pulsante qui sotto per aggiornarlo ora.</string>
<string name="wizard_gateway_installed">Bilancia salvata</string>
<string name="wizard_gateway_installed_detail">Il gateway BLE integrato si collegherà automaticamente all\'avvio.</string>
<string name="wizard_gateway_not_installed">Nessuna bilancia selezionata</string>
<string name="wizard_gateway_not_installed_detail">Scansiona le bilance BLE nelle vicinanze e tocca una per selezionarla.</string>
<string name="wizard_gateway_checking">Scansione bilance BLE in corso</string>
<string name="wizard_gateway_up_to_date">Servizio BLE bilancia pronto.</string>
<string name="wizard_gateway_update_available">Bilancia BLE trovata</string>
<string name="wizard_gateway_update_detail">Tocca la bilancia nell\'elenco per connettersi.</string>
<!-- Stati scaricamento / installazione -->
<string name="install_downloading">Scaricamento in corso…</string>
@@ -16,21 +16,21 @@
<string name="setup_exit_cancel">Continue</string>
<!-- Wizard Step 3: Smart scale -->
<string name="wizard_step3_title">Smart Scale (Optional)</string>
<string name="wizard_step3_description">To use a Bluetooth kitchen scale, you need the EverShelf Scale Gateway app installed separately.</string>
<string name="wizard_step3_title">Smart Scale</string>
<string name="wizard_step3_description">EverShelf Kiosk includes a built-in Bluetooth gateway — no external app needed. Select your scale below.</string>
<string name="wizard_step3_question">Do you have a Bluetooth smart scale?</string>
<string name="wizard_step3_yes">✅ Yes, I have a scale</string>
<string name="wizard_step3_no">➡️ No, skip this step</string>
<!-- Gateway status messages -->
<string name="wizard_gateway_installed">Scale Gateway installed ✅</string>
<string name="wizard_gateway_installed_detail">Will be launched in the background when you proceed.</string>
<string name="wizard_gateway_not_installed">Scale Gateway not installed</string>
<string name="wizard_gateway_not_installed_detail">Install the Scale Gateway app to use a Bluetooth scale.</string>
<string name="wizard_gateway_checking">Checking for updates…</string>
<string name="wizard_gateway_up_to_date">Scale Gateway is up to date.</string>
<string name="wizard_gateway_update_available">Update available for Scale Gateway</string>
<string name="wizard_gateway_update_detail">Tap the button below to update it now.</string>
<string name="wizard_gateway_installed">Scale device saved ✅</string>
<string name="wizard_gateway_installed_detail">The integrated BLE gateway will connect automatically on startup.</string>
<string name="wizard_gateway_not_installed">No scale selected</string>
<string name="wizard_gateway_not_installed_detail">Scan for nearby BLE scales and tap one to select it.</string>
<string name="wizard_gateway_checking">Scanning for BLE scales…</string>
<string name="wizard_gateway_up_to_date">Scale BLE service ready.</string>
<string name="wizard_gateway_update_available">BLE scale found</string>
<string name="wizard_gateway_update_detail">Tap the scale in the list to connect.</string>
<!-- Install / download progress states -->
<string name="install_downloading">Scaricamento in corso…</string>