aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/moe/yuuta/workmode/MainActivity.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/moe/yuuta/workmode/MainActivity.kt')
-rw-r--r--app/src/main/java/moe/yuuta/workmode/MainActivity.kt8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/src/main/java/moe/yuuta/workmode/MainActivity.kt b/app/src/main/java/moe/yuuta/workmode/MainActivity.kt
index 72f1050..e2ff1e1 100644
--- a/app/src/main/java/moe/yuuta/workmode/MainActivity.kt
+++ b/app/src/main/java/moe/yuuta/workmode/MainActivity.kt
@@ -54,6 +54,8 @@ class MainActivity : AppCompatActivity(), SwitchBar.OnSwitchChangeListener, View
private lateinit var tabLayout: TabLayout
private lateinit var welcomeTip: TextView
+ private lateinit var mCheckUpdateObserver: LifecycleUpdateChecker
+
private val mStoppableGroup: StoppableGroup = StoppableGroup()
private var mSortDisplayStoppable: Stoppable? = null
@@ -74,8 +76,9 @@ class MainActivity : AppCompatActivity(), SwitchBar.OnSwitchChangeListener, View
mAdapter = Adapter()
recyclerView.adapter = mAdapter
displayUI()
+ mCheckUpdateObserver = LifecycleUpdateChecker(this, this)
lifecycle.addObserver(LifecycleUIUpdateReceiver(this, this))
- lifecycle.addObserver(LifecycleUpdateChecker(this, this))
+ lifecycle.addObserver(mCheckUpdateObserver)
lifecycle.addObserver(GPL(this, lifecycle, this))
setProgressUI(false)
}
@@ -286,7 +289,7 @@ class MainActivity : AppCompatActivity(), SwitchBar.OnSwitchChangeListener, View
return true
}
R.id.action_check_update -> {
- startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=${BuildConfig.APPLICATION_ID}")))
+ mCheckUpdateObserver.start()
return true
}
R.id.action_oss -> {
@@ -338,6 +341,7 @@ class MainActivity : AppCompatActivity(), SwitchBar.OnSwitchChangeListener, View
val manager = getSystemService(NotificationManager::class.java)
manager.createNotificationChannel(NotificationChannel("update",
getString(R.string.notification_channel_update), NotificationManager.IMPORTANCE_HIGH))
+ manager.cancel(0)
manager.notify(0, Notification.Builder(this, "update")
.setContentTitle(getString(R.string.notification_title_update, name))
.setContentText(getString(R.string.notification_text_update_summary))