- Fixing some bug fixes.

This commit is contained in:
Michatec
2026-01-21 17:10:35 +01:00
parent 5412f59f61
commit 51b37d8f7b
8 changed files with 11 additions and 39 deletions

View File

@@ -59,6 +59,7 @@ dependencies {
implementation 'com.google.code.gson:gson:2.13.2'
// AndroidX Stuff //
implementation 'androidx.core:core-ktx:1.17.0'
implementation 'androidx.activity:activity-ktx:1.12.2'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'androidx.preference:preference-ktx:1.2.1'
@@ -73,4 +74,5 @@ dependencies {
// Volley HTTP request //
implementation 'com.android.volley:volley:1.2.1'
implementation 'androidx.compose.material3:material3:1.4.0'
}

View File

@@ -183,7 +183,6 @@ class PlayerFragment : Fragment(),
// set the same background color of the player sheet for the navigation bar
requireActivity().window.navigationBarColor = ContextCompat.getColor(requireActivity(), R.color.player_sheet_background)
// associate the ItemTouchHelper with the RecyclerView
itemTouchHelper = ItemTouchHelper(ItemTouchHelperCallback())
itemTouchHelper?.attachToRecyclerView(layout.recyclerView)
@@ -536,7 +535,7 @@ class PlayerFragment : Fragment(),
private fun requestSleepTimerUpdate() {
val resultFuture: ListenableFuture<SessionResult>? =
controller?.requestSleepTimerRemaining()
resultFuture?.addListener(Runnable {
resultFuture?.addListener({
val timeRemaining: Long = resultFuture.get().extras.getLong(Keys.EXTRA_SLEEP_TIMER_REMAINING)
layout.updateSleepTimer(activity as Context, timeRemaining)
}, MoreExecutors.directExecutor())
@@ -546,7 +545,7 @@ class PlayerFragment : Fragment(),
/* Requests an update of the metadata history from the player service */
private fun requestMetadataUpdate() {
val resultFuture: ListenableFuture<SessionResult>? = controller?.requestMetadataHistory()
resultFuture?.addListener(Runnable {
resultFuture?.addListener({
val metadata: ArrayList<String>? = resultFuture.get().extras.getStringArrayList(Keys.EXTRA_METADATA_HISTORY)
layout.updateMetadata(metadata?.toMutableList())
}, MoreExecutors.directExecutor())
@@ -808,4 +807,3 @@ class PlayerFragment : Fragment(),
queue.add(request)
}
}

View File

@@ -27,8 +27,6 @@ import android.view.View
import androidx.activity.result.ActivityResult
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.ContextCompat
import androidx.core.net.toUri
import androidx.core.os.bundleOf
import androidx.navigation.fragment.findNavController

View File

@@ -651,7 +651,7 @@ class CollectionAdapter(
/*
* Inner class: ViewHolder for the Add New Station action
*/
private inner class AddNewViewHolder(listItemAddNewLayout: View) :
private class AddNewViewHolder(listItemAddNewLayout: View) :
RecyclerView.ViewHolder(listItemAddNewLayout) {
val addNewStationView: ExtendedFloatingActionButton =
listItemAddNewLayout.findViewById(R.id.card_add_new_station)
@@ -666,7 +666,7 @@ class CollectionAdapter(
/*
* Inner class: ViewHolder for a station
*/
private inner class StationViewHolder(stationCardLayout: View) :
private class StationViewHolder(stationCardLayout: View) :
RecyclerView.ViewHolder(stationCardLayout) {
val stationCardView: CardView = stationCardLayout.findViewById(R.id.station_card)
val stationImageView: ImageView = stationCardLayout.findViewById(R.id.station_icon)

View File

@@ -288,32 +288,6 @@ object CollectionHelper {
}
/* Gets MediaIem for next station within collection */
fun getNextMediaItem(context: Context, collection: Collection, stationUuid: String): MediaItem {
val currentStationPosition: Int = getStationPosition(collection, stationUuid)
return if (collection.stations.isEmpty() || currentStationPosition == -1) {
buildMediaItem(context, Station())
} else if (currentStationPosition < collection.stations.size -1) {
buildMediaItem(context, collection.stations[currentStationPosition + 1])
} else {
buildMediaItem(context, collection.stations.first())
}
}
/* Gets MediaIem for previous station within collection */
fun getPreviousMediaItem(context: Context, collection: Collection, stationUuid: String): MediaItem {
val currentStationPosition: Int = getStationPosition(collection, stationUuid)
return if (collection.stations.isEmpty() || currentStationPosition == -1) {
buildMediaItem(context, Station())
} else if (currentStationPosition > 0) {
buildMediaItem(context, collection.stations[currentStationPosition - 1])
} else {
buildMediaItem(context, collection.stations.last())
}
}
/* Get the position from collection for given UUID */
fun getStationPosition(collection: Collection, stationUuid: String): Int {
collection.stations.forEachIndexed { stationId, station ->
@@ -561,7 +535,7 @@ object CollectionHelper {
fun exportCollectionM3u(context: Context, collection: Collection) {
Log.v(TAG, "Exporting collection of stations as M3U")
// export collection as M3U - launch = fire & forget (no return value from save collection)
if (collection.stations.size > 0) {
if (collection.stations.isNotEmpty()) {
CoroutineScope(IO).launch {
FileHelper.backupCollectionAsM3uSuspended(
context,
@@ -603,7 +577,7 @@ object CollectionHelper {
fun exportCollectionPls(context: Context, collection: Collection) {
Log.v(TAG, "Exporting collection of stations as PLS")
// export collection as PLS - launch = fire & forget (no return value from save collection)
if (collection.stations.size > 0) {
if (collection.stations.isNotEmpty()) {
CoroutineScope(IO).launch {
FileHelper.backupCollectionAsPlsSuspended(
context,

View File

@@ -17,7 +17,6 @@ package com.michatec.radio.helpers
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.os.Build
import android.widget.Toast
import androidx.core.content.pm.ShortcutInfoCompat
import androidx.core.content.pm.ShortcutManagerCompat

View File

@@ -359,7 +359,7 @@ data class LayoutHolder(var rootView: View) {
/* Shows player */
fun showPlayer(context: Context): Boolean {
UiHelper.setViewMargins(context, recyclerView, 0, 0, 0, Keys.BOTTOM_SHEET_PEEK_HEIGHT)
if (bottomSheetBehavior.state == BottomSheetBehavior.STATE_HIDDEN && onboardingLayout.visibility == View.GONE) {
if (bottomSheetBehavior.state == BottomSheetBehavior.STATE_HIDDEN && onboardingLayout.isGone) {
bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
}
return true
@@ -440,7 +440,7 @@ data class LayoutHolder(var rootView: View) {
/*
* Inner class: Custom LinearLayoutManager
*/
private inner class CustomLayoutManager(context: Context) :
private class CustomLayoutManager(context: Context) :
LinearLayoutManager(context, VERTICAL, false) {
override fun supportsPredictiveItemAnimations(): Boolean {
return true

View File

@@ -14,3 +14,4 @@ org.gradle.jvmargs=-Xmx1536m
# enables androidx repo
android.useAndroidX=true
org.gradle.configuration-cache=true