add fullscreen actionbar menu items for rotating images

This commit is contained in:
tibbi 2017-02-12 23:38:22 +01:00
parent 86a2868386
commit e951b85570
15 changed files with 108 additions and 3 deletions

View file

@ -92,10 +92,21 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.viewpager_menu, menu) menuInflater.inflate(R.menu.menu_viewpager, menu)
menu.findItem(R.id.menu_set_as_wallpaper).isVisible = getCurrentMedium()?.isImage() == true menu.apply {
menu.findItem(R.id.menu_edit).isVisible = getCurrentMedium()?.isImage() == true if (getCurrentMedium()?.isImage() == true) {
findItem(R.id.menu_set_as_wallpaper).isVisible = getCurrentMedium()?.isImage() == true
findItem(R.id.menu_edit).isVisible = getCurrentMedium()?.isImage() == true
findItem(R.id.menu_rotate).subMenu.apply {
clearHeader()
findItem(R.id.rotate_right).icon = resources.getColoredDrawable(R.drawable.ic_rotate_right, R.color.actionbar_menu_icon)
findItem(R.id.rotate_left).icon = resources.getColoredDrawable(R.drawable.ic_rotate_left, R.color.actionbar_menu_icon)
findItem(R.id.rotate_one_eighty).icon = resources.getColoredDrawable(R.drawable.ic_rotate_one_eighty, R.color.actionbar_menu_icon)
}
}
}
return true return true
} }
@ -114,6 +125,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
R.id.menu_edit -> openEditor(getCurrentFile()) R.id.menu_edit -> openEditor(getCurrentFile())
R.id.menu_properties -> showProperties() R.id.menu_properties -> showProperties()
R.id.show_on_map -> showOnMap() R.id.show_on_map -> showOnMap()
R.id.rotate_right -> {}
R.id.rotate_left -> {}
R.id.rotate_one_eighty -> {}
else -> return super.onOptionsItemSelected(item) else -> return super.onOptionsItemSelected(item)
} }
return true return true

View file

@ -23,6 +23,23 @@
android:icon="@drawable/ic_share" android:icon="@drawable/ic_share"
android:title="@string/share" android:title="@string/share"
app:showAsAction="ifRoom"/> app:showAsAction="ifRoom"/>
<item
android:id="@+id/menu_rotate"
android:icon="@drawable/ic_rotate_right"
android:title="@string/rotate"
app:showAsAction="ifRoom">
<menu>
<item
android:id="@+id/rotate_right"
android:title="@string/rotate_right"/>
<item
android:id="@+id/rotate_left"
android:title="@string/rotate_left"/>
<item
android:id="@+id/rotate_one_eighty"
android:title="@string/rotate_one_eighty"/>
</menu>
</item>
<item <item
android:id="@+id/menu_edit" android:id="@+id/menu_edit"
android:icon="@drawable/ic_edit" android:icon="@drawable/ic_edit"

View file

@ -60,6 +60,12 @@
<string name="no_editor_found">Kein Bildeditor gefunden</string> <string name="no_editor_found">Kein Bildeditor gefunden</string>
<string name="unknown_file_location">Unbekannter Dateiort</string> <string name="unknown_file_location">Unbekannter Dateiort</string>
<string name="error_saving_file">Konnte Quelldatei nicht überschreiben</string> <string name="error_saving_file">Konnte Quelldatei nicht überschreiben</string>
<string name="rotate_left">Rotate left</string>
<string name="rotate_right">Rotate right</string>
<string name="rotate_one_eighty">Rotate by 180º</string>
<string name="flip">Flip</string>
<string name="horizontally">Horizontally</string>
<string name="vertically">Vertically</string>
<!-- Set wallpaper --> <!-- Set wallpaper -->
<string name="simple_wallpaper">Simple Wallpaper</string> <string name="simple_wallpaper">Simple Wallpaper</string>

View file

@ -60,6 +60,12 @@
<string name="no_editor_found">No image editor found</string> <string name="no_editor_found">No image editor found</string>
<string name="unknown_file_location">Unknown file location</string> <string name="unknown_file_location">Unknown file location</string>
<string name="error_saving_file">Could not overwrite the source file</string> <string name="error_saving_file">Could not overwrite the source file</string>
<string name="rotate_left">Rotate left</string>
<string name="rotate_right">Rotate right</string>
<string name="rotate_one_eighty">Rotate by 180º</string>
<string name="flip">Flip</string>
<string name="horizontally">Horizontally</string>
<string name="vertically">Vertically</string>
<!-- Set wallpaper --> <!-- Set wallpaper -->
<string name="simple_wallpaper">Simple Wallpaper</string> <string name="simple_wallpaper">Simple Wallpaper</string>

View file

