diff options
author | John Reck <jreck@google.com> | 2013-02-05 10:44:51 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2013-02-05 12:35:06 -0800 |
commit | 009dbc7b5ff33e97ca8a99fb60f1275ad07f572d (patch) | |
tree | f8b5ba2a22ae35c4c5b05ff6995a60c0af162e93 /src/com/android | |
parent | 465e25bd3cb2c76732102d7be98bc0335962f715 (diff) | |
download | android_packages_apps_Snap-009dbc7b5ff33e97ca8a99fb60f1275ad07f572d.tar.gz android_packages_apps_Snap-009dbc7b5ff33e97ca8a99fb60f1275ad07f572d.tar.bz2 android_packages_apps_Snap-009dbc7b5ff33e97ca8a99fb60f1275ad07f572d.zip |
Cleanup
Move Canvas to com.android.photos.canvas
Remove workaround for b/8079561
Change-Id: I14b832d5935eb8704e96e5591c58f33a7cd4de31
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/gallery3d/app/Gallery.java | 5 | ||||
-rw-r--r-- | src/com/android/photos/canvas/CanvasActivity.java | 35 | ||||
-rw-r--r-- | src/com/android/photos/canvas/CanvasProvider.java (renamed from src/com/android/gallery3d/provider/CanvasProvider.java) | 23 | ||||
-rw-r--r-- | src/com/android/photos/canvas/CanvasProviderBase.java (renamed from src/com/android/gallery3d/provider/CanvasProviderBase.java) | 7 | ||||
-rw-r--r-- | src/com/android/photos/canvas/EnableSyncActivity.java | 25 |
5 files changed, 66 insertions, 29 deletions
diff --git a/src/com/android/gallery3d/app/Gallery.java b/src/com/android/gallery3d/app/Gallery.java index f847f2f39..baef56b44 100644 --- a/src/com/android/gallery3d/app/Gallery.java +++ b/src/com/android/gallery3d/app/Gallery.java @@ -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 index 000000000..17afdb8b4 --- /dev/null +++ b/src/com/android/photos/canvas/CanvasActivity.java @@ -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(); + } +} diff --git a/src/com/android/gallery3d/provider/CanvasProvider.java b/src/com/android/photos/canvas/CanvasProvider.java index d339aa781..1ed6cd461 100644 --- a/src/com/android/gallery3d/provider/CanvasProvider.java +++ b/src/com/android/photos/canvas/CanvasProvider.java @@ -14,16 +14,13 @@ * 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; - } - } diff --git a/src/com/android/gallery3d/provider/CanvasProviderBase.java b/src/com/android/photos/canvas/CanvasProviderBase.java index 30a1d5410..4438c5398 100644 --- a/src/com/android/gallery3d/provider/CanvasProviderBase.java +++ b/src/com/android/photos/canvas/CanvasProviderBase.java @@ -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); diff --git a/src/com/android/photos/canvas/EnableSyncActivity.java b/src/com/android/photos/canvas/EnableSyncActivity.java new file mode 100644 index 000000000..e6d5303b5 --- /dev/null +++ b/src/com/android/photos/canvas/EnableSyncActivity.java @@ -0,0 +1,25 @@ +package com.android.photos.canvas; + +import android.accounts.Account; +import android.accounts.AccountManager; +import android.app.Activity; +import android.content.ContentResolver; +import android.os.Bundle; + + + +public class EnableSyncActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + Account[] accounts = AccountManager.get(this).getAccountsByType( + CanvasProvider.ACCOUNT_TYPE); + for (Account account : accounts) { + ContentResolver.setSyncAutomatically(account, + CanvasProvider.PHOTO_AUTHORITY, true); + } + finish(); + getContentResolver().notifyChange(CanvasProviderBase.NOTIFY_CHANGED_URI, + null, false); + } +} |