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 0df7a7f4e..dab05977d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -293,6 +293,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View findItem(R.id.menu_delete).isVisible = visibleBottomActions and BOTTOM_ACTION_DELETE == 0 findItem(R.id.menu_share).isVisible = visibleBottomActions and BOTTOM_ACTION_SHARE == 0 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_save_as).isVisible = mRotationDegrees != 0 findItem(R.id.menu_hide).isVisible = !currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0 @@ -852,6 +853,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } } + + bottom_rename.beVisibleIf(visibleBottomActions and BOTTOM_ACTION_RENAME != 0) + bottom_rename.setOnClickListener { + if (bottom_actions.alpha == 1f) { + renameFile() + } + } } 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 d21801eba..3236ad750 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ManageBottomActionsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ManageBottomActionsDialog.kt @@ -24,6 +24,7 @@ class ManageBottomActionsDialog(val activity: BaseSimpleActivity, val callback: manage_bottom_actions_slideshow.isChecked = actions and BOTTOM_ACTION_PROPERTIES != 0 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 } AlertDialog.Builder(activity) @@ -57,6 +58,8 @@ class ManageBottomActionsDialog(val activity: BaseSimpleActivity, val callback: result += BOTTOM_ACTION_SHOW_ON_MAP if (manage_bottom_actions_toggle_visibility.isChecked) result += BOTTOM_ACTION_TOGGLE_VISIBILITY + if (manage_bottom_actions_rename.isChecked) + result += BOTTOM_ACTION_RENAME } 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 f6007bacb..fc723b757 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -146,5 +146,6 @@ const val BOTTOM_ACTION_LOCK_ORIENTATION = 64 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 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/layout/bottom_actions.xml b/app/src/main/res/layout/bottom_actions.xml index 4e433e8a2..0e69d8aeb 100644 --- a/app/src/main/res/layout/bottom_actions.xml +++ b/app/src/main/res/layout/bottom_actions.xml @@ -115,8 +115,19 @@ android:layout_height="wrap_content" android:padding="@dimen/medium_margin" android:src="@drawable/ic_hide" - app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintEnd_toStartOf="@+id/bottom_rename" app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toEndOf="@+id/bottom_show_on_map"/> + + 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 162ab0907..451250814 100644 --- a/app/src/main/res/layout/dialog_manage_bottom_actions.xml +++ b/app/src/main/res/layout/dialog_manage_bottom_actions.xml @@ -94,5 +94,13 @@ android:paddingTop="@dimen/activity_margin" android:text="@string/toggle_file_visibility"/> + +