@ -60,6 +60,12 @@
<string name="no_editor_found">Aucun éditeur d\'image trouvé</string> <string name="no_editor_found">Aucun éditeur d\'image trouvé</string>
<string name="unknown_file_location">Emplacement du fichier inconnu.</string> <string name="unknown_file_location">Emplacement du fichier inconnu.</string>
<string name="error_saving_file">Ne parvient pas à réécrire par dessus le fichier source</string> <string name="error_saving_file">Ne parvient pas à réécrire par dessus le fichier source</string>
<string name="rotate_left">Rotate left</string>
<string name="rotate_right">Rotate right</string>
<string name="rotate_one_eighty">Rotate by 180º</string>
<string name="flip">Flip</string>
<string name="horizontally">Horizontally</string>
<string name="vertically">Vertically</string>
<!-- Set wallpaper --> <!-- Set wallpaper -->
<string name="simple_wallpaper">Simple fond d\'écran</string> <string name="simple_wallpaper">Simple fond d\'écran</string>

View file

@ -60,6 +60,12 @@
<string name="no_editor_found">Editor immagine non trovato</string> <string name="no_editor_found">Editor immagine non trovato</string>
<string name="unknown_file_location">Posizione file sconosciuta</string> <string name="unknown_file_location">Posizione file sconosciuta</string>
<string name="error_saving_file">Impossibile sovrascrivere il file sorgente</string> <string name="error_saving_file">Impossibile sovrascrivere il file sorgente</string>
<string name="rotate_left">Rotate left</string>
<string name="rotate_right">Rotate right</string>
<string name="rotate_one_eighty">Rotate by 180º</string>
<string name="flip">Flip</string>
<string name="horizontally">Horizontally</string>
<string name="vertically">Vertically</string>
<!-- Set wallpaper --> <!-- Set wallpaper -->
<string name="simple_wallpaper">Sfondo Semplice</string> <string name="simple_wallpaper">Sfondo Semplice</string>

View file

@ -60,6 +60,12 @@
<string name="no_editor_found">画像エディターが見つかりません</string> <string name="no_editor_found">画像エディターが見つかりません</string>
<string name="unknown_file_location">ファイルの場所が不明です</string> <string name="unknown_file_location">ファイルの場所が不明です</string>
<string name="error_saving_file">元のファイルを上書きできません</string> <string name="error_saving_file">元のファイルを上書きできません</string>
<string name="rotate_left">Rotate left</string>
<string name="rotate_right">Rotate right</string>
<string name="rotate_one_eighty">Rotate by 180º</string>
<string name="flip">Flip</string>
<string name="horizontally">Horizontally</string>
<string name="vertically">Vertically</string>
<!-- Set wallpaper --> <!-- Set wallpaper -->
<string name="simple_wallpaper">シンプル壁紙</string> <string name="simple_wallpaper">シンプル壁紙</string>

View file

@ -60,6 +60,12 @@
<string name="no_editor_found">Editor não encontrado</string> <string name="no_editor_found">Editor não encontrado</string>
<string name="unknown_file_location">Localização desconhecida</string> <string name="unknown_file_location">Localização desconhecida</string>
<string name="error_saving_file">Não foi possível substituir o ficheiro original</string> <string name="error_saving_file">Não foi possível substituir o ficheiro original</string>
<string name="rotate_left">Rotate left</string>
<string name="rotate_right">Rotate right</string>
<string name="rotate_one_eighty">Rotate by 180º</string>
<string name="flip">Flip</string>
<string name="horizontally">Horizontally</string>
<string name="vertically">Vertically</string>
<!-- Set wallpaper --> <!-- Set wallpaper -->
<string name="simple_wallpaper">Simple Wallpaper</string> <string name="simple_wallpaper">Simple Wallpaper</string>

View file

@ -60,6 +60,12 @@
<string name="no_editor_found">Ни одного редактора изображений не найдено</string> <string name="no_editor_found">Ни одного редактора изображений не найдено</string>
<string name="unknown_file_location">Неизвестное местоположение файла</string> <string name="unknown_file_location">Неизвестное местоположение файла</string>
<string name="error_saving_file">Не удалось перезаписать исходный файл</string> <string name="error_saving_file">Не удалось перезаписать исходный файл</string>
<string name="rotate_left">Rotate left</string>
<string name="rotate_right">Rotate right</string>
<string name="rotate_one_eighty">Rotate by 180º</string>
<string name="flip">Flip</string>
<string name="horizontally">Horizontally</string>
<string name="vertically">Vertically</string>
<!-- Set wallpaper --> <!-- Set wallpaper -->
<string name="simple_wallpaper">Простые обои</string> <string name="simple_wallpaper">Простые обои</string>

View file

