Skip to content

Commit

Permalink
Update widget data in onStop
Browse files Browse the repository at this point in the history
  • Loading branch information
shockbytes committed Feb 2, 2020
1 parent 9bc599a commit 16303ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package at.shockbytes.dante.ui.activity

import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelProviders
import android.content.Context
import android.content.Intent
import android.net.Uri
Expand Down Expand Up @@ -37,6 +36,7 @@ import at.shockbytes.dante.flagging.FeatureFlag
import at.shockbytes.dante.navigation.Destination
import at.shockbytes.dante.ui.fragment.AnnouncementFragment
import at.shockbytes.dante.util.toggleVisibility
import at.shockbytes.dante.util.viewModelOf
import at.shockbytes.util.AppUtils
import com.leinardi.android.speeddial.SpeedDialActionItem
import io.reactivex.android.schedulers.AndroidSchedulers
Expand Down Expand Up @@ -67,7 +67,7 @@ class MainActivity : BaseActivity(), ViewPager.OnPageChangeListener {
setContentView(R.layout.activity_main)
setSupportActionBar(toolbar)

viewModel = ViewModelProviders.of(this, vmFactory)[MainViewModel::class.java]
viewModel = viewModelOf(vmFactory)
tabId = savedInstanceState?.getInt("tabId") ?: R.id.menu_navigation_current

handleIntentExtras()
Expand Down Expand Up @@ -116,8 +116,8 @@ class MainActivity : BaseActivity(), ViewPager.OnPageChangeListener {
setupFabMenu()
}

override fun onDestroy() {
super.onDestroy()
override fun onStop() {
super.onStop()
DanteAppWidgetManager.refresh(this)
}

Expand Down Expand Up @@ -388,10 +388,8 @@ class MainActivity : BaseActivity(), ViewPager.OnPageChangeListener {

danteSettings
.observeDarkModeEnabled()
.subscribe { isDarkModeEnabled ->
enableDarkMode(isDarkModeEnabled)
}
.addTo(compositeDisposable)
.subscribe(::enableDarkMode)
.addTo(compositeDisposable)
}

private fun enableDarkMode(isEnabled: Boolean) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/debug/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<resources>

<string name="app_name" translatable="false">Dante Debug</string>
<string name="app_version" translatable="false">3.8 (Debug Build)</string>
<string name="app_version" translatable="false">3.8.2 (Debug Build)</string>

</resources>

0 comments on commit 16303ff

Please sign in to comment.