当前位置: 首页>>代码示例>>Java>>正文


Java MDTintHelper类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:MaterialDialog.java

示例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));
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:23,代码来源:SupportDevelopmentActivity.java

示例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);
    }
}
 
开发者ID:aitorvs,项目名称:fingerlock,代码行数:25,代码来源:FingerprintDialog.java

示例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);
    }
}
 
开发者ID:captain-miao,项目名称:bleYan,代码行数:18,代码来源:DevicesCommandFragment.java

示例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);
    }
}
 
开发者ID:captain-miao,项目名称:bleYan,代码行数:18,代码来源:BleDeviceActivity.java

示例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);
  }
}
 
开发者ID:afollestad,项目名称:material-dialogs,代码行数:24,代码来源:MaterialDialog.java

示例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);
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:ColorChooserDialog.java

示例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;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:DialogInit.java

示例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();
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:16,代码来源:DonationsDialog.java

示例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);
    }
  }
}
 
开发者ID:ThirtyDegreesRay,项目名称:OpenHub,代码行数:34,代码来源:ColorChooserDialog.java

示例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;
    }
}
 
开发者ID:susong7519,项目名称:EasyFrame,代码行数:32,代码来源:DialogInit.java

示例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);
    }
}
 
开发者ID:susong7519,项目名称:EasyFrame,代码行数:15,代码来源:MaterialDialog.java

示例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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:50,代码来源:MaterialEditTextPreference.java

示例14: setProgressBarColor

import com.afollestad.materialdialogs.internal.MDTintHelper; //导入依赖的package包/类
private void setProgressBarColor(int color) {
    MDTintHelper.setTint(mProgressBar, color);
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:4,代码来源:HmmPlayerFragment.java

示例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;
}
 
开发者ID:easyredmine,项目名称:mobile_app_android,代码行数:7,代码来源:TasksEndlessAdapter.java


注:本文中的com.afollestad.materialdialogs.internal.MDTintHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。