[app] Harmonize card color (#1213)

* [app] Harmonize card color

* [app] Fix recyclerview paddings

* [app] Fix styles

* [app] Use MaterialAlertDialog

* [app] Fix icon button style

* [app] Update appbar to MD3 style

* [app] Use new DynamicColors

* [app] Fix color picker style
This commit is contained in:
tehcneko 2021-10-03 19:56:18 +08:00 committed by GitHub
parent 2d8820b490
commit cb43a9342e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 179 additions and 530 deletions

View File

@ -35,6 +35,7 @@ import android.util.Log;
import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager;
import com.google.android.material.color.DynamicColors;
import com.google.gson.JsonParser;
import org.lsposed.hiddenapibypass.HiddenApiBypass;
@ -161,6 +162,9 @@ public class App extends Application {
DayNightDelegate.setApplicationContext(this);
DayNightDelegate.setDefaultNightMode(ThemeUtil.getDarkTheme());
LocaleDelegate.setDefaultLocale(getLocale());
if (ThemeUtil.isSystemAccent()) {
DynamicColors.applyToActivitiesIfAvailable(this);
}
registerReceiver(new BroadcastReceiver() {
@Override

View File

@ -21,7 +21,6 @@
package org.lsposed.manager;
import android.os.IBinder;
import android.widget.Toast;
import org.lsposed.manager.receivers.LSPManagerServiceHolder;

View File

@ -54,7 +54,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.SearchView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;
@ -62,6 +61,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.transition.Transition;
import com.google.android.material.checkbox.MaterialCheckBox;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import org.lsposed.lspd.models.Application;
@ -226,7 +226,7 @@ public class ScopeAdapter extends RecyclerView.Adapter<ScopeAdapter.ViewHolder>
int itemId = item.getItemId();
if (itemId == R.id.use_recommended) {
if (!checkedList.isEmpty()) {
new AlertDialog.Builder(activity)
new MaterialAlertDialogBuilder(activity)
.setMessage(R.string.use_recommended_message)
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
checkRecommended();
@ -295,7 +295,7 @@ public class ScopeAdapter extends RecyclerView.Adapter<ScopeAdapter.ViewHolder>
if (info.packageName.equals("android")) {
ConfigManager.reboot(false);
} else {
new AlertDialog.Builder(activity)
new MaterialAlertDialogBuilder(activity)
.setTitle(R.string.force_stop_dlg_title)
.setMessage(R.string.force_stop_dlg_text)
.setPositiveButton(android.R.string.ok, (dialog, which) -> ConfigManager.forceStopPackage(info.packageName, info.uid / 100000))
@ -618,7 +618,7 @@ public class ScopeAdapter extends RecyclerView.Adapter<ScopeAdapter.ViewHolder>
public void onBackPressed() {
fragment.searchView.clearFocus();
if (!refreshing && fragment.binding.masterSwitch.isChecked() && checkedList.isEmpty()) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(activity);
builder.setMessage(!recommendedList.isEmpty() ? R.string.no_scope_selected_has_recommended : R.string.no_scope_selected);
if (!recommendedList.isEmpty()) {
builder.setPositiveButton(android.R.string.ok, (dialog, which) -> {

View File

@ -22,13 +22,13 @@ package org.lsposed.manager.ui.activity.base;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import org.lsposed.manager.BuildConfig;
import org.lsposed.manager.ConfigManager;
@ -49,7 +49,7 @@ public class BaseActivity extends MaterialActivity {
if (!ConfigManager.isBinderAlive()) return;
var version = ConfigManager.getXposedVersionName();
if (BuildConfig.VERSION_NAME.equals(version)) return;
new AlertDialog.Builder(this)
new MaterialAlertDialogBuilder(this)
.setMessage(BuildConfig.VERSION_NAME.compareTo(version) > 0 ?
R.string.outdated_core : R.string.outdated_manager)
.setPositiveButton(android.R.string.ok, (dialog, id) -> {

View File

@ -30,10 +30,12 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.core.os.BuildCompat;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import java.lang.reflect.Method;
@SuppressWarnings({"JavaReflectionMemberAccess", "ConstantConditions"})
public class BlurBehindDialogBuilder extends AlertDialog.Builder {
public class BlurBehindDialogBuilder extends MaterialAlertDialogBuilder {
private static final boolean supportBlur = getSystemProperty("ro.surface_flinger.supports_background_blur", false) && !getSystemProperty("persist.sys.sf.disable_blurs", false);
public BlurBehindDialogBuilder(@NonNull Context context) {

View File

@ -66,7 +66,8 @@ public class AppListFragment extends BaseFragment {
if (module == null) {
return binding.getRoot();
}
binding.appBar.setRaised(true);
binding.appBar.setLiftable(true);
binding.appBar.setLifted(true);
String title;
if (module.userId != 0) {
title = String.format(Locale.US, "%s (%d)", module.getAppName(), module.userId);

View File

@ -31,10 +31,10 @@ import android.view.LayoutInflater;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatDialogFragment;
import androidx.fragment.app.FragmentManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import org.lsposed.manager.App;
@ -76,7 +76,7 @@ public class CompileDialogFragment extends AppCompatDialogFragment {
FragmentCompileDialogBinding binding = FragmentCompileDialogBinding.inflate(LayoutInflater.from(requireActivity()), null, false);
final PackageManager pm = requireContext().getPackageManager();
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity())
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireActivity())
.setIcon(appInfo.loadIcon(pm))
.setTitle(appInfo.loadLabel(pm))
.setView(binding.getRoot());

View File

@ -31,6 +31,7 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.core.text.HtmlCompat;
import com.google.android.material.color.MaterialColors;
import com.google.android.material.snackbar.Snackbar;
import org.lsposed.manager.App;
@ -60,7 +61,8 @@ public class HomeFragment extends BaseFragment {
setupToolbar(binding.toolbar, getString(R.string.app_name), R.menu.menu_home);
binding.toolbar.setNavigationIcon(null);
binding.nestedScrollView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> binding.appBar.setRaised(!top));
binding.appBar.setLiftable(true);
binding.nestedScrollView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> binding.appBar.setLifted(!top));
Activity activity = requireActivity();
binding.status.setOnClickListener(v -> {
@ -155,10 +157,10 @@ public class HomeFragment extends BaseFragment {
binding.statusIcon.setImageResource(R.drawable.ic_round_error_outline_24);
Snackbar.make(binding.snackbar, R.string.lsposed_not_active, Snackbar.LENGTH_INDEFINITE).show();
}
binding.status.setCardBackgroundColor(cardBackgroundColor);
binding.status.setCardBackgroundColor(MaterialColors.harmonizeWithPrimary(activity, cardBackgroundColor));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
binding.status.setOutlineSpotShadowColor(cardBackgroundColor);
binding.status.setOutlineAmbientShadowColor(cardBackgroundColor);
binding.status.setOutlineSpotShadowColor(MaterialColors.harmonizeWithPrimary(activity, cardBackgroundColor));
binding.status.setOutlineAmbientShadowColor(MaterialColors.harmonizeWithPrimary(activity, cardBackgroundColor));
}
}

View File

@ -45,6 +45,7 @@ import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;
@ -70,6 +71,8 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import rikka.core.os.FileUtils;
import rikka.core.util.ResourceUtils;
import rikka.insets.WindowInsetsHelperKt;
import rikka.recyclerview.RecyclerViewKt;
@SuppressLint("NotifyDataSetChanged")
@ -105,8 +108,11 @@ public class LogsFragment extends BaseFragment {
binding = FragmentLogsBinding.inflate(inflater, container, false);
binding.getRoot().bringChildToFront(binding.appBar);
setupToolbar(binding.toolbar, R.string.Logs, R.menu.menu_logs);
binding.recyclerView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> binding.appBar.setRaised(!top));
binding.appBar.setLiftable(true);
binding.recyclerView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> binding.appBar.setLifted(!top));
int height = ResourceUtils.resolveDimensionPixelOffset(requireActivity().getTheme(), androidx.appcompat.R.attr.actionBarSize, 0)
+ getResources().getDimensionPixelOffset(R.dimen.tab_layout_height);
WindowInsetsHelperKt.setInitialPadding(binding.recyclerView, 0, height, 0, 0);
binding.slidingTabs.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
@ -182,7 +188,7 @@ public class LogsFragment extends BaseFragment {
new LogsReader().execute(parcelFileDescriptor.getFileDescriptor());
} else {
binding.slidingTabs.selectTab(binding.slidingTabs.getTabAt(0));
new AlertDialog.Builder(requireActivity())
new MaterialAlertDialogBuilder(requireActivity())
.setMessage(R.string.verbose_log_not_avaliable)
.setPositiveButton(android.R.string.ok, null)
.show();
@ -250,7 +256,7 @@ public class LogsFragment extends BaseFragment {
@Override
protected void onPreExecute() {
mProgressDialog = new AlertDialog.Builder(requireActivity()).create();
mProgressDialog = new MaterialAlertDialogBuilder(requireActivity()).create();
mProgressDialog.setMessage(getString(R.string.loading));
mProgressDialog.setCancelable(false);
handler.postDelayed(mRunnable, 300);

View File

@ -50,7 +50,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.SearchView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
@ -63,6 +62,7 @@ import androidx.viewpager2.widget.ViewPager2;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.transition.Transition;
import com.google.android.material.checkbox.MaterialCheckBox;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
@ -138,6 +138,7 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
binding.getRoot().bringChildToFront(binding.appBar);
setupToolbar(binding.toolbar, R.string.Modules, R.menu.menu_modules);
binding.appBar.setLiftable(true);
binding.viewPager.setAdapter(new PagerAdapter(this));
binding.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override
@ -145,7 +146,7 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
BorderRecyclerView recyclerView = binding.viewPager.findViewWithTag(position);
if (recyclerView != null) {
binding.appBar.setRaised(!recyclerView.getBorderViewDelegate().isShowingTopBorder());
binding.appBar.setLifted(!recyclerView.getBorderViewDelegate().isShowingTopBorder());
}
if (position > 0) {
@ -204,7 +205,7 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
var rv = DialogRecyclerviewBinding.inflate(getLayoutInflater()).getRoot();
rv.setAdapter(pickAdaptor);
rv.setLayoutManager(new LinearLayoutManager(requireActivity()));
var dialog = new AlertDialog.Builder(requireActivity())
var dialog = new MaterialAlertDialogBuilder(requireActivity())
.setTitle(getString(R.string.install_to_user, user.name))
.setView(rv)
.setNegativeButton(android.R.string.cancel, null)
@ -252,7 +253,7 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
}
private void installModuleToUser(ModuleUtil.InstalledModule module, UserInfo user) {
new AlertDialog.Builder(requireActivity())
new MaterialAlertDialogBuilder(requireActivity())
.setTitle(getString(R.string.install_to_user, user.name))
.setMessage(getString(R.string.install_to_user_message, module.getAppName(), user.name))
.setPositiveButton(android.R.string.ok, (dialog, which) ->
@ -301,7 +302,7 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
ConfigManager.startActivityAsUserWithFeature(new Intent(ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", selectedModule.packageName, null)), selectedModule.userId);
return true;
} else if (itemId == R.id.menu_uninstall) {
new AlertDialog.Builder(requireActivity())
new MaterialAlertDialogBuilder(requireActivity())
.setTitle(selectedModule.getAppName())
.setMessage(R.string.module_uninstall_message)
.setPositiveButton(android.R.string.ok, (dialog, which) ->
@ -347,12 +348,16 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
ItemRepoRecyclerviewBinding binding = ItemRepoRecyclerviewBinding.inflate(getLayoutInflater(), container, false);
if (fragment.adapters.size() == 1) {
WindowInsetsHelperKt.setInitialPadding(binding.recyclerView, 0, ResourceUtils.resolveDimensionPixelOffset(requireActivity().getTheme(), androidx.appcompat.R.attr.actionBarSize, 0), 0, 0);
} else {
int height = ResourceUtils.resolveDimensionPixelOffset(requireActivity().getTheme(), androidx.appcompat.R.attr.actionBarSize, 0)
+ getResources().getDimensionPixelOffset(R.dimen.tab_layout_height);
WindowInsetsHelperKt.setInitialPadding(binding.recyclerView, 0, height, 0, 0);
}
binding.recyclerView.setTag(position);
binding.recyclerView.setAdapter(fragment.adapters.get(position));
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(requireActivity());
binding.recyclerView.setLayoutManager(layoutManager);
binding.recyclerView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> fragment.binding.appBar.setRaised(!top));
binding.recyclerView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> fragment.binding.appBar.setLifted(!top));
binding.recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {

View File

@ -104,7 +104,8 @@ public class RepoFragment extends BaseFragment implements RepoLoader.Listener {
binding = FragmentRepoBinding.inflate(getLayoutInflater(), container, false);
binding.getRoot().bringChildToFront(binding.appBar);
setupToolbar(binding.toolbar, R.string.module_repo, R.menu.menu_repo);
binding.recyclerView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> binding.appBar.setRaised(!top));
binding.appBar.setLiftable(true);
binding.recyclerView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> binding.appBar.setLifted(!top));
adapter = new RepoAdapter();
adapter.setHasStableIds(true);
binding.recyclerView.setAdapter(adapter);

View File

@ -39,12 +39,12 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.widget.ViewPager2;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.progressindicator.CircularProgressIndicator;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.tabs.TabLayout;
@ -78,6 +78,7 @@ import okhttp3.Headers;
import okhttp3.Request;
import okhttp3.Response;
import rikka.core.util.ResourceUtils;
import rikka.insets.WindowInsetsHelperKt;
import rikka.recyclerview.RecyclerViewKt;
import rikka.widget.borderview.BorderNestedScrollView;
import rikka.widget.borderview.BorderRecyclerView;
@ -97,6 +98,7 @@ public class RepoItemFragment extends BaseFragment implements RepoLoader.Listene
String moduleName = module.getDescription();
binding.getRoot().bringChildToFront(binding.appBar);
setupToolbar(binding.toolbar, moduleName, R.menu.menu_repo_item);
binding.appBar.setLiftable(true);
binding.toolbar.setSubtitle(modulePackageName);
binding.viewPager.setAdapter(new PagerAdapter());
binding.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@ -105,7 +107,7 @@ public class RepoItemFragment extends BaseFragment implements RepoLoader.Listene
BorderView borderView = binding.viewPager.findViewWithTag(position);
if (borderView != null) {
binding.appBar.setRaised(!borderView.getBorderViewDelegate().isShowingTopBorder());
binding.appBar.setLifted(!borderView.getBorderViewDelegate().isShowingTopBorder());
}
}
});
@ -374,7 +376,7 @@ public class RepoItemFragment extends BaseFragment implements RepoLoader.Listene
holder.viewAssets.setOnClickListener(v -> {
ArrayList<String> names = new ArrayList<>();
assets.forEach(releaseAsset -> names.add(releaseAsset.getName()));
new AlertDialog.Builder(requireActivity())
new MaterialAlertDialogBuilder(requireActivity())
.setItems(names.toArray(new String[0]), (dialog, which) -> NavUtil.startURL(requireActivity(), assets.get(which).getDownloadUrl()))
.show();
});
@ -441,7 +443,7 @@ public class RepoItemFragment extends BaseFragment implements RepoLoader.Listene
public void onBindViewHolder(@NonNull PagerAdapter.ViewHolder holder, int position) {
switch (position) {
case 0:
holder.scrollView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> binding.appBar.setRaised(!top));
holder.scrollView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> binding.appBar.setLifted(!top));
holder.scrollView.setTag(position);
if (module != null)
renderGithubMarkdown(holder.webView, module.getReadmeHTML());
@ -453,9 +455,12 @@ public class RepoItemFragment extends BaseFragment implements RepoLoader.Listene
} else {
holder.recyclerView.setAdapter(new InformationAdapter(module));
}
int height = ResourceUtils.resolveDimensionPixelOffset(requireActivity().getTheme(), androidx.appcompat.R.attr.actionBarSize, 0)
+ getResources().getDimensionPixelOffset(R.dimen.tab_layout_height);
WindowInsetsHelperKt.setInitialPadding(holder.recyclerView, 0, height, 0, 0);
holder.recyclerView.setTag(position);
holder.recyclerView.setLayoutManager(new LinearLayoutManager(requireActivity()));
holder.recyclerView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> binding.appBar.setRaised(!top));
holder.recyclerView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> binding.appBar.setLifted(!top));
var insets = requireActivity().getWindow().getDecorView().getRootWindowInsets();
if (insets != null)
holder.recyclerView.onApplyWindowInsets(insets);

View File

@ -40,6 +40,7 @@ import androidx.preference.Preference;
import androidx.preference.SwitchPreference;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.color.DynamicColors;
import com.google.android.material.snackbar.Snackbar;
import com.takisoft.preferencex.PreferenceFragmentCompat;
@ -72,6 +73,7 @@ public class SettingsFragment extends BaseFragment {
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = FragmentSettingsBinding.inflate(inflater, container, false);
binding.getRoot().bringChildToFront(binding.appBar);
binding.appBar.setLiftable(true);
setupToolbar(binding.toolbar, R.string.Settings);
if (savedInstanceState == null) {
getChildFragmentManager().beginTransaction()
@ -227,7 +229,7 @@ public class SettingsFragment extends BaseFragment {
}
SwitchPreference prefFollowSystemAccent = findPreference("follow_system_accent");
if (prefFollowSystemAccent != null && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S || Build.VERSION.SDK_INT == Build.VERSION_CODES.R && Build.VERSION.PREVIEW_SDK_INT != 0)) {
if (prefFollowSystemAccent != null && DynamicColors.isDynamicColorAvailable()) {
if (primary_color != null) {
primary_color.setVisible(!prefFollowSystemAccent.isChecked());
}
@ -302,7 +304,7 @@ public class SettingsFragment extends BaseFragment {
recyclerView.getBorderViewDelegate().setBorderVisibilityChangedListener((top, oldTop, bottom, oldBottom) -> {
SettingsFragment fragment = (SettingsFragment) getParentFragment();
if (fragment != null) {
fragment.binding.appBar.setRaised(!top);
fragment.binding.appBar.setLifted(!top);
}
});
return recyclerView;

View File

@ -19,22 +19,68 @@
package org.lsposed.manager.util.theme;
import static com.google.android.material.theme.overlay.MaterialThemeOverlay.wrap;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.View;
import android.view.Window;
import androidx.annotation.AttrRes;
import androidx.annotation.NonNull;
import androidx.annotation.StyleRes;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.core.view.ViewCompat;
import androidx.preference.PreferenceDialogFragmentCompat;
import com.google.android.material.color.MaterialColors;
import com.google.android.material.dialog.InsetDialogOnTouchListener;
import com.google.android.material.dialog.MaterialDialogs;
import com.google.android.material.resources.MaterialAttributes;
import com.google.android.material.shape.MaterialShapeDrawable;
import com.takisoft.colorpicker.ColorPickerDialog;
import com.takisoft.colorpicker.OnColorSelectedListener;
@SuppressLint("RestrictedApi")
public class ThemeColorPreferenceDialogFragmentCompat extends PreferenceDialogFragmentCompat implements OnColorSelectedListener {
private int pickedColor;
ThemeUtil.CustomThemeColors[] themeColors;
private int[] colors;
@AttrRes
private static final int DEF_STYLE_ATTR = com.google.android.material.R.attr.alertDialogStyle;
@StyleRes
private static final int DEF_STYLE_RES = com.google.android.material.R.style.MaterialAlertDialog_MaterialComponents;
@AttrRes
private static final int MATERIAL_ALERT_DIALOG_THEME_OVERLAY = com.google.android.material.R.attr.materialAlertDialogTheme;
private static int getMaterialAlertDialogThemeOverlay(@NonNull Context context) {
TypedValue materialAlertDialogThemeOverlay =
MaterialAttributes.resolve(context, MATERIAL_ALERT_DIALOG_THEME_OVERLAY);
if (materialAlertDialogThemeOverlay == null) {
return 0;
}
return materialAlertDialogThemeOverlay.data;
}
private static Context createMaterialAlertDialogThemedContext(@NonNull Context context) {
int themeOverlayId = getMaterialAlertDialogThemeOverlay(context);
Context themedContext = wrap(context, null, DEF_STYLE_ATTR, DEF_STYLE_RES);
if (themeOverlayId == 0) {
return themedContext;
}
return new ContextThemeWrapper(themedContext, themeOverlayId);
}
@NonNull
@Override
@ -48,8 +94,9 @@ public class ThemeColorPreferenceDialogFragmentCompat extends PreferenceDialogFr
for (int i = 0; i < themeColors.length; i++) {
colors[i] = activity.getColor(themeColors[i].getResourceId());
}
Context context = createMaterialAlertDialogThemedContext(activity);
ColorPickerDialog.Params params = new ColorPickerDialog.Params.Builder(activity)
ColorPickerDialog.Params params = new ColorPickerDialog.Params.Builder(context)
.setSelectedColor(selectedColor)
.setColors(colors)
.setSize(ColorPickerDialog.SIZE_SMALL)
@ -57,8 +104,40 @@ public class ThemeColorPreferenceDialogFragmentCompat extends PreferenceDialogFr
.setColumns(0)
.build();
ColorPickerDialog dialog = new ColorPickerDialog(activity, this, params);
Resources.Theme theme = context.getTheme();
Rect backgroundInsets = MaterialDialogs.getDialogBackgroundInsets(context, DEF_STYLE_ATTR, DEF_STYLE_RES);
int surfaceColor =
MaterialColors.getColor(context, com.google.android.material.R.attr.colorSurface, getClass().getCanonicalName());
MaterialShapeDrawable materialShapeDrawable =
new MaterialShapeDrawable(context, null, DEF_STYLE_ATTR, DEF_STYLE_RES);
materialShapeDrawable.initializeElevationOverlay(context);
materialShapeDrawable.setFillColor(ColorStateList.valueOf(surfaceColor));
// dialogCornerRadius first appeared in Android Pie
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
TypedValue dialogCornerRadiusValue = new TypedValue();
theme.resolveAttribute(android.R.attr.dialogCornerRadius, dialogCornerRadiusValue, true);
float dialogCornerRadius =
dialogCornerRadiusValue.getDimension(getContext().getResources().getDisplayMetrics());
if (dialogCornerRadiusValue.type == TypedValue.TYPE_DIMENSION && dialogCornerRadius >= 0) {
materialShapeDrawable.setCornerSize(dialogCornerRadius);
}
}
ColorPickerDialog dialog = new ColorPickerDialog(context, this, params);
dialog.setTitle(pref.getDialogTitle());
Window window = dialog.getWindow();
/* {@link Window#getDecorView()} should be called before any changes are made to the Window
* as it locks in attributes and affects layout. */
View decorView = window.getDecorView();
if (materialShapeDrawable instanceof MaterialShapeDrawable) {
((MaterialShapeDrawable) materialShapeDrawable).setElevation(ViewCompat.getElevation(decorView));
}
Drawable insetDrawable = MaterialDialogs.insetDrawable(materialShapeDrawable, backgroundInsets);
window.setBackgroundDrawable(insetDrawable);
decorView.setOnTouchListener(new InsetDialogOnTouchListener(dialog, backgroundInsets));
return dialog;
}

View File

@ -21,11 +21,12 @@ package org.lsposed.manager.util.theme;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import androidx.annotation.ColorRes;
import androidx.annotation.StyleRes;
import com.google.android.material.color.DynamicColors;
import org.lsposed.manager.App;
import org.lsposed.manager.R;
@ -74,7 +75,7 @@ public class ThemeUtil {
return preferences.getBoolean("black_dark_theme", false);
}
private static boolean isSystemAccent() {
public static boolean isSystemAccent() {
return preferences.getBoolean("follow_system_accent", true);
}
@ -98,7 +99,7 @@ public class ThemeUtil {
}
public static String getColorTheme() {
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.S || Build.VERSION.SDK_INT == Build.VERSION_CODES.R && Build.VERSION.PREVIEW_SDK_INT != 0) && isSystemAccent()) {
if (DynamicColors.isDynamicColorAvailable() && isSystemAccent()) {
return "system";
}
String primaryColorEntryName = "COLOR_PRIMARY";
@ -113,9 +114,6 @@ public class ThemeUtil {
@StyleRes
public static int getColorThemeStyleRes() {
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.S || Build.VERSION.SDK_INT == Build.VERSION_CODES.R && Build.VERSION.PREVIEW_SDK_INT != 0) && isSystemAccent()) {
return R.style.ThemeOverlay_system;
}
Integer theme = colorThemeMap.get(getColorTheme());
if (theme == null) {
return R.style.ThemeOverlay_color_primary;

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2021 LSPosed Contributors
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@android:color/system_neutral1_500" />
<item android:color="@android:color/system_neutral1_50" />
</selector>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2021 LSPosed Contributors
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@android:color/system_neutral1_400" />
<item android:color="@android:color/system_neutral1_900" />
</selector>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2021 LSPosed Contributors
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:alpha="?android:disabledAlpha" android:color="@android:color/system_neutral2_200" />
<item android:color="@android:color/system_neutral2_200" />
</selector>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2021 LSPosed Contributors
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:alpha="?android:disabledAlpha" android:color="@android:color/system_neutral2_700" />
<item android:color="@android:color/system_neutral2_700" />
</selector>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2021 LSPosed Contributors
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:alpha="?android:disabledAlpha" android:color="@android:color/system_neutral2_400" />
<item android:color="@android:color/system_neutral2_400" />
</selector>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2021 LSPosed Contributors
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:alpha="?android:disabledAlpha" android:color="@android:color/system_neutral2_500" />
<item android:color="@android:color/system_neutral2_500" />
</selector>

View File

@ -28,23 +28,20 @@
app:edgeToEdge="true"
app:fitsSystemWindowsInsets="start|end">
<rikka.material.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
style="?appBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<androidx.appcompat.widget.Toolbar
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:subtitleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Subtitle"
app:titleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Title"
app:popupTheme="?actionBarPopupTheme" />
android:elevation="0dp" />
</rikka.material.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"

View File

@ -28,14 +28,13 @@
app:edgeToEdge="true"
app:fitsSystemWindowsInsets="start|end">
<rikka.material.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
style="?appBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<androidx.appcompat.widget.Toolbar
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -43,11 +42,9 @@
app:logo="@drawable/ic_launcher"
app:contentInsetStart="24dp"
app:titleMarginStart="48dp"
app:subtitleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Subtitle"
app:titleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Title"
app:popupTheme="?actionBarPopupTheme" />
android:elevation="0dp" />
</rikka.material.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
<FrameLayout
android:layout_width="match_parent"

View File

@ -27,9 +27,8 @@
app:edgeToEdge="true"
app:fitsSystemWindowsInsets="start|end">
<rikka.material.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
style="?appBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
@ -39,14 +38,12 @@
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:subtitleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Subtitle"
app:titleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Title"
app:popupTheme="?actionBarPopupTheme" />
android:elevation="0dp" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/sliding_tabs"
@ -66,7 +63,7 @@
android:text="@string/nav_item_logs_lsp" />
</com.google.android.material.tabs.TabLayout>
</LinearLayout>
</rikka.material.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
<HorizontalScrollView
android:id="@+id/horizontalScrollView"
@ -81,7 +78,6 @@
android:layout_height="match_parent"
android:clipToPadding="false"
android:fadeScrollbars="true"
android:paddingTop="104dp"
android:scrollbarStyle="insideOverlay"
android:scrollbars="vertical"
app:borderTopVisibility="whenTop"

View File

@ -27,9 +27,8 @@
app:edgeToEdge="true"
app:fitsSystemWindowsInsets="start|end">
<rikka.material.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
style="?appBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
@ -39,14 +38,12 @@
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:popupTheme="?actionBarPopupTheme"
app:subtitleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Subtitle"
app:titleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Title" />
android:elevation="0dp" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
@ -57,7 +54,7 @@
app:tabIndicatorAnimationMode="elastic"
app:tabMode="scrollable" />
</LinearLayout>
</rikka.material.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"

View File

@ -27,23 +27,20 @@
app:edgeToEdge="true"
app:fitsSystemWindowsInsets="start|end">
<rikka.material.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
style="?appBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<androidx.appcompat.widget.Toolbar
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:subtitleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Subtitle"
app:titleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Title"
app:popupTheme="?actionBarPopupTheme" />
android:elevation="0dp" />
</rikka.material.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress"

View File

@ -27,23 +27,20 @@
app:edgeToEdge="true"
app:fitsSystemWindowsInsets="start|end">
<rikka.material.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
style="?appBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<androidx.appcompat.widget.Toolbar
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:subtitleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Subtitle"
app:titleTextAppearance="@android:style/TextAppearance.Material.Widget.Toolbar.Title"
app:popupTheme="?actionBarPopupTheme" />
android:elevation="0dp" />
</rikka.material.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/container"

View File

@ -23,7 +23,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingTop="104dp"
android:fadeScrollbars="true"
android:scrollbarStyle="insideOverlay"
android:scrollbars="vertical"

View File

@ -75,7 +75,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/description"
app:layout_constraintTop_toBottomOf="@id/description"
style="@style/Widget.MaterialComponents.Button" />
style="@style/Widget.MaterialComponents.Button.Icon" />
<com.google.android.material.button.MaterialButton
android:id="@+id/open_in_browser"

View File

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2021 LSPosed Contributors
-->
<resources>
<color name="color_primary_md3">@color/color_primary_md3_dark</color>
<color name="color_background_md3">@color/color_background_md3_dark</color>
<color name="color_surface_md3">@color/color_surface_md3_dark</color>
<color name="color_background_floating_md3">@color/color_background_floating_md3_dark</color>
<color name="primary_text_md3">@color/primary_text_md3_dark</color>
<color name="primary_text_inverse_md3">@color/primary_text_md3_light</color>
<color name="secondary_text_md3">@color/secondary_text_md3_dark</color>
<color name="secondary_text_inverse_md3">@color/secondary_text_md3_light</color>
<color name="tertiary_text_md3">@color/tertiary_text_md3_dark</color>
<color name="tertiary_text_inverse_md3">@color/tertiary_text_md3_light</color>
</resources>

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2021 LSPosed Contributors
-->
<resources>
<color name="color_primary_md3_light">@android:color/system_accent1_600</color>
<color name="color_primary_md3_dark">@android:color/system_accent1_200</color>
<color name="color_primary_md3">@color/color_primary_md3_light</color>
<color name="color_surface_md3_light">@android:color/system_neutral1_50</color>
<color name="color_surface_md3_dark">@android:color/system_neutral1_900</color>
<color name="color_surface_md3">@color/color_surface_md3_light</color>
<color name="color_background_md3_light">@android:color/system_neutral1_50</color>
<color name="color_background_md3_dark">@android:color/system_neutral1_800</color>
<color name="color_background_md3">@color/color_background_md3_light</color>
<color name="color_background_floating_md3_light">@android:color/system_neutral1_50</color>
<color name="color_background_floating_md3_dark">@android:color/system_neutral1_800</color>
<color name="color_background_floating_md3">@color/color_background_floating_md3_light</color>
<color name="primary_text_md3">@color/primary_text_md3_light</color>
<color name="primary_text_inverse_md3">@color/primary_text_md3_dark</color>
<color name="secondary_text_md3">@color/secondary_text_md3_light</color>
<color name="secondary_text_inverse_md3">@color/secondary_text_md3_dark</color>
<color name="tertiary_text_md3">@color/tertiary_text_md3_light</color>
<color name="tertiary_text_inverse_md3">@color/tertiary_text_md3_dark</color>
</resources>

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2021 LSPosed Contributors
-->
<resources>
<style name="ThemeOverlay.system">
<item name="colorPrimary">@color/color_primary_md3</item>
<item name="colorSurface">@color/color_surface_md3</item>
<item name="colorBackgroundFloating">@color/color_background_floating_md3</item>
<item name="android:colorBackground">@color/color_background_md3</item>
<item name="android:textColorPrimary">@color/primary_text_md3</item>
<item name="android:textColorPrimaryInverse">@color/primary_text_inverse_md3</item>
<item name="android:textColorSecondary">@color/secondary_text_md3</item>
<item name="android:textColorSecondaryInverse">@color/secondary_text_inverse_md3</item>
<item name="android:textColorTertiary">@color/tertiary_text_md3</item>
<item name="android:textColorTertiaryInverse">@color/tertiary_text_inverse_md3</item>
</style>
</resources>

View File

@ -32,12 +32,6 @@
<item name="colorNormal">@color/material_green_500</item>
<item name="colorInstall">@color/material_blue_500</item>
<item name="actionBarStyle">@style/Widget.Material.ActionBar.Surface</item>
<item name="actionBarTheme">@style/ThemeOverlay.ActionBar</item>
<item name="toolbarStyle">@style/Widget.Material.Toolbar</item>
<item name="appBarStyle">@style/Widget.AppBar.Surface.Raisable</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
@ -60,12 +54,6 @@
<item name="colorNormal">@color/material_green_200</item>
<item name="colorInstall">@color/material_blue_200</item>
<item name="actionBarStyle">@style/Widget.Material.ActionBar.Surface</item>
<item name="actionBarTheme">@style/ThemeOverlay.ActionBar</item>
<item name="toolbarStyle">@style/Widget.Material.Toolbar</item>
<item name="appBarStyle">@style/Widget.AppBar.Surface.Raisable</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
@ -77,45 +65,6 @@
<style name="Theme" parent="Base.AppTheme" />
<style name="Widget.AppBar" parent="">
<item name="android:background">?toolbarColor</item>
<item name="android:theme">?actionBarTheme</item>
<item name="android:stateListAnimator">@animator/raise_animator</item>
<item name="android:elevation">2dp</item>
</style>
<style name="Widget.Material.Toolbar" parent="Widget.MaterialComponents.Toolbar">
<item name="android:background">?android:colorBackground</item>
</style>
<style name="Widget.AppBar.Surface">
<item name="android:background">?android:colorBackground</item>
<item name="android:stateListAnimator">@animator/alpha_animator</item>
<item name="android:elevation">@dimen/app_bar_elevation</item>
</style>
<style name="Widget.AppBar.Surface.Raisable">
<item name="android:elevation">0dp</item>
<item name="android:stateListAnimator">@animator/raise_animator</item>
</style>
<style name="ThemeOverlay.ActionBar" parent="ThemeOverlay.MaterialComponents.ActionBar">
<item name="elevation">0dp</item>
<item name="titleTextAppearance">
@android:style/TextAppearance.Material.Widget.Toolbar.Title
</item>
<item name="subtitleTextAppearance">
@android:style/TextAppearance.Material.Widget.Toolbar.Subtitle
</item>
</style>
<style name="Widget.App.Button.OutlinedButton.IconOnly" parent="Widget.MaterialComponents.Button.OutlinedButton">
<item name="iconPadding">0dp</item>
<item name="android:paddingLeft">12dp</item>
<item name="android:paddingRight">12dp</item>
<item name="android:minWidth">48dp</item>
</style>
<style name="DeviceInfoDialogLabel">
<item name="android:textAlignment">viewStart</item>
<item name="android:textAppearance">@style/TextAppearance.MaterialComponents.Body1</item>
@ -159,4 +108,11 @@
<item name="android:padding">16dp</item>
</style>
<style name="Widget.App.Button.OutlinedButton.IconOnly" parent="Widget.Material3.Button.OutlinedButton">
<item name="iconPadding">0dp</item>
<item name="android:paddingLeft">@dimen/mtrl_btn_icon_btn_padding_left</item>
<item name="android:paddingRight">@dimen/mtrl_btn_icon_btn_padding_left</item>
<item name="android:minWidth">36dp</item>
</style>
</resources>

View File

@ -43,7 +43,7 @@
<item name="useMaterialThemeColors">true</item>
</style>
<style name="ThemeOverlay.Material.Dialog.ColorPicker" parent="@style/ThemeOverlay.Material.Dialog" />
<style name="ThemeOverlay.Material.Dialog.ColorPicker" parent="@style/ThemeOverlay.Material3.Dialog" />
<style name="PreferenceSummaryTextStyle" tools:override="true">
<item name="android:fontFamily">sans-serif</item>
@ -66,34 +66,18 @@
<item name="android:statusBarColor">?android:colorBackground</item>
<item name="android:ambientShadowAlpha">@dimen/ambient_shadow_alpha</item>
<item name="android:spotShadowAlpha">@dimen/spot_shadow_alpha</item>
<item name="android:listDivider">@drawable/list_divider</item>
<item name="android:dividerVertical">?android:listDivider</item>
<item name="android:dividerHorizontal">?android:listDivider</item>
<item name="android:colorBackground">@color/background_light</item>
<item name="android:backgroundDimAmount">@dimen/rd_material_dialog_default_dim_amount</item>
<item name="colorPrimary">@color/primary_light</item>
<item name="colorPrimaryVariant">@color/primary_dark_light</item>
<item name="actionBarStyle">@style/Widget.Material.ActionBar.Solid</item>
<item name="dialogCornerRadius">@dimen/rd_default_dialog_corner_radius</item>
<item name="swipeRefreshLayoutProgressSpinnerBackgroundColor">?cardBackground</item>
<item name="dialogTheme">@style/ThemeOverlay.Material.Dialog</item>
<item name="alertDialogTheme">@style/ThemeOverlay.Material.Dialog.Alert</item>
<item name="cardBackground">@color/cardview_light_background</item>
<item name="colorAlert">@color/material_red_A200</item>
<item name="colorSafe">@color/material_green_600</item>
<item name="colorWarning">@color/material_orange_700</item>
<item name="colorInactive" tools:ignore="PrivateResource">@color/material_grey_600</item>
<item name="outlineButtonStyle">@style/Widget.Material.Button.Outline.Light</item>
<item name="outlineButtonBackground">@drawable/material_button_outline_background</item>
<item name="outlineButtonForeground">@drawable/material_button_outline_foreground</item>
<item name="materialButtonHorizontalMarginAmend">@dimen/rd_material_button_horizontal_margin_amend</item>
<item name="navigationBarDividerColor">@color/navigation_bar_divider_light</item>
<item name="extendedFloatingActionButtonStyle">@style/Widget.Material.ExtendedFloatingActionButton.Icon</item>
<!-- SwitchBar -->
<item name="switchBarStyle">@style/Widget.SwitchBar.Light</item>
<item name="switchBarTheme">@style/ThemeOverlay.SwitchBar</item>
@ -105,130 +89,22 @@
<item name="android:statusBarColor">?android:colorBackground</item>
<item name="android:ambientShadowAlpha">@dimen/ambient_shadow_alpha</item>
<item name="android:spotShadowAlpha">@dimen/spot_shadow_alpha</item>
<item name="android:listDivider">@drawable/list_divider</item>
<item name="android:dividerVertical">?android:listDivider</item>
<item name="android:dividerHorizontal">?android:listDivider</item>
<item name="android:colorBackground">@color/background_dark</item>
<item name="android:backgroundDimAmount">@dimen/rd_material_dialog_default_dim_amount</item>
<item name="colorPrimary">@color/primary_dark</item>
<item name="colorPrimaryVariant">@color/primary_dark_dark</item>
<item name="actionBarStyle">@style/Widget.Material.ActionBar.Surface</item>
<item name="dialogCornerRadius">@dimen/rd_default_dialog_corner_radius</item>
<item name="swipeRefreshLayoutProgressSpinnerBackgroundColor">?cardBackground</item>
<item name="dialogTheme">@style/ThemeOverlay.Material.Dialog</item>
<item name="alertDialogTheme">@style/ThemeOverlay.Material.Dialog.Alert</item>
<item name="cardBackground">@color/cardview_dark_background</item>
<item name="colorAlert">@color/material_red_A100</item>
<item name="colorSafe">@color/material_green_A100</item>
<item name="colorWarning">@color/material_orange_A100</item>
<item name="colorInactive">@color/material_grey_500</item>
<item name="outlineButtonStyle">@style/Widget.Material.Button.Outline</item>
<item name="outlineButtonBackground">@drawable/material_button_outline_background_dark</item>
<item name="outlineButtonForeground">@drawable/material_button_outline_foreground</item>
<item name="materialButtonHorizontalMarginAmend">@dimen/rd_material_button_horizontal_margin_amend</item>
<item name="navigationBarDividerColor">@color/navigation_bar_divider_dark</item>
<item name="extendedFloatingActionButtonStyle">@style/Widget.Material.ExtendedFloatingActionButton.Icon</item>
<!-- SwitchBar -->
<item name="switchBarStyle">@style/Widget.SwitchBar</item>
<item name="switchBarTheme">@style/ThemeOverlay.SwitchBar</item>
<item name="switchBarBackgroundNormal">@color/switchbar_background_dark</item>
<item name="switchBarBackgroundDisabled">@color/switchbar_background_dark</item>
</style>
<style name="Base.Light.Dialog" parent="Theme.Material3.Light.Dialog">
<item name="android:ambientShadowAlpha">@dimen/ambient_shadow_alpha</item>
<item name="android:spotShadowAlpha">@dimen/spot_shadow_alpha</item>
<item name="android:listDivider">@drawable/list_divider</item>
<item name="android:dividerVertical">?android:listDivider</item>
<item name="android:dividerHorizontal">?android:listDivider</item>
<item name="android:backgroundDimAmount">@dimen/rd_material_dialog_default_dim_amount</item>
<item name="colorPrimary">@color/primary_light</item>
<item name="colorPrimaryVariant">@color/primary_dark_light</item>
<item name="actionBarStyle">@style/Widget.Material.ActionBar.Solid</item>
<item name="dialogCornerRadius">@dimen/rd_default_dialog_corner_radius</item>
<item name="swipeRefreshLayoutProgressSpinnerBackgroundColor">?cardBackground</item>
<item name="dialogTheme">@style/ThemeOverlay.Material.Dialog</item>
<item name="alertDialogTheme">@style/ThemeOverlay.Material.Dialog.Alert</item>
<item name="cardBackground">@color/cardview_light_background</item>
<item name="colorAlert">@color/material_red_A200</item>
<item name="colorSafe">@color/material_green_600</item>
<item name="colorWarning">@color/material_orange_700</item>
<item name="colorInactive" tools:ignore="PrivateResource">@color/material_grey_600</item>
<item name="switchBarStyle">@style/Widget.SwitchBar.Light</item>
<item name="switchBarTheme">@style/ThemeOverlay.SwitchBar</item>
<item name="switchBarBackgroundNormal">@color/switchbar_background_light</item>
<item name="switchBarBackgroundDisabled">@color/switchbar_background_light</item>
<item name="outlineButtonStyle">@style/Widget.Material.Button.Outline.Light</item>
<item name="outlineButtonBackground">@drawable/material_button_outline_background</item>
<item name="outlineButtonForeground">@drawable/material_button_outline_foreground</item>
<item name="materialButtonHorizontalMarginAmend">@dimen/rd_material_button_horizontal_margin_amend</item>
<item name="navigationBarDividerColor">@color/navigation_bar_divider_light</item>
<item name="extendedFloatingActionButtonStyle">@style/Widget.Material.ExtendedFloatingActionButton.Icon</item>
</style>
<style name="Base.Dialog" parent="Theme.Material3.Dark.Dialog">
<item name="android:ambientShadowAlpha">@dimen/ambient_shadow_alpha</item>
<item name="android:spotShadowAlpha">@dimen/spot_shadow_alpha</item>
<item name="android:listDivider">@drawable/list_divider</item>
<item name="android:dividerVertical">?android:listDivider</item>
<item name="android:dividerHorizontal">?android:listDivider</item>
<item name="android:backgroundDimAmount">@dimen/rd_material_dialog_default_dim_amount</item>
<item name="colorPrimary">@color/primary_dark</item>
<item name="colorPrimaryVariant">@color/primary_dark_dark</item>
<item name="actionBarStyle">@style/Widget.Material.ActionBar.Surface</item>
<item name="dialogCornerRadius">@dimen/rd_default_dialog_corner_radius</item>
<item name="swipeRefreshLayoutProgressSpinnerBackgroundColor">?cardBackground</item>
<item name="dialogTheme">@style/ThemeOverlay.Material.Dialog</item>
<item name="alertDialogTheme">@style/ThemeOverlay.Material.Dialog.Alert</item>
<item name="cardBackground">@color/cardview_dark_background</item>
<item name="colorAlert">@color/material_red_A100</item>
<item name="colorSafe">@color/material_green_A100</item>
<item name="colorWarning">@color/material_orange_A100</item>
<item name="colorInactive">@color/material_grey_500</item>
<item name="switchBarStyle">@style/Widget.SwitchBar</item>
<item name="switchBarTheme">@style/ThemeOverlay.SwitchBar</item>
<item name="switchBarBackgroundNormal">@color/switchbar_background_dark</item>
<item name="switchBarBackgroundDisabled">@color/switchbar_background_dark</item>
<item name="outlineButtonStyle">@style/Widget.Material.Button.Outline</item>
<item name="outlineButtonBackground">@drawable/material_button_outline_background_dark</item>
<item name="outlineButtonForeground">@drawable/material_button_outline_foreground</item>
<item name="materialButtonHorizontalMarginAmend">@dimen/rd_material_button_horizontal_margin_amend</item>
<item name="navigationBarDividerColor">@color/navigation_bar_divider_dark</item>
<item name="extendedFloatingActionButtonStyle">@style/Widget.Material.ExtendedFloatingActionButton.Icon</item>
</style>
<style name="ThemeOverlay.Material.Dialog" parent="ThemeOverlay.Material3.Dialog">
<item name="android:windowAnimationStyle">@style/Animation.Material.Dialog</item>
<item name="android:windowElevation">@dimen/rd_material_dialog_default_elevation</item>
<item name="android:backgroundDimAmount">@dimen/rd_material_dialog_default_dim_amount</item>
</style>
<style name="ThemeOverlay.Material.Dialog.Alert" parent="ThemeOverlay.Material3.Dialog.Alert">
<item name="android:windowAnimationStyle">@style/Animation.Material.Dialog</item>
<item name="android:windowElevation">@dimen/rd_material_dialog_default_elevation</item>
<item name="android:backgroundDimAmount">@dimen/rd_material_dialog_default_dim_amount</item>
<item name="alertDialogStyle">@style/AlertDialog.Material</item>
<item name="android:checkedTextViewStyle">@style/Widget.Material3.CheckedTextView</item>
<item name="buttonBarButtonStyle">@style/Widget.Material3.Button.TextButton.Dialog</item>
<item name="buttonBarPositiveButtonStyle">@style/Widget.Material3.Button.TextButton.Dialog</item>
<item name="buttonBarNegativeButtonStyle">@style/Widget.Material3.Button.TextButton.Dialog</item>
<item name="buttonBarNeutralButtonStyle">@style/Widget.Material3.Button.TextButton.Dialog.Flush</item>
<item name="materialAlertDialogBodyTextStyle">@style/AlertDialog.Material.Body.Text</item>
<item name="materialAlertDialogTitlePanelStyle">@style/MaterialAlertDialog.Material3.Title.Panel</item>
<item name="materialAlertDialogTitleIconStyle">@style/MaterialAlertDialog.Material3.Title.Icon</item>
<item name="materialAlertDialogTitleTextStyle">@style/AlertDialog.Material.Title.Text</item>
</style>
</resources>