mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 20:45:17 +00:00
Convert BaseActivity to Kotlin
This commit is contained in:
parent
c9f5810ea0
commit
191c287bf7
@ -1,32 +0,0 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import org.session.libsession.messaging.MessagingModuleConfiguration;
|
||||
import org.session.libsession.utilities.TextSecurePreferences;
|
||||
import org.session.libsession.utilities.dynamiclanguage.DynamicLanguageActivityHelper;
|
||||
import org.session.libsession.utilities.dynamiclanguage.DynamicLanguageContextWrapper;
|
||||
|
||||
import network.loki.messenger.R;
|
||||
|
||||
public abstract class BaseActivity extends FragmentActivity {
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
DynamicLanguageActivityHelper.recreateIfNotInCorrectLanguage(this, MessagingModuleConfiguration.getShared().getPrefs().getLanguage());
|
||||
String name = getResources().getString(R.string.app_name);
|
||||
Bitmap icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher_foreground);
|
||||
int color = getResources().getColor(R.color.app_icon_background);
|
||||
setTaskDescription(new ActivityManager.TaskDescription(name, icon, color));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
super.attachBaseContext(DynamicLanguageContextWrapper.updateContext(newBase, MessagingModuleConfiguration.getShared().getPrefs().getLanguage()));
|
||||
}
|
||||
}
|
33
app/src/main/java/org/thoughtcrime/securesms/BaseActivity.kt
Normal file
33
app/src/main/java/org/thoughtcrime/securesms/BaseActivity.kt
Normal file
@ -0,0 +1,33 @@
|
||||
package org.thoughtcrime.securesms
|
||||
|
||||
import android.app.ActivityManager.TaskDescription
|
||||
import android.content.Context
|
||||
import android.graphics.BitmapFactory
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsession.messaging.MessagingModuleConfiguration.Companion.shared
|
||||
import org.session.libsession.utilities.dynamiclanguage.DynamicLanguageActivityHelper
|
||||
import org.session.libsession.utilities.dynamiclanguage.DynamicLanguageContextWrapper
|
||||
|
||||
abstract class BaseActivity : FragmentActivity() {
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
DynamicLanguageActivityHelper.recreateIfNotInCorrectLanguage(
|
||||
this,
|
||||
shared.prefs.getLanguage()
|
||||
)
|
||||
val name = resources.getString(R.string.app_name)
|
||||
val icon = BitmapFactory.decodeResource(resources, R.drawable.ic_launcher_foreground)
|
||||
val color = resources.getColor(R.color.app_icon_background)
|
||||
setTaskDescription(TaskDescription(name, icon, color))
|
||||
}
|
||||
|
||||
override fun attachBaseContext(newBase: Context) {
|
||||
super.attachBaseContext(
|
||||
DynamicLanguageContextWrapper.updateContext(
|
||||
newBase,
|
||||
shared.prefs.getLanguage()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user