本文整理汇总了Java中com.prolificinteractive.materialcalendarview.OnDateSelectedListener类的典型用法代码示例。如果您正苦于以下问题:Java OnDateSelectedListener类的具体用法?Java OnDateSelectedListener怎么用?Java OnDateSelectedListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OnDateSelectedListener类属于com.prolificinteractive.materialcalendarview包,在下文中一共展示了OnDateSelectedListener类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initEventAndData
import com.prolificinteractive.materialcalendarview.OnDateSelectedListener; //导入依赖的package包/类
@Override
protected void initEventAndData() {
setToolBar(mToolbar, "选择日期");
mCalender.state().edit()
.setFirstDayOfWeek(Calendar.WEDNESDAY)
.setMinimumDate(CalendarDay.from(2013, 5, 20))
.setMaximumDate(CalendarDay.from(DateUtil.getCurrentYear(), DateUtil.getCurrentMonth(), DateUtil.getCurrentDay()))
.setCalendarDisplayMode(CalendarMode.MONTHS)
.commit();
mCalender.setOnDateChangedListener(new OnDateSelectedListener() {
@Override
public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
mDate = date;
}
});
}
示例2: call
import com.prolificinteractive.materialcalendarview.OnDateSelectedListener; //导入依赖的package包/类
@Override
@UiThread
public void call(final Subscriber<? super LocalDate> subscriber) {
checkUiThread();
calendarView.setOnDateChangedListener(new OnDateSelectedListener() {
@Override
public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
if (!subscriber.isUnsubscribed()) {
subscriber.onNext(DateHelper.calendarDayToLocalDate(date));
}
}
});
subscriber.add(new MainThreadSubscription() {
@Override
protected void onUnsubscribe() {
calendarView.setOnDateChangedListener(null);
}
});
}
示例3: onReceiveNativeEvent
import com.prolificinteractive.materialcalendarview.OnDateSelectedListener; //导入依赖的package包/类
public void onReceiveNativeEvent(final ThemedReactContext reactContext, final MaterialCalendarView materialCalendarView) {
materialCalendarView.setOnDateChangedListener(new OnDateSelectedListener() {
@Override
public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
WritableMap event = Arguments.createMap();
event.putString("date", date.getDate().toString());
event.putInt("day", date.getDay());
event.putInt("month", date.getMonth());
event.putInt("year", date.getYear());
reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(materialCalendarView.getId(), "topChange", event);
}
});
}
开发者ID:williamcabrera4,项目名称:react-native-android-material-calendar-view,代码行数:14,代码来源:MaterialCalendarViewManager.java
示例4: onCreateView
import com.prolificinteractive.materialcalendarview.OnDateSelectedListener; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.calendar_navigation, container, false);
calendarView = (MaterialCalendarView) root.findViewById(R.id.calendarView);
calendarView.state().edit()
.setFirstDayOfWeek(Calendar.SATURDAY)
.setMinimumDate(CalendarDay.from(2017, 11,1))
.setMaximumDate(CalendarDay.from(2099, 5, 11))
.setCalendarDisplayMode(CalendarMode.MONTHS)
.commit();
calendarView.setOnDateChangedListener(new OnDateSelectedListener() {
@Override
public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
Intent i = new Intent(getActivity(), DayView.class);
String myFormat = "MM/dd/yy"; //In which you need put here
SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.US);
System.out.println(sdf.format(date.getDate()));
i.putExtra("date", String.valueOf(sdf.format(date.getDate())));
getActivity().startActivity(i);
}
});
return root;
}
示例5: addEventEmitters
import com.prolificinteractive.materialcalendarview.OnDateSelectedListener; //导入依赖的package包/类
@Override
protected void addEventEmitters(final ThemedReactContext reactContext, final Calendar view) {
view.setOnDateChangedListener(new OnDateSelectedListener() {
@Override
public void onDateSelected(MaterialCalendarView widget, CalendarDay date, boolean selected) {
reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher()
.dispatchEvent(new CalendarEvent(
view.getId(),
date,
selected));
}
});
}