diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SetWallpaperActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SetWallpaperActivity.kt index 869f51fdf..ac06244b5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SetWallpaperActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SetWallpaperActivity.kt @@ -16,6 +16,7 @@ import kotlinx.android.synthetic.main.view_crop_image.* class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener { private val PICK_IMAGE = 1 + private var isLandscapeRatio = true lateinit var uri: Uri lateinit var wallpaperManager: WallpaperManager @@ -47,13 +48,22 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete crop_image_view.apply { guidelines = CropImageView.Guidelines.OFF setOnCropImageCompleteListener(this@SetWallpaperActivity) - setImageUriAsync(intent.data) - setAspectRatio(wallpaperManager.desiredMinimumWidth, wallpaperManager.desiredMinimumHeight) + setImageUriAsync(uri) } + + setupAspectRatio() } - override fun onCreateOptionsMenu(menu: Menu?): Boolean { + private fun setupAspectRatio() { + val wallpaperWidth = if (isLandscapeRatio) wallpaperManager.desiredMinimumWidth else wallpaperManager.desiredMinimumWidth / 2 + crop_image_view.setAspectRatio(wallpaperWidth, wallpaperManager.desiredMinimumHeight) + } + + override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_set_wallpaper, menu) + + menu.findItem(R.id.portrait_aspect_ratio).isVisible = isLandscapeRatio + menu.findItem(R.id.landscape_aspect_ratio).isVisible = !isLandscapeRatio return true } @@ -61,11 +71,19 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete when (item.itemId) { R.id.save -> crop_image_view.getCroppedImageAsync() R.id.rotate -> crop_image_view.rotateImage(90) + R.id.portrait_aspect_ratio -> changeAspectRatio(false) + R.id.landscape_aspect_ratio -> changeAspectRatio(true) else -> return super.onOptionsItemSelected(item) } return true } + private fun changeAspectRatio(isLandscape: Boolean) { + isLandscapeRatio = isLandscape + setupAspectRatio() + invalidateOptionsMenu() + } + override fun onCropImageComplete(view: CropImageView?, result: CropImageView.CropResult) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && isDestroyed) return diff --git a/app/src/main/res/menu/menu_set_wallpaper.xml b/app/src/main/res/menu/menu_set_wallpaper.xml index 7a0fdb9f7..59328d99d 100644 --- a/app/src/main/res/menu/menu_set_wallpaper.xml +++ b/app/src/main/res/menu/menu_set_wallpaper.xml @@ -1,14 +1,24 @@ - + + + diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 35a525ab5..8d7fd29fa 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -75,6 +75,8 @@ Nebyla nalezena žádná vhodná aplikace Nastavuje se tapeta… Tapeta byla úspěšně změněna + Portrait aspect ratio + Landscape aspect ratio Zobrazit skryté složky diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 0559dc67f..597cbf618 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -75,6 +75,8 @@ Keine passende App gefunden Setze Hintergrundbild… Hintergrundbild erfolgreich festgelegt + Portrait aspect ratio + Landscape aspect ratio Zeige versteckte Ordner diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 2efabfb20..abc63effe 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -75,6 +75,8 @@ No se encontró aplicación para ello Estableciendo fondo de pantalla… Fondo de pantalla establecido correctamente + Portrait aspect ratio + Landscape aspect ratio Mostrar carpetas ocultas diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 35f365460..beea73ea6 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -75,6 +75,8 @@ Aucune application trouvée pour continuer cette action Paramètre de fond d\'écran… Fond d\'écran défini avec succès. + Portrait aspect ratio + Landscape aspect ratio Afficher les dossiers cachés diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 0093fbf85..8c1a50d96 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -75,6 +75,8 @@ No app capable of it has been found Setting wallpaper… Wallpaper set successfully + Portrait aspect ratio + Landscape aspect ratio Show hidden folders diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index bc2a896fb..ebb747853 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -75,6 +75,8 @@ Non sono disponibili app compatibili Impostazione sfondo… Sfondo impostato correttamente + Portrait aspect ratio + Landscape aspect ratio Mostra cartelle nascoste diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 85c13edbf..50b8a1a30 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -75,6 +75,8 @@ 対応できるアプリが見つかりません 壁紙の設定… 壁紙を正常に設定しました + Portrait aspect ratio + Landscape aspect ratio 非表示フォルダーを表示 diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 7c12f1a3f..24063aa8c 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -75,6 +75,8 @@ Brak odpowiednich ustawień Ustawianie tapety… Tapeta ustawiona + Portrait aspect ratio + Landscape aspect ratio Pokaż ukryte foldery diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 23e60d6ce..04e030e96 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -75,6 +75,8 @@ Aplicativo não encontrado A definir como fundo de tela; Fundo de tela definido com sucesso + Portrait aspect ratio + Landscape aspect ratio Mostrar pastas ocultas diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index b2b47bd44..f5337e34d 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -75,6 +75,8 @@ Aplicação não encontrada A definir como fundo de ecrã… Fundo definido com sucesso + Portrait aspect ratio + Landscape aspect ratio Mostrar pastas ocultas diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 639298914..85182d9c5 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -75,6 +75,8 @@ Приложение не найдено Установка обоев… Обои успешно установлены + Portrait aspect ratio + Landscape aspect ratio Показать скрытые папки diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index cdae6c973..d52157746 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -75,6 +75,8 @@ Nenašla sa žiadna vhodná aplikácia No app capable of it has been found Nastavuje sa tapeta… Tapeta bola úspešne zmenená + Orientácia nastojato + Orientácia naležato Zobraziť skryté priečinky diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 6a92f31d7..52522cd90 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -75,6 +75,8 @@ Hittade ingen app som klarar av detta Inställningar för bakgrundsbild… Bakgrundsbilden är ändrad + Portrait aspect ratio + Landscape aspect ratio Visa dolda mappar diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 161ddab7b..c720f6251 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -75,6 +75,8 @@ Mümkün olan herhangi bir uygulama bulunamadı Duvar kağıdını ayarlama… Duvar kağıdı başarıyla ayarlandı + Portrait aspect ratio + Landscape aspect ratio Gizli klasörleri göster diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 37e53ac54..a53ade54a 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -75,6 +75,8 @@ 没有可用的软件 壁纸应用中… 壁纸应用成功 + Portrait aspect ratio + Landscape aspect ratio 显示所有 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index d550429b6..a7d62c528 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -75,6 +75,8 @@ 沒有可用的應用軟體 正在應用軟體桌布… 成功應用軟體桌布 + Portrait aspect ratio + Landscape aspect ratio 秀出隱藏資料夾 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 728e7aee7..ba53ead22 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -75,6 +75,8 @@ No app capable of it has been found Setting wallpaper… Wallpaper set successfully + Portrait aspect ratio + Landscape aspect ratio Show hidden folders