@ -60,6 +60,12 @@
<string name="no_editor_found">Nebol nájdený žiadny editor</string> <string name="no_editor_found">Nebol nájdený žiadny editor</string>
<string name="unknown_file_location">Neznáme umiestnenie súboru</string> <string name="unknown_file_location">Neznáme umiestnenie súboru</string>
<string name="error_saving_file">Nepodarilo sa prepísať zdrojový súbor</string> <string name="error_saving_file">Nepodarilo sa prepísať zdrojový súbor</string>
<string name="rotate_left">Otočiť vľavo</string>
<string name="rotate_right">Otočiť vpravo</string>
<string name="rotate_one_eighty">Otočiť o 180º</string>
<string name="flip">Preklopiť</string>
<string name="horizontally">Vodorovne</string>
<string name="vertically">Zvisle</string>
<!-- Set wallpaper --> <!-- Set wallpaper -->
<string name="simple_wallpaper">Jednoduchá tapeta</string> <string name="simple_wallpaper">Jednoduchá tapeta</string>

View file

@ -60,6 +60,12 @@
<string name="no_editor_found">Hittade ingen bildredigerare</string> <string name="no_editor_found">Hittade ingen bildredigerare</string>
<string name="unknown_file_location">Okänd filplats</string> <string name="unknown_file_location">Okänd filplats</string>
<string name="error_saving_file">Det gick inte att skriva över källfilen</string> <string name="error_saving_file">Det gick inte att skriva över källfilen</string>
<string name="rotate_left">Rotate left</string>
<string name="rotate_right">Rotate right</string>
<string name="rotate_one_eighty">Rotate by 180º</string>
<string name="flip">Flip</string>
<string name="horizontally">Horizontally</string>
<string name="vertically">Vertically</string>
<!-- Set wallpaper --> <!-- Set wallpaper -->
<string name="simple_wallpaper">Bakgrundsbild</string> <string name="simple_wallpaper">Bakgrundsbild</string>

View file

@ -60,6 +60,12 @@
<string name="no_editor_found">没有可用的图片编辑器</string> <string name="no_editor_found">没有可用的图片编辑器</string>
<string name="unknown_file_location">未知文件路径</string> <string name="unknown_file_location">未知文件路径</string>
<string name="error_saving_file">不能覆盖源文件</string> <string name="error_saving_file">不能覆盖源文件</string>
<string name="rotate_left">Rotate left</string>
<string name="rotate_right">Rotate right</string>
<string name="rotate_one_eighty">Rotate by 180º</string>
<string name="flip">Flip</string>
<string name="horizontally">Horizontally</string>
<string name="vertically">Vertically</string>
<!-- Set wallpaper --> <!-- Set wallpaper -->
<string name="simple_wallpaper">Simple Wallpaper</string> <string name="simple_wallpaper">Simple Wallpaper</string>

View file

@ -60,6 +60,12 @@
<string name="no_editor_found">沒有可用的圖檔編輯器</string> <string name="no_editor_found">沒有可用的圖檔編輯器</string>
<string name="unknown_file_location">未知檔案路徑</string> <string name="unknown_file_location">未知檔案路徑</string>
<string name="error_saving_file">不能覆蓋源檔案</string> <string name="error_saving_file">不能覆蓋源檔案</string>
<string name="rotate_left">Rotate left</string>
<string name="rotate_right">Rotate right</string>
<string name="rotate_one_eighty">Rotate by 180º</string>
<string name="flip">Flip</string>
<string name="horizontally">Horizontally</string>
<string name="vertically">Vertically</string>
<!-- Set wallpaper --> <!-- Set wallpaper -->
<string name="simple_wallpaper">簡易桌布</string> <string name="simple_wallpaper">簡易桌布</string>

View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="actionbar_menu_icon">#454545</color>
<!-- Default colors --> <!-- Default colors -->
<color name="default_text_color">@color/default_text_color_dark_theme</color> <color name="default_text_color">@color/default_text_color_dark_theme</color>
<color name="default_background_color">@color/default_background_color_dark_theme</color> <color name="default_background_color">@color/default_background_color_dark_theme</color>

View file

@ -60,6 +60,12 @@
<string name="no_editor_found">No image editor found</string> <string name="no_editor_found">No image editor found</string>
<string name="unknown_file_location">Unknown file location</string> <string name="unknown_file_location">Unknown file location</string>
<string name="error_saving_file">Could not overwrite the source file</string> <string name="error_saving_file">Could not overwrite the source file</string>
<string name="rotate_left">Rotate left</string>
<string name="rotate_right">Rotate right</string>
<string name="rotate_one_eighty">Rotate by 180º</string>
<string name="flip">Flip</string>
<string name="horizontally">Horizontally</string>
<string name="vertically">Vertically</string>
<!-- Set wallpaper --> <!-- Set wallpaper -->
<string name="simple_wallpaper">Simple Wallpaper</string> <string name="simple_wallpaper">Simple Wallpaper</string>