36 Commits

Author SHA1 Message Date
3171c21db9 style(ui): make television dialogs responsive 2026-03-28 23:11:42 +01:00
f43775d3f2 style(ui): adjust television dialog heights to 800dp 2026-03-28 23:05:53 +01:00
868c39a6e1 style(ui): increase find station dialog height 2026-03-28 22:59:25 +01:00
985e7d4e1b style(ui): increase find station dialog height 2026-03-28 22:53:00 +01:00
363d197ba5 style(ui): simplify theme selection dialog radio buttons 2026-03-28 22:47:13 +01:00
d0e412ca83 feat(ui): save theme selection to preferences 2026-03-28 22:37:55 +01:00
93008f7247 feat(ui): handle theme selection dialog results and update summary 2026-03-28 22:29:02 +01:00
7e95a0bfe1 refactor(ui): unify theme selection by removing TV-specific handling 2026-03-28 22:21:38 +01:00
8d509b6b23 refactor(ui): update theme selection dialog behavior and TV layout 2026-03-28 22:18:12 +01:00
cb4aff47a7 feat(ui): add theme selection dialog layout 2026-03-28 22:01:33 +01:00
293a823442 fix(ui): ensure theme selection dialog dismisses on button click 2026-03-28 21:58:24 +01:00
a5b11ba99a feat(ui): implement theme selection dialog with TV support 2026-03-28 21:55:38 +01:00
2ccb4225d4 refactor(ui): remove TV-specific preference layouts 2026-03-28 21:39:05 +01:00
453e6e5b71 refactor(ui): adjust TV preference layout structure 2026-03-28 21:30:02 +01:00
4108cf2c7c feat(ui): add TV-specific preference layouts for focus visibility 2026-03-28 21:25:50 +01:00
f038e01981 feat(ui): add keyboard shortcut for favouriting stations 2026-03-28 21:03:54 +01:00
f66b5af810 docs(readme): add DEL key alternative for station removal 2026-03-28 20:56:08 +01:00
a6a9daf3a3 docs(readme): add Android TV controls documentation 2026-03-28 20:54:56 +01:00
d79d5e15fa refactor(ui): consolidate keyboard shortcut handling in collection adapter 2026-03-28 20:48:54 +01:00
c3f37092de feat(ui): add keyboard shortcuts for station removal 2026-03-28 20:34:56 +01:00
48d14fecdb style(ui): adjust highlight colors for better contrast
Reduce opacity of focused highlight colors and adjust control highlight colors across all theme variants to improve visual consistency and accessibility. Changes include:
- Lowering alpha values for focused highlights in night themes
- Switching from white-based to black-based highlights in light themes
- Standardizing highlight opacity across API level-specific styles
2026-03-28 20:10:41 +01:00
c8293b1b6d - standardize highlight colors across themes 2026-03-28 19:38:28 +01:00
51c8d5b303 Add rotation animation to playback button for mobile devices 2026-03-28 19:02:38 +01:00
180d5c2218 Set enabled state for stream URI editing preference 2026-03-28 18:55:19 +01:00
391999c406 Update README to mention Android TV support 2026-03-28 18:40:13 +01:00
fb779bd661 Merge remote-tracking branch 'origin/main' 2026-03-28 18:37:07 +01:00
46ebf21c06 Add support for Android TV and update dependencies
*   Implement initial Android TV support, including `LEANBACK_LAUNCHER` intent filter, hardware feature declarations, and television-specific layouts for the player, search results, and dialogs.
*   Add a splash/loading screen for the TV interface and a dedicated `SplashTheme`.
*   Improve DPAD navigation by adding `OnKeyListener` for station cards and allowing focus on internal elements.
*   Update `LayoutHolder` and `PlayerFragment` to handle TV layouts and add previous/next station navigation buttons.
*   Adjust `PreferencesHelper` to disable station editing by default on TV devices.
*   Update `androidx.media3` to v1.10.0, `work-runtime-ktx` to v2.11.2, and add `androidx.leanback` dependency.
*   Bump `versionCode` to 144 and `versionName` to 14.4.
*   Refactor `PlayerService` to simplify sleep timer cancellation logic.
*   Remove stale copyright headers and license comments from several Kotlin files.
2026-03-28 18:36:50 +01:00
Michachatz
2d2d95875f Merge pull request #60 from Michatec/renovate/media3
Update media3 to v1.10.0
2026-03-27 14:12:16 +01:00
renovate[bot]
46e7b905c8 Update media3 to v1.10.0 2026-03-27 12:45:39 +00:00
Michachatz
d033ae6344 Merge pull request #59 from Michatec/renovate/workruntimektx
Update dependency androidx.work:work-runtime-ktx to v2.11.2
2026-03-27 13:45:08 +01:00
renovate[bot]
fc275d349b Update dependency androidx.work:work-runtime-ktx to v2.11.2 2026-03-25 20:25:14 +00:00
Michachatz
4e6f7c7c67 Update gradle-publish.yml to target main branch
Restrict workflow triggers to main branch for push and pull requests.
2026-03-25 07:52:12 +01:00
Michachatz
272d6fd908 Add installation instructions for Radio 2026-03-25 07:36:28 +01:00
Michachatz
4a30828c99 Update README with warning about Google requirements
Added a warning about Google's upcoming requirement for personal identity details for apps on certified Android devices, effective 2026/2027.
2026-03-25 07:35:21 +01:00
Michachatz
963f6e7618 Merge pull request #58 from Michatec/renovate/android-actions-setup-android-4.x
Update android-actions/setup-android action to v4
2026-03-25 07:30:33 +01:00
renovate[bot]
29ead7e1d8 Update android-actions/setup-android action to v4 2026-03-25 01:58:58 +00:00
42 changed files with 1314 additions and 224 deletions

View File

@@ -3,8 +3,10 @@ name: Build and publish APK
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
tags: branches: [ "main" ]
- 'b*' pull_request:
branches: [ "main" ]
env: env:
ANDROID_HOME: /usr/local/lib/android/sdk/ ANDROID_HOME: /usr/local/lib/android/sdk/
@@ -38,7 +40,7 @@ jobs:
## It is not necessary to check for cache hit as it ## It is not necessary to check for cache hit as it
## will not download Android SDK again ## will not download Android SDK again
#if: steps.cache-android-sdk.outputs.cache-hit != 'true' #if: steps.cache-android-sdk.outputs.cache-hit != 'true'
uses: android-actions/setup-android@v3 uses: android-actions/setup-android@v4
with: with:
packages: '' packages: ''

View File

