Skip to content

Commit

Permalink
Merge pull request #171 from TeamAmaze/bugfix/fullscreen-cutoff
Browse files Browse the repository at this point in the history
Fix cutout mode crashes for full screen players
  • Loading branch information
VishalNehra authored Jul 8, 2024
2 parents dfcda81 + 868d0c4 commit 383b104
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<activity
android:name=".image_viewer.ImageViewerActivity"
android:label="@string/image_viewer"
android:theme="@style/Theme.AmazeFileUtilities.FullScreen.Dark"
android:theme="@style/Theme.AmazeFileUtilities.FullScreen.Dark.Fallback"
android:exported="true"
>
<intent-filter
Expand All @@ -111,7 +111,7 @@
<activity
android:name=".image_viewer.editor.EditImageActivity"
android:label="@string/image_editor"
android:theme="@style/Theme.AmazeFileUtilities.FullScreen.Dark"
android:theme="@style/Theme.AmazeFileUtilities.FullScreen.Dark.Fallback"
android:exported="true"
>
<intent-filter
Expand Down Expand Up @@ -159,7 +159,7 @@
android:supportsPictureInPicture="true"
android:resizeableActivity="true"
android:taskAffinity="com.amaze.fileutilitiespip"
android:theme="@style/Theme.AmazeFileUtilities.FullScreen.Dark"
android:theme="@style/Theme.AmazeFileUtilities.FullScreen.Dark.Fallback"
android:exported="true">
<intent-filter
android:label="@string/video_player_full_screen"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package com.amaze.fileutilities.image_viewer

import android.os.Build
import android.os.Bundle
import androidx.lifecycle.ViewModelProvider
import androidx.viewpager2.widget.ViewPager2
Expand All @@ -28,9 +29,10 @@ import com.amaze.fileutilities.R
import com.amaze.fileutilities.databinding.GenericPagerViewerActivityBinding
import com.amaze.fileutilities.utilis.Utils.Companion.showProcessingDialog
import com.amaze.fileutilities.utilis.showToastInCenter
import java.io.File
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.io.File


class ImageViewerActivity : PermissionsActivity() {

Expand All @@ -42,6 +44,14 @@ class ImageViewerActivity : PermissionsActivity() {
}

override fun onCreate(savedInstanceState: Bundle?) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
try {
setTheme(R.style.Theme_AmazeFileUtilities_FullScreen_Dark)
} catch (e: Exception) {
log.warn("failed to set theme Theme_AmazeFileUtilities_FullScreen_Dark")
setTheme(R.style.Theme_AmazeFileUtilities_FullScreen_Dark_Fallback)
}
}
super.onCreate(savedInstanceState)
setContentView(viewBinding.root)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import android.graphics.Bitmap
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.provider.MediaStore
import android.view.MotionEvent
Expand Down Expand Up @@ -143,6 +144,14 @@ class EditImageActivity :
)

override fun onCreate(savedInstanceState: Bundle?) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
try {
setTheme(R.style.Theme_AmazeFileUtilities_FullScreen_Dark)
} catch (e: Exception) {
log.warn("failed to set theme Theme_AmazeFileUtilities_FullScreen_Dark")
setTheme(R.style.Theme_AmazeFileUtilities_FullScreen_Dark_Fallback)
}
}
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_edit_image)
initViews()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import android.view.View
import android.view.WindowInsets
import android.view.WindowInsetsController
import android.view.WindowManager
import com.amaze.fileutilities.R

class VideoPlayerActivity : BaseVideoPlayerActivity() {

Expand All @@ -39,6 +40,14 @@ class VideoPlayerActivity : BaseVideoPlayerActivity() {
}

override fun onCreate(savedInstanceState: Bundle?) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
try {
setTheme(R.style.Theme_AmazeFileUtilities_FullScreen_Dark)
} catch (e: Exception) {
log.warn("failed to set theme Theme_AmazeFileUtilities_FullScreen_Dark", e)
setTheme(R.style.Theme_AmazeFileUtilities_FullScreen_Dark_Fallback)
}
}
initLocalVideoModel(intent)
super.onCreate(savedInstanceState)
handleVideoPlayerActivityResources()
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
<item name="android:windowBackground">@color/black</item>
</style>

<style name="Theme.AmazeFileUtilities.FullScreen.Dark.Fallback" parent="Theme.AmazeFileUtilities.Dark">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowBackground">@color/black</item>
</style>

<style name="BottomNavigationTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@color/blue</item>
<item name="android:textColorSecondary">@color/blue</item>
Expand Down

0 comments on commit 383b104

Please sign in to comment.