diff --git a/.github/workflows/nightlies.yml b/.github/workflows/nightlies.yml index 5520782..7eafe3a 100644 --- a/.github/workflows/nightlies.yml +++ b/.github/workflows/nightlies.yml @@ -48,11 +48,31 @@ jobs: declare -a apks=("universal" "arm64-v8a" "armeabi-v7a" "x86" "x86_64") printf "%s\n" "${apks[@]}" | xargs -n 1 -I {} sh -c ' - cp app/build/outputs/apk/preview/app-{}-preview-signed.apk mpvKt-{}-r${{ env.COMMIT_COUNT }}.apk' + cp app/build/outputs/apk/preview/app-{}-preview-signed.apk mpvKt-{}-r${{ env.COMMIT_COUNT }}.apk + echo "{}=mpv-{}-r${{ env.COMMIT_COUNT}}.apk" >> $GITHUB_ENV' - name: Upload the APK artifact uses: actions/upload-artifact@v4 with: - path: ./mpvKt-*.apk - name: packages - retention-days: 14 + path: ${{ env.universal }} + name: ${{ env.universal }} + - name: Upload the APK artifact + uses: actions/upload-artifact@v4 + with: + path: ${{ env.arm64-v8a }} + name: ${{ env.arm64-v8a }} + - name: Upload the APK artifact + uses: actions/upload-artifact@v4 + with: + path: ${{ env.armeabi-v7a }} + name: ${{ env.armeabi-v7a }} + - name: Upload the APK artifact + uses: actions/upload-artifact@v4 + with: + path: ${{ env.x86 }} + name: ${{ env.x86 }} + - name: Upload the APK artifact + uses: actions/upload-artifact@v4 + with: + path: ${{ env.x86_64 }} + name: ${{ env.x86_64 }} \ No newline at end of file diff --git a/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerActivity.kt b/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerActivity.kt index b373b21..508560c 100644 --- a/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerActivity.kt +++ b/app/src/main/java/live/mehiz/mpvkt/ui/player/PlayerActivity.kt @@ -1,5 +1,6 @@ package live.mehiz.mpvkt.ui.player +import android.annotation.SuppressLint import android.app.PictureInPictureParams import android.content.BroadcastReceiver import android.content.Context @@ -81,7 +82,7 @@ class PlayerActivity : AppCompatActivity() { private var restoreAudioFocus: () -> Unit = {} private var pipRect: android.graphics.Rect? = null - private val isPipSupported by lazy { + val isPipSupported by lazy { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { false } else { @@ -133,23 +134,26 @@ class PlayerActivity : AppCompatActivity() { } override fun onPause() { - super.onPause() - CoroutineScope(Dispatchers.IO).launch { - saveVideoPlaybackState() - } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && !isInPictureInPictureMode) { viewModel.pause() - } else { - return } + CoroutineScope(Dispatchers.IO).launch { + saveVideoPlaybackState() + } + super.onPause() } + override fun onStop() { + viewModel.pause() + super.onStop() + } + + @SuppressLint("NewApi") override fun onUserLeaveHint() { - if (!isPipSupported) { - super.onUserLeaveHint() - return - } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && player.paused == false) { + if (isPipSupported && + player.paused == false && + playerPreferences.automaticallyEnterPip.get() + ) { enterPictureInPictureMode() } super.onUserLeaveHint() diff --git a/app/src/main/java/live/mehiz/mpvkt/ui/player/controls/BottomRightPlayerControls.kt b/app/src/main/java/live/mehiz/mpvkt/ui/player/controls/BottomRightPlayerControls.kt index ea6abdd..e58c5b7 100644 --- a/app/src/main/java/live/mehiz/mpvkt/ui/player/controls/BottomRightPlayerControls.kt +++ b/app/src/main/java/live/mehiz/mpvkt/ui/player/controls/BottomRightPlayerControls.kt @@ -1,5 +1,6 @@ package live.mehiz.mpvkt.ui.player.controls +import android.annotation.SuppressLint import android.os.Build import androidx.compose.foundation.layout.Row import androidx.compose.material.icons.Icons @@ -17,14 +18,15 @@ import live.mehiz.mpvkt.ui.player.VideoAspect import live.mehiz.mpvkt.ui.player.controls.components.ControlsButton import org.koin.compose.koinInject +@SuppressLint("NewApi") @Composable fun BottomRightPlayerControls(modifier: Modifier = Modifier) { val viewModel = koinInject() val playerPreferences = koinInject() val aspect by playerPreferences.videoAspect.collectAsState() Row(modifier) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - val activity = LocalContext.current as PlayerActivity + val activity = LocalContext.current as PlayerActivity + if (activity.isPipSupported) { ControlsButton( Icons.Default.PictureInPictureAlt, onClick = {