mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
Reset Localizer on account deletion
This commit is contained in:
@@ -20,10 +20,12 @@ public class Localizer {
|
|||||||
// Locking: class
|
// Locking: class
|
||||||
@Nullable
|
@Nullable
|
||||||
private static Localizer INSTANCE;
|
private static Localizer INSTANCE;
|
||||||
|
private final Locale systemLocale;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final Locale locale;
|
private volatile Locale locale;
|
||||||
|
|
||||||
private Localizer(SharedPreferences sharedPreferences) {
|
private Localizer(SharedPreferences sharedPreferences) {
|
||||||
|
systemLocale = Locale.getDefault();
|
||||||
locale = getLocaleFromTag(
|
locale = getLocaleFromTag(
|
||||||
sharedPreferences.getString(LANGUAGE, "default"));
|
sharedPreferences.getString(LANGUAGE, "default"));
|
||||||
}
|
}
|
||||||
@@ -39,6 +41,11 @@ public class Localizer {
|
|||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset to the system locale
|
||||||
|
public synchronized void reset() {
|
||||||
|
locale = systemLocale;
|
||||||
|
}
|
||||||
|
|
||||||
// Get Locale from BCP-47 tag
|
// Get Locale from BCP-47 tag
|
||||||
@Nullable
|
@Nullable
|
||||||
public static Locale getLocaleFromTag(String tag) {
|
public static Locale getLocaleFromTag(String tag) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import android.widget.EditText;
|
|||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
import org.briarproject.briar.R;
|
import org.briarproject.briar.R;
|
||||||
|
import org.briarproject.briar.android.Localizer;
|
||||||
import org.briarproject.briar.android.activity.ActivityComponent;
|
import org.briarproject.briar.android.activity.ActivityComponent;
|
||||||
import org.briarproject.briar.android.activity.BaseActivity;
|
import org.briarproject.briar.android.activity.BaseActivity;
|
||||||
import org.briarproject.briar.android.controller.BriarController;
|
import org.briarproject.briar.android.controller.BriarController;
|
||||||
@@ -105,6 +106,7 @@ public class PasswordActivity extends BaseActivity {
|
|||||||
|
|
||||||
private void deleteAccount() {
|
private void deleteAccount() {
|
||||||
passwordController.deleteAccount(this);
|
passwordController.deleteAccount(this);
|
||||||
|
Localizer.getInstance().reset();
|
||||||
setResult(RESULT_CANCELED);
|
setResult(RESULT_CANCELED);
|
||||||
Intent i = new Intent(this, SetupActivity.class);
|
Intent i = new Intent(this, SetupActivity.class);
|
||||||
i.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
|
i.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
|||||||
Reference in New Issue
Block a user