mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 09:33:33 +00:00
fix: Replace poor syntax that created warnings during build
This commit is contained in:
parent
78e7032903
commit
44679855cd
4 changed files with 28 additions and 18 deletions
|
|
@ -8,15 +8,15 @@ import java.util.*
|
||||||
|
|
||||||
@Keep
|
@Keep
|
||||||
@Parcelize
|
@Parcelize
|
||||||
class Share : Parcelable {
|
data class Share(
|
||||||
@SerializedName("entry")
|
@SerializedName("entry")
|
||||||
var entries: List<Child>? = null
|
var entries: List<Child>? = null,
|
||||||
var id: String? = null
|
var id: String? = null,
|
||||||
var url: String? = null
|
var url: String? = null,
|
||||||
var description: String? = null
|
var description: String? = null,
|
||||||
var username: String? = null
|
var username: String? = null,
|
||||||
var created: Date? = null
|
var created: Date? = null,
|
||||||
var expires: Date? = null
|
var expires: Date? = null,
|
||||||
var lastVisited: Date? = null
|
var lastVisited: Date? = null,
|
||||||
var visitCount = 0
|
var visitCount: Int = 0
|
||||||
}
|
) : Parcelable
|
||||||
|
|
@ -123,9 +123,9 @@ class MediaService : MediaLibraryService() {
|
||||||
val connectionResult = super.onConnect(session, controller)
|
val connectionResult = super.onConnect(session, controller)
|
||||||
val availableSessionCommands = connectionResult.availableSessionCommands.buildUpon()
|
val availableSessionCommands = connectionResult.availableSessionCommands.buildUpon()
|
||||||
|
|
||||||
shuffleCommands.forEach { commandButton ->
|
shuffleCommands.forEach {
|
||||||
// TODO: Aggiungere i comandi personalizzati
|
// TODO: Aggiungere i comandi personalizzati
|
||||||
// commandButton.sessionCommand?.let { availableSessionCommands.add(it) }
|
// it.sessionCommand?.let { availableSessionCommands.add(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
return MediaSession.ConnectionResult.accept(
|
return MediaSession.ConnectionResult.accept(
|
||||||
|
|
@ -430,7 +430,7 @@ class MediaService : MediaLibraryService() {
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ignoreFuture(customLayout: ListenableFuture<SessionResult>) {
|
private fun ignoreFuture(@Suppress("UNUSED_PARAMETER") customLayout: ListenableFuture<SessionResult>) {
|
||||||
/* Do nothing. */
|
/* Do nothing. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import android.os.Binder
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.media3.cast.CastPlayer
|
import androidx.media3.cast.CastPlayer
|
||||||
import androidx.media3.cast.SessionAvailabilityListener
|
import androidx.media3.cast.SessionAvailabilityListener
|
||||||
import androidx.media3.common.AudioAttributes
|
import androidx.media3.common.AudioAttributes
|
||||||
|
|
@ -73,10 +74,10 @@ class MediaService : MediaLibraryService(), SessionAvailabilityListener {
|
||||||
|
|
||||||
initializeRepository()
|
initializeRepository()
|
||||||
initializePlayer()
|
initializePlayer()
|
||||||
initializeCastPlayer()
|
|
||||||
initializeMediaLibrarySession()
|
initializeMediaLibrarySession()
|
||||||
restorePlayerFromQueue()
|
restorePlayerFromQueue()
|
||||||
initializePlayerListener()
|
initializePlayerListener()
|
||||||
|
initializeCastPlayer()
|
||||||
initializeEqualizerManager()
|
initializeEqualizerManager()
|
||||||
|
|
||||||
setPlayer(
|
setPlayer(
|
||||||
|
|
@ -150,8 +151,15 @@ class MediaService : MediaLibraryService(), SessionAvailabilityListener {
|
||||||
if (GoogleApiAvailability.getInstance()
|
if (GoogleApiAvailability.getInstance()
|
||||||
.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS
|
.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS
|
||||||
) {
|
) {
|
||||||
castPlayer = CastPlayer(CastContext.getSharedInstance(this))
|
CastContext.getSharedInstance(this, ContextCompat.getMainExecutor(this))
|
||||||
castPlayer.setSessionAvailabilityListener(this)
|
.addOnSuccessListener { castContext ->
|
||||||
|
castPlayer = CastPlayer(castContext)
|
||||||
|
castPlayer.setSessionAvailabilityListener(this@MediaService)
|
||||||
|
|
||||||
|
if (castPlayer.isCastSessionAvailable && this::mediaLibrarySession.isInitialized) {
|
||||||
|
setPlayer(player, castPlayer)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.cappielloantonio.tempo.util;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.google.android.gms.cast.framework.CastContext;
|
import com.google.android.gms.cast.framework.CastContext;
|
||||||
import com.google.android.gms.common.ConnectionResult;
|
import com.google.android.gms.common.ConnectionResult;
|
||||||
import com.google.android.gms.common.GoogleApiAvailability;
|
import com.google.android.gms.common.GoogleApiAvailability;
|
||||||
|
|
@ -9,6 +11,6 @@ import com.google.android.gms.common.GoogleApiAvailability;
|
||||||
public class Flavors {
|
public class Flavors {
|
||||||
public static void initializeCastContext(Context context) {
|
public static void initializeCastContext(Context context) {
|
||||||
if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS)
|
if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS)
|
||||||
CastContext.getSharedInstance(context);
|
CastContext.getSharedInstance(context, ContextCompat.getMainExecutor(context));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue