fix: scale dot contrast + kiosk scale config panel + download banner in kiosk

style.css:
- Scale connected dot: bright #4ade80 fill + white border + double shadow
  so it pops on the dark green header (was white on green = invisible)

index.html:
- Scale settings tab: add kiosk panel with 'Riconfigura bilancia BLE'
  button (hidden in browser, shown in kiosk mode)
- Wrap gateway download section and WebSocket URL section with IDs
  so JS can hide them in kiosk mode
- CSS cache bust ?v=20260506b

app.js:
- syncSettingsFromDB: in kiosk mode hide scale gateway download section,
  WebSocket URL section and test button; show kiosk BLE panel instead;
  auto-set URL to ws://localhost:8765
- Add _kioskReconfigureScale() helper that calls _kioskBridge.reconfigureScale()

KioskActivity.kt:
- Add reconfigureScale() @JavascriptInterface: stops GatewayService,
  clears saved scale device prefs, launches SetupActivity at step 4
- Import GatewayService
This commit is contained in:
dadaloop82
2026-05-06 13:44:50 +00:00
parent f04e227cc0
commit 115c966322
4 changed files with 56 additions and 7 deletions
@@ -42,6 +42,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.google.android.material.button.MaterialButton
import it.dadaloop.evershelf.kiosk.scale.GatewayService
import org.json.JSONObject
import java.net.URL
import java.util.Locale
@@ -418,6 +419,23 @@ class KioskActivity : AppCompatActivity() {
fun stopSpeech() { tts?.stop() }
@JavascriptInterface
fun isTtsReady(): String = if (ttsReady) "true" else "false"
@JavascriptInterface
fun reconfigureScale() {
// Stop the BLE gateway service, clear saved scale device,
// and launch SetupActivity directly at step 4 (BLE scan)
runOnUiThread {
GatewayService.stop(this@KioskActivity)
prefs.edit()
.remove("scale_device_address")
.remove("scale_device_name")
.putBoolean("has_scale", false)
.putBoolean("setup_complete", false)
.apply()
val intent = Intent(this@KioskActivity, SetupActivity::class.java)
intent.putExtra("start_step", 4)
startActivity(intent)
}
}
}, "_kioskBridge")
val url = prefs.getString(KEY_URL, "http://evershelf.local") ?: "http://evershelf.local"