public Dialog actionTextColor(int color) { positiveActionTextColor(color); negativeActionTextColor(color); neutralActionTextColor(color); return this; }
public Dialog applyStyle(int resId) { Context context = getContext(); TypedArray a = context.obtainStyledAttributes(resId, R.styleable.Dialog); int layout_width; int layout_height; if (ThemeUtil.getType(a, R.styleable.Dialog_android_layout_width) == TypedValue.TYPE_DIMENSION) layout_width = a.getDimensionPixelSize(R.styleable.Dialog_android_layout_width, 0); else layout_width = a.getInteger( R.styleable.Dialog_android_layout_width, ViewGroup.LayoutParams.WRAP_CONTENT); if (ThemeUtil.getType(a, R.styleable.Dialog_android_layout_height) == TypedValue.TYPE_DIMENSION) layout_height = a.getDimensionPixelSize(R.styleable.Dialog_android_layout_height, 0); else layout_height = a.getInteger( R.styleable.Dialog_android_layout_height, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParams(layout_width, layout_height); dimAmount(a.getFloat(R.styleable.Dialog_di_dimAmount, 0.5f)); backgroundColor( a.getColor( R.styleable.Dialog_di_backgroundColor, ThemeUtil.windowBackground(context, 0xFFFFFFFF))); maxElevation(a.getDimensionPixelOffset(R.styleable.Dialog_di_maxElevation, 0)); elevation( a.getDimensionPixelOffset(R.styleable.Dialog_di_elevation, ThemeUtil.dpToPx(context, 4))); cornerRadius( a.getDimensionPixelOffset( R.styleable.Dialog_di_cornerRadius, ThemeUtil.dpToPx(context, 2))); titleTextAppearance( a.getResourceId( R.styleable.Dialog_di_titleTextAppearance, R.style.TextAppearance_AppCompat_Title)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_titleTextColor) != TypedValue.TYPE_NULL) titleColor(a.getColor(R.styleable.Dialog_di_titleTextColor, 0)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_actionBackground) != TypedValue.TYPE_NULL) actionBackground(a.getResourceId(R.styleable.Dialog_di_actionBackground, 0)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_actionRipple) != TypedValue.TYPE_NULL) actionRipple(a.getResourceId(R.styleable.Dialog_di_actionRipple, 0)); actionTextAppearance( a.getResourceId( R.styleable.Dialog_di_actionTextAppearance, R.style.TextAppearance_AppCompat_Button)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_actionTextColor) != TypedValue.TYPE_NULL) actionTextColor(a.getColorStateList(R.styleable.Dialog_di_actionTextColor)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_positiveActionBackground) != TypedValue.TYPE_NULL) positiveActionBackground(a.getResourceId(R.styleable.Dialog_di_positiveActionBackground, 0)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_positiveActionRipple) != TypedValue.TYPE_NULL) positiveActionRipple(a.getResourceId(R.styleable.Dialog_di_positiveActionRipple, 0)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_positiveActionTextAppearance) != TypedValue.TYPE_NULL) positiveActionTextAppearance( a.getResourceId(R.styleable.Dialog_di_positiveActionTextAppearance, 0)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_positiveActionTextColor) != TypedValue.TYPE_NULL) positiveActionTextColor(a.getColorStateList(R.styleable.Dialog_di_positiveActionTextColor)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_negativeActionBackground) != TypedValue.TYPE_NULL) negativeActionBackground(a.getResourceId(R.styleable.Dialog_di_negativeActionBackground, 0)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_negativeActionRipple) != TypedValue.TYPE_NULL) negativeActionRipple(a.getResourceId(R.styleable.Dialog_di_negativeActionRipple, 0)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_negativeActionTextAppearance) != TypedValue.TYPE_NULL) negativeActionTextAppearance( a.getResourceId(R.styleable.Dialog_di_negativeActionTextAppearance, 0)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_negativeActionTextColor) != TypedValue.TYPE_NULL) negativeActionTextColor(a.getColorStateList(R.styleable.Dialog_di_negativeActionTextColor)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_neutralActionBackground) != TypedValue.TYPE_NULL) neutralActionBackground(a.getResourceId(R.styleable.Dialog_di_neutralActionBackground, 0)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_neutralActionRipple) != TypedValue.TYPE_NULL) neutralActionRipple(a.getResourceId(R.styleable.Dialog_di_neutralActionRipple, 0)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_neutralActionTextAppearance) != TypedValue.TYPE_NULL) neutralActionTextAppearance( a.getResourceId(R.styleable.Dialog_di_neutralActionTextAppearance, 0)); if (ThemeUtil.getType(a, R.styleable.Dialog_di_neutralActionTextColor) != TypedValue.TYPE_NULL) neutralActionTextColor(a.getColorStateList(R.styleable.Dialog_di_neutralActionTextColor)); inAnimation(a.getResourceId(R.styleable.Dialog_di_inAnimation, 0)); outAnimation(a.getResourceId(R.styleable.Dialog_di_outAnimation, 0)); dividerColor(a.getColor(R.styleable.Dialog_di_dividerColor, 0x1E000000)); dividerHeight( a.getDimensionPixelOffset( R.styleable.Dialog_di_dividerHeight, ThemeUtil.dpToPx(context, 1))); setCancelable(a.getBoolean(R.styleable.Dialog_di_cancelable, true)); setCanceledOnTouchOutside(a.getBoolean(R.styleable.Dialog_di_canceledOnTouchOutside, true)); a.recycle(); return this; }