mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
Merge pull request #3731 from nextcloud/ezaquarii/fix-button-disabled-state-in-folder-sync-preferences-2
Fix button disabled state in folder sync preferences
This commit is contained in:
commit
67eec757fb
2 changed files with 21 additions and 2 deletions
|
@ -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());
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
Loading…
Reference in a new issue