mirror of
https://github.com/screentinker/screentinker.git
synced 2026-06-22 05:54:02 -06:00
fix(android): make pairing code fit/visible on all screen sizes
Reported on a Pixel 10: the pairing code wasn't visible. The provisioning screen was a non-scrolling vertical stack, and when the pairing section appeared below the server-URL + Connect controls, the fixed 64sp code got pushed off-screen on short/landscape phones (and could clip horizontally on narrow widths). - Wrap the screen in a ScrollView (fillViewport) so content is always reachable. - pairingCodeText now auto-sizes (autoSizeTextType=uniform, 24-96sp, single line, match_parent width) so it fills the width and never clips - phones, TVs, sticks. - Hide the server-URL section + Connect button once paired so the code gets the full screen. Compile-checked + signed APK builds. Needs on-device confirmation (Pixel 10 / onn stick) that the code is now visible. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d41bd1f27d
commit
06c6c3214b
|
|
@ -34,6 +34,7 @@ class ProvisioningActivity : AppCompatActivity() {
|
|||
private lateinit var statusText: TextView
|
||||
private lateinit var progressBar: ProgressBar
|
||||
private lateinit var pairingSection: View
|
||||
private lateinit var serverSection: View
|
||||
|
||||
private val connection = object : ServiceConnection {
|
||||
override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
|
||||
|
|
@ -73,6 +74,7 @@ class ProvisioningActivity : AppCompatActivity() {
|
|||
statusText = findViewById(R.id.statusText)
|
||||
progressBar = findViewById(R.id.progressBar)
|
||||
pairingSection = findViewById(R.id.pairingSection)
|
||||
serverSection = findViewById(R.id.serverSection)
|
||||
|
||||
// Pre-fill if previously entered
|
||||
if (config.serverUrl.isNotEmpty()) {
|
||||
|
|
@ -135,6 +137,10 @@ class ProvisioningActivity : AppCompatActivity() {
|
|||
wsService?.onRegistered = { deviceId ->
|
||||
runOnUiThread {
|
||||
progressBar.visibility = View.GONE
|
||||
// Hide the server/connect controls so the pairing code has the
|
||||
// whole screen and stays visible on short/landscape phones.
|
||||
serverSection.visibility = View.GONE
|
||||
connectBtn.visibility = View.GONE
|
||||
pairingSection.visibility = View.VISIBLE
|
||||
pairingCodeText.text = wsService?.getPairingCode() ?: "------"
|
||||
statusText.text = "Enter this code in the dashboard to pair this display"
|
||||
|
|
|
|||
|
|
@ -1,12 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
<!-- Scrolls so content is always reachable on short screens; the pairing code
|
||||
auto-sizes to fit any screen width (phones, TVs, HD sticks). -->
|
||||
<ScrollView
|
||||
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:fillViewport="true"
|
||||
android:background="#111827">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:background="#111827"
|
||||
android:padding="48dp"
|
||||
android:padding="32dp"
|
||||
android:keepScreenOn="true">
|
||||
|
||||
<TextView
|
||||
|
|
@ -24,10 +32,11 @@
|
|||
android:text="Digital Signage Player"
|
||||
android:textColor="#94A3B8"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginBottom="48dp" />
|
||||
android:layout_marginBottom="32dp" />
|
||||
|
||||
<!-- Server URL Section -->
|
||||
<!-- Server URL Section (hidden once paired so the code has room) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/serverSection"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
|
|
@ -77,7 +86,7 @@
|
|||
<!-- Pairing Section (shown after connection) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/pairingSection"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
|
|
@ -91,19 +100,26 @@
|
|||
android:textSize="16sp"
|
||||
android:layout_marginBottom="12dp" />
|
||||
|
||||
<!-- Auto-sizes between 24sp and 96sp to fill the available width on a
|
||||
single line, so it's readable and never clipped on any screen. -->
|
||||
<TextView
|
||||
android:id="@+id/pairingCodeText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="------"
|
||||
android:textColor="#3B82F6"
|
||||
android:textSize="64sp"
|
||||
android:textStyle="bold"
|
||||
android:fontFamily="monospace"
|
||||
android:letterSpacing="0.3" />
|
||||
android:letterSpacing="0.3"
|
||||
android:maxLines="1"
|
||||
android:gravity="center"
|
||||
app:autoSizeTextType="uniform"
|
||||
app:autoSizeMinTextSize="24sp"
|
||||
app:autoSizeMaxTextSize="96sp"
|
||||
app:autoSizeStepGranularity="2sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Enter this code in the dashboard to pair this display"
|
||||
android:textColor="#64748B"
|
||||
|
|
@ -118,6 +134,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textColor="#94A3B8"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="16dp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
|
|||
Loading…
Reference in a new issue