Skip to content

Commit

Permalink
better name
Browse files Browse the repository at this point in the history
  • Loading branch information
wuan committed Oct 8, 2023
1 parent 72d152e commit ba2d638
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/src/main/java/org/blitzortung/android/app/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ import javax.inject.Inject
import kotlin.math.roundToInt

class Main : FragmentActivity(), OnSharedPreferenceChangeListener {
private var backgroundAlerts: Boolean = false
private var backgroundAlertEnabled: Boolean = false
private lateinit var statusComponent: StatusComponent

private lateinit var strikeColorHandler: StrikeColorHandler
Expand Down Expand Up @@ -482,7 +482,7 @@ class Main : FragmentActivity(), OnSharedPreferenceChangeListener {

disableDataUpdates()

if (backgroundAlerts) {
if (backgroundAlertEnabled) {
startService()
if (!locationHandler.backgroundMode) {
locationHandler.shutdown()
Expand Down Expand Up @@ -582,7 +582,7 @@ class Main : FragmentActivity(), OnSharedPreferenceChangeListener {

if (permission != null) {
val requiresBackgroundPermission = if (isAtLeast(Build.VERSION_CODES.Q)) {
backgroundAlerts && checkSelfPermission(ACCESS_BACKGROUND_LOCATION) != PackageManager.PERMISSION_GRANTED
backgroundAlertEnabled && checkSelfPermission(ACCESS_BACKGROUND_LOCATION) != PackageManager.PERMISSION_GRANTED
} else {
false
}
Expand Down Expand Up @@ -631,9 +631,9 @@ class Main : FragmentActivity(), OnSharedPreferenceChangeListener {

@TargetApi(Build.VERSION_CODES.M)
private fun requestWakeupPermissions(context: Context) {
Log.v(LOG_TAG, "requestWakeupPermissions() background alerts: $backgroundAlerts")
Log.v(LOG_TAG, "requestWakeupPermissions() background alerts: $backgroundAlertEnabled")

if (backgroundAlerts) {
if (backgroundAlertEnabled) {
val pm = context.getSystemService(Context.POWER_SERVICE)
if (pm is PowerManager) {
val packageName = context.packageName
Expand Down Expand Up @@ -733,7 +733,7 @@ class Main : FragmentActivity(), OnSharedPreferenceChangeListener {
}

PreferenceKey.BACKGROUND_QUERY_PERIOD -> {
backgroundAlerts = sharedPreferences.get(key, "0").toInt() > 0
backgroundAlertEnabled = sharedPreferences.get(key, "0").toInt() > 0
}

else -> {}
Expand Down

0 comments on commit ba2d638

Please sign in to comment.