本文整理汇总了Java中com.afollestad.materialdialogs.internal.MDTintHelper类的典型用法代码示例。如果您正苦于以下问题:Java MDTintHelper类的具体用法?Java MDTintHelper怎么用?Java MDTintHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MDTintHelper类属于com.afollestad.materialdialogs.internal包,在下文中一共展示了MDTintHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invalidateInputMinMaxIndicator
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
protected void invalidateInputMinMaxIndicator(int currentLength, boolean emptyDisabled) {
if (inputMinMax != null) {
if (builder.inputMaxLength > 0) {
inputMinMax.setText(String.format(Locale.getDefault(), "%d/%d", currentLength, builder.inputMaxLength));
inputMinMax.setVisibility(View.VISIBLE);
} else inputMinMax.setVisibility(View.GONE);
final boolean isDisabled = (emptyDisabled && currentLength == 0) ||
(builder.inputMaxLength > 0 && currentLength > builder.inputMaxLength) ||
currentLength < builder.inputMinLength;
final int colorText = isDisabled ? builder.inputRangeErrorColor : builder.contentColor;
final int colorWidget = isDisabled ? builder.inputRangeErrorColor : builder.widgetColor;
if (builder.inputMaxLength > 0)
inputMinMax.setTextColor(colorText);
MDTintHelper.setTint(input, colorWidget);
final View positiveAb = getActionButton(DialogAction.POSITIVE);
positiveAb.setEnabled(!isDisabled);
}
}
示例2: onCreate
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_donation);
ButterKnife.bind(this);
setStatusbarColorAuto();
setNavigationbarColorAuto();
setTaskDescriptionColorAuto();
mToolbar.setBackgroundColor(ThemeStore.primaryColor(this));
setSupportActionBar(mToolbar);
//noinspection ConstantConditions
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mToolbar.setNavigationOnClickListener(view -> onBackPressed());
mBillingProcessor
= new BillingProcessor(this, BuildConfig.GOOGLE_PLAY_LICENSE_KEY, this);
MDTintHelper.setTint(mProgressBar, ThemeStore.accentColor(this));
((TextView) findViewById(R.id.donation)).setTextColor(ThemeStore.accentColor(this));
}
示例3: notifyPasswordValidation
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
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);
}
}
示例4: invalidateInputMinMaxIndicator
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
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);
}
}
示例5: invalidateInputMinMaxIndicator
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
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);
}
}
示例6: invalidateInputMinMaxIndicator
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
void invalidateInputMinMaxIndicator(int currentLength, boolean emptyDisabled) {
if (inputMinMax != null) {
if (builder.inputMaxLength > 0) {
inputMinMax.setText(
String.format(Locale.getDefault(), "%d/%d", currentLength, builder.inputMaxLength));
inputMinMax.setVisibility(View.VISIBLE);
} else {
inputMinMax.setVisibility(View.GONE);
}
final boolean isDisabled =
(emptyDisabled && currentLength == 0)
|| (builder.inputMaxLength > 0 && currentLength > builder.inputMaxLength)
|| currentLength < builder.inputMinLength;
final int colorText = isDisabled ? builder.inputRangeErrorColor : builder.contentColor;
final int colorWidget = isDisabled ? builder.inputRangeErrorColor : builder.widgetColor;
if (builder.inputMaxLength > 0) {
inputMinMax.setTextColor(colorText);
}
MDTintHelper.setTint(input, colorWidget);
final View positiveAb = getActionButton(DialogAction.POSITIVE);
positiveAb.setEnabled(!isDisabled);
}
}
示例7: invalidateDynamicButtonColors
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
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 (customSeekR != null) {
if (customSeekA.getVisibility() == View.VISIBLE)
MDTintHelper.setTint(customSeekA, selectedColor);
MDTintHelper.setTint(customSeekR, selectedColor);
MDTintHelper.setTint(customSeekG, selectedColor);
MDTintHelper.setTint(customSeekB, selectedColor);
}
}
}
示例8: setupInputDialog
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
private static void setupInputDialog(final MaterialDialog dialog) {
final MaterialDialog.Builder builder = dialog.builder;
dialog.input = (EditText) dialog.view.findViewById(android.R.id.input);
if (dialog.input == null) return;
dialog.setTypeface(dialog.input, builder.regularFont);
if (builder.inputPrefill != null)
dialog.input.setText(builder.inputPrefill);
dialog.setInternalInputCallback();
dialog.input.setHint(builder.inputHint);
dialog.input.setSingleLine();
dialog.input.setTextColor(builder.contentColor);
dialog.input.setHintTextColor(DialogUtils.adjustAlpha(builder.contentColor, 0.3f));
MDTintHelper.setTint(dialog.input, dialog.builder.widgetColor);
if (builder.inputType != -1) {
dialog.input.setInputType(builder.inputType);
if (builder.inputType != InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD &&
(builder.inputType & InputType.TYPE_TEXT_VARIATION_PASSWORD) == InputType.TYPE_TEXT_VARIATION_PASSWORD) {
// If the flags contain TYPE_TEXT_VARIATION_PASSWORD, apply the password transformation method automatically
dialog.input.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
}
dialog.inputMinMax = (TextView) dialog.view.findViewById(R.id.md_minMax);
if (builder.inputMinLength > 0 || builder.inputMaxLength > -1) {
dialog.invalidateInputMinMaxIndicator(dialog.input.getText().toString().length(),
!builder.inputAllowEmpty);
} else {
dialog.inputMinMax.setVisibility(View.GONE);
dialog.inputMinMax = null;
}
}
示例9: onCreateDialog
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
@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();
}
示例10: invalidateDynamicButtonColors
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
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);
}
}
}
示例11: setupInputDialog
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
private static void setupInputDialog(final MaterialDialog dialog) {
final MaterialDialog.Builder builder = dialog.mBuilder;
dialog.input = (EditText) dialog.view.findViewById(android.R.id.input);
if (dialog.input == null) return;
dialog.setTypeface(dialog.input, builder.regularFont);
if (builder.inputPrefill != null)
dialog.input.setText(builder.inputPrefill);
dialog.setInternalInputCallback();
dialog.input.setHint(builder.inputHint);
dialog.input.setSingleLine();
dialog.input.setTextColor(builder.contentColor);
dialog.input.setHintTextColor(DialogUtils.adjustAlpha(builder.contentColor, 0.3f));
MDTintHelper.setTint(dialog.input, dialog.mBuilder.widgetColor);
if (builder.inputType != -1) {
dialog.input.setInputType(builder.inputType);
if ((builder.inputType & InputType.TYPE_TEXT_VARIATION_PASSWORD) == InputType.TYPE_TEXT_VARIATION_PASSWORD) {
// If the flags contain TYPE_TEXT_VARIATION_PASSWORD, apply the password transformation method automatically
dialog.input.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
}
dialog.inputMinMax = (TextView) dialog.view.findViewById(R.id.minMax);
if (builder.inputMinLength > 0 || builder.inputMaxLength > -1) {
dialog.invalidateInputMinMaxIndicator(dialog.input.getText().toString().length(),
!builder.inputAllowEmpty);
} else {
dialog.inputMinMax.setVisibility(View.GONE);
dialog.inputMinMax = null;
}
}
示例12: invalidateInputMinMaxIndicator
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
protected void invalidateInputMinMaxIndicator(int currentLength, boolean emptyDisabled) {
if (inputMinMax != null) {
inputMinMax.setText(String.format("%d/%d", currentLength, mBuilder.inputMaxLength));
final boolean isDisabled = (emptyDisabled && currentLength == 0) ||
currentLength > mBuilder.inputMaxLength ||
currentLength < mBuilder.inputMinLength;
final int colorText = isDisabled ? mBuilder.inputRangeErrorColor : mBuilder.contentColor;
final int colorWidget = isDisabled ? mBuilder.inputRangeErrorColor : mBuilder.widgetColor;
inputMinMax.setTextColor(colorText);
MDTintHelper.setTint(input, colorWidget);
final View positiveAb = getActionButton(DialogAction.POSITIVE);
positiveAb.setEnabled(!isDisabled);
}
}
示例13: showDialog
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
@Override protected void showDialog(Bundle state) {
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);
@SuppressLint("InflateParams")
View layout = LayoutInflater.from(getContext()).inflate(R.layout.md_stub_inputpref, null);
onBindDialogView(layout);
MDTintHelper.setTint(editText, color);
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);
PrefUtil.registerOnActivityDestroyListener(this, this);
dialog = mBuilder.build();
if (state != null)
dialog.onRestoreInstanceState(state);
requestInputMethod(dialog);
dialog.show();
}
示例14: setProgressBarColor
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
private void setProgressBarColor(int color) {
MDTintHelper.setTint(mProgressBar, color);
}
示例15: getPendingView
import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
@Override
protected View getPendingView(ViewGroup parent) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.widget_progess, parent, false);
MDTintHelper.setTint((ProgressBar) ((FrameLayout) v).getChildAt(0), parent.getContext().getResources().getColor(((BaseFragmentActivity) parent.getContext()).isEasyRedmine() ? R.color.er_primary : R.color.r_primary));
return v;
}