bump dependencies version

This commit is contained in:
Gary Wang 2022-03-02 20:32:46 +08:00
parent 164976f8ae
commit c6e107fdd0
No known key found for this signature in database
GPG Key ID: 5D30A4F15EA78760
5 changed files with 49 additions and 6 deletions

View File

@ -63,14 +63,14 @@ dependencies {
def nav_compose_version = '2.4.1'
implementation "androidx.navigation:navigation-compose:$nav_compose_version"
def lifecycle_version = '2.4.0'
def lifecycle_version = '2.4.1'
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation 'androidx.activity:activity-compose:1.4.0'
implementation "androidx.datastore:datastore-preferences:1.0.0"
def room_version = '2.4.1'
def room_version = '2.4.2'
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
implementation "androidx.room:room-runtime:$room_version"
@ -78,7 +78,7 @@ dependencies {
implementation "com.squareup.okhttp3:okhttp:4.9.0"
def media3_version = '1.0.0-alpha01'
def media3_version = '1.0.0-alpha02'
implementation "androidx.media3:media3-ui:$media3_version"
implementation "androidx.media3:media3-exoplayer:$media3_version"
implementation "androidx.media3:media3-session:$media3_version"

View File

@ -1,5 +1,6 @@
package net.blumia.pcmdroid
import android.annotation.SuppressLint
import android.content.ComponentName
import android.os.Bundle
import androidx.activity.ComponentActivity
@ -74,6 +75,7 @@ class MainActivity : ComponentActivity() {
MediaBrowser.releaseFuture(browserFuture)
}
@androidx.annotation.OptIn(UnstableApi::class)
private fun pushRoot() {
// browser can be initialized many times
// only push root at the first initialization

View File

@ -4,11 +4,19 @@ import android.app.PendingIntent.FLAG_IMMUTABLE
import android.app.PendingIntent.FLAG_UPDATE_CURRENT
import android.content.Intent
import android.os.Build
import android.util.Log
import androidx.core.app.TaskStackBuilder
import androidx.media3.common.AudioAttributes
import androidx.media3.common.MediaItem
import androidx.media3.common.MediaMetadata
import androidx.media3.common.MediaMetadata.FOLDER_TYPE_MIXED
import androidx.media3.common.util.UnstableApi
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.session.LibraryResult
import androidx.media3.session.MediaLibraryService
import androidx.media3.session.MediaSession
import com.google.common.util.concurrent.Futures
import com.google.common.util.concurrent.ListenableFuture
import net.blumia.pcmdroid.MainActivity
class PlaybackService : MediaLibraryService() {
@ -20,6 +28,35 @@ class PlaybackService : MediaLibraryService() {
private inner class CustomMediaLibrarySessionCallback
: MediaLibrarySession.MediaLibrarySessionCallback
{
@androidx.annotation.OptIn(UnstableApi::class)
override fun onGetLibraryRoot(
session: MediaLibrarySession,
browser: MediaSession.ControllerInfo,
params: LibraryParams?
): ListenableFuture<LibraryResult<MediaItem>> {
Log.d("aaa", "onGetLibraryRoot ${params.toString()}")
val metadata = MediaMetadata.Builder()
.setTitle("Root")
.setIsPlayable(false)
.setFolderType(FOLDER_TYPE_MIXED)
.build()
val item = MediaItem.Builder()
.setMediaId("test")
.setMediaMetadata(metadata)
.build()
return Futures.immediateFuture(LibraryResult.ofItem(item, params))
//MediaMetadata
// return super.onGetLibraryRoot(session, browser, params)
}
override fun onGetItem(
session: MediaLibrarySession,
browser: MediaSession.ControllerInfo,
mediaId: String
): ListenableFuture<LibraryResult<MediaItem>> {
Log.d("aaa", "onGetItem $mediaId")
return super.onGetItem(session, browser, mediaId)
}
}
override fun onGetSession(controllerInfo: MediaSession.ControllerInfo): MediaLibrarySession {
@ -37,6 +74,7 @@ class PlaybackService : MediaLibraryService() {
super.onDestroy()
}
@androidx.annotation.OptIn(UnstableApi::class)
private fun initializeSessionAndPlayer() {
player =
ExoPlayer.Builder(this)

View File

@ -7,6 +7,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.livedata.observeAsState
import androidx.lifecycle.MutableLiveData
import androidx.media3.common.MediaItem
import androidx.media3.common.util.UnstableApi
import androidx.media3.session.MediaBrowser
import androidx.navigation.NavHostController
import androidx.navigation.NavType
@ -33,6 +34,7 @@ object MainDestinations {
const val SETTINGS_ROUTE = "settings"
}
@androidx.annotation.OptIn(UnstableApi::class)
@Composable
fun NavGraph(
mainViewModel: MainViewModel,
@ -73,6 +75,7 @@ fun NavGraph(
onSongItemClicked = { song, songs ->
Log.d("vvv", song.url + browser.toString())
val playlist = browser ?: return@MainPlayer
Log.d("vvv", song.url + browser.toString())
val item = MediaItem.Builder().setUri(song.url).build()

View File

@ -1,12 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
compose_version = '1.1.0'
compose_version = '1.1.1'
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.1' apply false
id 'com.android.library' version '7.1.1' apply false
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}