From ef45b6f11d9ee1a9bc695e98b0b20b25c7e7b43c Mon Sep 17 00:00:00 2001 From: Chris Narkiewicz Date: Sat, 9 Mar 2019 21:21:21 +0000 Subject: [PATCH] Dim disabled Save button in custom folder sync prefs dialog Fixes #3664 Signed-off-by: Chris Narkiewicz --- ...SyncedFolderPreferencesDialogFragment.java | 4 ++-- .../owncloud/android/utils/ThemeUtils.java | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java b/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java index 118f724017..abd2132dca 100644 --- a/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java +++ b/src/main/java/com/owncloud/android/ui/dialog/SyncedFolderPreferencesDialogFragment.java @@ -195,10 +195,10 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment { mUploadBehaviorSummary = view.findViewById(R.id.setting_instant_behaviour_summary); mCancel = view.findViewById(R.id.cancel); - mCancel.setTextColor(accentColor); + ThemeUtils.themeDialogActionButton(mCancel); mSave = view.findViewById(R.id.save); - mSave.setTextColor(accentColor); + ThemeUtils.themeDialogActionButton(mSave); // Set values setEnabled(mSyncedFolder.getEnabled()); diff --git a/src/main/java/com/owncloud/android/utils/ThemeUtils.java b/src/main/java/com/owncloud/android/utils/ThemeUtils.java index 8f4f4cbd40..18f3f9677a 100644 --- a/src/main/java/com/owncloud/android/utils/ThemeUtils.java +++ b/src/main/java/com/owncloud/android/utils/ThemeUtils.java @@ -40,6 +40,7 @@ import android.widget.ProgressBar; import android.widget.SeekBar; import android.widget.TextView; +import com.google.android.material.button.MaterialButton; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import com.google.android.material.textfield.TextInputLayout; @@ -419,6 +420,24 @@ public final class ThemeUtils { )); } + public static void themeDialogActionButton(MaterialButton button) { + if (button == null ) return; + + Context context = button.getContext(); + int accentColor = ThemeUtils.primaryAccentColor(button.getContext()); + int disabledColor = ContextCompat.getColor(context, R.color.disabled_text); + button.setTextColor(new ColorStateList( + new int[][]{ + new int[] { android.R.attr.state_enabled}, // enabled + new int[] {-android.R.attr.state_enabled}, // disabled + }, + new int[]{ + accentColor, + disabledColor + } + )); + } + public static void themeEditText(Context context, EditText editText, boolean themedBackground) { if (editText == null) { return; }