add batch image rotation at the thumbnails screen

This commit is contained in:
tibbi 2019-01-13 22:12:16 +01:00
parent f8d39f61af
commit 040d6357c9
2 changed files with 31 additions and 0 deletions

View File

@ -137,6 +137,9 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
R.id.cab_remove_from_favorites -> toggleFavorites(false)
R.id.cab_restore_recycle_bin_files -> restoreFiles()
R.id.cab_share -> shareMedia()
R.id.cab_rotate_right -> rotateSelection(90)
R.id.cab_rotate_left -> rotateSelection(270)
R.id.cab_rotate_one_eighty -> rotateSelection(180)
R.id.cab_copy_to -> copyMoveTo(true)
R.id.cab_move_to -> moveFilesTo()
R.id.cab_select_all -> selectAll()
@ -273,6 +276,17 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
}
}
private fun rotateSelection(degrees: Int) {
Thread {
val paths = getSelectedPaths()
paths.forEach {
activity.saveRotatedImageToFile(it, it, degrees) {
}
}
}.start()
}
private fun moveFilesTo() {
activity.handleDeletePasswordProtection {
copyMoveTo(false)

View File

@ -16,6 +16,23 @@
android:icon="@drawable/ic_share"
android:title="@string/share"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/cab_rotate"
android:icon="@drawable/ic_rotate_right"
android:title="@string/rotate"
app:showAsAction="ifRoom">
<menu>
<item
android:id="@+id/cab_rotate_right"
android:title="@string/rotate_right"/>
<item
android:id="@+id/cab_rotate_left"
android:title="@string/rotate_left"/>
<item
android:id="@+id/cab_rotate_one_eighty"
android:title="@string/rotate_one_eighty"/>
</menu>
</item>
<item
android:id="@+id/cab_properties"
android:icon="@drawable/ic_info"