update the widget at app startup just once, not three times

This commit is contained in:
tibbi 2016-09-19 23:51:01 +02:00
parent 702826b745
commit ead01b5926
2 changed files with 6 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import android.view.MenuItem
import com.simplemobiletools.calendar.*
import com.simplemobiletools.calendar.Formatter
import com.simplemobiletools.calendar.adapters.MyMonthPagerAdapter
import com.simplemobiletools.calendar.extensions.updateWidget
import kotlinx.android.synthetic.main.activity_main.*
import org.joda.time.DateTime
import org.joda.time.DateTimeZone
@ -25,6 +26,11 @@ class MainActivity : SimpleActivity(), NavigationListener {
calendar_fab.setOnClickListener { addNewEvent() }
}
override fun onResume() {
super.onResume()
updateWidget()
}
override fun onDestroy() {
super.onDestroy()
Config.newInstance(applicationContext).isFirstRun = false

View File

@ -13,7 +13,6 @@ import android.view.ViewGroup
import android.widget.*
import com.simplemobiletools.calendar.*
import com.simplemobiletools.calendar.activities.DayActivity
import com.simplemobiletools.calendar.extensions.updateWidget
import com.simplemobiletools.calendar.models.Day
import kotlinx.android.synthetic.main.month_fragment.view.*
import kotlinx.android.synthetic.main.top_navigation.view.*
@ -74,7 +73,6 @@ class MonthFragment : Fragment(), Calendar {
activity?.runOnUiThread {
mHolder.top_value.text = month
updateDays(days)
context.updateWidget()
}
}