Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
crossle committed Jan 23, 2025
1 parent e4fe8c9 commit b96df53
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 17 deletions.
7 changes: 4 additions & 3 deletions app/src/main/java/one/mixin/android/ui/player/MusicService.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package one.mixin.android.ui.player

import android.annotation.SuppressLint
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
Expand All @@ -15,7 +16,6 @@ import androidx.media3.common.Player
import androidx.media3.common.Player.DISCONTINUITY_REASON_INTERNAL
import androidx.media3.common.Player.DISCONTINUITY_REASON_REMOVE
import androidx.media3.common.Player.DISCONTINUITY_REASON_SEEK_ADJUSTMENT
import androidx.media3.common.util.UnstableApi
import androidx.media3.session.MediaSession
import androidx.media3.session.MediaSessionService
import androidx.paging.PagedList
Expand All @@ -36,7 +36,7 @@ import javax.inject.Inject
import kotlin.math.max
import kotlin.math.min

@UnstableApi @AndroidEntryPoint
@AndroidEntryPoint
class MusicService : MediaSessionService(), LifecycleOwner {
private lateinit var mediaSession: MediaSession

Expand Down Expand Up @@ -265,7 +265,8 @@ class MusicService : MediaSessionService(), LifecycleOwner {

private inner class MediaSessionCallback : MediaSession.Callback

@UnstableApi private inner class PlayerEventListener : Player.Listener {
private inner class PlayerEventListener : Player.Listener {
@SuppressLint("UnsafeOptInUsageError")
override fun onPositionDiscontinuity(
oldPosition: Player.PositionInfo,
newPosition: Player.PositionInfo,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package one.mixin.android.ui.player.internal

import android.annotation.SuppressLint
import android.support.v4.media.MediaBrowserCompat
import android.support.v4.media.MediaDescriptionCompat
import android.support.v4.media.MediaMetadataCompat
import androidx.lifecycle.LiveData
import androidx.media3.common.util.UnstableApi
import androidx.paging.PagedList
import androidx.paging.toLiveData
import one.mixin.android.db.MixinDatabase
Expand All @@ -14,7 +14,8 @@ import one.mixin.android.vo.MediaStatus
import one.mixin.android.vo.MessageItem
import one.mixin.android.vo.absolutePath

@UnstableApi class ConversationLoader : MusicMetaLoader() {
@SuppressLint("UnsafeOptInUsageError")
class ConversationLoader : MusicMetaLoader() {
fun conversationLiveData(
conversationId: String,
db: MixinDatabase,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package one.mixin.android.ui.player.internal

import android.annotation.SuppressLint
import android.util.LruCache
import androidx.media3.common.MediaItem
import androidx.media3.common.Metadata
import androidx.media3.common.util.UnstableApi
import androidx.media3.exoplayer.MetadataRetriever
import androidx.media3.extractor.metadata.flac.PictureFrame
import androidx.media3.extractor.metadata.id3.ApicFrame
Expand All @@ -19,13 +19,14 @@ import java.io.FileNotFoundException
import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeoutException

@UnstableApi abstract class MusicMetaLoader {
abstract class MusicMetaLoader {
val unknownString = getLocalString(MixinApplication.appContext, R.string.Unknown)

val ignoreSet = mutableSetOf<String>()

private val metaCache = LruCache<String, MusicMeta>(100 * 1024)

@SuppressLint("UnsafeOptInUsageError")
protected fun retrieveMetadata(
id: String,
url: String,
Expand Down Expand Up @@ -68,6 +69,7 @@ import java.util.concurrent.TimeoutException
return null
}

@SuppressLint("UnsafeOptInUsageError")
private fun decodeMetadata(
id: String,
url: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class DepositFragment : BaseFragment() {
savedInstanceState: Bundle?,
) {
super.onViewCreated(view, savedInstanceState)
val asset = requireNotNull(requireArguments().getParcelableCompat(TransactionsFragment.ARGS_ASSET, TokenItem::class.java)) { "required TokenItem can not be null" }
val asset = requireNotNull(requireArguments().getParcelableCompat(ARGS_ASSET, TokenItem::class.java)) { "required TokenItem can not be null" }
initView(asset)
}

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/one/mixin/android/util/AudioPlayer.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package one.mixin.android.util

import android.annotation.SuppressLint
import android.media.AudioManager
import androidx.media3.common.Player
import androidx.media3.common.util.UnstableApi
import androidx.media3.exoplayer.ExoPlaybackException
import androidx.media3.exoplayer.source.UnrecognizedInputFormatException
import io.reactivex.Observable
Expand Down Expand Up @@ -42,7 +42,7 @@ import org.threeten.bp.ZonedDateTime
import timber.log.Timber
import java.util.concurrent.TimeUnit

@UnstableApi class AudioPlayer private constructor() {
class AudioPlayer private constructor() {
companion object {
@Synchronized
private fun get(): AudioPlayer {
Expand Down Expand Up @@ -167,6 +167,7 @@ import java.util.concurrent.TimeUnit
}
}

@SuppressLint("UnsafeOptInUsageError")
override fun onPlayerError(error: ExoPlaybackException) {
if (error.cause is UnrecognizedInputFormatException) {
status = STATUS_ERROR
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/one/mixin/android/util/MusicPlayer.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package one.mixin.android.util

import android.annotation.SuppressLint
import android.support.v4.media.MediaMetadataCompat
import androidx.media3.common.AudioAttributes
import androidx.media3.common.C
Expand All @@ -8,7 +9,6 @@ import androidx.media3.common.PlaybackException
import androidx.media3.common.PlaybackParameters
import androidx.media3.common.Player
import androidx.media3.common.Timeline
import androidx.media3.common.util.UnstableApi
import androidx.media3.exoplayer.ExoPlaybackException
import androidx.media3.exoplayer.ExoPlaybackException.TYPE_SOURCE
import androidx.media3.exoplayer.ExoPlayer
Expand All @@ -34,7 +34,7 @@ import one.mixin.android.widget.CircleProgress.Companion.STATUS_PAUSE
import one.mixin.android.widget.CircleProgress.Companion.STATUS_PLAY
import java.util.concurrent.TimeUnit

@UnstableApi class MusicPlayer private constructor() {
class MusicPlayer private constructor() {
companion object {
@Synchronized
fun get(): MusicPlayer {
Expand Down Expand Up @@ -95,7 +95,7 @@ import java.util.concurrent.TimeUnit

private val updater = MusicPlayerUpdater(exoPlayer)

@UnstableApi private inner class PlayerListener : Player.Listener {
private inner class PlayerListener : Player.Listener {
override fun onPlaybackStateChanged(playbackState: Int) {
if (playbackState == Player.STATE_ENDED) {
id()?.let { id -> RxBus.publish(pauseEvent(id)) }
Expand Down Expand Up @@ -128,6 +128,7 @@ import java.util.concurrent.TimeUnit
}
}

@SuppressLint("UnsafeOptInUsageError")
override fun onPlayerError(error: PlaybackException) {
if (error.cause is UnrecognizedInputFormatException) {
status = STATUS_ERROR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import androidx.media3.common.Player.STATE_READY
import androidx.media3.common.Timeline
import androidx.media3.common.Tracks
import androidx.media3.common.VideoSize
import androidx.media3.common.util.UnstableApi
import androidx.media3.datasource.DataSource
import androidx.media3.datasource.DefaultDataSource
import androidx.media3.exoplayer.ExoPlaybackException
Expand All @@ -36,7 +35,7 @@ import one.mixin.android.util.reportExoPlayerException
import kotlin.math.max
import kotlin.math.min

@UnstableApi
@SuppressLint("UnsafeOptInUsageError")
@Suppress("unused")
class MixinPlayer(val isAudio: Boolean = false) : Player.Listener {
val player: ExoPlayer by lazy {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_size.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/slider"
android:text="A"
android:textSize="12dp"
android:textSize="12sp"
android:layout_marginEnd="12dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -55,7 +55,7 @@
app:layout_constraintStart_toEndOf="@id/slider"
app:layout_constraintBottom_toBottomOf="@id/slider"
android:text="A"
android:textSize="26dp"
android:textSize="26sp"
android:layout_width="wrap_content"
android:layout_marginStart="12dp"
android:layout_height="wrap_content"
Expand Down

0 comments on commit b96df53

Please sign in to comment.