chore: auto-merge develop → main
Triggered by: 84d2ff0 kiosk: improve wizard UX + gateway configurability
This commit is contained in:
@@ -11,8 +11,8 @@ android {
|
|||||||
applicationId = "it.dadaloop.evershelf.kiosk"
|
applicationId = "it.dadaloop.evershelf.kiosk"
|
||||||
minSdk = 24
|
minSdk = 24
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 6
|
versionCode = 7
|
||||||
versionName = "1.5.0"
|
versionName = "1.5.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
|
|||||||
+12
-1
@@ -70,6 +70,17 @@ class SettingsActivity : AppCompatActivity() {
|
|||||||
deviceView.text = "Install the Scale Gateway app to use a Bluetooth scale"
|
deviceView.text = "Install the Scale Gateway app to use a Bluetooth scale"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val btnConfigureGateway = findViewById<MaterialButton>(R.id.btnConfigureGateway)
|
||||||
|
if (gatewayInstalled) {
|
||||||
|
btnConfigureGateway.visibility = android.view.View.VISIBLE
|
||||||
|
btnConfigureGateway.setOnClickListener {
|
||||||
|
val intent = packageManager.getLaunchIntentForPackage(GATEWAY_PACKAGE)
|
||||||
|
if (intent != null) startActivity(intent)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
btnConfigureGateway.visibility = android.view.View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
// Back
|
// Back
|
||||||
findViewById<android.widget.ImageButton>(R.id.btnBack).setOnClickListener { finish() }
|
findViewById<android.widget.ImageButton>(R.id.btnBack).setOnClickListener { finish() }
|
||||||
|
|
||||||
@@ -79,7 +90,7 @@ class SettingsActivity : AppCompatActivity() {
|
|||||||
// Run wizard again
|
// Run wizard again
|
||||||
findViewById<MaterialButton>(R.id.btnRunWizard).setOnClickListener {
|
findViewById<MaterialButton>(R.id.btnRunWizard).setOnClickListener {
|
||||||
prefs.edit().putBoolean(KEY_SETUP_COMPLETE, false).apply()
|
prefs.edit().putBoolean(KEY_SETUP_COMPLETE, false).apply()
|
||||||
Toast.makeText(this, "Wizard will run on next launch", Toast.LENGTH_SHORT).show()
|
startActivity(Intent(this, SetupActivity::class.java))
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,8 @@ class SetupActivity : AppCompatActivity() {
|
|||||||
private lateinit var gatewayStatusIcon: TextView
|
private lateinit var gatewayStatusIcon: TextView
|
||||||
private lateinit var gatewayStatusText: TextView
|
private lateinit var gatewayStatusText: TextView
|
||||||
private lateinit var gatewayStatusDetail: TextView
|
private lateinit var gatewayStatusDetail: TextView
|
||||||
private lateinit var btnInstallGateway: MaterialButton
|
private lateinit var btnInstallGateway: MaterialButton
|
||||||
|
private lateinit var btnConfigureGateway: MaterialButton
|
||||||
private lateinit var gatewayProgressBar: ProgressBar
|
private lateinit var gatewayProgressBar: ProgressBar
|
||||||
private lateinit var gatewayProgressText: TextView
|
private lateinit var gatewayProgressText: TextView
|
||||||
private lateinit var step3NextButtons: LinearLayout
|
private lateinit var step3NextButtons: LinearLayout
|
||||||
@@ -212,9 +213,10 @@ class SetupActivity : AppCompatActivity() {
|
|||||||
gatewayInstallCard = findViewById(R.id.gatewayInstallCard)
|
gatewayInstallCard = findViewById(R.id.gatewayInstallCard)
|
||||||
gatewayStatusIcon = findViewById(R.id.gatewayStatusIcon)
|
gatewayStatusIcon = findViewById(R.id.gatewayStatusIcon)
|
||||||
gatewayStatusText = findViewById(R.id.gatewayStatusText)
|
gatewayStatusText = findViewById(R.id.gatewayStatusText)
|
||||||
gatewayStatusDetail = findViewById(R.id.gatewayStatusDetail)
|
gatewayStatusDetail = findViewById(R.id.gatewayStatusDetail)
|
||||||
btnInstallGateway = findViewById(R.id.btnInstallGateway)
|
btnInstallGateway = findViewById(R.id.btnInstallGateway)
|
||||||
gatewayProgressBar = findViewById(R.id.gatewayProgressBar)
|
btnConfigureGateway = findViewById(R.id.btnConfigureGateway)
|
||||||
|
gatewayProgressBar = findViewById(R.id.gatewayProgressBar)
|
||||||
gatewayProgressText = findViewById(R.id.gatewayProgressText)
|
gatewayProgressText = findViewById(R.id.gatewayProgressText)
|
||||||
step3NextButtons = findViewById(R.id.step3NextButtons)
|
step3NextButtons = findViewById(R.id.step3NextButtons)
|
||||||
|
|
||||||
@@ -281,6 +283,14 @@ class SetupActivity : AppCompatActivity() {
|
|||||||
pendingApkDownloadUrl = GATEWAY_DOWNLOAD_URL
|
pendingApkDownloadUrl = GATEWAY_DOWNLOAD_URL
|
||||||
triggerApkDownload(GATEWAY_DOWNLOAD_URL)
|
triggerApkDownload(GATEWAY_DOWNLOAD_URL)
|
||||||
}
|
}
|
||||||
|
btnConfigureGateway.setOnClickListener {
|
||||||
|
val intent = packageManager.getLaunchIntentForPackage(GATEWAY_PACKAGE)
|
||||||
|
if (intent != null) {
|
||||||
|
startActivity(intent)
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this, "Gateway non trovato", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
findViewById<MaterialButton>(R.id.btnScaleBack).setOnClickListener { showStep(3) }
|
findViewById<MaterialButton>(R.id.btnScaleBack).setOnClickListener { showStep(3) }
|
||||||
findViewById<MaterialButton>(R.id.btnScaleNext).setOnClickListener {
|
findViewById<MaterialButton>(R.id.btnScaleNext).setOnClickListener {
|
||||||
prefs.edit().putBoolean(KEY_HAS_SCALE, true).apply()
|
prefs.edit().putBoolean(KEY_HAS_SCALE, true).apply()
|
||||||
@@ -336,10 +346,20 @@ class SetupActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
// Reset scale step when entering it
|
// Reset scale step when entering it
|
||||||
if (step == 4) {
|
if (step == 4) {
|
||||||
scaleQuestionCard.visibility = View.VISIBLE
|
val scaleAlreadyConfiguredYes = prefs.contains(KEY_HAS_SCALE) && prefs.getBoolean(KEY_HAS_SCALE, false)
|
||||||
gatewayInfoCard.visibility = View.GONE
|
if (scaleAlreadyConfiguredYes) {
|
||||||
gatewayInstallCard.visibility = View.GONE
|
// User already confirmed they have a scale — skip the question
|
||||||
step3NextButtons.visibility = View.GONE
|
scaleQuestionCard.visibility = View.GONE
|
||||||
|
gatewayInfoCard.visibility = View.VISIBLE
|
||||||
|
gatewayInstallCard.visibility = View.VISIBLE
|
||||||
|
step3NextButtons.visibility = View.VISIBLE
|
||||||
|
checkGatewayStatus()
|
||||||
|
} else {
|
||||||
|
scaleQuestionCard.visibility = View.VISIBLE
|
||||||
|
gatewayInfoCard.visibility = View.GONE
|
||||||
|
gatewayInstallCard.visibility = View.GONE
|
||||||
|
step3NextButtons.visibility = View.GONE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build summary when entering done step
|
// Build summary when entering done step
|
||||||
@@ -682,15 +702,17 @@ class SetupActivity : AppCompatActivity() {
|
|||||||
gatewayStatusText.text = getString(R.string.wizard_gateway_installed)
|
gatewayStatusText.text = getString(R.string.wizard_gateway_installed)
|
||||||
gatewayStatusDetail.text = getString(R.string.wizard_gateway_installed_detail)
|
gatewayStatusDetail.text = getString(R.string.wizard_gateway_installed_detail)
|
||||||
gatewayStatusDetail.setTextColor(0xFF34d399.toInt())
|
gatewayStatusDetail.setTextColor(0xFF34d399.toInt())
|
||||||
btnInstallGateway.visibility = View.GONE
|
btnInstallGateway.visibility = View.GONE
|
||||||
gatewayProgressBar.visibility = View.GONE
|
btnConfigureGateway.visibility = View.VISIBLE
|
||||||
gatewayProgressText.visibility = View.GONE
|
gatewayProgressBar.visibility = View.GONE
|
||||||
|
gatewayProgressText.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
gatewayStatusIcon.text = "📲"
|
gatewayStatusIcon.text = "📲"
|
||||||
gatewayStatusText.text = getString(R.string.wizard_gateway_not_installed)
|
gatewayStatusText.text = getString(R.string.wizard_gateway_not_installed)
|
||||||
gatewayStatusDetail.text = getString(R.string.wizard_gateway_not_installed_detail)
|
gatewayStatusDetail.text = getString(R.string.wizard_gateway_not_installed_detail)
|
||||||
gatewayStatusDetail.setTextColor(0xFFfbbf24.toInt())
|
gatewayStatusDetail.setTextColor(0xFFfbbf24.toInt())
|
||||||
btnInstallGateway.visibility = View.VISIBLE
|
btnInstallGateway.visibility = View.VISIBLE
|
||||||
|
btnConfigureGateway.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,19 @@
|
|||||||
android:text="No scale connected"
|
android:text="No scale connected"
|
||||||
android:textColor="#64748b"
|
android:textColor="#64748b"
|
||||||
android:textSize="13sp" />
|
android:textSize="13sp" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btnConfigureGateway"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:text="⚙️ Apri Gateway per configurarlo"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||||
|
android:strokeColor="#34d399"
|
||||||
|
android:textColor="#34d399"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:visibility="gone" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- Screensaver Section -->
|
<!-- Screensaver Section -->
|
||||||
|
|||||||
@@ -905,6 +905,19 @@
|
|||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:backgroundTint="#7c3aed" />
|
android:backgroundTint="#7c3aed" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btnConfigureGateway"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:text="⚙️ Apri Gateway per configurarlo"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||||
|
android:strokeColor="#34d399"
|
||||||
|
android:textColor="#34d399"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:visibility="gone" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- Step 3 navigation (shown after YES) -->
|
<!-- Step 3 navigation (shown after YES) -->
|
||||||
|
|||||||
Reference in New Issue
Block a user