@@ -3,6 +3,7 @@
### About Radio ### About Radio
**Radio is an application with a minimalist approach to listening to radio over the Internet.** <br> **Radio is an application with a minimalist approach to listening to radio over the Internet.** <br>
**Radio only offers a very basic search option, and it imports audio streaming links when you tap them in a web browser.** <br> **Radio only offers a very basic search option, and it imports audio streaming links when you tap them in a web browser.** <br>
**Radio now also supports Android TV (Beta).** <br>
**Pull request are welcome at any time.**<br> **Pull request are welcome at any time.**<br>
**Radio is free software. It is released under the [MIT open source license](https://opensource.org/licenses/MIT).** **Radio is free software. It is released under the [MIT open source license](https://opensource.org/licenses/MIT).**
@@ -10,6 +11,19 @@
---------------------------------------- ----------------------------------------
<details>
<summary>❗Warning</summary>
<br>
<p>
Google has announced that, starting in 2026/2027, all apps on certified Android devices will require the developer to submit personal identity details directly to Google.
Since the developers of this app do not agree to this requirement, this app will no longer work on certified Android devices after that time.
</p>
<a href="https://github.com/woheller69/FreeDroidWarn"> More Information</a>
</details>
----------------------------------------
<details> <details>
<summary>⚙️ Install Radio</summary> <summary>⚙️ Install Radio</summary>
<br> <br>
@@ -57,6 +71,22 @@ You can help out the radio-browser.info community by [adding the missing station
---------------------------------------- ----------------------------------------
<details>
<summary>📺 Android TV Controls</summary>
<br>
When **Edit Stations** is enabled:
- Press **← (Left)** on the remote to open the detailed station editing area
- Press **2** or **Back** to close the editing area
**General TV** Controls:
- Press **0** or **DEL** to remove the selected radio station
- Press **1** or **SPACE** to make the selected radio station favourite
</details>
----------------------------------------
<details> <details>
<summary>📜️ Credit</summary> <summary>📜️ Credit</summary>

View File

@@ -19,8 +19,8 @@ android {
applicationId 'com.michatec.radio' applicationId 'com.michatec.radio'
minSdk 28 minSdk 28
targetSdk 36 targetSdk 36
versionCode 143 versionCode 144
versionName '14.3' versionName '14.4'
resourceConfigurations += ['en', 'de', 'el', 'nl', 'pl', 'ru','uk', 'ja', 'da', 'fr'] resourceConfigurations += ['en', 'de', 'el', 'nl', 'pl', 'ru','uk', 'ja', 'da', 'fr']
} }
@@ -71,6 +71,7 @@ dependencies {
implementation libs.navigation.fragment.ktx implementation libs.navigation.fragment.ktx
implementation libs.navigation.ui.ktx implementation libs.navigation.ui.ktx
implementation libs.work.runtime.ktx implementation libs.work.runtime.ktx
implementation libs.leanback
implementation libs.freedroidwarn implementation libs.freedroidwarn

View File

@@ -1,6 +1,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<uses-feature
android:name="android.software.leanback"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
@@ -10,6 +17,7 @@
<application <application
android:name=".Radio" android:name=".Radio"
android:allowBackup="true" android:allowBackup="true"
android:banner="@mipmap/ic_launcher"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules" android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
@@ -32,17 +40,19 @@
android:name="com.google.android.gms.car.notification.SmallIcon" android:name="com.google.android.gms.car.notification.SmallIcon"
android:resource="@mipmap/ic_launcher" /> android:resource="@mipmap/ic_launcher" />
<!-- Main activity for radio station playback on phone --> <!-- Main activity for radio station playback on phone and TV -->
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:windowSoftInputMode="adjustPan" android:windowSoftInputMode="adjustPan"
android:theme="@style/SplashTheme"
android:exported="true"> android:exported="true">
<!-- react to main intents --> <!-- react to main intents -->
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter> </intent-filter>
<!-- react to be recognized as a music player --> <!-- react to be recognized as a music player -->

View File

@@ -1,17 +1,3 @@
/*
* Keys.kt
* Implements the keys used throughout the app
* This object hosts all keys used to control Radio state
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio package com.michatec.radio
import java.util.* import java.util.*
@@ -98,6 +84,7 @@ object Keys {
const val DIALOG_REMOVE_STATION: Int = 2 const val DIALOG_REMOVE_STATION: Int = 2
const val DIALOG_UPDATE_STATION_IMAGES: Int = 4 const val DIALOG_UPDATE_STATION_IMAGES: Int = 4
const val DIALOG_RESTORE_COLLECTION: Int = 5 const val DIALOG_RESTORE_COLLECTION: Int = 5
const val DIALOG_THEME_SELECTION: Int = 6
// dialog results // dialog results
const val DIALOG_EMPTY_PAYLOAD_STRING: String = "" const val DIALOG_EMPTY_PAYLOAD_STRING: String = ""

View File

@@ -15,7 +15,11 @@
package com.michatec.radio package com.michatec.radio
import android.content.SharedPreferences import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.os.Bundle import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.View
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.navigation.fragment.NavHostFragment import androidx.navigation.fragment.NavHostFragment
@@ -38,6 +42,7 @@ class MainActivity : AppCompatActivity() {
/* Overrides onCreate from AppCompatActivity */ /* Overrides onCreate from AppCompatActivity */
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
// Free Android // Free Android
@@ -58,6 +63,15 @@ class MainActivity : AppCompatActivity() {
NavigationUI.setupWithNavController(toolbar, navController, appBarConfiguration) NavigationUI.setupWithNavController(toolbar, navController, appBarConfiguration)
supportActionBar?.hide() supportActionBar?.hide()
// TV-specific loading logic
if (packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
Handler(Looper.getMainLooper()).postDelayed({
findViewById<View>(R.id.loading_layout)?.visibility = View.GONE
}, 1500)
} else {
findViewById<View>(R.id.loading_layout)?.visibility = View.GONE
}
// register listener for changes in shared preferences // register listener for changes in shared preferences
PreferencesHelper.registerPreferenceChangeListener(sharedPreferenceChangeListener) PreferencesHelper.registerPreferenceChangeListener(sharedPreferenceChangeListener)
} }

View File

@@ -462,7 +462,7 @@ class PlayerFragment : Fragment(),
swipeToMarkStarredItemTouchHelper.attachToRecyclerView(layout.recyclerView) swipeToMarkStarredItemTouchHelper.attachToRecyclerView(layout.recyclerView)
// set up sleep timer start button // set up sleep timer start button
layout.sheetSleepTimerStartButtonView.setOnClickListener { layout.sheetSleepTimerStartButtonView?.setOnClickListener {
when (controller?.isPlaying) { when (controller?.isPlaying) {
true -> { true -> {
val timePicker = MaterialTimePicker.Builder() val timePicker = MaterialTimePicker.Builder()
@@ -492,12 +492,28 @@ class PlayerFragment : Fragment(),
} }
// set up sleep timer cancel button // set up sleep timer cancel button
layout.sheetSleepTimerCancelButtonView.setOnClickListener { layout.sheetSleepTimerCancelButtonView?.setOnClickListener {
playerState.sleepTimerRunning = false playerState.sleepTimerRunning = false
controller?.cancelSleepTimer() controller?.cancelSleepTimer()
togglePeriodicSleepTimerUpdateRequest() togglePeriodicSleepTimerUpdateRequest()
} }
// set up TV station navigation
layout.playerPrevButtonView?.setOnClickListener {
val currentPosition = CollectionHelper.getStationPosition(collection, playerState.stationUuid)
if (currentPosition > 0) {
val prevStation = collection.stations[currentPosition - 1]
onPlayButtonTapped(prevStation.uuid)
}
}
layout.playerNextButtonView?.setOnClickListener {
val currentPosition = CollectionHelper.getStationPosition(collection, playerState.stationUuid)
if (currentPosition < collection.stations.size - 1) {
val nextStation = collection.stations[currentPosition + 1]
onPlayButtonTapped(nextStation.uuid)
}
}
} }
/* Sets up the player */ /* Sets up the player */
@@ -740,6 +756,7 @@ class PlayerFragment : Fragment(),
layout.showBufferingIndicator(buffering = false) layout.showBufferingIndicator(buffering = false)
} else { } else {
// playback is paused or stopped // playback is paused or stopped
layout.updateSleepTimer(activity as Context, 0L)
// check if buffering (playback is not active but playWhenReady is true) // check if buffering (playback is not active but playWhenReady is true)
if (controller?.playWhenReady == true) { if (controller?.playWhenReady == true) {
// playback is buffering, show the buffering indicator // playback is buffering, show the buffering indicator

View File

@@ -210,12 +210,9 @@ class PlayerService : MediaLibraryService() {
/* Cancels sleep timer */ /* Cancels sleep timer */
private fun cancelSleepTimer() { private fun cancelSleepTimer() {
if (this::sleepTimer.isInitialized) { if (this::sleepTimer.isInitialized) {
if (manuallyCancelledSleepTimer) {
sleepTimerTimeRemaining = 0L
sleepTimer.cancel() sleepTimer.cancel()
} }
manuallyCancelledSleepTimer = false sleepTimerTimeRemaining = 0L
}
// store timer state // store timer state
PreferencesHelper.saveSleepTimerRunning(isRunning = false) PreferencesHelper.saveSleepTimerRunning(isRunning = false)
} }

View File

@@ -1,17 +1,3 @@
/*
* SettingsFragment.kt
* Implements the SettingsFragment fragment
* A SettingsFragment displays the user accessible settings of the app
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio package com.michatec.radio
import android.app.Activity import android.app.Activity
@@ -32,6 +18,7 @@ import androidx.navigation.fragment.findNavController
import androidx.preference.* import androidx.preference.*
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.michatec.radio.dialogs.ErrorDialog import com.michatec.radio.dialogs.ErrorDialog
import com.michatec.radio.dialogs.ThemeSelectionDialog
import com.michatec.radio.dialogs.YesNoDialog import com.michatec.radio.dialogs.YesNoDialog
import com.michatec.radio.helpers.* import com.michatec.radio.helpers.*
import com.michatec.radio.helpers.AppThemeHelper.getColor import com.michatec.radio.helpers.AppThemeHelper.getColor
@@ -45,7 +32,7 @@ import java.util.*
/* /*
* SettingsFragment class * SettingsFragment class
*/ */
class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogListener { class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogListener, ThemeSelectionDialog.ThemeSelectionDialogListener {
/* Define log tag */ /* Define log tag */
@@ -69,33 +56,17 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
val screen = preferenceManager.createPreferenceScreen(context) val screen = preferenceManager.createPreferenceScreen(context)
// set up "App Theme" preference // set up "App Theme" preference
val preferenceThemeSelection = ListPreference(activity as Context) val preferenceThemeSelection = Preference(activity as Context)
preferenceThemeSelection.title = getString(R.string.pref_theme_selection_title) preferenceThemeSelection.title = getString(R.string.pref_theme_selection_title)
preferenceThemeSelection.setIcon(R.drawable.ic_brush_24dp) preferenceThemeSelection.setIcon(R.drawable.ic_brush_24dp)
preferenceThemeSelection.key = Keys.PREF_THEME_SELECTION preferenceThemeSelection.key = Keys.PREF_THEME_SELECTION
preferenceThemeSelection.summary = "${getString(R.string.pref_theme_selection_summary)} ${ preferenceThemeSelection.summary = "${getString(R.string.pref_theme_selection_summary)} ${
AppThemeHelper.getCurrentTheme(activity as Context) AppThemeHelper.getCurrentTheme(activity as Context)
}" }"
preferenceThemeSelection.entries = arrayOf( preferenceThemeSelection.setOnPreferenceClickListener {
getString(R.string.pref_theme_selection_mode_device_default), // show theme selection dialog
getString(R.string.pref_theme_selection_mode_light), ThemeSelectionDialog(this).show(activity as Context)
getString(R.string.pref_theme_selection_mode_dark) return@setOnPreferenceClickListener true
)
preferenceThemeSelection.entryValues = arrayOf(
Keys.STATE_THEME_FOLLOW_SYSTEM,
Keys.STATE_THEME_LIGHT_MODE,
Keys.STATE_THEME_DARK_MODE
)
preferenceThemeSelection.setDefaultValue(Keys.STATE_THEME_FOLLOW_SYSTEM)
preferenceThemeSelection.setOnPreferenceChangeListener { preference, newValue ->
if (preference is ListPreference) {
val index: Int = preference.entryValues.indexOf(newValue)
preferenceThemeSelection.summary =
"${getString(R.string.pref_theme_selection_summary)} ${preference.entries[index]}"
return@setOnPreferenceChangeListener true
} else {
return@setOnPreferenceChangeListener false
}
} }
// set up "Update Station Images" preference // set up "Update Station Images" preference
@@ -114,7 +85,6 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
return@setOnPreferenceClickListener true return@setOnPreferenceClickListener true
} }
// set up "Update Stations" preference // set up "Update Stations" preference
val preferenceUpdateCollection = Preference(activity as Context) val preferenceUpdateCollection = Preference(activity as Context)
preferenceUpdateCollection.title = getString(R.string.pref_update_collection_title) preferenceUpdateCollection.title = getString(R.string.pref_update_collection_title)
@@ -193,7 +163,8 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
preferenceEnableEditingStreamUri.key = Keys.PREF_EDIT_STREAMS_URIS preferenceEnableEditingStreamUri.key = Keys.PREF_EDIT_STREAMS_URIS
preferenceEnableEditingStreamUri.summaryOn = getString(R.string.pref_edit_station_stream_summary_enabled) preferenceEnableEditingStreamUri.summaryOn = getString(R.string.pref_edit_station_stream_summary_enabled)
preferenceEnableEditingStreamUri.summaryOff = getString(R.string.pref_edit_station_stream_summary_disabled) preferenceEnableEditingStreamUri.summaryOff = getString(R.string.pref_edit_station_stream_summary_disabled)
preferenceEnableEditingStreamUri.setDefaultValue(PreferencesHelper.loadEditStreamUrisEnabled()) preferenceEnableEditingStreamUri.setDefaultValue(PreferencesHelper.loadEditStreamUrisEnabled(context))
preferenceEnableEditingStreamUri.isEnabled = PreferencesHelper.loadEditStreamUrisEnabled(context)
// set up "Edit Stations" preference // set up "Edit Stations" preference
@@ -203,7 +174,7 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
preferenceEnableEditingGeneral.key = Keys.PREF_EDIT_STATIONS preferenceEnableEditingGeneral.key = Keys.PREF_EDIT_STATIONS
preferenceEnableEditingGeneral.summaryOn = getString(R.string.pref_edit_station_summary_enabled) preferenceEnableEditingGeneral.summaryOn = getString(R.string.pref_edit_station_summary_enabled)
preferenceEnableEditingGeneral.summaryOff = getString(R.string.pref_edit_station_summary_disabled) preferenceEnableEditingGeneral.summaryOff = getString(R.string.pref_edit_station_summary_disabled)
preferenceEnableEditingGeneral.setDefaultValue(PreferencesHelper.loadEditStationsEnabled()) preferenceEnableEditingGeneral.setDefaultValue(PreferencesHelper.loadEditStationsEnabled(context))
preferenceEnableEditingGeneral.setOnPreferenceChangeListener { _, newValue -> preferenceEnableEditingGeneral.setOnPreferenceChangeListener { _, newValue ->
when (newValue) { when (newValue) {
true -> { true -> {
@@ -217,7 +188,6 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
return@setOnPreferenceChangeListener true return@setOnPreferenceChangeListener true
} }
// set up "App Version" preference // set up "App Version" preference
val preferenceAppVersion = Preference(context) val preferenceAppVersion = Preference(context)
preferenceAppVersion.title = getString(R.string.pref_app_version_title) preferenceAppVersion.title = getString(R.string.pref_app_version_title)
@@ -318,6 +288,26 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
preferenceScreen = screen preferenceScreen = screen
} }
/* Overrides onThemeSelectionDialog from ThemeSelectionDialogListener */
override fun onThemeSelectionDialog(dialogResult: Boolean, selectedTheme: String) {
if (dialogResult) {
// update summary
val themes = arrayOf(
getString(R.string.pref_theme_selection_mode_device_default),
getString(R.string.pref_theme_selection_mode_light),
getString(R.string.pref_theme_selection_mode_dark)
)
val themeValues = arrayOf(
Keys.STATE_THEME_FOLLOW_SYSTEM,
Keys.STATE_THEME_LIGHT_MODE,
Keys.STATE_THEME_DARK_MODE
)
val index = themeValues.indexOf(selectedTheme)
val preferenceThemeSelection = findPreference<Preference>(Keys.PREF_THEME_SELECTION)
preferenceThemeSelection?.summary = "${getString(R.string.pref_theme_selection_summary)} ${themes[index]}"
}
}
/* Overrides onYesNoDialog from YesNoDialogListener */ /* Overrides onYesNoDialog from YesNoDialogListener */
override fun onYesNoDialog( override fun onYesNoDialog(

View File

@@ -19,6 +19,7 @@ import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import android.text.Editable import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.view.KeyEvent
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@@ -62,8 +63,8 @@ class CollectionAdapter(
/* Main class variables */ /* Main class variables */
private lateinit var collectionViewModel: CollectionViewModel private lateinit var collectionViewModel: CollectionViewModel
private var collection: Collection = Collection() private var collection: Collection = Collection()
private var editStationsEnabled: Boolean = PreferencesHelper.loadEditStationsEnabled() private var editStationsEnabled: Boolean = PreferencesHelper.loadEditStationsEnabled(context)
private var editStationStreamsEnabled: Boolean = PreferencesHelper.loadEditStreamUrisEnabled() private var editStationStreamsEnabled: Boolean = PreferencesHelper.loadEditStreamUrisEnabled(context)
private var expandedStationUuid: String = PreferencesHelper.loadStationListStreamUuid() private var expandedStationUuid: String = PreferencesHelper.loadStationListStreamUuid()
private var expandedStationPosition: Int = -1 private var expandedStationPosition: Int = -1
var isExpandedForEdit: Boolean = false var isExpandedForEdit: Boolean = false
@@ -214,6 +215,8 @@ class CollectionAdapter(
stationViewHolder.stationNameEditView.imeOptions = stationViewHolder.stationNameEditView.imeOptions =
EditorInfo.IME_ACTION_DONE EditorInfo.IME_ACTION_DONE
} }
// Allow internal focus
stationViewHolder.stationCardView.descendantFocusability = ViewGroup.FOCUS_AFTER_DESCENDANTS
} }
// hide edit views // hide edit views
else -> { else -> {
@@ -222,6 +225,8 @@ class CollectionAdapter(
stationViewHolder.stationStarredView.isVisible = station.starred stationViewHolder.stationStarredView.isVisible = station.starred
stationViewHolder.editViews.isGone = true stationViewHolder.editViews.isGone = true
stationViewHolder.stationUriEditView.isGone = true stationViewHolder.stationUriEditView.isGone = true
// Block internal focus
stationViewHolder.stationCardView.descendantFocusability = ViewGroup.FOCUS_BLOCK_DESCENDANTS
} }
} }
} }
@@ -387,6 +392,7 @@ class CollectionAdapter(
false -> stationViewHolder.playButtonView.visibility = View.INVISIBLE false -> stationViewHolder.playButtonView.visibility = View.INVISIBLE
} }
stationViewHolder.stationCardView.setOnClickListener { stationViewHolder.stationCardView.setOnClickListener {
if (expandedStationPosition == stationViewHolder.bindingAdapterPosition) return@setOnClickListener
collectionAdapterListener.onPlayButtonTapped(station.uuid) collectionAdapterListener.onPlayButtonTapped(station.uuid)
} }
stationViewHolder.playButtonView.setOnClickListener { stationViewHolder.playButtonView.setOnClickListener {
@@ -401,6 +407,38 @@ class CollectionAdapter(
stationViewHolder.stationImageView.setOnClickListener { stationViewHolder.stationImageView.setOnClickListener {
collectionAdapterListener.onPlayButtonTapped(station.uuid) collectionAdapterListener.onPlayButtonTapped(station.uuid)
} }
// TV improvement: Allow opening edit view with DPAD_LEFT
stationViewHolder.stationCardView.setOnKeyListener { _, keyCode, event ->
if (event.action == KeyEvent.ACTION_DOWN) {
when (keyCode) {
KeyEvent.KEYCODE_DPAD_LEFT -> {
if (editStationsEnabled && expandedStationPosition != stationViewHolder.bindingAdapterPosition) {
val position: Int = stationViewHolder.bindingAdapterPosition
toggleEditViews(position, station.uuid)
return@setOnKeyListener true
}
}
KeyEvent.KEYCODE_NUMPAD_2, KeyEvent.KEYCODE_2, KeyEvent.KEYCODE_BACK -> {
if (expandedStationPosition == stationViewHolder.bindingAdapterPosition) {
val position: Int = stationViewHolder.bindingAdapterPosition
toggleEditViews(position, station.uuid)
return@setOnKeyListener true
}
}
KeyEvent.KEYCODE_NUMPAD_0, KeyEvent.KEYCODE_0, KeyEvent.KEYCODE_DEL -> {
removeStation(context, stationViewHolder.bindingAdapterPosition)
return@setOnKeyListener true
}
KeyEvent.KEYCODE_NUMPAD_1, KeyEvent.KEYCODE_1, KeyEvent.KEYCODE_SPACE -> {
toggleStarredStation(context, stationViewHolder.bindingAdapterPosition)
return@setOnKeyListener true
}
}
}
false
}
stationViewHolder.playButtonView.setOnLongClickListener { stationViewHolder.playButtonView.setOnLongClickListener {
if (editStationsEnabled) { if (editStationsEnabled) {
val position: Int = stationViewHolder.bindingAdapterPosition val position: Int = stationViewHolder.bindingAdapterPosition
@@ -649,9 +687,9 @@ class CollectionAdapter(
SharedPreferences.OnSharedPreferenceChangeListener { _, key -> SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
when (key) { when (key) {
Keys.PREF_EDIT_STATIONS -> editStationsEnabled = Keys.PREF_EDIT_STATIONS -> editStationsEnabled =
PreferencesHelper.loadEditStationsEnabled() PreferencesHelper.loadEditStationsEnabled(context)
Keys.PREF_EDIT_STREAMS_URIS -> editStationStreamsEnabled = Keys.PREF_EDIT_STREAMS_URIS -> editStationStreamsEnabled =
PreferencesHelper.loadEditStreamUrisEnabled() PreferencesHelper.loadEditStreamUrisEnabled(context)
} }
} }
/* /*

View File

@@ -16,7 +16,9 @@ package com.michatec.radio.dialogs
import android.content.Context import android.content.Context
import android.view.LayoutInflater import android.view.LayoutInflater
import android.widget.Button
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.core.view.isGone
import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@@ -45,6 +47,8 @@ class AddStationDialog (
/* Main class variables */ /* Main class variables */
private lateinit var dialog: AlertDialog private lateinit var dialog: AlertDialog
private lateinit var stationSearchResultList: RecyclerView private lateinit var stationSearchResultList: RecyclerView
private var customPositiveButton: Button? = null
private var customNegativeButton: Button? = null
private lateinit var searchResultAdapter: SearchResultAdapter private lateinit var searchResultAdapter: SearchResultAdapter
private var station: Station = Station() private var station: Station = Station()
@@ -73,6 +77,10 @@ class AddStationDialog (
// set up list of search results // set up list of search results
setupRecyclerView(context) setupRecyclerView(context)
// find custom buttons (for TV layout)
customPositiveButton = view.findViewById(R.id.dialog_positive_button)
customNegativeButton = view.findViewById(R.id.dialog_negative_button)
// add okay ("Add") button // add okay ("Add") button
builder.setPositiveButton(R.string.dialog_find_station_button_add) { _, _ -> builder.setPositiveButton(R.string.dialog_find_station_button_add) { _, _ ->
// listen for click on add button // listen for click on add button
@@ -88,6 +96,17 @@ class AddStationDialog (
searchResultAdapter.stopPrePlayback() searchResultAdapter.stopPrePlayback()
} }
// set up custom buttons if they exist (TV layout)
customPositiveButton?.setOnClickListener {
listener.onAddStationDialog(station)
searchResultAdapter.stopPrePlayback()
dialog.dismiss()
}
customNegativeButton?.setOnClickListener {
searchResultAdapter.stopPrePlayback()
dialog.dismiss()
}
// set dialog view // set dialog view
builder.setView(view) builder.setView(view)
@@ -95,9 +114,17 @@ class AddStationDialog (
dialog = builder.create() dialog = builder.create()
dialog.show() dialog.show()
// initially disable "Add" button // handle button visibility and state
if (customPositiveButton != null) {
// hide default buttons if custom ones are used
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isGone = true
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).isGone = true
customPositiveButton?.isEnabled = false
} else {
// initially disable default "Add" button
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
} }
}
/* Sets up list of results (RecyclerView) */ /* Sets up list of results (RecyclerView) */
@@ -117,12 +144,14 @@ class AddStationDialog (
/* Implement activateAddButton to enable the "Add" button */ /* Implement activateAddButton to enable the "Add" button */
override fun activateAddButton() { override fun activateAddButton() {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true
customPositiveButton?.isEnabled = true
} }
/* Implement deactivateAddButton to disable the "Add" button */ /* Implement deactivateAddButton to disable the "Add" button */
override fun deactivateAddButton() { override fun deactivateAddButton() {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
customPositiveButton?.isEnabled = false
} }

View File

@@ -21,6 +21,7 @@ import android.os.Handler
import android.os.Looper import android.os.Looper
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import android.widget.Button
import android.widget.ProgressBar import android.widget.ProgressBar
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
@@ -63,6 +64,8 @@ class FindStationDialog (
private lateinit var searchRequestProgressIndicator: ProgressBar private lateinit var searchRequestProgressIndicator: ProgressBar
private lateinit var noSearchResultsTextView: MaterialTextView private lateinit var noSearchResultsTextView: MaterialTextView
private lateinit var stationSearchResultList: RecyclerView private lateinit var stationSearchResultList: RecyclerView
private var customPositiveButton: Button? = null
private var customNegativeButton: Button? = null
private lateinit var searchResultAdapter: SearchResultAdapter private lateinit var searchResultAdapter: SearchResultAdapter
private lateinit var radioBrowserSearch: RadioBrowserSearch private lateinit var radioBrowserSearch: RadioBrowserSearch
private lateinit var directInputCheck: DirectInputCheck private lateinit var directInputCheck: DirectInputCheck
@@ -134,6 +137,10 @@ class FindStationDialog (
// set up list of search results // set up list of search results
setupRecyclerView(context) setupRecyclerView(context)
// find custom buttons (for TV layout)
customPositiveButton = view.findViewById(R.id.dialog_positive_button)
customNegativeButton = view.findViewById(R.id.dialog_negative_button)
// add okay ("Add") button // add okay ("Add") button
builder.setPositiveButton(R.string.dialog_find_station_button_add) { _, _ -> builder.setPositiveButton(R.string.dialog_find_station_button_add) { _, _ ->
// listen for click on add button // listen for click on add button
@@ -152,6 +159,18 @@ class FindStationDialog (
searchResultAdapter.stopPrePlayback() searchResultAdapter.stopPrePlayback()
} }
// set up custom buttons if they exist (TV layout)
customPositiveButton?.setOnClickListener {
listener.onFindStationDialog(station)
searchResultAdapter.stopPrePlayback()
dialog.dismiss()
}
customNegativeButton?.setOnClickListener {
radioBrowserSearch.stopSearchRequest()
searchResultAdapter.stopPrePlayback()
dialog.dismiss()
}
// listen for input // listen for input
stationSearchBoxView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { stationSearchBoxView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextChange(query: String): Boolean { override fun onQueryTextChange(query: String): Boolean {
@@ -174,11 +193,19 @@ class FindStationDialog (
dialog = builder.create() dialog = builder.create()
dialog.show() dialog.show()
// initially disable "Add" button // handle button visibility and state
if (customPositiveButton != null) {
// hide default buttons if custom ones are used
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isGone = true
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).isGone = true
customPositiveButton?.isEnabled = false
} else {
// initially disable default "Add" button
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isAllCaps = true dialog.getButton(AlertDialog.BUTTON_POSITIVE).isAllCaps = true
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).isAllCaps = true dialog.getButton(AlertDialog.BUTTON_NEGATIVE).isAllCaps = true
} }
}
/* Sets up list of results (RecyclerView) */ /* Sets up list of results (RecyclerView) */
@@ -242,12 +269,14 @@ class FindStationDialog (
/* Makes the "Add" button clickable */ /* Makes the "Add" button clickable */
override fun activateAddButton() { override fun activateAddButton() {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true
customPositiveButton?.isEnabled = true
searchRequestProgressIndicator.isGone = true searchRequestProgressIndicator.isGone = true
noSearchResultsTextView.isGone = true noSearchResultsTextView.isGone = true
} }
override fun deactivateAddButton() { override fun deactivateAddButton() {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
customPositiveButton?.isEnabled = false
searchRequestProgressIndicator.isGone = true searchRequestProgressIndicator.isGone = true
noSearchResultsTextView.isGone = true noSearchResultsTextView.isGone = true
} }
@@ -256,6 +285,7 @@ class FindStationDialog (
/* Resets the dialog layout to default state */ /* Resets the dialog layout to default state */
private fun resetLayout(clearAdapter: Boolean = false) { private fun resetLayout(clearAdapter: Boolean = false) {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
customPositiveButton?.isEnabled = false
searchRequestProgressIndicator.isGone = true searchRequestProgressIndicator.isGone = true
noSearchResultsTextView.isGone = true noSearchResultsTextView.isGone = true
searchResultAdapter.resetSelection(clearAdapter) searchResultAdapter.resetSelection(clearAdapter)
@@ -265,6 +295,7 @@ class FindStationDialog (
/* Display the "No Results" error - hide other unneeded views */ /* Display the "No Results" error - hide other unneeded views */
private fun showNoResultsError() { private fun showNoResultsError() {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
customPositiveButton?.isEnabled = false
searchRequestProgressIndicator.isGone = true searchRequestProgressIndicator.isGone = true
noSearchResultsTextView.isVisible = true noSearchResultsTextView.isVisible = true
} }
@@ -273,6 +304,7 @@ class FindStationDialog (
/* Display the "No Results" error - hide other unneeded views */ /* Display the "No Results" error - hide other unneeded views */
private fun showProgressIndicator() { private fun showProgressIndicator() {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
customPositiveButton?.isEnabled = false
searchRequestProgressIndicator.isVisible = true searchRequestProgressIndicator.isVisible = true
noSearchResultsTextView.isGone = true noSearchResultsTextView.isGone = true
} }

View File

@@ -0,0 +1,111 @@
package com.michatec.radio.dialogs
import android.content.Context
import android.view.LayoutInflater
import android.widget.RadioButton
import androidx.appcompat.app.AlertDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.michatec.radio.Keys
import com.michatec.radio.R
import com.michatec.radio.helpers.AppThemeHelper
import com.michatec.radio.helpers.PreferencesHelper
/*
* ThemeSelectionDialog class
*/
class ThemeSelectionDialog(private var themeSelectionDialogListener: ThemeSelectionDialogListener) {
/* Interface used to communicate back to activity */
interface ThemeSelectionDialogListener {
fun onThemeSelectionDialog(dialogResult: Boolean, selectedTheme: String) {
}
}
/* Main class variables */
private lateinit var dialog: AlertDialog
/* Update radio buttons to reflect current theme */
private fun updateRadioButtons(
context: Context,
radioFollowSystem: RadioButton,
radioLight: RadioButton,
radioDark: RadioButton
) {
val currentTheme = AppThemeHelper.getCurrentTheme(context)
when (currentTheme) {
context.getString(R.string.pref_theme_selection_mode_device_default) -> {
radioFollowSystem.isChecked = true
}
context.getString(R.string.pref_theme_selection_mode_light) -> {
radioLight.isChecked = true
}
context.getString(R.string.pref_theme_selection_mode_dark) -> {
radioDark.isChecked = true
}
}
}
/* Construct and show dialog */
fun show(context: Context) {
// prepare dialog builder
val builder = MaterialAlertDialogBuilder(context)
// inflate custom layout
val inflater = LayoutInflater.from(context)
val view = inflater.inflate(R.layout.dialog_theme_selection, null)
// find radio buttons
val radioGroup = view.findViewById<android.widget.RadioGroup>(R.id.theme_radio_group)
val radioFollowSystem = view.findViewById<RadioButton>(R.id.radio_theme_follow_system)
val radioLight = view.findViewById<RadioButton>(R.id.radio_theme_light)
val radioDark = view.findViewById<RadioButton>(R.id.radio_theme_dark)
// set current selection
val currentTheme = AppThemeHelper.getCurrentTheme(context)
when (currentTheme) {
context.getString(R.string.pref_theme_selection_mode_device_default) -> {
radioFollowSystem.isChecked = true
}
context.getString(R.string.pref_theme_selection_mode_light) -> {
radioLight.isChecked = true
}
context.getString(R.string.pref_theme_selection_mode_dark) -> {
radioDark.isChecked = true
}
}
// set up radio group listener
radioGroup.setOnCheckedChangeListener { _, checkedId ->
val selectedTheme = when (checkedId) {
R.id.radio_theme_follow_system -> Keys.STATE_THEME_FOLLOW_SYSTEM
R.id.radio_theme_light -> Keys.STATE_THEME_LIGHT_MODE
R.id.radio_theme_dark -> Keys.STATE_THEME_DARK_MODE
else -> Keys.STATE_THEME_FOLLOW_SYSTEM
}
// save theme selection to preferences
PreferencesHelper.saveThemeSelection(selectedTheme)
// apply theme immediately
AppThemeHelper.setTheme(selectedTheme)
// notify listener
themeSelectionDialogListener.onThemeSelectionDialog(true, selectedTheme)
// dismiss dialog
dialog.dismiss()
}
// set custom view
builder.setView(view)
// handle outside-click as cancel
builder.setOnCancelListener {
themeSelectionDialogListener.onThemeSelectionDialog(false, Keys.STATE_THEME_FOLLOW_SYSTEM)
}
// display dialog
dialog = builder.create()
dialog.show()
}
}

View File

@@ -16,6 +16,7 @@ package com.michatec.radio.helpers
import android.content.Context import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.util.Log import android.util.Log
import androidx.core.content.edit import androidx.core.content.edit
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
@@ -222,14 +223,24 @@ object PreferencesHelper {
} }
/* Save currently selected app theme */
fun saveThemeSelection(theme: String) {
sharedPreferences.edit {
putString(Keys.PREF_THEME_SELECTION, theme)
}
}
/* Loads value of the option: Edit Stations */ /* Loads value of the option: Edit Stations */
fun loadEditStationsEnabled(): Boolean { fun loadEditStationsEnabled(context: Context): Boolean {
return sharedPreferences.getBoolean(Keys.PREF_EDIT_STATIONS, true) val defaultValue = !context.packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
return sharedPreferences.getBoolean(Keys.PREF_EDIT_STATIONS, defaultValue)
} }
/* Loads value of the option: Edit Station Streams */ /* Loads value of the option: Edit Station Streams */
fun loadEditStreamUrisEnabled(): Boolean { fun loadEditStreamUrisEnabled(context: Context): Boolean {
return sharedPreferences.getBoolean(Keys.PREF_EDIT_STREAMS_URIS, true) val defaultValue = !context.packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
return sharedPreferences.getBoolean(Keys.PREF_EDIT_STREAMS_URIS, defaultValue)
} }

View File

@@ -1,17 +1,3 @@
/*
* LayoutHolder.kt
* Implements the LayoutHolder class
* A LayoutHolder hold references to the main views
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.ui package com.michatec.radio.ui
import android.annotation.SuppressLint import android.annotation.SuppressLint
@@ -19,6 +5,7 @@ import android.content.ClipData
import android.content.ClipboardManager import android.content.ClipboardManager
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.drawable.AnimatedVectorDrawable import android.graphics.drawable.AnimatedVectorDrawable
import android.os.Build import android.os.Build
import android.view.View import android.view.View
@@ -54,30 +41,32 @@ data class LayoutHolder(var rootView: View) {
/* Main class variables */ /* Main class variables */
var recyclerView: RecyclerView = rootView.findViewById(R.id.station_list) var recyclerView: RecyclerView = rootView.findViewById(R.id.station_list)
val layoutManager: LinearLayoutManager val layoutManager: LinearLayoutManager
private var bottomSheet: ConstraintLayout = rootView.findViewById(R.id.bottom_sheet) private var bottomSheet: ConstraintLayout? = rootView.findViewById(R.id.bottom_sheet)
//private var sheetMetadataViews: Group //private var sheetMetadataViews: Group
private var sleepTimerRunningViews: Group = rootView.findViewById(R.id.sleep_timer_running_views) private var sleepTimerRunningViews: Group? = rootView.findViewById(R.id.sleep_timer_running_views)
private var downloadProgressIndicator: ProgressBar = rootView.findViewById(R.id.download_progress_indicator) private var downloadProgressIndicator: ProgressBar? = rootView.findViewById(R.id.download_progress_indicator)
private var stationImageView: ImageView = rootView.findViewById(R.id.station_icon) private var stationImageView: ImageView? = rootView.findViewById(R.id.station_icon)
private var stationNameView: TextView = rootView.findViewById(R.id.player_station_name) private var stationNameView: TextView? = rootView.findViewById(R.id.player_station_name)
private var metadataView: TextView = rootView.findViewById(R.id.player_station_metadata) private var metadataView: TextView? = rootView.findViewById(R.id.player_station_metadata)
var playButtonView: ImageButton = rootView.findViewById(R.id.player_play_button) var playButtonView: ImageButton = rootView.findViewById(R.id.player_play_button)
var playerPrevButtonView: ImageButton? = rootView.findViewById(R.id.player_prev_button)
var playerNextButtonView: ImageButton? = rootView.findViewById(R.id.player_next_button)
private var bufferingIndicator: ProgressBar = rootView.findViewById(R.id.player_buffering_indicator) private var bufferingIndicator: ProgressBar = rootView.findViewById(R.id.player_buffering_indicator)
private var sheetStreamingLinkHeadline: TextView = rootView.findViewById(R.id.sheet_streaming_link_headline) private var sheetStreamingLinkHeadline: TextView? = rootView.findViewById(R.id.sheet_streaming_link_headline)
private var sheetStreamingLinkView: TextView = rootView.findViewById(R.id.sheet_streaming_link) private var sheetStreamingLinkView: TextView? = rootView.findViewById(R.id.sheet_streaming_link)
private var sheetMetadataHistoryHeadline: TextView = rootView.findViewById(R.id.sheet_metadata_headline) private var sheetMetadataHistoryHeadline: TextView? = rootView.findViewById(R.id.sheet_metadata_headline)
private var sheetMetadataHistoryView: TextView = rootView.findViewById(R.id.sheet_metadata_history) private var sheetMetadataHistoryView: TextView? = rootView.findViewById(R.id.sheet_metadata_history)
private var sheetNextMetadataView: ImageButton = rootView.findViewById(R.id.sheet_next_metadata_button) private var sheetNextMetadataView: ImageButton? = rootView.findViewById(R.id.sheet_next_metadata_button)
private var sheetPreviousMetadataView: ImageButton = rootView.findViewById(R.id.sheet_previous_metadata_button) private var sheetPreviousMetadataView: ImageButton? = rootView.findViewById(R.id.sheet_previous_metadata_button)
private var sheetCopyMetadataButtonView: ImageButton = rootView.findViewById(R.id.copy_station_metadata_button) private var sheetCopyMetadataButtonView: ImageButton? = rootView.findViewById(R.id.copy_station_metadata_button)
private var sheetShareLinkButtonView: ImageView = rootView.findViewById(R.id.sheet_share_link_button) private var sheetShareLinkButtonView: ImageView? = rootView.findViewById(R.id.sheet_share_link_button)
private var sheetBitrateView: TextView = rootView.findViewById(R.id.sheet_bitrate_view) private var sheetBitrateView: TextView? = rootView.findViewById(R.id.sheet_bitrate_view)
var sheetSleepTimerStartButtonView: ImageButton = rootView.findViewById(R.id.sleep_timer_start_button) var sheetSleepTimerStartButtonView: ImageButton? = rootView.findViewById(R.id.sleep_timer_start_button)
var sheetSleepTimerCancelButtonView: ImageButton = rootView.findViewById(R.id.sleep_timer_cancel_button) var sheetSleepTimerCancelButtonView: ImageButton? = rootView.findViewById(R.id.sleep_timer_cancel_button)
private var sheetSleepTimerRemainingTimeView: TextView = rootView.findViewById(R.id.sleep_timer_remaining_time) private var sheetSleepTimerRemainingTimeView: TextView = rootView.findViewById(R.id.sleep_timer_remaining_time)
private var onboardingLayout: ConstraintLayout = rootView.findViewById(R.id.onboarding_layout) private var onboardingLayout: ConstraintLayout = rootView.findViewById(R.id.onboarding_layout)
private var bottomSheetBehavior: BottomSheetBehavior<ConstraintLayout> = BottomSheetBehavior.from(bottomSheet) private var bottomSheetBehavior: BottomSheetBehavior<ConstraintLayout>? = bottomSheet?.let { BottomSheetBehavior.from(it) }
private var metadataHistory: MutableList<String> private var metadataHistory: MutableList<String>
private var metadataHistoryPosition: Int private var metadataHistoryPosition: Int
private var isBuffering: Boolean private var isBuffering: Boolean
@@ -97,31 +86,31 @@ data class LayoutHolder(var rootView: View) {
recyclerView.itemAnimator = DefaultItemAnimator() recyclerView.itemAnimator = DefaultItemAnimator()
// set up metadata history next and previous buttons // set up metadata history next and previous buttons
sheetPreviousMetadataView.setOnClickListener { sheetPreviousMetadataView?.setOnClickListener {
if (metadataHistory.isNotEmpty()) { if (metadataHistory.isNotEmpty()) {
if (metadataHistoryPosition > 0) { if (metadataHistoryPosition > 0) {
metadataHistoryPosition -= 1 metadataHistoryPosition -= 1
} else { } else {
metadataHistoryPosition = metadataHistory.size - 1 metadataHistoryPosition = metadataHistory.size - 1
} }
sheetMetadataHistoryView.text = metadataHistory[metadataHistoryPosition] sheetMetadataHistoryView?.text = metadataHistory[metadataHistoryPosition]
} }
} }
sheetNextMetadataView.setOnClickListener { sheetNextMetadataView?.setOnClickListener {
if (metadataHistory.isNotEmpty()) { if (metadataHistory.isNotEmpty()) {
if (metadataHistoryPosition < metadataHistory.size - 1) { if (metadataHistoryPosition < metadataHistory.size - 1) {
metadataHistoryPosition += 1 metadataHistoryPosition += 1
} else { } else {
metadataHistoryPosition = 0 metadataHistoryPosition = 0
} }
sheetMetadataHistoryView.text = metadataHistory[metadataHistoryPosition] sheetMetadataHistoryView?.text = metadataHistory[metadataHistoryPosition]
} }
} }
sheetMetadataHistoryView.setOnLongClickListener { sheetMetadataHistoryView?.setOnLongClickListener {
copyMetadataHistoryToClipboard() copyMetadataHistoryToClipboard()
return@setOnLongClickListener true return@setOnLongClickListener true
} }
sheetMetadataHistoryHeadline.setOnLongClickListener { sheetMetadataHistoryHeadline?.setOnLongClickListener {
copyMetadataHistoryToClipboard() copyMetadataHistoryToClipboard()
return@setOnLongClickListener true return@setOnLongClickListener true
} }
@@ -137,29 +126,29 @@ data class LayoutHolder(var rootView: View) {
// set default metadata views, when playback has stopped // set default metadata views, when playback has stopped
if (!isPlaying) { if (!isPlaying) {
metadataView.text = station.name metadataView?.text = station.name
sheetMetadataHistoryView.text = station.name sheetMetadataHistoryView?.text = station.name
// sheetMetadataHistoryView.isSelected = true // sheetMetadataHistoryView.isSelected = true
} }
// update name // update name
stationNameView.text = station.name stationNameView?.text = station.name
// toggle text scrolling (marquee) if necessary // toggle text scrolling (marquee) if necessary
stationNameView.isSelected = isPlaying stationNameView?.isSelected = isPlaying
// reduce the shadow left and right because of scrolling (Marquee) // reduce the shadow left and right because of scrolling (Marquee)
stationNameView.setFadingEdgeLength(8) stationNameView?.setFadingEdgeLength(8)
// update cover // update cover
if (station.imageColor != -1) { if (station.imageColor != -1) {
stationImageView.setBackgroundColor(station.imageColor) stationImageView?.setBackgroundColor(station.imageColor)
} }
stationImageView.setImageBitmap(ImageHelper.getStationImage(context, station.smallImage)) stationImageView?.setImageBitmap(ImageHelper.getStationImage(context, station.smallImage))
stationImageView.contentDescription = "${context.getString(R.string.descr_player_station_image)}: ${station.name}" stationImageView?.contentDescription = "${context.getString(R.string.descr_player_station_image)}: ${station.name}"
// update streaming link // update streaming link
sheetStreamingLinkView.text = station.getStreamUri() sheetStreamingLinkView?.text = station.getStreamUri()
val bitrateText: CharSequence = if (station.codec.isNotEmpty()) { val bitrateText: CharSequence = if (station.codec.isNotEmpty()) {
if (station.bitrate == 0) { if (station.bitrate == 0) {
@@ -188,50 +177,50 @@ data class LayoutHolder(var rootView: View) {
} }
// update bitrate // update bitrate
sheetBitrateView.text = bitrateText sheetBitrateView?.text = bitrateText
// update click listeners // update click listeners
sheetStreamingLinkHeadline.setOnClickListener { sheetStreamingLinkHeadline?.setOnClickListener {
copyToClipboard( copyToClipboard(
context, context,
sheetStreamingLinkView.text sheetStreamingLinkView?.text ?: ""
) )
} }
sheetStreamingLinkView.setOnClickListener { sheetStreamingLinkView?.setOnClickListener {
copyToClipboard( copyToClipboard(
context, context,
sheetStreamingLinkView.text sheetStreamingLinkView?.text ?: ""
) )
} }
sheetMetadataHistoryHeadline.setOnClickListener { sheetMetadataHistoryHeadline?.setOnClickListener {
copyToClipboard( copyToClipboard(
context, context,
sheetMetadataHistoryView.text sheetMetadataHistoryView?.text ?: ""
) )
} }
sheetMetadataHistoryView.setOnClickListener { sheetMetadataHistoryView?.setOnClickListener {
copyToClipboard( copyToClipboard(
context, context,
sheetMetadataHistoryView.text sheetMetadataHistoryView?.text ?: ""
) )
} }
sheetCopyMetadataButtonView.setOnClickListener { sheetCopyMetadataButtonView?.setOnClickListener {
copyToClipboard( copyToClipboard(
context, context,
sheetMetadataHistoryView.text sheetMetadataHistoryView?.text ?: ""
) )
} }
sheetBitrateView.setOnClickListener { sheetBitrateView?.setOnClickListener {
copyToClipboard( copyToClipboard(
context, context,
sheetBitrateView.text sheetBitrateView?.text ?: ""
) )
} }
sheetShareLinkButtonView.setOnClickListener { sheetShareLinkButtonView?.setOnClickListener {
val share = Intent.createChooser(Intent().apply { val share = Intent.createChooser(Intent().apply {
action = Intent.ACTION_SEND action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_TITLE, stationNameView.text) putExtra(Intent.EXTRA_TITLE, stationNameView?.text)
putExtra(Intent.EXTRA_TEXT, sheetStreamingLinkView.text) putExtra(Intent.EXTRA_TEXT, sheetStreamingLinkView?.text ?: "")
type = "text/plain" type = "text/plain"
}, null) }, null)
context.startActivity(share) context.startActivity(share)
@@ -264,11 +253,11 @@ data class LayoutHolder(var rootView: View) {
fun updateMetadata(metadataHistoryList: MutableList<String>?) { fun updateMetadata(metadataHistoryList: MutableList<String>?) {
if (!metadataHistoryList.isNullOrEmpty()) { if (!metadataHistoryList.isNullOrEmpty()) {
metadataHistory = metadataHistoryList metadataHistory = metadataHistoryList
if (metadataHistory.last() != metadataView.text) { if (metadataHistory.last() != metadataView?.text) {
metadataHistoryPosition = metadataHistory.size - 1 metadataHistoryPosition = metadataHistory.size - 1
val metadataString = metadataHistory[metadataHistoryPosition] val metadataString = metadataHistory[metadataHistoryPosition]
metadataView.text = metadataString metadataView?.text = metadataString
sheetMetadataHistoryView.text = metadataString sheetMetadataHistoryView?.text = metadataString
} }
} }
} }
@@ -278,14 +267,16 @@ data class LayoutHolder(var rootView: View) {
fun updateSleepTimer(context: Context, timeRemaining: Long = 0L) { fun updateSleepTimer(context: Context, timeRemaining: Long = 0L) {
when (timeRemaining) { when (timeRemaining) {
0L -> { 0L -> {
sleepTimerRunningViews.isGone = true sleepTimerRunningViews?.isGone = true
sheetSleepTimerRemainingTimeView.isVisible = false
} }
else -> { else -> {
sleepTimerRunningViews.isVisible = true sleepTimerRunningViews?.isVisible = true
sheetSleepTimerRemainingTimeView.isVisible = true
val sleepTimerTimeRemaining = DateTimeHelper.convertToHoursMinutesSeconds(timeRemaining) val sleepTimerTimeRemaining = DateTimeHelper.convertToHoursMinutesSeconds(timeRemaining)
sheetSleepTimerRemainingTimeView.text = sleepTimerTimeRemaining sheetSleepTimerRemainingTimeView.text = sleepTimerTimeRemaining
sheetSleepTimerRemainingTimeView.contentDescription = "${context.getString(R.string.descr_expanded_player_sleep_timer_remaining_time)}: $sleepTimerTimeRemaining" sheetSleepTimerRemainingTimeView.contentDescription = "${context.getString(R.string.descr_expanded_player_sleep_timer_remaining_time)}: $sleepTimerTimeRemaining"
stationNameView.isSelected = false stationNameView?.isSelected = false
} }
} }
} }
@@ -297,11 +288,11 @@ data class LayoutHolder(var rootView: View) {
playButtonView.setImageResource(R.drawable.ic_audio_waves_animated) playButtonView.setImageResource(R.drawable.ic_audio_waves_animated)
val animatedVectorDrawable = playButtonView.drawable as? AnimatedVectorDrawable val animatedVectorDrawable = playButtonView.drawable as? AnimatedVectorDrawable
animatedVectorDrawable?.start() animatedVectorDrawable?.start()
sheetSleepTimerStartButtonView.isVisible = true sheetSleepTimerStartButtonView?.isVisible = true
// bufferingIndicator.isVisible = false // bufferingIndicator.isVisible = false
} else { } else {
playButtonView.setImageResource(R.drawable.ic_player_play_symbol_42dp) playButtonView.setImageResource(R.drawable.ic_player_play_symbol_42dp)
sheetSleepTimerStartButtonView.isVisible = false sheetSleepTimerStartButtonView?.isVisible = false
// bufferingIndicator.isVisible = isBuffering // bufferingIndicator.isVisible = isBuffering
} }
} }
@@ -316,8 +307,8 @@ data class LayoutHolder(var rootView: View) {
/* Toggles visibility of the download progress indicator */ /* Toggles visibility of the download progress indicator */
fun toggleDownloadProgressIndicator() { fun toggleDownloadProgressIndicator() {
when (PreferencesHelper.loadActiveDownloads()) { when (PreferencesHelper.loadActiveDownloads()) {
Keys.ACTIVE_DOWNLOADS_EMPTY -> downloadProgressIndicator.isGone = true Keys.ACTIVE_DOWNLOADS_EMPTY -> downloadProgressIndicator?.isGone = true
else -> downloadProgressIndicator.isVisible = true else -> downloadProgressIndicator?.isVisible = true
} }
} }
@@ -338,27 +329,27 @@ data class LayoutHolder(var rootView: View) {
/* Initiates the rotation animation of the play button */ /* Initiates the rotation animation of the play button */
fun animatePlaybackButtonStateTransition(context: Context, isPlaying: Boolean) { fun animatePlaybackButtonStateTransition(context: Context, isPlaying: Boolean) {
when (isPlaying) { if (context.packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
true -> { // TV: Toggle play button immediately for snappier feel
val rotateClockwise = AnimationUtils.loadAnimation(context, R.anim.rotate_clockwise_slow) togglePlayButton(isPlaying)
rotateClockwise.setAnimationListener(createAnimationListener(true)) } else {
playButtonView.startAnimation(rotateClockwise) // Handy/Tablet: Rotate the play button
} val rotateAnimation = AnimationUtils.loadAnimation(context, if (isPlaying) R.anim.rotate_clockwise_slow else R.anim.rotate_counterclockwise_fast)
false -> { rotateAnimation.setAnimationListener(createAnimationListener(isPlaying))
val rotateCounterClockwise = AnimationUtils.loadAnimation(context, R.anim.rotate_counterclockwise_fast) playButtonView.startAnimation(rotateAnimation)
rotateCounterClockwise.setAnimationListener(createAnimationListener(false))
playButtonView.startAnimation(rotateCounterClockwise)
}
} }
} }
/* Shows player */ /* Shows player */
fun showPlayer(context: Context): Boolean { fun showPlayer(context: Context): Boolean {
if (bottomSheetBehavior != null) {
UiHelper.setViewMargins(context, recyclerView, 0, 0, 0, Keys.BOTTOM_SHEET_PEEK_HEIGHT) UiHelper.setViewMargins(context, recyclerView, 0, 0, 0, Keys.BOTTOM_SHEET_PEEK_HEIGHT)
if (bottomSheetBehavior.state == BottomSheetBehavior.STATE_HIDDEN && onboardingLayout.isGone) { if (bottomSheetBehavior?.state == BottomSheetBehavior.STATE_HIDDEN && onboardingLayout.isGone) {
bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED bottomSheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
}
} else {
UiHelper.setViewMargins(context, recyclerView, 0, 0, 0, 0)
} }
return true return true
} }
@@ -367,15 +358,15 @@ data class LayoutHolder(var rootView: View) {
/* Hides player */ /* Hides player */
private fun hidePlayer(context: Context): Boolean { private fun hidePlayer(context: Context): Boolean {
UiHelper.setViewMargins(context, recyclerView, 0, 0, 0, 0) UiHelper.setViewMargins(context, recyclerView, 0, 0, 0, 0)
bottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN bottomSheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN
return true return true
} }
/* Minimizes player sheet if expanded */ /* Minimizes player sheet if expanded */
fun minimizePlayerIfExpanded(): Boolean { fun minimizePlayerIfExpanded(): Boolean {
return if (bottomSheetBehavior.state == BottomSheetBehavior.STATE_EXPANDED) { return if (bottomSheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED) {
bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED bottomSheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
true true
} else { } else {
false false
@@ -388,7 +379,7 @@ data class LayoutHolder(var rootView: View) {
return object : Animation.AnimationListener { return object : Animation.AnimationListener {
override fun onAnimationStart(animation: Animation) {} override fun onAnimationStart(animation: Animation) {}
override fun onAnimationEnd(animation: Animation) { override fun onAnimationEnd(animation: Animation) {
// set up button symbol and playback indicator afterwards // set up button symbol and playback indicator afterward
togglePlayButton(isPlaying) togglePlayButton(isPlaying)
} }
@@ -399,9 +390,10 @@ data class LayoutHolder(var rootView: View) {
/* Sets up the player (BottomSheet) */ /* Sets up the player (BottomSheet) */
private fun setupBottomSheet() { private fun setupBottomSheet() {
if (bottomSheetBehavior != null) {
// show / hide the small player // show / hide the small player
bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED bottomSheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
bottomSheetBehavior.addBottomSheetCallback(object : bottomSheetBehavior?.addBottomSheetCallback(object :
BottomSheetBehavior.BottomSheetCallback() { BottomSheetBehavior.BottomSheetCallback() {
override fun onSlide(view: View, slideOffset: Float) { override fun onSlide(view: View, slideOffset: Float) {
} }
@@ -418,19 +410,20 @@ data class LayoutHolder(var rootView: View) {
} }
}) })
// toggle collapsed state on tap // toggle collapsed state on tap
bottomSheet.setOnClickListener { toggleBottomSheetState() } bottomSheet?.setOnClickListener { toggleBottomSheetState() }
stationImageView.setOnClickListener { toggleBottomSheetState() } stationImageView?.setOnClickListener { toggleBottomSheetState() }
stationNameView.setOnClickListener { toggleBottomSheetState() } stationNameView?.setOnClickListener { toggleBottomSheetState() }
metadataView.setOnClickListener { toggleBottomSheetState() } metadataView?.setOnClickListener { toggleBottomSheetState() }
}
} }
/* Toggle expanded/collapsed state of bottom sheet */ /* Toggle expanded/collapsed state of bottom sheet */
private fun toggleBottomSheetState() { private fun toggleBottomSheetState() {
when (bottomSheetBehavior.state) { when (bottomSheetBehavior?.state) {
BottomSheetBehavior.STATE_COLLAPSED -> bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED -> bottomSheetBehavior?.state =
BottomSheetBehavior.STATE_EXPANDED BottomSheetBehavior.STATE_EXPANDED
else -> bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED else -> bottomSheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
} }
} }

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/list_card_stroke_focused" android:state_focused="true" />
<item android:color="@color/list_card_stroke_background" />
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/search_result_background_selected" android:state_focused="true" />
<item android:drawable="@android:color/transparent" />
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/list_card_stroke_focused" android:state_focused="true" />
<item android:color="@color/list_card_stroke_background" />
</selector>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true">
<shape android:shape="rectangle">
<solid android:color="#80FFFFFF" />
<corners android:radius="8dp" />
<stroke android:width="3dp" android:color="@color/default_neutral_white" />
</shape>
</item>
<item android:drawable="@android:color/transparent" />
</selector>

View File

@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- View is "selected" --> <!-- View is "selected" or "focused" (for TV) -->
<item android:drawable="@drawable/shape_search_result_item_selected" android:state_selected="true" /> <item android:drawable="@drawable/shape_search_result_item_selected" android:state_selected="true" />
<item android:drawable="@drawable/shape_search_result_item_selected" android:state_focused="true" />
<!-- Default state. --> <!-- Default state. -->
<item android:drawable="@drawable/shape_search_result_item" /> <item android:drawable="@drawable/shape_search_result_item" />

View File

@@ -1,8 +1,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"> android:shape="oval">
<stroke <stroke
android:width="2dp" android:width="4dp"
android:color="@color/default_neutral_lighter" /> android:color="@color/default_neutral_white" />
<size <size
android:width="56dp" android:width="56dp"
android:height="56dp" /> android:height="56dp" />

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splashBackgroundColor" />
<item
android:width="160dp"
android:height="160dp"
android:gravity="center">
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher" />
</item>
</layer-list>

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_player_sheet_background"
android:padding="24dp">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/station_icon"
android:layout_width="120dp"
android:layout_height="120dp"
android:background="@drawable/shape_cover_small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/RoundedCorners"
app:srcCompat="@drawable/ic_default_station_image_72dp" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/player_station_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:textAppearance="@style/TextAppearance.Material3.HeadlineMedium"
android:textColor="@color/player_sheet_text_main"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/player_play_button"
app:layout_constraintStart_toEndOf="@+id/station_icon"
app:layout_constraintTop_toTopOf="@+id/station_icon"
tools:text="Station Name" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/player_station_metadata"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
android:textColor="@color/player_sheet_text_main"
app:layout_constraintEnd_toEndOf="@+id/player_station_name"
app:layout_constraintStart_toStartOf="@+id/player_station_name"
app:layout_constraintTop_toBottomOf="@+id/player_station_name"
tools:text="Metadata Info" />
<ImageButton
android:id="@+id/player_play_button"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/selector_play_button"
android:focusable="true"
android:scaleType="center"
app:layout_constraintBottom_toBottomOf="@+id/station_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/station_icon"
app:srcCompat="@drawable/ic_player_play_symbol_42dp" />
<LinearLayout
android:id="@+id/detailed_controls_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@+id/station_icon">
<ImageButton
android:id="@+id/sheet_previous_metadata_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
app:srcCompat="@drawable/ic_chevron_left_24dp" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/sheet_metadata_history"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginHorizontal="16dp"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:textColor="@color/player_sheet_text_main"
tools:text="Metadata History" />
<ImageButton
android:id="@+id/sheet_next_metadata_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
app:srcCompat="@drawable/ic_chevron_right_24dp" />
<ImageButton
android:id="@+id/copy_station_metadata_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
app:srcCompat="@drawable/ic_copy_content_24dp" />
<ImageButton
android:id="@+id/sleep_timer_start_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
app:srcCompat="@drawable/ic_sleep_timer_24dp" />
<ImageButton
android:id="@+id/sleep_timer_cancel_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
android:visibility="gone"
app:srcCompat="@drawable/ic_clear_24dp" />
</LinearLayout>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/sleep_timer_remaining_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
android:textColor="@color/player_sheet_text_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/detailed_controls_row"
tools:text="15:00" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/station_list"
android:layout_width="0dp"
android:layout_height="0dp"
android:clipToPadding="false"
android:paddingBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.7" />
<LinearLayout
android:id="@+id/dialog_button_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/dialog_positive_button"
style="@style/Widget.Material3.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dialog_find_station_button_add" />
<Button
android:id="@+id/dialog_negative_button"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/dialog_generic_button_cancel" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<androidx.appcompat.widget.SearchView
android:id="@+id/station_search_box_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:iconifiedByDefault="false"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:queryHint="@string/dialog_find_station_hint" />
<ProgressBar
android:id="@+id/search_request_progress_indicator"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="@+id/station_search_box_view"
app:layout_constraintStart_toStartOf="@+id/station_search_box_view"
app:layout_constraintTop_toBottomOf="@+id/station_search_box_view" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/no_results_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dialog_find_station_no_results"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
android:visibility="gone"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/search_request_progress_indicator" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/station_search_result_list"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:clipToPadding="false"
android:paddingBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/no_results_text_view" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.7" />
<!-- Right side: Actions -->
<LinearLayout
android:id="@+id/dialog_button_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/dialog_positive_button"
style="@style/Widget.Material3.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dialog_find_station_button_add" />
<Button
android:id="@+id/dialog_negative_button"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/dialog_generic_button_cancel" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="800dp"
android:layout_height="wrap_content"
android:padding="24dp">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/dialog_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dialog_error_message_default"
android:textAppearance="@style/TextAppearance.Material3.HeadlineSmall"
android:textColor="@color/text_default"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/dialog_error_message_default" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/dialog_details_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:focusable="true"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:padding="8dp"
android:text="@string/dialog_generic_details_button"
android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
android:textColor="@color/text_default"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dialog_message"
tools:text="@string/dialog_generic_details_button" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/dialog_details"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:focusable="true"
android:clickable="true"
android:scrollbars="vertical"
android:text="@string/dialog_opml_import_details_default"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
android:textColor="@color/text_default"
android:textIsSelectable="true"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dialog_details_link"
tools:text="@string/dialog_opml_import_details_default" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="24dp">
<TextView
android:id="@+id/dialog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_title"
android:textSize="24sp"
android:textStyle="bold"
android:paddingBottom="16dp" />
<RadioGroup
android:id="@+id/theme_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/radio_theme_follow_system"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_mode_device_default"
android:textSize="20sp"
android:padding="12dp"
android:focusable="true"
android:clickable="true" />
<RadioButton
android:id="@+id/radio_theme_light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_mode_light"
android:textSize="20sp"
android:padding="12dp"
android:focusable="true"
android:clickable="true" />
<RadioButton
android:id="@+id/radio_theme_dark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_mode_dark"
android:textSize="20sp"
android:padding="12dp"
android:focusable="true"
android:clickable="true" />
</RadioGroup>
</LinearLayout>

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:focusable="true"
android:clickable="true"
android:nextFocusRight="@+id/dialog_positive_button"
android:background="@drawable/selector_search_result_item">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/station_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.Material3.TitleLarge"
android:textColor="@color/text_default"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Station Name" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/station_url"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
android:textColor="@color/text_lightweight"
app:layout_constraintEnd_toEndOf="@+id/station_name"
app:layout_constraintStart_toStartOf="@+id/station_name"
app:layout_constraintTop_toBottomOf="@+id/station_name"
tools:text="http://stream.url" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/station_bitrate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
android:textColor="@color/text_lightweight"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/station_url"
app:layout_constraintStart_toStartOf="@+id/station_url"
app:layout_constraintTop_toBottomOf="@+id/station_url"
tools:text="128 kbps" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View File

@@ -0,0 +1,206 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/station_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:clipToPadding="false"
android:padding="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<include
layout="@layout/element_onboarding"
android:visibility="gone" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.2"
android:background="@color/player_sheet_background"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/player_ui"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="24dp">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/station_icon"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_marginTop="16dp"
android:background="@drawable/shape_cover_small"
android:contentDescription="@string/descr_player_station_image"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/RoundedCorners"
app:srcCompat="@drawable/ic_default_station_image_72dp" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/player_station_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.Material3.HeadlineMedium"
android:textColor="@color/player_sheet_text_main"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/station_icon"
tools:text="Station Name" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/player_station_metadata"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:ellipsize="end"
android:singleLine="true"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
android:textColor="@color/player_sheet_text_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/player_station_name"
tools:text="Artist - Title" />
<LinearLayout
android:id="@+id/controls_row"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/player_station_metadata">
<ImageButton
android:id="@+id/player_prev_button"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginEnd="16dp"
android:background="@drawable/selector_generic_button_focus"
android:contentDescription="@string/descr_expanded_player_metadata_previous_button"
android:focusable="true"
android:padding="12dp"
app:srcCompat="@drawable/ic_chevron_left_24dp" />
<ImageButton
android:id="@+id/player_play_button"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/selector_play_button"
android:contentDescription="@string/descr_player_playback_button"
android:focusable="true"
android:scaleType="center"
app:srcCompat="@drawable/ic_player_play_symbol_42dp" />
<ImageButton
android:id="@+id/player_next_button"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginStart="16dp"
android:background="@drawable/selector_generic_button_focus"
android:contentDescription="@string/descr_expanded_player_metadata_next_button"
android:focusable="true"
android:padding="12dp"
app:srcCompat="@drawable/ic_chevron_right_24dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_controls_row"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/controls_row">
<ImageButton
android:id="@+id/copy_station_metadata_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginEnd="12dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
android:padding="8dp"
app:srcCompat="@drawable/ic_copy_content_24dp"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@+id/sleep_timer_start_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginEnd="12dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
android:padding="8dp"
app:srcCompat="@drawable/ic_sleep_timer_24dp"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@+id/sleep_timer_cancel_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
android:padding="8dp"
android:visibility="gone"
app:srcCompat="@drawable/ic_clear_24dp"
tools:ignore="ContentDescription" />
</LinearLayout>
<ProgressBar
android:id="@+id/player_buffering_indicator"
style="?android:attr/progressBarStyleLarge"
android:layout_width="96dp"
android:layout_height="96dp"
android:indeterminateTint="@color/player_button_buffering"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/controls_row"
app:layout_constraintEnd_toEndOf="@+id/controls_row"
app:layout_constraintStart_toStartOf="@+id/controls_row"
app:layout_constraintTop_toTopOf="@+id/controls_row" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/sleep_timer_remaining_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:textColor="@color/player_sheet_text_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/secondary_controls_row"
tools:text="15:00" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</LinearLayout>

View File

@@ -29,4 +29,49 @@
app:layout_constraintTop_toBottomOf="@+id/main_toolbar" app:layout_constraintTop_toBottomOf="@+id/main_toolbar"
app:navGraph="@navigation/nav_graph_main" /> app:navGraph="@navigation/nav_graph_main" />
<!-- SPLASH / LOADING SCREEN -->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/loading_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/splashBackgroundColor"
android:elevation="10dp"
android:visibility="visible">
<ImageView
android:id="@+id/loading_logo"
android:layout_width="160dp"
android:layout_height="160dp"
android:contentDescription="@string/icon_launcher"
android:src="@mipmap/ic_launcher"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/loading"
android:textAppearance="@style/TextAppearance.Material3.HeadlineSmall"
android:textColor="@color/default_neutral_white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/loading_logo" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:indeterminate="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/loading_logo"
android:visibility="invisible" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -12,6 +12,8 @@
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginBottom="24dp" android:layout_marginBottom="24dp"
android:focusable="true"
android:clickable="true"
android:stateListAnimator="@null" android:stateListAnimator="@null"
app:backgroundTint="@color/list_card_background" app:backgroundTint="@color/list_card_background"
app:icon="@drawable/ic_add_24dp" app:icon="@drawable/ic_add_24dp"
@@ -28,6 +30,8 @@
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="24dp" android:layout_marginBottom="24dp"
android:focusable="true"
android:clickable="true"
android:stateListAnimator="@null" android:stateListAnimator="@null"
app:backgroundTint="@color/list_card_background" app:backgroundTint="@color/list_card_background"
app:icon="@drawable/ic_settings_24dp" app:icon="@drawable/ic_settings_24dp"

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/dialog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_title"
android:textSize="18sp"
android:textStyle="bold"
android:paddingBottom="12dp" />
<RadioGroup
android:id="@+id/theme_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/radio_theme_follow_system"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_mode_device_default"
android:textSize="16sp"
android:padding="8dp"/>
<RadioButton
android:id="@+id/radio_theme_light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_mode_light"
android:textSize="16sp"
android:padding="8dp"/>
<RadioButton
android:id="@+id/radio_theme_dark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_mode_dark"
android:textSize="16sp"
android:padding="8dp"/>
</RadioGroup>
</LinearLayout>

View File

@@ -11,6 +11,9 @@
<item name="colorOnSurfaceVariant">@android:color/system_accent1_100</item> <item name="colorOnSurfaceVariant">@android:color/system_accent1_100</item>
<item name="android:colorBackground">@android:color/system_neutral1_900</item> <item name="android:colorBackground">@android:color/system_neutral1_900</item>
<item name="android:textColorHighlight">@android:color/system_accent1_500</item> <item name="android:textColorHighlight">@android:color/system_accent1_500</item>
<item name="colorControlHighlight">#33FFFFFF</item>
<item name="android:colorControlHighlight">#33FFFFFF</item>
<item name="android:colorFocusedHighlight">#80FFFFFF</item>
<!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL --> <!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL -->
<item name="elevationOverlayEnabled">false</item> <item name="elevationOverlayEnabled">false</item>
@@ -39,6 +42,7 @@
<item name="colorSurface">@color/player_sheet_background</item> <item name="colorSurface">@color/player_sheet_background</item>
<item name="materialAlertDialogBodyTextStyle">@style/TextAppearance.MaterialComponents.Body1</item> <item name="materialAlertDialogBodyTextStyle">@style/TextAppearance.MaterialComponents.Body1</item>
<item name="android:backgroundDimAmount">0.64</item> <item name="android:backgroundDimAmount">0.64</item>
<item name="colorControlActivated">#FFDAE2FF</item>
</style> </style>
<style name="ThemeOverlay.App.TimePicker" parent="ThemeOverlay.MaterialComponents.TimePicker"> <style name="ThemeOverlay.App.TimePicker" parent="ThemeOverlay.MaterialComponents.TimePicker">
@@ -49,5 +53,12 @@
<item name="android:background">@color/player_sheet_background</item> <item name="android:background">@color/player_sheet_background</item>
<item name="dialogCornerRadius">28dp</item> <item name="dialogCornerRadius">28dp</item>
<item name="checkedTextViewStyle">@style/AlertDialog.TextColor</item> <item name="checkedTextViewStyle">@style/AlertDialog.TextColor</item>
<item name="colorControlActivated">#FFDAE2FF</item>
<item name="colorControlHighlight">#33FFFFFF</item>
<item name="android:colorFocusedHighlight">#80FFFFFF</item>
</style>
<style name="AlertDialog.TextColor" parent="@style/TextAppearance.MaterialComponents.Body1">
<item name="android:textColor">?attr/colorControlNormal</item>
</style> </style>
</resources> </resources>

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- NIGHT THEME COLORS --> <!-- NIGHT THEME COLORS -->

View File

@@ -7,6 +7,9 @@
<item name="colorAccent">#FFDAE2FF</item> <item name="colorAccent">#FFDAE2FF</item>
<item name="colorOnPrimary">#FF182E60</item> <item name="colorOnPrimary">#FF182E60</item>
<item name="android:textColorHighlight">#FF495D92</item> <item name="android:textColorHighlight">#FF495D92</item>
<item name="colorControlHighlight">#33FFFFFF</item>
<item name="android:colorControlHighlight">#33FFFFFF</item>
<item name="android:colorFocusedHighlight">#80FFFFFF</item>
<!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL --> <!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL -->
<item name="elevationOverlayEnabled">false</item> <item name="elevationOverlayEnabled">false</item>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SplashTheme" parent="Theme.Material3.DayNight.NoActionBar">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:statusBarColor">@color/splashBackgroundColor</item>
<item name="android:navigationBarColor">@color/splashBackgroundColor</item>
</style>
</resources>

View File

@@ -6,6 +6,9 @@
<item name="colorPrimary">#FF495D92</item> <item name="colorPrimary">#FF495D92</item>
<item name="colorAccent">#FF495D92</item> <item name="colorAccent">#FF495D92</item>
<item name="android:textColorHighlight">#FF495D92</item> <item name="android:textColorHighlight">#FF495D92</item>
<item name="colorControlHighlight">#33000000</item>
<item name="android:colorControlHighlight">#33000000</item>
<item name="android:colorFocusedHighlight">#80000000</item>
<!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL --> <!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL -->
<item name="elevationOverlayEnabled">false</item> <item name="elevationOverlayEnabled">false</item>

View File

@@ -11,6 +11,9 @@
<item name="colorOnSurfaceVariant">@android:color/system_accent1_600</item> <item name="colorOnSurfaceVariant">@android:color/system_accent1_600</item>
<item name="android:colorBackground">@android:color/system_neutral2_10</item> <item name="android:colorBackground">@android:color/system_neutral2_10</item>
<item name="android:textColorHighlight">@android:color/system_accent1_200</item> <item name="android:textColorHighlight">@android:color/system_accent1_200</item>
<item name="colorControlHighlight">#22000000</item>
<item name="android:colorControlHighlight">#22000000</item>
<item name="android:colorFocusedHighlight">#66000000</item>
<!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL --> <!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL -->
<item name="elevationOverlayEnabled">false</item> <item name="elevationOverlayEnabled">false</item>
@@ -38,6 +41,8 @@
<item name="colorSurface">@color/list_card_background</item> <item name="colorSurface">@color/list_card_background</item>
<item name="materialAlertDialogBodyTextStyle">@style/TextAppearance.MaterialComponents.Body1</item> <item name="materialAlertDialogBodyTextStyle">@style/TextAppearance.MaterialComponents.Body1</item>
<item name="android:backgroundDimAmount">0.64</item> <item name="android:backgroundDimAmount">0.64</item>
<item name="colorControlHighlight">#22000000</item>
<item name="android:colorFocusedHighlight">#66000000</item>
</style> </style>
<style name="ThemeOverlay.App.TimePicker" parent="ThemeOverlay.MaterialComponents.TimePicker"> <style name="ThemeOverlay.App.TimePicker" parent="ThemeOverlay.MaterialComponents.TimePicker">

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- DAY THEME COLORS --> <!-- DAY THEME COLORS -->
@@ -16,6 +15,7 @@
<!-- list --> <!-- list -->
<color name="list_card_background">#FFFEFBFF</color> <color name="list_card_background">#FFFEFBFF</color>
<color name="list_card_stroke_background">#FFC0C6DD</color> <color name="list_card_stroke_background">#FFC0C6DD</color>
<color name="list_card_stroke_focused">#FF495D92</color>
<color name="list_card_cover_background">#FFE7E0EC</color> <color name="list_card_cover_background">#FFE7E0EC</color>
<color name="list_card_delete_background">#FFB3261E</color> <color name="list_card_delete_background">#FFB3261E</color>
<color name="list_card_delete_icon">#FFFFFFFF</color> <color name="list_card_delete_icon">#FFFFFFFF</color>

View File

@@ -140,4 +140,6 @@
<string name="snackbar_url_app_home_page" translatable="false">https://github.com/michatec/Radio/releases/latest</string> <string name="snackbar_url_app_home_page" translatable="false">https://github.com/michatec/Radio/releases/latest</string>
<string name="snackbar_github_update_check_url" translatable="false">https://api.github.com/repos/michatec/Radio/releases/latest</string> <string name="snackbar_github_update_check_url" translatable="false">https://api.github.com/repos/michatec/Radio/releases/latest</string>
<string name="app_name" translatable="false">Radio</string> <string name="app_name" translatable="false">Radio</string>
<string name="icon_launcher" translatable="false">Icon launcher.</string>
<string name="loading">Loading...</string>
</resources> </resources>

View File

@@ -2,29 +2,24 @@
<resources> <resources>
<style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar"> <style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Set AppCompats colors -->
<item name="colorPrimary">#FF495D92</item> <item name="colorPrimary">#FF495D92</item>
<item name="colorAccent">#FF495D92</item> <item name="colorAccent">#FF495D92</item>
<item name="android:textColorHighlight">#FF495D92</item> <item name="android:textColorHighlight">#FF495D92</item>
<!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL -->
<item name="elevationOverlayEnabled">false</item> <item name="elevationOverlayEnabled">false</item>
<item name="colorControlActivated">#FFDAE2FF</item>
<!-- Switch Theming -->
<item name="switchPreferenceCompatStyle">@style/Preference.SwitchPreferenceCompat.Material3</item> <item name="switchPreferenceCompatStyle">@style/Preference.SwitchPreferenceCompat.Material3</item>
<!-- Material Alert Dialog Theming -->
<item name="materialAlertDialogTheme">@style/ThemeOverlay.App.MaterialAlertDialog</item> <item name="materialAlertDialogTheme">@style/ThemeOverlay.App.MaterialAlertDialog</item>
<item name="alertDialogTheme">@style/ThemeOverlay.App.AlertDialogTheme</item> <item name="alertDialogTheme">@style/ThemeOverlay.App.AlertDialogTheme</item>
<!-- Material Time Picker Theming -->
<item name="materialTimePickerTheme">@style/ThemeOverlay.App.TimePicker</item> <item name="materialTimePickerTheme">@style/ThemeOverlay.App.TimePicker</item>
<!-- Use "light" Status Bar -->
<item name="android:windowLightStatusBar">true</item> <item name="android:windowLightStatusBar">true</item>
<item name="android:statusBarColor">@android:color/transparent</item> <item name="android:statusBarColor">@android:color/transparent</item>
<item name="colorControlHighlight">#80000000</item>
<item name="android:colorControlHighlight">#80000000</item>
<item name="android:colorFocusedHighlight">#FF333333</item>
</style> </style>
<style name="SplashTheme" parent="AppTheme" />
<style name="Preference.SwitchPreferenceCompat.Material3" parent="@style/Preference.SwitchPreferenceCompat.Material"> <style name="Preference.SwitchPreferenceCompat.Material3" parent="@style/Preference.SwitchPreferenceCompat.Material">
<item name="widgetLayout">@layout/preference_switch</item> <item name="widgetLayout">@layout/preference_switch</item>
</style> </style>
@@ -38,7 +33,13 @@
<style name="ThemeOverlay.App.AlertDialogTheme" parent="@style/ThemeOverlay.Material3.MaterialAlertDialog"> <style name="ThemeOverlay.App.AlertDialogTheme" parent="@style/ThemeOverlay.Material3.MaterialAlertDialog">
<item name="android:background">@color/list_card_background</item> <item name="android:background">@color/list_card_background</item>
<item name="dialogCornerRadius">28dp</item> <item name="dialogCornerRadius">28dp</item>
<item name="checkedTextViewStyle">@style/AlertDialog.TextColor</item> <!-- TV Fix: Explicitly set accent color for radio buttons/checkboxes -->
<item name="colorAccent">@color/icon_default</item>
<item name="colorControlActivated">@color/icon_default</item>
<item name="android:textColorPrimary">@color/text_default</item>
<item name="android:textColorSecondary">@color/text_lightweight</item>
<item name="colorControlHighlight">#80000000</item>
<item name="android:colorFocusedHighlight">#FF333333</item>
</style> </style>
<style name="ThemeOverlay.App.TimePicker" parent="ThemeOverlay.MaterialComponents.TimePicker"> <style name="ThemeOverlay.App.TimePicker" parent="ThemeOverlay.MaterialComponents.TimePicker">
@@ -46,13 +47,16 @@
</style> </style>
<style name="AlertDialog.TextColor" parent="@style/TextAppearance.MaterialComponents.Body1"> <style name="AlertDialog.TextColor" parent="@style/TextAppearance.MaterialComponents.Body1">
<item name="android:textColor">?attr/colorControlNormal</item> <item name="android:textColor">@color/text_default</item>
</style> </style>
<style name="App.Widget.Material3.CardView.Outlined" parent="@style/Widget.Material3.CardView.Outlined"> <style name="App.Widget.Material3.CardView.Outlined" parent="@style/Widget.Material3.CardView.Outlined">
<item name="strokeColor">@color/list_card_stroke_background</item> <item name="strokeColor">@color/selector_card_station_stroke</item>
<item name="strokeWidth">3dp</item> <item name="strokeWidth">4dp</item>
<item name="cardCornerRadius">24dp</item> <item name="cardCornerRadius">24dp</item>
<item name="android:focusable">true</item>
<item name="android:clickable">true</item>
<item name="android:descendantFocusability">afterDescendants</item>
</style> </style>
<style name="App.Widget.MaterialComponents.TextView" parent="@style/Widget.MaterialComponents.TextView"> <style name="App.Widget.MaterialComponents.TextView" parent="@style/Widget.MaterialComponents.TextView">

View File

@@ -3,24 +3,25 @@ activityKtx = "1.13.0"
agp = "9.1.0" agp = "9.1.0"
coreKtx = "1.18.0" coreKtx = "1.18.0"
freedroidwarn = "V1.10" freedroidwarn = "V1.10"
gradleToolchainsFoojayResolverConvention = "1.0.0"
gson = "2.13.2" gson = "2.13.2"
kotlin = "2.3.20" kotlin = "2.3.20"
leanback = "1.2.0"
material = "1.13.0" material = "1.13.0"
material3 = "1.4.0" material3 = "1.4.0"
media = "1.7.1" media = "1.7.1"
media3 = "1.9.3" media3 = "1.10.0"
navigation = "2.9.7" navigation = "2.9.7"
paletteKtx = "1.0.0" paletteKtx = "1.0.0"
preferenceKtx = "1.2.1" preferenceKtx = "1.2.1"
volley = "1.2.1" volley = "1.2.1"
workRuntimeKtx = "2.11.1" workRuntimeKtx = "2.11.2"
[libraries] [libraries]
activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "activityKtx" } activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "activityKtx" }
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
freedroidwarn = { group = "com.github.woheller69", name = "FreeDroidWarn", version.ref = "freedroidwarn" } freedroidwarn = { group = "com.github.woheller69", name = "FreeDroidWarn", version.ref = "freedroidwarn" }
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
leanback = { group = "androidx.leanback", name = "leanback", version.ref = "leanback" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" } material = { group = "com.google.android.material", name = "material", version.ref = "material" }
material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" } material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
media = { group = "androidx.media", name = "media", version.ref = "media" } media = { group = "androidx.media", name = "media", version.ref = "media" }
@@ -38,5 +39,4 @@ work-runtime-ktx = { group = "androidx.work", name = "work-runtime-ktx", version
[plugins] [plugins]
android-application = { id = "com.android.application", version.ref = "agp" } android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" } android-library = { id = "com.android.library", version.ref = "agp" }
foojay = { id = "org.gradle.toolchains.foojay-resolver-convention", version.ref = "gradleToolchainsFoojayResolverConvention" }
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }