Skip to content

Commit

Permalink
Imrpove AlertWindow handling 3.0.0 (33004)
Browse files Browse the repository at this point in the history
  • Loading branch information
anod committed Sep 9, 2023
1 parent 0594bbc commit 63f71c8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ android {
targetSdk = 33 // 29 wifi switch not working
applicationId = "com.anod.car.home.free"

versionCode = 33003
versionName = "3.0.0-rc1"
versionCode = 33004
versionName = "3.0.0"
vectorDrawables.generatedDensities("hdpi", "xxhdpi")
}

Expand Down
11 changes: 3 additions & 8 deletions app/src/main/java/com/anod/car/home/CarWidgetApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import org.koin.core.component.KoinComponent
import org.koin.core.component.get
import org.koin.core.context.startKoin
import org.koin.core.module.dsl.factoryOf
import org.koin.core.module.dsl.singleOf
import org.koin.core.qualifier.named
import org.koin.dsl.bind
import org.koin.dsl.module
Expand Down Expand Up @@ -146,17 +147,11 @@ class CarWidgetApplication : Application(), ApplicationInstance, KoinComponent {
factory { (skinName: String) -> get<SkinPropertiesFactory>().create(skinName) }
factoryOf(::ScreenOrientation)
factoryOf(::AlertWindow)
factoryOf(::ScreenOnAlert)
singleOf(::ScreenOnAlert)
factory {
BroadcastService.Manager(applicationContext = get(), inCarSettings = get())
} bind BroadcastServiceManager::class
factory {
ModeHandler(
context = get(),
screenOrientation = get(),
koin = getKoin()
)
}
singleOf(::ModeHandler)
factoryOf(::ModePhoneStateListener)
factoryOf(::PermissionChecker)
factory(named("permissionDescriptions")) { permissionDescriptions }
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/java/com/anod/car/home/incar/ModeHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ import info.anodsplace.applog.AppLog
import info.anodsplace.carwidget.incar.ScreenOnAlert
import info.anodsplace.carwidget.incar.ScreenOrientation
import info.anodsplace.framework.content.startActivitySafely
import org.koin.core.Koin

class ModeHandler(
private val context: Context,
private val screenOrientation: ScreenOrientation,
private val koin: Koin
private val alertWindow: ScreenOnAlert
) {
private val alertWindow: ScreenOnAlert by lazy { koin.get() }

fun enable(prefs: info.anodsplace.carwidget.content.preferences.InCarInterface) {
if (prefs.isDisableScreenTimeout) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ class ScreenOnAlert(private val context: Context, private val prefs: InCarInterf

fun hide() {
alertWindow.hide()
prefs.screenOnAlert = prefs.screenOnAlert.withLocation(lastX, lastY)
if (lastX > 0 && lastY > 0) {
prefs.screenOnAlert = prefs.screenOnAlert.withLocation(lastX, lastY)
}
}

@SuppressLint("ClickableViewAccessibility")
Expand Down
2 changes: 1 addition & 1 deletion lib

0 comments on commit 63f71c8

Please sign in to comment.