本文整理汇总了Java中com.fourmob.datetimepicker.date.DatePickerDialog.newInstance方法的典型用法代码示例。如果您正苦于以下问题:Java DatePickerDialog.newInstance方法的具体用法?Java DatePickerDialog.newInstance怎么用?Java DatePickerDialog.newInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fourmob.datetimepicker.date.DatePickerDialog
的用法示例。
在下文中一共展示了DatePickerDialog.newInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sensorstartonClick
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
public void sensorstartonClick() {
final Calendar calendar = Calendar.getInstance();
final DatePickerDialog datePickerDialog = DatePickerDialog.newInstance((DatePickerDialog.OnDateSetListener) this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
final TimePickerDialog timePickerDialog = TimePickerDialog.newInstance((TimePickerDialog.OnTimeSetListener) this, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), false, false);
timePickerDialog.show(getSupportFragmentManager(), "timepicker");
datePickerDialog.setYearRange(2016, 2028);
datePickerDialog.show(getSupportFragmentManager(), "datepicker");
/*
Notification notification = new NotificationCompat.Builder(getApplication())
.setSmallIcon(R.drawable.common_google_signin_btn_icon_dark)
.setContentTitle("Hello World")
.setContentText("My first Android Wear notification")
.extend(
new NotificationCompat.WearableExtender().setHintShowBackgroundOnly(false))
.build();
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(getApplication());
int notificationId = 1;
notificationManager.notify(notificationId, notification);
*/
}
示例2: onClick
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
if (mEndDateTextView == v) {
if (mDatePickerDialog != null) {
mDatePickerDialog.dismiss();
}
mDatePickerDialog = DatePickerDialog.newInstance(this, mModel.endDate.year,
mModel.endDate.month, mModel.endDate.monthDay);
mDatePickerDialog.setFirstDayOfWeek(Utils.getFirstDayOfWeekAsCalendar(getActivity()));
mDatePickerDialog.setYearRange(Utils.YEAR_MIN, Utils.YEAR_MAX);
mDatePickerDialog.show(getFragmentManager(), FRAG_TAG_DATE_PICKER);
} else if (mDone == v) {
String rrule;
if (mModel.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) {
rrule = null;
} else {
copyModelToEventRecurrence(mModel, mRecurrence);
rrule = mRecurrence.toString();
}
if (mRecurrenceSetListener != null) {
mRecurrenceSetListener.onRecurrenceSet(rrule);
}
dismiss();
}
}
示例3: onClick
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
super.onClick(v);
switch (v.getId()) {
case R.id.team_diary_pager_right:
int currentPage1 = mPager.getCurrentItem();
if (currentPage1 < mPager.getAdapter().getCount()) {
mPager.setCurrentItem(currentPage1 + 1);
}
break;
case R.id.team_diary_pager_left:
int currentPage2 = mPager.getCurrentItem();
if (currentPage2 > 0) {
mPager.setCurrentItem(currentPage2 - 1);
}
break;
case R.id.team_diary_pager_calendar:
final DatePickerDialog datePickerDialog = DatePickerDialog
.newInstance(this, calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH), false);
datePickerDialog.setVibrate(false);
datePickerDialog.setYearRange(2014, 2015);
datePickerDialog.show(getFragmentManager(), "datepicker");
break;
default:
break;
}
}
示例4: onCreate
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_new_trip);
ButterKnife.bind(this);
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
userid = sharedPreferences.getString(Constants.USER_ID, "1");
mHandler = new Handler(Looper.getMainLooper());
cityname.setThreshold(1);
final Calendar calendar = Calendar.getInstance();
datePickerDialog = DatePickerDialog.newInstance(this,
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH),
isVibrate());
sdate.setOnClickListener(this);
edate.setOnClickListener(this);
ok.setOnClickListener(this);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
示例5: onCreate
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hotels);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ButterKnife.bind(this);
mHandler = new Handler(Looper.getMainLooper());
s = PreferenceManager.getDefaultSharedPreferences(this);
source = s.getString(Constants.SOURCE_CITY_ID, "1");
dest = s.getString(Constants.DESTINATION_CITY_ID, "1");
sourcet = s.getString(Constants.SOURCE_CITY, "Delhi");
destt = s.getString(Constants.DESTINATION_CITY, "Mumbai");
city.setText("Showing " + destt + " hotels");
selectdate.setText("Check In : " + dates);
final Calendar calendar = Calendar.getInstance();
datePickerDialog = DatePickerDialog.newInstance(this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), isVibrate());
getHotellist();
setTitle("Hotels");
selectdate.setOnClickListener(this);
city.setOnClickListener(this);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
示例6: onCreate
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bus_list);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mHandler = new Handler(Looper.getMainLooper());
ButterKnife.bind(this);
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
source = sharedPreferences.getString(Constants.SOURCE_CITY, "delhi");
dest = sharedPreferences.getString(Constants.DESTINATION_CITY, "mumbai");
selectdate.setText(dates);
city.setText(source + " to " + dest);
getBuslist();
final Calendar calendar = Calendar.getInstance();
datePickerDialog = DatePickerDialog.newInstance(this,
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH),
isVibrate());
setTitle("Buses");
city.setOnClickListener(this);
selectdate.setOnClickListener(this);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
示例7: populateViews
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
private void populateViews() {
name.setText(updatePatient.getNom());
prenom.setText(updatePatient.getPrenom());
telephone.setText(updatePatient.getTelephone());
cas.setText(updatePatient.getCasPatient());
date.setText(MyFunctions.getReadableShortDate(calendarDate.getTimeInMillis()));
this.datePickerDialog = DatePickerDialog.newInstance(
this,
calendarDate.get(Calendar.YEAR),
calendarDate.get(Calendar.MONTH),
calendarDate.get(Calendar.DAY_OF_MONTH));
//on limite l'age des patients à contacter à 85 ans
try {
datePickerDialog.setYearRange((calendarDate.get(Calendar.YEAR) - 85), calendarDate.get(Calendar.YEAR));
}catch (IllegalArgumentException ex){
Log.e("_____","min year end must > 1902");
}
Log.e("sex val__","__"+updatePatient.getSexe());
//On
if(updatePatient.getSexe().toLowerCase().equals("m"))
((RadioButton)sexe.findViewById(R.id.radioM)).setChecked(true);
else
((RadioButton)sexe.findViewById(R.id.radioF)).setChecked(true);
btnAdd.setText(getResources().getString(R.string.btn_patient_update));
}
示例8: setRemindTime
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
private void setRemindTime() {
isRemind = false;
final Calendar calendar = Calendar.getInstance();
final DatePickerDialog datePickerDialog = DatePickerDialog.newInstance(this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), false);
datePickerDialog.setYearRange(2015, 2036);
datePickerDialog.setCloseOnSingleTapDay(false);
datePickerDialog.setCancelable(false);
datePickerDialog.show(getSupportFragmentManager(), GlobalSettings.DATEPICKER_TAG);
}
示例9: setRemindTime
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
public void setRemindTime(int position) {
setTimeRecord = TimeFleetingData.futureRecords.get(position);
final Calendar calendar = Calendar.getInstance();
final DatePickerDialog datePickerDialog = DatePickerDialog.newInstance(this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), false);
datePickerDialog.setYearRange(2015, 2036);
datePickerDialog.setCloseOnSingleTapDay(false);
datePickerDialog.setCancelable(false);
datePickerDialog.show(mActivity.getSupportFragmentManager(), GlobalSettings.DATEPICKER_TAG);
}
示例10: setTime
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
private void setTime() {
final Calendar calendar = Calendar.getInstance();
final DatePickerDialog datePickerDialog = DatePickerDialog.newInstance(this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), false);
datePickerDialog.setYearRange(1915, 2036);
datePickerDialog.setCloseOnSingleTapDay(false);
datePickerDialog.setCancelable(true);
datePickerDialog.show(getSupportFragmentManager(), GlobalSettings.DATEPICKER_TAG);
}
示例11: showDateTimeSelectors
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
/**
* Show date and time pickers
*/
protected void showDateTimeSelectors(long reminder) {
// Sets actual time or previously saved in note
final Calendar now = DateHelper.getCalendar(reminder);
DatePickerDialog mCalendarDatePickerDialog = DatePickerDialog.newInstance(
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePickerDialog dialog, int year, int monthOfYear, int dayOfMonth) {
reminderYear = year;
reminderMonth = monthOfYear;
reminderDay = dayOfMonth;
TimePickerDialog mRadialTimePickerDialog = TimePickerDialog.newInstance(
new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(RadialPickerLayout radialPickerLayout, int hour, int minute) {
hourOfDay = hour;
minutes = minute;
showRecurrencePickerDialog(recurrenceRule);
}
}, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE),
DateHelper.is24HourMode(mActivity));
mRadialTimePickerDialog.show(mActivity.getSupportFragmentManager(), Constants.TAG);
}
}, now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
mCalendarDatePickerDialog.show(mActivity.getSupportFragmentManager(), Constants.TAG);
}
示例12: initDateTimePicker
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
/**
* 初始化日期时间选择器
*/
private void initDateTimePicker(Bundle savedInstanceState){
final Calendar calendar = Calendar.getInstance();
datePickerDialog = DatePickerDialog.newInstance(this,
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH),
true);
timePickerDialog = TimePickerDialog.newInstance(this,
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
true,
true);
if (savedInstanceState != null) {
DatePickerDialog dpd = (DatePickerDialog) getSupportFragmentManager().findFragmentByTag(DATEPICKER_TAG);
if (dpd != null) {
dpd.setOnDateSetListener(this);
}
TimePickerDialog tpd = (TimePickerDialog) getSupportFragmentManager().findFragmentByTag(TIMEPICKER_TAG);
if (tpd != null) {
tpd.setOnTimeSetListener(this);
}
}
}
示例13: onClick
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_enable:
config.setWidgetCountdownEnable(true);
getActivity().finish();
break;
case R.id.tv_disable:
config.setWidgetCountdownEnable(false);
getActivity().finish();
break;
case R.id.tv_countdown_content:
Intent intent = new Intent(getActivity(), CommentActivity.class);
intent.putExtra(Constants.StringConstant.PARAMS_DATA, config.getCountdownContent());
intent.putExtra(Constants.StringConstant.PARAMS_DATA1, config.getWidgetCountdownColor());
startActivityForResult(intent, Constants.RequestCode.REQUEST_CODE_CHAGE_TEXT_TITLE);
break;
case R.id.tv_countdown_time:
calendar.setTimeInMillis(config.getCountdownTimestamp());
dpd = DatePickerDialog.newInstance(this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), false);
tpd = TimePickerDialog.newInstance(this, calendar.get(Calendar.HOUR_OF_DAY) ,calendar.get(Calendar.MINUTE), false, false);
dpd.setYearRange(Constants.CommonValue.FIRST_YEAR, Constants.CommonValue.LAST_YEAR);
dpd.setCloseOnSingleTapDay(false);
dpd.show(getFragmentManager(), TAG);
break;
default:
break;
}
}
示例14: onClick
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_enable:
config.setWidgetTimingEnable(true);
getActivity().finish();
break;
case R.id.tv_disable:
config.setWidgetTimingEnable(false);
getActivity().finish();
break;
case R.id.tv_timing_content:
Intent intent = new Intent(getActivity(), CommentActivity.class);
intent.putExtra(Constants.StringConstant.PARAMS_DATA, config.getTimingContent());
intent.putExtra(Constants.StringConstant.PARAMS_DATA1, config.getWidgetTimingColor());
startActivityForResult(intent, Constants.RequestCode.REQUEST_CODE_CHAGE_TEXT_TITLE);
break;
case R.id.tv_timing_time:
calendar.setTimeInMillis(config.getTimingTimestamp());
dpd = DatePickerDialog.newInstance(this, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), false);
tpd = TimePickerDialog.newInstance(this, calendar.get(Calendar.HOUR_OF_DAY) ,calendar.get(Calendar.MINUTE), false, false);
dpd.setYearRange(Constants.CommonValue.FIRST_YEAR, Constants.CommonValue.LAST_YEAR);
dpd.setCloseOnSingleTapDay(false);
dpd.show(getFragmentManager(), TAG);
break;
default:
break;
}
}
示例15: initViews
import com.fourmob.datetimepicker.date.DatePickerDialog; //导入方法依赖的package包/类
private void initViews() {
presenter = new PlanTicketPresenter(this);
longTimes = String.valueOf(DateUtil.toLongTimes(DateUtil.getNowTime2Show()));
searchId = MetroApp.getContext().getResources().getStringArray(R.array.search_id);
stations = MetroApp.getContext().getResources().getStringArray(R.array.search_station);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, stations);
autoTvStartStation.setAdapter(adapter);
autoTvEndStation.setAdapter(adapter);
tvStartTime.setText(DateUtil.getNowTime2Show());
Calendar calendar = Calendar.getInstance();
datePickerDialog = DatePickerDialog.newInstance(this, calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH),
true);
rbWeek.setChecked(true);
radioGroup.setOnCheckedChangeListener((radioGroup1, i) -> {
int checkId = radioGroup1.getCheckedRadioButtonId();
RadioButton rb = (RadioButton) findViewById(checkId);
String t = rb.getText().toString();
switch (t) {
case "周票":
if (isVisibility(daysView)) {
daysView.setVisibility(View.GONE);
}
type = TYPE_WEEK;
break;
case "月票":
if (isVisibility(daysView)) {
daysView.setVisibility(View.GONE);
}
type = TYPE_MONTH;
break;
case "其它":
if (!isVisibility(daysView)) {
daysView.setVisibility(View.VISIBLE);
}
type = TYPE_OTHERS;
break;
}
});
}