A few UI tweaks

This commit is contained in:
Damontecres 2026-02-10 16:57:44 -05:00
parent 3879072c1d
commit 7005adc507
No known key found for this signature in database
3 changed files with 12 additions and 9 deletions

View file

@ -1,8 +1,6 @@
package com.github.damontecres.wholphin.ui.components package com.github.damontecres.wholphin.ui.components
import androidx.compose.animation.animateColorAsState import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.focusable import androidx.compose.foundation.focusable
import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.MutableInteractionSource
@ -16,7 +14,6 @@ import androidx.compose.runtime.NonRestartableComposable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.scale
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.tv.material3.MaterialTheme import androidx.tv.material3.MaterialTheme
@ -59,8 +56,6 @@ fun FocusableItemRow(
) { ) {
val interactionSource = remember { MutableInteractionSource() } val interactionSource = remember { MutableInteractionSource() }
val focused by interactionSource.collectIsFocusedAsState() val focused by interactionSource.collectIsFocusedAsState()
val padding by animateDpAsState(if (focused) 8.dp else 0.dp)
val scale by animateFloatAsState(if (focused) 1.1f else 1f)
val background by animateColorAsState( val background by animateColorAsState(
if (focused) { if (focused) {
MaterialTheme.colorScheme.border.copy(alpha = .25f) MaterialTheme.colorScheme.border.copy(alpha = .25f)
@ -74,9 +69,8 @@ fun FocusableItemRow(
modifier modifier
.padding(start = 8.dp) .padding(start = 8.dp)
.focusable(interactionSource = interactionSource) .focusable(interactionSource = interactionSource)
.scale(scale)
.background(background, shape = RoundedCornerShape(8.dp)) .background(background, shape = RoundedCornerShape(8.dp))
.padding(padding), .padding(8.dp),
) { ) {
titleContent.invoke() titleContent.invoke()
subtitleContent.invoke() subtitleContent.invoke()

View file

@ -392,6 +392,7 @@ class HomeSettingsViewModel
try { try {
Timber.d("saveToRemote") Timber.d("saveToRemote")
homeSettingsService.saveToServer(user.id, settings) homeSettingsService.saveToServer(user.id, settings)
showSaveToast()
} catch (ex: Exception) { } catch (ex: Exception) {
Timber.e(ex) Timber.e(ex)
showToast(context, "Error saving: ${ex.localizedMessage}") showToast(context, "Error saving: ${ex.localizedMessage}")
@ -471,12 +472,12 @@ class HomeSettingsViewModel
// Only save if there are changes // Only save if there are changes
if (local != settings) { if (local != settings) {
homeSettingsService.saveToLocal(user.id, settings) homeSettingsService.saveToLocal(user.id, settings)
showToast(context, context.getString(R.string.save), Toast.LENGTH_SHORT) showSaveToast()
} }
} catch (ex: UnsupportedHomeSettingsVersionException) { } catch (ex: UnsupportedHomeSettingsVersionException) {
Timber.w(ex, "Overwriting local settings") Timber.w(ex, "Overwriting local settings")
homeSettingsService.saveToLocal(user.id, settings) homeSettingsService.saveToLocal(user.id, settings)
showToast(context, context.getString(R.string.save), Toast.LENGTH_SHORT) showSaveToast()
} catch (ex: Exception) { } catch (ex: Exception) {
Timber.e(ex) Timber.e(ex)
showToast(context, "Error saving: ${ex.localizedMessage}") showToast(context, "Error saving: ${ex.localizedMessage}")
@ -526,6 +527,13 @@ class HomeSettingsViewModel
fetchRowData() fetchRowData()
} }
} }
private suspend fun showSaveToast() =
showToast(
context,
context.getString(R.string.settings_saved),
Toast.LENGTH_SHORT,
)
} }
data class HomePageSettingsState( data class HomePageSettingsState(

View file

@ -512,6 +512,7 @@
<string name="increase_all_cards_size">Increase size for all cards</string> <string name="increase_all_cards_size">Increase size for all cards</string>
<string name="decrease_all_cards_size">Decrease size for all cards</string> <string name="decrease_all_cards_size">Decrease size for all cards</string>
<string name="use_thumb_images">Use thumb images</string> <string name="use_thumb_images">Use thumb images</string>
<string name="settings_saved">Settings saved</string>
<string-array name="theme_song_volume"> <string-array name="theme_song_volume">
<item>Disabled</item> <item>Disabled</item>