]> www.average.org Git - WhereAmI.git/blobdiff - src/org/average/whereami/Authorize.java
make configurable calendar selection
[WhereAmI.git] / src / org / average / whereami / Authorize.java
index 44a88a9b470d11943ed2c772d4311b91161a58e0..1137ea57e454e3518509c40edaa21553aca8156c 100644 (file)
@@ -6,14 +6,14 @@ package org.average.whereami;
 import java.io.IOException;
 
 import org.average.whereami.ClientCredentials;
-import org.average.whereami.CredentialStore;
+import org.average.whereami.PersistentStore;
 
 import android.app.Activity;
 import android.os.Bundle;
 import android.graphics.Bitmap;
+import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
 import android.preference.PreferenceManager;
 import android.util.Log;
 import android.view.View;
@@ -29,12 +29,7 @@ import com.google.api.client.json.jackson.JacksonFactory;
 public class Authorize extends Activity {
 
     final String TAG = getClass().getName();
-
-    private SharedPreferences prefs;
-    private static final String ACCESS_TOKEN = "access_token";
-    private static final String EXPIRES_IN = "expires_in";
-    private static final String REFRESH_TOKEN = "refresh_token";
-    private static final String SCOPE = "scope";
+    SharedPreferences prefs;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -73,19 +68,13 @@ public class Authorize extends Activity {
                                 ClientCredentials.CLIENT_SECRET,
                                 code,
                                 ClientCredentials.REDIRECT_URI).execute();
-                            CredentialStore credentialStore =
-                                               new CredentialStore(prefs);
+                            PersistentStore credentialStore =
+                                                    new PersistentStore(prefs);
                             credentialStore.write(accessTokenResponse);
                             finish();
-                            //view.setVisibility(View.INVISIBLE);
-                            //startActivity(new Intent(Authorize.this,
-                            //                         WhereAmI.class));
                         } else if (url.indexOf("error=")!=-1) {
-                            new CredentialStore(prefs).clear();
+                            new PersistentStore(prefs).clear();
                             finish();
-                            //view.setVisibility(View.INVISIBLE);
-                            //startActivity(new Intent(Authorize.this,
-                            //                         WhereAmI.class));
                         }
                     } catch (IOException e) {
                         e.printStackTrace();