fix #1113, #2309, fixing some wallpaper setting related glitches

This commit is contained in:
tibbi 2022-05-03 10:38:36 +02:00
parent b2130669ab
commit f3eb312e57

View file

@ -34,6 +34,7 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_set_wallpaper) setContentView(R.layout.activity_set_wallpaper)
setupBottomActions()
if (checkAppSideloading()) { if (checkAppSideloading()) {
return return
@ -48,7 +49,6 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
} }
handleImage(intent) handleImage(intent)
setupBottomActions()
} }
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
@ -93,10 +93,16 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
} }
private fun setupAspectRatio() { private fun setupAspectRatio() {
var widthToUse = wallpaperManager.desiredMinimumWidth
val heightToUse = wallpaperManager.desiredMinimumHeight
if (widthToUse == heightToUse) {
widthToUse /= 2
}
when (aspectRatio) { when (aspectRatio) {
RATIO_LANDSCAPE -> crop_image_view.setAspectRatio(wallpaperManager.desiredMinimumWidth, wallpaperManager.desiredMinimumHeight / 2) RATIO_PORTRAIT -> crop_image_view.setAspectRatio(heightToUse, widthToUse)
RATIO_PORTRAIT -> crop_image_view.setAspectRatio(wallpaperManager.desiredMinimumWidth / 2, wallpaperManager.desiredMinimumHeight) RATIO_LANDSCAPE -> crop_image_view.setAspectRatio(widthToUse, heightToUse)
else -> crop_image_view.setAspectRatio(wallpaperManager.desiredMinimumWidth, wallpaperManager.desiredMinimumWidth) else -> crop_image_view.setAspectRatio(widthToUse, widthToUse)
} }
} }