all: fix merge regressions

This commit is contained in:
Alexander Capehart 2024-10-14 14:52:21 -06:00
parent d2524a0b3a
commit 190abd5588
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
5 changed files with 42 additions and 5 deletions

View file

@ -542,13 +542,17 @@ constructor(
val header =
if (section is DetailSection.Songs) SortHeader(section.stringRes)
else BasicHeader(section.stringRes)
newList.add(Divider(header))
if (newList.isNotEmpty()) {
newList.add(Divider(header))
}
newList.add(header)
section.items
}
is DetailSection.Discs -> {
val header = SortHeader(section.stringRes)
newList.add(Divider(header))
if (newList.isNotEmpty()) {
newList.add(Divider(header))
}
newList.add(header)
section.discs.flatMap { listOf(DiscHeader(it.key)) + it.value }
}

View file

@ -73,6 +73,10 @@ constructor(
private var currentRequest: Request? = null
private var currentHandle = 0L
/** If this provider is currently attempting to load something. */
val isBusy: Boolean
get() = currentRequest?.run { !disposable.isDisposed } ?: false
/**
* Load the Album cover [Bitmap] from a [Song].
*

View file

@ -65,7 +65,11 @@ class RoundedRectTransformation(
val (outputWidth, outputHeight) = calculateOutputSize(input, size)
val output = createBitmap(outputWidth, outputHeight, input.config)
val output =
createBitmap(
outputWidth,
outputHeight,
requireNotNull(input.config) { "unsupported bitmap format" })
output.applyCanvas {
drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR)

View file

@ -15,19 +15,19 @@
* 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.music.external
import android.content.Context
import android.net.Uri
import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject
import org.oxycblt.auxio.music.Playlist
import org.oxycblt.auxio.music.fs.Components
import org.oxycblt.auxio.music.fs.DocumentPathFactory
import org.oxycblt.auxio.music.fs.Path
import org.oxycblt.auxio.music.fs.contentResolverSafe
import org.oxycblt.auxio.util.logE
import javax.inject.Inject
/**
* Generic playlist file importing abstraction.

View file

@ -20,6 +20,7 @@ package org.oxycblt.auxio.playback.state
import android.net.Uri
import android.os.SystemClock
import android.support.v4.media.session.PlaybackStateCompat
import org.oxycblt.auxio.list.adapter.UpdateInstructions
import org.oxycblt.auxio.music.MusicParent
import org.oxycblt.auxio.music.Song
@ -324,6 +325,30 @@ private constructor(
initPositionMs
}
/**
* Load this instance into a [PlaybackStateCompat].
*
* @param builder The [PlaybackStateCompat.Builder] to mutate.
* @return The same [PlaybackStateCompat.Builder] for easy chaining.
*/
fun intoPlaybackState(builder: PlaybackStateCompat.Builder): PlaybackStateCompat.Builder =
builder.setState(
// State represents the user's preference, not the actual player state.
// Doing this produces a better experience in the media control UI.
if (isPlaying) {
PlaybackStateCompat.STATE_PLAYING
} else {
PlaybackStateCompat.STATE_PAUSED
},
initPositionMs,
if (isAdvancing) {
1f
} else {
// Not advancing, so don't move the position.
0f
},
creationTime)
// Equality ignores the creation time to prevent functionally identical states
// from being non-equal.