mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-16 20:00:39 +01:00
reordering some functions
This commit is contained in:
parent
7524360fea
commit
3cef66f2bf
@ -124,7 +124,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (mStoredTextColor != config.textColor || mStoredBackgroundColor != config.backgroundColor || mStoredPrimaryColor != config.primaryColor
|
||||
|| mStoredDayCode != getCurrentDayCode()) {
|
||||
|| mStoredDayCode != Formatter.getTodayCode()) {
|
||||
updateViewPager()
|
||||
}
|
||||
|
||||
@ -199,11 +199,9 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||
mStoredTextColor = config.textColor
|
||||
mStoredPrimaryColor = config.primaryColor
|
||||
mStoredBackgroundColor = config.backgroundColor
|
||||
mStoredDayCode = getCurrentDayCode()
|
||||
mStoredDayCode = Formatter.getTodayCode()
|
||||
}
|
||||
|
||||
private fun getCurrentDayCode() = Formatter.getDayCodeFromTS((System.currentTimeMillis() / 1000).toInt())
|
||||
|
||||
private fun showViewDialog() {
|
||||
val res = resources
|
||||
val items = arrayListOf(
|
||||
@ -304,6 +302,14 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleParseResult(result: IcsImporter.ImportResult) {
|
||||
toast(when (result) {
|
||||
IcsImporter.ImportResult.IMPORT_OK -> R.string.holidays_imported_successfully
|
||||
IcsImporter.ImportResult.IMPORT_PARTIAL -> R.string.importing_some_holidays_failed
|
||||
else -> R.string.importing_holidays_failed
|
||||
}, Toast.LENGTH_LONG)
|
||||
}
|
||||
|
||||
private fun addBirthdays() {
|
||||
val birthdays = getString(R.string.birthdays)
|
||||
var eventTypeId = dbHelper.getEventTypeIdWithTitle(birthdays)
|
||||
@ -355,14 +361,6 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleParseResult(result: IcsImporter.ImportResult) {
|
||||
toast(when (result) {
|
||||
IcsImporter.ImportResult.IMPORT_OK -> R.string.holidays_imported_successfully
|
||||
IcsImporter.ImportResult.IMPORT_PARTIAL -> R.string.importing_some_holidays_failed
|
||||
else -> R.string.importing_holidays_failed
|
||||
}, Toast.LENGTH_LONG)
|
||||
}
|
||||
|
||||
private fun updateView(view: Int) {
|
||||
calendar_fab.beGoneIf(view == YEARLY_VIEW)
|
||||
mIsMonthSelected = view == MONTHLY_VIEW
|
||||
|
@ -54,6 +54,8 @@ object Formatter {
|
||||
return "$month $day $year"
|
||||
}
|
||||
|
||||
fun getTodayCode() = Formatter.getDayCodeFromTS((System.currentTimeMillis() / 1000).toInt())
|
||||
|
||||
fun getHours(context: Context, dateTime: DateTime) = dateTime.toString(getHourPattern(context))
|
||||
|
||||
fun getTime(context: Context, dateTime: DateTime) = dateTime.toString(getTimePattern(context))
|
||||
|
Loading…
x
Reference in New Issue
Block a user