diff options
| author | Dirk Sierd de Vries <contact@lecapuchon.nl> | 2026-08-12 15:20:14 +0200 |
|---|---|---|
| committer | Dirk Sierd de Vries <contact@lecapuchon.nl> | 2026-08-12 15:20:14 +0200 |
| commit | a47c52e829fc2740e0bc1855a2ca1743500ad28e (patch) | |
| tree | 3a3d7714809c83f1c62e43e93860e63fef8e19fc /app | |
| parent | 914c72ac29ed945befa57aff60f16595b29474c6 (diff) | |
| download | SidePhOnelauncher-a47c52e829fc2740e0bc1855a2ca1743500ad28e.tar.gz SidePhOnelauncher-a47c52e829fc2740e0bc1855a2ca1743500ad28e.tar.bz2 SidePhOnelauncher-a47c52e829fc2740e0bc1855a2ca1743500ad28e.zip | |
Improve home and drawer focus highlight styling
Diffstat (limited to 'app')
| -rw-r--r-- | app/src/main/java/app/sidephonelauncher/ui/AppDrawerAdapter.kt | 29 | ||||
| -rw-r--r-- | app/src/main/java/app/sidephonelauncher/ui/HomeAppTextView.kt | 23 | ||||
| -rw-r--r-- | app/src/main/java/app/sidephonelauncher/ui/HomeFragment.kt | 114 | ||||
| -rw-r--r-- | app/src/main/res/color/icon_tint_focus_inverted.xml | 7 | ||||
| -rw-r--r-- | app/src/main/res/color/text_focus_inverted.xml | 7 | ||||
| -rw-r--r-- | app/src/main/res/drawable/bg_focus_inverted.xml | 6 | ||||
| -rw-r--r-- | app/src/main/res/drawable/bg_focus_inverted_selector.xml | 7 | ||||
| -rw-r--r-- | app/src/main/res/layout-land/fragment_home.xml | 52 | ||||
| -rw-r--r-- | app/src/main/res/layout/adapter_app_drawer.xml | 18 | ||||
| -rw-r--r-- | app/src/main/res/layout/fragment_home.xml | 20 | ||||
| -rw-r--r-- | app/src/main/res/values-night/styles.xml | 20 | ||||
| -rw-r--r-- | app/src/main/res/values/styles.xml | 20 |
12 files changed, 276 insertions, 47 deletions
diff --git a/app/src/main/java/app/sidephonelauncher/ui/AppDrawerAdapter.kt b/app/src/main/java/app/sidephonelauncher/ui/AppDrawerAdapter.kt index bedf0e9..10c5a41 100644 --- a/app/src/main/java/app/sidephonelauncher/ui/AppDrawerAdapter.kt +++ b/app/src/main/java/app/sidephonelauncher/ui/AppDrawerAdapter.kt @@ -93,6 +93,7 @@ class AppDrawerAdapter( false ) ) + VIEW_TYPE_SPACER -> SpacerViewHolder( AdapterAppDrawerSpacerBinding.inflate( LayoutInflater.from(parent.context), @@ -100,6 +101,7 @@ class AppDrawerAdapter( false ) ) + else -> ViewHolder( AdapterAppDrawerBinding.inflate( LayoutInflater.from(parent.context), @@ -122,6 +124,7 @@ class AppDrawerAdapter( privateSpaceSettingsListener, ) } + is ViewHolder -> holder.bind( flag, appLabelGravity, @@ -135,6 +138,7 @@ class AppDrawerAdapter( appLeftListener, appBackListener, ) + is SpacerViewHolder -> Unit } } catch (e: Exception) { @@ -155,8 +159,8 @@ class AppDrawerAdapter( } else { appsList.filter { app -> app !is AppModel.PrivateSpaceHeader - && app !is AppModel.Spacer - && appLabelMatches(app.appLabel, charSearch) + && app !is AppModel.Spacer + && appLabelMatches(app.appLabel, charSearch) }.toMutableList() }.appendSpacerItem() @@ -182,8 +186,8 @@ class AppDrawerAdapter( try { val launchableResults = appFilteredList.filter { it !is AppModel.PrivateSpaceHeader - && it !is AppModel.Spacer - && it.appPackage.isNotBlank() + && it !is AppModel.Spacer + && it.appPackage.isNotBlank() } if (launchableResults.size == 1 && autoLaunch @@ -279,12 +283,22 @@ class AppDrawerAdapter( appTitle.gravity = appLabelGravity otherProfileIndicator.isVisible = appModel.user != myUserHandle && !isSpecialActionItem + appRow.onFocusChangeListener = View.OnFocusChangeListener { _, hasFocus -> + appTitle.isSelected = hasFocus + otherProfileIndicator.isSelected = hasFocus + } + appTitle.isSelected = appRow.isFocused + otherProfileIndicator.isSelected = appRow.isFocused + appRow.setOnClickListener { clickListener(appModel) } appRow.setOnLongClickListener { if (isSpecialActionItem) return@setOnLongClickListener true if (appModel.appPackage.isNotEmpty()) { appDelete.alpha = when ( - appModel is AppModel.PinnedShortcut || !root.context.isSystemApp(appModel.appPackage, appModel.user) + appModel is AppModel.PinnedShortcut || !root.context.isSystemApp( + appModel.appPackage, + appModel.user + ) ) { true -> 1.0f false -> 0.5f @@ -315,16 +329,20 @@ class AppDrawerAdapter( } true } + KeyEvent.ACTION_UP -> { if (event.repeatCount == 0) appRow.performClick() true } + else -> false } } + KeyEvent.KEYCODE_DPAD_LEFT -> { if (event.action == KeyEvent.ACTION_DOWN) appLeftListener() else false } + KeyEvent.KEYCODE_BACK -> { when (event.action) { KeyEvent.ACTION_DOWN -> true @@ -332,6 +350,7 @@ class AppDrawerAdapter( else -> false } } + else -> false } } diff --git a/app/src/main/java/app/sidephonelauncher/ui/HomeAppTextView.kt b/app/src/main/java/app/sidephonelauncher/ui/HomeAppTextView.kt index ffce91a..65775e2 100644 --- a/app/src/main/java/app/sidephonelauncher/ui/HomeAppTextView.kt +++ b/app/src/main/java/app/sidephonelauncher/ui/HomeAppTextView.kt @@ -6,7 +6,9 @@ import android.graphics.Color import android.graphics.Paint import android.util.AttributeSet import android.widget.TextView +import app.sidephonelauncher.R import app.sidephonelauncher.helper.dpToPx +import app.sidephonelauncher.helper.getColorFromAttr class HomeAppTextView @JvmOverloads constructor( context: Context, @@ -14,6 +16,11 @@ class HomeAppTextView @JvmOverloads constructor( defStyleAttr: Int = android.R.attr.textViewStyle, ) : TextView(context, attrs, defStyleAttr) { + private val activeTextColor = Color.BLACK + private val inactiveTextColor = context.getColorFromAttr(R.attr.primaryColor) + private val activeHintColor = Color.BLACK + private val inactiveHintColor = context.getColorFromAttr(R.attr.primaryColorTrans80) + private val dotPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { color = Color.WHITE alpha = 220 @@ -32,6 +39,7 @@ class HomeAppTextView @JvmOverloads constructor( paddingEnd + reservedSideSpacePx, paddingBottom, ) + applyFocusAppearance() } fun setShowNotificationDot(show: Boolean) { @@ -40,10 +48,25 @@ class HomeAppTextView @JvmOverloads constructor( invalidate() } + override fun drawableStateChanged() { + super.drawableStateChanged() + applyFocusAppearance(hasFocus() || isPressed) + if (showNotificationDot) invalidate() + } + + private fun applyFocusAppearance(active: Boolean = hasFocus() || isPressed) { + super.setTextColor(if (active) activeTextColor else inactiveTextColor) + setHintTextColor(if (active) activeHintColor else inactiveHintColor) + setShadowLayer(0f, 0f, 0f, Color.TRANSPARENT) + } + override fun onDraw(canvas: Canvas) { + val active = hasFocus() || isPressed + applyFocusAppearance(active) super.onDraw(canvas) if (!showNotificationDot) return + dotPaint.color = if (active) Color.BLACK else Color.WHITE val cx = width - reservedSideSpacePx / 2f val cy = height / 2f canvas.drawCircle(cx, cy, dotRadiusPx, dotPaint) diff --git a/app/src/main/java/app/sidephonelauncher/ui/HomeFragment.kt b/app/src/main/java/app/sidephonelauncher/ui/HomeFragment.kt index d2ef10f..9ef1e27 100644 --- a/app/src/main/java/app/sidephonelauncher/ui/HomeFragment.kt +++ b/app/src/main/java/app/sidephonelauncher/ui/HomeFragment.kt @@ -157,18 +157,21 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener prefs.clockAppClassName = "" prefs.clockAppUser = "" } + R.id.date -> { showAppList(Constants.FLAG_SET_CALENDAR_APP) prefs.calendarAppPackage = "" prefs.calendarAppClassName = "" prefs.calendarAppUser = "" } + R.id.tvScreenTime -> { showAppList(Constants.FLAG_SET_SCREEN_TIME_APP) prefs.screenTimeAppPackage = "" prefs.screenTimeAppClassName = "" prefs.screenTimeAppUser = "" } + R.id.setDefaultLauncher -> { prefs.hideSetDefaultLauncher = true binding.setDefaultLauncher.visibility = View.GONE @@ -235,12 +238,14 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } event.action == KeyEvent.ACTION_DOWN || event.action == KeyEvent.ACTION_UP } + KeyEvent.KEYCODE_DPAD_RIGHT -> { if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) { openSwipeLeftApp() } event.action == KeyEvent.ACTION_DOWN || event.action == KeyEvent.ACTION_UP } + else -> false } } @@ -248,8 +253,8 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener fun shouldHandleUnfocusedDpadKeyEvent(): Boolean { val focusedView = activity?.currentFocus return focusedView == null - || focusedView == binding.mainLayout - || getFocusableHomeTargets().none { it == focusedView } + || focusedView == binding.mainLayout + || getFocusableHomeTargets().none { it == focusedView } } fun handleUnfocusedDpadKeyEvent(event: KeyEvent): Boolean { @@ -260,12 +265,14 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } true } + KeyEvent.KEYCODE_DPAD_RIGHT -> { if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) { openSwipeLeftApp() } true } + KeyEvent.KEYCODE_DPAD_UP, KeyEvent.KEYCODE_DPAD_DOWN, KeyEvent.KEYCODE_DPAD_CENTER, @@ -276,6 +283,7 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } true } + else -> false } } @@ -295,12 +303,14 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } return true } + KeyEvent.KEYCODE_DPAD_LEFT -> { if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) { openSwipeRightApp() } return true } + KeyEvent.KEYCODE_DPAD_RIGHT -> { if (event.action == KeyEvent.ACTION_DOWN && event.repeatCount == 0) { openSwipeLeftApp() @@ -324,6 +334,7 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } return true } + KeyEvent.KEYCODE_DPAD_DOWN -> { if (event.repeatCount > 0) return true if (focusedIndex < visibleApps.size - 1) { @@ -331,21 +342,25 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } return true } + KeyEvent.KEYCODE_DPAD_LEFT -> { if (event.repeatCount > 0) return true openSwipeRightApp() return true } + KeyEvent.KEYCODE_DPAD_RIGHT -> { if (event.repeatCount > 0) return true openSwipeLeftApp() return true } + KeyEvent.KEYCODE_DPAD_CENTER, KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_NUMPAD_ENTER -> return false } } + KeyEvent.ACTION_UP -> { when (keyCode) { KeyEvent.KEYCODE_DPAD_DOWN -> return true @@ -467,6 +482,7 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } true } + KeyEvent.KEYCODE_DPAD_DOWN -> { if (event.action != KeyEvent.ACTION_DOWN || event.repeatCount > 0) return@setOnKeyListener true val headerTargets = getTopHomeHeaderTargets() @@ -475,24 +491,28 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener currentIndex in 0 until headerTargets.lastIndex -> { headerTargets[currentIndex + 1].requestFocus() } + else -> { getVisibleHomeApps().firstOrNull()?.requestFocus() } } true } + KeyEvent.KEYCODE_DPAD_LEFT -> { if (event.action != KeyEvent.ACTION_DOWN) return@setOnKeyListener true if (event.repeatCount > 0) return@setOnKeyListener true openSwipeRightApp() true } + KeyEvent.KEYCODE_DPAD_RIGHT -> { if (event.action != KeyEvent.ACTION_DOWN) return@setOnKeyListener true if (event.repeatCount > 0) return@setOnKeyListener true openSwipeLeftApp() true } + KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_DPAD_CENTER, KeyEvent.KEYCODE_NUMPAD_ENTER -> { @@ -503,13 +523,16 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } true } + KeyEvent.ACTION_UP -> { if (event.repeatCount == 0) view.performClick() true } + else -> false } } + else -> false } } @@ -543,18 +566,21 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } true } + KeyEvent.KEYCODE_DPAD_LEFT -> { if (event.action != KeyEvent.ACTION_DOWN) return@setOnKeyListener true if (event.repeatCount > 0) return@setOnKeyListener true openSwipeRightApp() true } + KeyEvent.KEYCODE_DPAD_RIGHT -> { if (event.action != KeyEvent.ACTION_DOWN) return@setOnKeyListener true if (event.repeatCount > 0) return@setOnKeyListener true openSwipeLeftApp() true } + KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_DPAD_CENTER, KeyEvent.KEYCODE_NUMPAD_ENTER -> { @@ -565,13 +591,16 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } true } + KeyEvent.ACTION_UP -> { if (event.repeatCount == 0) view.performClick() true } + else -> false } } + else -> false } } @@ -644,7 +673,15 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } binding.homeApp1.visibility = View.VISIBLE - if (!setHomeAppText(binding.homeApp1 as TextView, prefs.appName1, prefs.appPackage1, prefs.appUser1, prefs.isShortcut1, prefs.shortcutId1)) { + if (!setHomeAppText( + binding.homeApp1 as TextView, + prefs.appName1, + prefs.appPackage1, + prefs.appUser1, + prefs.isShortcut1, + prefs.shortcutId1 + ) + ) { prefs.appName1 = "" prefs.appPackage1 = "" } @@ -654,7 +691,15 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } binding.homeApp2.visibility = View.VISIBLE - if (!setHomeAppText(binding.homeApp2 as TextView, prefs.appName2, prefs.appPackage2, prefs.appUser2, prefs.isShortcut2, prefs.shortcutId2)) { + if (!setHomeAppText( + binding.homeApp2 as TextView, + prefs.appName2, + prefs.appPackage2, + prefs.appUser2, + prefs.isShortcut2, + prefs.shortcutId2 + ) + ) { prefs.appName2 = "" prefs.appPackage2 = "" } @@ -664,7 +709,15 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } binding.homeApp3.visibility = View.VISIBLE - if (!setHomeAppText(binding.homeApp3 as TextView, prefs.appName3, prefs.appPackage3, prefs.appUser3, prefs.isShortcut3, prefs.shortcutId3)) { + if (!setHomeAppText( + binding.homeApp3 as TextView, + prefs.appName3, + prefs.appPackage3, + prefs.appUser3, + prefs.isShortcut3, + prefs.shortcutId3 + ) + ) { prefs.appName3 = "" prefs.appPackage3 = "" } @@ -674,7 +727,15 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } binding.homeApp4.visibility = View.VISIBLE - if (!setHomeAppText(binding.homeApp4 as TextView, prefs.appName4, prefs.appPackage4, prefs.appUser4, prefs.isShortcut4, prefs.shortcutId4)) { + if (!setHomeAppText( + binding.homeApp4 as TextView, + prefs.appName4, + prefs.appPackage4, + prefs.appUser4, + prefs.isShortcut4, + prefs.shortcutId4 + ) + ) { prefs.appName4 = "" prefs.appPackage4 = "" } @@ -684,7 +745,15 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } binding.homeApp5.visibility = View.VISIBLE - if (!setHomeAppText(binding.homeApp5 as TextView, prefs.appName5, prefs.appPackage5, prefs.appUser5, prefs.isShortcut5, prefs.shortcutId5)) { + if (!setHomeAppText( + binding.homeApp5 as TextView, + prefs.appName5, + prefs.appPackage5, + prefs.appUser5, + prefs.isShortcut5, + prefs.shortcutId5 + ) + ) { prefs.appName5 = "" prefs.appPackage5 = "" } @@ -694,7 +763,15 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } binding.homeApp6.visibility = View.VISIBLE - if (!setHomeAppText(binding.homeApp6 as TextView, prefs.appName6, prefs.appPackage6, prefs.appUser6, prefs.isShortcut6, prefs.shortcutId6)) { + if (!setHomeAppText( + binding.homeApp6 as TextView, + prefs.appName6, + prefs.appPackage6, + prefs.appUser6, + prefs.isShortcut6, + prefs.shortcutId6 + ) + ) { prefs.appName6 = "" prefs.appPackage6 = "" } @@ -704,7 +781,15 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } binding.homeApp7.visibility = View.VISIBLE - if (!setHomeAppText(binding.homeApp7 as TextView, prefs.appName7, prefs.appPackage7, prefs.appUser7, prefs.isShortcut7, prefs.shortcutId7)) { + if (!setHomeAppText( + binding.homeApp7 as TextView, + prefs.appName7, + prefs.appPackage7, + prefs.appUser7, + prefs.isShortcut7, + prefs.shortcutId7 + ) + ) { prefs.appName7 = "" prefs.appPackage7 = "" } @@ -714,7 +799,15 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener } binding.homeApp8.visibility = View.VISIBLE - if (!setHomeAppText(binding.homeApp8 as TextView, prefs.appName8, prefs.appPackage8, prefs.appUser8, prefs.isShortcut8, prefs.shortcutId8)) { + if (!setHomeAppText( + binding.homeApp8 as TextView, + prefs.appName8, + prefs.appPackage8, + prefs.appUser8, + prefs.isShortcut8, + prefs.shortcutId8 + ) + ) { prefs.appName8 = "" prefs.appPackage8 = "" } @@ -939,6 +1032,7 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener showAppList(Constants.FLAG_LAUNCH_APP) return } + Constants.HomeAction.OPEN_PHONE -> { openDialerApp(requireContext()) return diff --git a/app/src/main/res/color/icon_tint_focus_inverted.xml b/app/src/main/res/color/icon_tint_focus_inverted.xml new file mode 100644 index 0000000..723c905 --- /dev/null +++ b/app/src/main/res/color/icon_tint_focus_inverted.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:color="@android:color/black" android:state_pressed="true" /> + <item android:color="@android:color/black" android:state_selected="true" /> + <item android:color="@android:color/black" android:state_focused="true" /> + <item android:color="?attr/primaryColor" /> +</selector> diff --git a/app/src/main/res/color/text_focus_inverted.xml b/app/src/main/res/color/text_focus_inverted.xml new file mode 100644 index 0000000..723c905 --- /dev/null +++ b/app/src/main/res/color/text_focus_inverted.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:color="@android:color/black" android:state_pressed="true" /> + <item android:color="@android:color/black" android:state_selected="true" /> + <item android:color="@android:color/black" android:state_focused="true" /> + <item android:color="?attr/primaryColor" /> +</selector> diff --git a/app/src/main/res/drawable/bg_focus_inverted.xml b/app/src/main/res/drawable/bg_focus_inverted.xml new file mode 100644 index 0000000..3381498 --- /dev/null +++ b/app/src/main/res/drawable/bg_focus_inverted.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <solid android:color="@android:color/white" /> + <corners android:radius="9dp" /> +</shape> diff --git a/app/src/main/res/drawable/bg_focus_inverted_selector.xml b/app/src/main/res/drawable/bg_focus_inverted_selector.xml new file mode 100644 index 0000000..b23cce0 --- /dev/null +++ b/app/src/main/res/drawable/bg_focus_inverted_selector.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@drawable/bg_focus_inverted" android:state_pressed="true" /> + <item android:drawable="@drawable/bg_focus_inverted" android:state_selected="true" /> + <item android:drawable="@drawable/bg_focus_inverted" android:state_focused="true" /> + <item android:drawable="@android:color/transparent" /> +</selector> diff --git a/app/src/main/res/layout-land/fragment_home.xml b/app/src/main/res/layout-land/fragment_home.xml index cf6e388..1a8b955 100644 --- a/app/src/main/res/layout-land/fragment_home.xml +++ b/app/src/main/res/layout-land/fragment_home.xml @@ -40,7 +40,7 @@ <TextClock android:id="@+id/clock" - style="@style/TextDefault" + style="@style/TextDefaultFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" android:fontFamily="sans-serif-light" @@ -50,7 +50,7 @@ <TextView android:id="@+id/date" - style="@style/TextDefault" + style="@style/TextDefaultFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" android:nextFocusUp="@id/clock" @@ -87,88 +87,104 @@ android:orientation="vertical" android:paddingVertical="@dimen/home_app_padding_vertical"> - <TextView + <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp1" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:focusable="true" + android:focusableInTouchMode="true" android:hint="@string/app" android:paddingVertical="@dimen/home_app_padding_vertical" android:tag="@string/tag_1" android:visibility="gone" tools:visibility="visible" /> - <TextView + <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp2" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:focusable="true" + android:focusableInTouchMode="true" android:hint="@string/app" android:paddingVertical="@dimen/home_app_padding_vertical" android:tag="@string/tag_2" android:visibility="gone" tools:visibility="visible" /> - <TextView + <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp3" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:focusable="true" + android:focusableInTouchMode="true" android:hint="@string/app" android:paddingVertical="@dimen/home_app_padding_vertical" android:tag="@string/tag_3" android:visibility="gone" tools:visibility="visible" /> - <TextView + <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp4" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:focusable="true" + android:focusableInTouchMode="true" android:hint="@string/app" android:paddingVertical="@dimen/home_app_padding_vertical" android:tag="@string/tag_4" android:visibility="gone" tools:visibility="visible" /> - <TextView + <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp5" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:focusable="true" + android:focusableInTouchMode="true" android:hint="@string/app" android:paddingVertical="@dimen/home_app_padding_vertical" android:tag="@string/tag_5" android:visibility="gone" tools:visibility="visible" /> - <TextView + <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp6" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:focusable="true" + android:focusableInTouchMode="true" android:hint="@string/app" android:paddingVertical="@dimen/home_app_padding_vertical" android:tag="@string/tag_6" android:visibility="gone" tools:visibility="visible" /> - <TextView + <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp7" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:focusable="true" + android:focusableInTouchMode="true" android:hint="@string/app" android:paddingVertical="@dimen/home_app_padding_vertical" android:tag="@string/tag_7" android:visibility="gone" tools:visibility="visible" /> - <TextView + <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp8" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:focusable="true" + android:focusableInTouchMode="true" android:hint="@string/app" android:paddingVertical="@dimen/home_app_padding_vertical" android:tag="@string/tag_8" diff --git a/app/src/main/res/layout/adapter_app_drawer.xml b/app/src/main/res/layout/adapter_app_drawer.xml index a68f88d..1fc11fd 100644 --- a/app/src/main/res/layout/adapter_app_drawer.xml +++ b/app/src/main/res/layout/adapter_app_drawer.xml @@ -10,11 +10,14 @@ android:id="@+id/appRow" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginHorizontal="12dp" + android:background="@drawable/bg_focus_inverted_selector" + android:defaultFocusHighlightEnabled="false" android:focusable="true" android:focusableInTouchMode="false" android:gravity="center_vertical" android:orientation="horizontal" - android:paddingHorizontal="24dp" + android:paddingHorizontal="12dp" android:paddingVertical="@dimen/app_padding_vertical"> <TextView @@ -22,21 +25,28 @@ style="@style/TextLarge" android:layout_width="0dp" android:layout_height="wrap_content" + android:duplicateParentState="true" android:layout_weight="1" android:maxLines="1" - android:text="@string/app" /> + android:shadowColor="@android:color/transparent" + android:shadowDx="0" + android:shadowDy="0" + android:shadowRadius="0" + android:text="@string/app" + android:textColor="@color/text_focus_inverted" /> </LinearLayout> <ImageView android:id="@+id/otherProfileIndicator" android:layout_width="5dp" android:layout_height="5dp" + android:duplicateParentState="true" android:layout_gravity="center_vertical" - android:layout_marginStart="10dp" + android:layout_marginStart="22dp" android:layout_marginTop="1dp" android:gravity="center" android:src="@drawable/ic_rounded" - app:tint="?attr/primaryColor" /> + app:tint="@color/icon_tint_focus_inverted" /> <LinearLayout android:id="@+id/appHideLayout" diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index fc01909..62402cf 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -29,7 +29,7 @@ <TextClock android:id="@+id/clock" - style="@style/TextDefault" + style="@style/TextDefaultFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" @@ -43,7 +43,7 @@ <TextView android:id="@+id/date" - style="@style/TextDefault" + style="@style/TextDefaultFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" @@ -84,7 +84,7 @@ <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp1" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" @@ -97,7 +97,7 @@ <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp2" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" @@ -110,7 +110,7 @@ <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp3" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" @@ -123,7 +123,7 @@ <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp4" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" @@ -136,7 +136,7 @@ <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp5" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" @@ -149,7 +149,7 @@ <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp6" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" @@ -162,7 +162,7 @@ <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp7" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" @@ -175,7 +175,7 @@ <app.sidephonelauncher.ui.HomeAppTextView android:id="@+id/homeApp8" - style="@style/TextLarge" + style="@style/TextLargeFocusableInverted" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index 250a22a..a4d0e42 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -75,6 +75,26 @@ <item name="android:textSize">@dimen/text_large</item> </style> + <style name="TextDefaultFocusableInverted" parent="TextDefault"> + <item name="android:background">@drawable/bg_focus_inverted_selector</item> + <item name="android:textColor">@color/text_focus_inverted</item> + <item name="android:shadowColor">@android:color/transparent</item> + <item name="android:shadowDx">0</item> + <item name="android:shadowDy">0</item> + <item name="android:shadowRadius">0</item> + <item name="android:defaultFocusHighlightEnabled">false</item> + </style> + + <style name="TextLargeFocusableInverted" parent="TextLarge"> + <item name="android:background">@drawable/bg_focus_inverted_selector</item> + <item name="android:textColor">@color/text_focus_inverted</item> + <item name="android:shadowColor">@android:color/transparent</item> + <item name="android:shadowDx">0</item> + <item name="android:shadowDy">0</item> + <item name="android:shadowRadius">0</item> + <item name="android:defaultFocusHighlightEnabled">false</item> + </style> + <style name="TextMedium" parent="TextDefault"> <item name="android:textSize">20sp</item> </style> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index a9ca7b0..09d42fb 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -75,6 +75,26 @@ <item name="android:textSize">@dimen/text_large</item> </style> + <style name="TextDefaultFocusableInverted" parent="TextDefault"> + <item name="android:background">@drawable/bg_focus_inverted_selector</item> + <item name="android:textColor">@color/text_focus_inverted</item> + <item name="android:shadowColor">@android:color/transparent</item> + <item name="android:shadowDx">0</item> + <item name="android:shadowDy">0</item> + <item name="android:shadowRadius">0</item> + <item name="android:defaultFocusHighlightEnabled">false</item> + </style> + + <style name="TextLargeFocusableInverted" parent="TextLarge"> + <item name="android:background">@drawable/bg_focus_inverted_selector</item> + <item name="android:textColor">@color/text_focus_inverted</item> + <item name="android:shadowColor">@android:color/transparent</item> + <item name="android:shadowDx">0</item> + <item name="android:shadowDy">0</item> + <item name="android:shadowRadius">0</item> + <item name="android:defaultFocusHighlightEnabled">false</item> + </style> + <style name="TextMedium" parent="TextDefault"> <item name="android:textSize">20sp</item> </style> |
