blob: 609ed48eea400bbf6ed21aa7b92ff744994ce94f [file] [log] [blame]
Michael Chan49701592010-06-30 11:04:03 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.calendar;
18
Erikdd95df52010-08-27 09:31:18 -070019import static android.provider.Calendar.EVENT_BEGIN_TIME;
20import static android.provider.Calendar.EVENT_END_TIME;
Michael Chan2c7c8512010-12-10 14:12:57 -080021import static android.provider.Calendar.AttendeesColumns.ATTENDEE_STATUS;
Erikdd95df52010-08-27 09:31:18 -070022
Michael Chan83b0fe32010-07-08 16:46:26 -070023import com.android.calendar.CalendarController.EventHandler;
Michael Chanab29d9e2010-07-21 06:08:47 -070024import com.android.calendar.CalendarController.EventInfo;
Michael Chan83b0fe32010-07-08 16:46:26 -070025import com.android.calendar.CalendarController.EventType;
Michael Chan3458a172010-07-13 17:58:21 -070026import com.android.calendar.CalendarController.ViewType;
Mason Tang00b8c1a2010-08-23 12:02:00 -070027import com.android.calendar.agenda.AgendaFragment;
Erik981874e2010-10-05 16:52:52 -070028import com.android.calendar.month.MonthByWeekFragment;
Mason Tang9a3cb142010-07-27 12:16:41 -070029import com.android.calendar.selectcalendars.SelectCalendarsFragment;
Michael Chan83b0fe32010-07-08 16:46:26 -070030
RoboErikb8549562011-02-15 14:25:23 -080031import android.animation.ObjectAnimator;
Michael Chanab29d9e2010-07-21 06:08:47 -070032import android.app.ActionBar;
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -070033import android.app.ActionBar.Tab;
Michael Chan49701592010-06-30 11:04:03 -070034import android.app.Activity;
Michael Chan83b0fe32010-07-08 16:46:26 -070035import android.app.Fragment;
Erik63cd0532011-01-26 14:16:03 -080036import android.app.FragmentManager;
Michael Chan3458a172010-07-13 17:58:21 -070037import android.app.FragmentTransaction;
Erik954c8712010-08-06 10:12:34 -070038import android.content.ContentResolver;
Erikdd95df52010-08-27 09:31:18 -070039import android.content.Intent;
Mason Tang8e3d4302010-07-12 17:39:30 -070040import android.content.SharedPreferences;
41import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
Michael Chanab29d9e2010-07-21 06:08:47 -070042import android.content.res.Configuration;
Erikeaafa2b2010-12-23 14:30:37 -080043import android.content.res.Resources;
Erik954c8712010-08-06 10:12:34 -070044import android.database.ContentObserver;
Erikdd95df52010-08-27 09:31:18 -070045import android.net.Uri;
Michael Chan49701592010-06-30 11:04:03 -070046import android.os.Bundle;
Erik954c8712010-08-06 10:12:34 -070047import android.os.Handler;
48import android.provider.Calendar;
Erik6c255102010-09-29 14:43:00 -070049import android.text.TextUtils;
50import android.text.format.DateFormat;
Michael Chan3458a172010-07-13 17:58:21 -070051import android.text.format.DateUtils;
Michael Chan83b0fe32010-07-08 16:46:26 -070052import android.text.format.Time;
Erik954c8712010-08-06 10:12:34 -070053import android.util.Log;
Erik2051f122010-07-02 13:45:45 -070054import android.view.Menu;
Michael Chan3458a172010-07-13 17:58:21 -070055import android.view.MenuItem;
Michael Chanab29d9e2010-07-21 06:08:47 -070056import android.view.View;
Erik259b8f92011-01-12 14:01:12 -080057import android.view.accessibility.AccessibilityEvent;
RoboErikde20d762011-02-08 17:52:25 -080058import android.widget.RelativeLayout;
59import android.widget.RelativeLayout.LayoutParams;
Daisuke Miyakawa6d2e6f72010-09-17 10:30:54 -070060import android.widget.SearchView;
Erik6c255102010-09-29 14:43:00 -070061import android.widget.TextView;
62
Michael Chan2c7c8512010-12-10 14:12:57 -080063import java.util.List;
Erik6c255102010-09-29 14:43:00 -070064import java.util.Locale;
65import java.util.TimeZone;
Michael Chan49701592010-06-30 11:04:03 -070066
Michael Chanab29d9e2010-07-21 06:08:47 -070067public class AllInOneActivity extends Activity implements EventHandler,
Adam Powell28f9b352011-01-20 18:36:10 -080068 OnSharedPreferenceChangeListener, SearchView.OnQueryTextListener,
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -070069 ActionBar.TabListener {
Michael Chand6734db2010-07-22 00:48:08 -070070 private static final String TAG = "AllInOneActivity";
Erik954c8712010-08-06 10:12:34 -070071 private static final boolean DEBUG = false;
Erik63cd0532011-01-26 14:16:03 -080072 private static final String EVENT_INFO_FRAGMENT_TAG = "EventInfoFragment";
Michael Chand6734db2010-07-22 00:48:08 -070073 private static final String BUNDLE_KEY_RESTORE_TIME = "key_restore_time";
Erik7b92da22010-09-23 14:55:22 -070074 private static final String BUNDLE_KEY_EVENT_ID = "key_event_id";
RoboErik277eb972011-02-24 16:05:04 -080075 private static final String BUNDLE_KEY_RESTORE_VIEW = "key_restore_view";
Erik3f348f32010-08-10 13:17:19 -070076 private static final int HANDLER_KEY = 0;
RoboErikde20d762011-02-08 17:52:25 -080077 private static final long CONTROLS_ANIMATE_DURATION = 400;
78 private static int CONTROLS_ANIMATE_WIDTH = 283;
79 private static int CONTROLS_MARGIN_RIGHT = 16;
80 private static float mScale = 0;
Erikeaafa2b2010-12-23 14:30:37 -080081
Michael Chan0558def2010-07-22 21:30:32 -070082 private static CalendarController mController;
Erik9fc409f2010-07-28 11:40:47 -070083 private static boolean mIsMultipane;
Michael Chan6191c122010-11-02 16:23:47 -070084 private boolean mOnSaveInstanceStateCalled = false;
Erik954c8712010-08-06 10:12:34 -070085 private ContentResolver mContentResolver;
Erik648c59c2010-08-13 12:49:26 -070086 private int mPreviousView;
87 private int mCurrentView;
Erikcb811892010-09-28 13:44:19 -070088 private boolean mPaused = true;
89 private boolean mUpdateOnResume = false;
RoboErikde20d762011-02-08 17:52:25 -080090 private boolean mHideControls = false;
Erik6c255102010-09-29 14:43:00 -070091 private TextView mHomeTime;
Erikeaafa2b2010-12-23 14:30:37 -080092 private TextView mDateRange;
RoboErikde20d762011-02-08 17:52:25 -080093 private View mMiniMonth;
94 private View mCalendarsList;
95 private View mMiniMonthContainer;
Erikc5f92d72010-11-11 16:18:34 -080096 private String mTimeZone;
Erik6c255102010-09-29 14:43:00 -070097
Michael Chan2c7c8512010-12-10 14:12:57 -080098 private long mViewEventId = -1;
99 private long mIntentEventStartMillis = -1;
100 private long mIntentEventEndMillis = -1;
Michael Chandeced892010-12-10 15:59:35 -0800101 private int mIntentAttendeeResponse = CalendarController.ATTENDEE_NO_RESPONSE;
Michael Chan2c7c8512010-12-10 14:12:57 -0800102
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -0700103 // Action bar and Navigation bar (left side of Action bar)
104 private ActionBar mActionBar;
105 private ActionBar.Tab mDayTab;
106 private ActionBar.Tab mWeekTab;
107 private ActionBar.Tab mMonthTab;
Erikcb830312011-01-19 14:41:41 -0800108 private SearchView mSearchView;
RoboErikde20d762011-02-08 17:52:25 -0800109 private MenuItem mControlsMenu;
110
111 private String mHideString = "Hide controls";
112 private String mShowString = "Show controls";
RoboErikde20d762011-02-08 17:52:25 -0800113
RoboErikb8549562011-02-15 14:25:23 -0800114 // Params for animating the controls on the right
115 LayoutParams mControlsParams = new LayoutParams(CONTROLS_ANIMATE_WIDTH, 0);
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -0700116
Erik6c255102010-09-29 14:43:00 -0700117 private Runnable mHomeTimeUpdater = new Runnable() {
118 @Override
119 public void run() {
120 updateHomeClock();
121 }
122 };
Erik954c8712010-08-06 10:12:34 -0700123
124 // Create an observer so that we can update the views whenever a
125 // Calendar event changes.
Erik7b92da22010-09-23 14:55:22 -0700126 private ContentObserver mObserver = new ContentObserver(new Handler()) {
Erik954c8712010-08-06 10:12:34 -0700127 @Override
128 public boolean deliverSelfNotifications() {
129 return true;
130 }
131
132 @Override
133 public void onChange(boolean selfChange) {
134 eventsChanged();
135 }
136 };
Michael Chan83b0fe32010-07-08 16:46:26 -0700137
Michael Chan49701592010-06-30 11:04:03 -0700138 @Override
Erik63cd0532011-01-26 14:16:03 -0800139 protected void onNewIntent(Intent intent) {
140 String action = intent.getAction();
141 if (Intent.ACTION_VIEW.equals(action)) {
142 parseViewAction(intent);
143 }
144 }
145
146 @Override
Michael Chan83b0fe32010-07-08 16:46:26 -0700147 protected void onCreate(Bundle icicle) {
Erikca478672011-01-19 20:02:47 -0800148 if (Utils.getSharedPreference(this, OtherPreferences.KEY_OTHER_1, false)) {
149 setTheme(R.style.CalendarTheme_WithActionBarWallpaper);
150 }
Michael Chan83b0fe32010-07-08 16:46:26 -0700151 super.onCreate(icicle);
152
153 // This needs to be created before setContentView
Michael Chan0558def2010-07-22 21:30:32 -0700154 mController = CalendarController.getInstance(this);
Erik954c8712010-08-06 10:12:34 -0700155 // Get time from intent or icicle
Michael Chan2c7c8512010-12-10 14:12:57 -0800156 long timeMillis = -1;
157 int viewType = -1;
Michael Chan2c7c8512010-12-10 14:12:57 -0800158 final Intent intent = getIntent();
Erik954c8712010-08-06 10:12:34 -0700159 if (icicle != null) {
160 timeMillis = icicle.getLong(BUNDLE_KEY_RESTORE_TIME);
RoboErik277eb972011-02-24 16:05:04 -0800161 viewType = icicle.getInt(BUNDLE_KEY_RESTORE_VIEW, -1);
Erik7b92da22010-09-23 14:55:22 -0700162 } else {
Michael Chan2c7c8512010-12-10 14:12:57 -0800163 String action = intent.getAction();
164 if (Intent.ACTION_VIEW.equals(action)) {
165 // Open EventInfo later
166 timeMillis = parseViewAction(intent);
167 }
168
169 if (timeMillis == -1) {
170 timeMillis = Utils.timeFromIntentInMillis(intent);
171 }
172 }
173
RoboErik277eb972011-02-24 16:05:04 -0800174 if (viewType == -1) {
Erik7b92da22010-09-23 14:55:22 -0700175 viewType = Utils.getViewTypeFromIntentAndSharedPref(this);
176 }
Erikc5f92d72010-11-11 16:18:34 -0800177 mTimeZone = Utils.getTimeZone(this, mHomeTimeUpdater);
178 Time t = new Time(mTimeZone);
Erik954c8712010-08-06 10:12:34 -0700179 t.set(timeMillis);
180
Michael Chan2c7c8512010-12-10 14:12:57 -0800181 if (icicle != null && intent != null) {
182 Log.d(TAG, "both, icicle:" + icicle.toString() + " intent:" + intent.toString());
Erik7b92da22010-09-23 14:55:22 -0700183 } else {
Michael Chan2c7c8512010-12-10 14:12:57 -0800184 Log.d(TAG, "not both, icicle:" + icicle + " intent:" + intent);
Erik7b92da22010-09-23 14:55:22 -0700185 }
186
Erikeaafa2b2010-12-23 14:30:37 -0800187 Resources res = getResources();
RoboErikde20d762011-02-08 17:52:25 -0800188 if (mScale == 0) {
189 mScale = res.getDisplayMetrics().density;
190 CONTROLS_ANIMATE_WIDTH *= mScale;
191 CONTROLS_MARGIN_RIGHT *= mScale;
192 }
193 mHideString = res.getString(R.string.hide_controls);
194 mShowString = res.getString(R.string.show_controls);
RoboErikb8549562011-02-15 14:25:23 -0800195 mControlsParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
196 mControlsParams.rightMargin = CONTROLS_MARGIN_RIGHT;
197
Erikeaafa2b2010-12-23 14:30:37 -0800198 mIsMultipane =
199 (res.getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_XLARGE) != 0;
Erik9fc409f2010-07-28 11:40:47 -0700200
Erik63cd0532011-01-26 14:16:03 -0800201 Utils.setAllowWeekForDetailView(mIsMultipane);
Michael Chanb60218a2010-12-14 16:34:39 -0800202
Erikeaafa2b2010-12-23 14:30:37 -0800203 mDateRange = (TextView) getLayoutInflater().inflate(R.layout.date_range_title, null);
204
Erikbe8191c2010-10-26 16:50:08 -0700205 // setContentView must be called before configureActionBar
206 setContentView(R.layout.all_in_one);
207 // configureActionBar auto-selects the first tab you add, so we need to
208 // call it before we set up our own fragments to make sure it doesn't
209 // overwrite us
210 configureActionBar();
211
Erik3f348f32010-08-10 13:17:19 -0700212 // Must be the first to register because this activity can modify the
213 // list of event handlers in it's handle method. This affects who the
214 // rest of the handlers the controller dispatches to are.
215 mController.registerEventHandler(HANDLER_KEY, this);
Michael Chan83b0fe32010-07-08 16:46:26 -0700216
Erik6c255102010-09-29 14:43:00 -0700217 mHomeTime = (TextView) findViewById(R.id.home_time);
RoboErikde20d762011-02-08 17:52:25 -0800218 mMiniMonth = findViewById(R.id.mini_month);
219 mCalendarsList = findViewById(R.id.calendar_list);
220 mMiniMonthContainer = findViewById(R.id.mini_month_container);
Michael Chan83b0fe32010-07-08 16:46:26 -0700221
Erik7b92da22010-09-23 14:55:22 -0700222 initFragments(timeMillis, viewType, icicle);
Mason Tang8e3d4302010-07-12 17:39:30 -0700223
Erik6c255102010-09-29 14:43:00 -0700224
Mason Tang8e3d4302010-07-12 17:39:30 -0700225 // Listen for changes that would require this to be refreshed
Daisuke Miyakawa4b441bd2010-09-16 14:55:36 -0700226 SharedPreferences prefs = GeneralPreferences.getSharedPreferences(this);
Mason Tang8e3d4302010-07-12 17:39:30 -0700227 prefs.registerOnSharedPreferenceChangeListener(this);
Erikcb811892010-09-28 13:44:19 -0700228
Erik954c8712010-08-06 10:12:34 -0700229 mContentResolver = getContentResolver();
Erikbe8191c2010-10-26 16:50:08 -0700230 }
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -0700231
Michael Chan2c7c8512010-12-10 14:12:57 -0800232 private long parseViewAction(final Intent intent) {
233 long timeMillis = -1;
234 Uri data = intent.getData();
235 if (data != null && data.isHierarchical()) {
236 List<String> path = data.getPathSegments();
237 if (path.size() == 2 && path.get(0).equals("events")) {
238 try {
239 mViewEventId = Long.valueOf(data.getLastPathSegment());
240 if(mViewEventId != -1) {
241 mIntentEventStartMillis = intent.getLongExtra(EVENT_BEGIN_TIME, 0);
242 mIntentEventEndMillis = intent.getLongExtra(EVENT_END_TIME, 0);
243 mIntentAttendeeResponse = intent.getIntExtra(
Michael Chandeced892010-12-10 15:59:35 -0800244 ATTENDEE_STATUS, CalendarController.ATTENDEE_NO_RESPONSE);
Michael Chan2c7c8512010-12-10 14:12:57 -0800245 timeMillis = mIntentEventStartMillis;
246 }
247 } catch (NumberFormatException e) {
248 // Ignore if mViewEventId can't be parsed
249 }
250 }
251 }
252 return timeMillis;
253 }
254
Erikbe8191c2010-10-26 16:50:08 -0700255 private void configureActionBar() {
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -0700256 mActionBar = getActionBar();
Michael Chandeced892010-12-10 15:59:35 -0800257 mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -0700258 if (mActionBar == null) {
259 Log.w(TAG, "ActionBar is null.");
260 } else {
261 mDayTab = mActionBar.newTab();
262 mDayTab.setText(getString(R.string.day_view));
263 mDayTab.setTabListener(this);
264 mActionBar.addTab(mDayTab);
265 mWeekTab = mActionBar.newTab();
266 mWeekTab.setText(getString(R.string.week_view));
267 mWeekTab.setTabListener(this);
268 mActionBar.addTab(mWeekTab);
269 mMonthTab = mActionBar.newTab();
270 mMonthTab.setText(getString(R.string.month_view));
271 mMonthTab.setTabListener(this);
272 mActionBar.addTab(mMonthTab);
Erikeaafa2b2010-12-23 14:30:37 -0800273 mActionBar.setCustomView(mDateRange);
274 mActionBar.setDisplayOptions(
275 ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -0700276 }
Erik954c8712010-08-06 10:12:34 -0700277 }
278
279 @Override
280 protected void onResume() {
281 super.onResume();
282 mContentResolver.registerContentObserver(Calendar.Events.CONTENT_URI, true, mObserver);
Erikcb811892010-09-28 13:44:19 -0700283 if (mUpdateOnResume) {
284 initFragments(mController.getTime(), mController.getViewType(), null);
285 mUpdateOnResume = false;
286 }
Erik6c255102010-09-29 14:43:00 -0700287 updateHomeClock();
RoboErik3b3af612011-02-24 13:42:57 -0800288 if (mControlsMenu != null) {
289 mControlsMenu.setTitle(mHideControls ? mShowString : mHideString);
290 }
Erikcb811892010-09-28 13:44:19 -0700291 mPaused = false;
Michael Chan6191c122010-11-02 16:23:47 -0700292 mOnSaveInstanceStateCalled = false;
Michael Chan2c7c8512010-12-10 14:12:57 -0800293
294 if (mViewEventId != -1 && mIntentEventStartMillis != -1 && mIntentEventEndMillis != -1) {
RoboErikf6b58a92011-02-24 14:22:11 -0800295 long currentMillis = System.currentTimeMillis();
296 long selectedTime = -1;
297 if (currentMillis > mIntentEventStartMillis && currentMillis < mIntentEventEndMillis) {
298 selectedTime = currentMillis;
299 }
Michael Chanf0868f62011-01-11 19:37:35 -0800300 mController.sendEventRelatedEventWithResponse(this, EventType.VIEW_EVENT, mViewEventId,
RoboErikf6b58a92011-02-24 14:22:11 -0800301 mIntentEventStartMillis, mIntentEventEndMillis, -1, -1, mIntentAttendeeResponse,
302 selectedTime);
Michael Chan2c7c8512010-12-10 14:12:57 -0800303 mViewEventId = -1;
304 mIntentEventStartMillis = -1;
305 mIntentEventEndMillis = -1;
306 }
Mason Tang8e3d4302010-07-12 17:39:30 -0700307 }
308
309 @Override
Michael Chand6734db2010-07-22 00:48:08 -0700310 protected void onPause() {
311 super.onPause();
Erikcb811892010-09-28 13:44:19 -0700312 mPaused = true;
Daisuke Miyakawac9e53072010-10-14 12:18:49 -0700313 mHomeTime.removeCallbacks(mHomeTimeUpdater);
Erik954c8712010-08-06 10:12:34 -0700314 mContentResolver.unregisterContentObserver(mObserver);
Erikcb811892010-09-28 13:44:19 -0700315 if (isFinishing()) {
316 // Stop listening for changes that would require this to be refreshed
317 SharedPreferences prefs = GeneralPreferences.getSharedPreferences(this);
318 prefs.unregisterOnSharedPreferenceChangeListener(this);
319 }
Erik7b92da22010-09-23 14:55:22 -0700320 // FRAG_TODO save highlighted days of the week;
Erikdd95df52010-08-27 09:31:18 -0700321 if (mController.getViewType() != ViewType.EDIT) {
322 Utils.setDefaultView(this, mController.getViewType());
323 }
Michael Chand6734db2010-07-22 00:48:08 -0700324 }
325
326 @Override
Erik7b92da22010-09-23 14:55:22 -0700327 protected void onUserLeaveHint() {
328 mController.sendEvent(this, EventType.USER_HOME, null, null, -1, ViewType.CURRENT);
329 super.onUserLeaveHint();
330 }
331
332 @Override
Michael Chand6734db2010-07-22 00:48:08 -0700333 public void onSaveInstanceState(Bundle outState) {
Michael Chan6191c122010-11-02 16:23:47 -0700334 mOnSaveInstanceStateCalled = true;
Michael Chand6734db2010-07-22 00:48:08 -0700335 super.onSaveInstanceState(outState);
336
337 outState.putLong(BUNDLE_KEY_RESTORE_TIME, mController.getTime());
Erik7b92da22010-09-23 14:55:22 -0700338 if (mCurrentView == ViewType.EDIT) {
RoboErik277eb972011-02-24 16:05:04 -0800339 outState.putInt(BUNDLE_KEY_RESTORE_VIEW, mCurrentView);
Erik7b92da22010-09-23 14:55:22 -0700340 outState.putLong(BUNDLE_KEY_EVENT_ID, mController.getEventId());
341 }
Michael Chand6734db2010-07-22 00:48:08 -0700342 }
343
344 @Override
Mason Tang8e3d4302010-07-12 17:39:30 -0700345 protected void onDestroy() {
346 super.onDestroy();
347
Daisuke Miyakawa4b441bd2010-09-16 14:55:36 -0700348 SharedPreferences prefs = GeneralPreferences.getSharedPreferences(this);
Mason Tang8e3d4302010-07-12 17:39:30 -0700349 prefs.unregisterOnSharedPreferenceChangeListener(this);
Eriked61b482010-08-13 13:59:50 -0700350 CalendarController.removeInstance(this);
Mason Tang8e3d4302010-07-12 17:39:30 -0700351 }
352
Erik7b92da22010-09-23 14:55:22 -0700353 private void initFragments(long timeMillis, int viewType, Bundle icicle) {
Dianne Hackborn12b33302011-01-17 12:30:13 -0800354 FragmentTransaction ft = getFragmentManager().beginTransaction();
Michael Chan3458a172010-07-13 17:58:21 -0700355
Erik9fc409f2010-07-28 11:40:47 -0700356 if (mIsMultipane) {
Erik40bcd102010-11-16 15:46:40 -0800357 Fragment miniMonthFrag = new MonthByWeekFragment(timeMillis, true);
Michael Chanab29d9e2010-07-21 06:08:47 -0700358 ft.replace(R.id.mini_month, miniMonthFrag);
Erik3f348f32010-08-10 13:17:19 -0700359 mController.registerEventHandler(R.id.mini_month, (EventHandler) miniMonthFrag);
Michael Chanab29d9e2010-07-21 06:08:47 -0700360
361 Fragment selectCalendarsFrag = new SelectCalendarsFragment();
362 ft.replace(R.id.calendar_list, selectCalendarsFrag);
RoboErik8d1b2fd2011-02-25 10:24:43 -0800363 mController.registerEventHandler(
364 R.id.calendar_list, (EventHandler) selectCalendarsFrag);
Erikdd95df52010-08-27 09:31:18 -0700365 }
Erik7b92da22010-09-23 14:55:22 -0700366 if (!mIsMultipane || viewType == ViewType.EDIT) {
RoboErikde20d762011-02-08 17:52:25 -0800367 mMiniMonth.setVisibility(View.GONE);
368 mCalendarsList.setVisibility(View.GONE);
Michael Chanab29d9e2010-07-21 06:08:47 -0700369 }
Michael Chan3458a172010-07-13 17:58:21 -0700370
Erikdd95df52010-08-27 09:31:18 -0700371 EventInfo info = null;
372 if (viewType == ViewType.EDIT) {
Daisuke Miyakawa4b441bd2010-09-16 14:55:36 -0700373 mPreviousView = GeneralPreferences.getSharedPreferences(this).getInt(
Erik7b92da22010-09-23 14:55:22 -0700374 GeneralPreferences.KEY_START_VIEW, GeneralPreferences.DEFAULT_START_VIEW);
Erikdd95df52010-08-27 09:31:18 -0700375
Daisuke Miyakawa4143cfa2010-09-17 19:55:04 -0700376 long eventId = -1;
Erikdd95df52010-08-27 09:31:18 -0700377 Intent intent = getIntent();
378 Uri data = intent.getData();
379 if (data != null) {
380 try {
Daisuke Miyakawa4143cfa2010-09-17 19:55:04 -0700381 eventId = Long.parseLong(data.getLastPathSegment());
Erikdd95df52010-08-27 09:31:18 -0700382 } catch (NumberFormatException e) {
383 if (DEBUG) {
384 Log.d(TAG, "Create new event");
385 }
386 }
Erik7b92da22010-09-23 14:55:22 -0700387 } else if (icicle != null && icicle.containsKey(BUNDLE_KEY_EVENT_ID)) {
388 eventId = icicle.getLong(BUNDLE_KEY_EVENT_ID);
Erikdd95df52010-08-27 09:31:18 -0700389 }
Daisuke Miyakawa4143cfa2010-09-17 19:55:04 -0700390
Erikdd95df52010-08-27 09:31:18 -0700391 long begin = intent.getLongExtra(EVENT_BEGIN_TIME, -1);
392 long end = intent.getLongExtra(EVENT_END_TIME, -1);
393 info = new EventInfo();
394 if (end != -1) {
395 info.endTime = new Time();
396 info.endTime.set(end);
397 }
398 if (begin != -1) {
399 info.startTime = new Time();
400 info.startTime.set(begin);
401 }
402 info.id = eventId;
403 // We set the viewtype so if the user presses back when they are
404 // done editing the controller knows we were in the Edit Event
Erik7b92da22010-09-23 14:55:22 -0700405 // screen. Likewise for eventId
Erikdd95df52010-08-27 09:31:18 -0700406 mController.setViewType(viewType);
Erik7b92da22010-09-23 14:55:22 -0700407 mController.setEventId(eventId);
Erikdd95df52010-08-27 09:31:18 -0700408 } else {
409 mPreviousView = viewType;
410 }
Erik63cd0532011-01-26 14:16:03 -0800411 setMainPane(ft, R.id.main_pane, viewType, timeMillis, true);
Michael Chan3458a172010-07-13 17:58:21 -0700412
413 ft.commit(); // this needs to be after setMainPane()
414
Erikc5f92d72010-11-11 16:18:34 -0800415 Time t = new Time(mTimeZone);
Michael Chand6734db2010-07-22 00:48:08 -0700416 t.set(timeMillis);
Erikdd95df52010-08-27 09:31:18 -0700417 if (viewType != ViewType.EDIT) {
418 mController.sendEvent(this, EventType.GO_TO, t, null, -1, viewType);
419 }
Michael Chan49701592010-06-30 11:04:03 -0700420 }
Erik2051f122010-07-02 13:45:45 -0700421
422 @Override
Erik648c59c2010-08-13 12:49:26 -0700423 public void onBackPressed() {
Daisuke Miyakawa93e69eb2010-10-22 18:54:38 -0700424 if (mCurrentView == ViewType.EDIT || mCurrentView == ViewType.DETAIL) {
Erikdd95df52010-08-27 09:31:18 -0700425 mController.sendEvent(this, EventType.GO_TO, null, null, -1, mPreviousView);
Daisuke Miyakawa93e69eb2010-10-22 18:54:38 -0700426 } else {
427 super.onBackPressed();
Erik648c59c2010-08-13 12:49:26 -0700428 }
429 }
430
431 @Override
Erik2051f122010-07-02 13:45:45 -0700432 public boolean onCreateOptionsMenu(Menu menu) {
433 super.onCreateOptionsMenu(menu);
434
Erik2051f122010-07-02 13:45:45 -0700435 getMenuInflater().inflate(R.menu.all_in_one_title_bar, menu);
Daisuke Miyakawa6d2e6f72010-09-17 10:30:54 -0700436
Erikcb830312011-01-19 14:41:41 -0800437 mSearchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
438 if (mSearchView != null) {
439 mSearchView.setIconifiedByDefault(true);
Adam Powell28f9b352011-01-20 18:36:10 -0800440 mSearchView.setOnQueryTextListener(this);
Erikcb830312011-01-19 14:41:41 -0800441 mSearchView.setSubmitButtonEnabled(true);
Michael Chan71b221a2010-10-25 17:55:44 -0700442 }
RoboErikde20d762011-02-08 17:52:25 -0800443 mControlsMenu = menu.findItem(R.id.action_hide_controls);
444 if (mControlsMenu != null && mController != null
445 && mController.getViewType() == ViewType.MONTH) {
446 mControlsMenu.setVisible(false);
447 mControlsMenu.setEnabled(false);
448 }
Daisuke Miyakawa6d2e6f72010-09-17 10:30:54 -0700449
Erik2051f122010-07-02 13:45:45 -0700450 return true;
451 }
Michael Chan3458a172010-07-13 17:58:21 -0700452
453 @Override
454 public boolean onOptionsItemSelected(MenuItem item) {
455 Time t = null;
456 int viewType = ViewType.CURRENT;
457 switch (item.getItemId()) {
Erikba1b94a2010-07-20 17:50:50 -0700458 case R.id.action_refresh:
459 mController.refreshCalendars();
460 return true;
Michael Chan3458a172010-07-13 17:58:21 -0700461 case R.id.action_today:
462 viewType = ViewType.CURRENT;
Erikc5f92d72010-11-11 16:18:34 -0800463 t = new Time(mTimeZone);
Michael Chan3458a172010-07-13 17:58:21 -0700464 t.setToNow();
465 break;
466 case R.id.action_create_event:
RoboErik87f993f2011-02-03 17:47:20 -0800467 mController.sendEventRelatedEvent(this, EventType.CREATE_EVENT, -1, 0, 0, 0, 0, -1);
Michael Chan3458a172010-07-13 17:58:21 -0700468 return true;
Michael Chanab29d9e2010-07-21 06:08:47 -0700469 case R.id.action_settings:
470 mController.sendEvent(this, EventType.LAUNCH_SETTINGS, null, null, 0, 0);
471 return true;
RoboErikde20d762011-02-08 17:52:25 -0800472 case R.id.action_hide_controls:
473 mHideControls = !mHideControls;
474 item.setTitle(mHideControls ? mShowString : mHideString);
RoboErikb8549562011-02-15 14:25:23 -0800475 final ObjectAnimator slideAnimation = ObjectAnimator.ofInt(this, "controlsOffset",
476 mHideControls ? 0 : CONTROLS_ANIMATE_WIDTH,
477 mHideControls ? CONTROLS_ANIMATE_WIDTH : 0);
478 slideAnimation.setDuration(CONTROLS_ANIMATE_DURATION);
479 ObjectAnimator.setFrameDelay(0);
480 slideAnimation.start();
RoboErikde20d762011-02-08 17:52:25 -0800481 return true;
Michael Chan3458a172010-07-13 17:58:21 -0700482 default:
483 return false;
484 }
Michael Chanab29d9e2010-07-21 06:08:47 -0700485 mController.sendEvent(this, EventType.GO_TO, t, null, -1, viewType);
Michael Chan3458a172010-07-13 17:58:21 -0700486 return true;
487 }
Mason Tang8e3d4302010-07-12 17:39:30 -0700488
RoboErikb8549562011-02-15 14:25:23 -0800489 /**
490 * Sets the offset of the controls on the right for animating them off/on
491 * screen. ProGuard strips this if it's not in proguard.flags
492 *
493 * @param controlsOffset The current offset in pixels
494 */
495 public void setControlsOffset(int controlsOffset) {
496 mMiniMonth.setTranslationX(controlsOffset);
497 mCalendarsList.setTranslationX(controlsOffset);
498 mHomeTime.setTranslationX(controlsOffset);
499 mControlsParams.width = Math.max(
500 0, CONTROLS_ANIMATE_WIDTH - controlsOffset - mControlsParams.rightMargin);
501 mMiniMonthContainer.setLayoutParams(mControlsParams);
502 }
RoboErikde20d762011-02-08 17:52:25 -0800503
Mason Tang8e3d4302010-07-12 17:39:30 -0700504 @Override
505 public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
Daisuke Miyakawa4b441bd2010-09-16 14:55:36 -0700506 if (key.equals(GeneralPreferences.KEY_WEEK_START_DAY)) {
Erikcb811892010-09-28 13:44:19 -0700507 if (mPaused) {
508 mUpdateOnResume = true;
509 } else {
510 initFragments(mController.getTime(), mController.getViewType(), null);
511 }
Mason Tang8e3d4302010-07-12 17:39:30 -0700512 }
513 }
Michael Chanab29d9e2010-07-21 06:08:47 -0700514
Erik63cd0532011-01-26 14:16:03 -0800515 private void setMainPane(
516 FragmentTransaction ft, int viewId, int viewType, long timeMillis, boolean force) {
Michael Chan6191c122010-11-02 16:23:47 -0700517 if (mOnSaveInstanceStateCalled) {
518 return;
519 }
Erik7b92da22010-09-23 14:55:22 -0700520 if (!force && mCurrentView == viewType) {
Michael Chanab29d9e2010-07-21 06:08:47 -0700521 return;
522 }
523
Erik648c59c2010-08-13 12:49:26 -0700524 if (viewType != mCurrentView) {
525 // The rules for this previous view are different than the
526 // controller's and are used for intercepting the back button.
Erikdd95df52010-08-27 09:31:18 -0700527 if (mCurrentView != ViewType.EDIT && mCurrentView > 0) {
528 mPreviousView = mCurrentView;
529 }
Erik648c59c2010-08-13 12:49:26 -0700530 mCurrentView = viewType;
531 }
Erik3f348f32010-08-10 13:17:19 -0700532 // Create new fragment
533 Fragment frag;
Michael Chanab29d9e2010-07-21 06:08:47 -0700534 switch (viewType) {
535 case ViewType.AGENDA:
Mason Tang31df4262010-07-19 17:51:46 -0700536 frag = new AgendaFragment(timeMillis);
Michael Chanab29d9e2010-07-21 06:08:47 -0700537 break;
538 case ViewType.DAY:
Daisuke Miyakawa40474a82010-10-25 17:07:34 -0700539 if (mActionBar != null && (mActionBar.getSelectedTab() != mDayTab)) {
540 mActionBar.selectTab(mDayTab);
541 }
Michael Chan75d9b562010-07-26 16:54:25 -0700542 frag = new DayFragment(timeMillis, 1);
543 break;
Michael Chanab29d9e2010-07-21 06:08:47 -0700544 case ViewType.WEEK:
Daisuke Miyakawa40474a82010-10-25 17:07:34 -0700545 if (mActionBar != null && (mActionBar.getSelectedTab() != mWeekTab)) {
546 mActionBar.selectTab(mWeekTab);
547 }
Michael Chan75d9b562010-07-26 16:54:25 -0700548 frag = new DayFragment(timeMillis, 7);
Michael Chanab29d9e2010-07-21 06:08:47 -0700549 break;
550 case ViewType.MONTH:
Daisuke Miyakawa40474a82010-10-25 17:07:34 -0700551 if (mActionBar != null && (mActionBar.getSelectedTab() != mMonthTab)) {
552 mActionBar.selectTab(mMonthTab);
553 }
Erik40bcd102010-11-16 15:46:40 -0800554 frag = new MonthByWeekFragment(timeMillis, false);
Michael Chanab29d9e2010-07-21 06:08:47 -0700555 break;
556 default:
Michael Chand6734db2010-07-22 00:48:08 -0700557 throw new IllegalArgumentException(
558 "Must be Agenda, Day, Week, or Month ViewType, not " + viewType);
Michael Chanab29d9e2010-07-21 06:08:47 -0700559 }
560
561 boolean doCommit = false;
562 if (ft == null) {
563 doCommit = true;
Dianne Hackborn12b33302011-01-17 12:30:13 -0800564 ft = getFragmentManager().beginTransaction();
Michael Chanab29d9e2010-07-21 06:08:47 -0700565 }
566
567 ft.replace(viewId, frag);
Daisuke Miyakawa93e69eb2010-10-22 18:54:38 -0700568
Erik954c8712010-08-06 10:12:34 -0700569 if (DEBUG) {
570 Log.d(TAG, "Adding handler with viewId " + viewId + " and type " + viewType);
571 }
Erik3f348f32010-08-10 13:17:19 -0700572 // If the key is already registered this will replace it
573 mController.registerEventHandler(viewId, (EventHandler) frag);
Michael Chanab29d9e2010-07-21 06:08:47 -0700574
575 if (doCommit) {
Michael Chane8f45c62011-03-01 14:41:03 -0800576 Log.d(TAG, "setMainPane AllInOne=" + this + " finishing:" + this.isFinishing());
Michael Chanab29d9e2010-07-21 06:08:47 -0700577 ft.commit();
578 }
579 }
580
581 private void setTitleInActionBar(EventInfo event) {
Erikeaafa2b2010-12-23 14:30:37 -0800582 if (event.eventType != EventType.UPDATE_TITLE || mActionBar == null) {
Michael Chanab29d9e2010-07-21 06:08:47 -0700583 return;
584 }
585
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -0700586 final long start = event.startTime.toMillis(false /* use isDst */);
587 final long end;
Michael Chand6734db2010-07-22 00:48:08 -0700588 if (event.endTime != null) {
Michael Chanab29d9e2010-07-21 06:08:47 -0700589 end = event.endTime.toMillis(false /* use isDst */);
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -0700590 } else {
591 end = start;
Michael Chanab29d9e2010-07-21 06:08:47 -0700592 }
Michael Chanab29d9e2010-07-21 06:08:47 -0700593
Erikeaafa2b2010-12-23 14:30:37 -0800594 final String msg = Utils.formatDateRange(this, start, end, (int) event.extraLong);
Erik259b8f92011-01-12 14:01:12 -0800595 CharSequence oldDate = mDateRange.getText();
Erikeaafa2b2010-12-23 14:30:37 -0800596 mDateRange.setText(msg);
Erik259b8f92011-01-12 14:01:12 -0800597 if (!TextUtils.equals(oldDate, msg)) {
598 mDateRange.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
599 }
Michael Chanab29d9e2010-07-21 06:08:47 -0700600 }
601
Erik6c255102010-09-29 14:43:00 -0700602 private void updateHomeClock() {
Erikc5f92d72010-11-11 16:18:34 -0800603 mTimeZone = Utils.getTimeZone(this, mHomeTimeUpdater);
Erik6c255102010-09-29 14:43:00 -0700604 if (mIsMultipane && (mCurrentView == ViewType.DAY || mCurrentView == ViewType.WEEK)
Erikc5f92d72010-11-11 16:18:34 -0800605 && !TextUtils.equals(mTimeZone, Time.getCurrentTimezone())) {
606 Time time = new Time(mTimeZone);
Erik6c255102010-09-29 14:43:00 -0700607 time.setToNow();
608 long millis = time.toMillis(true);
609 boolean isDST = time.isDst != 0;
610 int flags = DateUtils.FORMAT_SHOW_TIME;
611 if (DateFormat.is24HourFormat(this)) {
612 flags |= DateUtils.FORMAT_24HOUR;
613 }
614 // Formats the time as
Erikc5f92d72010-11-11 16:18:34 -0800615 String timeString = (new StringBuilder(
616 Utils.formatDateRange(this, millis, millis, flags))).append(" ").append(
617 TimeZone.getTimeZone(mTimeZone).getDisplayName(
618 isDST, TimeZone.SHORT, Locale.getDefault())).toString();
Erik6c255102010-09-29 14:43:00 -0700619 mHomeTime.setText(timeString);
620 mHomeTime.setVisibility(View.VISIBLE);
621 // Update when the minute changes
622 mHomeTime.postDelayed(
Daisuke Miyakawac9e53072010-10-14 12:18:49 -0700623 mHomeTimeUpdater,
624 DateUtils.MINUTE_IN_MILLIS - (millis % DateUtils.MINUTE_IN_MILLIS));
Erik6c255102010-09-29 14:43:00 -0700625 } else {
626 mHomeTime.setVisibility(View.GONE);
627 }
628 }
629
Erik3f348f32010-08-10 13:17:19 -0700630 @Override
Michael Chanab29d9e2010-07-21 06:08:47 -0700631 public long getSupportedEventTypes() {
Erikeaafa2b2010-12-23 14:30:37 -0800632 return EventType.GO_TO | EventType.VIEW_EVENT | EventType.UPDATE_TITLE;
Michael Chanab29d9e2010-07-21 06:08:47 -0700633 }
634
Erik3f348f32010-08-10 13:17:19 -0700635 @Override
Michael Chanab29d9e2010-07-21 06:08:47 -0700636 public void handleEvent(EventInfo event) {
Michael Chane8f45c62011-03-01 14:41:03 -0800637 Log.d(TAG, "handleEvent AllInOne=" + this);
Michael Chanab29d9e2010-07-21 06:08:47 -0700638 if (event.eventType == EventType.GO_TO) {
Erik63cd0532011-01-26 14:16:03 -0800639 setMainPane(
640 null, R.id.main_pane, event.viewType, event.startTime.toMillis(false), false);
Erikaa3dde12011-02-03 11:16:23 -0800641 if (mSearchView != null) {
642 mSearchView.clearFocus();
643 }
Erik9fc409f2010-07-28 11:40:47 -0700644 if (!mIsMultipane) {
645 return;
646 }
Michael Chanab29d9e2010-07-21 06:08:47 -0700647 if (event.viewType == ViewType.MONTH) {
648 // hide minimonth and calendar frag
RoboErikde20d762011-02-08 17:52:25 -0800649 mMiniMonth.setVisibility(View.GONE);
650 mCalendarsList.setVisibility(View.GONE);
651 mMiniMonthContainer.setVisibility(View.GONE);
652 if (mControlsMenu != null) {
653 mControlsMenu.setVisible(false);
654 mControlsMenu.setEnabled(false);
655 }
Michael Chanab29d9e2010-07-21 06:08:47 -0700656 } else {
657 // show minimonth and calendar frag
RoboErikde20d762011-02-08 17:52:25 -0800658 mMiniMonth.setVisibility(View.VISIBLE);
659 mCalendarsList.setVisibility(View.VISIBLE);
660 mMiniMonthContainer.setVisibility(View.VISIBLE);
661 if (mControlsMenu != null) {
662 mControlsMenu.setVisible(true);
663 mControlsMenu.setEnabled(true);
664 }
Michael Chanab29d9e2010-07-21 06:08:47 -0700665 }
Michael Chan71d08832010-08-25 18:28:59 -0700666 } else if (event.eventType == EventType.VIEW_EVENT) {
Michael Chan0a01fd32011-01-23 15:13:28 -0800667 EventInfoFragment fragment = new EventInfoFragment(this,
Michael Chandeced892010-12-10 15:59:35 -0800668 event.id, event.startTime.toMillis(false), event.endTime.toMillis(false),
669 (int) event.extraLong);
RoboErik87f993f2011-02-03 17:47:20 -0800670 if (event.selectedTime != null) {
671 mController.sendEvent(this, EventType.GO_TO, event.selectedTime, event.selectedTime,
672 -1, ViewType.DETAIL);
Erik63cd0532011-01-26 14:16:03 -0800673 }
Michael Chan71d08832010-08-25 18:28:59 -0700674 fragment.setDialogParams(event.x, event.y);
Erik63cd0532011-01-26 14:16:03 -0800675 FragmentManager fm = getFragmentManager();
676 FragmentTransaction ft = fm.beginTransaction();
677 // if we have an old popup close it
678 Fragment fOld = fm.findFragmentByTag(EVENT_INFO_FRAGMENT_TAG);
Michael Chane8f45c62011-03-01 14:41:03 -0800679 if (fOld != null && fOld.isAdded()) {
Erik63cd0532011-01-26 14:16:03 -0800680 ft.remove(fOld);
681 }
682 ft.add(fragment, EVENT_INFO_FRAGMENT_TAG);
683 ft.commit();
Erikeaafa2b2010-12-23 14:30:37 -0800684 } else if (event.eventType == EventType.UPDATE_TITLE) {
685 setTitleInActionBar(event);
Michael Chanab29d9e2010-07-21 06:08:47 -0700686 }
Erik6c255102010-09-29 14:43:00 -0700687 updateHomeClock();
Michael Chanab29d9e2010-07-21 06:08:47 -0700688 }
689
Erik3f348f32010-08-10 13:17:19 -0700690 @Override
Michael Chanab29d9e2010-07-21 06:08:47 -0700691 public void eventsChanged() {
Erik954c8712010-08-06 10:12:34 -0700692 mController.sendEvent(this, EventType.EVENTS_CHANGED, null, null, -1, ViewType.CURRENT);
Michael Chanab29d9e2010-07-21 06:08:47 -0700693 }
694
Erik3f348f32010-08-10 13:17:19 -0700695 @Override
Adam Powell28f9b352011-01-20 18:36:10 -0800696 public boolean onQueryTextChange(String newText) {
Daisuke Miyakawa6d2e6f72010-09-17 10:30:54 -0700697 return false;
698 }
699
700 @Override
Adam Powell28f9b352011-01-20 18:36:10 -0800701 public boolean onQueryTextSubmit(String query) {
Erikca478672011-01-19 20:02:47 -0800702 if (TextUtils.equals(query, "TARDIS")) {
703 Utils.tardis();
704 }
Erikcb830312011-01-19 14:41:41 -0800705 mSearchView.clearFocus();
Michael Chan46a8b112010-12-14 16:36:27 -0800706 mController.sendEvent(this, EventType.SEARCH, null, null, -1, ViewType.CURRENT, -1, query,
Erik7b92da22010-09-23 14:55:22 -0700707 getComponentName());
Daisuke Miyakawa6d2e6f72010-09-17 10:30:54 -0700708 return false;
709 }
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -0700710
711 @Override
712 public void onTabSelected(Tab tab, FragmentTransaction ft) {
Michael Chane8f45c62011-03-01 14:41:03 -0800713 Log.w(TAG, "TabSelected AllInOne=" + this + " finishing:" + this.isFinishing());
Daisuke Miyakawa40474a82010-10-25 17:07:34 -0700714 if (tab == mDayTab && mCurrentView != ViewType.DAY) {
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -0700715 mController.sendEvent(this, EventType.GO_TO, null, null, -1, ViewType.DAY);
Daisuke Miyakawa40474a82010-10-25 17:07:34 -0700716 } else if (tab == mWeekTab && mCurrentView != ViewType.WEEK) {
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -0700717 mController.sendEvent(this, EventType.GO_TO, null, null, -1, ViewType.WEEK);
Daisuke Miyakawa40474a82010-10-25 17:07:34 -0700718 } else if (tab == mMonthTab && mCurrentView != ViewType.MONTH) {
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -0700719 mController.sendEvent(this, EventType.GO_TO, null, null, -1, ViewType.MONTH);
720 } else {
Michael Chanece2fbd2011-01-19 14:49:37 -0800721 Log.w(TAG, "TabSelected event from unknown tab: "
722 + (tab == null ? "null" : tab.getText()));
723 Log.w(TAG, "CurrentView:" + mCurrentView + " Tab:" + tab.toString() + " Day:" + mDayTab
724 + " Week:" + mWeekTab + " Month:" + mMonthTab);
Daisuke Miyakawa04ae7682010-10-19 14:15:39 -0700725 }
726 }
727
728 @Override
729 public void onTabReselected(Tab tab, FragmentTransaction ft) {
730 }
731
732 @Override
733 public void onTabUnselected(Tab tab, FragmentTransaction ft) {
734 }
Michael Chan49701592010-06-30 11:04:03 -0700735}