Java 类com.afollestad.materialdialogs.R 实例源码

项目:GitHub    文件:MDTintHelper.java   
public static void setTint(@NonNull RadioButton radioButton,
                           @ColorInt int color) {
    final int disabledColor = DialogUtils.getDisabledColor(radioButton.getContext());
    ColorStateList sl = new ColorStateList(new int[][]{
            new int[]{android.R.attr.state_enabled, -android.R.attr.state_checked},
            new int[]{android.R.attr.state_enabled, android.R.attr.state_checked},
            new int[]{-android.R.attr.state_enabled, -android.R.attr.state_checked},
            new int[]{-android.R.attr.state_enabled, android.R.attr.state_checked}
    }, new int[]{
            DialogUtils.resolveColor(radioButton.getContext(), R.attr.colorControlNormal),
            color,
            disabledColor,
            disabledColor
    });
    setTint(radioButton, sl);
}
项目:GitHub    文件:MDRootLayout.java   
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    Resources r = context.getResources();

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MDRootLayout, defStyleAttr, 0);
    reducePaddingNoTitleNoButtons = a.getBoolean(R.styleable.MDRootLayout_md_reduce_padding_no_title_no_buttons, true);
    a.recycle();

    noTitlePaddingFull = r.getDimensionPixelSize(R.dimen.md_notitle_vertical_padding);
    buttonPaddingFull = r.getDimensionPixelSize(R.dimen.md_button_frame_vertical_padding);

    buttonHorizontalEdgeMargin = r.getDimensionPixelSize(R.dimen.md_button_padding_frame_side);
    buttonBarHeight = r.getDimensionPixelSize(R.dimen.md_button_height);

    dividerPaint = new Paint();
    dividerWidth = r.getDimensionPixelSize(R.dimen.md_divider_height);
    dividerPaint.setColor(DialogUtils.resolveColor(context, R.attr.md_divider_color));
    setWillNotDraw(false);
}
项目:GitHub    文件:MDRootLayout.java   
@Override public void onFinishInflate() {
    super.onFinishInflate();
    for (int i = 0; i < getChildCount(); i++) {
        View v = getChildAt(i);
        if (v.getId() == R.id.md_titleFrame) {
            titleBar = v;
        } else if (v.getId() == R.id.md_buttonDefaultNeutral) {
            buttons[INDEX_NEUTRAL] = (MDButton) v;
        } else if (v.getId() == R.id.md_buttonDefaultNegative) {
            buttons[INDEX_NEGATIVE] = (MDButton) v;
        } else if (v.getId() == R.id.md_buttonDefaultPositive) {
            buttons[INDEX_POSITIVE] = (MDButton) v;
        } else {
            content = v;
        }
    }
}
项目:EasyFrame    文件:MDTintHelper.java   
public static void setTint(@NonNull RadioButton radioButton, @ColorInt int color) {
    ColorStateList sl = new ColorStateList(new int[][]{
            new int[]{-android.R.attr.state_checked},
            new int[]{android.R.attr.state_checked}
    }, new int[]{
            DialogUtils.resolveColor(radioButton.getContext(), R.attr.colorControlNormal),
            color
    });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        radioButton.setButtonTintList(sl);
    } else {
        Drawable d = DrawableCompat.wrap(ContextCompat.getDrawable(radioButton.getContext(), R.drawable.abc_btn_radio_material));
        DrawableCompat.setTintList(d, sl);
        radioButton.setButtonDrawable(d);
    }
}
项目:EasyFrame    文件:MDTintHelper.java   
public static void setTint(@NonNull CheckBox box, @ColorInt int color) {
    ColorStateList sl = new ColorStateList(new int[][]{
            new int[]{-android.R.attr.state_checked},
            new int[]{android.R.attr.state_checked}
    }, new int[]{
            DialogUtils.resolveColor(box.getContext(), R.attr.colorControlNormal),
            color
    });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        box.setButtonTintList(sl);
    } else {
        Drawable drawable = DrawableCompat.wrap(ContextCompat.getDrawable(box.getContext(), R.drawable.abc_btn_check_material));
        DrawableCompat.setTintList(drawable, sl);
        box.setButtonDrawable(drawable);
    }
}
项目:EasyFrame    文件:MDRootLayout.java   
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    Resources r = context.getResources();

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MDRootLayout, defStyleAttr, 0);
    mReducePaddingNoTitleNoButtons = a.getBoolean(R.styleable.MDRootLayout_md_reduce_padding_no_title_no_buttons, true);
    a.recycle();

    mNoTitlePaddingFull = r.getDimensionPixelSize(R.dimen.md_notitle_vertical_padding);
    mButtonPaddingFull = r.getDimensionPixelSize(R.dimen.md_button_frame_vertical_padding);

    mButtonHorizontalEdgeMargin = r.getDimensionPixelSize(R.dimen.md_button_padding_frame_side);
    mButtonBarHeight = r.getDimensionPixelSize(R.dimen.md_button_height);

    mDividerPaint = new Paint();
    mDividerWidth = r.getDimensionPixelSize(R.dimen.md_divider_height);
    mDividerPaint.setColor(DialogUtils.resolveColor(context, R.attr.md_divider_color));
    setWillNotDraw(false);
}
项目:EasyFrame    文件:MDRootLayout.java   
@Override
public void onFinishInflate() {
    super.onFinishInflate();
    for (int i = 0; i < getChildCount(); i++) {
        View v = getChildAt(i);
        if (v.getId() == R.id.titleFrame) {
            mTitleBar = v;
        } else if (v.getId() == R.id.buttonDefaultNeutral) {
            mButtons[INDEX_NEUTRAL] = (MDButton) v;
        } else if (v.getId() == R.id.buttonDefaultNegative) {
            mButtons[INDEX_NEGATIVE] = (MDButton) v;
        } else if (v.getId() == R.id.buttonDefaultPositive) {
            mButtons[INDEX_POSITIVE] = (MDButton) v;
        } else {
            mContent = v;
        }
    }
}
项目:material-dialogs    文件:MDTintHelper.java   
public static void setTint(RadioButton radioButton, @ColorInt int color) {
  final int disabledColor = DialogUtils.getDisabledColor(radioButton.getContext());
  ColorStateList sl =
      new ColorStateList(
          new int[][] {
            new int[] {android.R.attr.state_enabled, -android.R.attr.state_checked},
            new int[] {android.R.attr.state_enabled, android.R.attr.state_checked},
            new int[] {-android.R.attr.state_enabled, -android.R.attr.state_checked},
            new int[] {-android.R.attr.state_enabled, android.R.attr.state_checked}
          },
          new int[] {
            DialogUtils.resolveColor(radioButton.getContext(), R.attr.colorControlNormal),
            color,
            disabledColor,
            disabledColor
          });
  setTint(radioButton, sl);
}
项目:material-dialogs    文件:MDTintHelper.java   
public static void setTint(CheckBox box, @ColorInt int color) {
  final int disabledColor = DialogUtils.getDisabledColor(box.getContext());
  ColorStateList sl =
      new ColorStateList(
          new int[][] {
            new int[] {android.R.attr.state_enabled, -android.R.attr.state_checked},
            new int[] {android.R.attr.state_enabled, android.R.attr.state_checked},
            new int[] {-android.R.attr.state_enabled, -android.R.attr.state_checked},
            new int[] {-android.R.attr.state_enabled, android.R.attr.state_checked}
          },
          new int[] {
            DialogUtils.resolveColor(box.getContext(), R.attr.colorControlNormal),
            color,
            disabledColor,
            disabledColor
          });
  setTint(box, sl);
}
项目:material-dialogs    文件:MDRootLayout.java   
private void init(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
  Resources r = context.getResources();

  TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MDRootLayout, defStyleAttr, 0);
  reducePaddingNoTitleNoButtons =
      a.getBoolean(R.styleable.MDRootLayout_md_reduce_padding_no_title_no_buttons, true);
  a.recycle();

  noTitlePaddingFull = r.getDimensionPixelSize(R.dimen.md_notitle_vertical_padding);
  buttonPaddingFull = r.getDimensionPixelSize(R.dimen.md_button_frame_vertical_padding);

  buttonHorizontalEdgeMargin = r.getDimensionPixelSize(R.dimen.md_button_padding_frame_side);
  buttonBarHeight = r.getDimensionPixelSize(R.dimen.md_button_height);

  dividerPaint = new Paint();
  dividerWidth = r.getDimensionPixelSize(R.dimen.md_divider_height);
  dividerPaint.setColor(DialogUtils.resolveColor(context, R.attr.md_divider_color));
  setWillNotDraw(false);
}
项目:material-dialogs    文件:MDRootLayout.java   
@Override
public void onFinishInflate() {
  super.onFinishInflate();
  for (int i = 0; i < getChildCount(); i++) {
    View v = getChildAt(i);
    if (v.getId() == R.id.md_titleFrame) {
      titleBar = v;
    } else if (v.getId() == R.id.md_buttonDefaultNeutral) {
      buttons[INDEX_NEUTRAL] = (MDButton) v;
    } else if (v.getId() == R.id.md_buttonDefaultNegative) {
      buttons[INDEX_NEGATIVE] = (MDButton) v;
    } else if (v.getId() == R.id.md_buttonDefaultPositive) {
      buttons[INDEX_POSITIVE] = (MDButton) v;
    } else if (v.getId() == R.id.md_promptCheckbox) {
      checkPrompt = (CheckBox) v;
    } else {
      content = v;
    }
  }
}
项目:GitHub    文件:MDTintHelper.java   
public static void setTint(@NonNull RadioButton radioButton,
                           @NonNull ColorStateList colors) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        radioButton.setButtonTintList(colors);
    } else {
        Drawable radioDrawable = ContextCompat.getDrawable(radioButton.getContext(),
                R.drawable.abc_btn_radio_material);
        Drawable d = DrawableCompat.wrap(radioDrawable);
        DrawableCompat.setTintList(d, colors);
        radioButton.setButtonDrawable(d);
    }
}
项目:GitHub    文件:MDTintHelper.java   
public static void setTint(@NonNull CheckBox box, @ColorInt int color) {
    final int disabledColor = DialogUtils.getDisabledColor(box.getContext());
    ColorStateList sl = new ColorStateList(new int[][]{
            new int[]{android.R.attr.state_enabled, -android.R.attr.state_checked},
            new int[]{android.R.attr.state_enabled, android.R.attr.state_checked},
            new int[]{-android.R.attr.state_enabled, -android.R.attr.state_checked},
            new int[]{-android.R.attr.state_enabled, android.R.attr.state_checked}
    }, new int[]{
            DialogUtils.resolveColor(box.getContext(), R.attr.colorControlNormal),
            color,
            disabledColor,
            disabledColor
    });
    setTint(box, sl);
}
项目:GitHub    文件:MDTintHelper.java   
private static ColorStateList createEditTextColorStateList(
        @NonNull Context context, @ColorInt int color) {
    int[][] states = new int[3][];
    int[] colors = new int[3];
    int i = 0;
    states[i] = new int[]{-android.R.attr.state_enabled};
    colors[i] = DialogUtils.resolveColor(context, R.attr.colorControlNormal);
    i++;
    states[i] = new int[]{-android.R.attr.state_pressed, -android.R.attr.state_focused};
    colors[i] = DialogUtils.resolveColor(context, R.attr.colorControlNormal);
    i++;
    states[i] = new int[]{};
    colors[i] = color;
    return new ColorStateList(states, colors);
}
项目:EasyFrame    文件:MDTintHelper.java   
private static ColorStateList createEditTextColorStateList(@NonNull Context context, @ColorInt int color) {
    int[][] states = new int[3][];
    int[] colors = new int[3];
    int i = 0;
    states[i] = new int[]{-android.R.attr.state_enabled};
    colors[i] = DialogUtils.resolveColor(context, R.attr.colorControlNormal);
    i++;
    states[i] = new int[]{-android.R.attr.state_pressed, -android.R.attr.state_focused};
    colors[i] = DialogUtils.resolveColor(context, R.attr.colorControlNormal);
    i++;
    states[i] = new int[]{};
    colors[i] = color;
    return new ColorStateList(states, colors);
}
项目:material-dialogs    文件:MDTintHelper.java   
public static void setTint(RadioButton radioButton, ColorStateList colors) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
    radioButton.setButtonTintList(colors);
  } else {
    Drawable radioDrawable =
        ContextCompat.getDrawable(radioButton.getContext(), R.drawable.abc_btn_radio_material);
    Drawable d = DrawableCompat.wrap(radioDrawable);
    DrawableCompat.setTintList(d, colors);
    radioButton.setButtonDrawable(d);
  }
}
项目:material-dialogs    文件:MDTintHelper.java   
private static ColorStateList createEditTextColorStateList(Context context, @ColorInt int color) {
  int[][] states = new int[3][];
  int[] colors = new int[3];
  int i = 0;
  states[i] = new int[] {-android.R.attr.state_enabled};
  colors[i] = DialogUtils.resolveColor(context, R.attr.colorControlNormal);
  i++;
  states[i] = new int[] {-android.R.attr.state_pressed, -android.R.attr.state_focused};
  colors[i] = DialogUtils.resolveColor(context, R.attr.colorControlNormal);
  i++;
  states[i] = new int[] {};
  colors[i] = color;
  return new ColorStateList(states, colors);
}
项目:GitHub    文件:MDButton.java   
private void init(Context context) {
    stackedEndPadding = context.getResources()
            .getDimensionPixelSize(R.dimen.md_dialog_frame_margin);
    stackedGravity = GravityEnum.END;
}
项目:EasyFrame    文件:ProgressDrawableBase.java   
public ProgressDrawableBase(Context context) {
    int colorControlActivated = DialogUtils.resolveColor(context, R.attr.colorControlActivated);
    // setTint() has been overridden for compatibility; DrawableCompat won't work because
    // wrapped Drawable won't be Animatable.
    setTint(colorControlActivated);
}
项目:EasyFrame    文件:MDButton.java   
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    mStackedEndPadding = context.getResources()
            .getDimensionPixelSize(R.dimen.md_dialog_frame_margin);
    mStackedGravity = GravityEnum.END;
}
项目:material-dialogs    文件:MDButton.java   
private void init(Context context) {
  stackedEndPadding =
      context.getResources().getDimensionPixelSize(R.dimen.md_dialog_frame_margin);
  stackedGravity = GravityEnum.END;
}