mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Applying night mode to DevReportActivity
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user