Format code

This commit is contained in:
Ming Ming 2022-05-15 16:45:25 +08:00
parent c784cf63ff
commit 812b26f10e
2 changed files with 14 additions and 4 deletions

View file

@ -161,7 +161,11 @@ class NotificationChannelHandler(context: Context) :
action = Intent.ACTION_SEND_MULTIPLE
putParcelableArrayListExtra(Intent.EXTRA_STREAM, ArrayList(uris))
type =
if (mimeTypes.all { it?.startsWith("image/") == true }) "image/*" else "*/*"
if (mimeTypes.all {
it?.startsWith(
"image/"
) == true
}) "image/*" else "*/*"
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
}
@ -204,7 +208,11 @@ class NotificationChannelHandler(context: Context) :
).setOnlyAlertOnce(true).setAutoCancel(false).setLocalOnly(true)
.setProgress(max, progress, false).setContentText("$progress/$max")
if (currentItemTitle == null) {
builder.setContentTitle(_context.getString(R.string.download_progress_notification_untitled_text))
builder.setContentTitle(
_context.getString(
R.string.download_progress_notification_untitled_text
)
)
} else {
builder.setContentTitle(
_context.getString(
@ -330,7 +338,9 @@ class NotificationChannelHandler(context: Context) :
}
val manager =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
context.getSystemService(
Context.NOTIFICATION_SERVICE
) as NotificationManager
manager.createNotificationChannel(channel)
}
}

View file

@ -24,7 +24,7 @@ inline fun <T> HttpURLConnection.use(block: (HttpURLConnection) -> T): T {
}
inline fun ByteArray.transform(transform: (Byte) -> Byte) {
forEachIndexed{ i, v -> this[i] = transform(v) }
forEachIndexed { i, v -> this[i] = transform(v) }
}
inline fun <T> measureTime(tag: String, message: String, block: () -> T): T {