本文整理汇总了Java中com.android.datetimepicker.R类的典型用法代码示例。如果您正苦于以下问题:Java R类的具体用法?Java R怎么用?Java R使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
R类属于com.android.datetimepicker包,在下文中一共展示了R类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.android.datetimepicker.R; //导入依赖的package包/类
public void initialize(Context context, boolean is24HourMode) {
if (mIsInitialized) {
Log.e(TAG, "CircleView may only be initialized once.");
return;
}
Resources res = context.getResources();
mIs24HourMode = is24HourMode;
if (is24HourMode) {
mCircleRadiusMultiplier = Float.parseFloat(
res.getString(R.string.circle_radius_multiplier_24HourMode));
} else {
mCircleRadiusMultiplier = Float.parseFloat(
res.getString(R.string.circle_radius_multiplier));
mAmPmCircleRadiusMultiplier =
Float.parseFloat(res.getString(R.string.ampm_circle_radius_multiplier));
}
mIsInitialized = true;
}
示例2: YearPickerView
import com.android.datetimepicker.R; //导入依赖的package包/类
/**
* @param context
*/
public YearPickerView(Context context, DatePickerController controller) {
super(context);
mController = controller;
mController.registerOnDateChangedListener(this);
ViewGroup.LayoutParams frame = new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
setLayoutParams(frame);
Resources res = context.getResources();
mViewSize = res.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height);
mChildSize = res.getDimensionPixelOffset(R.dimen.year_label_height);
setVerticalFadingEdgeEnabled(true);
setFadingEdgeLength(mChildSize / 3);
init(context);
setOnItemClickListener(this);
setSelector(new StateListDrawable());
setDividerHeight(0);
onDateChanged();
}
示例3: setIndicatorColor
import com.android.datetimepicker.R; //导入依赖的package包/类
public void setIndicatorColor(int color) {
mCirclePaint.setColor(color);
int[][] states = new int[][] {
new int[] { android.R.attr.state_pressed}, // pressed
new int[] { } // default
};
int[] colors = new int[] {
color,
getResources().getColor(R.color.date_picker_text_normal)
};
ColorStateList colorStateList = new ColorStateList(states, colors);
setTextColor(colorStateList);
}
示例4: MonthPickerView
import com.android.datetimepicker.R; //导入依赖的package包/类
public MonthPickerView(Context context, DatePickerController controller) {
super(context);
mController = controller;
mController.registerOnDateChangedListener(this);
ViewGroup.LayoutParams frame = new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
setLayoutParams(frame);
Resources res = context.getResources();
mViewSize = res.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height);
mChildSize = res.getDimensionPixelOffset(R.dimen.year_label_height);
setVerticalFadingEdgeEnabled(true);
setFadingEdgeLength(mChildSize / 3);
init(context);
setOnItemClickListener(this);
setSelector(new StateListDrawable());
setDividerHeight(0);
onDateChanged();
}
示例5: TextViewWithCircularIndicator
import com.android.datetimepicker.R; //导入依赖的package包/类
public TextViewWithCircularIndicator(Context context, AttributeSet attrs) {
super(context, attrs);
Resources res = context.getResources();
mCircleColor = res.getColor(R.color.blue);
TypedArray attrArray = context.getTheme().obtainStyledAttributes(R.styleable.DateTimePicker);
int attrCount = attrArray.getIndexCount();
for (int i = 0; i < attrCount; i++) {
int attr = attrArray.getIndex(i);
switch (attr) {
case R.styleable.DateTimePicker_hightlightedTextColor:
ColorStateList stateList = attrArray.getColorStateList(attr);
mCircleColor = stateList.getColorForState(new int[]{android.R.attr.state_selected}, stateList.getDefaultColor());
break;
}
}
mRadius = res.getDimensionPixelOffset(R.dimen.month_select_circle_radius);
mItemIsSelectedText = context.getResources().getString(R.string.item_is_selected);
init();
}
示例6: YearPickerView
import com.android.datetimepicker.R; //导入依赖的package包/类
public YearPickerView(Context context, DatePickerController datePickerController) {
super(context);
this.mController = datePickerController;
this.mController.registerOnDateChangedListener(this);
setLayoutParams(new ViewGroup.LayoutParams(-1, -2));
Resources resources = context.getResources();
this.mViewSize = resources.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height);
this.mChildSize = resources.getDimensionPixelOffset(R.dimen.year_label_height);
setVerticalFadingEdgeEnabled(true);
setFadingEdgeLength(this.mChildSize / 3);
init(context);
setOnItemClickListener(this);
setSelector(new StateListDrawable());
setDividerHeight(0);
onDateChanged();
}
示例7: SimpleMonthView
import com.android.datetimepicker.R; //导入依赖的package包/类
public SimpleMonthView(Context context) {
super(context);
Resources resources = context.getResources();
this.mDayLabelCalendar = Calendar.getInstance();
this.mCalendar = Calendar.getInstance();
this.mDayOfWeekTypeface = resources.getString(R.string.day_of_week_label_typeface);
this.mMonthTitleTypeface = resources.getString(R.string.sans_serif);
this.mDayTextColor = resources.getColor(R.color.date_picker_text_normal);
this.mTodayNumberColor = resources.getColor(R.color.blue);
this.mMonthTitleColor = resources.getColor(R.color.white);
this.mMonthTitleBGColor = resources.getColor(R.color.circle_background);
this.mStringBuilder = new StringBuilder(50);
this.mFormatter = new Formatter(this.mStringBuilder, Locale.getDefault());
MINI_DAY_NUMBER_TEXT_SIZE = resources.getDimensionPixelSize(R.dimen.day_number_size);
MONTH_LABEL_TEXT_SIZE = resources.getDimensionPixelSize(R.dimen.month_label_size);
MONTH_DAY_LABEL_TEXT_SIZE = resources.getDimensionPixelSize(R.dimen.month_day_label_text_size);
MONTH_HEADER_SIZE = resources.getDimensionPixelOffset(R.dimen.month_list_item_header_height);
DAY_SELECTED_CIRCLE_SIZE = resources.getDimensionPixelSize(R.dimen.day_number_select_circle_radius);
this.mRowHeight = ((resources.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height) - MONTH_HEADER_SIZE) / 6);
initView();
}
示例8: CircleView
import com.android.datetimepicker.R; //导入依赖的package包/类
public CircleView(Context context) {
super(context);
Resources res = context.getResources();
mCircleColor = res.getColor(R.color.white);
mDotColor = res.getColor(R.color.numbers_text_color);
mPaint.setAntiAlias(true);
mIsInitialized = false;
}
示例9: setTheme
import com.android.datetimepicker.R; //导入依赖的package包/类
void setTheme(Context context, boolean dark) {
Resources res = context.getResources();
if (dark) {
mCircleColor = res.getColor(R.color.dark_gray);
mDotColor = res.getColor(R.color.light_gray);
} else {
mCircleColor = res.getColor(R.color.white);
mDotColor = res.getColor(R.color.numbers_text_color);
}
}
示例10: setTheme
import com.android.datetimepicker.R; //导入依赖的package包/类
void setTheme(Context context, boolean themeDark) {
Resources res = context.getResources();
int color;
if (themeDark) {
color = res.getColor(R.color.red);
mSelectionAlpha = SELECTED_ALPHA_THEME_DARK;
} else {
color = res.getColor(R.color.blue);
mSelectionAlpha = SELECTED_ALPHA;
}
mPaint.setColor(color);
}
示例11: setTheme
import com.android.datetimepicker.R; //导入依赖的package包/类
void setTheme(Context context, boolean themeDark) {
Resources res = context.getResources();
int textColor;
if (themeDark) {
textColor = res.getColor(R.color.white);
} else {
textColor = res.getColor(R.color.numbers_text_color);
}
mPaint.setColor(textColor);
}
示例12: initialize
import com.android.datetimepicker.R; //导入依赖的package包/类
public void initialize(Context context, int amOrPm) {
if (mIsInitialized) {
Log.e(TAG, "AmPmCirclesView may only be initialized once.");
return;
}
Resources res = context.getResources();
mUnselectedColor = res.getColor(R.color.white);
mSelectedColor = res.getColor(R.color.blue);
mAmPmTextColor = res.getColor(R.color.ampm_text_color);
mSelectedAlpha = SELECTED_ALPHA;
String typefaceFamily = res.getString(R.string.sans_serif);
Typeface tf = Typeface.create(typefaceFamily, Typeface.NORMAL);
mPaint.setTypeface(tf);
mPaint.setAntiAlias(true);
mPaint.setTextAlign(Align.CENTER);
mCircleRadiusMultiplier =
Float.parseFloat(res.getString(R.string.circle_radius_multiplier));
mAmPmCircleRadiusMultiplier =
Float.parseFloat(res.getString(R.string.ampm_circle_radius_multiplier));
String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
mAmText = amPmTexts[0];
mPmText = amPmTexts[1];
setAmOrPm(amOrPm);
mAmOrPmPressed = -1;
mIsInitialized = true;
}
示例13: setTheme
import com.android.datetimepicker.R; //导入依赖的package包/类
void setTheme(Context context, boolean themeDark) {
Resources res = context.getResources();
if (themeDark) {
mUnselectedColor = res.getColor(R.color.dark_gray);
mSelectedColor = res.getColor(R.color.red);
mAmPmTextColor = res.getColor(R.color.white);
mSelectedAlpha = SELECTED_ALPHA_THEME_DARK;
} else {
mUnselectedColor = res.getColor(R.color.white);
mSelectedColor = res.getColor(R.color.blue);
mAmPmTextColor = res.getColor(R.color.ampm_text_color);
mSelectedAlpha = SELECTED_ALPHA;
}
}
示例14: MonthView
import com.android.datetimepicker.R; //导入依赖的package包/类
public MonthView(Context context, AttributeSet attr) {
super(context, attr);
Resources res = context.getResources();
mDayLabelCalendar = Calendar.getInstance();
mCalendar = Calendar.getInstance();
mDayOfWeekTypeface = res.getString(R.string.day_of_week_label_typeface);
mMonthTitleTypeface = res.getString(R.string.sans_serif);
mDayTextColor = res.getColor(R.color.date_picker_text_normal);
mTodayNumberColor = res.getColor(R.color.blue);
mDisabledDayTextColor = res.getColor(R.color.date_picker_text_disabled);
mMonthTitleColor = res.getColor(R.color.white);
mMonthTitleBGColor = res.getColor(R.color.circle_background);
mStringBuilder = new StringBuilder(50);
mFormatter = new Formatter(mStringBuilder, Locale.getDefault());
MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.day_number_size);
MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_label_size);
MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.month_day_label_text_size);
MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.month_list_item_header_height);
DAY_SELECTED_CIRCLE_SIZE = res
.getDimensionPixelSize(R.dimen.day_number_select_circle_radius);
CIRCLE_INDICATOR_SiZE = Math.round(0.15f * (float)DAY_SELECTED_CIRCLE_SIZE);
mRowHeight = (res.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height)
- getMonthHeaderSize()) / MAX_NUM_ROWS;
// Set up accessibility components.
mTouchHelper = getMonthViewTouchHelper();
ViewCompat.setAccessibilityDelegate(this, mTouchHelper);
ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
mLockAccessibilityDelegate = true;
// Sets up any standard paints that will be used
initView();
}
示例15: setFixedHeight
import com.android.datetimepicker.R; //导入依赖的package包/类
public void setFixedHeight(int height) {
this.mFixedHeightFlag = height != -1;
if (this.mFixedHeightFlag) {
this.mFixedHeight = height;
mRowHeight = (height
- getMonthHeaderSize()) / MAX_NUM_ROWS;
} else {
mRowHeight = (getContext().getResources().getDimensionPixelOffset(R.dimen.date_picker_view_animator_height)
- getMonthHeaderSize()) / MAX_NUM_ROWS;
}
ROW_HEIGHT = mRowHeight;
}