mirror of
https://github.com/Michatec/Radio.git
synced 2026-05-31 06:32:39 +02:00
refactor(ui): improve intent handling and collection view state
- Update `handleStartIntent` and `handleStartPlayer` in `PlayerFragment` to ensure intents are only cleared if successfully handled and stations are valid. - Refine star icon rendering in `CollectionAdapter` by clearing color filters when appropriate. - Remove obsolete commented-out code and update log messages in `PlayerFragment`, `PlayerService`, and `LayoutHolder`. - Uncomment maintenance preference updates in `SettingsFragment`. - Reformat code for better readability in `CollectionAdapter`.
This commit is contained in:
@@ -22,7 +22,6 @@ import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.media3.common.text.TextAnnotation
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@@ -190,7 +189,11 @@ class CollectionAdapter(
|
||||
|
||||
// highlight if reordering
|
||||
if (reorderStationUuid == station.uuid) {
|
||||
stationViewHolder.stationCardView.setStrokeColor(ColorStateList.valueOf(ContextCompat.getColor(context, R.color.cardview_reordering)))
|
||||
stationViewHolder.stationCardView.setStrokeColor(
|
||||
ColorStateList.valueOf(
|
||||
ContextCompat.getColor(context, R.color.cardview_reordering)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// show / hide edit views
|
||||
@@ -369,12 +372,16 @@ class CollectionAdapter(
|
||||
when (station.starred) {
|
||||
true -> {
|
||||
if (station.imageColor != -1) {
|
||||
// stationViewHolder.stationCardView.setCardBackgroundColor(station.imageColor)
|
||||
stationViewHolder.stationStarredView.setColorFilter(station.imageColor)
|
||||
} else {
|
||||
stationViewHolder.stationStarredView.clearColorFilter()
|
||||
}
|
||||
stationViewHolder.stationStarredView.isVisible = true
|
||||
}
|
||||
false -> stationViewHolder.stationStarredView.isGone = true
|
||||
false -> {
|
||||
stationViewHolder.stationStarredView.clearColorFilter()
|
||||
stationViewHolder.stationStarredView.isGone = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user