adding a menu item at viewpager for resizing images

This commit is contained in:
tibbi 2019-12-12 11:07:34 +01:00
parent 943c4a0cb8
commit 7fda22e5d5
2 changed files with 10 additions and 0 deletions

View file

@ -172,6 +172,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
findItem(R.id.menu_move_to).isVisible = visibleBottomActions and BOTTOM_ACTION_MOVE == 0 findItem(R.id.menu_move_to).isVisible = visibleBottomActions and BOTTOM_ACTION_MOVE == 0
findItem(R.id.menu_save_as).isVisible = rotationDegrees != 0 findItem(R.id.menu_save_as).isVisible = rotationDegrees != 0
findItem(R.id.menu_print).isVisible = currentMedium.isImage() || currentMedium.isRaw() findItem(R.id.menu_print).isVisible = currentMedium.isImage() || currentMedium.isRaw()
findItem(R.id.menu_resize).isVisible = currentMedium.isImage()
findItem(R.id.menu_hide).isVisible = !currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0 && !currentMedium.getIsInRecycleBin() findItem(R.id.menu_hide).isVisible = !currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0 && !currentMedium.getIsInRecycleBin()
findItem(R.id.menu_unhide).isVisible = currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0 && !currentMedium.getIsInRecycleBin() findItem(R.id.menu_unhide).isVisible = currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0 && !currentMedium.getIsInRecycleBin()
findItem(R.id.menu_add_to_favorites).isVisible = !currentMedium.isFavorite && visibleBottomActions and BOTTOM_ACTION_TOGGLE_FAVORITE == 0 && !currentMedium.getIsInRecycleBin() findItem(R.id.menu_add_to_favorites).isVisible = !currentMedium.isFavorite && visibleBottomActions and BOTTOM_ACTION_TOGGLE_FAVORITE == 0 && !currentMedium.getIsInRecycleBin()
@ -226,6 +227,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
R.id.menu_default_orientation -> toggleOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) R.id.menu_default_orientation -> toggleOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
R.id.menu_save_as -> saveImageAs() R.id.menu_save_as -> saveImageAs()
R.id.menu_create_shortcut -> createShortcut() R.id.menu_create_shortcut -> createShortcut()
R.id.menu_resize -> resizeImage()
R.id.menu_settings -> launchSettings() R.id.menu_settings -> launchSettings()
else -> return super.onOptionsItemSelected(item) else -> return super.onOptionsItemSelected(item)
} }
@ -898,6 +900,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
} }
private fun resizeImage() {
}
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) { override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
if (requestCode == REQUEST_EDIT_IMAGE && resultCode == Activity.RESULT_OK && resultData != null) { if (requestCode == REQUEST_EDIT_IMAGE && resultCode == Activity.RESULT_OK && resultData != null) {
mPos = -1 mPos = -1

View file

@ -115,6 +115,10 @@
android:id="@+id/menu_print" android:id="@+id/menu_print"
android:title="@string/print" android:title="@string/print"
app:showAsAction="never"/> app:showAsAction="never"/>
<item
android:id="@+id/menu_resize"
android:title="@string/resize"
app:showAsAction="never"/>
<item <item
android:id="@+id/menu_show_on_map" android:id="@+id/menu_show_on_map"
android:title="@string/show_on_map" android:title="@string/show_on_map"