OSDN Git Service

change the sync framework and users to understand Account
authorFred Quintana <fredq@google.com>
Thu, 23 Apr 2009 20:36:28 +0000 (13:36 -0700)
committerFred Quintana <fredq@google.com>
Thu, 23 Apr 2009 21:01:16 +0000 (14:01 -0700)
src/com/android/calendar/CalendarActivity.java
src/com/android/calendar/LaunchActivity.java

index 2bc991a..e2621c6 100644 (file)
@@ -18,7 +18,6 @@ package com.android.calendar;
 
 import dalvik.system.VMRuntime;
 
-import android.accounts.AccountMonitor;
 import android.app.Activity;
 import android.content.BroadcastReceiver;
 import android.content.ContentResolver;
@@ -53,8 +52,6 @@ public class CalendarActivity extends Activity implements Navigator {
 
     private ContentResolver mContentResolver;
 
-    private AccountMonitor mAccountMonitor;
-
     protected ProgressBar mProgressBar;
     protected ViewSwitcher mViewSwitcher;
     protected Animation mInAnimationForward;
@@ -153,14 +150,6 @@ public class CalendarActivity extends Activity implements Navigator {
     }
 
     @Override
-    protected void onDestroy() {
-        if (mAccountMonitor != null) {
-            mAccountMonitor.close();
-        }
-        super.onDestroy();
-    }
-
-    @Override
     protected void onPause() {
         super.onPause();
         mContentResolver.unregisterContentObserver(mObserver);
index e3dd523..a982ba1 100644 (file)
@@ -23,6 +23,8 @@ import android.accounts.AuthenticatorException;
 import android.accounts.Future2;
 import android.accounts.Future2Callback;
 import android.accounts.OperationCanceledException;
+import android.accounts.Account;
+import android.accounts.Constants;
 import android.app.Activity;
 import android.content.Intent;
 import android.content.SharedPreferences;
@@ -57,8 +59,9 @@ public class LaunchActivity extends Activity {
                 public void run(Future2 future) {
                     try {
                         Bundle result = future.getResult();
-                        onAccountsLoaded(result.getString(
-                                GoogleLoginServiceConstants.AUTH_ACCOUNT_KEY));
+                        onAccountsLoaded(new Account(
+                                result.getString(GoogleLoginServiceConstants.AUTH_ACCOUNT_KEY),
+                                result.getString(Constants.ACCOUNT_TYPE_KEY)));
                     } catch (OperationCanceledException e) {
                         finish();
                     } catch (IOException e) {
@@ -71,7 +74,7 @@ public class LaunchActivity extends Activity {
         }
     }
     
-    private void onAccountsLoaded(String account) {
+    private void onAccountsLoaded(Account account) {
         SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
         String startActivity = prefs.getString(CalendarPreferenceActivity.KEY_START_VIEW,
                 CalendarPreferenceActivity.DEFAULT_START_VIEW);