deps: update to mdc 1.8.0-alpha01
FINALLY update to MDC 1.7.0. After over half a year. I have been continually blocked by doing this due to this absurd ripple bug that was so continually frustrating. Today, I finally figred out how to hack a fix in by using R E F L E C T I O N and manually disabling the bugged code path since google apparently can't be bothered to fix it. Now, you might wonder why I didn't update to 1.8.0. That is because there is ANOTHER RIPPLE BUG. THIS TIME WITH THE TAB LAYOUT. AND ONLY IF IT'S IN A COLLAPSING TOOLBAR LAYOUT. Can't wait to finally use the new 1.8.0 features in December!
This commit is contained in:
@@ -143,8 +143,8 @@ class SongImpl(rawSong: RawSong, musicSettings: MusicSettings) : Song {
|
||||
override fun resolveGenreContents(context: Context) = resolveNames(context, genres)
|
||||
|
||||
/**
|
||||
* The [RawAlbum] instances collated by the [Song]. This can be used to group [Song]s
|
||||
* into an [Album].
|
||||
* The [RawAlbum] instances collated by the [Song]. This can be used to group [Song]s into an
|
||||
* [Album].
|
||||
*/
|
||||
val rawAlbum =
|
||||
RawAlbum(
|
||||
@@ -167,8 +167,8 @@ class SongImpl(rawSong: RawSong, musicSettings: MusicSettings) : Song {
|
||||
rawIndividualArtists.ifEmpty { rawAlbumArtists }.ifEmpty { listOf(RawArtist()) }
|
||||
|
||||
/**
|
||||
* The [RawGenre] instances collated by the [Song]. This can be used to group up [Song]s
|
||||
* into a [Genre]. ID3v2 Genre names are automatically converted to their resolved names.
|
||||
* The [RawGenre] instances collated by the [Song]. This can be used to group up [Song]s into a
|
||||
* [Genre]. ID3v2 Genre names are automatically converted to their resolved names.
|
||||
*/
|
||||
val rawGenres =
|
||||
rawSong.genreNames
|
||||
@@ -233,8 +233,8 @@ class SongImpl(rawSong: RawSong, musicSettings: MusicSettings) : Song {
|
||||
/**
|
||||
* Library-backed implementation of [Album].
|
||||
* @param rawAlbum The [RawAlbum] to derive the member data from.
|
||||
* @param songs The [Song]s that are a part of this [Album]. These items will be linked to
|
||||
* this [Album].
|
||||
* @param songs The [Song]s that are a part of this [Album]. These items will be linked to this
|
||||
* [Album].
|
||||
* @author Alexander Capehart (OxygenCobalt)
|
||||
*/
|
||||
class AlbumImpl(val rawAlbum: RawAlbum, override val songs: List<SongImpl>) : Album {
|
||||
@@ -334,9 +334,9 @@ class AlbumImpl(val rawAlbum: RawAlbum, override val songs: List<SongImpl>) : Al
|
||||
/**
|
||||
* Library-backed implementation of [Artist].
|
||||
* @param rawArtist The [RawArtist] to derive the member data from.
|
||||
* @param songAlbums A list of the [Song]s and [Album]s that are a part of this [Artist]
|
||||
* , either through artist or album artist tags. Providing [Song]s to the artist is optional.
|
||||
* These instances will be linked to this [Artist].
|
||||
* @param songAlbums A list of the [Song]s and [Album]s that are a part of this [Artist] , either
|
||||
* through artist or album artist tags. Providing [Song]s to the artist is optional. These instances
|
||||
* will be linked to this [Artist].
|
||||
* @author Alexander Capehart (OxygenCobalt)
|
||||
*/
|
||||
class ArtistImpl(private val rawArtist: RawArtist, songAlbums: List<Music>) : Artist {
|
||||
@@ -404,8 +404,8 @@ class ArtistImpl(private val rawArtist: RawArtist, songAlbums: List<Music>) : Ar
|
||||
|
||||
/**
|
||||
* Returns the original position of this [Artist]'s [RawArtist] within the given [RawArtist]
|
||||
* list. This can be used to create a consistent ordering within child [Artist] lists based
|
||||
* on the original tag order.
|
||||
* list. This can be used to create a consistent ordering within child [Artist] lists based on
|
||||
* the original tag order.
|
||||
* @param rawArtists The [RawArtist] instances to check. It is assumed that this [Artist]'s
|
||||
* [RawArtist] will be within the list.
|
||||
* @return The index of the [Artist]'s [RawArtist] within the list.
|
||||
@@ -467,9 +467,9 @@ class GenreImpl(private val rawGenre: RawGenre, override val songs: List<SongImp
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the original position of this [Genre]'s [RawGenre] within the given [RawGenre]
|
||||
* list. This can be used to create a consistent ordering within child [Genre] lists based
|
||||
* on the original tag order.
|
||||
* Returns the original position of this [Genre]'s [RawGenre] within the given [RawGenre] list.
|
||||
* This can be used to create a consistent ordering within child [Genre] lists based on the
|
||||
* original tag order.
|
||||
* @param rawGenres The [RawGenre] instances to check. It is assumed that this [Genre] 's
|
||||
* [RawGenre] will be within the list.
|
||||
* @return The index of the [Genre]'s [RawGenre] within the list.
|
||||
|
||||
@@ -366,6 +366,10 @@ constructor(
|
||||
mediaStoreJob.await()
|
||||
metadataJob.await()
|
||||
|
||||
if (rawSongs.isEmpty()) {
|
||||
throw Indexer.NoMusicException()
|
||||
}
|
||||
|
||||
// Successfully loaded the library, now save the cache and create the library in
|
||||
// parallel.
|
||||
emitIndexing(Indexer.Indexing.Indeterminate)
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
import org.oxycblt.auxio.util.getInteger
|
||||
|
||||
/**
|
||||
@@ -32,7 +33,7 @@ import org.oxycblt.auxio.util.getInteger
|
||||
class AnimatedMaterialButton
|
||||
@JvmOverloads
|
||||
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
|
||||
MaterialButton(context, attrs, defStyleAttr) {
|
||||
RippleFixMaterialButton(context, attrs, defStyleAttr) {
|
||||
private var currentCornerRadiusRatio = 0f
|
||||
private var animator: ValueAnimator? = null
|
||||
|
||||
|
||||
@@ -18,10 +18,13 @@
|
||||
package org.oxycblt.auxio.settings.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.widget.AppCompatButton
|
||||
import androidx.preference.PreferenceDialogFragmentCompat
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import org.oxycblt.auxio.BuildConfig
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.util.fixDoubleRipple
|
||||
|
||||
/**
|
||||
* The companion dialog to [IntListPreference]. Use [from] to create an instance.
|
||||
@@ -32,6 +35,16 @@ class IntListPreferenceDialog : PreferenceDialogFragmentCompat() {
|
||||
get() = (preference as IntListPreference)
|
||||
private var pendingValueIndex = -1
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
|
||||
(requireDialog() as AlertDialog).apply {
|
||||
(getButton(AlertDialog.BUTTON_NEUTRAL) as AppCompatButton).fixDoubleRipple()
|
||||
(getButton(AlertDialog.BUTTON_POSITIVE) as AppCompatButton).fixDoubleRipple()
|
||||
(getButton(AlertDialog.BUTTON_NEGATIVE) as AppCompatButton).fixDoubleRipple()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?) =
|
||||
// PreferenceDialogFragmentCompat does not allow us to customize the actual creation
|
||||
// of the alert dialog, so we have to override onCreateDialog and create a new dialog
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Auxio Project
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.oxycblt.auxio.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.annotation.AttrRes
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import org.oxycblt.auxio.util.fixDoubleRipple
|
||||
|
||||
/**
|
||||
* Fixes an issue where double ripples appear on [MaterialButton] from AppCompat 1.5 afterwards due
|
||||
* to a currently unfixed change.
|
||||
* @author Alexander Capehart (OxygenCobalt)
|
||||
*/
|
||||
open class RippleFixMaterialButton
|
||||
@JvmOverloads
|
||||
constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr: Int = 0) :
|
||||
MaterialButton(context, attrs, defStyleAttr) {
|
||||
init {
|
||||
fixDoubleRipple()
|
||||
}
|
||||
}
|
||||
@@ -22,9 +22,11 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.widget.AppCompatButton
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import org.oxycblt.auxio.util.fixDoubleRipple
|
||||
import org.oxycblt.auxio.util.logD
|
||||
import org.oxycblt.auxio.util.unlikelyToBeNull
|
||||
|
||||
@@ -102,6 +104,16 @@ abstract class ViewBindingDialogFragment<VB : ViewBinding> : DialogFragment() {
|
||||
logD("Fragment created")
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
|
||||
(requireDialog() as AlertDialog).apply {
|
||||
(getButton(AlertDialog.BUTTON_NEUTRAL) as AppCompatButton).fixDoubleRipple()
|
||||
(getButton(AlertDialog.BUTTON_POSITIVE) as AppCompatButton).fixDoubleRipple()
|
||||
(getButton(AlertDialog.BUTTON_NEGATIVE) as AppCompatButton).fixDoubleRipple()
|
||||
}
|
||||
}
|
||||
|
||||
final override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
onDestroyBinding(unlikelyToBeNull(_binding))
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.os.Build
|
||||
import android.view.View
|
||||
import android.view.WindowInsets
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.widget.AppCompatButton
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import androidx.core.graphics.Insets
|
||||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
@@ -106,6 +107,17 @@ val ViewBinding.context: Context
|
||||
*/
|
||||
fun RecyclerView.canScroll() = computeVerticalScrollRange() > height
|
||||
|
||||
/**
|
||||
* Fix the double ripple that appears in MaterialButton instances due to an issue with AppCompat 1.5
|
||||
* or higher.
|
||||
*/
|
||||
fun AppCompatButton.fixDoubleRipple() {
|
||||
AppCompatButton::class.java.getDeclaredField("mBackgroundTintHelper").apply {
|
||||
isAccessible = true
|
||||
set(this@fixDoubleRipple, null)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [CoordinatorLayout.Behavior] of a [View], or null if the [View] is not part of a
|
||||
* [CoordinatorLayout] or does not have a [CoordinatorLayout.Behavior].
|
||||
|
||||
Reference in New Issue
Block a user