add Rename to available bottom actions
This commit is contained in:
parent
91e2638c21
commit
ee1ec98df9
5 changed files with 32 additions and 1 deletions
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_rename"
|
||||
style="@style/MyBorderlessBackgroundStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/medium_margin"
|
||||
android:src="@drawable/ic_rename_new"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/bottom_toggle_file_visibility"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
|
|
@ -94,5 +94,13 @@
|
|||
android:paddingTop="@dimen/activity_margin"
|
||||
android:text="@string/toggle_file_visibility"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
||||
android:id="@+id/manage_bottom_actions_rename"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:text="@string/rename"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
Loading…
Reference in a new issue