本文整理汇总了Java中com.alamkanak.weekview.WeekViewEvent类的典型用法代码示例。如果您正苦于以下问题:Java WeekViewEvent类的具体用法?Java WeekViewEvent怎么用?Java WeekViewEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WeekViewEvent类属于com.alamkanak.weekview包,在下文中一共展示了WeekViewEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMonthChange
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public List<? extends WeekViewEvent> onMonthChange(int newYear, int newMonth) {
// Download events from network if it hasn't been done already. To understand how events are
// downloaded using retrofit, visit http://square.github.io/retrofit
if (!calledNetwork) {
RestAdapter retrofit = new RestAdapter.Builder()
.setEndpoint("https://api.myjson.com/bins")
.build();
MyJsonService service = retrofit.create(MyJsonService.class);
service.listEvents(this);
calledNetwork = true;
}
// Return only the events that matches newYear and newMonth.
List<WeekViewEvent> matchedEvents = new ArrayList<WeekViewEvent>();
for (WeekViewEvent event : events) {
if (eventMatches(event, newYear, newMonth)) {
matchedEvents.add(event);
}
}
return matchedEvents;
}
示例2: onMonthChange
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public List<WeekViewEvent> onMonthChange(int newYear, int newMonth) {
// Populate the week view with some events.
List<WeekViewEvent> events = new ArrayList<WeekViewEvent>();
Calendar startTime = Calendar.getInstance();
startTime.set(Calendar.HOUR_OF_DAY, 3);
startTime.set(Calendar.MINUTE, 0);
startTime.set(Calendar.MONTH, newMonth-1);
startTime.set(Calendar.YEAR, newYear);
Calendar endTime = (Calendar) startTime.clone();
endTime.add(Calendar.HOUR, 1);
endTime.set(Calendar.MONTH, newMonth-1);
WeekViewEvent event = new WeekViewEvent(1, getEventTitle(startTime), startTime, endTime);
//event.setColor(getResources().getColor(R.color.event_color_01));
events.add(event);
return events;
}
示例3: loadEventsInBackground
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
private void loadEventsInBackground(final int newYear, final int newMonth) {
new Thread(() -> {
// Populate the week view with the events of the month to display
Calendar calendar = Calendar.getInstance();
//Note the (-1), since the calendar starts with month 0, but we get months starting with 1
calendar.set(newYear, newMonth - 1, 1);
int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String startTime = format.format(calendar.getTime());
calendar.set(newYear, newMonth - 1, daysInMonth);
String endTime = format.format(calendar.getTime());
//Convert to the proper type
final List<WeekViewEvent> events = fetchEventList(roomApiCode, startTime, endTime);
//Finish loading
context.runOnUiThread(() -> {
loadedEvents.put(calculateLoadedKey(newYear, newMonth), events);
//Trigger onMonthChange() again
mWeekView.notifyDatasetChanged();
});
}).start();
}
示例4: onMonthChange
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public List<WeekViewEvent> onMonthChange(int newYear, int newMonth) {
// Populate the week view with the events of the month to display
List<WeekViewEvent> events = new ArrayList<>();
Calendar calendar = Calendar.getInstance();
//Note the (-1), since the calendar starts with month 0, but we get months starting with 1
calendar.set(newYear, newMonth - 1, 1);
int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
//Probably refactor this to a good SQL query
for (int curDay = 1; curDay <= daysInMonth; curDay++) {
calendar.set(Calendar.DAY_OF_MONTH, curDay);
List<CalendarItem> calendarItems = calendarManager.getFromDbForDate(new Date(calendar.getTimeInMillis()));
for (CalendarItem calendarItem: calendarItems) {
events.add(new IntegratedCalendarEvent(calendarItem));
}
}
return events;
}
示例5: getEvents
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
public ArrayList<WeekViewEvent> getEvents(int periodIndex) {
ArrayList<WeekViewEvent> events = mEvents.get(periodIndex);
if (events == null) {
events = new ArrayList<>();
mEvents.put(periodIndex, events);
}
return mEvents.get(periodIndex);
}
示例6: onMonthChange
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public List<WeekViewEvent> onMonthChange(int newYear, int newMonth) {
if (!isLoaded(newYear, newMonth)) {
loadEventsInBackground(newYear, newMonth);
return new ArrayList<>();
}
//Events already have been loaded.
return loadedEvents.get(calculateLoadedKey(newYear, newMonth));
}
示例7: fetchEventList
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
private List<WeekViewEvent> fetchEventList(String roomId, String startDate, String endDate) {
List<WeekViewEvent> events = new ArrayList<>();
try {
Optional<List<RoomFinderSchedule>> result = Optional.of(TUMCabeClient.getInstance(context)
.fetchSchedule(roomId, startDate, endDate));
List<RoomFinderSchedule> schedules = result.get();
//Convert to the proper type
for (RoomFinderSchedule schedule : schedules) {
Calendar startCal = Calendar.getInstance();
startCal.setTime(Utils.getDateTime(schedule.getStart()));
Calendar endCal = Calendar.getInstance();
endCal.setTime(Utils.getDateTime(schedule.getEnd()));
IntegratedCalendarEvent calendarEvent = new IntegratedCalendarEvent(schedule.getEvent_id(),
schedule.getTitle(), startCal, endCal, "",
IntegratedCalendarEvent.getDisplayColorFromColor(0xff28921f));
events.add(calendarEvent);
}
return events;
} catch (IOException | NullPointerException e) {
Utils.log(e);
}
return events;
}
示例8: onEventClick
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventClick(WeekViewEvent weekViewEvent, RectF rectF) {
CalendarDetailsFragment detailsFragment = new CalendarDetailsFragment();
Bundle bundle = new Bundle();
CalendarItem item = calendarManager.getCalendarItemByStartAndEndTime(weekViewEvent.getStartTime(), weekViewEvent.getEndTime());
bundle.putString(CALENDAR_ID_PARAM, item.getNr());
detailsFragment.setArguments(bundle);
detailsFragment.show(getSupportFragmentManager(), null);
}
示例9: onEventClick
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventClick(WeekViewEvent weekViewEvent, RectF rectF) {
EventDetailBaseActivity.event = eventRealmResults.where()
.equalTo("id", weekViewEvent.getId()).findFirst();
startActivity(new Intent(DayViewActivity.this, EventDetailActivity.class));
}
示例10: eventMatches
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
private boolean eventMatches(WeekViewEvent event, int year, int month) {
return (event.getStartTime().get(Calendar.YEAR) == year &&
event.getStartTime().get(Calendar.MONTH) == month - 1) ||
(event.getEndTime().get(Calendar.YEAR) == year &&
event.getEndTime().get(Calendar.MONTH) == month - 1);
}
示例11: onEventClick
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventClick(WeekViewEvent event, RectF eventRect) {
Toast.makeText(this, "Clicked " + event.getName(), Toast.LENGTH_SHORT).show();
}
示例12: onEventLongPress
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventLongPress(WeekViewEvent event, RectF eventRect) {
Toast.makeText(this, "Long pressed event: " + event.getName(), Toast.LENGTH_SHORT).show();
}
示例13: onEventClick
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventClick(WeekViewEvent event, RectF eventRect) {
Toast.makeText(getContext(), "Go to Attendance", Toast.LENGTH_SHORT).show();
}
示例14: onEventClick
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventClick(WeekViewEvent event, RectF eventRect) {
Toast.makeText(CalendarActivity.this, "Clicked " + event.getName(), Toast.LENGTH_SHORT).show();
}
示例15: onEventLongPress
import com.alamkanak.weekview.WeekViewEvent; //导入依赖的package包/类
@Override
public void onEventLongPress(WeekViewEvent event, RectF eventRect) {
Toast.makeText(CalendarActivity.this, "Long pressed event: " + event.getName(), Toast.LENGTH_SHORT).show();
}