X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2Ffragments%2FAboutTabFragment.java;h=8c48825469861e614119463028bda7c1ed602195;hp=5c811e8d42ef1e6202f0e1adbd8f3dfb41054976;hb=f0393ca22075be3e5fe9199c7db87381256236fa;hpb=54c70ca476ba2f53ae274df1ac725be3919e8f56 diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTabFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTabFragment.java index 5c811e8d..8c488254 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTabFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutTabFragment.java @@ -21,10 +21,12 @@ package com.stoutner.privacybrowser.fragments; import android.annotation.SuppressLint; import android.content.Context; +import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.pm.Signature; import android.os.Build; import android.os.Bundle; +import android.preference.PreferenceManager; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.style.ForegroundColorSpan; @@ -92,6 +94,12 @@ public class AboutTabFragment extends Fragment { Context context = getContext(); assert context != null; + // Get a handle for the shared preferences. + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); + + // Get the theme preference. + boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false); + // Load the tabs. Tab numbers start at 0. if (tabNumber == 0) { // Load the about tab. // Setting false at the end of inflater.inflate does not attach the inflated layout as a child of container. The fragment will take care of attaching the root automatically. @@ -201,7 +209,7 @@ public class AboutTabFragment extends Fragment { ForegroundColorSpan blueColorSpan; // Set `blueColorSpan` according to the theme. We have to use the deprecated `getColor()` until API >= 23. - if (MainWebViewActivity.darkTheme) { + if (darkTheme) { //noinspection deprecation blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_400)); } else { @@ -346,7 +354,7 @@ public class AboutTabFragment extends Fragment { WebView tabWebView = (WebView) tabLayout; // Load the tabs according to the theme. - if (MainWebViewActivity.darkTheme) { // The dark theme is applied. + if (darkTheme) { // The dark theme is applied. // Set the background color. The deprecated `.getColor()` must be used until the minimum API >= 23. //noinspection deprecation tabWebView.setBackgroundColor(getResources().getColor(R.color.gray_850));