Skip to content

Commit

Permalink
Code style
Browse files Browse the repository at this point in the history
  • Loading branch information
cvzi committed Aug 25, 2023
1 parent fedf98a commit fe5e15d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/publish.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
task sourcesJar(type: Jar) {
tasks.register('sourcesJar', Jar) {
from android.sourceSets.main.java.srcDirs
archiveClassifier = 'sources'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import android.app.Application
import android.os.StrictMode
import android.os.StrictMode.VmPolicy

@Suppress("unused")
class App : Application() {
init {
if (BuildConfig.DEBUG) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const val NIGHT = true

typealias DayOrNight = Boolean
typealias StringRes = Int
typealias IdRes = Int

open class WallpaperStatus
class WallpaperStatusLoading : WallpaperStatus()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,6 @@ open class MainActivity : AppCompatActivity() {
}

@Deprecated("Deprecated in Java")
@Suppress("DEPRECATION")
override fun onBackPressed() {
// This is no longer used on Android 13+/Tiramisu
// See onBackInvokedCallback for Android 13+
Expand Down
22 changes: 11 additions & 11 deletions app/src/main/java/com/google/android/renderscript/Toolkit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import android.graphics.Bitmap
import kotlin.math.min

// This string is used for error messages.
private const val externalName = "RenderScript Toolkit"
private const val EXTERNAL_NAME = "RenderScript Toolkit"

/**
* A collection of high-performance graphic utility functions like blur and blend.
Expand Down Expand Up @@ -80,7 +80,7 @@ object Toolkit {
fun blur(inputBitmap: Bitmap, radius: Int = 5, restriction: Range2d? = null): Bitmap {
validateBitmap("blur", inputBitmap)
require(radius in 1..25) {
"$externalName blur. The radius should be between 1 and 25. $radius provided."
"$EXTERNAL_NAME blur. The radius should be between 1 and 25. $radius provided."
}
validateRestriction("blur", inputBitmap.width, inputBitmap.height, restriction)

Expand All @@ -106,7 +106,7 @@ object Toolkit {
}
validateBitmap("blur", inputBitmap)
require(radius > 0) {
"$externalName blur. The radius should be greater than 0. $radius provided."
"$EXTERNAL_NAME blur. The radius should be greater than 0. $radius provided."
}
validateRestriction("blur", inputBitmap.width, inputBitmap.height, restriction)

Expand Down Expand Up @@ -166,17 +166,17 @@ internal fun validateBitmap(
inputBitmap.config == Bitmap.Config.ARGB_8888 ||
inputBitmap.config == Bitmap.Config.ALPHA_8
) {
"$externalName. $function supports only ARGB_8888 and ALPHA_8 bitmaps. " +
"$EXTERNAL_NAME. $function supports only ARGB_8888 and ALPHA_8 bitmaps. " +
"${inputBitmap.config} provided."
}
} else {
require(inputBitmap.config == Bitmap.Config.ARGB_8888) {
"$externalName. $function supports only ARGB_8888. " +
"$EXTERNAL_NAME. $function supports only ARGB_8888. " +
"${inputBitmap.config} provided."
}
}
require(inputBitmap.width * vectorSize(inputBitmap) == inputBitmap.rowBytes) {
"$externalName $function. Only bitmaps with rowSize equal to the width * vectorSize are " +
"$EXTERNAL_NAME $function. Only bitmaps with rowSize equal to the width * vectorSize are " +
"currently supported. Provided were rowBytes=${inputBitmap.rowBytes}, " +
"width={${inputBitmap.width}, and vectorSize=${vectorSize(inputBitmap)}."
}
Expand All @@ -193,21 +193,21 @@ internal fun validateRestriction(
) {
if (restriction == null) return
require(restriction.startX < sizeX && restriction.endX <= sizeX) {
"$externalName $tag. sizeX should be greater than restriction.startX and greater " +
"$EXTERNAL_NAME $tag. sizeX should be greater than restriction.startX and greater " +
"or equal to restriction.endX. $sizeX, ${restriction.startX}, " +
"and ${restriction.endX} were provided respectively."
}
require(restriction.startY < sizeY && restriction.endY <= sizeY) {
"$externalName $tag. sizeY should be greater than restriction.startY and greater " +
"$EXTERNAL_NAME $tag. sizeY should be greater than restriction.startY and greater " +
"or equal to restriction.endY. $sizeY, ${restriction.startY}, " +
"and ${restriction.endY} were provided respectively."
}
require(restriction.startX < restriction.endX) {
"$externalName $tag. Restriction startX should be less than endX. " +
"$EXTERNAL_NAME $tag. Restriction startX should be less than endX. " +
"${restriction.startX} and ${restriction.endX} were provided respectively."
}
require(restriction.startY < restriction.endY) {
"$externalName $tag. Restriction startY should be less than endY. " +
"$EXTERNAL_NAME $tag. Restriction startY should be less than endY. " +
"${restriction.startY} and ${restriction.endY} were provided respectively."
}
}
Expand All @@ -217,7 +217,7 @@ internal fun vectorSize(bitmap: Bitmap): Int {
Bitmap.Config.ARGB_8888 -> 4
Bitmap.Config.ALPHA_8 -> 1
else -> throw IllegalArgumentException(
"$externalName. Only ARGB_8888 and ALPHA_8 Bitmap are supported."
"$EXTERNAL_NAME. Only ARGB_8888 and ALPHA_8 Bitmap are supported."
)
}
}
Expand Down

0 comments on commit fe5e15d

Please sign in to comment.