本文整理汇总了Java中com.jzxiang.pickerview.data.Type类的典型用法代码示例。如果您正苦于以下问题:Java Type类的具体用法?Java Type怎么用?Java Type使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Type类属于com.jzxiang.pickerview.data包,在下文中一共展示了Type类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTimePickerDialog
import com.jzxiang.pickerview.data.Type; //导入依赖的package包/类
private TimePickerDialog getTimePickerDialog() {
if (mTimePickerDialog != null) {
return mTimePickerDialog;
}
mTimePickerDialog = new TimePickerDialog.Builder()
.setCallBack(mOnDateSetListener)
.setTitleStringId(getString(R.string.text_time_picker_title))
.setSureStringId(getString(R.string.text_time_picker_ok))
.setCancelStringId(getString(R.string.text_time_picker_cancel))
.setYearText(getString(R.string.text_time_picker_year))
.setMonthText(getString(R.string.text_time_picker_month))
.setDayText(getString(R.string.text_time_picker_day))
.setHourText(getString(R.string.text_time_picker_hour))
.setMinuteText(getString(R.string.text_time_picker_minute))
.setCyclic(false)
.setCurrentMillseconds(System.currentTimeMillis())
.setThemeColor(ContextCompat.getColor(getActivity(), R.color.colorPrimary))
.setType(Type.ALL)
// .setWheelItemTextNormalColor(ContextCompat.getColor(getActivity(), R.color.colorPrimary))
.setWheelItemTextSelectorColor(ContextCompat.getColor(getActivity(), R.color.colorAccent))
.setWheelItemTextSize(16)
.build();
return mTimePickerDialog;
}
示例2: onCreate
import com.jzxiang.pickerview.data.Type; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
long tenYears = 10L * 365 * 1000 * 60 * 60 * 24L;
mDialogAll = new TimePickerDialog.Builder()
.setCallBack(this)
.setCancelStringId("Cancel")
.setSureStringId("Sure")
.setTitleStringId("TimePicker")
.setYearText("Year")
.setMonthText("Month")
.setDayText("Day")
.setHourText("Hour")
.setMinuteText("Minute")
.setCyclic(false)
.setMinMillseconds(System.currentTimeMillis())
.setMaxMillseconds(System.currentTimeMillis() + tenYears)
.setCurrentMillseconds(System.currentTimeMillis())
.setThemeColor(getResources().getColor(R.color.timepicker_dialog_bg))
.setType(Type.ALL)
.setWheelItemTextNormalColor(getResources().getColor(R.color.timetimepicker_default_text_color))
.setWheelItemTextSelectorColor(getResources().getColor(R.color.timepicker_toolbar_bg))
.setWheelItemTextSize(12)
.build();
// mDialogAll = new TimePickerDialog.Builder()
// .setMinMillseconds(System.currentTimeMillis())
// .setThemeColor(R.color.colorPrimary)
// .setWheelItemTextSize(16)
// .setCallBack(this)
// .build();
mDialogYearMonth = new TimePickerDialog.Builder()
.setType(Type.YEAR_MONTH)
.setThemeColor(getResources().getColor(R.color.colorPrimary))
.setCallBack(this)
.build();
mDialogYearMonthDay = new TimePickerDialog.Builder()
.setType(Type.YEAR_MONTH_DAY)
.setCallBack(this)
.build();
mDialogMonthDayHourMinute = new TimePickerDialog.Builder()
.setType(Type.MONTH_DAY_HOUR_MIN)
.setCallBack(this)
.build();
mDialogHourMinute = new TimePickerDialog.Builder()
.setType(Type.HOURS_MINS)
.setCallBack(this)
.build();
}
示例3: setType
import com.jzxiang.pickerview.data.Type; //导入依赖的package包/类
public Builder setType(Type type) {
mPickerConfig.mType = type;
return this;
}
示例4: getDateUpdateWatcher
import com.jzxiang.pickerview.data.Type; //导入依赖的package包/类
protected View.OnClickListener getDateUpdateWatcher(final int pickerType)
{
return new View.OnClickListener()
{
protected void setValue()
{
DateTime.this.setText(mDateFormat.format(mCalendar.getTime()));
}
@Override
public void onClick(View view)
{
Context context = DateTime.this.getContext();
String title = null;
Type type = Type.ALL;
switch (pickerType) {
case GeoConstants.FTDate:
title = context.getString(R.string.field_type_date);
type = Type.YEAR_MONTH_DAY;
break;
case GeoConstants.FTTime:
title = context.getString(R.string.field_type_time);
type = Type.HOURS_MINS;
break;
case GeoConstants.FTDateTime:
title = context.getString(R.string.field_type_datetime);
type = Type.ALL;
break;
}
OnDateSetListener onDateSetListener = new OnDateSetListener() {
@Override
public void onDateSet(TimePickerDialog timePickerView, long milliseconds) {
mCalendar.setTimeInMillis(milliseconds);
setValue();
}
};
mTimeDialog = new TimePickerDialog.Builder()
.setCallBack(onDateSetListener)
.setTitleStringId(title)
.setSureStringId(context.getString(android.R.string.ok))
.setCancelStringId(context.getString(android.R.string.cancel))
.setYearText(" " + context.getString(R.string.unit_year))
.setMonthText(" " + context.getString(R.string.unit_month))
.setDayText(" " + context.getString(R.string.unit_day))
.setHourText(" " + context.getString(R.string.unit_hour))
.setMinuteText(" " + context.getString(R.string.unit_min))
.setType(type)
.setCyclic(false)
.setMinMillseconds(1)
.setMaxMillseconds(Long.MAX_VALUE)
.setCurrentMillseconds(mCalendar.getTimeInMillis())
.setWheelItemTextSize(12)
.setWheelItemTextNormalColor(ContextCompat.getColor(getContext(), R.color.timetimepicker_default_text_color))
.setWheelItemTextSelectorColor(ContextCompat.getColor(getContext(), R.color.accent))
.setThemeColor(ContextCompat.getColor(getContext(), R.color.primary_dark))
.build();
AppCompatActivity activity = ControlHelper.getActivity(getContext());
if (activity != null)
mTimeDialog.show(activity.getSupportFragmentManager(), "TimePickerDialog");
}
};
}
示例5: getDateUpdateWatcher
import com.jzxiang.pickerview.data.Type; //导入依赖的package包/类
protected View.OnClickListener getDateUpdateWatcher(final int pickerType)
{
return new View.OnClickListener()
{
protected Calendar mCalendar = Calendar.getInstance();
protected void setValue()
{
mValue = mCalendar.getTimeInMillis();
DateTime.this.setText(getText());
}
@Override
public void onClick(View view)
{
Context context = DateTime.this.getContext();
if (null != mValue) {
mCalendar.setTimeInMillis(mValue);
} else {
mCalendar.setTime(new Date());
}
String title = null;
Type type = Type.ALL;
switch (pickerType) {
case GeoConstants.FTDate:
title = context.getString(R.string.field_type_date);
type = Type.YEAR_MONTH_DAY;
break;
case GeoConstants.FTTime:
title = context.getString(R.string.field_type_time);
type = Type.HOURS_MINS;
break;
case GeoConstants.FTDateTime:
title = context.getString(R.string.field_type_datetime);
type = Type.ALL;
break;
}
OnDateSetListener onDateSetListener = new OnDateSetListener() {
@Override
public void onDateSet(TimePickerDialog timePickerView, long milliseconds) {
mCalendar.setTimeInMillis(milliseconds);
setValue();
}
};
mTimeDialog = new TimePickerDialog.Builder()
.setCallBack(onDateSetListener)
.setTitleStringId(title)
.setSureStringId(context.getString(android.R.string.ok))
.setCancelStringId(context.getString(android.R.string.cancel))
.setYearText(" " + context.getString(R.string.unit_year))
.setMonthText(" " + context.getString(R.string.unit_month))
.setDayText(" " + context.getString(R.string.unit_day))
.setHourText(" " + context.getString(R.string.unit_hour))
.setMinuteText(" " + context.getString(R.string.unit_min))
.setType(type)
.setCyclic(false)
.setMinMillseconds(1)
.setMaxMillseconds(Long.MAX_VALUE)
.setCurrentMillseconds(mCalendar.getTimeInMillis())
.setWheelItemTextSize(12)
.setWheelItemTextNormalColor(ContextCompat.getColor(getContext(), R.color.timetimepicker_default_text_color))
.setWheelItemTextSelectorColor(ContextCompat.getColor(getContext(), R.color.accent))
.setThemeColor(ContextCompat.getColor(getContext(), R.color.primary_dark))
.build();
AppCompatActivity activity = ControlHelper.getActivity(getContext());
if (activity != null)
mTimeDialog.show(activity.getSupportFragmentManager(), "TimePickerDialog");
}
};
}