mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
parent
b2130669ab
commit
f3eb312e57
1 changed files with 10 additions and 4 deletions
|
@ -34,6 +34,7 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_set_wallpaper)
|
||||
setupBottomActions()
|
||||
|
||||
if (checkAppSideloading()) {
|
||||
return
|
||||
|
@ -48,7 +49,6 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
|
|||
}
|
||||
|
||||
handleImage(intent)
|
||||
setupBottomActions()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
|
@ -93,10 +93,16 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
|
|||
}
|
||||
|
||||
private fun setupAspectRatio() {
|
||||
var widthToUse = wallpaperManager.desiredMinimumWidth
|
||||
val heightToUse = wallpaperManager.desiredMinimumHeight
|
||||
if (widthToUse == heightToUse) {
|
||||
widthToUse /= 2
|
||||
}
|
||||
|
||||
when (aspectRatio) {
|
||||
RATIO_LANDSCAPE -> crop_image_view.setAspectRatio(wallpaperManager.desiredMinimumWidth, wallpaperManager.desiredMinimumHeight / 2)
|
||||
RATIO_PORTRAIT -> crop_image_view.setAspectRatio(wallpaperManager.desiredMinimumWidth / 2, wallpaperManager.desiredMinimumHeight)
|
||||
else -> crop_image_view.setAspectRatio(wallpaperManager.desiredMinimumWidth, wallpaperManager.desiredMinimumWidth)
|
||||
RATIO_PORTRAIT -> crop_image_view.setAspectRatio(heightToUse, widthToUse)
|
||||
RATIO_LANDSCAPE -> crop_image_view.setAspectRatio(widthToUse, heightToUse)
|
||||
else -> crop_image_view.setAspectRatio(widthToUse, widthToUse)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue