handle bottom action button clicks

This commit is contained in:
tibbi 2018-06-17 16:08:57 +02:00
parent 38397a71dd
commit 1b008490a8
2 changed files with 9 additions and 5 deletions

View file

@ -275,6 +275,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
val currentMedium = getCurrentMedium() ?: return true
menu.apply {
findItem(R.id.menu_properties).isVisible = !config.bottomActions
findItem(R.id.menu_delete).isVisible = !config.bottomActions
findItem(R.id.menu_share).isVisible = !config.bottomActions
findItem(R.id.menu_edit).isVisible = !config.bottomActions
findItem(R.id.menu_rotate).isVisible = currentMedium.isImage()
findItem(R.id.menu_save_as).isVisible = mRotationDegrees != 0
findItem(R.id.menu_hide).isVisible = !currentMedium.name.startsWith('.')
@ -742,19 +746,19 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private fun initBottomActionButtons() {
bottom_properties.setOnClickListener {
showProperties()
}
bottom_edit.setOnClickListener {
openEditor(getCurrentPath())
}
bottom_share.setOnClickListener {
shareMedium(getCurrentMedium()!!)
}
bottom_delete.setOnClickListener {
checkDeleteConfirmation()
}
}

View file

@ -36,7 +36,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_rename"
android:src="@drawable/ic_edit"
app:layout_constraintEnd_toStartOf="@+id/bottom_share"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/bottom_properties"/>