Commit 2aeb8d98 authored by Michael Chan's avatar Michael Chan
Browse files

Add UI to select calendar visibility on the phone

Bug:4731309
Change-Id: I09975d9a79e407df6e4eb41f4cb7e4e0f42ddd48
parent 27b17e98
......@@ -116,7 +116,14 @@
</intent-filter>
</activity>
<activity android:name="SelectCalendarsActivity" android:label="@string/calendars_title" />
<activity android:name=".selectcalendars.SelectVisibleCalendarsActivity"
android:label="@string/select_visible_calendars_title"
android:theme="@android:style/Theme.Holo.Light"/>
<activity android:name=".selectcalendars.SelectSyncedCalendarsMultiAccountActivity"
android:label="@string/select_synced_calendars_title"
android:theme="@android:style/Theme.Holo.Light"/>
<activity android:name="CalendarSettingsActivity" android:label="@string/preferences_title"
android:theme="@android:style/Theme.Holo.Light"/>
......
......@@ -5,6 +5,12 @@
-keepclassmembers class com.android.calendar.AllInOneActivity {
*** setControlsOffset(...);
}
-keepclassmembers class com.android.calendar.selectcalendars.SelectVisibleCalendarsActivity {
*** handleSelectSyncedCalendarsClicked(...);
}
-keepclassmembers class com.android.calendar.AllInOneActivity {
*** handleSelectSyncedCalendarsClicked(...);
}
-keepclassmembers class com.android.calendar.DayView {
*** setAnimateDayHeight(...);
*** setAnimateDayEventHeight(...);
......
File mode changed from 100755 to 100644
res/drawable-hdpi/ic_menu_select_visible_calendars_holo_light.png

1.54 KB

res/drawable-mdpi/ic_menu_select_visible_calendars_holo_light.png

3.57 KB

File mode changed from 100755 to 100644
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
android:paddingRight="?android:attr/scrollbarSize">
<TextView
android:id="@+id/account"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:singleLine="true"
android:ellipsize="marquee"
android:paddingTop="6dip"
style="?android:attr/textAppearanceLarge"
android:duplicateParentState="true" />
<TextView
android:id="@+id/account_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:maxLines="2"
android:textAppearance="?android:attr/textAppearanceSmall"
android:duplicateParentState="true" />
</LinearLayout>
\ No newline at end of file
......@@ -14,45 +14,46 @@
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:layout_marginRight="6dip"
android:layout_marginTop="6dip"
android:layout_marginBottom="6dip"
android:layout_weight="1">
<CheckBox android:id="@+id/sync"
android:clickable="false"
android:longClickable="false"
android:focusable="false">
<CheckBox
android:id="@+id/sync"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="4dip"
android:layout_marginRight="14dip"
android:layout_alignParentRight="true"
android:contentDescription="@string/accessibility_sync_cal"
android:gravity="center_vertical"
/>
<View android:id="@+id/color"
android:contentDescription="@string/accessibility_sync_cal" />
<View
android:id="@+id/color"
android:layout_width="16dip"
android:layout_height="16dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
android:layout_marginTop="8dip" />
<TextView android:id="@+id/calendar"
android:layout_marginTop="8dip"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/calendar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/color"
android:layout_toLeftOf="@id/sync"
android:gravity="center_vertical"
android:singleLine="true"
android:ellipsize="marquee"
style="?android:attr/textAppearanceLarge"
android:duplicateParentState="true"
/>
<TextView android:id="@+id/status"
style="?android:attr/textAppearanceMedium"
android:duplicateParentState="true" />
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/calendar"
......@@ -61,7 +62,5 @@
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:duplicateParentState="true"
/>
</RelativeLayout>
android:duplicateParentState="true" />
</RelativeLayout>
\ No newline at end of file
......@@ -14,10 +14,25 @@
limitations under the License.
-->
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dip"
android:clickable="true"
android:layout_weight="1"
android:cacheColorHint="#00000000" />
android:layout_height="match_parent">
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="0dip"
android:clickable="true"
android:layout_weight="1"
android:cacheColorHint="#00000000" />
<Button
android:id="@+id/manage_sync_set"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_gravity="center_horizontal"
android:onClick="handleSelectSyncedCalendarsClicked"
android:text="@string/select_synced_calendars_button" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/calendars"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ExpandableListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="0dip"
android:clickable="true"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
style="@android:style/ButtonBar">
<Button
android:id="@+id/btn_done"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@android:string/ok" />
<Button
android:id="@+id/btn_discard"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@android:string/cancel" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -39,6 +39,11 @@
android:alphabeticShortcut="r"
android:title="@string/calendar_refresh"
android:icon="@drawable/ic_menu_refresh_holo_light" />
<item
android:id="@+id/action_select_visible_calendars"
android:title="@string/menu_select_visible_calendars"
android:icon="@drawable/ic_menu_select_visible_calendars_holo_light"
android:showAsAction="never" />
<item
android:id="@+id/action_settings"
android:alphabeticShortcut="s"
......
......@@ -39,6 +39,11 @@
android:alphabeticShortcut="r"
android:title="@string/calendar_refresh"
android:icon="@drawable/ic_menu_refresh_holo_light" />
<item
android:id="@+id/action_select_visible_calendars"
android:title="@string/menu_select_visible_calendars"
android:icon="@drawable/ic_menu_select_visible_calendars_holo_light"
android:showAsAction="never" />
<item
android:id="@+id/action_settings"
android:alphabeticShortcut="s"
......
......@@ -85,6 +85,11 @@
<color name="event_center">#ff6bd697</color>
<color name="edit_event_separator">#FFDDDDDD</color>
<color name="calendar_visible">#ff000000</color>
<color name="calendar_hidden">#ff808080</color>
<color name="calendar_secondary_visible">#ff323232</color>
<color name="calendar_secondary_hidden">#ff808080</color>
<!-- Text color of the date in the Calendar widget -->
<color name="agenda_day_bar_title_color">#FF999999</color>
<color name="agenda_item_not_selected">#00000000</color>
......
......@@ -127,7 +127,10 @@
user to view and edit his Settings (or Preferences) -->
<string name="menu_preferences">"Settings"</string>
<!-- This is a label on a menu item. Pressing this menu item allows the
user to search their events. [CHAR LIMIT=11]-->
user to select the calendars to display [CHAR LIMIT=11] -->
<string name="menu_select_visible_calendars">"Calendars to display"</string>
<!-- This is a label on a menu item. Pressing this menu item allows the
user to select the calendars to display [CHAR LIMIT=11] -->
<string name="search">"Search"</string>
<!-- This is a label on a menu item. Pressing this menu item hides
the navigation controls on the right side. [CHAR LIMIT=20] -->
......@@ -139,10 +142,10 @@
<!-- Month view -->
<skip />
<!-- Select Calendars activity -->
<!-- Select Visible Calendars activity -->
<skip />
<!-- Title of "My calendars" screen -->
<string name="calendars_title">"Calendars"</string>
<string name="select_visible_calendars_title">"Calendars to Display"</string>
<!-- Synced and visible status message -->
<string name="synced_visible">synced, visible</string>
<!-- Synced but not visible status message -->
......@@ -162,6 +165,12 @@
<!-- Label on button that takes user to the Accounts and Sync settings page [CHAR LIMIT=60] -->
<string name="accounts">Accounts &amp; sync</string>
<!-- Select Synced Calendars activity -->
<!-- Select the set of calendars to sync [CHAR LIMIT=60] -->
<string name="select_synced_calendars_title">Calendars to Sync</string>
<!-- Select the set of calendars to sync [CHAR LIMIT=60] -->
<string name="select_synced_calendars_button">Calendars to sync</string>
<!-- Event edit activity -->
<skip />
<!-- The title of the screen where the user edits an event [CHAR LIMIT=17] -->
......
......@@ -27,7 +27,8 @@ import com.android.calendar.CalendarController.EventType;
import com.android.calendar.CalendarController.ViewType;
import com.android.calendar.agenda.AgendaFragment;
import com.android.calendar.month.MonthByWeekFragment;
import com.android.calendar.selectcalendars.SelectCalendarsFragment;
import com.android.calendar.selectcalendars.SelectSyncedCalendarsMultiAccountActivity;
import com.android.calendar.selectcalendars.SelectVisibleCalendarsFragment;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
......@@ -40,11 +41,9 @@ import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.net.Uri;
......@@ -61,7 +60,6 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.widget.ArrayAdapter;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.SearchView;
......@@ -486,7 +484,7 @@ public class AllInOneActivity extends Activity implements EventHandler,
ft.replace(R.id.mini_month, miniMonthFrag);
mController.registerEventHandler(R.id.mini_month, (EventHandler) miniMonthFrag);
Fragment selectCalendarsFrag = new SelectCalendarsFragment();
Fragment selectCalendarsFrag = new SelectVisibleCalendarsFragment();
ft.replace(R.id.calendar_list, selectCalendarsFrag);
mController.registerEventHandler(
R.id.calendar_list, (EventHandler) selectCalendarsFrag);
......@@ -616,6 +614,10 @@ public class AllInOneActivity extends Activity implements EventHandler,
mController.sendEventRelatedEvent(
this, EventType.CREATE_EVENT, -1, t.toMillis(true), 0, 0, 0, -1);
return true;
case R.id.action_select_visible_calendars:
mController.sendEvent(this, EventType.LAUNCH_SELECT_VISIBLE_CALENDARS, null, null,
0, 0);
return true;
case R.id.action_settings:
mController.sendEvent(this, EventType.LAUNCH_SETTINGS, null, null, 0, 0);
return true;
......@@ -971,6 +973,14 @@ public class AllInOneActivity extends Activity implements EventHandler,
updateHomeClock();
}
// Needs to be in proguard whitelist
// Specified as listener via android:onClick in a layout xml
public void handleSelectSyncedCalendarsClicked(View v) {
mController.sendEvent(this, EventType.LAUNCH_SETTINGS, null, null, null, 0, 0,
CalendarController.EXTRA_GOTO_TIME, null,
null);
}
@Override
public void eventsChanged() {
mController.sendEvent(this, EventType.EVENTS_CHANGED, null, null, -1, ViewType.CURRENT);
......
......@@ -20,6 +20,7 @@ import static android.provider.CalendarContract.EXTRA_EVENT_BEGIN_TIME;
import static android.provider.CalendarContract.EXTRA_EVENT_END_TIME;
import com.android.calendar.event.EditEventActivity;
import com.android.calendar.selectcalendars.SelectVisibleCalendarsActivity;
import android.accounts.Account;
import android.app.Activity;
......@@ -126,6 +127,9 @@ public class CalendarController {
// date range has changed, update the title
final long UPDATE_TITLE = 1L << 10;
// select which calendars to display
final long LAUNCH_SELECT_VISIBLE_CALENDARS = 1L << 11;
}
/**
......@@ -445,6 +449,12 @@ public class CalendarController {
return;
}
// Launch Calendar Visible Selector
if (event.eventType == EventType.LAUNCH_SELECT_VISIBLE_CALENDARS) {
launchSelectVisibleCalendars();
return;
}
// Create/View/Edit/Delete Event
long endTime = (event.endTime == null) ? -1 : event.endTime.toMillis(false);
if (event.eventType == EventType.CREATE_EVENT) {
......@@ -533,6 +543,13 @@ public class CalendarController {
return mPreviousViewType;
}
private void launchSelectVisibleCalendars() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName(mContext, SelectVisibleCalendarsActivity.class.getName());
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP);
mContext.startActivity(intent);
}
private void launchSettings() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName(mContext, CalendarSettingsActivity.class.getName());
......@@ -696,6 +713,8 @@ public class CalendarController {
tmp = "Edit event";
} else if ((eventInfo.eventType & EventType.DELETE_EVENT) != 0) {
tmp = "Delete event";
} else if ((eventInfo.eventType & EventType.LAUNCH_SELECT_VISIBLE_CALENDARS) != 0) {
tmp = "Launch select visible calendars";
} else if ((eventInfo.eventType & EventType.LAUNCH_SETTINGS) != 0) {
tmp = "Launch settings";
} else if ((eventInfo.eventType & EventType.EVENTS_CHANGED) != 0) {
......
......@@ -28,7 +28,6 @@ import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
......@@ -68,8 +67,8 @@ public class Utils {
// exiting is identical to reverting
public static final int DONE_EXIT = 1 << 0;
protected static final String OPEN_EMAIL_MARKER = " <";
protected static final String CLOSE_EMAIL_MARKER = ">";
public static final String OPEN_EMAIL_MARKER = " <";
public static final String CLOSE_EMAIL_MARKER = ">";
public static final String INTENT_KEY_DETAIL_VIEW = "DETAIL_VIEW";
public static final String INTENT_KEY_VIEW_TYPE = "VIEW";
......
......@@ -25,10 +25,13 @@ import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.provider.CalendarContract.Calendars;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.ListAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;
......@@ -41,16 +44,6 @@ public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAda
private static int COLOR_CHIP_RIGHT_MARGIN = 8;
private static int COLOR_CHIP_TOP_OFFSET = 5;
private Drawable[] mBackgrounds = new Drawable[16];
private static final int SELECTED_UNDER_NORMAL = 0;
private static final int BOTTOM_SELECTED_UNDER_NORMAL = 1;
private static final int BOTTOM_SELECTED_UNDER_SELECTED = 2;
private static final int SELECTED_UNDER_SELECTED = 3;
private static final int NORMAL_UNDER_NORMAL = 4;
private static final int BOTTOM_NORMAL_UNDER_NORMAL = 5;
private static final int BOTTOM_NORMAL_UNDER_SELECTED = 6;
private static final int NORMAL_UNDER_SELECTED = 7;
private static final int IS_SELECTED = 1 << 0;
private static final int IS_TOP = 1 << 1;
private static final int IS_BOTTOM = 1 << 2;
......@@ -58,6 +51,7 @@ public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAda
private LayoutInflater mInflater;
Resources mRes;
private int mLayout;
private int mOrientation;
private CalendarRow[] mData;
......@@ -68,11 +62,17 @@ public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAda
private int mNameColumn;
private int mColorColumn;
private int mVisibleColumn;
private int mOwnerAccountColumn;
private float mScale = 0;
private int mColorCalendarVisible;
private int mColorCalendarHidden;
private int mColorCalendarSecondaryVisible;
private int mColorCalendarSecondaryHidden;
private class CalendarRow {
long id;
String displayName;
String ownerAccount;
int color;
boolean selected;
}
......@@ -83,56 +83,73 @@ public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAda
mOrientation = context.getResources().getConfiguration().orientation;
initData(c);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Resources res = context.getResources();
mRes = context.getResources();
mColorCalendarVisible = mRes.getColor(R.color.calendar_visible);
mColorCalendarHidden = mRes.getColor(R.color.calendar_hidden);
mColorCalendarSecondaryVisible = mRes.getColor(R.color.calendar_secondary_visible);
mColorCalendarSecondaryHidden = mRes.getColor(R.color.calendar_secondary_hidden);
if (mScale == 0) {
mScale = res.getDisplayMetrics().density;
mScale = mRes.getDisplayMetrics().density;
SELECTED_COLOR_CHIP_SIZE *= mScale;
UNSELECTED_COLOR_CHIP_SIZE *= mScale;
COLOR_CHIP_LEFT_MARGIN *= mScale;
COLOR_CHIP_RIGHT_MARGIN *= mScale;
COLOR_CHIP_TOP_OFFSET *= mScale;
}
initBackgrounds(res);
}
/**
* Sets up the background drawables for the calendars list
*
* @param res The context's resources
*/
private void initBackgrounds(Resources res) {
mBackgrounds[0] = res.getDrawable(R.drawable.calname_unselected_holo_light);
mBackgrounds[IS_TOP] = mBackgrounds[0];
mBackgrounds[IS_SELECTED] = res.getDrawable(
R.drawable.calname_select_underunselected_holo_light);
mBackgrounds[IS_SELECTED | IS_TOP] = mBackgrounds[IS_SELECTED];
mBackgrounds[IS_SELECTED | IS_BOTTOM] = res.getDrawable(
R.drawable.calname_bottom_select_underunselected_holo_light);
mBackgrounds[IS_SELECTED | IS_TOP | IS_BOTTOM] = mBackgrounds[IS_SELECTED | IS_BOTTOM];
mBackgrounds[IS_SELECTED | IS_BOTTOM | IS_BELOW_SELECTED] =
res.getDrawable(R.drawable.calname_bottom_select_underselect_holo_light);
mBackgrounds[IS_SELECTED | IS_TOP | IS_BOTTOM | IS_BELOW_SELECTED] = mBackgrounds[
IS_SELECTED | IS_BOTTOM | IS_BELOW_SELECTED];
mBackgrounds[IS_SELECTED | IS_BELOW_SELECTED] =
res.getDrawable(R.drawable.calname_select_underselect_holo_light);
mBackgrounds[IS_SELECTED | IS_TOP | IS_BELOW_SELECTED] = mBackgrounds[IS_SELECTED
| IS_BELOW_SELECTED];
mBackgrounds[IS_BOTTOM] = res.getDrawable(R.drawable.calname_bottom_unselected_holo_light);
mBackgrounds[IS_TOP | IS_BOTTOM] = mBackgrounds[IS_BOTTOM];
mBackgrounds[IS_BOTTOM | IS_BELOW_SELECTED] = res.getDrawable(
R.drawable.calname_bottom_unselected_underselect_holo_light);
mBackgrounds[IS_TOP | IS_BOTTOM | IS_BELOW_SELECTED] = mBackgrounds[IS_BOTTOM
| IS_BELOW_SELECTED];
mBackgrounds[IS_BELOW_SELECTED] = res.getDrawable(
R.drawable.calname_unselected_underselect_holo_light);
mBackgrounds[IS_TOP | IS_BELOW_SELECTED] = mBackgrounds[IS_BELOW_SELECTED];
private static class TabletCalendarItemBackgrounds {
static private Drawable[] mBackgrounds = null;
/**
* Sets up the background drawables for the calendars list
*
* @param res The context's resources
*/
static Drawable[] getBackgrounds(Resources res) {
// Not thread safe. Ok if called only from main thread
if (mBackgrounds != null) {
return mBackgrounds;
}
mBackgrounds = new Drawable[16];
mBackgrounds[0] = res.getDrawable(R.drawable.calname_unselected_holo_light);
mBackgrounds[IS_TOP] = mBackgrounds[0];
mBackgrounds[IS_SELECTED] = res.getDrawable(
R.drawable.calname_select_underunselected_holo_light);
mBackgrounds[IS_SELECTED | IS_TOP] = mBackgrounds[IS_SELECTED];
mBackgrounds[IS_SELECTED | IS_BOTTOM] = res.getDrawable(
R.drawable.calname_bottom_select_underunselected_holo_light);
mBackgrounds[IS_SELECTED | IS_TOP | IS_BOTTOM] = mBackgrounds[IS_SELECTED | IS_BOTTOM];
mBackgrounds[IS_SELECTED | IS_BOTTOM | IS_BELOW_SELECTED] =
res.getDrawable(R.drawable.calname_bottom_select_underselect_holo_light);
mBackgrounds[IS_SELECTED | IS_TOP | IS_BOTTOM | IS_BELOW_SELECTED] = mBackgrounds[
IS_SELECTED | IS_BOTTOM | IS_BELOW_SELECTED];
mBackgrounds[IS_SELECTED | IS_BELOW_SELECTED] =
res.getDrawable(R.drawable.calname_select_underselect_holo_light);
mBackgrounds[IS_SELECTED | IS_TOP | IS_BELOW_SELECTED] = mBackgrounds[IS_SELECTED
| IS_BELOW_SELECTED];
mBackgrounds[IS_BOTTOM] = res.getDrawable(
R.drawable.calname_bottom_unselected_holo_light);
mBackgrounds[IS_TOP | IS_BOTTOM] = mBackgrounds[IS_BOTTOM];
mBackgrounds[IS_BOTTOM | IS_BELOW_SELECTED] = res.getDrawable(
R.drawable.calname_bottom_unselected_underselect_holo_light);
mBackgrounds[IS_TOP | IS_BOTTOM | IS_BELOW_SELECTED] = mBackgrounds[IS_BOTTOM
| IS_BELOW_SELECTED];
mBackgrounds[IS_BELOW_SELECTED] = res.getDrawable(
R.drawable.calname_unselected_underselect_holo_light);
mBackgrounds[IS_TOP | IS_BELOW_SELECTED] = mBackgrounds[IS_BELOW_SELECTED];
return mBackgrounds;
}
}
private void initData(Cursor c) {
......@@ -151,6 +168,7 @@ public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAda
mNameColumn = c.getColumnIndexOrThrow(Calendars.CALENDAR_DISPLAY_NAME);
mColorColumn = c.getColumnIndexOrThrow(Calendars.CALENDAR_COLOR);
mVisibleColumn = c.getColumnIndexOrThrow(Calendars.VISIBLE);
mOwnerAccountColumn = c.getColumnIndexOrThrow(Calendars.OWNER_ACCOUNT);
mRowCount = c.getCount();
mData = new CalendarRow[(c.getCount() + 2)];
......@@ -162,6 +180,7 @@ public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAda
mData[p].displayName = c.getString(mNameColumn);
mData[p].color = c.getInt(mColorColumn);
mData[p].selected = c.getInt(mVisibleColumn) != 0;
mData[p].ownerAccount = c.getString(mOwnerAccountColumn);
p++;
}
}
......@@ -177,8 +196,6 @@ public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAda
}
String name = mData[position].displayName;
boolean selected = mData[position].selected;
Drawable bg = getBackground(position, selected);
int color = mData[position].color;
View view;
......@@ -188,25 +205,67 @@ public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAda
view = convertView;
}
TextView calendarName = (TextView) view.findViewById(R.id.calendar);
calendarName.setText(name);
View colorView = view.findViewById(R.id.color);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
SELECTED_COLOR_CHIP_SIZE, SELECTED_COLOR_CHIP_SIZE);
params.leftMargin = COLOR_CHIP_LEFT_MARGIN;
params.rightMargin = COLOR_CHIP_RIGHT_MARGIN;
// This offset is needed because the assets include the bottom of the
// previous item
params.topMargin = COLOR_CHIP_TOP_OFFSET;
if (!selected) {
params.height = UNSELECTED_COLOR_CHIP_SIZE;
params.width = UNSELECTED_COLOR_CHIP_SIZE;
params.leftMargin += (SELECTED_COLOR_CHIP_SIZE - UNSELECTED_COLOR_CHIP_SIZE) / 2;
params.topMargin += (SELECTED_COLOR_CHIP_SIZE - UNSELECTED_COLOR_CHIP_SIZE) / 2;
}
colorView.setLayoutParams(params);
colorView.setBackgroundColor(color);
setText(view, R.id.calendar, name);
view.setBackgroundDrawable(bg);
CheckBox syncCheckBox = (CheckBox) view.findViewById(R.id.sync);
if (syncCheckBox != null) {
// Full screen layout
syncCheckBox.setChecked(selected);
int textColor;
if (selected) {
textColor = mColorCalendarVisible;
} else {
textColor = mColorCalendarHidden;
}
calendarName.setTextColor(textColor);
LayoutParams layoutParam = calendarName.getLayoutParams();
TextView secondaryText = (TextView) view.findViewById(R.id.status);
if (!TextUtils.isEmpty(mData[position].ownerAccount)
&& !mData[position].ownerAccount.equals(name)
&& !mData[position].ownerAccount.endsWith("calendar.google.com")) {
int secondaryColor;
if (selected) {
secondaryColor = mColorCalendarSecondaryVisible;
} else {
secondaryColor = mColorCalendarSecondaryHidden;
}
secondaryText.setText(mData[position].ownerAccount);
secondaryText.setTextColor(secondaryColor);
secondaryText.setVisibility(View.VISIBLE);
layoutParam.height = LayoutParams.WRAP_CONTENT;
} else {
secondaryText.setVisibility(View.GONE);
layoutParam.height = LayoutParams.MATCH_PARENT;
}
calendarName.setLayoutParams(layoutParam);
} else {
// Tablet layout
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
SELECTED_COLOR_CHIP_SIZE, SELECTED_COLOR_CHIP_SIZE);
params.leftMargin = COLOR_CHIP_LEFT_MARGIN;
params.rightMargin = COLOR_CHIP_RIGHT_MARGIN;
// This offset is needed because the assets include the bottom of the
// previous item
params.topMargin = COLOR_CHIP_TOP_OFFSET;
if (!selected) {
params.height = UNSELECTED_COLOR_CHIP_SIZE;
params.width = UNSELECTED_COLOR_CHIP_SIZE;
params.leftMargin += (SELECTED_COLOR_CHIP_SIZE - UNSELECTED_COLOR_CHIP_SIZE) / 2;
params.topMargin += (SELECTED_COLOR_CHIP_SIZE - UNSELECTED_COLOR_CHIP_SIZE) / 2;
}
colorView.setLayoutParams(params);
Drawable bg = getBackground(position, selected);
view.setBackgroundDrawable(bg);
}
view.invalidate();
return view;
}
......@@ -223,7 +282,7 @@ public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAda
bg |= position == mData.length - 1 ? IS_BOTTOM : 0;
bg |= ((position == 0 && mOrientation != Configuration.ORIENTATION_LANDSCAPE && selected)
|| (position > 0 && mData[position - 1].selected)) ? IS_BELOW_SELECTED : 0;
return mBackgrounds[bg];
return TabletCalendarItemBackgrounds.getBackgrounds(mRes)[bg];
}
private static void setText(View view, int id, String text) {
......
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.calendar.selectcalendars;
import com.android.calendar.R;
import com.android.calendar.Utils;
import android.app.ExpandableListActivity;
import android.content.ContentResolver;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.os.Bundle;
import android.provider.CalendarContract.Calendars;
import android.view.View;
import android.widget.ExpandableListView;
public class SelectSyncedCalendarsMultiAccountActivity extends ExpandableListActivity
implements View.OnClickListener {
private static final String TAG = "Calendar";
private static final String EXPANDED_KEY = "is_expanded";
private static final String ACCOUNT_UNIQUE_KEY = "ACCOUNT_KEY";
private Cursor mCursor = null;
private ExpandableListView mList;
private SelectSyncedCalendarsMultiAccountAdapter mAdapter;
private static final String[] PROJECTION = new String[] {
Calendars._ID,
Calendars.ACCOUNT_TYPE,
Calendars.ACCOUNT_NAME,
Calendars.ACCOUNT_TYPE + " || " + Calendars.ACCOUNT_NAME + " AS " +
ACCOUNT_UNIQUE_KEY,
};
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.select_calendars_multi_accounts_fragment);
mList = getExpandableListView();
//TODO Move managedQuery into a background thread.
//TODO change to something that supports group by queries.
mCursor = managedQuery(Calendars.CONTENT_URI, PROJECTION,
"1) GROUP BY (" + ACCOUNT_UNIQUE_KEY, //Cheap hack to make WHERE a GROUP BY query
null /* selectionArgs */,
Calendars.ACCOUNT_NAME /*sort order*/);
MatrixCursor accountsCursor = Utils.matrixCursorFromCursor(mCursor);
startManagingCursor(accountsCursor);
mAdapter = new SelectSyncedCalendarsMultiAccountAdapter(findViewById(R.id.calendars)
.getContext(), accountsCursor, this);
mList.setAdapter(mAdapter);
// TODO initialize from sharepref
int count = mList.getCount();
for(int i = 0; i < count; i++) {
mList.expandGroup(i);
}
// Start a background sync to get the list of calendars from the server.
startCalendarMetafeedSync();
findViewById(R.id.btn_done).setOnClickListener(this);
findViewById(R.id.btn_discard).setOnClickListener(this);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_done:
mAdapter.doSaveAction();
finish();
break;
case R.id.btn_discard:
finish();
break;
}
}
@Override
protected void onResume() {
super.onResume();
if (mAdapter != null) {
mAdapter.startRefreshStopDelay();
}
}
@Override
protected void onPause() {
super.onPause();
mAdapter.cancelRefreshStopDelay();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
boolean[] isExpanded;
mList = getExpandableListView();
if(mList != null) {
int count = mList.getCount();
isExpanded = new boolean[count];
for(int i = 0; i < count; i++) {
isExpanded[i] = mList.isGroupExpanded(i);
}
} else {
isExpanded = null;
}
outState.putBooleanArray(EXPANDED_KEY, isExpanded);
//TODO Store this to preferences instead so it remains on restart
}
@Override
protected void onRestoreInstanceState(Bundle state) {
super.onRestoreInstanceState(state);
mList = getExpandableListView();
boolean[] isExpanded = state.getBooleanArray(EXPANDED_KEY);
if(mList != null && isExpanded != null && mList.getCount() >= isExpanded.length) {
for(int i = 0; i < isExpanded.length; i++) {
if(isExpanded[i] && !mList.isGroupExpanded(i)) {
mList.expandGroup(i);
} else if(!isExpanded[i] && mList.isGroupExpanded(i)){
mList.collapseGroup(i);
}
}
}
}
// startCalendarMetafeedSync() checks the server for an updated list of
// Calendars (in the background).
//
// If a Calendar is added on the web (and it is selected and not
// hidden) then it will be added to the list of calendars on the phone
// (when this finishes). When a new calendar from the
// web is added to the phone, then the events for that calendar are also
// downloaded from the web.
//
// This sync is done automatically in the background when the
// SelectCalendars activity is started.
private void startCalendarMetafeedSync() {
Bundle extras = new Bundle();
extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
extras.putBoolean("metafeedonly", true);
ContentResolver.requestSync(null /* all accounts */,
Calendars.CONTENT_URI.getAuthority(), extras);
}
}
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.calendar.selectcalendars;
import com.android.calendar.R;
import com.android.calendar.Utils;
import android.accounts.AccountManager;
import android.accounts.AuthenticatorDescription;
import android.content.AsyncQueryHandler;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.provider.CalendarContract.Calendars;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CursorTreeAdapter;
import android.widget.TextView;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class SelectSyncedCalendarsMultiAccountAdapter extends CursorTreeAdapter implements
View.OnClickListener {
private static final String TAG = "Calendar";
private static final String IS_PRIMARY = "\"primary\"";
private static final String CALENDARS_ORDERBY = IS_PRIMARY + " DESC,"
+ Calendars.CALENDAR_DISPLAY_NAME + " COLLATE NOCASE";
private static final String ACCOUNT_SELECTION = Calendars.ACCOUNT_NAME + "=?"
+ " AND " + Calendars.ACCOUNT_TYPE + "=?";
private final LayoutInflater mInflater;
private final ContentResolver mResolver;
private final SelectSyncedCalendarsMultiAccountActivity mActivity;
private final View mView;
private final static Runnable mStopRefreshing = new Runnable() {
public void run() {
mRefresh = false;
}
};
private Map<String, AuthenticatorDescription> mTypeToAuthDescription
= new HashMap<String, AuthenticatorDescription>();
protected AuthenticatorDescription[] mAuthDescs;
// These track changes to the synced state of calendars
private Map<Long, Boolean> mCalendarChanges
= new HashMap<Long, Boolean>();
private Map<Long, Boolean> mCalendarInitialStates
= new HashMap<Long, Boolean>();
// This is for keeping MatrixCursor copies so that we can requery in the background.
private static Map<String, Cursor> mChildrenCursors
= new HashMap<String, Cursor>();
private static AsyncCalendarsUpdater mCalendarsUpdater;
// This is to keep our update tokens separate from other tokens. Since we cancel old updates
// when a new update comes in, we'd like to leave a token space that won't be canceled.
private static final int MIN_UPDATE_TOKEN = 1000;
private static int mUpdateToken = MIN_UPDATE_TOKEN;
// How long to wait between requeries of the calendars to see if anything has changed.
private static final int REFRESH_DELAY = 5000;
// How long to keep refreshing for
private static final int REFRESH_DURATION = 60000;
private static boolean mRefresh = true;
private int mNumAccounts;
private static String mSyncedText;
private static String mNotSyncedText;
// This is to keep track of whether or not multiple calendars have the same display name
private static HashMap<String, Boolean> mIsDuplicateName = new HashMap<String, Boolean>();
private static final String[] PROJECTION = new String[] {
Calendars._ID,
Calendars.ACCOUNT_NAME,
Calendars.OWNER_ACCOUNT,
Calendars.CALENDAR_DISPLAY_NAME,
Calendars.CALENDAR_COLOR,
Calendars.VISIBLE,
Calendars.SYNC_EVENTS,
"(" + Calendars.ACCOUNT_NAME + "=" + Calendars.OWNER_ACCOUNT + ") AS " + IS_PRIMARY,
};
//Keep these in sync with the projection
private static final int ID_COLUMN = 0;
private static final int ACCOUNT_COLUMN = 1;
private static final int OWNER_COLUMN = 2;
private static final int NAME_COLUMN = 3;
private static final int COLOR_COLUMN = 4;
private static final int SELECTED_COLUMN = 5;
private static final int SYNCED_COLUMN = 6;
private static final int PRIMARY_COLUMN = 7;
private static final int TAG_ID_CALENDAR_ID = R.id.calendar;
private static final int TAG_ID_SYNC_CHECKBOX = R.id.sync;
private class AsyncCalendarsUpdater extends AsyncQueryHandler {
public AsyncCalendarsUpdater(ContentResolver cr) {
super(cr);
}
@Override
protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
if(cursor == null) {
return;
}
Cursor currentCursor = mChildrenCursors.get(cookie);
// Check if the new cursor has the same content as our old cursor
if (currentCursor != null) {
if (Utils.compareCursors(currentCursor, cursor)) {
cursor.close();
return;
}
}
// If not then make a new matrix cursor for our Map
MatrixCursor newCursor = Utils.matrixCursorFromCursor(cursor);
cursor.close();
// And update our list of duplicated names
Utils.checkForDuplicateNames(mIsDuplicateName, newCursor, NAME_COLUMN);
mChildrenCursors.put((String)cookie, newCursor);
try {
setChildrenCursor(token, newCursor);
mActivity.startManagingCursor(newCursor);
} catch (NullPointerException e) {
Log.w(TAG, "Adapter expired, try again on the next query: " + e);
}
// Clean up our old cursor if we had one. We have to do this after setting the new
// cursor so that our view doesn't throw on an invalid cursor.
if (currentCursor != null) {
mActivity.stopManagingCursor(currentCursor);
currentCursor.close();
}
}
}
/**
* Method for changing the sync state when a calendar's button is pressed.
*
* This gets called when the CheckBox for a calendar is clicked. It toggles
* the sync state for the associated calendar and saves a change of state to
* a hashmap. It also compares against the original value and removes any
* changes from the hashmap if this is back at its initial state.
*/
public void onClick(View v) {
long id = (Long) v.getTag(TAG_ID_CALENDAR_ID);
boolean newState;
boolean initialState = mCalendarInitialStates.get(id);
if (mCalendarChanges.containsKey(id)) {
// Negate to reflect the click
newState = !mCalendarChanges.get(id);
} else {
// Negate to reflect the click
newState = !initialState;
}
if (newState == initialState) {
mCalendarChanges.remove(id);
} else {
mCalendarChanges.put(id, newState);
}
((CheckBox) v.getTag(TAG_ID_SYNC_CHECKBOX)).setChecked(newState);
setText(v, R.id.status, newState ? mSyncedText : mNotSyncedText);
}
public SelectSyncedCalendarsMultiAccountAdapter(Context context, Cursor acctsCursor,
SelectSyncedCalendarsMultiAccountActivity act) {
super(acctsCursor, context);
mSyncedText = context.getString(R.string.synced);
mNotSyncedText = context.getString(R.string.not_synced);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mResolver = context.getContentResolver();
mActivity = act;
if (mCalendarsUpdater == null) {
mCalendarsUpdater = new AsyncCalendarsUpdater(mResolver);
}
mNumAccounts = acctsCursor.getCount();
if (mNumAccounts == 0) {
// Should never happen since Calendar requires an account exist to
// use it.
Log.e(TAG, "SelectCalendarsAdapter: No accounts were returned!");
}
// Collect proper description for account types
mAuthDescs = AccountManager.get(context).getAuthenticatorTypes();
for (int i = 0; i < mAuthDescs.length; i++) {
mTypeToAuthDescription.put(mAuthDescs[i].type, mAuthDescs[i]);
}
mView = mActivity.getExpandableListView();
mRefresh = true;
}
public void startRefreshStopDelay() {
mRefresh = true;
mView.postDelayed(mStopRefreshing, REFRESH_DURATION);
}
public void cancelRefreshStopDelay() {
mView.removeCallbacks(mStopRefreshing);
}
/*
* Write back the changes that have been made. The sync code will pick up any changes and
* do updates on its own.
*/
public void doSaveAction() {
// Cancel the previous operation
mCalendarsUpdater.cancelOperation(mUpdateToken);
mUpdateToken++;
// This is to allow us to do queries and updates with the same AsyncQueryHandler without
// accidently canceling queries.
if(mUpdateToken < MIN_UPDATE_TOKEN) {
mUpdateToken = MIN_UPDATE_TOKEN;
}
Iterator<Long> changeKeys = mCalendarChanges.keySet().iterator();
while (changeKeys.hasNext()) {
long id = changeKeys.next();
boolean newSynced = mCalendarChanges.get(id);
Uri uri = ContentUris.withAppendedId(Calendars.CONTENT_URI, id);
ContentValues values = new ContentValues();
values.put(Calendars.VISIBLE, newSynced ? 1 : 0);
values.put(Calendars.SYNC_EVENTS, newSynced ? 1 : 0);
mCalendarsUpdater.startUpdate(mUpdateToken, id, uri, values, null, null);
}
}
private static void setText(View view, int id, String text) {
if (TextUtils.isEmpty(text)) {
return;
}
TextView textView = (TextView) view.findViewById(id);
textView.setText(text);
}
/**
* Gets the label associated with a particular account type. If none found, return null.
* @param accountType the type of account
* @return a CharSequence for the label or null if one cannot be found.
*/
protected CharSequence getLabelForType(final String accountType) {
CharSequence label = null;
if (mTypeToAuthDescription.containsKey(accountType)) {
try {
AuthenticatorDescription desc = mTypeToAuthDescription.get(accountType);
Context authContext = mActivity.createPackageContext(desc.packageName, 0);
label = authContext.getResources().getText(desc.labelId);
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "No label for account type " + ", type " + accountType);
}
}
return label;
}
@Override
protected void bindChildView(View view, Context context, Cursor cursor, boolean isLastChild) {
view.findViewById(R.id.color).setBackgroundColor(cursor.getInt(COLOR_COLUMN));
String name = cursor.getString(NAME_COLUMN);
String owner = cursor.getString(OWNER_COLUMN);
if (mIsDuplicateName.containsKey(name) && mIsDuplicateName.get(name) &&
!name.equalsIgnoreCase(owner)) {
name = new StringBuilder(name)
.append(Utils.OPEN_EMAIL_MARKER)
.append(owner)
.append(Utils.CLOSE_EMAIL_MARKER)
.toString();
}
setText(view, R.id.calendar, name);
// First see if the user has already changed the state of this calendar
long id = cursor.getLong(ID_COLUMN);
Boolean sync = mCalendarChanges.get(id);
if (sync == null) {
sync = cursor.getInt(SYNCED_COLUMN) == 1;
mCalendarInitialStates.put(id, sync);
}
CheckBox button = (CheckBox) view.findViewById(R.id.sync);
button.setChecked(sync);
setText(view, R.id.status, sync ? mSyncedText : mNotSyncedText);
view.setTag(TAG_ID_CALENDAR_ID, id);
view.setTag(TAG_ID_SYNC_CHECKBOX, button);
view.setOnClickListener(this);
}
@Override
protected void bindGroupView(View view, Context context, Cursor cursor, boolean isExpanded) {
int accountColumn = cursor.getColumnIndexOrThrow(Calendars.ACCOUNT_NAME);
int accountTypeColumn = cursor.getColumnIndexOrThrow(Calendars.ACCOUNT_TYPE);
String account = cursor.getString(accountColumn);
String accountType = cursor.getString(accountTypeColumn);
setText(view, R.id.account, account);
setText(view, R.id.account_type, getLabelForType(accountType).toString());
}
@Override
protected Cursor getChildrenCursor(Cursor groupCursor) {
int accountColumn = groupCursor.getColumnIndexOrThrow(Calendars.ACCOUNT_NAME);
int accountTypeColumn = groupCursor.getColumnIndexOrThrow(Calendars.ACCOUNT_TYPE);
String account = groupCursor.getString(accountColumn);
String accountType = groupCursor.getString(accountTypeColumn);
//Get all the calendars for just this account.
Cursor childCursor = mChildrenCursors.get(account);
new RefreshCalendars(groupCursor.getPosition(), account, accountType).run();
return childCursor;
}
@Override
protected View newChildView(Context context, Cursor cursor, boolean isLastChild,
ViewGroup parent) {
return mInflater.inflate(R.layout.calendar_sync_item, parent, false);
}
@Override
protected View newGroupView(Context context, Cursor cursor, boolean isExpanded,
ViewGroup parent) {
return mInflater.inflate(R.layout.account_item, parent, false);
}
private class RefreshCalendars implements Runnable {
int mToken;
String mAccount;
String mAccountType;
public RefreshCalendars(int token, String cookie, String accountType) {
mToken = token;
mAccount = cookie;
mAccountType = accountType;
}
public void run() {
mCalendarsUpdater.cancelOperation(mToken);
// Set up a refresh for some point in the future if we haven't stopped updates yet
if(mRefresh) {
mView.postDelayed(new RefreshCalendars(mToken, mAccount, mAccountType),
REFRESH_DELAY);
}
mCalendarsUpdater.startQuery(mToken,
mAccount,
Calendars.CONTENT_URI, PROJECTION,
ACCOUNT_SELECTION,
new String[] { mAccount, mAccountType } /*selectionArgs*/,
CALENDARS_ORDERBY);
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment