Add button state coloring

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2021-02-17 16:42:10 +01:00
parent 6edaaa3d3c
commit adb0394722
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
6 changed files with 10 additions and 11 deletions

View file

@ -93,7 +93,7 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
int elementColor = ThemeUtils.primaryColor(this, true); int elementColor = ThemeUtils.primaryColor(this, true);
ThemeUtils.themeDialogActionButton(binding.cancel); ThemeUtils.themeBorderlessButton(binding.cancel, ThemeUtils.primaryColor(this, true));
passCodeEditTexts[0] = binding.txt0; passCodeEditTexts[0] = binding.txt0;
ThemeUtils.colorEditText(passCodeEditTexts[0], elementColor); ThemeUtils.colorEditText(passCodeEditTexts[0], elementColor);

View file

@ -114,8 +114,8 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
AlertDialog alertDialog = (AlertDialog) getDialog(); AlertDialog alertDialog = (AlertDialog) getDialog();
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(color); ThemeUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE), color);
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTextColor(color); ThemeUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL), color);
} }
@NonNull @NonNull

View file

@ -105,7 +105,6 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements View
args.putParcelable(ARG_CREATOR, creator); args.putParcelable(ARG_CREATOR, creator);
frag.setArguments(args); frag.setArguments(args);
return frag; return frag;
} }
@Override @Override
@ -117,11 +116,11 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements View
AlertDialog alertDialog = (AlertDialog) getDialog(); AlertDialog alertDialog = (AlertDialog) getDialog();
positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
positiveButton.setTextColor(color); ThemeUtils.themeBorderlessButton(positiveButton, color);
positiveButton.setOnClickListener(this); positiveButton.setOnClickListener(this);
positiveButton.setEnabled(false); positiveButton.setEnabled(false);
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTextColor(color); ThemeUtils.themeBorderlessButton(alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL), color);
} }
@NonNull @NonNull

View file

@ -202,10 +202,10 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment {
mNameCollisionPolicySummary = view.findViewById(R.id.setting_instant_name_collision_policy_summary); mNameCollisionPolicySummary = view.findViewById(R.id.setting_instant_name_collision_policy_summary);
mCancel = view.findViewById(R.id.cancel); mCancel = view.findViewById(R.id.cancel);
ThemeUtils.themeDialogActionButton(mCancel); ThemeUtils.themeBorderlessButton(mCancel, accentColor);
mSave = view.findViewById(R.id.save); mSave = view.findViewById(R.id.save);
ThemeUtils.themeDialogActionButton(mSave); ThemeUtils.themeBorderlessButton(mSave, accentColor);
// Set values // Set values
setEnabled(mSyncedFolder.isEnabled()); setEnabled(mSyncedFolder.isEnabled());

View file

@ -569,13 +569,12 @@ public final class ThemeUtils {
)); ));
} }
public static void themeDialogActionButton(MaterialButton button) { public static void themeBorderlessButton(Button button, int primaryColor) {
if (button == null) { if (button == null) {
return; return;
} }
Context context = button.getContext(); Context context = button.getContext();
int accentColor = ThemeUtils.primaryAccentColor(button.getContext());
int disabledColor = ContextCompat.getColor(context, R.color.disabled_text); int disabledColor = ContextCompat.getColor(context, R.color.disabled_text);
button.setTextColor(new ColorStateList( button.setTextColor(new ColorStateList(
new int[][]{ new int[][]{
@ -583,7 +582,7 @@ public final class ThemeUtils {
new int[]{-android.R.attr.state_enabled}, // disabled new int[]{-android.R.attr.state_enabled}, // disabled
}, },
new int[]{ new int[]{
accentColor, primaryColor,
disabledColor disabledColor
} }
)); ));

View file

@ -22,6 +22,7 @@
<color name="text_color">#E3E3E3</color> <color name="text_color">#E3E3E3</color>
<color name="text_color_inverse">#000000</color> <color name="text_color_inverse">#000000</color>
<color name="disabled_text">#ff6F6F6F</color>
<color name="secondary_text_color">#A5A5A5</color> <color name="secondary_text_color">#A5A5A5</color>
<color name="list_divider_background">#222222</color> <color name="list_divider_background">#222222</color>