OSDN Git Service

Cleanup
authorJohn Reck <jreck@google.com>
Tue, 5 Feb 2013 18:44:51 +0000 (10:44 -0800)
committerJohn Reck <jreck@google.com>
Tue, 5 Feb 2013 20:35:06 +0000 (12:35 -0800)
 Move Canvas to com.android.photos.canvas
 Remove workaround for b/8079561

Change-Id: I14b832d5935eb8704e96e5591c58f33a7cd4de31

AndroidManifest.xml
src/com/android/gallery3d/app/Gallery.java
src/com/android/photos/canvas/CanvasActivity.java [new file with mode: 0644]
src/com/android/photos/canvas/CanvasProvider.java [moved from src/com/android/gallery3d/provider/CanvasProvider.java with 94% similarity]
src/com/android/photos/canvas/CanvasProviderBase.java [moved from src/com/android/gallery3d/provider/CanvasProviderBase.java with 99% similarity]
src/com/android/photos/canvas/EnableSyncActivity.java [moved from src/com/google/android/canvas/provider/EnableSyncActivity.java with 83% similarity]

index d497283..e36f1a4 100644 (file)
                 <data android:mimeType="vnd.android.cursor.dir/image" />
                 <data android:mimeType="vnd.android.cursor.dir/video" />
             </intent-filter>
-            <meta-data
-                android:name="com.google.android.canvas.data.launcher_info"
-                android:resource="@xml/canvas_info" />
         </activity>
 
         <!-- we add this activity-alias for shortcut backward compatibility -->
         </activity>
         <service android:name="com.android.gallery3d.app.BatchService" />
         <service android:name="com.android.camera.MediaSaveService" />
+
         <!-- canvas -->
         <provider
-            android:name="com.android.gallery3d.provider.CanvasProvider"
+            android:name="com.android.photos.canvas.CanvasProvider"
             android:authorities="com.android.gallery3d.provider.CanvasProvider"
             android:exported="true"
             android:label="@string/app_name"
             android:permission="android.permission.ACCESS_APP_BROWSE_DATA" />
+        <activity android:name="com.android.photos.canvas.EnableSyncActivity"
+                android:exported="true"
+                android:theme="@style/Theme.ProxyLauncher">
+        </activity>
+        <activity android:name="com.android.photos.canvas.CanvasActivity"
+                android:label="@string/app_name"
+                android:exported="true"
+                android:theme="@style/Theme.ProxyLauncher">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="com.google.android.canvas.category.BROWSE_LAUNCHER" />
+            </intent-filter>
+            <meta-data
+                android:name="com.google.android.canvas.data.launcher_info"
+                android:resource="@xml/canvas_info" />
+        </activity>
     </application>
 </manifest>
index f847f2f..baef56b 100644 (file)
@@ -37,7 +37,6 @@ import com.android.gallery3d.data.MediaItem;
 import com.android.gallery3d.data.MediaSet;
 import com.android.gallery3d.data.Path;
 import com.android.gallery3d.picasasource.PicasaSource;
-import com.android.gallery3d.provider.CanvasProvider;
 import com.android.gallery3d.util.GalleryUtils;
 
 public final class Gallery extends AbstractGalleryActivity implements OnCancelListener {
@@ -101,10 +100,6 @@ public final class Gallery extends AbstractGalleryActivity implements OnCancelLi
     }
 
     public void startDefaultPage() {
-        if (CanvasProvider.startBrowseActivity(this)) {
-            finish();
-            return;
-        }
         PicasaSource.showSignInReminder(this);
         Bundle data = new Bundle();
         data.putString(AlbumSetPage.KEY_MEDIA_PATH,
diff --git a/src/com/android/photos/canvas/CanvasActivity.java b/src/com/android/photos/canvas/CanvasActivity.java
new file mode 100644 (file)
index 0000000..17afdb8
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2013 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.photos.canvas;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+
+import com.google.android.canvas.provider.CanvasContract;
+
+
+public class CanvasActivity extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        Intent intent = CanvasContract.getBrowseIntent(
+                CanvasProvider.BROWSER_ROOT_URI, 0);
+        startActivity(intent);
+        finish();
+    }
+}
  * limitations under the License.
  */
 
