all: cleanup
Miscellanious clean-up.
This commit is contained in:
parent
959a08413c
commit
14c9bbd4f9
21 changed files with 18 additions and 31 deletions
|
@ -12,6 +12,7 @@
|
|||
- Fixed issue where items would not highlight properly in the detail UI
|
||||
|
||||
#### Dev/Meta
|
||||
- New translations [yurical -> Korean, qwerty287 -> German]
|
||||
- Switched from `LiveData` to `StateFlow`
|
||||
- Use `notifyItemChanged` instead of directly mutating `ViewHolder` instances.
|
||||
|
||||
|
|
|
@ -68,7 +68,6 @@ dependencies {
|
|||
// UI
|
||||
implementation "androidx.recyclerview:recyclerview:1.2.1"
|
||||
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
|
||||
implementation "androidx.dynamicanimation:dynamicanimation:1.0.0"
|
||||
implementation "androidx.viewpager2:viewpager2:1.1.0-beta01"
|
||||
|
||||
// Lifecycle
|
||||
|
|
|
@ -25,7 +25,6 @@ import androidx.activity.OnBackPressedCallback
|
|||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import org.oxycblt.auxio.databinding.FragmentMainBinding
|
||||
import org.oxycblt.auxio.music.Music
|
||||
import org.oxycblt.auxio.music.MusicViewModel
|
||||
|
|
|
@ -22,7 +22,6 @@ import android.view.MenuItem
|
|||
import android.view.View
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.databinding.FragmentDetailBinding
|
||||
import org.oxycblt.auxio.detail.recycler.ArtistDetailAdapter
|
||||
|
@ -136,8 +135,6 @@ class ArtistDetailFragment : DetailFragment(), DetailAdapter.Listener {
|
|||
}
|
||||
|
||||
private fun updatePlayback(song: Song?, parent: MusicParent?) {
|
||||
val binding = requireBinding()
|
||||
|
||||
if (parent is Artist && parent.id == unlikelyToBeNull(detailModel.currentArtist.value).id) {
|
||||
detailAdapter.highlightSong(song)
|
||||
} else {
|
||||
|
|
|
@ -126,11 +126,10 @@ class GenreDetailFragment : DetailFragment(), DetailAdapter.Listener {
|
|||
}
|
||||
|
||||
private fun updatePlayback(song: Song?, parent: MusicParent?) {
|
||||
val binding = requireBinding()
|
||||
if (parent is Genre && parent.id == unlikelyToBeNull(detailModel.currentGenre.value).id) {
|
||||
detailAdapter.highlightSong(song)
|
||||
} else {
|
||||
// Clear the ViewHolders if the mode isn't ALL_SONGS
|
||||
// Clear any highlighting if playback is not occuring from this item.
|
||||
detailAdapter.highlightSong(null)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -228,9 +228,7 @@ private class AlbumSongViewHolder private constructor(private val binding: ItemA
|
|||
}
|
||||
|
||||
override fun setHighlighted(isHighlighted: Boolean) {
|
||||
binding.songName.isActivated = isHighlighted
|
||||
binding.songTrack.isActivated = isHighlighted
|
||||
binding.songTrackBg.isActivated = isHighlighted
|
||||
binding.root.isActivated = isHighlighted
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -230,7 +230,7 @@ private constructor(
|
|||
}
|
||||
|
||||
override fun setHighlighted(isHighlighted: Boolean) {
|
||||
binding.songName.isActivated = isHighlighted
|
||||
binding.root.isActivated = isHighlighted
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -35,7 +35,6 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.databinding.FragmentHomeBinding
|
||||
import org.oxycblt.auxio.home.list.AlbumListFragment
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.oxycblt.auxio.home.list
|
|||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.databinding.FragmentHomeListBinding
|
||||
import org.oxycblt.auxio.music.Album
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.oxycblt.auxio.home.list
|
|||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.databinding.FragmentHomeListBinding
|
||||
import org.oxycblt.auxio.music.Artist
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.oxycblt.auxio.home.list
|
|||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.databinding.FragmentHomeListBinding
|
||||
import org.oxycblt.auxio.music.Genre
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.oxycblt.auxio.home.list
|
|||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.databinding.FragmentHomeListBinding
|
||||
import org.oxycblt.auxio.music.Song
|
||||
|
|
|
@ -37,7 +37,7 @@ class MediaButtonReceiver : BroadcastReceiver() {
|
|||
val playbackManager = PlaybackStateManager.getInstance()
|
||||
if (playbackManager.song != null) {
|
||||
// We have a song, so we can assume that the service will start a foreground state.
|
||||
// At least, I hope
|
||||
// At least, I hope.
|
||||
intent.component = ComponentName(context, PlaybackService::class.java)
|
||||
ContextCompat.startForegroundService(context, intent)
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import androidx.fragment.app.Fragment
|
|||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.databinding.FragmentSearchBinding
|
||||
import org.oxycblt.auxio.music.Album
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.oxycblt.auxio.playback.replaygain.PreAmpCustomizeDialog
|
|||
import org.oxycblt.auxio.playback.replaygain.ReplayGainMode
|
||||
import org.oxycblt.auxio.settings.pref.IntListPreference
|
||||
import org.oxycblt.auxio.settings.pref.IntListPreferenceDialog
|
||||
import org.oxycblt.auxio.ui.accent.AccentCustomizeDialog
|
||||
import org.oxycblt.auxio.ui.accent.AccentDialog
|
||||
import org.oxycblt.auxio.util.hardRestart
|
||||
import org.oxycblt.auxio.util.isNight
|
||||
import org.oxycblt.auxio.util.logD
|
||||
|
@ -135,8 +135,7 @@ class SettingsListFragment : PreferenceFragmentCompat() {
|
|||
SettingsManager.KEY_ACCENT -> {
|
||||
onPreferenceClickListener =
|
||||
Preference.OnPreferenceClickListener {
|
||||
AccentCustomizeDialog()
|
||||
.show(childFragmentManager, AccentCustomizeDialog.TAG)
|
||||
AccentDialog().show(childFragmentManager, AccentDialog.TAG)
|
||||
true
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ import org.oxycblt.auxio.util.systemBarInsetsCompat
|
|||
* extendable. You have been warned.
|
||||
*
|
||||
* @author OxygenCobalt (With help from Umano and Hai Zhang)
|
||||
*
|
||||
* TODO: Implement rounded corners on the bar (when rounded covers is enabled)
|
||||
*/
|
||||
class BottomSheetLayout
|
||||
@JvmOverloads
|
||||
|
|
|
@ -63,8 +63,6 @@ private typealias AnyCreator = BindingViewHolder.Creator<out RecyclerView.ViewHo
|
|||
* An adapter for many viewholders tied to many types of data. Deriving this is more complicated
|
||||
* than [MonoAdapter], as less overrides can be provided "for free".
|
||||
* @author OxygenCobalt
|
||||
*
|
||||
* TODO: Force impls to handle payload situations.
|
||||
*/
|
||||
abstract class MultiAdapter<L>(private val listener: L) :
|
||||
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
|
|
@ -49,6 +49,8 @@ import org.oxycblt.auxio.util.getDrawableSafe
|
|||
* Default behavior includes the addition of a tonal background, automatic sizing of icons to half
|
||||
* of the view size, and corner radius application depending on user preference.
|
||||
* @author OxygenCobalt
|
||||
*
|
||||
* TODO: Add an activation indicator to this view too
|
||||
*/
|
||||
class StyledImageView
|
||||
@JvmOverloads
|
||||
|
|
|
@ -32,8 +32,7 @@ import org.oxycblt.auxio.util.unlikelyToBeNull
|
|||
* Dialog responsible for showing the list of accents to select.
|
||||
* @author OxygenCobalt
|
||||
*/
|
||||
class AccentCustomizeDialog :
|
||||
ViewBindingDialogFragment<DialogAccentBinding>(), AccentAdapter.Listener {
|
||||
class AccentDialog : ViewBindingDialogFragment<DialogAccentBinding>(), AccentAdapter.Listener {
|
||||
private val settingsManager = SettingsManager.getInstance()
|
||||
private var accentAdapter = AccentAdapter(this)
|
||||
|
|
@ -39,7 +39,6 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import androidx.viewbinding.ViewBinding
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oxycblt.auxio.R
|
||||
|
@ -170,9 +169,9 @@ fun Fragment.launch(
|
|||
}
|
||||
|
||||
/**
|
||||
* Combines the called flow with the given flow and then collects them both into [block].
|
||||
* This is a bit of a dumb hack with [combine], as when we have to combine flows, we often
|
||||
* just want to call the same block with both functions, and not do any transformations.
|
||||
* Combines the called flow with the given flow and then collects them both into [block]. This is a
|
||||
* bit of a dumb hack with [combine], as when we have to combine flows, we often just want to call
|
||||
* the same block with both functions, and not do any transformations.
|
||||
*/
|
||||
suspend fun <T1, T2> Flow<T1>.collectWith(other: Flow<T2>, block: suspend (T1, T2) -> Unit) {
|
||||
combine(this, other) { a, b -> a to b }.collect { block(it.first, it.second) }
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.os.Build
|
|||
import coil.request.ImageRequest
|
||||
import coil.size.Size
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import kotlin.math.min
|
||||
import org.oxycblt.auxio.image.BitmapProvider
|
||||
import org.oxycblt.auxio.image.SquareFrameTransform
|
||||
import org.oxycblt.auxio.music.MusicParent
|
||||
|
@ -103,7 +102,9 @@ class WidgetComponent(private val context: Context) :
|
|||
.toFloat()))
|
||||
// The output of RoundedCornersTransformation is dimension-dependent,
|
||||
// so scale up the image to the screen size to ensure consistent radii.
|
||||
.size(min(metrics.widthPixels, metrics.heightPixels))
|
||||
// Make sure we stop at 1024, so we don't accidentally make a massive
|
||||
// bitmap on very large screens.
|
||||
.size(minOf(metrics.widthPixels, metrics.heightPixels, 1024))
|
||||
} else {
|
||||
// Note: Explicitly use the "original" size as without it the scaling logic
|
||||
// in coil breaks down and results in an error.
|
||||
|
|
Loading…
Reference in a new issue