removing some old support action bar references

This commit is contained in:
tibbi 2022-07-28 13:41:55 +02:00
parent f246bca4b8
commit f896fc885a
8 changed files with 11 additions and 20 deletions

View file

@ -106,7 +106,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
storeStateVariables()
if (mShowAll) {
supportActionBar?.setDisplayHomeAsUpEnabled(false)
registerFileUpdateListener()
}

View file

@ -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()

View file

@ -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()

View file

@ -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 {

View file

@ -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) {

View file

@ -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

View file

@ -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

View file

@ -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() {