diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/App.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/App.kt
index 93a89298e..af6b8076c 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/App.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/App.kt
@@ -3,7 +3,9 @@ package com.simplemobiletools.calendar
import android.support.multidex.MultiDexApplication
import com.facebook.stetho.Stetho
import com.simplemobiletools.calendar.BuildConfig.USE_LEAK_CANARY
+import com.simplemobiletools.calendar.extensions.config
import com.squareup.leakcanary.LeakCanary
+import java.util.*
class App : MultiDexApplication() {
override fun onCreate() {
@@ -15,6 +17,12 @@ class App : MultiDexApplication() {
LeakCanary.install(this)
}
+ if (config.useEnglish) {
+ val conf = resources.configuration
+ conf.locale = Locale.ENGLISH
+ resources.updateConfiguration(conf, resources.displayMetrics)
+ }
+
Stetho.initializeWithDefaults(this)
}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/DayActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/DayActivity.kt
index 88349dd30..ec769af61 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/DayActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/DayActivity.kt
@@ -51,6 +51,7 @@ class DayActivity : SimpleActivity(), NavigationListener, ViewPager.OnPageChange
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_day, menu)
+ updateMenuTextSize(resources, menu)
menu.findItem(R.id.filter).isVisible = eventTypeColors.size() > 1 || config.displayEventTypes.isEmpty()
return true
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt
index 7d8b6c17d..fb115e564 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt
@@ -465,6 +465,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_event, menu)
+ updateMenuTextSize(resources, menu)
if (wasActivityInitialized) {
menu.findItem(R.id.delete).isVisible = mDialogTheme != 0 && mEvent.id != 0
menu.findItem(R.id.share).isVisible = mDialogTheme != 0 && mEvent.id != 0
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt
index 9d2024881..f58cd96b1 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt
@@ -53,6 +53,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
private val PREFILLED_WEEKS = 61
private var mIsMonthSelected = false
+ private var mStoredUseEnglish = false
private var mStoredTextColor = 0
private var mStoredBackgroundColor = 0
private var mStoredPrimaryColor = 0
@@ -117,6 +118,11 @@ class MainActivity : SimpleActivity(), NavigationListener {
override fun onResume() {
super.onResume()
+ if (mStoredUseEnglish != config.useEnglish) {
+ restartActivity()
+ return
+ }
+
if (mStoredTextColor != config.textColor || mStoredBackgroundColor != config.backgroundColor || mStoredPrimaryColor != config.primaryColor
|| mStoredDayCode != Formatter.getTodayCode()) {
updateViewPager()
@@ -143,11 +149,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
override fun onPause() {
super.onPause()
- mStoredTextColor = config.textColor
- mStoredIsSundayFirst = config.isSundayFirst
- mStoredBackgroundColor = config.backgroundColor
- mStoredPrimaryColor = config.primaryColor
- mStoredUse24HourFormat = config.use24hourFormat
+ storeStateVariables()
}
override fun onStop() {
@@ -158,9 +160,12 @@ class MainActivity : SimpleActivity(), NavigationListener {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_main, menu)
- menu.findItem(R.id.filter).isVisible = mShouldFilterBeVisible
- menu.findItem(R.id.go_to_today).isVisible = shouldGoToTodayBeVisible()
- menu.findItem(R.id.refresh_caldav_calendars).isVisible = config.caldavSync
+ updateMenuTextSize(resources, menu)
+ menu.apply {
+ findItem(R.id.filter).isVisible = mShouldFilterBeVisible
+ findItem(R.id.go_to_today).isVisible = shouldGoToTodayBeVisible()
+ findItem(R.id.refresh_caldav_calendars).isVisible = config.caldavSync
+ }
return true
}
@@ -191,9 +196,13 @@ class MainActivity : SimpleActivity(), NavigationListener {
}
private fun storeStateVariables() {
- mStoredTextColor = config.textColor
- mStoredPrimaryColor = config.primaryColor
- mStoredBackgroundColor = config.backgroundColor
+ config.apply {
+ mStoredUseEnglish = useEnglish
+ mStoredIsSundayFirst = isSundayFirst
+ mStoredTextColor = textColor
+ mStoredPrimaryColor = primaryColor
+ mStoredBackgroundColor = backgroundColor
+ }
mStoredDayCode = Formatter.getTodayCode()
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt
index ba23758c2..97ca4a635 100644
--- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt
@@ -18,13 +18,11 @@ import com.simplemobiletools.calendar.helpers.FONT_SIZE_MEDIUM
import com.simplemobiletools.calendar.helpers.FONT_SIZE_SMALL
import com.simplemobiletools.calendar.models.EventType
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
-import com.simplemobiletools.commons.extensions.beGone
-import com.simplemobiletools.commons.extensions.beVisibleIf
-import com.simplemobiletools.commons.extensions.toast
-import com.simplemobiletools.commons.extensions.updateTextColors
+import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_CALENDAR
import com.simplemobiletools.commons.models.RadioItem
import kotlinx.android.synthetic.main.activity_settings.*
+import java.util.*
class SettingsActivity : SimpleActivity() {
private val GET_RINGTONE_URI = 1
@@ -44,6 +42,7 @@ class SettingsActivity : SimpleActivity() {
super.onResume()
setupCustomizeColors()
+ setupUseEnglish()
setupManageEventTypes()
setupHourFormat()
setupSundayFirst()
@@ -84,6 +83,16 @@ class SettingsActivity : SimpleActivity() {
}
}
+ private fun setupUseEnglish() {
+ settings_use_english_holder.beVisibleIf(config.wasUseEnglishToggled || Locale.getDefault().language != "en")
+ settings_use_english.isChecked = config.useEnglish
+ settings_use_english_holder.setOnClickListener {
+ settings_use_english.toggle()
+ config.useEnglish = settings_use_english.isChecked
+ useEnglishToggled()
+ }
+ }
+
private fun setupManageEventTypes() {
settings_manage_event_types_holder.setOnClickListener {
startActivity(Intent(this, ManageEventTypesActivity::class.java))
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index c4d1837d2..0dc111729 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -49,6 +49,26 @@
+
+
+
+
+
+