Skip to content

Commit

Permalink
[video][Android] Remove Kotlin warnings (expo#28628)
Browse files Browse the repository at this point in the history
# Why

Removes Kotlin warnings. 
Most of them can be just ignored because we already migrated to new APIs.

# Test Plan

- NCL ✅
  • Loading branch information
lukmccall authored May 6, 2024
1 parent 2ec644a commit 338477c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ class FullscreenPlayerActivity : Activity() {
VideoManager.getVideoView(videoViewId).exitFullscreen()

// Disable the exit transition
if (Build.VERSION.SDK_INT >= 34) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
overrideActivityTransition(OVERRIDE_TRANSITION_CLOSE, 0, 0)
} else {
@Suppress("DEPRECATION")
overridePendingTransition(0, 0)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class VideoPlayerAudioFocusManager(val context: Context, private val player: Wea
this.currentFocusRequest = newFocusRequest
audioManager.requestAudioFocus(newFocusRequest)
} else {
@Suppress("DEPRECATION")
audioManager.requestAudioFocus(
this,
AudioManager.STREAM_MUSIC,
Expand All @@ -64,6 +65,7 @@ class VideoPlayerAudioFocusManager(val context: Context, private val player: Wea
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
audioManager.abandonAudioFocusRequest(it)
} else {
@Suppress("DEPRECATION")
audioManager.abandonAudioFocus(this)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class VideoView(context: Context, appContext: AppContext) : ExpoView(context, ap
if (Build.VERSION.SDK_INT >= 34) {
currentActivity.overrideActivityTransition(Activity.OVERRIDE_TRANSITION_OPEN, 0, 0)
} else {
@Suppress("DEPRECATION")
currentActivity.overridePendingTransition(0, 0)
}
isInFullscreen = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.graphics.Canvas
import android.graphics.Outline
import android.graphics.Path
import android.graphics.RectF
import android.os.Build
import android.view.View
import android.view.ViewOutlineProvider
import com.facebook.react.modules.i18nmanager.I18nUtil
Expand Down Expand Up @@ -197,7 +198,11 @@ class OutlineProvider(private val mContext: Context) : ViewOutlineProvider() {
// shadow is. For the particular case, we fallback to canvas clipping in the view
// which is supposed to call `clipCanvasIfNeeded` in its `draw` method.
updateConvexPathIfNeeded()
outline.setConvexPath(mConvexPath)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
outline.setPath(mConvexPath)
} else {
outline.setConvexPath(mConvexPath)
}
}
}

Expand Down

0 comments on commit 338477c

Please sign in to comment.