本文整理汇总了Java中com.wdullaer.materialdatetimepicker.Utils类的典型用法代码示例。如果您正苦于以下问题:Java Utils类的具体用法?Java Utils怎么用?Java Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Utils类属于com.wdullaer.materialdatetimepicker包,在下文中一共展示了Utils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateAmPmDisplay
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private void updateAmPmDisplay(int amOrPm) {
if (mVersion == Version.VERSION_2) {
if (amOrPm == AM) {
mAmTextView.setTextColor(mSelectedColor);
mPmTextView.setTextColor(mUnselectedColor);
Utils.tryAccessibilityAnnounce(mTimePicker, mAmText);
} else {
mAmTextView.setTextColor(mUnselectedColor);
mPmTextView.setTextColor(mSelectedColor);
Utils.tryAccessibilityAnnounce(mTimePicker, mPmText);
}
} else {
if (amOrPm == AM) {
mPmTextView.setText(mAmText);
Utils.tryAccessibilityAnnounce(mTimePicker, mAmText);
mPmTextView.setContentDescription(mAmText);
} else if (amOrPm == PM){
mPmTextView.setText(mPmText);
Utils.tryAccessibilityAnnounce(mTimePicker, mPmText);
mPmTextView.setContentDescription(mPmText);
} else {
mPmTextView.setText(mDoublePlaceholderText);
}
}
}
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:26,代码来源:TimePickerDialog.java
示例2: setHour
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private void setHour(int value, boolean announce) {
String format;
if (mIs24HourMode) {
format = "%02d";
} else {
format = "%d";
value = value % 12;
if (value == 0) {
value = 12;
}
}
CharSequence text = String.format(format, value);
mHourView.setText(text);
mHourSpaceView.setText(text);
if (announce) {
Utils.tryAccessibilityAnnounce(mTimePicker, text);
}
}
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:20,代码来源:TimePickerDialog.java
示例3: onValueSelected
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
public void onValueSelected(int pickerIndex, int newValue, boolean autoAdvance) {
if (pickerIndex == 0) {
setHour(newValue, false);
String announcement = String.format("%d", new Object[]{Integer.valueOf(newValue)});
if (this.mAllowAutoAdvance && autoAdvance) {
setCurrentItemShowing(1, true, true, false);
announcement = announcement + ". " + this.mSelectMinutes;
} else {
this.mTimePicker.setContentDescription(this.mHourPickerDescription + ": " +
newValue);
}
Utils.tryAccessibilityAnnounce(this.mTimePicker, announcement);
} else if (pickerIndex == 1) {
setMinute(newValue);
this.mTimePicker.setContentDescription(this.mMinutePickerDescription + ": " + newValue);
} else if (pickerIndex == 2) {
updateAmPmDisplay(newValue);
} else if (pickerIndex == 3) {
if (!isTypedTimeFullyLegal()) {
this.mTypedTimes.clear();
}
finishKbMode(true);
}
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:TimePickerDialog.java
示例4: setHour
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private void setHour(int value, boolean announce) {
String format;
if (this.mIs24HourMode) {
format = "%02d";
} else {
format = "%d";
value %= 12;
if (value == 0) {
value = 12;
}
}
CharSequence text = String.format(format, new Object[]{Integer.valueOf(value)});
this.mHourView.setText(text);
this.mHourSpaceView.setText(text);
if (announce) {
Utils.tryAccessibilityAnnounce(this.mTimePicker, text);
}
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:TimePickerDialog.java
示例5: addKeyIfLegal
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private boolean addKeyIfLegal(int keyCode) {
if (this.mIs24HourMode && this.mTypedTimes.size() == 4) {
return false;
}
if (!this.mIs24HourMode && isTypedTimeFullyLegal()) {
return false;
}
this.mTypedTimes.add(Integer.valueOf(keyCode));
if (isTypedTimeLegalSoFar()) {
int val = getValFromKeyCode(keyCode);
Utils.tryAccessibilityAnnounce(this.mTimePicker, String.format("%d", new
Object[]{Integer.valueOf(val)}));
if (isTypedTimeFullyLegal()) {
if (!this.mIs24HourMode && this.mTypedTimes.size() <= 3) {
this.mTypedTimes.add(this.mTypedTimes.size() - 1, Integer.valueOf(7));
this.mTypedTimes.add(this.mTypedTimes.size() - 1, Integer.valueOf(7));
}
this.mOkButton.setEnabled(true);
}
return true;
}
deleteLastTypedKey();
return false;
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:TimePickerDialog.java
示例6: updateDisplay
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private void updateDisplay(boolean announce) {
if (this.mDayOfWeekView != null) {
this.mDayOfWeekView.setText(this.mCalendar.getDisplayName(7, 2, Locale.getDefault())
.toUpperCase(Locale.getDefault()));
}
this.mSelectedMonthTextView.setText(this.mCalendar.getDisplayName(2, 1, Locale.getDefault
()).toUpperCase(Locale.getDefault()));
this.mSelectedDayTextView.setText(DAY_FORMAT.format(this.mCalendar.getTime()));
this.mYearView.setText(YEAR_FORMAT.format(this.mCalendar.getTime()));
long millis = this.mCalendar.getTimeInMillis();
this.mAnimator.setDateMillis(millis);
this.mMonthAndDayView.setContentDescription(DateUtils.formatDateTime(getActivity(),
millis, 24));
if (announce) {
Utils.tryAccessibilityAnnounce(this.mAnimator, DateUtils.formatDateTime(getActivity()
, millis, 20));
}
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:DatePickerDialog.java
示例7: onValueSelected
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
/**
* Called by the picker for updating the header display.
*/
@Override
public void onValueSelected(int pickerIndex, int newValue, boolean autoAdvance) {
if (pickerIndex == HOUR_INDEX) {
setHour(newValue, false);
String announcement = String.format("%d", newValue);
if (mAllowAutoAdvance && autoAdvance) {
setCurrentItemShowing(MINUTE_INDEX, true, true, false);
announcement += ". " + mSelectMinutes;
} else {
mTimePicker.setContentDescription(mHourPickerDescription + ": " + newValue);
}
Utils.tryAccessibilityAnnounce(mTimePicker, announcement);
} else if (pickerIndex == MINUTE_INDEX){
setMinute(newValue);
mTimePicker.setContentDescription(mMinutePickerDescription + ": " + newValue);
} else if (pickerIndex == AMPM_INDEX) {
updateAmPmDisplay(newValue);
} else if (pickerIndex == ENABLE_PICKER_INDEX) {
if (!isTypedTimeFullyLegal()) {
mTypedTimes.clear();
}
finishKbMode(true);
}
}
开发者ID:ZalemSoftware,项目名称:Ymir,代码行数:29,代码来源:TimePickerFragment.java
示例8: updateDisplay
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private void updateDisplay(boolean announce) {
if (mDayOfWeekView != null) {
mDayOfWeekView.setText(mCalendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG,
Locale.getDefault()).toUpperCase(Locale.getDefault()));
}
mSelectedMonthTextView.setText(mCalendar.getDisplayName(Calendar.MONTH, Calendar.SHORT,
Locale.getDefault()).toUpperCase(Locale.getDefault()));
mSelectedDayTextView.setText(DAY_FORMAT.format(mCalendar.getTime()));
mYearView.setText(YEAR_FORMAT.format(mCalendar.getTime()));
// Accessibility.
long millis = mCalendar.getTimeInMillis();
mAnimator.setDateMillis(millis);
int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_YEAR;
String monthAndDayText = DateUtils.formatDateTime(getActivity(), millis, flags);
mMonthAndDayView.setContentDescription(monthAndDayText);
if (announce) {
flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR;
String fullDateText = DateUtils.formatDateTime(getActivity(), millis, flags);
Utils.tryAccessibilityAnnounce(mAnimator, fullDateText);
}
}
开发者ID:ZalemSoftware,项目名称:Ymir,代码行数:25,代码来源:DatePickerFragment.java
示例9: setMinute
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private void setMinute(int value) {
if (value == 60) {
value = 0;
}
CharSequence text = String.format(Locale.getDefault(), "%02d", value);
Utils.tryAccessibilityAnnounce(mTimePicker, text);
mMinuteView.setText(text);
mMinuteSpaceView.setText(text);
}
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:10,代码来源:TimePickerDialog.java
示例10: setSecond
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private void setSecond(int value) {
if(value == 60) {
value = 0;
}
CharSequence text = String.format(Locale.getDefault(), "%02d", value);
Utils.tryAccessibilityAnnounce(mTimePicker, text);
mSecondView.setText(text);
mSecondSpaceView.setText(text);
}
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:10,代码来源:TimePickerDialog.java
示例11: addKeyIfLegal
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private boolean addKeyIfLegal(int keyCode) {
// If we're in 24hour mode, we'll need to check if the input is full. If in AM/PM mode,
// we'll need to see if AM/PM have been typed.
int textSize = 6;
if (mEnableMinutes && !mEnableSeconds) textSize = 4;
if (!mEnableMinutes && !mEnableSeconds) textSize = 2;
if ((mIs24HourMode && mTypedTimes.size() == textSize) ||
(!mIs24HourMode && isTypedTimeFullyLegal())) {
return false;
}
mTypedTimes.add(keyCode);
if (!isTypedTimeLegalSoFar()) {
deleteLastTypedKey();
return false;
}
int val = getValFromKeyCode(keyCode);
Utils.tryAccessibilityAnnounce(mTimePicker, String.format(Locale.getDefault(), "%d", val));
// Automatically fill in 0's if AM or PM was legally entered.
if (isTypedTimeFullyLegal()) {
if (!mIs24HourMode && mTypedTimes.size() <= (textSize - 1)) {
mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0);
mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0);
}
mOkButton.setEnabled(true);
}
return true;
}
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:31,代码来源:TimePickerDialog.java
示例12: updateDisplay
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private void updateDisplay(boolean announce) {
mYearView.setText(YEAR_FORMAT.format(mCalendar.getTime()));
if (mVersion == Version.VERSION_1) {
if (mDatePickerHeaderView != null) {
if (mTitle != null)
mDatePickerHeaderView.setText(mTitle.toUpperCase(Locale.getDefault()));
else {
mDatePickerHeaderView.setText(mCalendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG,
Locale.getDefault()).toUpperCase(Locale.getDefault()));
}
}
mSelectedMonthTextView.setText(MONTH_FORMAT.format(mCalendar.getTime()));
mSelectedDayTextView.setText(DAY_FORMAT.format(mCalendar.getTime()));
}
if (mVersion == Version.VERSION_2) {
mSelectedDayTextView.setText(VERSION_2_FORMAT.format(mCalendar.getTime()));
if (mTitle != null)
mDatePickerHeaderView.setText(mTitle.toUpperCase(Locale.getDefault()));
else
mDatePickerHeaderView.setVisibility(View.GONE);
}
// Accessibility.
long millis = mCalendar.getTimeInMillis();
mAnimator.setDateMillis(millis);
int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_YEAR;
String monthAndDayText = DateUtils.formatDateTime(getActivity(), millis, flags);
mMonthAndDayView.setContentDescription(monthAndDayText);
if (announce) {
flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR;
String fullDateText = DateUtils.formatDateTime(getActivity(), millis, flags);
Utils.tryAccessibilityAnnounce(mAnimator, fullDateText);
}
}
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:38,代码来源:DatePickerDialog.java
示例13: updateAmPmDisplay
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private void updateAmPmDisplay(int amOrPm) {
if (amOrPm == 0) {
this.mAmPmTextView.setText(this.mAmText);
Utils.tryAccessibilityAnnounce(this.mTimePicker, this.mAmText);
this.mAmPmHitspace.setContentDescription(this.mAmText);
} else if (amOrPm == 1) {
this.mAmPmTextView.setText(this.mPmText);
Utils.tryAccessibilityAnnounce(this.mTimePicker, this.mPmText);
this.mAmPmHitspace.setContentDescription(this.mPmText);
} else {
this.mAmPmTextView.setText(this.mDoublePlaceholderText);
}
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:TimePickerDialog.java
示例14: setMinute
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private void setMinute(int value) {
if (value == 60) {
value = 0;
}
CharSequence text = String.format(Locale.getDefault(), "%02d", new Object[]{Integer
.valueOf(value)});
Utils.tryAccessibilityAnnounce(this.mTimePicker, text);
this.mMinuteView.setText(text);
this.mMinuteSpaceView.setText(text);
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:TimePickerDialog.java
示例15: setCurrentItemShowing
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private void setCurrentItemShowing(int index, boolean animateCircle, boolean
delayLabelAnimate, boolean announce) {
TextView labelToAnimate;
this.mTimePicker.setCurrentItemShowing(index, animateCircle);
if (index == 0) {
int hours = this.mTimePicker.getHours();
if (!this.mIs24HourMode) {
hours %= 12;
}
this.mTimePicker.setContentDescription(this.mHourPickerDescription + ": " + hours);
if (announce) {
Utils.tryAccessibilityAnnounce(this.mTimePicker, this.mSelectHours);
}
labelToAnimate = this.mHourView;
} else {
this.mTimePicker.setContentDescription(this.mMinutePickerDescription + ": " + this
.mTimePicker.getMinutes());
if (announce) {
Utils.tryAccessibilityAnnounce(this.mTimePicker, this.mSelectMinutes);
}
labelToAnimate = this.mMinuteView;
}
int hourColor = index == 0 ? this.mSelectedColor : this.mUnselectedColor;
int minuteColor = index == 1 ? this.mSelectedColor : this.mUnselectedColor;
this.mHourView.setTextColor(hourColor);
this.mMinuteView.setTextColor(minuteColor);
ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f);
if (delayLabelAnimate) {
pulseAnimator.setStartDelay(300);
}
pulseAnimator.start();
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:33,代码来源:TimePickerDialog.java
示例16: initialize
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
public void initialize(Context context, TimePickerController controller, int amOrPm) {
if (this.mIsInitialized) {
Log.e(TAG, "AmPmCirclesView may only be initialized once.");
return;
}
Resources res = context.getResources();
if (controller.isThemeDark()) {
this.mUnselectedColor = res.getColor(R.color.mdtp_circle_background_dark_theme);
this.mAmPmTextColor = res.getColor(R.color.mdtp_white);
this.mSelectedAlpha = 255;
} else {
this.mUnselectedColor = res.getColor(R.color.mdtp_white);
this.mAmPmTextColor = res.getColor(R.color.mdtp_ampm_text_color);
this.mSelectedAlpha = 255;
}
this.mSelectedColor = controller.getAccentColor();
this.mTouchedColor = Utils.darkenColor(this.mSelectedColor);
this.mAmPmSelectedTextColor = res.getColor(R.color.mdtp_white);
this.mPaint.setTypeface(Typeface.create(res.getString(R.string.mdtp_sans_serif), 0));
this.mPaint.setAntiAlias(true);
this.mPaint.setTextAlign(Align.CENTER);
this.mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string
.mdtp_circle_radius_multiplier));
this.mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string
.mdtp_ampm_circle_radius_multiplier));
String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
this.mAmText = amPmTexts[0];
this.mPmText = amPmTexts[1];
setAmOrPm(amOrPm);
this.mAmOrPmPressed = -1;
this.mIsInitialized = true;
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:33,代码来源:AmPmCirclesView.java
示例17: performAccessibilityAction
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
@SuppressLint({"NewApi"})
public boolean performAccessibilityAction(int action, Bundle arguments) {
if (action != 4096 && action != 8192) {
return super.performAccessibilityAction(action, arguments);
}
int firstVisiblePosition = getFirstVisiblePosition();
CalendarDay day = new CalendarDay((firstVisiblePosition / 12) + this.mController
.getMinYear(), firstVisiblePosition % 12, 1);
if (action == 4096) {
day.month++;
if (day.month == 12) {
day.month = 0;
day.year++;
}
} else if (action == 8192) {
View firstVisibleView = getChildAt(0);
if (firstVisibleView != null && firstVisibleView.getTop() >= -1) {
day.month--;
if (day.month == -1) {
day.month = 11;
day.year--;
}
}
}
Utils.tryAccessibilityAnnounce(this, getMonthAndYearString(day));
goTo(day, true, false, true);
this.mPerformingScroll = true;
return true;
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:30,代码来源:DayPickerView.java
示例18: updateAmPmDisplay
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private void updateAmPmDisplay(int amOrPm) {
if (amOrPm == AM) {
mAmPmTextView.setText(mAmText);
Utils.tryAccessibilityAnnounce(mTimePicker, mAmText);
mAmPmHitspace.setContentDescription(mAmText);
} else if (amOrPm == PM){
mAmPmTextView.setText(mPmText);
Utils.tryAccessibilityAnnounce(mTimePicker, mPmText);
mAmPmHitspace.setContentDescription(mPmText);
} else {
mAmPmTextView.setText(mDoublePlaceholderText);
}
}
开发者ID:Tabrizian,项目名称:PersianAndroidDateTimePicker,代码行数:14,代码来源:TimePickerDialog.java
示例19: addKeyIfLegal
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private boolean addKeyIfLegal(int keyCode) {
// If we're in 24hour mode, we'll need to check if the input is full. If in AM/PM mode,
// we'll need to see if AM/PM have been typed.
int textSize = 6;
if (mEnableMinutes && !mEnableSeconds) textSize = 4;
if (!mEnableMinutes && !mEnableSeconds) textSize = 2;
if ((mIs24HourMode && mTypedTimes.size() == textSize) ||
(!mIs24HourMode && isTypedTimeFullyLegal())) {
return false;
}
mTypedTimes.add(keyCode);
if (!isTypedTimeLegalSoFar()) {
deleteLastTypedKey();
return false;
}
int val = getValFromKeyCode(keyCode);
Utils.tryAccessibilityAnnounce(mTimePicker, String.format("%d", val));
// Automatically fill in 0's if AM or PM was legally entered.
if (isTypedTimeFullyLegal()) {
if (!mIs24HourMode && mTypedTimes.size() <= (textSize - 1)) {
mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0);
mTypedTimes.add(mTypedTimes.size() - 1, KeyEvent.KEYCODE_0);
}
mOkButton.setEnabled(true);
}
return true;
}
开发者ID:Tabrizian,项目名称:PersianAndroidDateTimePicker,代码行数:31,代码来源:TimePickerDialog.java
示例20: setCurrentItemShowing
import com.wdullaer.materialdatetimepicker.Utils; //导入依赖的package包/类
private void setCurrentItemShowing(int index, boolean animateCircle, boolean delayLabelAnimate,
boolean announce) {
mTimePicker.setCurrentItemShowing(index, animateCircle);
TextView labelToAnimate;
if (index == HOUR_INDEX) {
int hours = mTimePicker.getHours();
if (!mIs24HourMode) {
hours = hours % 12;
}
mTimePicker.setContentDescription(mHourPickerDescription + ": " + hours);
if (announce) {
Utils.tryAccessibilityAnnounce(mTimePicker, mSelectHours);
}
labelToAnimate = mHourView;
} else {
int minutes = mTimePicker.getMinutes();
mTimePicker.setContentDescription(mMinutePickerDescription + ": " + minutes);
if (announce) {
Utils.tryAccessibilityAnnounce(mTimePicker, mSelectMinutes);
}
labelToAnimate = mMinuteView;
}
int hourColor = (index == HOUR_INDEX)? mSelectedColor : mUnselectedColor;
int minuteColor = (index == MINUTE_INDEX)? mSelectedColor : mUnselectedColor;
mHourView.setTextColor(hourColor);
mMinuteView.setTextColor(minuteColor);
ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f);
if (delayLabelAnimate) {
pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY);
}
pulseAnimator.start();
}
开发者ID:ZalemSoftware,项目名称:Ymir,代码行数:36,代码来源:TimePickerFragment.java
注:本文中的com.wdullaer.materialdatetimepicker.Utils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论