mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +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?) {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue