deps: upgrate

Like a while loop with no escape.
Platform -> API 32
Coil -> 2.0.0-alpha06
This commit is contained in:
OxygenCobalt 2022-01-06 12:34:34 -07:00
parent 8ad44d898c
commit dc43edd6cb
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
5 changed files with 13 additions and 16 deletions

View file

@ -4,7 +4,7 @@ apply plugin: "kotlin-kapt"
apply plugin: "androidx.navigation.safeargs.kotlin" apply plugin: "androidx.navigation.safeargs.kotlin"
android { android {
compileSdkVersion 31 compileSdkVersion 32
buildToolsVersion "31.0.0" buildToolsVersion "31.0.0"
defaultConfig { defaultConfig {
@ -13,7 +13,7 @@ android {
versionCode 10 versionCode 10
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 31 targetSdkVersion 32
buildFeatures { buildFeatures {
dataBinding true dataBinding true
@ -86,7 +86,7 @@ dependencies {
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version" implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
// Media // Media
// TODO: Migrate to Media3 // TODO: Dumpster this for Media3
implementation "androidx.media:media:1.4.3" implementation "androidx.media:media:1.4.3"
// Preferences // Preferences
@ -98,7 +98,7 @@ dependencies {
implementation "com.google.android.exoplayer:exoplayer-core:2.16.1" implementation "com.google.android.exoplayer:exoplayer-core:2.16.1"
// Image loading // Image loading
implementation 'io.coil-kt:coil:2.0.0-alpha05' implementation 'io.coil-kt:coil:2.0.0-alpha06'
// Material // Material
implementation 'com.google.android.material:material:1.5.0-rc01' implementation 'com.google.android.material:material:1.5.0-rc01'

View file

@ -39,6 +39,7 @@ import org.oxycblt.auxio.util.systemBarsCompat
/** /**
* A [Fragment] that displays more information about the song, along with more media controls. * A [Fragment] that displays more information about the song, along with more media controls.
* Instantiation is done by the navigation component, **do not instantiate this fragment manually.** * Instantiation is done by the navigation component, **do not instantiate this fragment manually.**
* TODO: Show playing from on this screen now
* @author OxygenCobalt * @author OxygenCobalt
*/ */
class PlaybackFragment : Fragment() { class PlaybackFragment : Fragment() {
@ -103,12 +104,10 @@ class PlaybackFragment : Fragment() {
playbackModel.song.observe(viewLifecycleOwner) { song -> playbackModel.song.observe(viewLifecycleOwner) { song ->
if (song != null) { if (song != null) {
logD("Updating song display to ${song.name}.") logD("Updating song display to ${song.name}.")
binding.song = song binding.song = song
binding.playbackSeekBar.setDuration(song.seconds) binding.playbackSeekBar.setDuration(song.seconds)
} else { } else {
logD("No song is being played, leaving.") logD("No song is being played, leaving.")
findNavController().navigateUp() findNavController().navigateUp()
} }
} }

View file

@ -34,8 +34,7 @@ import org.oxycblt.auxio.util.logD
import kotlin.math.pow import kotlin.math.pow
/** /**
* Object that manages the AudioFocus state. * Manages the current volume and playback state across ReplayGain and AudioFocus events.
* Adapted from NewPipe (https://github.com/TeamNewPipe/NewPipe)
* @author OxygenCobalt * @author OxygenCobalt
*/ */
class AudioReactor(context: Context) : AudioManager.OnAudioFocusChangeListener { class AudioReactor(context: Context) : AudioManager.OnAudioFocusChangeListener {
@ -76,8 +75,8 @@ class AudioReactor(context: Context) : AudioManager.OnAudioFocusChangeListener {
val gain = parseReplayGain(metadata) val gain = parseReplayGain(metadata)
// Currently we consider both the album and the track gain. One might want to add // Currently we consider both the album and the track gain.
// configuration to handle more cases. // TODO: Add configuration here
var adjust = 0f var adjust = 0f
if (gain != null) { if (gain != null) {
@ -107,12 +106,12 @@ class AudioReactor(context: Context) : AudioManager.OnAudioFocusChangeListener {
val entry = metadata.get(i) val entry = metadata.get(i)
// Sometimes the ReplayGain keys will be lowercase, so make them uppercase. // Sometimes the ReplayGain keys will be lowercase, so make them uppercase.
if (entry is TextInformationFrame && entry.description?.uppercase() in replayGainTags) { if (entry is TextInformationFrame && entry.description?.uppercase() in REPLAY_GAIN_TAGS) {
tags.add(GainTag(entry.description!!.uppercase(), parseReplayGainFloat(entry.value))) tags.add(GainTag(entry.description!!.uppercase(), parseReplayGainFloat(entry.value)))
continue continue
} }
if (entry is VorbisComment && entry.key.uppercase() in replayGainTags) { if (entry is VorbisComment && entry.key.uppercase() in REPLAY_GAIN_TAGS) {
tags.add(GainTag(entry.key.uppercase(), parseReplayGainFloat(entry.value))) tags.add(GainTag(entry.key.uppercase(), parseReplayGainFloat(entry.value)))
} }
} }
@ -228,7 +227,7 @@ class AudioReactor(context: Context) : AudioManager.OnAudioFocusChangeListener {
const val R128_TRACK = "R128_TRACK_GAIN" const val R128_TRACK = "R128_TRACK_GAIN"
const val R128_ALBUM = "R128_ALBUM_GAIN" const val R128_ALBUM = "R128_ALBUM_GAIN"
val replayGainTags = arrayOf( val REPLAY_GAIN_TAGS = arrayOf(
RG_TRACK, RG_TRACK,
RG_ALBUM, RG_ALBUM,
R128_ALBUM, R128_ALBUM,

View file

@ -27,6 +27,7 @@ import android.support.v4.media.session.MediaSessionCompat
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.media.app.NotificationCompat.MediaStyle import androidx.media.app.NotificationCompat.MediaStyle
import org.oxycblt.auxio.BuildConfig
import org.oxycblt.auxio.R import org.oxycblt.auxio.R
import org.oxycblt.auxio.coil.loadBitmap import org.oxycblt.auxio.coil.loadBitmap
import org.oxycblt.auxio.music.MusicParent import org.oxycblt.auxio.music.MusicParent
@ -172,7 +173,7 @@ class PlaybackNotification private constructor(
} }
companion object { companion object {
const val CHANNEL_ID = "CHANNEL_AUXIO_PLAYBACK" const val CHANNEL_ID = BuildConfig.APPLICATION_ID + ".channel.PLAYBACK"
const val NOTIFICATION_ID = 0xA0A0 const val NOTIFICATION_ID = 0xA0A0
/** /**

View file

@ -46,7 +46,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.conflate import kotlinx.coroutines.flow.conflate
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.takeWhile import kotlinx.coroutines.flow.takeWhile
@ -412,7 +411,6 @@ class PlaybackService : Service(), Player.Listener, PlaybackStateManager.Callbac
pollFlow.takeWhile { player.isPlaying }.collect { poll -> pollFlow.takeWhile { player.isPlaying }.collect { poll ->
playbackManager.setPosition(poll.pos) playbackManager.setPosition(poll.pos)
player.volume = audioReactor.volume player.volume = audioReactor.volume
logD(player.volume)
} }
} }
} }