Localize crash screen in language defined in settings

parent c14ebe82
...@@ -24,6 +24,7 @@ import org.briarproject.briar.android.controller.ActivityLifecycleController; ...@@ -24,6 +24,7 @@ import org.briarproject.briar.android.controller.ActivityLifecycleController;
import org.briarproject.briar.android.forum.ForumModule; import org.briarproject.briar.android.forum.ForumModule;
import org.briarproject.briar.android.fragment.BaseFragment; import org.briarproject.briar.android.fragment.BaseFragment;
import org.briarproject.briar.android.fragment.ScreenFilterDialogFragment; import org.briarproject.briar.android.fragment.ScreenFilterDialogFragment;
import org.briarproject.briar.android.reporting.DevReportActivity;
import org.briarproject.briar.android.util.UiUtils; import org.briarproject.briar.android.util.UiUtils;
import org.briarproject.briar.android.widget.TapSafeFrameLayout; import org.briarproject.briar.android.widget.TapSafeFrameLayout;
import org.briarproject.briar.android.widget.TapSafeFrameLayout.OnTapFilteredListener; import org.briarproject.briar.android.widget.TapSafeFrameLayout.OnTapFilteredListener;
...@@ -42,6 +43,10 @@ import static android.view.WindowManager.LayoutParams.FLAG_SECURE; ...@@ -42,6 +43,10 @@ import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
import static android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT; import static android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT;
import static org.briarproject.briar.android.TestingConstants.PREVENT_SCREENSHOTS; import static org.briarproject.briar.android.TestingConstants.PREVENT_SCREENSHOTS;
/**
* Warning: Some activities don't extend {@link BaseActivity}.
* E.g. {@link DevReportActivity}
*/
public abstract class BaseActivity extends AppCompatActivity public abstract class BaseActivity extends AppCompatActivity
implements DestroyableContext, OnTapFilteredListener { implements DestroyableContext, OnTapFilteredListener {
......
package org.briarproject.briar.android.reporting; package org.briarproject.briar.android.reporting;
import android.content.Context;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
...@@ -24,6 +25,7 @@ import org.acra.collector.CrashReportData; ...@@ -24,6 +25,7 @@ import org.acra.collector.CrashReportData;
import org.acra.dialog.BaseCrashReportDialog; import org.acra.dialog.BaseCrashReportDialog;
import org.acra.file.CrashReportPersister; import org.acra.file.CrashReportPersister;
import org.briarproject.briar.R; import org.briarproject.briar.R;
import org.briarproject.briar.android.Localizer;
import org.briarproject.briar.android.util.UserFeedback; import org.briarproject.briar.android.util.UserFeedback;
import java.io.File; import java.io.File;
...@@ -38,6 +40,7 @@ import static android.os.Build.VERSION.SDK_INT; ...@@ -38,6 +40,7 @@ import static android.os.Build.VERSION.SDK_INT;
import static android.view.View.GONE; import static android.view.View.GONE;
import static android.view.View.INVISIBLE; import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE; import static android.view.View.VISIBLE;
import static android.view.WindowManager.LayoutParams.FLAG_SECURE;
import static android.view.inputmethod.InputMethodManager.SHOW_FORCED; import static android.view.inputmethod.InputMethodManager.SHOW_FORCED;
import static java.util.logging.Level.WARNING; import static java.util.logging.Level.WARNING;
import static org.acra.ACRAConstants.EXTRA_REPORT_FILE; import static org.acra.ACRAConstants.EXTRA_REPORT_FILE;
...@@ -47,6 +50,7 @@ import static org.acra.ReportField.APP_VERSION_NAME; ...@@ -47,6 +50,7 @@ import static org.acra.ReportField.APP_VERSION_NAME;
import static org.acra.ReportField.PACKAGE_NAME; import static org.acra.ReportField.PACKAGE_NAME;
import static org.acra.ReportField.REPORT_ID; import static org.acra.ReportField.REPORT_ID;
import static org.acra.ReportField.STACK_TRACE; import static org.acra.ReportField.STACK_TRACE;
import static org.briarproject.briar.android.TestingConstants.PREVENT_SCREENSHOTS;
public class DevReportActivity extends BaseCrashReportDialog public class DevReportActivity extends BaseCrashReportDialog
implements CompoundButton.OnCheckedChangeListener { implements CompoundButton.OnCheckedChangeListener {
...@@ -107,6 +111,8 @@ public class DevReportActivity extends BaseCrashReportDialog ...@@ -107,6 +111,8 @@ public class DevReportActivity extends BaseCrashReportDialog
public void init(Bundle state) { public void init(Bundle state) {
super.init(state); super.init(state);
if (PREVENT_SCREENSHOTS) getWindow().addFlags(FLAG_SECURE);
getDelegate().setContentView(R.layout.activity_dev_report); getDelegate().setContentView(R.layout.activity_dev_report);
Toolbar tb = findViewById(R.id.toolbar); Toolbar tb = findViewById(R.id.toolbar);
...@@ -166,6 +172,12 @@ public class DevReportActivity extends BaseCrashReportDialog ...@@ -166,6 +172,12 @@ public class DevReportActivity extends BaseCrashReportDialog
requestReport.setVisibility(VISIBLE); requestReport.setVisibility(VISIBLE);
} }
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(
Localizer.getInstance().setLocale(base));
}
@Override @Override
public void onPostCreate(Bundle state) { public void onPostCreate(Bundle state) {
super.onPostCreate(state); super.onPostCreate(state);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment