Correct ktlint for FocusDialog

This commit is contained in:
mcc 2022-09-03 19:23:50 -04:00
parent 09ab141d97
commit 8f08b1b678
1 changed files with 14 additions and 13 deletions

View File

@ -17,7 +17,12 @@ package com.keylesspalace.tusky.components.compose.dialog
import android.app.Activity
import android.content.DialogInterface
import android.graphics.*
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Matrix
import android.graphics.Paint
import android.graphics.Path
import android.graphics.drawable.Drawable
import android.net.Uri
import android.os.Build
@ -47,9 +52,7 @@ import java.security.MessageDigest
import java.util.concurrent.locks.Lock
// Private, but necessary to implement BitmapTransformation, function extracted from Glide
private fun getAlphaSafeBitmap(
pool: BitmapPool, maybeAlphaSafe: Bitmap
): Bitmap {
private fun getAlphaSafeBitmap(pool: BitmapPool, maybeAlphaSafe: Bitmap): Bitmap {
val safeConfig: Bitmap.Config = getAlphaSafeConfig(maybeAlphaSafe)
if (safeConfig == maybeAlphaSafe.config) {
return maybeAlphaSafe
@ -77,9 +80,7 @@ private val transparentDarkGray = 0x40000000
/** Glide BitmapTransformation which overlays a highlight on a focus point. */
class HighlightFocus(val focus: Focus) : BitmapTransformation() {
override fun transform(
pool: BitmapPool, inBitmap: Bitmap, outWidth: Int, outHeight: Int
): Bitmap {
override fun transform(pool: BitmapPool, inBitmap: Bitmap, outWidth: Int, outHeight: Int): Bitmap {
// Draw overlaid target
val bitmapDrawableLock: Lock = TransformationUtils.getBitmapDrawableLock()
val safeConfig: Bitmap.Config = getAlphaSafeConfig(inBitmap)
@ -90,7 +91,7 @@ class HighlightFocus(val focus: Focus) : BitmapTransformation() {
val strokePaint = Paint(Paint.ANTI_ALIAS_FLAG)
strokePaint.setAntiAlias(true)
strokePaint.setStyle(Paint.Style.STROKE)
val strokeWidth = 10.0f;
val strokeWidth = 10.0f
strokePaint.setStrokeWidth(strokeWidth)
strokePaint.setColor(Color.WHITE)
val curtainPaint = Paint(Paint.ANTI_ALIAS_FLAG)
@ -106,7 +107,7 @@ class HighlightFocus(val focus: Focus) : BitmapTransformation() {
// Canvas range is 0..size Y-down but Mastodon API range is -1..1 Y-up
val width = result.width.toFloat()
val height = result.height.toFloat()
val x = (focus.x+1.0f)/2.0f*width;
val x = (focus.x + 1.0f) / 2.0f * width
val y = (1.0f - focus.y) / 2.0f * height
val circleRadius = Math.min(width, height).toFloat() / 4.0f