-package com.android.gallery3d.provider;
+package com.android.photos.canvas;
 
 import android.accounts.Account;
 import android.accounts.AccountManager;
-import android.app.Activity;
-import android.content.ActivityNotFoundException;
 import android.content.ContentResolver;
 import android.content.Intent;
 import android.content.res.AssetFileDescriptor;
-import android.content.res.Configuration;
 import android.database.MatrixCursor;
 import android.graphics.Bitmap;
 import android.graphics.Bitmap.CompressFormat;
@@ -47,7 +44,6 @@ import com.android.gallery3d.util.ThreadPool.Job;
 import com.android.gallery3d.util.ThreadPool.JobContext;
 import com.google.android.canvas.data.Cluster;
 import com.google.android.canvas.provider.CanvasContract;
-import com.google.android.canvas.provider.EnableSyncActivity;
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -334,6 +330,7 @@ public class CanvasProvider extends CanvasProviderBase {
 
     @Override
     protected void buildBrowseRow(String[] projection, MatrixCursor c, Uri uri) {
+        // TODO: Switch to item_uri scheme b/8018482
         int row = Integer.parseInt(uri.getLastPathSegment());
         MediaSet album = loadRootMediaSet().getSubMediaSet(row);
         loadMediaSet(album);
@@ -381,20 +378,4 @@ public class CanvasProvider extends CanvasProviderBase {
             c.addRow(header);
         }
     }
-
-    // TODO: Remove once b/8079561 is resolved
-    public static boolean startBrowseActivity(Activity activity) {
-        Configuration config = activity.getResources().getConfiguration();
-        if (config.touchscreen == Configuration.TOUCHSCREEN_NOTOUCH) {
-            try {
-                Intent intent = CanvasContract.getBrowseIntent(
-                        BROWSER_ROOT_URI, 0);
-                activity.startActivity(intent);
-                return true;
-            } catch (ActivityNotFoundException ex) {
-            }
-        }
-        return false;
-    }
-
 }
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.gallery3d.provider;
+package com.android.photos.canvas;
 
 import android.content.ContentProvider;
 import android.content.ContentValues;
@@ -50,14 +50,15 @@ public abstract class CanvasProviderBase extends ContentProvider {
     protected static final String PATH_BROWSE_HEADERS = PATH_BROWSE + "/"
             + CanvasContract.PATH_BROWSE_HEADERS;
 
+    public static final Uri BROWSER_ROOT_URI = Uri.parse("content://"
+            + AUTHORITY + "/" + PATH_BROWSE);
+
     protected static final int LAUNCHER = 1;
     protected static final int LAUNCHER_ITEMS = 2;
     protected static final int LAUNCHER_ITEM_ID = 3;
     protected static final int BROWSE_HEADERS = 4;
     protected static final int BROWSE = 5;
     protected static final int IMAGE = 6;
-    protected static final Uri BROWSER_ROOT_URI = Uri.parse("content://"
-            + AUTHORITY + "/" + PATH_BROWSE);
     protected static final UriMatcher sUriMatcher = new UriMatcher(
             UriMatcher.NO_MATCH);
 
@@ -1,4 +1,4 @@
-package com.google.android.canvas.provider;
+package com.android.photos.canvas;
 
 import android.accounts.Account;
 import android.accounts.AccountManager;
@@ -6,8 +6,6 @@ import android.app.Activity;
 import android.content.ContentResolver;
 import android.os.Bundle;
 
-import com.android.gallery3d.provider.CanvasProvider;
-import com.android.gallery3d.provider.CanvasProviderBase;
 
 
 public class EnableSyncActivity extends Activity {