Skip to content

Commit

Permalink
Format style
Browse files Browse the repository at this point in the history
  • Loading branch information
cvzi committed Jul 21, 2024
1 parent a6f1a37 commit 6d891f5
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
3 changes: 1 addition & 2 deletions app/src/main/java/com/github/cvzi/screenshottile/Types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import com.github.cvzi.screenshottile.utils.mimeFromFileExtension
import java.io.File
import java.io.OutputStream
import java.io.Serializable
import kotlin.math.max
import kotlin.math.min

/**
* Holds a single boolean value
Expand All @@ -32,6 +30,7 @@ enum class PackageNameFilterMode {
fun fromInt(i: Int): PackageNameFilterMode {
return entries.getOrElse(i) { entries[0] }
}

fun fromString(s: String): PackageNameFilterMode? {
return entries.firstOrNull { it.name == s }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.widget.RadioButton
import android.widget.TextView
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.children
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.github.cvzi.screenshottile.activities

import android.content.Context
import android.content.Intent
import android.content.pm.ResolveInfo
import android.content.res.Configuration
import android.graphics.Bitmap
import android.graphics.Canvas
Expand All @@ -15,7 +14,6 @@ import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup.LayoutParams
Expand All @@ -31,7 +29,6 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.widget.doAfterTextChanged
import com.github.cvzi.screenshottile.App
import com.github.cvzi.screenshottile.R
import com.github.cvzi.screenshottile.activities.MainActivity.Companion
import com.github.cvzi.screenshottile.databinding.ActivityFloatingButtonSettingsBinding
import com.github.cvzi.screenshottile.services.ScreenshotAccessibilityService
import com.github.cvzi.screenshottile.utils.ShutterCollection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ class FloatingTileService : TileService() {
// Floating button is currently hidden by package filter
// -> Temporary show it
ScreenshotAccessibilityService.instance?.overridePackageFilterTempShow()
}

else if (prefManager.floatingButton && prefManager.packageNameFilterEnabled && ScreenshotAccessibilityService.instance?.floatingButtonShown == true) {
} else if (prefManager.floatingButton && prefManager.packageNameFilterEnabled && ScreenshotAccessibilityService.instance?.floatingButtonShown == true) {
// Floating button is currently shown through package filter
// -> Temporary hide it
ScreenshotAccessibilityService.instance?.overridePackageFilterTempHide()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -860,14 +860,15 @@ class PrefManager(private val context: Context, private val pref: SharedPreferen
set(values) = pref.edit()
.putString(
context.getString(R.string.pref_key_package_name_filter_list),
LinkedHashSet(values).filter{ !it.contains("////")}.joinToString("////")
LinkedHashSet(values).filter { !it.contains("////") }.joinToString("////")
).apply()

fun addPackageNameToFilterList(packageName: String) {
val t = packageNameFilterList
t.add(packageName)
packageNameFilterList = t
}

var packageNameFilterEnabled: Boolean
get() = pref.getBoolean(
context.getString(R.string.pref_key_package_name_filter_enabled),
Expand All @@ -879,10 +880,12 @@ class PrefManager(private val context: Context, private val pref: SharedPreferen
).apply()

var packageNameFilterMode: PackageNameFilterMode
get() = PackageNameFilterMode.fromInt(pref.getString(
context.getString(R.string.pref_key_package_name_filter_mode),
"0"
)?.toIntOrNull() ?: 0)
get() = PackageNameFilterMode.fromInt(
pref.getString(
context.getString(R.string.pref_key_package_name_filter_mode),
"0"
)?.toIntOrNull() ?: 0
)
set(value) = pref.edit().putString(
context.getString(R.string.pref_key_package_name_filter_mode),
value.ordinal.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,8 @@ fun realScreenSize(context: Context): Point {
when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
// display.mode.physical is independent of screen orientation
context.display?.mode?.let {
when (context.display?.rotation) {
context.display.mode?.let {
when (context.display.rotation) {
Surface.ROTATION_90, Surface.ROTATION_270 -> {
y = it.physicalWidth
x = it.physicalHeight
Expand All @@ -754,7 +754,7 @@ fun realScreenSize(context: Context): Point {

Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> {
@Suppress("DEPRECATION")
context.display?.getRealSize(this)
(context.display.getRealSize(this))
}

else -> {
Expand Down

0 comments on commit 6d891f5

Please sign in to comment.