diff --git a/app/src/main/java/org/oxycblt/auxio/MainFragment.kt b/app/src/main/java/org/oxycblt/auxio/MainFragment.kt
index 8021652a0..d4926dd95 100644
--- a/app/src/main/java/org/oxycblt/auxio/MainFragment.kt
+++ b/app/src/main/java/org/oxycblt/auxio/MainFragment.kt
@@ -98,6 +98,7 @@ class MainFragment : Fragment(), PlaybackBarLayout.ActionCallback {
// Error, show the error to the user
is MusicStore.Response.Err -> {
+
logD("Received Error")
val errorRes = when (response.kind) {
diff --git a/app/src/main/java/org/oxycblt/auxio/home/FloatingActionButtonContainer.kt b/app/src/main/java/org/oxycblt/auxio/home/FloatingActionButtonContainer.kt
index fa2f68b76..761b7a98e 100644
--- a/app/src/main/java/org/oxycblt/auxio/home/FloatingActionButtonContainer.kt
+++ b/app/src/main/java/org/oxycblt/auxio/home/FloatingActionButtonContainer.kt
@@ -30,6 +30,10 @@ class FloatingActionButtonContainer @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = -1
) : FrameLayout(context, attrs, defStyleAttr) {
+ override fun dispatchApplyWindowInsets(insets: WindowInsets): WindowInsets {
+ return onApplyWindowInsets(insets)
+ }
+
override fun onApplyWindowInsets(insets: WindowInsets): WindowInsets {
updatePadding(bottom = insets.systemBarsCompat.bottom)
diff --git a/app/src/main/java/org/oxycblt/auxio/home/fastscroll/FastScrollRecyclerView.kt b/app/src/main/java/org/oxycblt/auxio/home/fastscroll/FastScrollRecyclerView.kt
index ccd1a78c7..d085b7dbd 100644
--- a/app/src/main/java/org/oxycblt/auxio/home/fastscroll/FastScrollRecyclerView.kt
+++ b/app/src/main/java/org/oxycblt/auxio/home/fastscroll/FastScrollRecyclerView.kt
@@ -110,13 +110,8 @@ class FastScrollRecyclerView @JvmOverloads constructor(
hideScrollbar()
}
- private val initialPadding = Rect(
- paddingLeft, paddingTop, paddingRight, paddingBottom
- )
-
- private val scrollerPadding = Rect(
- 0, 0, 0, 0
- )
+ private val initialPadding = Rect(paddingLeft, paddingTop, paddingRight, paddingBottom)
+ private val scrollerPadding = Rect(0, 0, 0, 0)
init {
val thumbDrawable = R.drawable.ui_scroll_thumb.resolveDrawable(context)
@@ -213,23 +208,23 @@ class FastScrollRecyclerView @JvmOverloads constructor(
popupView.layoutDirection = layoutDirection
val trackLeft = if (isRtl) {
- paddingLeft
+ scrollerPadding.left
} else {
- width - paddingRight - thumbWidth
+ width - scrollerPadding.right - thumbWidth
}
trackView.layout(
- trackLeft, paddingTop, trackLeft + thumbWidth,
+ trackLeft, scrollerPadding.top, trackLeft + thumbWidth,
height - scrollerPadding.bottom
)
val thumbLeft = if (isRtl) {
- paddingLeft
+ scrollerPadding.left
} else {
- width - paddingRight - thumbWidth
+ width - scrollerPadding.right - thumbWidth
}
- val thumbTop = paddingTop + thumbOffset
+ val thumbTop = scrollerPadding.top + thumbOffset
thumbView.layout(thumbLeft, thumbTop, thumbLeft + thumbWidth, thumbTop + thumbHeight)
@@ -342,40 +337,10 @@ class FastScrollRecyclerView @JvmOverloads constructor(
return
}
- // Getting a pixel-perfect scroll position from a recyclerview is a bit of an involved
- // process. It's kind of expected given how RecyclerView well...recycles views, but it's
- // still very annoying how many hoops one has to jump through.
-
- // First, we need to get the first visible child. We will use this to extrapolate a rough
- // scroll range/position for the view.
- // Doing this does mean that the fast scroller will break if you have a header view that's
- // a different height, but Auxio's home UI doesn't have something like that so we're okay.
- val firstChild = getChildAt(0)
-
- val itemPos = firstAdapterPos
- val itemCount = itemCount
-
- // Now get the bounds of the first child. These are the dimensions we use to extrapolate
- // information for the whole recyclerview.
- getDecoratedBoundsWithMargins(firstChild, childRect)
- val itemHeight = childRect.height()
- val itemTop = childRect.top
-
- // This is where things get messy. We have to take everything we just calculated and
- // do some arithmetic to get it into a working thumb position.
-
- // The total scroll range based on the initial item
- val scrollRange = paddingTop + (itemCount * itemHeight) + paddingBottom
-
- // The scroll range where the items aren't visible
- val scrollOffsetRange = scrollRange - height
-
- // The scroll offset, or basically the y of the current item + the height of all
- // the previous items
- val scrollOffset = paddingTop + (itemPos * itemHeight) - itemTop
-
- // The range of pixels where the thumb is not present
- val thumbOffsetRange = height - scrollerPadding.top - scrollerPadding.bottom - thumbHeight
+ // Combine the previous item dimensions with the current item top to find our scroll
+ // position
+ getDecoratedBoundsWithMargins(getChildAt(0), childRect)
+ val scrollOffset = paddingTop + (firstAdapterPos * itemHeight) - childRect.top
// Finally, we can calculate the thumb position, which is just:
// [proportion of scroll position to scroll range] * [total thumb range]
diff --git a/app/src/main/java/org/oxycblt/auxio/playback/CompactPlaybackView.kt b/app/src/main/java/org/oxycblt/auxio/playback/CompactPlaybackView.kt
index 8509ca4de..78d4dba71 100644
--- a/app/src/main/java/org/oxycblt/auxio/playback/CompactPlaybackView.kt
+++ b/app/src/main/java/org/oxycblt/auxio/playback/CompactPlaybackView.kt
@@ -92,11 +92,11 @@ class CompactPlaybackView @JvmOverloads constructor(
fun setPosition(position: Long) {
if (binding.song == null) {
- binding.playbackProgress.progress = 0
+ binding.playbackProgressBar.progress = 0
return
}
- binding.playbackProgress.progress = position.toInt()
+ binding.playbackProgressBar.progress = position.toInt()
}
fun setCallback(callback: PlaybackBarLayout.ActionCallback) {
diff --git a/app/src/main/java/org/oxycblt/auxio/playback/PlaybackSeekBar.kt b/app/src/main/java/org/oxycblt/auxio/playback/PlaybackSeekBar.kt
index 3d6227886..685b5cbcd 100644
--- a/app/src/main/java/org/oxycblt/auxio/playback/PlaybackSeekBar.kt
+++ b/app/src/main/java/org/oxycblt/auxio/playback/PlaybackSeekBar.kt
@@ -43,19 +43,19 @@ class PlaybackSeekBar @JvmOverloads constructor(
var onConfirmListener: ((Long) -> Unit)? = null
init {
- binding.playbackSeekBar.setOnSeekBarChangeListener(this)
+ binding.seekBar.setOnSeekBarChangeListener(this)
}
fun setProgress(seconds: Long) {
// Don't update the progress while we are seeking, that will make the SeekBar jump around.
if (!isSeeking) {
- binding.playbackSeekBar.progress = seconds.toInt()
+ binding.seekBar.progress = seconds.toInt()
binding.playbackDurationCurrent.text = seconds.toDuration()
}
}
fun setDuration(seconds: Long) {
- binding.playbackSeekBar.max = seconds.toInt()
+ binding.seekBar.max = seconds.toInt()
binding.playbackSongDuration.text = seconds.toDuration()
}
diff --git a/app/src/main/java/org/oxycblt/auxio/search/SearchViewModel.kt b/app/src/main/java/org/oxycblt/auxio/search/SearchViewModel.kt
index f206b5e3b..e7d27b9ae 100644
--- a/app/src/main/java/org/oxycblt/auxio/search/SearchViewModel.kt
+++ b/app/src/main/java/org/oxycblt/auxio/search/SearchViewModel.kt
@@ -85,21 +85,21 @@ class SearchViewModel : ViewModel(), MusicStore.MusicCallback {
if (mFilterMode == null || mFilterMode == DisplayMode.SHOW_ALBUMS) {
musicStore.albums.filterByOrNull(query)?.let { albums ->
- results.add(Header(-1, HeaderString.Single(R.string.lbl_albums)))
+ results.add(Header(-2, HeaderString.Single(R.string.lbl_albums)))
results.addAll(albums)
}
}
if (mFilterMode == null || mFilterMode == DisplayMode.SHOW_GENRES) {
musicStore.genres.filterByOrNull(query)?.let { genres ->
- results.add(Header(-1, HeaderString.Single(R.string.lbl_genres)))
+ results.add(Header(-3, HeaderString.Single(R.string.lbl_genres)))
results.addAll(genres)
}
}
if (mFilterMode == null || mFilterMode == DisplayMode.SHOW_SONGS) {
musicStore.songs.filterByOrNull(query)?.let { songs ->
- results.add(Header(-1, HeaderString.Single(R.string.lbl_songs)))
+ results.add(Header(-4, HeaderString.Single(R.string.lbl_songs)))
results.addAll(songs)
}
}
diff --git a/app/src/main/java/org/oxycblt/auxio/ui/LiftAppBarLayout.kt b/app/src/main/java/org/oxycblt/auxio/ui/EdgeAppBarLayout.kt
similarity index 94%
rename from app/src/main/java/org/oxycblt/auxio/ui/LiftAppBarLayout.kt
rename to app/src/main/java/org/oxycblt/auxio/ui/EdgeAppBarLayout.kt
index 83335e614..41b773a68 100644
--- a/app/src/main/java/org/oxycblt/auxio/ui/LiftAppBarLayout.kt
+++ b/app/src/main/java/org/oxycblt/auxio/ui/EdgeAppBarLayout.kt
@@ -38,7 +38,7 @@ import org.oxycblt.auxio.util.systemBarsCompat
* **Note:** This layout relies on [AppBarLayout.liftOnScrollTargetViewId] to figure out what
* scrolling view to use. Failure to specify this will result in the layout not working.
*/
-class LiftAppBarLayout @JvmOverloads constructor(
+class EdgeAppBarLayout @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
@StyleRes defStyleAttr: Int = -1
@@ -64,12 +64,6 @@ class LiftAppBarLayout @JvmOverloads constructor(
viewTreeObserver.addOnPreDrawListener(onPreDraw)
}
- override fun dispatchApplyWindowInsets(insets: WindowInsets): WindowInsets {
- super.dispatchApplyWindowInsets(insets)
-
- return onApplyWindowInsets(insets)
- }
-
override fun onApplyWindowInsets(insets: WindowInsets): WindowInsets {
super.onApplyWindowInsets(insets)
diff --git a/app/src/main/java/org/oxycblt/auxio/ui/EdgeCoordinatorLayout.kt b/app/src/main/java/org/oxycblt/auxio/ui/EdgeCoordinatorLayout.kt
new file mode 100644
index 000000000..7e41af3fe
--- /dev/null
+++ b/app/src/main/java/org/oxycblt/auxio/ui/EdgeCoordinatorLayout.kt
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2021 Auxio Project
+ * FuckedCoordinatorLayout.kt is part of Auxio.
+ *
+ * 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 .
+ */
+
+package org.oxycblt.auxio.ui
+
+import android.content.Context
+import android.util.AttributeSet
+import android.view.WindowInsets
+import androidx.coordinatorlayout.widget.CoordinatorLayout
+import androidx.core.view.children
+
+/**
+ * Class that fixes an issue where [CoordinatorLayout] will override [onApplyWindowInsets]
+ * and delegate the job to ***LAYOUT BEHAVIOR INSTANCES*** instead of the actual views.
+ *
+ * I can't believe I have to do this.
+ */
+class EdgeCoordinatorLayout @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = -1
+) : CoordinatorLayout(context, attrs, defStyleAttr) {
+ override fun onApplyWindowInsets(insets: WindowInsets): WindowInsets {
+ for (child in children) {
+ child.onApplyWindowInsets(insets)
+ }
+
+ return insets
+ }
+}
diff --git a/app/src/main/res/color/overlay_selection.xml b/app/src/main/res/color/overlay_selection.xml
deleted file mode 100644
index 31b3be26b..000000000
--- a/app/src/main/res/color/overlay_selection.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml
index a5839eb56..8efb53f61 100644
--- a/app/src/main/res/layout/fragment_about.xml
+++ b/app/src/main/res/layout/fragment_about.xml
@@ -4,13 +4,13 @@
xmlns:tools="http://schemas.android.com/tools"
tools:context=".settings.AboutFragment">
-
-
-
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_detail.xml b/app/src/main/res/layout/fragment_detail.xml
index 9663b4bbe..43942338c 100644
--- a/app/src/main/res/layout/fragment_detail.xml
+++ b/app/src/main/res/layout/fragment_detail.xml
@@ -9,11 +9,11 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
-
-
-
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
index cc8d524ef..005239c9e 100644
--- a/app/src/main/res/layout/fragment_home.xml
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -4,13 +4,13 @@
xmlns:tools="http://schemas.android.com/tools"
tools:context=".home.HomeFragment">
-
-
-
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_queue.xml b/app/src/main/res/layout/fragment_queue.xml
index 2a4271793..7b8bb8afa 100644
--- a/app/src/main/res/layout/fragment_queue.xml
+++ b/app/src/main/res/layout/fragment_queue.xml
@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
tools:context=".playback.queue.QueueFragment">
-
-
-
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml
index 81f24abf5..55306cb66 100644
--- a/app/src/main/res/layout/fragment_search.xml
+++ b/app/src/main/res/layout/fragment_search.xml
@@ -3,11 +3,11 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
-
-
-
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml
index 13c51726d..0ec96db45 100644
--- a/app/src/main/res/layout/fragment_settings.xml
+++ b/app/src/main/res/layout/fragment_settings.xml
@@ -4,14 +4,14 @@
xmlns:tools="http://schemas.android.com/tools"
tools:context=".settings.SettingsFragment">
-
-
-
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_action_header.xml b/app/src/main/res/layout/item_action_header.xml
index fdc1429dc..d793f661a 100644
--- a/app/src/main/res/layout/item_action_header.xml
+++ b/app/src/main/res/layout/item_action_header.xml
@@ -21,7 +21,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{header.string.resolve(context)}"
- app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintBottom_toTopOf="@id/header_divider"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Songs" />
@@ -38,10 +38,16 @@
android:paddingEnd="@dimen/spacing_medium"
android:background="@drawable/ui_small_unbounded_ripple"
android:src="@{context.getDrawable(header.icon)}"
- app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintBottom_toTopOf="@id/header_divider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_sort" />
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_header.xml b/app/src/main/res/layout/item_header.xml
index 820a0adbb..ed5ff6944 100644
--- a/app/src/main/res/layout/item_header.xml
+++ b/app/src/main/res/layout/item_header.xml
@@ -1,6 +1,7 @@
@@ -10,11 +11,26 @@
type="org.oxycblt.auxio.music.Header" />
-
+ android:layout_height="wrap_content">
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/view_compact_playback.xml b/app/src/main/res/layout/view_compact_playback.xml
index d3c227c1d..37cab6664 100644
--- a/app/src/main/res/layout/view_compact_playback.xml
+++ b/app/src/main/res/layout/view_compact_playback.xml
@@ -71,7 +71,7 @@
app:layout_constraintTop_toTopOf="parent" />
@color/surface_night
- @color/surface_day
+ @color/surface_day
#ffffff
#01151515
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index c37551f05..d016a27fb 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -2,7 +2,7 @@
#fafafa
- @color/surface_night
+ @color/surface_night
#202020
#01fafafa
diff --git a/app/src/main/res/values/styles_android.xml b/app/src/main/res/values/styles_android.xml
index a9d414753..7096e77f2 100644
--- a/app/src/main/res/values/styles_android.xml
+++ b/app/src/main/res/values/styles_android.xml
@@ -5,7 +5,6 @@
diff --git a/app/src/main/res/values/styles_ui.xml b/app/src/main/res/values/styles_ui.xml
index 80a73b3d5..57a5272d1 100644
--- a/app/src/main/res/values/styles_ui.xml
+++ b/app/src/main/res/values/styles_ui.xml
@@ -137,7 +137,6 @@
- center_vertical
- ?android:attr/textColorPrimary
- @font/inter_semibold
- - @drawable/ui_header_dividers