mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 13:08:00 +01:00
add an Open With menu button to media thumbnails view
This commit is contained in:
parent
fa2a237593
commit
8e8c0b127d
2 changed files with 7 additions and 1 deletions
|
@ -87,6 +87,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
||||||
R.id.cab_copy_to -> copyMoveTo(true)
|
R.id.cab_copy_to -> copyMoveTo(true)
|
||||||
R.id.cab_move_to -> copyMoveTo(false)
|
R.id.cab_move_to -> copyMoveTo(false)
|
||||||
R.id.cab_select_all -> selectAll()
|
R.id.cab_select_all -> selectAll()
|
||||||
|
R.id.cab_open_with -> activity.openFile(Uri.fromFile(getCurrentFile()))
|
||||||
R.id.cab_delete -> checkDeleteConfirmation()
|
R.id.cab_delete -> checkDeleteConfirmation()
|
||||||
else -> return false
|
else -> return false
|
||||||
}
|
}
|
||||||
|
@ -101,7 +102,8 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPrepareActionMode(actionMode: ActionMode?, menu: Menu): Boolean {
|
override fun onPrepareActionMode(actionMode: ActionMode?, menu: Menu): Boolean {
|
||||||
menu.findItem(R.id.cab_rename).isVisible = selectedPositions.size <= 1
|
menu.findItem(R.id.cab_rename).isVisible = selectedPositions.size == 1
|
||||||
|
menu.findItem(R.id.cab_open_with).isVisible = selectedPositions.size == 1
|
||||||
menu.findItem(R.id.cab_edit).isVisible = selectedPositions.size == 1 && media.size > selectedPositions.first() && media[selectedPositions.first()].isImage()
|
menu.findItem(R.id.cab_edit).isVisible = selectedPositions.size == 1 && media.size > selectedPositions.first() && media[selectedPositions.first()].isImage()
|
||||||
menu.findItem(R.id.cab_confirm_selection).isVisible = isPickIntent && allowMultiplePicks && selectedPositions.size > 0
|
menu.findItem(R.id.cab_confirm_selection).isVisible = isPickIntent && allowMultiplePicks && selectedPositions.size > 0
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,10 @@
|
||||||
android:icon="@drawable/ic_select_all"
|
android:icon="@drawable/ic_select_all"
|
||||||
android:title="@string/select_all"
|
android:title="@string/select_all"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/cab_open_with"
|
||||||
|
android:title="@string/open_with"
|
||||||
|
app:showAsAction="never"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/cab_copy_to"
|
android:id="@+id/cab_copy_to"
|
||||||
android:title="@string/copy_to"
|
android:title="@string/copy_to"
|
||||||
|
|
Loading…
Reference in a new issue