SelectCalendarsActivitypublic class SelectCalendarsActivity extends android.app.Activity implements ListView.OnItemClickListener
Fields Summary |
---|
private static final String | TAG | private android.view.View | mView | private android.database.Cursor | mCursor | private QueryHandler | mQueryHandler | private SelectCalendarsAdapter | mAdapter | private static final String[] | PROJECTION |
Methods Summary |
---|
protected void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.calendars_activity);
getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
Window.PROGRESS_INDETERMINATE_ON);
mQueryHandler = new QueryHandler(getContentResolver());
mView = findViewById(R.id.calendars);
ListView items = (ListView) mView.findViewById(R.id.items);
Context context = mView.getContext();
mCursor = managedQuery(Calendars.CONTENT_URI, PROJECTION,
Calendars.SYNC_EVENTS + "=1",
null /* selectionArgs */,
Calendars.DEFAULT_SORT_ORDER);
mAdapter = new SelectCalendarsAdapter(context, mCursor);
items.setAdapter(mAdapter);
items.setOnItemClickListener(this);
// Start a background sync to get the list of calendars from the server.
startCalendarSync();
| public boolean | onCreateOptionsMenu(android.view.Menu menu)
super.onCreateOptionsMenu(menu);
MenuItem item;
item = menu.add(0, 0, 0, R.string.add_calendars)
.setOnMenuItemClickListener(new ChangeCalendarAction(false /* not remove */));
item.setIcon(android.R.drawable.ic_menu_add);
item = menu.add(0, 0, 0, R.string.remove_calendars)
.setOnMenuItemClickListener(new ChangeCalendarAction(true /* remove */));
item.setIcon(android.R.drawable.ic_menu_delete);
return true;
| public void | onItemClick(android.widget.AdapterView parent, android.view.View view, int position, long id)
CheckBox box = (CheckBox) view.findViewById(R.id.checkbox);
box.toggle();
| public void | onPause()
super.onPause();
| private void | startCalendarSync()
getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
Window.PROGRESS_VISIBILITY_ON);
// TODO: make sure the user has login info.
Uri uri = Calendars.LIVE_CONTENT_URI;
mQueryHandler.startQuery(0, null, uri, PROJECTION,
Calendars.SYNC_EVENTS + "=1",
null, Calendars.DEFAULT_SORT_ORDER);
|
|