Extract string resources

This commit is contained in:
Mygod
2018-01-13 19:53:34 +08:00
parent a77beb39db
commit 11a1e793c9
8 changed files with 110 additions and 48 deletions

View File

@@ -5,6 +5,7 @@ import android.app.Application
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.SharedPreferences
import android.content.res.Configuration
import android.os.Build
import android.preference.PreferenceManager
@@ -16,10 +17,19 @@ class App : Application() {
override fun onCreate() {
super.onCreate()
app = this
updateNotificationChannels()
}
override fun onConfigurationChanged(newConfig: Configuration?) {
super.onConfigurationChanged(newConfig)
updateNotificationChannels()
}
private fun updateNotificationChannels() {
if (Build.VERSION.SDK_INT >= 26) @TargetApi(26) {
val nm = getSystemService(NotificationManager::class.java)
nm.createNotificationChannel(NotificationChannel(RepeaterService.CHANNEL,
"Repeater Service", NotificationManager.IMPORTANCE_LOW))
getText(R.string.notification_channel_repeater), NotificationManager.IMPORTANCE_LOW))
nm.deleteNotificationChannel("hotspot") // remove old service channel
}
}