Added None scaling option
This commit is contained in:
1 parent
78d7e0972b
commit
9f67243f0d
9 files changed
+51
-9
No files matched your search
@@ -20,7 +20,7 @@ android {
|
|||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 31
|
versionCode = 31
|
||||||
versionName = "2.1.1"
|
versionName = "2.2.0"
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables {
|
vectorDrawables {
|
||||||
useSupportLibrary = true
|
useSupportLibrary = true
|
||||||
@@ -113,6 +113,7 @@ dependencies {
|
|||||||
implementation("androidx.compose.foundation:foundation:1.7.0")
|
implementation("androidx.compose.foundation:foundation:1.7.0")
|
||||||
implementation("com.github.nanihadesuka:LazyColumnScrollbar:2.2.0")
|
implementation("com.github.nanihadesuka:LazyColumnScrollbar:2.2.0")
|
||||||
implementation("com.joaomgcd:taskerpluginlibrary:0.4.10")
|
implementation("com.joaomgcd:taskerpluginlibrary:0.4.10")
|
||||||
|
implementation("com.google.ar.sceneform:filament-android:1.17.1")
|
||||||
testImplementation("junit:junit:4.13.2")
|
testImplementation("junit:junit:4.13.2")
|
||||||
androidTestImplementation("androidx.test.ext:junit:1.2.1")
|
androidTestImplementation("androidx.test.ext:junit:1.2.1")
|
||||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
|
||||||
|
|||||||
@@ -3,5 +3,6 @@ package com.anthonyla.paperize.core
|
|||||||
enum class ScalingConstants {
|
enum class ScalingConstants {
|
||||||
FIT,
|
FIT,
|
||||||
FILL,
|
FILL,
|
||||||
STRETCH
|
STRETCH,
|
||||||
|
NONE
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,6 @@ object ScreenMetricsCompat {
|
|||||||
private val api: Api =
|
private val api: Api =
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) ApiLevel30() else Api()
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) ApiLevel30() else Api()
|
||||||
fun getScreenSize(context: Context): Size = api.getScreenSize(context)
|
fun getScreenSize(context: Context): Size = api.getScreenSize(context)
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
private open class Api {
|
private open class Api {
|
||||||
open fun getScreenSize(context: Context): Size {
|
open fun getScreenSize(context: Context): Size {
|
||||||
@@ -457,6 +456,7 @@ fun processBitmap(
|
|||||||
ScalingConstants.FILL -> fillBitmap(processedBitmap, width, height)
|
ScalingConstants.FILL -> fillBitmap(processedBitmap, width, height)
|
||||||
ScalingConstants.FIT -> fitBitmap(processedBitmap, width, height)
|
ScalingConstants.FIT -> fitBitmap(processedBitmap, width, height)
|
||||||
ScalingConstants.STRETCH -> stretchBitmap(processedBitmap, width, height)
|
ScalingConstants.STRETCH -> stretchBitmap(processedBitmap, width, height)
|
||||||
|
ScalingConstants.NONE -> processedBitmap
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply brightness effect
|
// Apply brightness effect
|
||||||
|
|||||||
+2
-1
@@ -54,9 +54,10 @@ fun PreviewItem(
|
|||||||
ScalingConstants.FILL -> ContentScale.FillHeight
|
ScalingConstants.FILL -> ContentScale.FillHeight
|
||||||
ScalingConstants.FIT -> ContentScale.FillWidth
|
ScalingConstants.FIT -> ContentScale.FillWidth
|
||||||
ScalingConstants.STRETCH -> ContentScale.FillBounds
|
ScalingConstants.STRETCH -> ContentScale.FillBounds
|
||||||
|
ScalingConstants.NONE -> ContentScale.Crop
|
||||||
},
|
},
|
||||||
requestSize = IntSize(300, 300),
|
requestSize = IntSize(300, 300),
|
||||||
alignment = Alignment.Center,
|
alignment = if (scaling == ScalingConstants.NONE) Alignment.CenterStart else Alignment.Center,
|
||||||
colorFilter = if (darken && darkenPercentage < 100) {
|
colorFilter = if (darken && darkenPercentage < 100) {
|
||||||
ColorFilter.tint(
|
ColorFilter.tint(
|
||||||
Color.Black.copy(alpha = (100 - darkenPercentage).toFloat().div(100f)),
|
Color.Black.copy(alpha = (100 - darkenPercentage).toFloat().div(100f)),
|
||||||
|
|||||||
+11
-3
@@ -61,13 +61,15 @@ fun WallpaperPreviewAndScale(
|
|||||||
ScalingConstants.FILL -> 0
|
ScalingConstants.FILL -> 0
|
||||||
ScalingConstants.FIT -> 1
|
ScalingConstants.FIT -> 1
|
||||||
ScalingConstants.STRETCH -> 2
|
ScalingConstants.STRETCH -> 2
|
||||||
|
ScalingConstants.NONE -> 3
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val options = listOf(
|
val options = listOf(
|
||||||
stringResource(R.string.fill),
|
stringResource(R.string.fill),
|
||||||
stringResource(R.string.fit),
|
stringResource(R.string.fit),
|
||||||
stringResource(R.string.stretch)
|
stringResource(R.string.stretch),
|
||||||
|
stringResource(R.string.none)
|
||||||
)
|
)
|
||||||
|
|
||||||
Surface(
|
Surface(
|
||||||
@@ -87,9 +89,13 @@ fun WallpaperPreviewAndScale(
|
|||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
val modifier = if (lockEnabled && homeEnabled) {
|
val modifier = if (lockEnabled && homeEnabled) {
|
||||||
Modifier.weight(1f).padding(8.dp)
|
Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.padding(8.dp)
|
||||||
} else {
|
} else {
|
||||||
Modifier.fillMaxSize(0.5f).padding(8.dp)
|
Modifier
|
||||||
|
.fillMaxSize(0.5f)
|
||||||
|
.padding(8.dp)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lockEnabled) {
|
if (lockEnabled) {
|
||||||
@@ -150,6 +156,7 @@ fun WallpaperPreviewAndScale(
|
|||||||
0 -> ScalingConstants.FILL
|
0 -> ScalingConstants.FILL
|
||||||
1 -> ScalingConstants.FIT
|
1 -> ScalingConstants.FIT
|
||||||
2 -> ScalingConstants.STRETCH
|
2 -> ScalingConstants.STRETCH
|
||||||
|
3 -> ScalingConstants.NONE
|
||||||
else -> ScalingConstants.FILL
|
else -> ScalingConstants.FILL
|
||||||
}
|
}
|
||||||
) },
|
) },
|
||||||
@@ -164,6 +171,7 @@ fun WallpaperPreviewAndScale(
|
|||||||
0 -> painterResource(id = R.drawable.fill)
|
0 -> painterResource(id = R.drawable.fill)
|
||||||
1 -> painterResource(id = R.drawable.fit)
|
1 -> painterResource(id = R.drawable.fit)
|
||||||
2 -> painterResource(id = R.drawable.stretch)
|
2 -> painterResource(id = R.drawable.stretch)
|
||||||
|
3 -> painterResource(id = R.drawable.none)
|
||||||
else -> painterResource(id = R.drawable.fill)
|
else -> painterResource(id = R.drawable.fill)
|
||||||
},
|
},
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
|
|||||||
+3
-1
@@ -42,6 +42,7 @@ import java.time.format.DateTimeFormatter
|
|||||||
import java.time.format.FormatStyle
|
import java.time.format.FormatStyle
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service for changing home screen
|
* Service for changing home screen
|
||||||
*/
|
*/
|
||||||
@@ -571,7 +572,7 @@ class HomeWallpaperService: Service() {
|
|||||||
val size = getDeviceScreenSize(context)
|
val size = getDeviceScreenSize(context)
|
||||||
val bitmap = retrieveBitmap(context, wallpaper, size.width, size.height)
|
val bitmap = retrieveBitmap(context, wallpaper, size.width, size.height)
|
||||||
if (bitmap == null) return false
|
if (bitmap == null) return false
|
||||||
else {
|
else if (wallpaperManager.isSetWallpaperAllowed) {
|
||||||
processBitmap(size.width, size.height, bitmap, darken, darkenPercent, scaling, blur, blurPercent, vignette, vignettePercent)?.let { image ->
|
processBitmap(size.width, size.height, bitmap, darken, darkenPercent, scaling, blur, blurPercent, vignette, vignettePercent)?.let { image ->
|
||||||
wallpaperManager.setBitmap(image, null, true, WallpaperManager.FLAG_SYSTEM)
|
wallpaperManager.setBitmap(image, null, true, WallpaperManager.FLAG_SYSTEM)
|
||||||
wallpaperManager.forgetLoadedWallpaper()
|
wallpaperManager.forgetLoadedWallpaper()
|
||||||
@@ -580,6 +581,7 @@ class HomeWallpaperService: Service() {
|
|||||||
bitmap.recycle()
|
bitmap.recycle()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
else return false
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
Log.e("PaperizeWallpaperChanger", "Error setting wallpaper", e)
|
Log.e("PaperizeWallpaperChanger", "Error setting wallpaper", e)
|
||||||
return false
|
return false
|
||||||
|
|||||||
+2
-1
@@ -494,7 +494,7 @@ class LockWallpaperService: Service() {
|
|||||||
val size = getDeviceScreenSize(context)
|
val size = getDeviceScreenSize(context)
|
||||||
val bitmap = retrieveBitmap(context, wallpaper, size.width, size.height)
|
val bitmap = retrieveBitmap(context, wallpaper, size.width, size.height)
|
||||||
if (bitmap == null) return false
|
if (bitmap == null) return false
|
||||||
else {
|
else if (wallpaperManager.isSetWallpaperAllowed) {
|
||||||
processBitmap(size.width, size.height, bitmap, darken, darkenPercent, scaling, blur, blurPercent, vignette, vignettePercent)?.let { image ->
|
processBitmap(size.width, size.height, bitmap, darken, darkenPercent, scaling, blur, blurPercent, vignette, vignettePercent)?.let { image ->
|
||||||
wallpaperManager.setBitmap(image, null, true, WallpaperManager.FLAG_LOCK)
|
wallpaperManager.setBitmap(image, null, true, WallpaperManager.FLAG_LOCK)
|
||||||
wallpaperManager.forgetLoadedWallpaper()
|
wallpaperManager.forgetLoadedWallpaper()
|
||||||
@@ -503,6 +503,7 @@ class LockWallpaperService: Service() {
|
|||||||
bitmap.recycle()
|
bitmap.recycle()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
else return false
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
Log.e("PaperizeWallpaperChanger", "Error setting wallpaper", e)
|
Log.e("PaperizeWallpaperChanger", "Error setting wallpaper", e)
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="128dp"
|
||||||
|
android:height="128dp"
|
||||||
|
android:viewportWidth="128"
|
||||||
|
android:viewportHeight="128">
|
||||||
|
<path
|
||||||
|
android:pathData="M29.66,113.89L29.66,113.89L98.34,113.89L98.34,113.89L98.34,15.04L98.34,15.04L29.66,15.04L29.66,15.04L29.66,113.89Z"
|
||||||
|
android:fillColor="#e1e0a6"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M79.94,109.3C79.94,111.06 78.5,112.5 76.74,112.5L38.39,112.5C36.63,112.5 35.19,111.06 35.19,109.3C35.19,109.3 55.8,82.13 57.56,82.13C59.32,82.13 79.93,109.3 79.93,109.3Z"
|
||||||
|
android:fillColor="#b8ca43"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M76.14,113.89L37.91,113.89C35.26,113.89 33.12,111.74 33.12,109.1L33.12,108.62C33.12,108.62 33.44,108.14 33.44,108.14C54.47,80.33 56.07,80.33 57.02,80.33C57.98,80.33 59.57,80.33 80.6,108.14L80.92,108.62L80.92,109.1C80.92,111.82 78.85,113.89 76.14,113.89L76.14,113.89ZM36.18,109.53C36.34,110.17 36.98,110.65 37.78,110.65L76.13,110.65C76.93,110.65 77.41,110.17 77.73,109.53C70.38,99.94 59.99,86.68 56.96,83.8C53.92,86.68 43.54,99.94 36.19,109.53Z"
|
||||||
|
android:fillColor="#231c1c"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M93.63,108.73C93.63,110.38 92.27,111.83 90.5,111.83L53.46,111.83C51.79,111.83 50.33,110.49 50.33,108.73C50.33,108.73 70.26,82.81 71.93,82.81C73.7,82.81 93.63,108.73 93.63,108.73Z"
|
||||||
|
android:fillColor="#b8ca43"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M90.84,113.89L52.87,113.89C50.52,113.89 48.6,111.97 48.6,109.62L48.6,109.3C48.6,109.3 48.81,108.98 48.81,108.98C69.56,81.75 71.16,81.75 71.8,81.75C72.44,81.75 74.05,81.75 94.79,108.98L95,109.3L95,109.62C95.11,111.97 93.18,113.89 90.83,113.89ZM50.91,109.76C51.02,110.72 51.98,111.58 52.94,111.58L90.85,111.58C91.92,111.58 92.77,110.83 92.88,109.76C84.23,98.33 74.3,85.84 71.95,83.81C69.6,85.84 59.67,98.33 50.91,109.76Z"
|
||||||
|
android:fillColor="#231c1c"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M53.55,45.67C58.25,45.67 61.79,40.68 59.14,35.7C58.13,33.81 56.12,32.67 53.98,32.67L53.37,32.67C50.82,32.67 48.48,34.19 47.55,36.57C45.72,41.24 49.11,45.67 53.54,45.67L53.54,45.67Z"
|
||||||
|
android:fillColor="#f29b54"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M60.87,39.62C60.87,44.09 57.35,47.61 52.88,47.61C48.41,47.61 44.89,44.09 44.89,39.62C44.89,35.15 48.41,31.63 52.88,31.63C57.35,31.63 60.87,35.15 60.87,39.62ZM48.09,39.62C48.09,42.34 50.17,44.41 52.88,44.41C55.59,44.41 57.67,42.33 57.67,39.62C57.67,36.91 55.59,34.83 52.88,34.83C50.17,34.83 48.09,36.91 48.09,39.62Z"
|
||||||
|
android:fillColor="#231c1c"/>
|
||||||
|
</vector>
|
||||||
@@ -163,4 +163,5 @@
|
|||||||
<string name="unselected_album">Unselected album</string>
|
<string name="unselected_album">Unselected album</string>
|
||||||
<string name="lock">Lock</string>
|
<string name="lock">Lock</string>
|
||||||
<string name="change_vignette">Change Vignette</string>
|
<string name="change_vignette">Change Vignette</string>
|
||||||
|
<string name="none">None</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in new issue
Block a user