diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt index 282ab5489..2b15e5b2a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt @@ -106,7 +106,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { storeStateVariables() if (mShowAll) { - supportActionBar?.setDisplayHomeAsUpEnabled(false) registerFileUpdateListener() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaPhotoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaPhotoActivity.kt index f72900572..9c66ac750 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaPhotoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaPhotoActivity.kt @@ -34,7 +34,6 @@ open class PanoramaPhotoActivity : SimpleActivity() { requestWindowFeature(Window.FEATURE_NO_TITLE) super.onCreate(savedInstanceState) setContentView(R.layout.activity_panorama_photo) - supportActionBar?.hide() checkNotchSupport() setupButtonMargins() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaVideoActivity.kt index 22352518d..1d7428fc0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaVideoActivity.kt @@ -45,7 +45,6 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList requestWindowFeature(Window.FEATURE_NO_TITLE) super.onCreate(savedInstanceState) setContentView(R.layout.activity_panorama_video) - supportActionBar?.hide() checkNotchSupport() checkIntent() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt index 6d1bf290a..7c4f5810d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt @@ -75,7 +75,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList } } - private fun refreshMenuItems() { + fun refreshMenuItems() { val visibleBottomActions = if (config.bottomActions) config.visibleBottomActions else 0 fragment_viewer_toolbar.menu.apply { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt index 65cac3e4e..6ac7e5994 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/VideoPlayerActivity.kt @@ -74,7 +74,6 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen override fun onResume() { super.onResume() top_shadow.layoutParams.height = statusBarHeight + actionBarHeight - supportActionBar?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) window.statusBarColor = Color.TRANSPARENT window.navigationBarColor = Color.TRANSPARENT if (config.blackBackground) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index d089e91ee..e7423f9d3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -140,7 +140,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } setupOrientation() - invalidateOptionsMenu() + refreshMenuItems() val filename = getCurrentMedium()?.name ?: mPath.getFilenameFromPath() medium_viewer_toolbar.title = filename @@ -166,7 +166,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } - private fun refreshMenuItems() { + fun refreshMenuItems() { val currentMedium = getCurrentMedium() ?: return currentMedium.isFavorite = mFavoritePaths.contains(currentMedium.path) val visibleBottomActions = if (config.bottomActions) config.visibleBottomActions else 0 @@ -375,7 +375,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View isShowingRecycleBin -> RECYCLE_BIN else -> mPath.getParentPath() } - supportActionBar?.title = mPath.getFilenameFromPath() + medium_viewer_toolbar.title = mPath.getFilenameFromPath() view_pager.onGlobalLayout { if (!isDestroyed) { @@ -691,7 +691,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun toggleFileVisibility(hide: Boolean, callback: (() -> Unit)? = null) { toggleFileVisibility(getCurrentPath(), hide) { val newFileName = it.getFilenameFromPath() - supportActionBar?.title = newFileName + medium_viewer_toolbar.title = newFileName getCurrentMedium()!!.apply { name = newFileName diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt index 60ee544c0..150325f48 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt @@ -171,20 +171,12 @@ fun BaseSimpleActivity.handleMediaManagementPrompt(callback: () -> Unit) { } fun AppCompatActivity.showSystemUI(toggleActionBarVisibility: Boolean) { - if (toggleActionBarVisibility) { - supportActionBar?.show() - } - window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN } fun AppCompatActivity.hideSystemUI(toggleActionBarVisibility: Boolean) { - if (toggleActionBarVisibility) { - supportActionBar?.hide() - } - window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt index 044127867..778a3bbbd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt @@ -45,9 +45,9 @@ import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.isRPlus +import com.simplemobiletools.commons.helpers.mydebug import com.simplemobiletools.gallery.pro.R -import com.simplemobiletools.gallery.pro.activities.PanoramaPhotoActivity -import com.simplemobiletools.gallery.pro.activities.PhotoActivity +import com.simplemobiletools.gallery.pro.activities.* import com.simplemobiletools.gallery.pro.adapters.PortraitPhotosAdapter import com.simplemobiletools.gallery.pro.extensions.config import com.simplemobiletools.gallery.pro.extensions.saveRotatedImageToFile @@ -709,7 +709,10 @@ class PhotoFragment : ViewPagerFragment() { doubleTapZoomScale = getDoubleTapZoomScale(useWidth, useHeight) mCurrentRotationDegrees = (mCurrentRotationDegrees + degrees) % 360 loadBitmap(false) - activity?.invalidateOptionsMenu() + + // ugly, but it works + (activity as? ViewPagerActivity)?.refreshMenuItems() + (activity as? PhotoVideoActivity)?.refreshMenuItems() } override fun onUpEvent() {