diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt
index 10c636fea..a3657295d 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt
@@ -48,8 +48,6 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
finish()
}
}
-
- initBottomActions()
}
override fun onResume() {
@@ -88,14 +86,15 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
showSystemUI(true)
val bundle = Bundle()
val file = File(mUri.toString())
+ val filename = getFilenameFromUri(mUri!!)
val type = when {
- file.isImageFast() -> TYPE_IMAGES
- file.isVideoFast() -> TYPE_VIDEOS
- file.isGif() -> TYPE_GIFS
+ filename.isImageFast() -> TYPE_IMAGES
+ filename.isVideoFast() -> TYPE_VIDEOS
+ filename.isGif() -> TYPE_GIFS
else -> TYPE_RAWS
}
- mMedium = Medium(null, getFilenameFromUri(mUri!!), mUri.toString(), mUri!!.path.getParentPath(), 0, 0, file.length(), type, false, 0L)
+ mMedium = Medium(null, filename, mUri.toString(), mUri!!.path.getParentPath(), 0, 0, file.length(), type, false, 0L)
supportActionBar?.title = mMedium!!.name
bundle.putSerializable(MEDIUM, mMedium)
@@ -114,6 +113,8 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
val isFullscreen = visibility and View.SYSTEM_UI_FLAG_FULLSCREEN != 0
mFragment?.fullscreenToggled(isFullscreen)
}
+
+ initBottomActions()
}
override fun onConfigurationChanged(newConfig: Configuration?) {
@@ -132,12 +133,13 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.photo_video_menu, menu)
+ val visibleBottomActions = if (config.bottomActions) config.visibleBottomActions else 0
menu.apply {
- findItem(R.id.menu_set_as).isVisible = mMedium?.isImage() == true
- findItem(R.id.menu_edit).isVisible = mMedium?.isImage() == true && mUri?.scheme == "file" && !config.bottomActions
- findItem(R.id.menu_properties).isVisible = mUri?.scheme == "file"
- findItem(R.id.menu_share).isVisible = !config.bottomActions
+ 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
}
return true
@@ -183,7 +185,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
}
val visibleBottomActions = if (config.bottomActions) config.visibleBottomActions else 0
- bottom_edit.beVisibleIf(visibleBottomActions and BOTTOM_ACTION_EDIT != 0)
+ bottom_edit.beVisibleIf(visibleBottomActions and BOTTOM_ACTION_EDIT != 0 && mMedium?.isImage() == true)
bottom_edit.setOnClickListener {
if (mUri != null && bottom_actions.alpha == 1f) {
openEditor(mUri!!.toString())
@@ -196,6 +198,11 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
sharePath(mUri!!.toString())
}
}
+
+ bottom_set_as.beVisibleIf(visibleBottomActions and BOTTOM_ACTION_SET_AS != 0 && mMedium?.isImage() == true)
+ bottom_set_as.setOnClickListener {
+ setAs(mUri!!.toString())
+ }
}
override fun fragmentClicked() {
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt
index 084ddc475..5a88de033 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt
@@ -296,6 +296,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
findItem(R.id.menu_edit).isVisible = visibleBottomActions and BOTTOM_ACTION_EDIT == 0
findItem(R.id.menu_rename).isVisible = visibleBottomActions and BOTTOM_ACTION_RENAME == 0
findItem(R.id.menu_rotate).isVisible = currentMedium.isImage() && visibleBottomActions and BOTTOM_ACTION_ROTATE == 0
+ findItem(R.id.menu_set_as).isVisible = visibleBottomActions and BOTTOM_ACTION_SET_AS == 0
findItem(R.id.menu_save_as).isVisible = mRotationDegrees != 0
findItem(R.id.menu_hide).isVisible = !currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0
findItem(R.id.menu_unhide).isVisible = currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0
@@ -842,6 +843,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
bottom_rename.setOnClickListener {
renameFile()
}
+
+ bottom_set_as.beVisibleIf(visibleBottomActions and BOTTOM_ACTION_SET_AS != 0)
+ bottom_set_as.setOnClickListener {
+ setAs(getCurrentPath())
+ }
}
private fun updateBottomActionIcons(medium: Medium?) {
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ManageBottomActionsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ManageBottomActionsDialog.kt
index a9ef79936..920c3c404 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ManageBottomActionsDialog.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ManageBottomActionsDialog.kt
@@ -25,6 +25,7 @@ class ManageBottomActionsDialog(val activity: BaseSimpleActivity, val callback:
manage_bottom_actions_show_on_map.isChecked = actions and BOTTOM_ACTION_SHOW_ON_MAP != 0
manage_bottom_actions_toggle_visibility.isChecked = actions and BOTTOM_ACTION_TOGGLE_VISIBILITY != 0
manage_bottom_actions_rename.isChecked = actions and BOTTOM_ACTION_RENAME != 0
+ manage_bottom_actions_set_as.isChecked = actions and BOTTOM_ACTION_SET_AS != 0
}
AlertDialog.Builder(activity)
@@ -60,6 +61,8 @@ class ManageBottomActionsDialog(val activity: BaseSimpleActivity, val callback:
result += BOTTOM_ACTION_TOGGLE_VISIBILITY
if (manage_bottom_actions_rename.isChecked)
result += BOTTOM_ACTION_RENAME
+ if (manage_bottom_actions_set_as.isChecked)
+ result += BOTTOM_ACTION_SET_AS
}
activity.config.visibleBottomActions = result
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt
index a33adcec3..53e17f4f2 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt
@@ -144,5 +144,6 @@ const val BOTTOM_ACTION_SLIDESHOW = 128
const val BOTTOM_ACTION_SHOW_ON_MAP = 256
const val BOTTOM_ACTION_TOGGLE_VISIBILITY = 512
const val BOTTOM_ACTION_RENAME = 1024
+const val BOTTOM_ACTION_SET_AS = 2048
const val DEFAULT_BOTTOM_ACTIONS = BOTTOM_ACTION_TOGGLE_FAVORITE or BOTTOM_ACTION_EDIT or BOTTOM_ACTION_SHARE or BOTTOM_ACTION_DELETE
diff --git a/app/src/main/res/drawable-hdpi/ic_set_as.png b/app/src/main/res/drawable-hdpi/ic_set_as.png
new file mode 100644
index 000000000..d4de4c2b5
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_set_as.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_set_as.png b/app/src/main/res/drawable-xhdpi/ic_set_as.png
new file mode 100644
index 000000000..728313d9e
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_set_as.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_set_as.png b/app/src/main/res/drawable-xxhdpi/ic_set_as.png
new file mode 100644
index 000000000..60f34eb20
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_set_as.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_set_as.png b/app/src/main/res/drawable-xxxhdpi/ic_set_as.png
new file mode 100644
index 000000000..303e1780f
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_set_as.png differ
diff --git a/app/src/main/res/layout/bottom_actions.xml b/app/src/main/res/layout/bottom_actions.xml
index b2c1e79bd..c3329af25 100644
--- a/app/src/main/res/layout/bottom_actions.xml
+++ b/app/src/main/res/layout/bottom_actions.xml
@@ -126,8 +126,19 @@
android:layout_height="wrap_content"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_rename_new"
- app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintEnd_toEndOf="@+id/bottom_set_as"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/bottom_toggle_file_visibility"/>
+
+
diff --git a/app/src/main/res/layout/dialog_manage_bottom_actions.xml b/app/src/main/res/layout/dialog_manage_bottom_actions.xml
index 0e4bd1dcf..6e58322e4 100644
--- a/app/src/main/res/layout/dialog_manage_bottom_actions.xml
+++ b/app/src/main/res/layout/dialog_manage_bottom_actions.xml
@@ -102,5 +102,13 @@
android:paddingTop="@dimen/activity_margin"
android:text="@string/rename"/>
+
+
diff --git a/app/src/main/res/menu/menu_viewpager.xml b/app/src/main/res/menu/menu_viewpager.xml
index 85cd15500..282910e8a 100644
--- a/app/src/main/res/menu/menu_viewpager.xml
+++ b/app/src/main/res/menu/menu_viewpager.xml
@@ -73,10 +73,6 @@
android:id="@+id/menu_move_to"
android:title="@string/move_to"
app:showAsAction="never"/>
-
+
+ app:showAsAction="ifRoom"/>