Skip to content

Instantly share code, notes, and snippets.

@jrobinson3k1
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrobinson3k1/d9417c24b1489552792e to your computer and use it in GitHub Desktop.
Save jrobinson3k1/d9417c24b1489552792e to your computer and use it in GitHub Desktop.
public class SessionsManager {
private Context mContext;
@Inject
SessionsManager(Context context) {
mContext = context;
}
public boolean isInMySchedule() {
Cursor cursor = mContext.getContentResolver().query(/* ... */);
try {
return cursor.getInt(SessionsQuery.IN_MY_SCHEDULE) != 0;
} finally {
cursor.close();
}
}
public void addSessionCalendar(Uri sessionUri, long start, long end, String room, String title) {
intent = new Intent(SessionCalendarService.ACTION_ADD_SESSION_CALENDAR, sessionUri);
intent.putExtra(SessionCalendarService.EXTRA_SESSION_START, start);
intent.putExtra(SessionCalendarService.EXTRA_SESSION_END, end);
intent.putExtra(SessionCalendarService.EXTRA_SESSION_ROOM, room);
intent.putExtra(SessionCalendarService.EXTRA_SESSION_TITLE, title);
mContext.startService(intent);
}
public void removeSessionCalendar(Uri sessionUri, long start, long end, String room, String title) {
intent = new Intent(SessionCalendarService.ACTION_REMOVE_SESSION_CALENDAR, sessionUri);
intent.putExtra(SessionCalendarService.EXTRA_SESSION_START, start);
intent.putExtra(SessionCalendarService.EXTRA_SESSION_END, end);
intent.putExtra(SessionCalendarService.EXTRA_SESSION_TITLE, title);
mContext.startService(intent);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment