本文整理汇总了Java中com.codetroopers.betterpickers.numberpicker.NumberPickerDialogFragment类的典型用法代码示例。如果您正苦于以下问题:Java NumberPickerDialogFragment类的具体用法?Java NumberPickerDialogFragment怎么用?Java NumberPickerDialogFragment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NumberPickerDialogFragment类属于com.codetroopers.betterpickers.numberpicker包,在下文中一共展示了NumberPickerDialogFragment类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTimeSet
import com.codetroopers.betterpickers.numberpicker.NumberPickerDialogFragment; //导入依赖的package包/类
/**
*
* @param dialog
* @param hourOfDay
* @param minute
*/
@Override
public void onTimeSet(RadialTimePickerDialogFragment dialog, final int hourOfDay, final int minute) {
NumberPickerBuilder npb = new NumberPickerBuilder()
.addNumberPickerDialogHandler(new NumberPickerDialogFragment.NumberPickerDialogHandlerV2() {
@Override
public void onDialogNumberSet(int reference, BigInteger number, double decimal, boolean isNegative, BigDecimal fullNumber) {
_calendar.set(_calendar.get(Calendar.YEAR),
_calendar.get(Calendar.MONTH),
_calendar.get(Calendar.DAY_OF_MONTH),
hourOfDay,
minute,
number.intValue());
_lastDateSet = _calendar.getTime();
System.out.println("Last date : " + _lastDateSet.getTime() / 1000);
_rView.setDate(_lastDateSet);
}
})
.setFragmentManager(getBaseActivity().getSupportFragmentManager())
.setStyleResId(R.style.BetterPickersDialogFragment)
.setLabelText("Seconds!");
npb.show();
}
示例2: onSelectYear
import com.codetroopers.betterpickers.numberpicker.NumberPickerDialogFragment; //导入依赖的package包/类
@OnClick(R.id.budgetYearTextView)
public void onSelectYear(View v) {
int currentYear = new MmxDate().getYear();
int year;
if (mModel.year != 0) {
year = mModel.year;
} else {
year = currentYear;
}
new NumberPickerBuilder()
.setFragmentManager(getSupportFragmentManager())
.setStyleResId(R.style.BetterPickersDialogFragment)
.setLabelText(getString(R.string.year))
.setPlusMinusVisibility(View.INVISIBLE)
.setDecimalVisibility(View.INVISIBLE)
.setMinNumber(BigDecimal.valueOf(currentYear - 10))
.setMaxNumber(BigDecimal.valueOf(currentYear + 10))
.setCurrentNumber(year)
.addNumberPickerDialogHandler(new NumberPickerDialogFragment.NumberPickerDialogHandlerV2() {
@Override
public void onDialogNumberSet(int reference, BigInteger number, double decimal, boolean isNegative, BigDecimal fullNumber) {
mModel.setYear(number.intValue());
viewHolder.refreshYear();
viewHolder.refreshName();
}
})
.show();
}
示例3: onSelectMonth
import com.codetroopers.betterpickers.numberpicker.NumberPickerDialogFragment; //导入依赖的package包/类
@OnClick(R.id.budgetMonthTextView)
public void onSelectMonth(View v) {
int month;
if (mModel.month != 0) {
month = mModel.month;
} else {
month = new MmxDate().getMonthOfYear();
}
new NumberPickerBuilder()
.setFragmentManager(getSupportFragmentManager())
.setStyleResId(R.style.BetterPickersDialogFragment)
.setLabelText(getString(R.string.month))
.setPlusMinusVisibility(View.INVISIBLE)
.setDecimalVisibility(View.INVISIBLE)
.setMinNumber(BigDecimal.ONE)
.setMaxNumber(BigDecimal.valueOf(12))
.setCurrentNumber(month)
.addNumberPickerDialogHandler(new NumberPickerDialogFragment.NumberPickerDialogHandlerV2() {
@Override
public void onDialogNumberSet(int reference, BigInteger number, double decimal, boolean isNegative, BigDecimal fullNumber) {
mModel.setMonth(number.intValue());
viewHolder.refreshMonth();
viewHolder.refreshName();
}
})
.show();
}