From 8405406d2203413be8166839bb64ba73b9b10ba2 Mon Sep 17 00:00:00 2001 From: darken Date: Fri, 20 Feb 2026 15:25:32 +0100 Subject: [PATCH] feat(popup): Redesign connection popup with Apple-inspired layout Large centered device graphics (64dp), vertically stacked battery info, adaptive width, rounded card with tonal close button. --- .../reaction/ui/popup/PopUpPodViewFactory.kt | 7 +- .../capod/reaction/ui/popup/PopUpWindow.kt | 12 +- .../layout/popup_notification_dual_pods.xml | 305 +++++++++--------- .../layout/popup_notification_single_pods.xml | 79 +++-- .../layout/popup_window_container_layout.xml | 29 +- app/src/main/res/values/styles.xml | 5 + 6 files changed, 233 insertions(+), 204 deletions(-) diff --git a/app/src/main/java/eu/darken/capod/reaction/ui/popup/PopUpPodViewFactory.kt b/app/src/main/java/eu/darken/capod/reaction/ui/popup/PopUpPodViewFactory.kt index a1beb5dd..f3f81f28 100644 --- a/app/src/main/java/eu/darken/capod/reaction/ui/popup/PopUpPodViewFactory.kt +++ b/app/src/main/java/eu/darken/capod/reaction/ui/popup/PopUpPodViewFactory.kt @@ -5,7 +5,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.appcompat.view.ContextThemeWrapper -import androidx.core.view.isInvisible +import androidx.core.view.isGone import androidx.core.view.isVisible import dagger.hilt.android.qualifiers.ApplicationContext import eu.darken.capod.R @@ -39,10 +39,9 @@ class PopUpPodViewFactory @Inject constructor( private fun createDualPods(parent: ViewGroup, device: DualPodDevice): View = PopupNotificationDualPodsBinding.inflate(layoutInflater, parent, false).apply { - podIcon.setImageResource(device.iconRes) podLabel.text = device.getLabel(context) signal.text = device.getSignalQuality(context) - signal.isInvisible = debugSettings.isDebugModeEnabled.value + signal.isGone = debugSettings.isDebugModeEnabled.value // Left val leftPercent = device.batteryLeftPodPercent @@ -71,7 +70,7 @@ class PopUpPodViewFactory @Inject constructor( headphonesIcon.setImageResource(device.iconRes) headphonesLabel.text = device.getLabel(context) signal.text = device.getSignalQuality(context) - signal.isInvisible = debugSettings.isDebugModeEnabled.value + signal.isGone = debugSettings.isDebugModeEnabled.value val headsetPercent = device.batteryHeadsetPercent headphonesBatteryIcon.setImageResource(getBatteryDrawable(headsetPercent)) diff --git a/app/src/main/java/eu/darken/capod/reaction/ui/popup/PopUpWindow.kt b/app/src/main/java/eu/darken/capod/reaction/ui/popup/PopUpWindow.kt index 3d0f0451..4a99c56b 100644 --- a/app/src/main/java/eu/darken/capod/reaction/ui/popup/PopUpWindow.kt +++ b/app/src/main/java/eu/darken/capod/reaction/ui/popup/PopUpWindow.kt @@ -32,13 +32,15 @@ class PopUpWindow @Inject constructor( private val windowManager = context.getSystemService(WINDOW_SERVICE) as WindowManager private val layoutParams = WindowManager.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, - WindowManager.LayoutParams.WRAP_CONTENT, // Display it on top of other application windows - WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, // Don't let it grab the input focus - WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, // Make the underlying application window visible - + WindowManager.LayoutParams.WRAP_CONTENT, + WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, + WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT ).apply { - gravity = Gravity.BOTTOM + gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL + val dm = appContext.resources.displayMetrics + val margin = (24 * dm.density).toInt() + width = minOf(dm.widthPixels - margin * 2, (400 * dm.density).toInt()) } private val popUpView: View = layoutInflater.inflate(R.layout.popup_window_container_layout, null).apply { findViewById(R.id.close_action).setOnClickListener { close() } diff --git a/app/src/main/res/layout/popup_notification_dual_pods.xml b/app/src/main/res/layout/popup_notification_dual_pods.xml index 92870ce5..9c944584 100644 --- a/app/src/main/res/layout/popup_notification_dual_pods.xml +++ b/app/src/main/res/layout/popup_notification_dual_pods.xml @@ -5,171 +5,184 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - - - + app:layout_constraintTop_toBottomOf="@id/pod_label" + tools:text="29%" /> - - - - - - - - - - - - - - - - - - - + app:layout_constraintStart_toEndOf="@id/signal" + app:layout_constraintTop_toTopOf="@id/signal" /> - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + app:layout_constraintStart_toEndOf="@id/pod_case_container" + app:layout_constraintTop_toTopOf="parent"> + + + + + + + + - - \ No newline at end of file + diff --git a/app/src/main/res/layout/popup_notification_single_pods.xml b/app/src/main/res/layout/popup_notification_single_pods.xml index b80146cd..cc743d5d 100644 --- a/app/src/main/res/layout/popup_notification_single_pods.xml +++ b/app/src/main/res/layout/popup_notification_single_pods.xml @@ -5,75 +5,84 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - + + + app:layout_constraintStart_toEndOf="@id/signal" + app:layout_constraintTop_toTopOf="@id/signal" /> + + + app:layout_constraintTop_toBottomOf="@id/headphones_icon"> + app:layout_constraintTop_toTopOf="parent" /> - - \ No newline at end of file + diff --git a/app/src/main/res/layout/popup_window_container_layout.xml b/app/src/main/res/layout/popup_window_container_layout.xml index 5571d4c2..6dc6998e 100644 --- a/app/src/main/res/layout/popup_window_container_layout.xml +++ b/app/src/main/res/layout/popup_window_container_layout.xml @@ -1,37 +1,38 @@ + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:cardCornerRadius="24dp" + app:cardElevation="8dp"> + android:layout_height="wrap_content" + android:paddingHorizontal="20dp" + android:paddingTop="20dp" + android:paddingBottom="16dp"> + app:layout_constraintTop_toTopOf="parent" /> - \ No newline at end of file + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 5e73c1c3..165f660c 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -48,6 +48,11 @@ 24dp + +