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 8660bd1c3..6d1bf290a 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
@@ -8,10 +8,8 @@ import android.net.Uri
import android.os.Bundle
import android.provider.MediaStore
import android.text.Html
-import android.view.Menu
-import android.view.MenuItem
import android.view.View
-import android.view.WindowInsetsController
+import android.widget.RelativeLayout
import com.simplemobiletools.commons.dialogs.PropertiesDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.*
@@ -38,6 +36,9 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
var mIsVideo = false
public override fun onCreate(savedInstanceState: Bundle?) {
+ showTransparentTop = true
+ showTransparentNavigation = true
+
if (config.isUsingSystemTheme) {
setTheme(R.style.AppTheme_Material)
}
@@ -48,6 +49,8 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
return
}
+ setupOptionsMenu()
+ refreshMenuItems()
handlePermission(PERMISSION_WRITE_STORAGE) {
if (it) {
checkIntent(savedInstanceState)
@@ -56,16 +59,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
finish()
}
}
-
- if (isRPlus()) {
- window.insetsController?.setSystemBarsAppearance(0, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS)
- }
}
override fun onResume() {
super.onResume()
- supportActionBar?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
- window.statusBarColor = Color.TRANSPARENT
if (config.bottomActions) {
window.navigationBarColor = Color.TRANSPARENT
@@ -78,37 +75,46 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
}
}
- override fun onCreateOptionsMenu(menu: Menu): Boolean {
- menuInflater.inflate(R.menu.photo_video_menu, menu)
+ private fun refreshMenuItems() {
val visibleBottomActions = if (config.bottomActions) config.visibleBottomActions else 0
- menu.apply {
+ fragment_viewer_toolbar.menu.apply {
findItem(R.id.menu_set_as).isVisible = mMedium?.isImage() == true && visibleBottomActions and BOTTOM_ACTION_SET_AS == 0
findItem(R.id.menu_edit).isVisible = mMedium?.isImage() == true && mUri?.scheme == "file" && visibleBottomActions and BOTTOM_ACTION_EDIT == 0
findItem(R.id.menu_properties).isVisible = mUri?.scheme == "file" && visibleBottomActions and BOTTOM_ACTION_PROPERTIES == 0
findItem(R.id.menu_share).isVisible = visibleBottomActions and BOTTOM_ACTION_SHARE == 0
findItem(R.id.menu_show_on_map).isVisible = visibleBottomActions and BOTTOM_ACTION_SHOW_ON_MAP == 0
}
-
- updateMenuItemColors(menu, forceWhiteIcons = true)
- return true
}
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
- if (mMedium == null || mUri == null) {
- return true
+ private fun setupOptionsMenu() {
+ (fragment_viewer_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight
+ fragment_viewer_toolbar.apply {
+ setTitleTextColor(Color.WHITE)
+ overflowIcon = resources.getColoredDrawableWithColor(R.drawable.ic_three_dots_vector, Color.WHITE)
+ navigationIcon = resources.getColoredDrawableWithColor(R.drawable.ic_arrow_left_vector, Color.WHITE)
}
- when (item.itemId) {
- R.id.menu_set_as -> setAs(mUri!!.toString())
- R.id.menu_open_with -> openPath(mUri!!.toString(), true)
- R.id.menu_share -> sharePath(mUri!!.toString())
- R.id.menu_edit -> openEditor(mUri!!.toString())
- R.id.menu_properties -> showProperties()
- R.id.menu_show_on_map -> showFileOnMap(mUri!!.toString())
- else -> return super.onOptionsItemSelected(item)
+ fragment_viewer_toolbar.setOnMenuItemClickListener { menuItem ->
+ if (mMedium == null || mUri == null) {
+ return@setOnMenuItemClickListener true
+ }
+
+ when (menuItem.itemId) {
+ R.id.menu_set_as -> setAs(mUri!!.toString())
+ R.id.menu_open_with -> openPath(mUri!!.toString(), true)
+ R.id.menu_share -> sharePath(mUri!!.toString())
+ R.id.menu_edit -> openEditor(mUri!!.toString())
+ R.id.menu_properties -> showProperties()
+ R.id.menu_show_on_map -> showFileOnMap(mUri!!.toString())
+ else -> return@setOnMenuItemClickListener false
+ }
+ return@setOnMenuItemClickListener true
+ }
+
+ fragment_viewer_toolbar.setNavigationOnClickListener {
+ finish()
}
- return true
}
private fun checkIntent(savedInstanceState: Bundle? = null) {
@@ -201,7 +207,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
mIsVideo = type == TYPE_VIDEOS
mMedium = Medium(null, filename, mUri.toString(), mUri!!.path!!.getParentPath(), 0, 0, file.length(), type, 0, false, 0L, 0)
- supportActionBar?.title = Html.fromHtml("${mMedium!!.name}")
+ fragment_viewer_toolbar.title = Html.fromHtml("${mMedium!!.name}")
bundle.putSerializable(MEDIUM, mMedium)
if (savedInstanceState == null) {
@@ -395,6 +401,12 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
if (!bottom_actions.isGone()) {
bottom_actions.animate().alpha(newAlpha).start()
}
+
+ fragment_viewer_toolbar.animate().alpha(newAlpha).withStartAction {
+ fragment_viewer_toolbar.beVisible()
+ }.withEndAction {
+ fragment_viewer_toolbar.beVisibleIf(newAlpha == 1f)
+ }.start()
}
override fun videoEnded() = false
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 7125c391b..32c73a356 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
@@ -143,7 +143,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
invalidateOptionsMenu()
val filename = getCurrentMedium()?.name ?: mPath.getFilenameFromPath()
- medium_viewer_toolbar?.title = filename
+ medium_viewer_toolbar.title = filename
}
override fun onPause() {
@@ -221,6 +221,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private fun setupOptionsMenu() {
(medium_viewer_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight
+ medium_viewer_toolbar.apply {
+ setTitleTextColor(Color.WHITE)
+ overflowIcon = resources.getColoredDrawableWithColor(R.drawable.ic_three_dots_vector, Color.WHITE)
+ navigationIcon = resources.getColoredDrawableWithColor(R.drawable.ic_arrow_left_vector, Color.WHITE)
+ }
+
medium_viewer_toolbar.setOnMenuItemClickListener { menuItem ->
if (getCurrentMedium() == null) {
return@setOnMenuItemClickListener true
diff --git a/app/src/main/res/layout/dialog_change_grouping.xml b/app/src/main/res/layout/dialog_change_grouping.xml
index 7faca3c29..2cb9731ef 100644
--- a/app/src/main/res/layout/dialog_change_grouping.xml
+++ b/app/src/main/res/layout/dialog_change_grouping.xml
@@ -23,64 +23,48 @@
android:id="@+id/grouping_dialog_radio_none"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingTop="@dimen/medium_margin"
- android:paddingBottom="@dimen/medium_margin"
android:text="@string/do_not_group_files" />
@@ -98,16 +82,12 @@
android:id="@+id/grouping_dialog_radio_ascending"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingTop="@dimen/medium_margin"
- android:paddingBottom="@dimen/medium_margin"
android:text="@string/ascending" />
diff --git a/app/src/main/res/layout/dialog_change_sorting.xml b/app/src/main/res/layout/dialog_change_sorting.xml
index d23537b83..7fe427d74 100644
--- a/app/src/main/res/layout/dialog_change_sorting.xml
+++ b/app/src/main/res/layout/dialog_change_sorting.xml
@@ -23,56 +23,42 @@
android:id="@+id/sorting_dialog_radio_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingTop="@dimen/medium_margin"
- android:paddingBottom="@dimen/medium_margin"
android:text="@string/name" />
@@ -92,16 +78,12 @@
android:id="@+id/sorting_dialog_radio_ascending"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingTop="@dimen/medium_margin"
- android:paddingBottom="@dimen/medium_margin"
android:text="@string/ascending" />
diff --git a/app/src/main/res/layout/dialog_change_view_type.xml b/app/src/main/res/layout/dialog_change_view_type.xml
index df69116a8..9e79f44d7 100644
--- a/app/src/main/res/layout/dialog_change_view_type.xml
+++ b/app/src/main/res/layout/dialog_change_view_type.xml
@@ -23,16 +23,12 @@
android:id="@+id/change_view_type_dialog_radio_grid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingTop="@dimen/medium_margin"
- android:paddingBottom="@dimen/medium_margin"
android:text="@string/grid" />
diff --git a/app/src/main/res/layout/fragment_holder.xml b/app/src/main/res/layout/fragment_holder.xml
index 6aea1be0a..505b0cbf7 100644
--- a/app/src/main/res/layout/fragment_holder.xml
+++ b/app/src/main/res/layout/fragment_holder.xml
@@ -1,5 +1,6 @@
@@ -21,4 +22,21 @@
layout="@layout/bottom_actions"
android:visibility="gone" />
+
+
+
+
+