Update calculator widget on locale change

This is required to toggle the digit separators automatically on locale change
This commit is contained in:
Naveen
2022-06-10 10:00:29 +05:30
parent f229eac421
commit e167e5a353
2 changed files with 25 additions and 0 deletions

View File

@@ -80,6 +80,14 @@
android:resource="@xml/widget_info" /> android:resource="@xml/widget_info" />
</receiver> </receiver>
<receiver
android:name=".receivers.LocaleChangeReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.LOCALE_CHANGED" />
</intent-filter>
</receiver>
<activity-alias <activity-alias
android:name=".activities.SplashActivity.Red" android:name=".activities.SplashActivity.Red"
android:enabled="false" android:enabled="false"

View File

@@ -0,0 +1,17 @@
package com.simplemobiletools.calculator.receivers
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.simplemobiletools.calculator.extensions.updateWidgets
class LocaleChangeReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if (Intent.ACTION_LOCALE_CHANGED == intent.action) {
context.updateWidgets()
}
}
}