Skip to content

Commit

Permalink
Use AppService.Instance inside AlertDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Sinz committed Apr 27, 2016
1 parent 39beae6 commit b1ec604
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 1 addition & 3 deletions app/src/main/java/org/blitzortung/android/app/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,7 @@ class Main : OwnMapActivity(), OnSharedPreferenceChangeListener {
R.id.info_dialog -> InfoDialog(this, versionComponent)

R.id.alarm_dialog ->
appService?.let { appService ->
AlertDialog(this, appService, AlertDialogColorHandler(PreferenceManager.getDefaultSharedPreferences(this)))
}
AlertDialog(this, AlertDialogColorHandler(PreferenceManager.getDefaultSharedPreferences(this)))

R.id.log_dialog -> LogDialog(this)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import org.blitzortung.android.app.R
import org.blitzortung.android.app.view.AlertView
import org.blitzortung.android.map.overlay.color.ColorHandler

class AlertDialog(context: Context, private val service: AppService?, private val colorHandler: ColorHandler) : android.app.AlertDialog(context) {
class AlertDialog(context: Context, private val colorHandler: ColorHandler) : android.app.AlertDialog(context) {
private lateinit var alertView: AlertView

private val alertHandler: AlertHandler = BOApplication.alertHandler
Expand All @@ -51,9 +51,8 @@ class AlertDialog(context: Context, private val service: AppService?, private va
alertHandler.requestUpdates(alertView.alertEventConsumer)

alertView.setColorHandler(colorHandler, BOApplication.dataHandler.intervalDuration)
service?.run {
alertView.alertEventConsumer.invoke(this.alertEvent())
}
alertView.alertEventConsumer(alertHandler.alertEvent)

colorHandler.updateTarget()
}

Expand Down

0 comments on commit b1ec604

Please sign in to comment.