diff --git a/app/src/main/java/com/topjohnwu/magisk/AboutActivity.java b/app/src/main/java/com/topjohnwu/magisk/AboutActivity.java index 7cf2fdad8..2847159f9 100644 --- a/app/src/main/java/com/topjohnwu/magisk/AboutActivity.java +++ b/app/src/main/java/com/topjohnwu/magisk/AboutActivity.java @@ -4,18 +4,21 @@ import android.content.Intent; import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.preference.PreferenceManager; import android.support.annotation.Nullable; import android.support.v7.app.ActionBar; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.text.Html; +import android.text.Spanned; import android.text.TextUtils; import android.text.method.LinkMovementMethod; import android.view.View; import android.view.WindowManager; import android.widget.TextView; +import com.topjohnwu.magisk.utils.Logger; import com.topjohnwu.magisk.utils.RowItem; import java.io.IOException; @@ -28,7 +31,7 @@ public class AboutActivity extends AppCompatActivity { private static final String SOURCE_CODE_URL = "https://github.com/topjohnwu/MagiskManager"; private static final String XDA_THREAD = "http://forum.xda-developers.com/android/software/mod-magisk-v1-universal-systemless-t3432382"; - + private AlertDialog.Builder builder; @BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.app_version_info) RowItem appVersionInfo; @@ -41,6 +44,11 @@ public class AboutActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); + String theme = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("theme", ""); + Logger.dh("AboutActivity: Theme is " + theme); + if (theme.equals("Dark")) { + setTheme(R.style.AppTheme_dh); + } setContentView(R.layout.activity_about); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); @@ -72,14 +80,24 @@ public class AboutActivity extends AppCompatActivity { } appChangelog.removeSummary(); + if (theme.equals("Dark")) { + builder = new AlertDialog.Builder(this,R.style.AlertDialog_dh); + } else { + builder = new AlertDialog.Builder(this); + } if (changes == null) { appChangelog.setVisibility(View.GONE); } else { - final String finalChanges = changes; + Spanned result; + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { + result = Html.fromHtml(changes,Html.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE); + } else { + result = Html.fromHtml(changes); + } appChangelog.setOnClickListener(v -> { - AlertDialog d = new AlertDialog.Builder(AboutActivity.this) + AlertDialog d = builder .setTitle(R.string.app_changelog) - .setMessage(Html.fromHtml(finalChanges)) + .setMessage(result) .setPositiveButton(android.R.string.ok, null) .create(); @@ -92,9 +110,15 @@ public class AboutActivity extends AppCompatActivity { appDevelopers.removeSummary(); appDevelopers.setOnClickListener(view -> { - AlertDialog d = new AlertDialog.Builder(AboutActivity.this) + Spanned result; + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { + result = Html.fromHtml(getString(R.string.app_developers_),Html.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE); + } else { + result = Html.fromHtml(getString(R.string.app_developers_)); + } + AlertDialog d = builder .setTitle(R.string.app_developers) - .setMessage(Html.fromHtml(getString(R.string.app_developers_))) + .setMessage(result) .setPositiveButton(android.R.string.ok, null) .create(); @@ -142,6 +166,5 @@ public class AboutActivity extends AppCompatActivity { setTitle("About"); - getWindow().setStatusBarColor(getResources().getColor(R.color.primary_dark)); - } + } } diff --git a/app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java b/app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java index 7079479e5..1ceb9770d 100644 --- a/app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/MagiskFragment.java @@ -6,6 +6,7 @@ import android.content.res.TypedArray; import android.graphics.Color; import android.os.AsyncTask; import android.os.Bundle; +import android.preference.PreferenceManager; import android.support.annotation.Nullable; import android.support.v4.content.FileProvider; @@ -52,6 +53,7 @@ public class MagiskFragment extends Fragment { private int colorOK, colorWarn, colorNeutral; int statusOK = R.drawable.ic_check_circle; int statusUnknown = R.drawable.ic_help; + private AlertDialog.Builder builder; @Nullable @Override @@ -91,6 +93,12 @@ public class MagiskFragment extends Fragment { @Override protected void onPostExecute(Void v) { super.onPostExecute(v); + String theme = PreferenceManager.getDefaultSharedPreferences(getActivity()).getString("theme", ""); + if (theme.equals("Dark")) { + builder = new AlertDialog.Builder(getActivity(),R.style.AlertDialog_dh); + } else { + builder = new AlertDialog.Builder(getActivity()); + } if (Utils.magiskVersion == -1) { magiskStatusContainer.setBackgroundColor(grey500); @@ -123,7 +131,7 @@ public class MagiskFragment extends Fragment { magiskCheckUpdatesIcon.setImageResource(R.drawable.ic_file_download); magiskCheckUpdatesStatus.setText(getString(R.string.magisk_update_available, String.valueOf(Utils.remoteMagiskVersion))); magiskCheckUpdatesStatus.setTextColor(colorNeutral); - magiskUpdateView.setOnClickListener(view -> new AlertDialog.Builder(getActivity()) + magiskUpdateView.setOnClickListener(view -> builder .setTitle(getString(R.string.update_title, getString(R.string.magisk))) .setMessage(getString(R.string.update_msg, getString(R.string.magisk), String.valueOf(Utils.remoteMagiskVersion), Utils.magiskChangelog)) .setCancelable(true) @@ -150,7 +158,7 @@ public class MagiskFragment extends Fragment { appCheckUpdatesIcon.setImageResource(R.drawable.ic_file_download); appCheckUpdatesStatus.setText(getString(R.string.app_update_available, String.valueOf(Utils.remoteAppVersion))); appCheckUpdatesStatus.setTextColor(colorNeutral); - appUpdateView.setOnClickListener(view -> new AlertDialog.Builder(getActivity()) + appUpdateView.setOnClickListener(view -> builder .setTitle(getString(R.string.update_title, getString(R.string.app_name))) .setMessage(getString(R.string.update_msg, getString(R.string.app_name), String.valueOf(Utils.remoteAppVersion), Utils.appChangelog)) .setCancelable(true) diff --git a/app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java b/app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java index e6f63a930..9e7b5823c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java +++ b/app/src/main/java/com/topjohnwu/magisk/ModulesAdapter.java @@ -127,8 +127,13 @@ public class ModulesAdapter extends RecyclerView.Adapter Shell.su("reboot")) diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/WebWindow.java b/app/src/main/java/com/topjohnwu/magisk/utils/WebWindow.java index a1cb40831..4249245ca 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/WebWindow.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/WebWindow.java @@ -1,16 +1,24 @@ package com.topjohnwu.magisk.utils; import android.content.Context; +import android.preference.PreferenceManager; import android.support.v7.app.AlertDialog; import android.webkit.WebResourceRequest; import android.webkit.WebView; import android.webkit.WebViewClient; +import com.topjohnwu.magisk.R; public class WebWindow { public WebWindow(String title, String url, Context context) { - AlertDialog.Builder alert = new AlertDialog.Builder(context); + AlertDialog.Builder alert; + String theme = PreferenceManager.getDefaultSharedPreferences(context).getString("theme", ""); + if (theme.equals("Dark")) { + alert = new AlertDialog.Builder(context, R.style.AlertDialog_dh); + } else { + alert = new AlertDialog.Builder(context); + } alert.setTitle(title); WebView wv = new WebView(context); diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index b0249a45c..3a60caf49 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -26,6 +26,7 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginBottom="8dp" + style="?attr/cardStyle" app:cardUseCompatPadding="true"> @android:color/transparent @color/dh_primary_text @color/dh_primary_text - @style/YourAlertDialogTheme + @style/AlertDialog.dh + @style/AlertDialog.dh @color/dh_alertOk @color/dh_alertWarn @color/dh_alertFail @@ -60,17 +61,49 @@ - + + + + + + +