feat(ui): use checkbox to indicate reordering station status

This commit is contained in:
2026-04-18 17:53:52 +02:00
parent 1238a5fba2
commit 744a650a91
3 changed files with 20 additions and 10 deletions
@@ -3,7 +3,6 @@ package com.michatec.radio.collection
import android.annotation.SuppressLint
import android.content.Context
import android.content.SharedPreferences
import android.content.res.ColorStateList
import android.text.Editable
import android.text.TextWatcher
import android.view.KeyEvent
@@ -11,12 +10,12 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.widget.CheckBox
import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.constraintlayout.widget.Group
import androidx.core.content.ContextCompat
import androidx.core.net.toUri
import androidx.core.view.isGone
import androidx.core.view.isVisible
@@ -180,7 +179,6 @@ class CollectionAdapter(
// get reference to StationViewHolder
val stationViewHolder: StationViewHolder = holder
// set up station views
setStarredIcon(stationViewHolder, station)
setStationName(stationViewHolder, station)
@@ -190,13 +188,12 @@ class CollectionAdapter(
setPlaybackProgress(stationViewHolder, station)
setDownloadProgress(stationViewHolder, station)
// highlight if reordering
if (reorderStationUuid == station.uuid) {
stationViewHolder.stationCardView.setStrokeColor(
ColorStateList.valueOf(
ContextCompat.getColor(context, R.color.cardview_reordering)
)
)
stationViewHolder.reorderCheckbox.isVisible = true
stationViewHolder.reorderCheckbox.isChecked = true
} else {
stationViewHolder.reorderCheckbox.isGone = true
stationViewHolder.reorderCheckbox.isChecked = false
}
// show / hide edit views
@@ -774,6 +771,7 @@ class CollectionAdapter(
val stationImageView: ImageView = stationCardLayout.findViewById(R.id.station_icon)
val stationNameView: TextView = stationCardLayout.findViewById(R.id.station_name)
val stationStarredView: ImageView = stationCardLayout.findViewById(R.id.starred_icon)
val reorderCheckbox: CheckBox = stationCardLayout.findViewById(R.id.reorder_checkbox)
val bufferingProgress: ProgressBar = stationCardLayout.findViewById(R.id.buffering_progress)
val downloadProgress: ProgressBar = stationCardLayout.findViewById(R.id.download_progress)
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Focused (TV remote) states -->
<item android:color="@color/list_card_stroke_focused" android:state_focused="true" />
<!-- Default state -->
<item android:color="@color/list_card_stroke_background" />
</selector>
+11 -1
View File
@@ -61,6 +61,16 @@
app:shapeAppearanceOverlay="@style/RoundedCorners"
app:srcCompat="@drawable/ic_image_white_36dp" />
<CheckBox
android:id="@+id/reorder_checkbox"
android:layout_width="24dp"
android:layout_height="24dp"
android:foregroundTint="@color/icon_default"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/station_icon"
app:layout_constraintStart_toEndOf="@+id/starred_icon"
app:layout_constraintTop_toTopOf="@+id/station_icon" />
<ImageView
android:id="@+id/starred_icon"
android:layout_width="wrap_content"
@@ -86,7 +96,7 @@
android:textColor="@color/text_lightweight"
app:layout_constraintBottom_toBottomOf="@+id/station_icon"
app:layout_constraintEnd_toStartOf="@+id/playback_button"
app:layout_constraintStart_toEndOf="@+id/starred_icon"
app:layout_constraintStart_toEndOf="@+id/reorder_checkbox"
app:layout_constraintTop_toTopOf="@+id/station_icon"
tools:text="@string/sample_text_station_name" />