com.afollestad.materialdialogs.internal.MDTintHelper Java Examples
The following examples show how to use
com.afollestad.materialdialogs.internal.MDTintHelper.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DonationsDialog.java From Orin with GNU General Public License v3.0 | 6 votes |
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { billingProcessor = new BillingProcessor(getContext(), App.GOOGLE_PLAY_LICENSE_KEY, this); @SuppressLint("InflateParams") View customView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_donation, null); ProgressBar progressBar = ButterKnife.findById(customView, R.id.progress); MDTintHelper.setTint(progressBar, ThemeSingleton.get().positiveColor.getDefaultColor()); return new MaterialDialog.Builder(getContext()) .title(R.string.support_development) .customView(customView, false) .build(); }
Example #2
Source File: FingerprintDialog.java From fingerlock with MIT License | 6 votes |
public void notifyPasswordValidation(boolean valid) { final MaterialDialog dialog = (MaterialDialog) getDialog(); final View positive = dialog.getActionButton(DialogAction.POSITIVE); final View negative = dialog.getActionButton(DialogAction.NEGATIVE); toggleButtonsEnabled(true); if (valid) { if (mStage == Stage.KEY_INVALIDATED && mUseFingerprintFutureCheckBox.isChecked()) { // Re-create the key so that fingerprints including new ones are validated. mFingerLock.recreateKey(this); mStage = Stage.FINGERPRINT; } mPassword.setText(""); mCallback.onFingerprintDialogAuthenticated(); dismiss(); } else { mPasswordDescriptionTextView.setText(R.string.invalid_password); final int red = ContextCompat.getColor(getActivity(), R.color.material_red_500); MDTintHelper.setTint(mPassword, red); ((TextView) positive).setTextColor(red); ((TextView) negative).setTextColor(red); } }
Example #3
Source File: DevicesCommandFragment.java From bleYan with GNU General Public License v2.0 | 6 votes |
protected void invalidateInputMinMaxIndicator(EditText inputMinMax, int currentLength) { if (inputMinMax != null) { int materialBlue = ContextCompat.getColor(getActivity(), com.afollestad.materialdialogs.R.color.md_material_blue_600); int widgetColor = DialogUtils.resolveColor(getActivity(), com.afollestad.materialdialogs.R.attr.colorAccent, materialBlue); if (Build.VERSION.SDK_INT >= 21) { widgetColor = DialogUtils.resolveColor(getActivity(), android.R.attr.colorAccent, widgetColor); } final boolean isDisabled = currentLength > 20; final int colorText = isDisabled ? ContextCompat.getColor(getActivity(), R.color.red) : -1; final int colorWidget = isDisabled ? ContextCompat.getColor(getActivity(), R.color.red) : widgetColor; inputMinMax.setTextColor(colorText); MDTintHelper.setTint(inputMinMax, colorWidget); } }
Example #4
Source File: BleDeviceActivity.java From bleYan with GNU General Public License v2.0 | 6 votes |
protected void invalidateInputMinMaxIndicator(EditText input, int currentLength) { if (input != null) { int materialBlue = ContextCompat.getColor(this, com.afollestad.materialdialogs.R.color.md_material_blue_600); int widgetColor = DialogUtils.resolveColor(this, com.afollestad.materialdialogs.R.attr.colorAccent, materialBlue); if (Build.VERSION.SDK_INT >= 21) { widgetColor = DialogUtils.resolveColor(this, android.R.attr.colorAccent, widgetColor); } final boolean isDisabled = currentLength > 20; final int colorText = isDisabled ? ContextCompat.getColor(this, R.color.red) : -1; final int colorWidget = isDisabled ? ContextCompat.getColor(this, R.color.red) : widgetColor; input.setTextColor(colorText); MDTintHelper.setTint(input, colorWidget); } }
Example #5
Source File: ColorChooserDialog.java From OpenHub with GNU General Public License v3.0 | 5 votes |
private void invalidateDynamicButtonColors() { final MaterialDialog dialog = (MaterialDialog) getDialog(); if (dialog == null) { return; } final Builder builder = getBuilder(); if (builder.dynamicButtonColor) { int selectedColor = getSelectedColor(); if (Color.alpha(selectedColor) < 64 || (Color.red(selectedColor) > 247 && Color.green(selectedColor) > 247 && Color.blue(selectedColor) > 247)) { // Once we get close to white or transparent, // the action buttons and seekbars will be a very light gray. selectedColor = Color.parseColor("#DEDEDE"); } if (getBuilder().dynamicButtonColor) { dialog.getActionButton(DialogAction.POSITIVE).setTextColor(selectedColor); dialog.getActionButton(DialogAction.NEGATIVE).setTextColor(selectedColor); dialog.getActionButton(DialogAction.NEUTRAL).setTextColor(selectedColor); } if (customSeekR != null) { if (customSeekA.getVisibility() == View.VISIBLE) { MDTintHelper.setTint(customSeekA, selectedColor); } MDTintHelper.setTint(customSeekR, selectedColor); MDTintHelper.setTint(customSeekG, selectedColor); MDTintHelper.setTint(customSeekB, selectedColor); } } }
Example #6
Source File: ColorChooserDialog.java From APlayer with GNU General Public License v3.0 | 5 votes |
private void invalidateDynamicButtonColors() { final MaterialDialog dialog = (MaterialDialog) getDialog(); if (dialog == null) { return; } final Builder builder = getBuilder(); if (builder.mDynamicButtonColor) { int selectedColor = getSelectedColor(); if (Color.alpha(selectedColor) < 64 || (Color.red(selectedColor) > 247 && Color.green(selectedColor) > 247 && Color.blue(selectedColor) > 247)) { // Once we get close to white or transparent, the action buttons and seekbars will be a very light gray selectedColor = Color.parseColor("#DEDEDE"); } if (getBuilder().mDynamicButtonColor) { dialog.getActionButton(DialogAction.POSITIVE).setTextColor(selectedColor); dialog.getActionButton(DialogAction.NEGATIVE).setTextColor(selectedColor); dialog.getActionButton(DialogAction.NEUTRAL).setTextColor(selectedColor); } if (mCustomSeekR != null) { if (mCustomSeekA.getVisibility() == View.VISIBLE) { MDTintHelper.setTint(mCustomSeekA, selectedColor); } MDTintHelper.setTint(mCustomSeekR, selectedColor); MDTintHelper.setTint(mCustomSeekG, selectedColor); MDTintHelper.setTint(mCustomSeekB, selectedColor); } } }
Example #7
Source File: DonationsDialog.java From Phonograph with GNU General Public License v3.0 | 5 votes |
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { billingProcessor = new BillingProcessor(getContext(), App.GOOGLE_PLAY_LICENSE_KEY, this); @SuppressLint("InflateParams") View customView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_donation, null); ProgressBar progressBar = customView.findViewById(R.id.progress); MDTintHelper.setTint(progressBar, ThemeSingleton.get().positiveColor.getDefaultColor()); return new MaterialDialog.Builder(getContext()) .title(R.string.support_development) .customView(customView, false) .build(); }
Example #8
Source File: MaterialEditTextPreference.java From 920-text-editor-v2 with Apache License 2.0 | 4 votes |
@Override protected void showDialog(Bundle state) { MaterialDialog.Builder mBuilder = new MaterialDialog.Builder(getContext()) .title(getDialogTitle()) .icon(getDialogIcon()) .positiveText(getPositiveButtonText()) .negativeText(getNegativeButtonText()) .dismissListener(this) .onAny(new MaterialDialog.SingleButtonCallback() { @Override public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { switch (which) { default: MaterialEditTextPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE); break; case NEUTRAL: MaterialEditTextPreference.this.onClick(dialog, DialogInterface.BUTTON_NEUTRAL); break; case NEGATIVE: MaterialEditTextPreference.this.onClick(dialog, DialogInterface.BUTTON_NEGATIVE); break; } } }) .dismissListener(this); onPrepareDialogBuilder(mBuilder); @SuppressLint("InflateParams") View layout = LayoutInflater.from(getContext()).inflate(com.afollestad.materialdialogs.commons.R.layout.md_stub_inputpref, null); onBindDialogView(layout); MDTintHelper.setTint(mEditText, mColor); TextView message = (TextView) layout.findViewById(android.R.id.message); if (getDialogMessage() != null && getDialogMessage().toString().length() > 0) { message.setVisibility(View.VISIBLE); message.setText(getDialogMessage()); } else { message.setVisibility(View.GONE); } mBuilder.customView(layout, false); registerOnActivityDestroyListener(this, this); mDialog = mBuilder.build(); if (state != null) mDialog.onRestoreInstanceState(state); requestInputMethod(mDialog); mDialog.show(); }