Refine color (#1555)

This commit is contained in:
LoveSy 2022-01-25 10:13:44 +08:00 committed by GitHub
parent e5011a1b16
commit 255ebe3458
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 28 deletions

View File

@ -387,7 +387,7 @@ public class ScopeAdapter extends EmptyStateRecyclerView.EmptyStateAdapter<Scope
if (!recommendedList.isEmpty() && recommendedList.contains(appInfo.application)) {
String recommended = activity.getString(R.string.requested_by_module);
sb.append(recommended);
final ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(ResourceUtils.resolveColor(activity.getTheme(), androidx.appcompat.R.attr.colorAccent));
final ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(ResourceUtils.resolveColor(activity.getTheme(), com.google.android.material.R.attr.colorPrimary));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
final TypefaceSpan typefaceSpan = new TypefaceSpan(Typeface.create("sans-serif-medium", Typeface.NORMAL));
sb.setSpan(typefaceSpan, sb.length() - recommended.length(), sb.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
@ -401,7 +401,7 @@ public class ScopeAdapter extends EmptyStateRecyclerView.EmptyStateAdapter<Scope
if (sb.length() != 0) sb.append("\n");
String denylist = activity.getString(R.string.deny_list_info);
sb.append(denylist);
final ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(ResourceUtils.resolveColor(activity.getTheme(), rikka.material.R.attr.colorWarning));
final ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(ResourceUtils.resolveColor(activity.getTheme(), com.google.android.material.R.attr.colorError));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
final TypefaceSpan typefaceSpan = new TypefaceSpan(Typeface.create("sans-serif-medium", Typeface.NORMAL));
sb.setSpan(typefaceSpan, sb.length() - denylist.length(), sb.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);

View File

@ -556,7 +556,7 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
}
if (warningText != null) {
sb.append(warningText);
final ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(ContextCompat.getColor(requireActivity(), rikka.material.R.color.material_red_500));
final ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(ResourceUtils.resolveColor(requireActivity().getTheme(), com.google.android.material.R.attr.colorError));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
final TypefaceSpan typefaceSpan = new TypefaceSpan(Typeface.create("sans-serif-medium", Typeface.NORMAL));
sb.setSpan(typefaceSpan, sb.length() - warningText.length(), sb.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
@ -571,7 +571,7 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
if (warningText != null) sb.append("\n");
String recommended = getString(R.string.update_available, ver.versionName);
sb.append(recommended);
final ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(ResourceUtils.resolveColor(requireActivity().getTheme(), androidx.appcompat.R.attr.colorAccent));
final ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(ResourceUtils.resolveColor(requireActivity().getTheme(), androidx.appcompat.R.attr.colorPrimary));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
final TypefaceSpan typefaceSpan = new TypefaceSpan(Typeface.create("sans-serif-medium", Typeface.NORMAL));
sb.setSpan(typefaceSpan, sb.length() - recommended.length(), sb.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);

View File

@ -293,7 +293,7 @@ public class RepoFragment extends BaseFragment implements RepoLoader.RepoListene
if (upgradableVer != null) {
String hint = getString(R.string.update_available, upgradableVer.versionName);
sb.append(hint);
final ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(ResourceUtils.resolveColor(requireActivity().getTheme(), androidx.appcompat.R.attr.colorAccent));
final ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(ResourceUtils.resolveColor(requireActivity().getTheme(), com.google.android.material.R.attr.colorPrimary));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
final TypefaceSpan typefaceSpan = new TypefaceSpan(Typeface.create("sans-serif-medium", Typeface.NORMAL));
sb.setSpan(typefaceSpan, sb.length() - hint.length(), sb.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);

View File

@ -21,18 +21,6 @@
<style name="Base.AppTheme.Light" parent="Theme.Material.Light.LightStatusBar">
<item name="android:statusBarColor">?android:colorBackground</item>
<item name="colorPrimary">@color/material_blue_700</item>
<item name="colorPrimaryVariant">?colorPrimary</item>
<item name="colorSecondary">?colorPrimary</item>
<item name="colorSecondaryVariant">?colorPrimary</item>
<item name="colorOnSecondary">@android:color/white</item>
<item name="colorTertiary">?colorPrimary</item>
<item name="colorOnTertiary">@android:color/white</item>
<item name="colorError">@color/material_red_500</item>
<item name="colorNormal">@color/material_green_500</item>
<item name="colorInstall">@color/material_blue_500</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
@ -40,22 +28,15 @@
<!-- Preference title -->
<item name="android:textAppearanceListItem">?textAppearanceSubtitle1</item>
<!-- Preference category title -->
<item name="android:colorAccent">?colorPrimary</item>
<!-- Preference switch -->
<item name="android:colorControlActivated">?colorPrimary</item>
</style>
<style name="Theme.Light" parent="Base.AppTheme.Light" />
<style name="Base.AppTheme" parent="Theme.Material">
<item name="colorPrimary">@color/material_blue_700</item>
<item name="colorPrimaryVariant">?colorPrimary</item>
<item name="colorSecondary">?colorPrimary</item>
<item name="colorSecondaryVariant">?colorPrimary</item>
<item name="colorOnSecondary">@android:color/black</item>
<item name="colorTertiary">?colorPrimary</item>
<item name="colorOnTertiary">@android:color/black</item>
<item name="colorError">@color/material_red_200</item>
<item name="colorNormal">@color/material_green_200</item>
<item name="colorInstall">@color/material_blue_200</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
@ -63,6 +44,10 @@
<!-- Preference title -->
<item name="android:textAppearanceListItem">?textAppearanceSubtitle1</item>
<!-- Preference category title -->
<item name="android:colorAccent">?colorPrimary</item>
<!-- Preference switch -->
<item name="android:colorControlActivated">?colorPrimary</item>
</style>
<style name="Theme" parent="Base.AppTheme" />