Applying night mode to DevReportActivity

This commit is contained in:
Torsten Grote
2018-05-26 11:55:22 -03:00
parent 5be672f0e7
commit ba5b2f601b
4 changed files with 25 additions and 8 deletions

View File

@@ -22,7 +22,7 @@ dependencies {
implementation "com.android.support:support-annotations:$supportVersion"
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation('ch.acra:acra:4.8.5') {
implementation('ch.acra:acra:4.9.1') {
exclude module: 'support-v4'
exclude module: 'support-annotations'
}
@@ -61,7 +61,7 @@ dependencyVerification {
'android.arch.lifecycle:viewmodel:1.1.0:viewmodel-1.1.0.aar:6407c93a5ea9850661dca42a0068d6f3deccefd7228ee69bae1c35d70cbc2557',
'backport-util-concurrent:backport-util-concurrent:3.1:backport-util-concurrent-3.1.jar:f5759b7fcdfc83a525a036deedcbd32e5b536b625ebc282426f16ca137eb5902',
'cglib:cglib:3.2.0:cglib-3.2.0.jar:adb13bab79712ad6bdf1bd59f2a3918018a8016e722e8a357065afb9e6690861',
'ch.acra:acra:4.8.5:acra-4.8.5.aar:afd5b28934d5166b55f261c85685ad59e8a4ebe9ca1960906afaa8c76d8dc9eb',
'ch.acra:acra:4.9.1:acra-4.9.1.aar:d2762968c448757a7d6acc9f141881d9632f664988e9723ece33b5f7c79f3bc9',
'classworlds:classworlds:1.1-alpha-2:classworlds-1.1-alpha-2.jar:2bf4e59f3acd106fea6145a9a88fe8956509f8b9c0fdd11eb96fee757269e3f3',
'com.almworks.sqlite4java:sqlite4java:0.282:sqlite4java-0.282.jar:9e1d8dd83ca6003f841e3af878ce2dc7c22497493a7bb6d1b62ec1b0d0a83c05',
'com.android.support.constraint:constraint-layout-solver:1.1.0:constraint-layout-solver-1.1.0.jar:fcb4c7d705754ca3d69b1b2c3caf445a425599fda8caabbcf855d98ea0663e4e',

View File

@@ -44,7 +44,6 @@
android:finishOnTaskLaunch="true"
android:label="@string/crash_report_title"
android:launchMode="singleInstance"
android:process=":briar_error_handler"
android:theme="@style/BriarTheme.NoActionBar"
android:windowSoftInputMode="stateHidden">
</activity>

View File

@@ -3,6 +3,7 @@ package org.briarproject.briar.android.reporting;
import android.content.res.Configuration;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
@@ -33,7 +34,7 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.logging.Logger;
import static android.support.v7.app.AppCompatDelegate.MODE_NIGHT_YES;
import static android.os.Build.VERSION.SDK_INT;
import static android.view.View.GONE;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
@@ -84,11 +85,27 @@ public class DevReportActivity extends BaseCrashReportDialog
}
@Override
public void onCreate(Bundle state) {
getDelegate().setLocalNightMode(MODE_NIGHT_YES);
protected void preInit(@Nullable Bundle savedInstanceState) {
super.preInit(savedInstanceState);
getDelegate().installViewFactory();
getDelegate().onCreate(state);
super.onCreate(state);
getDelegate().onCreate(savedInstanceState);
if (getDelegate().applyDayNight()) {
// If DayNight has been applied, we need to re-apply the theme for
// the changes to take effect. On API 23+, we should bypass
// setTheme(), which will no-op if the theme ID is identical to the
// current theme ID.
int theme = R.style.BriarTheme_NoActionBar;
if (SDK_INT >= 23) {
onApplyThemeResource(getTheme(), theme, false);
} else {
setTheme(theme);
}
}
}
@Override
public void init(Bundle state) {
super.init(state);
getDelegate().setContentView(R.layout.activity_dev_report);

View File

@@ -164,6 +164,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
// activate new theme
UiUtils.setTheme(getActivity(), (String) newValue);
// bring up parent activity, so it can change its theme as well
// upstream bug: https://issuetracker.google.com/issues/38352704
Intent intent =
new Intent(getActivity(), NavDrawerActivity.class);
intent.setFlags(