all: cleanup
General app cleanup.
This commit is contained in:
parent
83dc6cd4c9
commit
d4513293a7
8 changed files with 21 additions and 18 deletions
|
@ -36,7 +36,7 @@ import org.oxycblt.auxio.playback.system.PlaybackService
|
|||
import org.oxycblt.auxio.settings.SettingsManager
|
||||
import org.oxycblt.auxio.util.isNight
|
||||
import org.oxycblt.auxio.util.logD
|
||||
import org.oxycblt.auxio.util.replaceInsetsCompat
|
||||
import org.oxycblt.auxio.util.replaceSystemBarInsetsCompat
|
||||
import org.oxycblt.auxio.util.systemBarInsetsCompat
|
||||
|
||||
/**
|
||||
|
@ -158,7 +158,7 @@ class MainActivity : AppCompatActivity() {
|
|||
right = bars.right
|
||||
)
|
||||
|
||||
return replaceInsetsCompat(0, bars.top, 0, bars.bottom)
|
||||
return replaceSystemBarInsetsCompat(0, bars.top, 0, bars.bottom)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -101,7 +101,7 @@ data class Song(
|
|||
/** The album of this song. */
|
||||
val album: Album get() = requireNotNull(mAlbum)
|
||||
|
||||
var mGenre: Genre? = null
|
||||
private var mGenre: Genre? = null
|
||||
/** The genre of this song. Will be an "unknown genre" if the song does not have any. */
|
||||
val genre: Genre get() = requireNotNull(mGenre)
|
||||
|
||||
|
|
|
@ -259,8 +259,8 @@ class MusicLoader {
|
|||
}
|
||||
val artistAlbums = entry.value
|
||||
|
||||
// Due to the black magic we do to get a good artist field, the ID is unreliable.
|
||||
// Take a hash of the artist name instead.
|
||||
// Album deduplication does not eliminate every case of fragmented artists, do
|
||||
// we deduplicate in the artist creation step as well.
|
||||
val previousArtistIndex = artists.indexOfFirst { artist ->
|
||||
artist.name.lowercase() == artistName.lowercase()
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.oxycblt.auxio.music.Song
|
|||
import org.oxycblt.auxio.util.getAttrColorSafe
|
||||
import org.oxycblt.auxio.util.getDimenSizeSafe
|
||||
import org.oxycblt.auxio.util.getDrawableSafe
|
||||
import org.oxycblt.auxio.util.replaceInsetsCompat
|
||||
import org.oxycblt.auxio.util.replaceSystemBarInsetsCompat
|
||||
import org.oxycblt.auxio.util.stateList
|
||||
import org.oxycblt.auxio.util.systemBarInsetsCompat
|
||||
import kotlin.math.abs
|
||||
|
@ -383,7 +383,7 @@ class PlaybackLayout @JvmOverloads constructor(
|
|||
val consumedByPanel = computePanelTopPosition(panelOffset) - measuredHeight
|
||||
val adjustedBottomInset = (consumedByPanel + bars.bottom).coerceAtLeast(0)
|
||||
|
||||
return insets.replaceInsetsCompat(bars.left, bars.top, bars.right, adjustedBottomInset)
|
||||
return insets.replaceSystemBarInsetsCompat(bars.left, bars.top, bars.right, adjustedBottomInset)
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(): Parcelable = Bundle().apply {
|
||||
|
|
|
@ -75,8 +75,7 @@ fun Context.getPluralSafe(@PluralsRes pluralsRes: Int, value: Int): String {
|
|||
return try {
|
||||
resources.getQuantityString(pluralsRes, value, value)
|
||||
} catch (e: Exception) {
|
||||
logE("plural load failed")
|
||||
return "<plural error>"
|
||||
handleResourceFailure(e, "plural", "<plural error>")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ fun RecyclerView.applySpans(shouldBeFullWidth: ((Int) -> Boolean)? = null) {
|
|||
fun RecyclerView.canScroll(): Boolean = computeVerticalScrollRange() > height
|
||||
|
||||
/**
|
||||
* Resolve window insets in a version-aware manner. This can be used to apply padding to
|
||||
* Resolve system bar insets in a version-aware manner. This can be used to apply padding to
|
||||
* a view that properly follows all the frustrating changes that were made between 8-11.
|
||||
*/
|
||||
val WindowInsets.systemBarInsetsCompat: Rect get() {
|
||||
|
@ -86,7 +86,11 @@ val WindowInsets.systemBarInsetsCompat: Rect get() {
|
|||
}
|
||||
}
|
||||
|
||||
fun WindowInsets.replaceInsetsCompat(left: Int, top: Int, right: Int, bottom: Int): WindowInsets {
|
||||
/**
|
||||
* Replaces the system bar insets in a version-aware manner. This can be used to modify the insets
|
||||
* for child views in a way that follows all of the frustrating changes that were made between 8-11.
|
||||
*/
|
||||
fun WindowInsets.replaceSystemBarInsetsCompat(left: Int, top: Int, right: Int, bottom: Int): WindowInsets {
|
||||
return when {
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> {
|
||||
WindowInsets.Builder(this)
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
|
||||
<android.widget.TextView
|
||||
android:layout_width="match_parent"
|
||||
android:textAppearance="@style/Widget.Auxio.TextView.Primary.AppWidget"
|
||||
style="@style/Widget.Auxio.TextView.Primary.AppWidget"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:ellipsize="none"
|
||||
android:singleLine="false"
|
||||
android:textAlignment="center"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/spacing_medium"
|
||||
android:text="@string/def_playback"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textStyle="normal"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
android:text="@string/def_playback" />
|
||||
|
||||
</FrameLayout>
|
||||
|
|
|
@ -32,8 +32,8 @@ This is for a couple reason:
|
|||
- Auxio doesn't extract ReplayGain tags for your format.
|
||||
- Auxio doesn't recognize your ReplayGain tags. This is usually because of a non-standard tag like ID3v2's `RVAD` or
|
||||
an unrecognized name.
|
||||
- Your tags use a ReplayGain value higher than 0. Due to technical limitations, Auxio does not support this right now.
|
||||
I do plan to add it eventually.
|
||||
- Your tags use a ReplayGain value higher than 0. Due to technical limitations, Auxio does not support this right now,
|
||||
but I can work on it if the demand for this is sufficient.
|
||||
|
||||
#### What is dynamic ReplayGain?
|
||||
Dynamic ReplayGain is a quirk setting based off the FooBar2000 plugin that dynamically switches from track gain to album
|
||||
|
|
Loading…
Reference in a new issue