summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhbong Chang <cwahbong@google.com>2012-07-30 11:34:13 +0800
committerAhbong Chang <cwahbong@google.com>2012-07-30 11:42:01 +0800
commit813ac7496e93faa2cf0f2763df421a146d38fc11 (patch)
treef4a1064166c83f8560cdf5eaeb18a4107fd344a5
parentdbc472eb08c19e78811823f8b83e59c3aeacc6d0 (diff)
downloadandroid_packages_apps_Snap-813ac7496e93faa2cf0f2763df421a146d38fc11.tar.gz
android_packages_apps_Snap-813ac7496e93faa2cf0f2763df421a146d38fc11.tar.bz2
android_packages_apps_Snap-813ac7496e93faa2cf0f2763df421a146d38fc11.zip
Code clean up.
Remove unused imports. Remove unused fields. Remove unnecessary cast. Add missing override annotations. Change-Id: Idad2e587697a5015eb5363d7b71fab9de9cc8ffb
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/FileCache.java1
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/Fingerprint.java4
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/HttpClientFactory.java1
-rw-r--r--gallerycommon/src/com/android/gallery3d/common/Scroller.java6
-rw-r--r--src/com/android/gallery3d/app/AlbumDataLoader.java2
-rw-r--r--src/com/android/gallery3d/app/AlbumPage.java7
-rw-r--r--src/com/android/gallery3d/app/AlbumPicker.java2
-rw-r--r--src/com/android/gallery3d/app/AlbumSetDataLoader.java2
-rw-r--r--src/com/android/gallery3d/app/AppBridge.java2
-rw-r--r--src/com/android/gallery3d/app/CropImage.java7
-rw-r--r--src/com/android/gallery3d/app/EyePosition.java3
-rw-r--r--src/com/android/gallery3d/app/FilterUtils.java1
-rw-r--r--src/com/android/gallery3d/app/GalleryActionBar.java6
-rw-r--r--src/com/android/gallery3d/app/GalleryAppImpl.java5
-rw-r--r--src/com/android/gallery3d/app/ManageCachePage.java1
-rw-r--r--src/com/android/gallery3d/app/MovieControllerOverlay.java724
-rw-r--r--src/com/android/gallery3d/app/OrientationManager.java1
-rw-r--r--src/com/android/gallery3d/app/PhotoDataAdapter.java14
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java3
-rw-r--r--src/com/android/gallery3d/app/PickerActivity.java1
-rw-r--r--src/com/android/gallery3d/app/SinglePhotoDataAdapter.java5
-rw-r--r--src/com/android/gallery3d/app/SlideshowDataAdapter.java6
-rw-r--r--src/com/android/gallery3d/app/SlideshowPage.java11
-rw-r--r--src/com/android/gallery3d/data/BitmapPool.java1
-rw-r--r--src/com/android/gallery3d/data/ClusterAlbum.java4
-rw-r--r--src/com/android/gallery3d/data/ClusterAlbumSet.java3
-rw-r--r--src/com/android/gallery3d/data/ComboAlbum.java2
-rw-r--r--src/com/android/gallery3d/data/ComboAlbumSet.java2
-rw-r--r--src/com/android/gallery3d/data/DataManager.java1
-rw-r--r--src/com/android/gallery3d/data/DownloadCache.java3
-rw-r--r--src/com/android/gallery3d/data/DownloadUtils.java1
-rw-r--r--src/com/android/gallery3d/data/Face.java1
-rw-r--r--src/com/android/gallery3d/data/FaceClustering.java1
-rw-r--r--src/com/android/gallery3d/data/FilterDeleteSet.java1
-rw-r--r--src/com/android/gallery3d/data/FilterSource.java1
-rw-r--r--src/com/android/gallery3d/data/FilterTypeSet.java2
-rw-r--r--src/com/android/gallery3d/data/LocalImage.java1
-rw-r--r--src/com/android/gallery3d/data/LocalMediaItem.java1
-rw-r--r--src/com/android/gallery3d/data/LocalSource.java1
-rw-r--r--src/com/android/gallery3d/data/LocationClustering.java3
-rw-r--r--src/com/android/gallery3d/data/MediaDetails.java1
-rw-r--r--src/com/android/gallery3d/data/MediaSet.java2
-rw-r--r--src/com/android/gallery3d/data/MtpClient.java6
-rw-r--r--src/com/android/gallery3d/data/MtpContext.java2
-rw-r--r--src/com/android/gallery3d/data/MtpImage.java2
-rw-r--r--src/com/android/gallery3d/data/MtpSource.java1
-rw-r--r--src/com/android/gallery3d/data/SizeClustering.java1
-rw-r--r--src/com/android/gallery3d/data/SnailAlbum.java1
-rw-r--r--src/com/android/gallery3d/data/SnailItem.java3
-rw-r--r--src/com/android/gallery3d/data/SnailSource.java1
-rw-r--r--src/com/android/gallery3d/data/TagClustering.java1
-rw-r--r--src/com/android/gallery3d/data/TimeClustering.java3
-rw-r--r--src/com/android/gallery3d/data/UriImage.java2
-rw-r--r--src/com/android/gallery3d/gadget/LocalPhotoSource.java3
-rw-r--r--src/com/android/gallery3d/gadget/MediaSetSource.java1
-rw-r--r--src/com/android/gallery3d/gadget/WidgetService.java6
-rw-r--r--src/com/android/gallery3d/onetimeinitializer/GalleryWidgetMigrator.java1
-rw-r--r--src/com/android/gallery3d/ui/ActionModeHandler.java7
-rw-r--r--src/com/android/gallery3d/ui/BasicTexture.java4
-rw-r--r--src/com/android/gallery3d/ui/BitmapScreenNail.java1
-rw-r--r--src/com/android/gallery3d/ui/CacheStorageUsageInfo.java1
-rw-r--r--src/com/android/gallery3d/ui/ColorTexture.java5
-rw-r--r--src/com/android/gallery3d/ui/CropView.java1
-rw-r--r--src/com/android/gallery3d/ui/DetailsAddressResolver.java3
-rw-r--r--src/com/android/gallery3d/ui/DialogDetailsView.java11
-rw-r--r--src/com/android/gallery3d/ui/EdgeEffect.java1
-rw-r--r--src/com/android/gallery3d/ui/EdgeView.java1
-rw-r--r--src/com/android/gallery3d/ui/ExtTexture.java1
-rw-r--r--src/com/android/gallery3d/ui/FlingScroller.java1
-rw-r--r--src/com/android/gallery3d/ui/GLCanvasImpl.java26
-rw-r--r--src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java1
-rw-r--r--src/com/android/gallery3d/ui/GestureRecognizer.java1
-rw-r--r--src/com/android/gallery3d/ui/MenuExecutor.java1
-rw-r--r--src/com/android/gallery3d/ui/Paper.java2
-rw-r--r--src/com/android/gallery3d/ui/PhotoView.java7
-rw-r--r--src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java2
-rw-r--r--src/com/android/gallery3d/ui/UndoBarView.java22
-rw-r--r--src/com/android/gallery3d/ui/UploadedTexture.java1
-rw-r--r--src/com/android/gallery3d/util/GalleryUtils.java1
-rw-r--r--src/com/android/gallery3d/util/MediaSetUtils.java1
-rw-r--r--src/com/android/gallery3d/util/PriorityThreadFactory.java1
-rw-r--r--src/com/android/gallery3d/util/Profile.java2
-rw-r--r--src/com/android/gallery3d/util/ProfileData.java1
-rw-r--r--src/com/android/gallery3d/util/ReverseGeocoder.java1
-rw-r--r--src/com/android/gallery3d/util/ThreadPool.java10
85 files changed, 613 insertions, 385 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/FileCache.java b/gallerycommon/src/com/android/gallery3d/common/FileCache.java
index a69487f4c..d7deda6fa 100644
--- a/gallerycommon/src/com/android/gallery3d/common/FileCache.java
+++ b/gallerycommon/src/com/android/gallery3d/common/FileCache.java
@@ -92,6 +92,7 @@ public class FileCache implements Closeable {
mDbHelper = new DatabaseHelper(context, dbName);
}
+ @Override
public void close() {
mDbHelper.close();
}
diff --git a/gallerycommon/src/com/android/gallery3d/common/Fingerprint.java b/gallerycommon/src/com/android/gallery3d/common/Fingerprint.java
index 39fcf9e09..2847e57ce 100644
--- a/gallerycommon/src/com/android/gallery3d/common/Fingerprint.java
+++ b/gallerycommon/src/com/android/gallery3d/common/Fingerprint.java
@@ -16,10 +16,6 @@
package com.android.gallery3d.common;
-import android.content.ContentResolver;
-import android.net.Uri;
-
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.DigestInputStream;
diff --git a/gallerycommon/src/com/android/gallery3d/common/HttpClientFactory.java b/gallerycommon/src/com/android/gallery3d/common/HttpClientFactory.java
index cb95e3329..9e327aa51 100644
--- a/gallerycommon/src/com/android/gallery3d/common/HttpClientFactory.java
+++ b/gallerycommon/src/com/android/gallery3d/common/HttpClientFactory.java
@@ -20,7 +20,6 @@ import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
-import android.util.Log;
import org.apache.http.HttpVersion;
import org.apache.http.client.HttpClient;
diff --git a/gallerycommon/src/com/android/gallery3d/common/Scroller.java b/gallerycommon/src/com/android/gallery3d/common/Scroller.java
index 160f3ca43..6cefd6fb0 100644
--- a/gallerycommon/src/com/android/gallery3d/common/Scroller.java
+++ b/gallerycommon/src/com/android/gallery3d/common/Scroller.java
@@ -342,7 +342,7 @@ public class Scroller {
mFinalY = startY + dy;
mDeltaX = dx;
mDeltaY = dy;
- mDurationReciprocal = 1.0f / (float) mDuration;
+ mDurationReciprocal = 1.0f / mDuration;
}
/**
@@ -370,8 +370,8 @@ public class Scroller {
if (mFlywheel && !mFinished) {
float oldVel = getCurrVelocity();
- float dx = (float) (mFinalX - mStartX);
- float dy = (float) (mFinalY - mStartY);
+ float dx = mFinalX - mStartX;
+ float dy = mFinalY - mStartY;
float hyp = FloatMath.sqrt(dx * dx + dy * dy);
float ndx = dx / hyp;
diff --git a/src/com/android/gallery3d/app/AlbumDataLoader.java b/src/com/android/gallery3d/app/AlbumDataLoader.java
index 71a575658..8e6fcf5c2 100644
--- a/src/com/android/gallery3d/app/AlbumDataLoader.java
+++ b/src/com/android/gallery3d/app/AlbumDataLoader.java
@@ -201,6 +201,7 @@ public class AlbumDataLoader {
}
private class MySourceListener implements ContentListener {
+ @Override
public void onContentDirty() {
if (mReloadTask != null) mReloadTask.notifyDirty();
}
@@ -243,6 +244,7 @@ public class AlbumDataLoader {
mVersion = version;
}
+ @Override
public UpdateInfo call() throws Exception {
UpdateInfo info = new UpdateInfo();
long version = mVersion;
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java
index b4e600bd8..be17f975a 100644
--- a/src/com/android/gallery3d/app/AlbumPage.java
+++ b/src/com/android/gallery3d/app/AlbumPage.java
@@ -459,6 +459,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
});
mActionModeHandler = new ActionModeHandler(mActivity, mSelectionManager);
mActionModeHandler.setActionModeListener(new ActionModeListener() {
+ @Override
public boolean onActionItemClicked(MenuItem item) {
return onItemSelected(item);
}
@@ -483,6 +484,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
if (mDetailsHelper == null) {
mDetailsHelper = new DetailsHelper(mActivity, mRootPane, mDetailsSource);
mDetailsHelper.setCloseListener(new CloseListener() {
+ @Override
public void onClose() {
hideDetails();
}
@@ -607,6 +609,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
}
}
+ @Override
public void onSelectionModeChange(int mode) {
switch (mode) {
case SelectionManager.ENTER_SELECTION_MODE: {
@@ -627,6 +630,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
}
}
+ @Override
public void onSelectionChange(Path path, boolean selected) {
Utils.assertTrue(mActionMode != null);
int count = mSelectionManager.getSelectedCount();
@@ -693,16 +697,19 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
private class MyDetailsSource implements DetailsHelper.DetailsSource {
private int mIndex;
+ @Override
public int size() {
return mAlbumDataAdapter.size();
}
+ @Override
public int setIndex() {
Path id = mSelectionManager.getSelected(false).get(0);
mIndex = mAlbumDataAdapter.findItem(id);
return mIndex;
}
+ @Override
public MediaDetails getDetails() {
// this relies on setIndex() being called beforehand
MediaObject item = mAlbumDataAdapter.get(mIndex);
diff --git a/src/com/android/gallery3d/app/AlbumPicker.java b/src/com/android/gallery3d/app/AlbumPicker.java
index 7509e63cb..65eb77291 100644
--- a/src/com/android/gallery3d/app/AlbumPicker.java
+++ b/src/com/android/gallery3d/app/AlbumPicker.java
@@ -24,8 +24,6 @@ import com.android.gallery3d.data.DataManager;
public class AlbumPicker extends PickerActivity {
- public static final String KEY_ALBUM_PATH = "album-path";
-
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
diff --git a/src/com/android/gallery3d/app/AlbumSetDataLoader.java b/src/com/android/gallery3d/app/AlbumSetDataLoader.java
index 33a30bcca..9613f99ec 100644
--- a/src/com/android/gallery3d/app/AlbumSetDataLoader.java
+++ b/src/com/android/gallery3d/app/AlbumSetDataLoader.java
@@ -219,6 +219,7 @@ public class AlbumSetDataLoader {
}
private class MySourceListener implements ContentListener {
+ @Override
public void onContentDirty() {
mReloadTask.notifyDirty();
}
@@ -279,6 +280,7 @@ public class AlbumSetDataLoader {
mUpdateInfo = info;
}
+ @Override
public Void call() {
// Avoid notifying listeners of status change after pause
// Otherwise gallery will be in inconsistent state after resume.
diff --git a/src/com/android/gallery3d/app/AppBridge.java b/src/com/android/gallery3d/app/AppBridge.java
index 5d6b1ec52..f89b35a4e 100644
--- a/src/com/android/gallery3d/app/AppBridge.java
+++ b/src/com/android/gallery3d/app/AppBridge.java
@@ -23,10 +23,12 @@ import com.android.gallery3d.ui.ScreenNail;
// This is the bridge to connect a PhotoPage to the external environment.
public abstract class AppBridge implements Parcelable {
+ @Override
public int describeContents() {
return 0;
}
+ @Override
public void writeToParcel(Parcel dest, int flags) {
}
diff --git a/src/com/android/gallery3d/app/CropImage.java b/src/com/android/gallery3d/app/CropImage.java
index a587624ed..6faf8cbcc 100644
--- a/src/com/android/gallery3d/app/CropImage.java
+++ b/src/com/android/gallery3d/app/CropImage.java
@@ -249,6 +249,7 @@ public class CropImage extends AbstractGalleryActivity {
mCropRect = cropRect;
}
+ @Override
public Intent run(JobContext jc) {
RectF cropRect = mCropRect;
Bundle extra = getIntent().getExtras();
@@ -487,6 +488,7 @@ public class CropImage extends AbstractGalleryActivity {
// We wrap the OutputStream so that it can be interrupted.
final InterruptableOutputStream ios = new InterruptableOutputStream(os);
jc.setCancelListener(new CancelListener() {
+ @Override
public void onCancel() {
ios.interrupt();
}
@@ -545,6 +547,7 @@ public class CropImage extends AbstractGalleryActivity {
this, null, getString(messageId), true, false);
mSaveTask = getThreadPool().submit(new SaveOutput(cropRect),
new FutureListener<Intent>() {
+ @Override
public void onFutureDone(Future<Intent> future) {
mSaveTask = null;
if (future.isCancelled()) return;
@@ -827,6 +830,7 @@ public class CropImage extends AbstractGalleryActivity {
if (supportedByBitmapRegionDecoder) {
mLoadTask = getThreadPool().submit(new LoadDataTask(mMediaItem),
new FutureListener<BitmapRegionDecoder>() {
+ @Override
public void onFutureDone(Future<BitmapRegionDecoder> future) {
mLoadTask = null;
BitmapRegionDecoder decoder = future.get();
@@ -841,6 +845,7 @@ public class CropImage extends AbstractGalleryActivity {
} else {
mLoadBitmapTask = getThreadPool().submit(new LoadBitmapDataTask(mMediaItem),
new FutureListener<Bitmap>() {
+ @Override
public void onFutureDone(Future<Bitmap> future) {
mLoadBitmapTask = null;
Bitmap bitmap = future.get();
@@ -925,6 +930,7 @@ public class CropImage extends AbstractGalleryActivity {
mItem = item;
}
+ @Override
public BitmapRegionDecoder run(JobContext jc) {
return mItem == null ? null : mItem.requestLargeImage().run(jc);
}
@@ -936,6 +942,7 @@ public class CropImage extends AbstractGalleryActivity {
public LoadBitmapDataTask(MediaItem item) {
mItem = item;
}
+ @Override
public Bitmap run(JobContext jc) {
return mItem == null
? null
diff --git a/src/com/android/gallery3d/app/EyePosition.java b/src/com/android/gallery3d/app/EyePosition.java
index 89e08468c..d99d97b0e 100644
--- a/src/com/android/gallery3d/app/EyePosition.java
+++ b/src/com/android/gallery3d/app/EyePosition.java
@@ -31,6 +31,7 @@ import com.android.gallery3d.common.Utils;
import com.android.gallery3d.util.GalleryUtils;
public class EyePosition {
+ @SuppressWarnings("unused")
private static final String TAG = "EyePosition";
public interface EyePositionListener {
@@ -180,9 +181,11 @@ public class EyePosition {
}
private class PositionListener implements SensorEventListener {
+ @Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
+ @Override
public void onSensorChanged(SensorEvent event) {
switch (event.sensor.getType()) {
case Sensor.TYPE_GYROSCOPE: {
diff --git a/src/com/android/gallery3d/app/FilterUtils.java b/src/com/android/gallery3d/app/FilterUtils.java
index c15457e7e..61a261f2c 100644
--- a/src/com/android/gallery3d/app/FilterUtils.java
+++ b/src/com/android/gallery3d/app/FilterUtils.java
@@ -54,6 +54,7 @@ import com.android.gallery3d.data.Path;
// functions. setupMenuItems() makes sure those types cannot be selected.
//
public class FilterUtils {
+ @SuppressWarnings("unused")
private static final String TAG = "FilterUtils";
public static final int CLUSTER_BY_ALBUM = 1;
diff --git a/src/com/android/gallery3d/app/GalleryActionBar.java b/src/com/android/gallery3d/app/GalleryActionBar.java
index 5c61648f7..2794b3fcd 100644
--- a/src/com/android/gallery3d/app/GalleryActionBar.java
+++ b/src/com/android/gallery3d/app/GalleryActionBar.java
@@ -36,6 +36,7 @@ import com.android.gallery3d.R;
import java.util.ArrayList;
public class GalleryActionBar implements ActionBar.OnNavigationListener {
+ @SuppressWarnings("unused")
private static final String TAG = "GalleryActionBar";
private ClusterRunner mClusterRunner;
@@ -91,18 +92,22 @@ public class GalleryActionBar implements ActionBar.OnNavigationListener {
private class ClusterAdapter extends BaseAdapter {
+ @Override
public int getCount() {
return sClusterItems.length;
}
+ @Override
public Object getItem(int position) {
return sClusterItems[position];
}
+ @Override
public long getItemId(int position) {
return sClusterItems[position].action;
}
+ @Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = mInflater.inflate(R.layout.action_bar_text,
@@ -207,6 +212,7 @@ public class GalleryActionBar implements ActionBar.OnNavigationListener {
final ArrayList<Integer> actions = mActions;
new AlertDialog.Builder(mContext).setTitle(R.string.group_by).setItems(
mTitles, new DialogInterface.OnClickListener() {
+ @Override
public void onClick(DialogInterface dialog, int which) {
// Need to lock rendering when operations invoked by system UI (main thread) are
// modifying slot data used in GL thread for rendering.
diff --git a/src/com/android/gallery3d/app/GalleryAppImpl.java b/src/com/android/gallery3d/app/GalleryAppImpl.java
index 852926bc7..f725ccf5a 100644
--- a/src/com/android/gallery3d/app/GalleryAppImpl.java
+++ b/src/com/android/gallery3d/app/GalleryAppImpl.java
@@ -49,10 +49,12 @@ public class GalleryAppImpl extends Application implements GalleryApp {
PicasaSource.initialize(this);
}
+ @Override
public Context getAndroidContext() {
return this;
}
+ @Override
public synchronized DataManager getDataManager() {
if (mDataManager == null) {
mDataManager = new DataManager(this);
@@ -61,6 +63,7 @@ public class GalleryAppImpl extends Application implements GalleryApp {
return mDataManager;
}
+ @Override
public ImageCacheService getImageCacheService() {
// This method may block on file I/O so a dedicated lock is needed here.
synchronized (mLock) {
@@ -71,6 +74,7 @@ public class GalleryAppImpl extends Application implements GalleryApp {
}
}
+ @Override
public synchronized ThreadPool getThreadPool() {
if (mThreadPool == null) {
mThreadPool = new ThreadPool();
@@ -78,6 +82,7 @@ public class GalleryAppImpl extends Application implements GalleryApp {
return mThreadPool;
}
+ @Override
public synchronized DownloadCache getDownloadCache() {
if (mDownloadCache == null) {
File cacheDir = new File(getExternalCacheDir(), DOWNLOAD_FOLDER);
diff --git a/src/com/android/gallery3d/app/ManageCachePage.java b/src/com/android/gallery3d/app/ManageCachePage.java
index cdbbfdc50..1f107285e 100644
--- a/src/com/android/gallery3d/app/ManageCachePage.java
+++ b/src/com/android/gallery3d/app/ManageCachePage.java
@@ -56,6 +56,7 @@ public class ManageCachePage extends ActivityState implements
EyePosition.EyePositionListener, OnClickListener {
public static final String KEY_MEDIA_PATH = "media-path";
+ @SuppressWarnings("unused")
private static final String TAG = "ManageCachePage";
private static final int DATA_CACHE_SIZE = 256;
diff --git a/src/com/android/gallery3d/app/MovieControllerOverlay.java b/src/com/android/gallery3d/app/MovieControllerOverlay.java
index f2c9e05dd..4781a1b8a 100644
--- a/src/com/android/gallery3d/app/MovieControllerOverlay.java
+++ b/src/com/android/gallery3d/app/MovieControllerOverlay.java
@@ -41,365 +41,387 @@ import com.android.gallery3d.R;
* The playback controller for the Movie Player.
*/
public class MovieControllerOverlay extends FrameLayout implements
- ControllerOverlay,
- OnClickListener,
- AnimationListener,
- TimeBar.Listener {
-
- private enum State {
- PLAYING,
- PAUSED,
- ENDED,
- ERROR,
- LOADING
- }
-
- private static final float ERROR_MESSAGE_RELATIVE_PADDING = 1.0f / 6;
-
- private Listener listener;
-
- private final View background;
- private final TimeBar timeBar;
-
- private View mainView;
- private final LinearLayout loadingView;
- private final TextView errorView;
- private final ImageView playPauseReplayView;
-
- private final Handler handler;
- private final Runnable startHidingRunnable;
- private final Animation hideAnimation;
-
- private State state;
-
- private boolean hidden;
-
- private boolean canReplay = true;
-
- public MovieControllerOverlay(Context context) {
- super(context);
-
- state = State.LOADING;
-
- LayoutParams wrapContent =
- new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
- LayoutParams matchParent =
- new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
-
- background = new View(context);
- background.setBackgroundColor(context.getResources().getColor(R.color.darker_transparent));
- addView(background, matchParent);
-
- timeBar = new TimeBar(context, this);
- addView(timeBar, wrapContent);
-
- loadingView = new LinearLayout(context);
- loadingView.setOrientation(LinearLayout.VERTICAL);
- loadingView.setGravity(Gravity.CENTER_HORIZONTAL);
- ProgressBar spinner = new ProgressBar(context);
- spinner.setIndeterminate(true);
- loadingView.addView(spinner, wrapContent);
- TextView loadingText = createOverlayTextView(context);
- loadingText.setText(R.string.loading_video);
- loadingView.addView(loadingText, wrapContent);
- addView(loadingView, wrapContent);
-
- playPauseReplayView = new ImageView(context);
- playPauseReplayView.setImageResource(R.drawable.ic_vidcontrol_play);
- playPauseReplayView.setBackgroundResource(R.drawable.bg_vidcontrol);
- playPauseReplayView.setScaleType(ScaleType.CENTER);
- playPauseReplayView.setFocusable(true);
- playPauseReplayView.setClickable(true);
- playPauseReplayView.setOnClickListener(this);
- addView(playPauseReplayView, wrapContent);
-
- errorView = createOverlayTextView(context);
- addView(errorView, matchParent);
-
- handler = new Handler();
- startHidingRunnable = new Runnable() {
- public void run() {
- startHiding();
- }
- };
-
- hideAnimation = AnimationUtils.loadAnimation(context, R.anim.player_out);
- hideAnimation.setAnimationListener(this);
-
- RelativeLayout.LayoutParams params =
- new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
- setLayoutParams(params);
- hide();
- }
-
- private TextView createOverlayTextView(Context context) {
- TextView view = new TextView(context);
- view.setGravity(Gravity.CENTER);
- view.setTextColor(0xFFFFFFFF);
- view.setPadding(0, 15, 0, 15);
- return view;
- }
-
- public void setListener(Listener listener) {
- this.listener = listener;
- }
-
- public void setCanReplay(boolean canReplay) {
- this.canReplay = canReplay;
- }
-
- public View getView() {
- return this;
- }
-
- public void showPlaying() {
- state = State.PLAYING;
- showMainView(playPauseReplayView);
- }
-
- public void showPaused() {
- state = State.PAUSED;
- showMainView(playPauseReplayView);
- }
-
- public void showEnded() {
- state = State.ENDED;
- showMainView(playPauseReplayView);
- }
-
- public void showLoading() {
- state = State.LOADING;
- showMainView(loadingView);
- }
-
- public void showErrorMessage(String message) {
- state = State.ERROR;
- int padding = (int) (getMeasuredWidth() * ERROR_MESSAGE_RELATIVE_PADDING);
- errorView.setPadding(padding, errorView.getPaddingTop(), padding, errorView.getPaddingBottom());
- errorView.setText(message);
- showMainView(errorView);
- }
-
- public void setTimes(int currentTime, int totalTime) {
- timeBar.setTime(currentTime, totalTime);
- }
-
- public void hide() {
- boolean wasHidden = hidden;
- hidden = true;
- playPauseReplayView.setVisibility(View.INVISIBLE);
- loadingView.setVisibility(View.INVISIBLE);
- background.setVisibility(View.INVISIBLE);
- timeBar.setVisibility(View.INVISIBLE);
- setVisibility(View.INVISIBLE);
- setFocusable(true);
- requestFocus();
- if (listener != null && wasHidden != hidden) {
- listener.onHidden();
- }
- }
-
- private void showMainView(View view) {
- mainView = view;
- errorView.setVisibility(mainView == errorView ? View.VISIBLE : View.INVISIBLE);
- loadingView.setVisibility(mainView == loadingView ? View.VISIBLE : View.INVISIBLE);
- playPauseReplayView.setVisibility(
- mainView == playPauseReplayView ? View.VISIBLE : View.INVISIBLE);
- show();
- }
-
- public void show() {
- boolean wasHidden = hidden;
- hidden = false;
- updateViews();
- setVisibility(View.VISIBLE);
- setFocusable(false);
- if (listener != null && wasHidden != hidden) {
- listener.onShown();
- }
- maybeStartHiding();
- }
-
- private void maybeStartHiding() {
- cancelHiding();
- if (state == State.PLAYING) {
- handler.postDelayed(startHidingRunnable, 2500);
- }
- }
-
- private void startHiding() {
- startHideAnimation(background);
- startHideAnimation(timeBar);
- startHideAnimation(playPauseReplayView);
- }
-
- private void startHideAnimation(View view) {
- if (view.getVisibility() == View.VISIBLE) {
- view.startAnimation(hideAnimation);
- }
- }
-
- private void cancelHiding() {
- handler.removeCallbacks(startHidingRunnable);
- background.setAnimation(null);
- timeBar.setAnimation(null);
- playPauseReplayView.setAnimation(null);
- }
-
- public void onAnimationStart(Animation animation) {
- // Do nothing.
- }
-
- public void onAnimationRepeat(Animation animation) {
- // Do nothing.
- }
-
- public void onAnimationEnd(Animation animation) {
- hide();
- }
-
- public void onClick(View view) {
- if (listener != null) {
- if (view == playPauseReplayView) {
- if (state == State.ENDED) {
- if (canReplay) {
- listener.onReplay();
- }
- } else if (state == State.PAUSED || state == State.PLAYING) {
- listener.onPlayPause();
- }
- }
+ ControllerOverlay,
+ OnClickListener,
+ AnimationListener,
+ TimeBar.Listener {
+
+ private enum State {
+ PLAYING,
+ PAUSED,
+ ENDED,
+ ERROR,
+ LOADING
+ }
+
+ private static final float ERROR_MESSAGE_RELATIVE_PADDING = 1.0f / 6;
+
+ private Listener listener;
+
+ private final View background;
+ private final TimeBar timeBar;
+
+ private View mainView;
+ private final LinearLayout loadingView;
+ private final TextView errorView;
+ private final ImageView playPauseReplayView;
+
+ private final Handler handler;
+ private final Runnable startHidingRunnable;
+ private final Animation hideAnimation;
+
+ private State state;
+
+ private boolean hidden;
+
+ private boolean canReplay = true;
+
+ public MovieControllerOverlay(Context context) {
+ super(context);
+
+ state = State.LOADING;
+
+ LayoutParams wrapContent =
+ new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+ LayoutParams matchParent =
+ new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+
+ background = new View(context);
+ background.setBackgroundColor(context.getResources().getColor(R.color.darker_transparent));
+ addView(background, matchParent);
+
+ timeBar = new TimeBar(context, this);
+ addView(timeBar, wrapContent);
+
+ loadingView = new LinearLayout(context);
+ loadingView.setOrientation(LinearLayout.VERTICAL);
+ loadingView.setGravity(Gravity.CENTER_HORIZONTAL);
+ ProgressBar spinner = new ProgressBar(context);
+ spinner.setIndeterminate(true);
+ loadingView.addView(spinner, wrapContent);
+ TextView loadingText = createOverlayTextView(context);
+ loadingText.setText(R.string.loading_video);
+ loadingView.addView(loadingText, wrapContent);
+ addView(loadingView, wrapContent);
+
+ playPauseReplayView = new ImageView(context);
+ playPauseReplayView.setImageResource(R.drawable.ic_vidcontrol_play);
+ playPauseReplayView.setBackgroundResource(R.drawable.bg_vidcontrol);
+ playPauseReplayView.setScaleType(ScaleType.CENTER);
+ playPauseReplayView.setFocusable(true);
+ playPauseReplayView.setClickable(true);
+ playPauseReplayView.setOnClickListener(this);
+ addView(playPauseReplayView, wrapContent);
+
+ errorView = createOverlayTextView(context);
+ addView(errorView, matchParent);
+
+ handler = new Handler();
+ startHidingRunnable = new Runnable() {
+ @Override
+ public void run() {
+ startHiding();
+ }
+ };
+
+ hideAnimation = AnimationUtils.loadAnimation(context, R.anim.player_out);
+ hideAnimation.setAnimationListener(this);
+
+ RelativeLayout.LayoutParams params =
+ new RelativeLayout.LayoutParams(
+ LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+ setLayoutParams(params);
+ hide();
}
- }
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- if (hidden) {
- show();
+ private TextView createOverlayTextView(Context context) {
+ TextView view = new TextView(context);
+ view.setGravity(Gravity.CENTER);
+ view.setTextColor(0xFFFFFFFF);
+ view.setPadding(0, 15, 0, 15);
+ return view;
}
- return super.onKeyDown(keyCode, event);
- }
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- if (super.onTouchEvent(event)) {
- return true;
+ @Override
+ public void setListener(Listener listener) {
+ this.listener = listener;
}
- if (hidden) {
- show();
- return true;
+ @Override
+ public void setCanReplay(boolean canReplay) {
+ this.canReplay = canReplay;
}
- switch (event.getAction()) {
- case MotionEvent.ACTION_DOWN:
- cancelHiding();
- if (state == State.PLAYING || state == State.PAUSED) {
- listener.onPlayPause();
+
+ @Override
+ public View getView() {
+ return this;
+ }
+
+ @Override
+ public void showPlaying() {
+ state = State.PLAYING;
+ showMainView(playPauseReplayView);
+ }
+
+ @Override
+ public void showPaused() {
+ state = State.PAUSED;
+ showMainView(playPauseReplayView);
+ }
+
+ @Override
+ public void showEnded() {
+ state = State.ENDED;
+ showMainView(playPauseReplayView);
+ }
+
+ @Override
+ public void showLoading() {
+ state = State.LOADING;
+ showMainView(loadingView);
+ }
+
+ @Override
+ public void showErrorMessage(String message) {
+ state = State.ERROR;
+ int padding = (int) (getMeasuredWidth() * ERROR_MESSAGE_RELATIVE_PADDING);
+ errorView.setPadding(
+ padding, errorView.getPaddingTop(), padding, errorView.getPaddingBottom());
+ errorView.setText(message);
+ showMainView(errorView);
+ }
+
+ @Override
+ public void setTimes(int currentTime, int totalTime) {
+ timeBar.setTime(currentTime, totalTime);
+ }
+
+ public void hide() {
+ boolean wasHidden = hidden;
+ hidden = true;
+ playPauseReplayView.setVisibility(View.INVISIBLE);
+ loadingView.setVisibility(View.INVISIBLE);
+ background.setVisibility(View.INVISIBLE);
+ timeBar.setVisibility(View.INVISIBLE);
+ setVisibility(View.INVISIBLE);
+ setFocusable(true);
+ requestFocus();
+ if (listener != null && wasHidden != hidden) {
+ listener.onHidden();
+ }
+ }
+
+ private void showMainView(View view) {
+ mainView = view;
+ errorView.setVisibility(mainView == errorView ? View.VISIBLE : View.INVISIBLE);
+ loadingView.setVisibility(mainView == loadingView ? View.VISIBLE : View.INVISIBLE);
+ playPauseReplayView.setVisibility(
+ mainView == playPauseReplayView ? View.VISIBLE : View.INVISIBLE);
+ show();
+ }
+
+ @Override
+ public void show() {
+ boolean wasHidden = hidden;
+ hidden = false;
+ updateViews();
+ setVisibility(View.VISIBLE);
+ setFocusable(false);
+ if (listener != null && wasHidden != hidden) {
+ listener.onShown();
}
- break;
- case MotionEvent.ACTION_UP:
maybeStartHiding();
- break;
- }
- return true;
- }
-
- // The paddings of 4 sides which covered by system components. E.g.
- // +-----------------+\
- // | Action Bar | insets.top
- // +-----------------+/
- // | |
- // | Content Area | insets.right = insets.left = 0
- // | |
- // +-----------------+\
- // | Navigation Bar | insets.bottom
- // +-----------------+/
- // Please see View.fitSystemWindows() for more details.
- private final Rect mWindowInsets = new Rect();
-
- @Override
- protected boolean fitSystemWindows(Rect insets) {
- // We don't set the paddings of this View, otherwise,
- // the content will get cropped outside window
- mWindowInsets.set(insets);
- return true;
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- Rect insets = mWindowInsets;
- int pl = insets.left; // the left paddings
- int pr = insets.right;
- int pt = insets.top;
- int pb = insets.bottom;
-
- int h = bottom - top;
- int w = right - left;
- boolean error = errorView.getVisibility() == View.VISIBLE;
-
- int y = h - pb;
- // Put both TimeBar and Background just above the bottom system component.
- // But extend the background to the width of the screen, since we don't
- // care if it will be covered by a system component and it looks better.
- background.layout(0, y - timeBar.getBarHeight(), w, y);
- timeBar.layout(pl, y - timeBar.getPreferredHeight(), w - pr, y);
-
- // Needed, otherwise the framework will not re-layout in case only the padding is changed
- timeBar.requestLayout();
-
- // Put the play/pause/next/ previous button in the center of the screen
- layoutCenteredView(playPauseReplayView, 0, 0, w, h);
-
- if (mainView != null) {
- layoutCenteredView(mainView, 0, 0, w, h);
- }
- }
-
- private void layoutCenteredView(View view, int l, int t, int r, int b) {
- int cw = view.getMeasuredWidth();
- int ch = view.getMeasuredHeight();
- int cl = (r - l - cw) / 2;
- int ct = (b - t - ch) / 2;
- view.layout(cl, ct, cl + cw, ct + ch);
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- measureChildren(widthMeasureSpec, heightMeasureSpec);
- }
-
- private void updateViews() {
- if (hidden) {
- return;
- }
- background.setVisibility(View.VISIBLE);
- timeBar.setVisibility(View.VISIBLE);
- playPauseReplayView.setImageResource(
- state == State.PAUSED ? R.drawable.ic_vidcontrol_play :
- state == State.PLAYING ? R.drawable.ic_vidcontrol_pause :
- R.drawable.ic_vidcontrol_reload);
- playPauseReplayView.setVisibility(
- (state != State.LOADING && state != State.ERROR &&
+ }
+
+ private void maybeStartHiding() {
+ cancelHiding();
+ if (state == State.PLAYING) {
+ handler.postDelayed(startHidingRunnable, 2500);
+ }
+ }
+
+ private void startHiding() {
+ startHideAnimation(background);
+ startHideAnimation(timeBar);
+ startHideAnimation(playPauseReplayView);
+ }
+
+ private void startHideAnimation(View view) {
+ if (view.getVisibility() == View.VISIBLE) {
+ view.startAnimation(hideAnimation);
+ }
+ }
+
+ private void cancelHiding() {
+ handler.removeCallbacks(startHidingRunnable);
+ background.setAnimation(null);
+ timeBar.setAnimation(null);
+ playPauseReplayView.setAnimation(null);
+ }
+
+ @Override
+ public void onAnimationStart(Animation animation) {
+ // Do nothing.
+ }
+
+ @Override
+ public void onAnimationRepeat(Animation animation) {
+ // Do nothing.
+ }
+
+ @Override
+ public void onAnimationEnd(Animation animation) {
+ hide();
+ }
+
+ @Override
+ public void onClick(View view) {
+ if (listener != null) {
+ if (view == playPauseReplayView) {
+ if (state == State.ENDED) {
+ if (canReplay) {
+ listener.onReplay();
+ }
+ } else if (state == State.PAUSED || state == State.PLAYING) {
+ listener.onPlayPause();
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ if (hidden) {
+ show();
+ }
+ return super.onKeyDown(keyCode, event);
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (super.onTouchEvent(event)) {
+ return true;
+ }
+
+ if (hidden) {
+ show();
+ return true;
+ }
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ cancelHiding();
+ if (state == State.PLAYING || state == State.PAUSED) {
+ listener.onPlayPause();
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ maybeStartHiding();
+ break;
+ }
+ return true;
+ }
+
+ // The paddings of 4 sides which covered by system components. E.g.
+ // +-----------------+\
+ // | Action Bar | insets.top
+ // +-----------------+/
+ // | |
+ // | Content Area | insets.right = insets.left = 0
+ // | |
+ // +-----------------+\
+ // | Navigation Bar | insets.bottom
+ // +-----------------+/
+ // Please see View.fitSystemWindows() for more details.
+ private final Rect mWindowInsets = new Rect();
+
+ @Override
+ protected boolean fitSystemWindows(Rect insets) {
+ // We don't set the paddings of this View, otherwise,
+ // the content will get cropped outside window
+ mWindowInsets.set(insets);
+ return true;
+ }
+
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ Rect insets = mWindowInsets;
+ int pl = insets.left; // the left paddings
+ int pr = insets.right;
+ int pt = insets.top;
+ int pb = insets.bottom;
+
+ int h = bottom - top;
+ int w = right - left;
+ boolean error = errorView.getVisibility() == View.VISIBLE;
+
+ int y = h - pb;
+ // Put both TimeBar and Background just above the bottom system
+ // component.
+ // But extend the background to the width of the screen, since we don't
+ // care if it will be covered by a system component and it looks better.
+ background.layout(0, y - timeBar.getBarHeight(), w, y);
+ timeBar.layout(pl, y - timeBar.getPreferredHeight(), w - pr, y);
+
+ // Needed, otherwise the framework will not re-layout in case only the
+ // padding is changed
+ timeBar.requestLayout();
+
+ // Put the play/pause/next/ previous button in the center of the screen
+ layoutCenteredView(playPauseReplayView, 0, 0, w, h);
+
+ if (mainView != null) {
+ layoutCenteredView(mainView, 0, 0, w, h);
+ }
+ }
+
+ private void layoutCenteredView(View view, int l, int t, int r, int b) {
+ int cw = view.getMeasuredWidth();
+ int ch = view.getMeasuredHeight();
+ int cl = (r - l - cw) / 2;
+ int ct = (b - t - ch) / 2;
+ view.layout(cl, ct, cl + cw, ct + ch);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ measureChildren(widthMeasureSpec, heightMeasureSpec);
+ }
+
+ private void updateViews() {
+ if (hidden) {
+ return;
+ }
+ background.setVisibility(View.VISIBLE);
+ timeBar.setVisibility(View.VISIBLE);
+ playPauseReplayView.setImageResource(
+ state == State.PAUSED ? R.drawable.ic_vidcontrol_play :
+ state == State.PLAYING ? R.drawable.ic_vidcontrol_pause :
+ R.drawable.ic_vidcontrol_reload);
+ playPauseReplayView.setVisibility(
+ (state != State.LOADING && state != State.ERROR &&
!(state == State.ENDED && !canReplay))
- ? View.VISIBLE : View.GONE);
- requestLayout();
- }
-
- // TimeBar listener
-
- public void onScrubbingStart() {
- cancelHiding();
- listener.onSeekStart();
- }
-
- public void onScrubbingMove(int time) {
- cancelHiding();
- listener.onSeekMove(time);
- }
-
- public void onScrubbingEnd(int time) {
- maybeStartHiding();
- listener.onSeekEnd(time);
- }
+ ? View.VISIBLE : View.GONE);
+ requestLayout();
+ }
+
+ // TimeBar listener
+
+ @Override
+ public void onScrubbingStart() {
+ cancelHiding();
+ listener.onSeekStart();
+ }
+
+ @Override
+ public void onScrubbingMove(int time) {
+ cancelHiding();
+ listener.onSeekMove(time);
+ }
+
+ @Override
+ public void onScrubbingEnd(int time) {
+ maybeStartHiding();
+ listener.onSeekEnd(time);
+ }
}
diff --git a/src/com/android/gallery3d/app/OrientationManager.java b/src/com/android/gallery3d/app/OrientationManager.java
index c3e91fb81..f5cbf06c6 100644
--- a/src/com/android/gallery3d/app/OrientationManager.java
+++ b/src/com/android/gallery3d/app/OrientationManager.java
@@ -24,7 +24,6 @@ import android.content.res.Configuration;
import android.provider.Settings;
import android.view.OrientationEventListener;
import android.view.Surface;
-import android.view.ViewConfiguration;
import com.android.gallery3d.ui.OrientationSource;
diff --git a/src/com/android/gallery3d/app/PhotoDataAdapter.java b/src/com/android/gallery3d/app/PhotoDataAdapter.java
index 555ea897c..5339e7e0a 100644
--- a/src/com/android/gallery3d/app/PhotoDataAdapter.java
+++ b/src/com/android/gallery3d/app/PhotoDataAdapter.java
@@ -341,6 +341,7 @@ public class PhotoDataAdapter implements PhotoPage.Model {
updateImageRequests();
}
+ @Override
public void resume() {
mIsActive = true;
mSource.addContentListener(mSourceListener);
@@ -353,6 +354,7 @@ public class PhotoDataAdapter implements PhotoPage.Model {
fireDataChange();
}
+ @Override
public void pause() {
mIsActive = false;
@@ -485,35 +487,43 @@ public class PhotoDataAdapter implements PhotoPage.Model {
return LOADING_INIT;
}
+ @Override
public ScreenNail getScreenNail() {
return getScreenNail(0);
}
+ @Override
public int getImageHeight() {
return mTileProvider.getImageHeight();
}
+ @Override
public int getImageWidth() {
return mTileProvider.getImageWidth();
}
+ @Override
public int getLevelCount() {
return mTileProvider.getLevelCount();
}
+ @Override
public Bitmap getTile(int level, int x, int y, int tileSize,
int borderSize, BitmapPool pool) {
return mTileProvider.getTile(level, x, y, tileSize, borderSize, pool);
}
+ @Override
public boolean isEmpty() {
return mSize == 0;
}
+ @Override
public int getCurrentIndex() {
return mCurrentIndex;
}
+ @Override
public MediaItem getMediaItem(int offset) {
int index = mCurrentIndex + offset;
if (index >= mContentStart && index < mContentEnd) {
@@ -522,6 +532,7 @@ public class PhotoDataAdapter implements PhotoPage.Model {
return null;
}
+ @Override
public void setCurrentPhoto(Path path, int indexHint) {
if (mItemPath == path) return;
mItemPath = path;
@@ -537,10 +548,12 @@ public class PhotoDataAdapter implements PhotoPage.Model {
}
}
+ @Override
public void setFocusHintDirection(int direction) {
mFocusHintDirection = direction;
}
+ @Override
public void setFocusHintPath(Path path) {
mFocusHintPath = path;
}
@@ -848,6 +861,7 @@ public class PhotoDataAdapter implements PhotoPage.Model {
}
private class SourceListener implements ContentListener {
+ @Override
public void onContentDirty() {
if (mReloadTask != null) mReloadTask.notifyDirty();
}
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 950f8c552..678ba6daf 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -26,15 +26,12 @@ import android.content.Intent;
import android.graphics.Rect;
import android.net.Uri;
import android.nfc.NfcAdapter;
-import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
-import android.view.View;
-import android.view.WindowManager;
import android.widget.ShareActionProvider;
import android.widget.Toast;
diff --git a/src/com/android/gallery3d/app/PickerActivity.java b/src/com/android/gallery3d/app/PickerActivity.java
index f5b2cbdfc..d5bb218ea 100644
--- a/src/com/android/gallery3d/app/PickerActivity.java
+++ b/src/com/android/gallery3d/app/PickerActivity.java
@@ -25,7 +25,6 @@ import android.view.View.OnClickListener;
import android.view.Window;
import com.android.gallery3d.R;
-import com.android.gallery3d.ui.GLRoot;
import com.android.gallery3d.ui.GLRootView;
public class PickerActivity extends AbstractGalleryActivity
diff --git a/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java b/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java
index f5b22d15c..6885456a6 100644
--- a/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java
+++ b/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java
@@ -84,6 +84,7 @@ public class SinglePhotoDataAdapter extends TileImageViewAdapter
private FutureListener<BitmapRegionDecoder> mLargeListener =
new FutureListener<BitmapRegionDecoder>() {
+ @Override
public void onFutureDone(Future<BitmapRegionDecoder> future) {
BitmapRegionDecoder decoder = future.get();
if (decoder == null) return;
@@ -100,12 +101,14 @@ public class SinglePhotoDataAdapter extends TileImageViewAdapter
private FutureListener<Bitmap> mThumbListener =
new FutureListener<Bitmap>() {
+ @Override
public void onFutureDone(Future<Bitmap> future) {
mHandler.sendMessage(
mHandler.obtainMessage(MSG_UPDATE_IMAGE, future));
}
};
+ @Override
public boolean isEmpty() {
return false;
}
@@ -137,6 +140,7 @@ public class SinglePhotoDataAdapter extends TileImageViewAdapter
}
}
+ @Override
public void resume() {
if (mTask == null) {
if (mHasFullImage) {
@@ -150,6 +154,7 @@ public class SinglePhotoDataAdapter extends TileImageViewAdapter
}
}
+ @Override
public void pause() {
Future<?> task = mTask;
task.cancel();
diff --git a/src/com/android/gallery3d/app/SlideshowDataAdapter.java b/src/com/android/gallery3d/app/SlideshowDataAdapter.java
index 7c934ee3b..7a0fba5fb 100644
--- a/src/com/android/gallery3d/app/SlideshowDataAdapter.java
+++ b/src/com/android/gallery3d/app/SlideshowDataAdapter.java
@@ -92,6 +92,7 @@ public class SlideshowDataAdapter implements SlideshowPage.Model {
}
private class ReloadTask implements Job<Void> {
+ @Override
public Void run(JobContext jc) {
while (true) {
synchronized (SlideshowDataAdapter.this) {
@@ -145,6 +146,7 @@ public class SlideshowDataAdapter implements SlideshowPage.Model {
}
private class SourceListener implements ContentListener {
+ @Override
public void onContentDirty() {
synchronized (SlideshowDataAdapter.this) {
mNeedReload.set(true);
@@ -168,8 +170,10 @@ public class SlideshowDataAdapter implements SlideshowPage.Model {
return mImageQueue.removeFirst();
}
+ @Override
public Future<Slide> nextSlide(FutureListener<Slide> listener) {
return mThreadPool.submit(new Job<Slide>() {
+ @Override
public Slide run(JobContext jc) {
jc.setMode(ThreadPool.MODE_NONE);
return innerNextBitmap();
@@ -177,6 +181,7 @@ public class SlideshowDataAdapter implements SlideshowPage.Model {
}, listener);
}
+ @Override
public void pause() {
synchronized (this) {
mIsActive = false;
@@ -188,6 +193,7 @@ public class SlideshowDataAdapter implements SlideshowPage.Model {
mReloadTask = null;
}
+ @Override
public synchronized void resume() {
mIsActive = true;
mSource.addContentListener(mSourceListener);
diff --git a/src/com/android/gallery3d/app/SlideshowPage.java b/src/com/android/gallery3d/app/SlideshowPage.java
index a6ae52725..5ec447f65 100644
--- a/src/com/android/gallery3d/app/SlideshowPage.java
+++ b/src/com/android/gallery3d/app/SlideshowPage.java
@@ -134,6 +134,7 @@ public class SlideshowPage extends ActivityState {
private void loadNextBitmap() {
mModel.nextSlide(new FutureListener<Slide>() {
+ @Override
public void onFutureDone(Future<Slide> future) {
mPendingSlide = future.get();
mHandler.sendEmptyMessage(MSG_SHOW_PENDING_BITMAP);
@@ -242,10 +243,12 @@ public class SlideshowPage extends ActivityState {
mRepeat = repeat;
}
+ @Override
public int findItemIndex(Path path, int hint) {
return hint;
}
+ @Override
public MediaItem getMediaItem(int index) {
if (!mRepeat && index >= mOrder.length) return null;
if (mOrder.length == 0) return null;
@@ -259,6 +262,7 @@ public class SlideshowPage extends ActivityState {
return item;
}
+ @Override
public long reload() {
long version = mMediaSet.reload();
if (version != mSourceVersion) {
@@ -284,10 +288,12 @@ public class SlideshowPage extends ActivityState {
}
}
+ @Override
public void addContentListener(ContentListener listener) {
mMediaSet.addContentListener(listener);
}
+ @Override
public void removeContentListener(ContentListener listener) {
mMediaSet.removeContentListener(listener);
}
@@ -307,10 +313,12 @@ public class SlideshowPage extends ActivityState {
mRepeat = repeat;
}
+ @Override
public int findItemIndex(Path path, int hint) {
return mMediaSet.getIndexOfItem(path, hint);
}
+ @Override
public MediaItem getMediaItem(int index) {
int dataEnd = mDataStart + mData.size();
@@ -328,6 +336,7 @@ public class SlideshowPage extends ActivityState {
return (index < mDataStart || index >= dataEnd) ? null : mData.get(index - mDataStart);
}
+ @Override
public long reload() {
long version = mMediaSet.reload();
if (version != mDataVersion) {
@@ -337,10 +346,12 @@ public class SlideshowPage extends ActivityState {
return mDataVersion;
}
+ @Override
public void addContentListener(ContentListener listener) {
mMediaSet.addContentListener(listener);
}
+ @Override
public void removeContentListener(ContentListener listener) {
mMediaSet.removeContentListener(listener);
}
diff --git a/src/com/android/gallery3d/data/BitmapPool.java b/src/com/android/gallery3d/data/BitmapPool.java
index 1151dded7..5bc6d672b 100644
--- a/src/com/android/gallery3d/data/BitmapPool.java
+++ b/src/com/android/gallery3d/data/BitmapPool.java
@@ -23,6 +23,7 @@ import com.android.gallery3d.common.Utils;
import java.util.ArrayList;
public class BitmapPool {
+ @SuppressWarnings("unused")
private static final String TAG = "BitmapPool";
private final ArrayList<Bitmap> mPool;
diff --git a/src/com/android/gallery3d/data/ClusterAlbum.java b/src/com/android/gallery3d/data/ClusterAlbum.java
index 569e5a4b3..8681952bf 100644
--- a/src/com/android/gallery3d/data/ClusterAlbum.java
+++ b/src/com/android/gallery3d/data/ClusterAlbum.java
@@ -19,6 +19,7 @@ package com.android.gallery3d.data;
import java.util.ArrayList;
public class ClusterAlbum extends MediaSet implements ContentListener {
+ @SuppressWarnings("unused")
private static final String TAG = "ClusterAlbum";
private ArrayList<Path> mPaths = new ArrayList<Path>();
private String mName = "";
@@ -80,6 +81,7 @@ public class ClusterAlbum extends MediaSet implements ContentListener {
ArrayList<Path> subset = new ArrayList<Path>(paths.subList(start, end));
final MediaItem[] buf = new MediaItem[end - start];
ItemConsumer consumer = new ItemConsumer() {
+ @Override
public void consume(int index, MediaItem item) {
buf[index] = item;
}
@@ -111,6 +113,7 @@ public class ClusterAlbum extends MediaSet implements ContentListener {
return mDataVersion;
}
+ @Override
public void onContentDirty() {
notifyContentChanged();
}
@@ -123,6 +126,7 @@ public class ClusterAlbum extends MediaSet implements ContentListener {
@Override
public void delete() {
ItemConsumer consumer = new ItemConsumer() {
+ @Override
public void consume(int index, MediaItem item) {
if ((item.getSupportedOperations() & SUPPORT_DELETE) != 0) {
item.delete();
diff --git a/src/com/android/gallery3d/data/ClusterAlbumSet.java b/src/com/android/gallery3d/data/ClusterAlbumSet.java
index 863e94ad5..a32ba87f4 100644
--- a/src/com/android/gallery3d/data/ClusterAlbumSet.java
+++ b/src/com/android/gallery3d/data/ClusterAlbumSet.java
@@ -25,6 +25,7 @@ import java.util.ArrayList;
import java.util.HashSet;
public class ClusterAlbumSet extends MediaSet implements ContentListener {
+ @SuppressWarnings("unused")
private static final String TAG = "ClusterAlbumSet";
private GalleryApp mApplication;
private MediaSet mBaseSet;
@@ -70,6 +71,7 @@ public class ClusterAlbumSet extends MediaSet implements ContentListener {
return mDataVersion;
}
+ @Override
public void onContentDirty() {
notifyContentChanged();
}
@@ -125,6 +127,7 @@ public class ClusterAlbumSet extends MediaSet implements ContentListener {
private void updateClustersContents() {
final HashSet<Path> existing = new HashSet<Path>();
mBaseSet.enumerateTotalMediaItems(new MediaSet.ItemConsumer() {
+ @Override
public void consume(int index, MediaItem item) {
existing.add(item.getPath());
}
diff --git a/src/com/android/gallery3d/data/ComboAlbum.java b/src/com/android/gallery3d/data/ComboAlbum.java
index 73c8ef36c..e100dc3e6 100644
--- a/src/com/android/gallery3d/data/ComboAlbum.java
+++ b/src/com/android/gallery3d/data/ComboAlbum.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
// from the input albums.
// This only handles SubMediaSets, not MediaItems. (That's all we need now)
public class ComboAlbum extends MediaSet implements ContentListener {
+ @SuppressWarnings("unused")
private static final String TAG = "ComboAlbum";
private final MediaSet[] mSets;
private final String mName;
@@ -86,6 +87,7 @@ public class ComboAlbum extends MediaSet implements ContentListener {
return mDataVersion;
}
+ @Override
public void onContentDirty() {
notifyContentChanged();
}
diff --git a/src/com/android/gallery3d/data/ComboAlbumSet.java b/src/com/android/gallery3d/data/ComboAlbumSet.java
index 6d9a2a3d4..3f3674500 100644
--- a/src/com/android/gallery3d/data/ComboAlbumSet.java
+++ b/src/com/android/gallery3d/data/ComboAlbumSet.java
@@ -24,6 +24,7 @@ import com.android.gallery3d.util.Future;
// media sets from the input album sets.
// This only handles SubMediaSets, not MediaItems. (That's all we need now)
public class ComboAlbumSet extends MediaSet implements ContentListener {
+ @SuppressWarnings("unused")
private static final String TAG = "ComboAlbumSet";
private final MediaSet[] mSets;
private final String mName;
@@ -83,6 +84,7 @@ public class ComboAlbumSet extends MediaSet implements ContentListener {
return mDataVersion;
}
+ @Override
public void onContentDirty() {
notifyContentChanged();
}
diff --git a/src/com/android/gallery3d/data/DataManager.java b/src/com/android/gallery3d/data/DataManager.java
index 9ffdc0b50..9485b0274 100644
--- a/src/com/android/gallery3d/data/DataManager.java
+++ b/src/com/android/gallery3d/data/DataManager.java
@@ -88,6 +88,7 @@ public class DataManager {
new DateTakenComparator();
private static class DateTakenComparator implements Comparator<MediaItem> {
+ @Override
public int compare(MediaItem item1, MediaItem item2) {
return -Utils.compare(item1.getDateInMs(), item2.getDateInMs());
}
diff --git a/src/com/android/gallery3d/data/DownloadCache.java b/src/com/android/gallery3d/data/DownloadCache.java
index 7505dac34..be7820b01 100644
--- a/src/com/android/gallery3d/data/DownloadCache.java
+++ b/src/com/android/gallery3d/data/DownloadCache.java
@@ -282,6 +282,7 @@ public class DownloadCache {
mProxySet.add(proxy);
}
+ @Override
public void onFutureDone(Future<File> future) {
File file = future.get();
long id = 0;
@@ -310,6 +311,7 @@ public class DownloadCache {
}
}
+ @Override
public File run(JobContext jc) {
// TODO: utilize etag
jc.setMode(ThreadPool.MODE_NETWORK);
@@ -345,6 +347,7 @@ public class DownloadCache {
public synchronized Entry get(JobContext jc) {
jc.setCancelListener(new CancelListener() {
+ @Override
public void onCancel() {
mTask.removeProxy(TaskProxy.this);
synchronized (TaskProxy.this) {
diff --git a/src/com/android/gallery3d/data/DownloadUtils.java b/src/com/android/gallery3d/data/DownloadUtils.java
index 9e35c4593..137898e91 100644
--- a/src/com/android/gallery3d/data/DownloadUtils.java
+++ b/src/com/android/gallery3d/data/DownloadUtils.java
@@ -49,6 +49,7 @@ public class DownloadUtils {
int rc = is.read(buffer, 0, buffer.length);
final Thread thread = Thread.currentThread();
jc.setCancelListener(new CancelListener() {
+ @Override
public void onCancel() {
thread.interrupt();
}
diff --git a/src/com/android/gallery3d/data/Face.java b/src/com/android/gallery3d/data/Face.java
index 29af27f15..d2dc22bfc 100644
--- a/src/com/android/gallery3d/data/Face.java
+++ b/src/com/android/gallery3d/data/Face.java
@@ -58,6 +58,7 @@ public class Face implements Comparable<Face> {
return false;
}
+ @Override
public int compareTo(Face another) {
return mName.compareTo(another.mName);
}
diff --git a/src/com/android/gallery3d/data/FaceClustering.java b/src/com/android/gallery3d/data/FaceClustering.java
index 126286c34..819915edb 100644
--- a/src/com/android/gallery3d/data/FaceClustering.java
+++ b/src/com/android/gallery3d/data/FaceClustering.java
@@ -94,6 +94,7 @@ public class FaceClustering extends Clustering {
final FaceCluster untagged = new FaceCluster(mUntaggedString);
baseSet.enumerateTotalMediaItems(new MediaSet.ItemConsumer() {
+ @Override
public void consume(int index, MediaItem item) {
Face[] faces = item.getFaces();
if (faces == null || faces.length == 0) {
diff --git a/src/com/android/gallery3d/data/FilterDeleteSet.java b/src/com/android/gallery3d/data/FilterDeleteSet.java
index dbd85d57d..2738387a6 100644
--- a/src/com/android/gallery3d/data/FilterDeleteSet.java
+++ b/src/com/android/gallery3d/data/FilterDeleteSet.java
@@ -28,6 +28,7 @@ import java.util.ArrayList;
// int getNumberOfDeletions();
//
public class FilterDeleteSet extends MediaSet implements ContentListener {
+ @SuppressWarnings("unused")
private static final String TAG = "FilterDeleteSet";
private static final int REQUEST_ADD = 1;
diff --git a/src/com/android/gallery3d/data/FilterSource.java b/src/com/android/gallery3d/data/FilterSource.java
index b3e6ee356..e3f350f76 100644
--- a/src/com/android/gallery3d/data/FilterSource.java
+++ b/src/com/android/gallery3d/data/FilterSource.java
@@ -19,6 +19,7 @@ package com.android.gallery3d.data;
import com.android.gallery3d.app.GalleryApp;
class FilterSource extends MediaSource {
+ @SuppressWarnings("unused")
private static final String TAG = "FilterSource";
private static final int FILTER_BY_MEDIATYPE = 0;
private static final int FILTER_BY_DELETE = 1;
diff --git a/src/com/android/gallery3d/data/FilterTypeSet.java b/src/com/android/gallery3d/data/FilterTypeSet.java
index 1983a39f1..477ef73ad 100644
--- a/src/com/android/gallery3d/data/FilterTypeSet.java
+++ b/src/com/android/gallery3d/data/FilterTypeSet.java
@@ -100,6 +100,7 @@ public class FilterTypeSet extends MediaSet implements ContentListener {
final Path[] buf = new Path[total];
mBaseSet.enumerateMediaItems(new MediaSet.ItemConsumer() {
+ @Override
public void consume(int index, MediaItem item) {
if (item.getMediaType() == mMediaType) {
if (index < 0 || index >= total) return;
@@ -124,6 +125,7 @@ public class FilterTypeSet extends MediaSet implements ContentListener {
@Override
public void delete() {
ItemConsumer consumer = new ItemConsumer() {
+ @Override
public void consume(int index, MediaItem item) {
if ((item.getSupportedOperations() & SUPPORT_DELETE) != 0) {
item.delete();
diff --git a/src/com/android/gallery3d/data/LocalImage.java b/src/com/android/gallery3d/data/LocalImage.java
index c432ab44d..370ef2686 100644
--- a/src/com/android/gallery3d/data/LocalImage.java
+++ b/src/com/android/gallery3d/data/LocalImage.java
@@ -218,6 +218,7 @@ public class LocalImage extends LocalMediaItem {
mLocalFilePath = localFilePath;
}
+ @Override
public BitmapRegionDecoder run(JobContext jc) {
return DecodeUtils.createBitmapRegionDecoder(jc, mLocalFilePath, false);
}
diff --git a/src/com/android/gallery3d/data/LocalMediaItem.java b/src/com/android/gallery3d/data/LocalMediaItem.java
index 7a54e8062..fdc973e8d 100644
--- a/src/com/android/gallery3d/data/LocalMediaItem.java
+++ b/src/com/android/gallery3d/data/LocalMediaItem.java
@@ -99,6 +99,7 @@ public abstract class LocalMediaItem extends MediaItem {
return mimeType;
}
+ @Override
public long getSize() {
return fileSize;
}
diff --git a/src/com/android/gallery3d/data/LocalSource.java b/src/com/android/gallery3d/data/LocalSource.java
index 6735b16e4..a2e3d1443 100644
--- a/src/com/android/gallery3d/data/LocalSource.java
+++ b/src/com/android/gallery3d/data/LocalSource.java
@@ -245,6 +245,7 @@ class LocalSource extends MediaSource {
// This is a comparator which compares the suffix number in two Paths.
private static class IdComparator implements Comparator<PathId> {
+ @Override
public int compare(PathId p1, PathId p2) {
String s1 = p1.path.getSuffix();
String s2 = p2.path.getSuffix();
diff --git a/src/com/android/gallery3d/data/LocationClustering.java b/src/com/android/gallery3d/data/LocationClustering.java
index b36bd63da..540322a33 100644
--- a/src/com/android/gallery3d/data/LocationClustering.java
+++ b/src/com/android/gallery3d/data/LocationClustering.java
@@ -29,6 +29,7 @@ import com.android.gallery3d.util.ReverseGeocoder;
import java.util.ArrayList;
class LocationClustering extends Clustering {
+ @SuppressWarnings("unused")
private static final String TAG = "LocationClustering";
private static final int MIN_GROUPS = 1;
@@ -70,6 +71,7 @@ class LocationClustering extends Clustering {
// Separate items to two sets: with or without lat-long.
final double[] latLong = new double[2];
baseSet.enumerateTotalMediaItems(new MediaSet.ItemConsumer() {
+ @Override
public void consume(int index, MediaItem item) {
if (index < 0 || index >= total) return;
SmallItem s = new SmallItem();
@@ -137,6 +139,7 @@ class LocationClustering extends Clustering {
if (hasUnresolvedAddress) {
mHandler.post(new Runnable() {
+ @Override
public void run() {
Toast.makeText(mContext, R.string.no_connectivity,
Toast.LENGTH_LONG).show();
diff --git a/src/com/android/gallery3d/data/MediaDetails.java b/src/com/android/gallery3d/data/MediaDetails.java
index c18365df0..298224729 100644
--- a/src/com/android/gallery3d/data/MediaDetails.java
+++ b/src/com/android/gallery3d/data/MediaDetails.java
@@ -88,6 +88,7 @@ public class MediaDetails implements Iterable<Entry<Integer, Object>> {
return mDetails.size();
}
+ @Override
public Iterator<Entry<Integer, Object>> iterator() {
return mDetails.entrySet().iterator();
}
diff --git a/src/com/android/gallery3d/data/MediaSet.java b/src/com/android/gallery3d/data/MediaSet.java
index 67525b1f3..d5d1048e0 100644
--- a/src/com/android/gallery3d/data/MediaSet.java
+++ b/src/com/android/gallery3d/data/MediaSet.java
@@ -32,6 +32,7 @@ import java.util.WeakHashMap;
// getTotalMediaItemCount() returns the number of all MediaItems, including
// those in sub-MediaSets.
public abstract class MediaSet extends MediaObject {
+ @SuppressWarnings("unused")
private static final String TAG = "MediaSet";
public static final int MEDIAITEM_BATCH_FETCH_COUNT = 500;
@@ -270,6 +271,7 @@ public abstract class MediaSet extends MediaObject {
}
private class MultiSetSyncFuture implements Future<Integer>, SyncListener {
+ @SuppressWarnings("hiding")
private static final String TAG = "Gallery.MultiSetSync";
private final SyncListener mListener;
diff --git a/src/com/android/gallery3d/data/MtpClient.java b/src/com/android/gallery3d/data/MtpClient.java
index dd65f9ef1..737b5b60d 100644
--- a/src/com/android/gallery3d/data/MtpClient.java
+++ b/src/com/android/gallery3d/data/MtpClient.java
@@ -179,7 +179,7 @@ public class MtpClient {
* Opens the {@link android.hardware.usb.UsbDevice} for an MTP or PTP
* device and return an {@link android.mtp.MtpDevice} for it.
*
- * @param device the device to open
+ * @param usbDevice the device to open
* @return an MtpDevice for the device.
*/
private MtpDevice openDeviceLocked(UsbDevice usbDevice) {
@@ -220,7 +220,7 @@ public class MtpClient {
}
/**
- * Registers a {@link android.mtp.MtpClient.Listener} interface to receive
+ * Registers a {@link com.android.gallery3d.data.MtpClient.Listener} interface to receive
* notifications when MTP or PTP devices are added or removed.
*
* @param listener the listener to register
@@ -234,7 +234,7 @@ public class MtpClient {
}
/**
- * Unregisters a {@link android.mtp.MtpClient.Listener} interface.
+ * Unregisters a {@link com.android.gallery3d.data.MtpClient.Listener} interface.
*
* @param listener the listener to unregister
*/
diff --git a/src/com/android/gallery3d/data/MtpContext.java b/src/com/android/gallery3d/data/MtpContext.java
index 056211c9e..53b6faafb 100644
--- a/src/com/android/gallery3d/data/MtpContext.java
+++ b/src/com/android/gallery3d/data/MtpContext.java
@@ -81,11 +81,13 @@ public class MtpContext implements MtpClient.Listener {
notifyDirty();
}
+ @Override
public void deviceAdded(android.mtp.MtpDevice device) {
notifyDirty();
showToast(R.string.camera_connected);
}
+ @Override
public void deviceRemoved(android.mtp.MtpDevice device) {
notifyDirty();
showToast(R.string.camera_disconnected);
diff --git a/src/com/android/gallery3d/data/MtpImage.java b/src/com/android/gallery3d/data/MtpImage.java
index 1d0f88db1..801a1d244 100644
--- a/src/com/android/gallery3d/data/MtpImage.java
+++ b/src/com/android/gallery3d/data/MtpImage.java
@@ -80,6 +80,7 @@ public class MtpImage extends MediaItem {
@Override
public Job<Bitmap> requestImage(int type) {
return new Job<Bitmap>() {
+ @Override
public Bitmap run(JobContext jc) {
byte[] thumbnail = mMtpContext.getMtpClient().getThumbnail(
UsbDevice.getDeviceName(mDeviceId), mObjectId);
@@ -95,6 +96,7 @@ public class MtpImage extends MediaItem {
@Override
public Job<BitmapRegionDecoder> requestLargeImage() {
return new Job<BitmapRegionDecoder>() {
+ @Override
public BitmapRegionDecoder run(JobContext jc) {
byte[] bytes = mMtpContext.getMtpClient().getObject(
UsbDevice.getDeviceName(mDeviceId), mObjectId, mObjectSize);
diff --git a/src/com/android/gallery3d/data/MtpSource.java b/src/com/android/gallery3d/data/MtpSource.java
index aaf50ad4c..47a2e6c66 100644
--- a/src/com/android/gallery3d/data/MtpSource.java
+++ b/src/com/android/gallery3d/data/MtpSource.java
@@ -19,6 +19,7 @@ package com.android.gallery3d.data;
import com.android.gallery3d.app.GalleryApp;
public class MtpSource extends MediaSource {
+ @SuppressWarnings("unused")
private static final String TAG = "MtpSource";
private static final int MTP_DEVICESET = 0;
diff --git a/src/com/android/gallery3d/data/SizeClustering.java b/src/com/android/gallery3d/data/SizeClustering.java
index 2dbe49dfd..0bde55e9e 100644
--- a/src/com/android/gallery3d/data/SizeClustering.java
+++ b/src/com/android/gallery3d/data/SizeClustering.java
@@ -53,6 +53,7 @@ public class SizeClustering extends Clustering {
final ArrayList<Path>[] group =
(ArrayList<Path>[]) new ArrayList[SIZE_LEVELS.length];
baseSet.enumerateTotalMediaItems(new MediaSet.ItemConsumer() {
+ @Override
public void consume(int index, MediaItem item) {
// Find the cluster this item belongs to.
long size = item.getSize();
diff --git a/src/com/android/gallery3d/data/SnailAlbum.java b/src/com/android/gallery3d/data/SnailAlbum.java
index cd4f803ad..18905fb2b 100644
--- a/src/com/android/gallery3d/data/SnailAlbum.java
+++ b/src/com/android/gallery3d/data/SnailAlbum.java
@@ -21,6 +21,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
// This is a simple MediaSet which contains only one MediaItem -- a SnailItem.
public class SnailAlbum extends MediaSet {
+ @SuppressWarnings("unused")
private static final String TAG = "SnailAlbum";
private SnailItem mItem;
private AtomicBoolean mDirty = new AtomicBoolean(false);
diff --git a/src/com/android/gallery3d/data/SnailItem.java b/src/com/android/gallery3d/data/SnailItem.java
index fdb1b0d56..3586d2cab 100644
--- a/src/com/android/gallery3d/data/SnailItem.java
+++ b/src/com/android/gallery3d/data/SnailItem.java
@@ -27,6 +27,7 @@ import com.android.gallery3d.util.ThreadPool.JobContext;
// used so we can show an foreign component (like an
// android.view.View) instead of a Bitmap.
public class SnailItem extends MediaItem {
+ @SuppressWarnings("unused")
private static final String TAG = "SnailItem";
private ScreenNail mScreenNail;
@@ -38,6 +39,7 @@ public class SnailItem extends MediaItem {
public Job<Bitmap> requestImage(int type) {
// nothing to return
return new Job<Bitmap>() {
+ @Override
public Bitmap run(JobContext jc) {
return null;
}
@@ -48,6 +50,7 @@ public class SnailItem extends MediaItem {
public Job<BitmapRegionDecoder> requestLargeImage() {
// nothing to return
return new Job<BitmapRegionDecoder>() {
+ @Override
public BitmapRegionDecoder run(JobContext jc) {
return null;
}
diff --git a/src/com/android/gallery3d/data/SnailSource.java b/src/com/android/gallery3d/data/SnailSource.java
index 5f663d2ec..7f971d3e0 100644
--- a/src/com/android/gallery3d/data/SnailSource.java
+++ b/src/com/android/gallery3d/data/SnailSource.java
@@ -18,6 +18,7 @@ package com.android.gallery3d.data;
import com.android.gallery3d.app.GalleryApp;
public class SnailSource extends MediaSource {
+ @SuppressWarnings("unused")
private static final String TAG = "SnailSource";
private static final int SNAIL_ALBUM = 0;
private static final int SNAIL_ITEM = 1;
diff --git a/src/com/android/gallery3d/data/TagClustering.java b/src/com/android/gallery3d/data/TagClustering.java
index 849f88510..407ca84c4 100644
--- a/src/com/android/gallery3d/data/TagClustering.java
+++ b/src/com/android/gallery3d/data/TagClustering.java
@@ -43,6 +43,7 @@ public class TagClustering extends Clustering {
final ArrayList<Path> untagged = new ArrayList<Path>();
baseSet.enumerateTotalMediaItems(new MediaSet.ItemConsumer() {
+ @Override
public void consume(int index, MediaItem item) {
Path path = item.getPath();
diff --git a/src/com/android/gallery3d/data/TimeClustering.java b/src/com/android/gallery3d/data/TimeClustering.java
index 9a0ae1d53..35cbab1ee 100644
--- a/src/com/android/gallery3d/data/TimeClustering.java
+++ b/src/com/android/gallery3d/data/TimeClustering.java
@@ -28,6 +28,7 @@ import java.util.Collections;
import java.util.Comparator;
public class TimeClustering extends Clustering {
+ @SuppressWarnings("unused")
private static final String TAG = "TimeClustering";
// If 2 items are greater than 25 miles apart, they will be in different
@@ -83,6 +84,7 @@ public class TimeClustering extends Clustering {
new DateComparator();
private static class DateComparator implements Comparator<SmallItem> {
+ @Override
public int compare(SmallItem item1, SmallItem item2) {
return -Utils.compare(item1.dateInMs, item2.dateInMs);
}
@@ -101,6 +103,7 @@ public class TimeClustering extends Clustering {
final double[] latLng = new double[2];
baseSet.enumerateTotalMediaItems(new MediaSet.ItemConsumer() {
+ @Override
public void consume(int index, MediaItem item) {
if (index < 0 || index >= total) return;
SmallItem s = new SmallItem();
diff --git a/src/com/android/gallery3d/data/UriImage.java b/src/com/android/gallery3d/data/UriImage.java
index b5bfe964b..8fc873e34 100644
--- a/src/com/android/gallery3d/data/UriImage.java
+++ b/src/com/android/gallery3d/data/UriImage.java
@@ -134,6 +134,7 @@ public class UriImage extends MediaItem {
private boolean prepareInputFile(JobContext jc) {
jc.setCancelListener(new CancelListener() {
+ @Override
public void onCancel() {
synchronized (this) {
notifyAll();
@@ -166,6 +167,7 @@ public class UriImage extends MediaItem {
}
private class RegionDecoderJob implements Job<BitmapRegionDecoder> {
+ @Override
public BitmapRegionDecoder run(JobContext jc) {
if (!prepareInputFile(jc)) return null;
BitmapRegionDecoder decoder = DecodeUtils.createBitmapRegionDecoder(
diff --git a/src/com/android/gallery3d/gadget/LocalPhotoSource.java b/src/com/android/gallery3d/gadget/LocalPhotoSource.java
index 6ec41f6da..4e94e8d75 100644
--- a/src/com/android/gallery3d/gadget/LocalPhotoSource.java
+++ b/src/com/android/gallery3d/gadget/LocalPhotoSource.java
@@ -41,6 +41,7 @@ import java.util.Random;
public class LocalPhotoSource implements WidgetSource {
+ @SuppressWarnings("unused")
private static final String TAG = "LocalPhotoSource";
private static final int MAX_PHOTO_COUNT = 128;
@@ -77,6 +78,7 @@ public class LocalPhotoSource implements WidgetSource {
.registerContentObserver(CONTENT_URI, true, mContentObserver);
}
+ @Override
public void close() {
mContext.getContentResolver().unregisterContentObserver(mContentObserver);
}
@@ -152,6 +154,7 @@ public class LocalPhotoSource implements WidgetSource {
}
}
+ @Override
public void reload() {
if (!mContentDirty) return;
mContentDirty = false;
diff --git a/src/com/android/gallery3d/gadget/MediaSetSource.java b/src/com/android/gallery3d/gadget/MediaSetSource.java
index 786092b05..caeff2a87 100644
--- a/src/com/android/gallery3d/gadget/MediaSetSource.java
+++ b/src/com/android/gallery3d/gadget/MediaSetSource.java
@@ -32,6 +32,7 @@ import java.util.Arrays;
public class MediaSetSource implements WidgetSource, ContentListener {
private static final int CACHE_SIZE = 32;
+ @SuppressWarnings("unused")
private static final String TAG = "MediaSetSource";
private MediaSet mSource;
diff --git a/src/com/android/gallery3d/gadget/WidgetService.java b/src/com/android/gallery3d/gadget/WidgetService.java
index 83e37a630..334b15a69 100644
--- a/src/com/android/gallery3d/gadget/WidgetService.java
+++ b/src/com/android/gallery3d/gadget/WidgetService.java
@@ -120,22 +120,27 @@ public class WidgetService extends RemoteViewsService {
mSource = null;
}
+ @Override
public int getCount() {
return mSource.size();
}
+ @Override
public long getItemId(int position) {
return position;
}
+ @Override
public int getViewTypeCount() {
return 1;
}
+ @Override
public boolean hasStableIds() {
return true;
}
+ @Override
public RemoteViews getLoadingView() {
RemoteViews rv = new RemoteViews(
mApp.getAndroidContext().getPackageName(),
@@ -144,6 +149,7 @@ public class WidgetService extends RemoteViewsService {
return rv;
}
+ @Override
public RemoteViews getViewAt(int position) {
Bitmap bitmap = mSource.getImage(position);
if (bitmap == null) return getLoadingView();
diff --git a/src/com/android/gallery3d/onetimeinitializer/GalleryWidgetMigrator.java b/src/com/android/gallery3d/onetimeinitializer/GalleryWidgetMigrator.java
index 4d85baa40..0187cba4b 100644
--- a/src/com/android/gallery3d/onetimeinitializer/GalleryWidgetMigrator.java
+++ b/src/com/android/gallery3d/onetimeinitializer/GalleryWidgetMigrator.java
@@ -23,7 +23,6 @@ import android.preference.PreferenceManager;
import android.util.Log;
import com.android.gallery3d.app.GalleryApp;
-import com.android.gallery3d.common.Utils;
import com.android.gallery3d.data.DataManager;
import com.android.gallery3d.data.LocalAlbum;
import com.android.gallery3d.data.MediaSet;
diff --git a/src/com/android/gallery3d/ui/ActionModeHandler.java b/src/com/android/gallery3d/ui/ActionModeHandler.java
index 80d2500d4..0b5cd54cd 100644
--- a/src/com/android/gallery3d/ui/ActionModeHandler.java
+++ b/src/com/android/gallery3d/ui/ActionModeHandler.java
@@ -51,6 +51,7 @@ import java.util.ArrayList;
public class ActionModeHandler implements
ActionMode.Callback, PopupList.OnPopupItemClickListener {
+ @SuppressWarnings("unused")
private static final String TAG = "ActionModeHandler";
private static final int SUPPORT_MULTIPLE_MASK = MediaObject.SUPPORT_DELETE
| MediaObject.SUPPORT_ROTATE | MediaObject.SUPPORT_SHARE
@@ -161,12 +162,14 @@ public class ActionModeHandler implements
mSelectionMenu.updateSelectAllMode(mSelectionManager.inSelectAllMode());
}
+ @Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
MenuInflater inflater = mode.getMenuInflater();
inflater.inflate(R.menu.operation, menu);
mShareActionProvider = GalleryActionBar.initializeShareActionProvider(menu);
OnShareTargetSelectedListener listener = new OnShareTargetSelectedListener() {
+ @Override
public boolean onShareTargetSelected(ShareActionProvider source, Intent intent) {
mSelectionManager.leaveSelectionMode();
return false;
@@ -178,10 +181,12 @@ public class ActionModeHandler implements
return true;
}
+ @Override
public void onDestroyActionMode(ActionMode mode) {
mSelectionManager.leaveSelectionMode();
}
+ @Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return true;
}
@@ -291,6 +296,7 @@ public class ActionModeHandler implements
// Generate sharing intent and update supported operations in the background
// The task can take a long time and be canceled in the mean time.
mMenuTask = mActivity.getThreadPool().submit(new Job<Void>() {
+ @Override
public Void run(final JobContext jc) {
// Pass1: Deal with unexpanded media object list for menu operation.
final int operation = computeMenuOptions(jc);
@@ -298,6 +304,7 @@ public class ActionModeHandler implements
// Pass2: Deal with expanded media object list for sharing operation.
final Intent intent = supportShare ? computeSharingIntent(jc) : null;
mMainHandler.post(new Runnable() {
+ @Override
public void run() {
mMenuTask = null;
if (!jc.isCancelled()) {
diff --git a/src/com/android/gallery3d/ui/BasicTexture.java b/src/com/android/gallery3d/ui/BasicTexture.java
index 78559270f..784b499ca 100644
--- a/src/com/android/gallery3d/ui/BasicTexture.java
+++ b/src/com/android/gallery3d/ui/BasicTexture.java
@@ -87,10 +87,12 @@ abstract class BasicTexture implements Texture {
return mId;
}
+ @Override
public int getWidth() {
return mWidth;
}
+ @Override
public int getHeight() {
return mHeight;
}
@@ -124,10 +126,12 @@ abstract class BasicTexture implements Texture {
mHasBorder = hasBorder;
}
+ @Override
public void draw(GLCanvas canvas, int x, int y) {
canvas.drawTexture(this, x, y, getWidth(), getHeight());
}
+ @Override
public void draw(GLCanvas canvas, int x, int y, int w, int h) {
canvas.drawTexture(this, x, y, w, h);
}
diff --git a/src/com/android/gallery3d/ui/BitmapScreenNail.java b/src/com/android/gallery3d/ui/BitmapScreenNail.java
index 0043e0cbe..6cb36b092 100644
--- a/src/com/android/gallery3d/ui/BitmapScreenNail.java
+++ b/src/com/android/gallery3d/ui/BitmapScreenNail.java
@@ -31,6 +31,7 @@ import com.android.gallery3d.data.MediaItem;
// - When the the bitmap is available, and we have drawn the placeholder color
// before, we will do a fade-in animation.
public class BitmapScreenNail implements ScreenNail {
+ @SuppressWarnings("unused")
private static final String TAG = "BitmapScreenNail";
private static final int PLACEHOLDER_COLOR = 0xFF222222;
// The duration of the fading animation in milliseconds
diff --git a/src/com/android/gallery3d/ui/CacheStorageUsageInfo.java b/src/com/android/gallery3d/ui/CacheStorageUsageInfo.java
index c65d77eff..611648a29 100644
--- a/src/com/android/gallery3d/ui/CacheStorageUsageInfo.java
+++ b/src/com/android/gallery3d/ui/CacheStorageUsageInfo.java
@@ -25,6 +25,7 @@ import com.android.gallery3d.util.ThreadPool.JobContext;
import java.io.File;
public class CacheStorageUsageInfo {
+ @SuppressWarnings("unused")
private static final String TAG = "CacheStorageUsageInfo";
// number of bytes the storage has.
diff --git a/src/com/android/gallery3d/ui/ColorTexture.java b/src/com/android/gallery3d/ui/ColorTexture.java
index 24e8914b5..733c05653 100644
--- a/src/com/android/gallery3d/ui/ColorTexture.java
+++ b/src/com/android/gallery3d/ui/ColorTexture.java
@@ -31,14 +31,17 @@ public class ColorTexture implements Texture {
mHeight = 1;
}
+ @Override
public void draw(GLCanvas canvas, int x, int y) {
draw(canvas, x, y, mWidth, mHeight);
}
+ @Override
public void draw(GLCanvas canvas, int x, int y, int w, int h) {
canvas.fillRect(x, y, w, h, mColor);
}
+ @Override
public boolean isOpaque() {
return Utils.isOpaque(mColor);
}
@@ -48,10 +51,12 @@ public class ColorTexture implements Texture {
mHeight = height;
}
+ @Override
public int getWidth() {
return mWidth;
}
+ @Override
public int getHeight() {
return mHeight;
}
diff --git a/src/com/android/gallery3d/ui/CropView.java b/src/com/android/gallery3d/ui/CropView.java
index 78d5d373d..8c2c3df2a 100644
--- a/src/com/android/gallery3d/ui/CropView.java
+++ b/src/com/android/gallery3d/ui/CropView.java
@@ -44,6 +44,7 @@ import javax.microedition.khronos.opengles.GL11;
* The activity can crop specific region of interest from an image.
*/
public class CropView extends GLView {
+ @SuppressWarnings("unused")
private static final String TAG = "CropView";
private static final int FACE_PIXEL_COUNT = 120000; // around 400x300
diff --git a/src/com/android/gallery3d/ui/DetailsAddressResolver.java b/src/com/android/gallery3d/ui/DetailsAddressResolver.java
index f5439234d..3dd20a5e0 100644
--- a/src/com/android/gallery3d/ui/DetailsAddressResolver.java
+++ b/src/com/android/gallery3d/ui/DetailsAddressResolver.java
@@ -43,6 +43,7 @@ public class DetailsAddressResolver {
mLatlng = latlng;
}
+ @Override
public Address run(JobContext jc) {
ReverseGeocoder geocoder = new ReverseGeocoder(mContext.getAndroidContext());
return geocoder.lookupAddress(mLatlng[0], mLatlng[1], true);
@@ -63,10 +64,12 @@ public class DetailsAddressResolver {
mAddressLookupJob = mContext.getThreadPool().submit(
new AddressLookupJob(latlng),
new FutureListener<Address>() {
+ @Override
public void onFutureDone(final Future<Address> future) {
mAddressLookupJob = null;
if (!future.isCancelled()) {
mHandler.post(new Runnable() {
+ @Override
public void run() {
updateLocation(future.get());
}
diff --git a/src/com/android/gallery3d/ui/DialogDetailsView.java b/src/com/android/gallery3d/ui/DialogDetailsView.java
index c90ab4033..a55660035 100644
--- a/src/com/android/gallery3d/ui/DialogDetailsView.java
+++ b/src/com/android/gallery3d/ui/DialogDetailsView.java
@@ -59,15 +59,18 @@ public class DialogDetailsView implements DetailsViewContainer {
mSource = source;
}
+ @Override
public void show() {
reloadDetails();
mDialog.show();
}
+ @Override
public void hide() {
mDialog.hide();
}
+ @Override
public void reloadDetails() {
int index = mSource.setIndex();
if (index == -1) return;
@@ -92,6 +95,7 @@ public class DialogDetailsView implements DetailsViewContainer {
.setView(detailsList)
.setTitle(title)
.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
+ @Override
public void onClick(DialogInterface dialog, int whichButton) {
mDialog.dismiss();
}
@@ -99,6 +103,7 @@ public class DialogDetailsView implements DetailsViewContainer {
.create();
mDialog.setOnDismissListener(new OnDismissListener() {
+ @Override
public void onDismiss(DialogInterface dialog) {
if (mListener != null) {
mListener.onClose();
@@ -198,18 +203,22 @@ public class DialogDetailsView implements DetailsViewContainer {
return false;
}
+ @Override
public int getCount() {
return mItems.size();
}
+ @Override
public Object getItem(int position) {
return mDetails.getDetail(position);
}
+ @Override
public long getItemId(int position) {
return position;
}
+ @Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView tv;
if (convertView == null) {
@@ -222,12 +231,14 @@ public class DialogDetailsView implements DetailsViewContainer {
return tv;
}
+ @Override
public void onAddressAvailable(String address) {
mItems.set(mLocationIndex, address);
notifyDataSetChanged();
}
}
+ @Override
public void setCloseListener(CloseListener listener) {
mListener = listener;
}
diff --git a/src/com/android/gallery3d/ui/EdgeEffect.java b/src/com/android/gallery3d/ui/EdgeEffect.java
index 362b8fea6..ed369737b 100644
--- a/src/com/android/gallery3d/ui/EdgeEffect.java
+++ b/src/com/android/gallery3d/ui/EdgeEffect.java
@@ -51,6 +51,7 @@ import com.android.gallery3d.R;
* {@link #draw(Canvas)} method.</p>
*/
public class EdgeEffect {
+ @SuppressWarnings("unused")
private static final String TAG = "EdgeEffect";
// Time it will take the effect to fully recede in ms
diff --git a/src/com/android/gallery3d/ui/EdgeView.java b/src/com/android/gallery3d/ui/EdgeView.java
index bf97108a8..4aff0494d 100644
--- a/src/com/android/gallery3d/ui/EdgeView.java
+++ b/src/com/android/gallery3d/ui/EdgeView.java
@@ -21,6 +21,7 @@ import android.opengl.Matrix;
// EdgeView draws EdgeEffect (blue glow) at four sides of the view.
public class EdgeView extends GLView {
+ @SuppressWarnings("unused")
private static final String TAG = "EdgeView";
public static final int INVALID_DIRECTION = -1;
diff --git a/src/com/android/gallery3d/ui/ExtTexture.java b/src/com/android/gallery3d/ui/ExtTexture.java
index 9319d8ccd..eac504fe5 100644
--- a/src/com/android/gallery3d/ui/ExtTexture.java
+++ b/src/com/android/gallery3d/ui/ExtTexture.java
@@ -77,6 +77,7 @@ public class ExtTexture extends BasicTexture {
return mTarget;
}
+ @Override
public boolean isOpaque() {
return true;
}
diff --git a/src/com/android/gallery3d/ui/FlingScroller.java b/src/com/android/gallery3d/ui/FlingScroller.java
index 1cddcdb76..6f98c64f9 100644
--- a/src/com/android/gallery3d/ui/FlingScroller.java
+++ b/src/com/android/gallery3d/ui/FlingScroller.java
@@ -26,6 +26,7 @@ package com.android.gallery3d.ui;
// (2) The duration is different.
// (3) The deceleration curve is different.
class FlingScroller {
+ @SuppressWarnings("unused")
private static final String TAG = "FlingController";
// The fling duration (in milliseconds) when velocity is 1 pixel/second
diff --git a/src/com/android/gallery3d/ui/GLCanvasImpl.java b/src/com/android/gallery3d/ui/GLCanvasImpl.java
index 45ea0584f..7b7a31773 100644
--- a/src/com/android/gallery3d/ui/GLCanvasImpl.java
+++ b/src/com/android/gallery3d/ui/GLCanvasImpl.java
@@ -92,6 +92,7 @@ public class GLCanvasImpl implements GLCanvas {
initialize();
}
+ @Override
public void setSize(int width, int height) {
Utils.assertTrue(width >= 0 && height >= 0);
@@ -119,15 +120,18 @@ public class GLCanvasImpl implements GLCanvas {
}
}
+ @Override
public void setAlpha(float alpha) {
Utils.assertTrue(alpha >= 0 && alpha <= 1);
mAlpha = alpha;
}
+ @Override
public float getAlpha() {
return mAlpha;
}
+ @Override
public void multiplyAlpha(float alpha) {
Utils.assertTrue(alpha >= 0 && alpha <= 1);
mAlpha *= alpha;
@@ -166,6 +170,7 @@ public class GLCanvasImpl implements GLCanvas {
// mMatrixValues and mAlpha will be initialized in setSize()
}
+ @Override
public void drawRect(float x, float y, float width, float height, GLPaint paint) {
GL11 gl = mGL;
@@ -183,6 +188,7 @@ public class GLCanvasImpl implements GLCanvas {
mCountDrawLine++;
}
+ @Override
public void drawLine(float x1, float y1, float x2, float y2, GLPaint paint) {
GL11 gl = mGL;
@@ -200,6 +206,7 @@ public class GLCanvasImpl implements GLCanvas {
mCountDrawLine++;
}
+ @Override
public void fillRect(float x, float y, float width, float height, int color) {
mGLState.setColorMode(color, mAlpha);
GL11 gl = mGL;
@@ -215,6 +222,7 @@ public class GLCanvasImpl implements GLCanvas {
mCountFillRect++;
}
+ @Override
public void translate(float x, float y, float z) {
Matrix.translateM(mMatrixValues, 0, x, y, z);
}
@@ -222,6 +230,7 @@ public class GLCanvasImpl implements GLCanvas {
// This is a faster version of translate(x, y, z) because
// (1) we knows z = 0, (2) we inline the Matrix.translateM call,
// (3) we unroll the loop
+ @Override
public void translate(float x, float y) {
float[] m = mMatrixValues;
m[12] += m[0] * x + m[4] * y;
@@ -230,10 +239,12 @@ public class GLCanvasImpl implements GLCanvas {
m[15] += m[3] * x + m[7] * y;
}
+ @Override
public void scale(float sx, float sy, float sz) {
Matrix.scaleM(mMatrixValues, 0, sx, sy, sz);
}
+ @Override
public void rotate(float angle, float x, float y, float z) {
if (angle == 0) return;
float[] temp = mTempMatrix;
@@ -242,6 +253,7 @@ public class GLCanvasImpl implements GLCanvas {
System.arraycopy(temp, 16, mMatrixValues, 0, 16);
}
+ @Override
public void multiplyMatrix(float matrix[], int offset) {
float[] temp = mTempMatrix;
Matrix.multiplyMM(temp, 0, mMatrixValues, 0, matrix, offset);
@@ -262,6 +274,7 @@ public class GLCanvasImpl implements GLCanvas {
mCountTextureRect++;
}
+ @Override
public void drawMesh(BasicTexture tex, int x, int y, int xyBuffer,
int uvBuffer, int indexBuffer, int indexCount) {
float alpha = mAlpha;
@@ -352,6 +365,7 @@ public class GLCanvasImpl implements GLCanvas {
}
}
+ @Override
public void drawTexture(
BasicTexture texture, int x, int y, int width, int height) {
drawTexture(texture, x, y, width, height, mAlpha);
@@ -368,6 +382,7 @@ public class GLCanvasImpl implements GLCanvas {
drawBoundTexture(texture, x, y, width, height);
}
+ @Override
public void drawTexture(BasicTexture texture, RectF source, RectF target) {
if (target.width() <= 0 || target.height() <= 0) return;
@@ -386,6 +401,7 @@ public class GLCanvasImpl implements GLCanvas {
textureRect(target.left, target.top, target.width(), target.height());
}
+ @Override
public void drawTexture(BasicTexture texture, float[] mTextureTransform,
int x, int y, int w, int h) {
mGLState.setBlendEnabled(mBlendEnabled
@@ -427,6 +443,7 @@ public class GLCanvasImpl implements GLCanvas {
}
}
+ @Override
public void drawMixed(BasicTexture from,
int toColor, float ratio, int x, int y, int w, int h) {
drawMixed(from, toColor, ratio, x, y, w, h, mAlpha);
@@ -626,10 +643,12 @@ public class GLCanvasImpl implements GLCanvas {
}
}
+ @Override
public GL11 getGLInstance() {
return mGL;
}
+ @Override
public void clearBuffer() {
mGL.glClear(GL10.GL_COLOR_BUFFER_BIT);
}
@@ -659,6 +678,7 @@ public class GLCanvasImpl implements GLCanvas {
// unloadTexture and deleteBuffer can be called from the finalizer thread,
// so we synchronized on the mUnboundTextures object.
+ @Override
public boolean unloadTexture(BasicTexture t) {
synchronized (mUnboundTextures) {
if (!t.isLoaded()) return false;
@@ -667,12 +687,14 @@ public class GLCanvasImpl implements GLCanvas {
}
}
+ @Override
public void deleteBuffer(int bufferId) {
synchronized (mUnboundTextures) {
mDeleteBuffers.add(bufferId);
}
}
+ @Override
public void deleteRecycledResources() {
synchronized (mUnboundTextures) {
IntArray ids = mUnboundTextures;
@@ -689,10 +711,12 @@ public class GLCanvasImpl implements GLCanvas {
}
}
+ @Override
public void save() {
save(SAVE_FLAG_ALL);
}
+ @Override
public void save(int saveFlags) {
ConfigState config = obtainRestoreConfig();
@@ -712,6 +736,7 @@ public class GLCanvasImpl implements GLCanvas {
mRestoreStack.add(config);
}
+ @Override
public void restore() {
if (mRestoreStack.isEmpty()) throw new IllegalStateException();
ConfigState config = mRestoreStack.remove(mRestoreStack.size() - 1);
@@ -746,6 +771,7 @@ public class GLCanvasImpl implements GLCanvas {
}
}
+ @Override
public void dumpStatisticsAndClear() {
String line = String.format(
"MESH:%d, TEX_OES:%d, TEX_RECT:%d, FILL_RECT:%d, LINE:%d",
diff --git a/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java b/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java
index 0d5643ff9..7089d3c1d 100644
--- a/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java
+++ b/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java
@@ -39,6 +39,7 @@ class GalleryEGLConfigChooser implements EGLConfigChooser {
EGL10.EGL_NONE
};
+ @Override
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
int[] numConfig = new int[1];
if (!egl.eglChooseConfig(display, mConfigSpec, null, 0, numConfig)) {
diff --git a/src/com/android/gallery3d/ui/GestureRecognizer.java b/src/com/android/gallery3d/ui/GestureRecognizer.java
index 780c548d0..e4e0c49f5 100644
--- a/src/com/android/gallery3d/ui/GestureRecognizer.java
+++ b/src/com/android/gallery3d/ui/GestureRecognizer.java
@@ -25,6 +25,7 @@ import android.view.ScaleGestureDetector;
// This class aggregates three gesture detectors: GestureDetector,
// ScaleGestureDetector, and DownUpDetector.
public class GestureRecognizer {
+ @SuppressWarnings("unused")
private static final String TAG = "GestureRecognizer";
public interface Listener {
diff --git a/src/com/android/gallery3d/ui/MenuExecutor.java b/src/com/android/gallery3d/ui/MenuExecutor.java
index 3619ca0f6..aaf5d3974 100644
--- a/src/com/android/gallery3d/ui/MenuExecutor.java
+++ b/src/com/android/gallery3d/ui/MenuExecutor.java
@@ -380,6 +380,7 @@ public class MenuExecutor {
mListener = listener;
}
+ @Override
public Void run(JobContext jc) {
int index = 0;
DataManager manager = mActivity.getDataManager();
diff --git a/src/com/android/gallery3d/ui/Paper.java b/src/com/android/gallery3d/ui/Paper.java
index 3b67a049a..3bd0a2175 100644
--- a/src/com/android/gallery3d/ui/Paper.java
+++ b/src/com/android/gallery3d/ui/Paper.java
@@ -25,6 +25,7 @@ import com.android.gallery3d.common.Utils;
// This class does the overscroll effect.
class Paper {
+ @SuppressWarnings("unused")
private static final String TAG = "Paper";
private static final int ROTATE_FACTOR = 4;
private EdgeAnimation mAnimationLeft = new EdgeAnimation();
@@ -90,6 +91,7 @@ class Paper {
// This class follows the structure of frameworks's EdgeEffect class.
class EdgeAnimation {
+ @SuppressWarnings("unused")
private static final String TAG = "EdgeAnimation";
private static final int STATE_IDLE = 0;
diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java
index 25254338a..ec042da23 100644
--- a/src/com/android/gallery3d/ui/PhotoView.java
+++ b/src/com/android/gallery3d/ui/PhotoView.java
@@ -539,7 +539,7 @@ public class PhotoView extends GLView {
boolean isDeletable(); // whether the picture can be deleted
void forceSize(); // called when mCompensation changes
Size getSize();
- };
+ }
class FullPicture implements Picture {
private int mRotation;
@@ -1046,9 +1046,8 @@ public class PhotoView extends GLView {
|| !mTouchBoxDeletable) {
return false;
}
- int maxVelocity = (int) GalleryUtils.dpToPixel(MAX_DISMISS_VELOCITY);
- int escapeVelocity =
- (int) GalleryUtils.dpToPixel(SWIPE_ESCAPE_VELOCITY);
+ int maxVelocity = GalleryUtils.dpToPixel(MAX_DISMISS_VELOCITY);
+ int escapeVelocity = GalleryUtils.dpToPixel(SWIPE_ESCAPE_VELOCITY);
int centerY = mPositionController.getPosition(mTouchBoxIndex)
.centerY();
boolean fastEnough = (Math.abs(vy) > escapeVelocity)
diff --git a/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java b/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
index dd9b7ce1f..fd16b3537 100644
--- a/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
+++ b/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
@@ -19,12 +19,12 @@ package com.android.gallery3d.ui;
import android.annotation.TargetApi;
import android.graphics.RectF;
import android.graphics.SurfaceTexture;
-import android.opengl.GLES11Ext;
import com.android.gallery3d.common.ApiHelper;
public abstract class SurfaceTextureScreenNail implements ScreenNail,
SurfaceTexture.OnFrameAvailableListener {
+ @SuppressWarnings("unused")
private static final String TAG = "SurfaceTextureScreenNail";
// This constant is not available in API level before 15, but it was just an
// oversight.
diff --git a/src/com/android/gallery3d/ui/UndoBarView.java b/src/com/android/gallery3d/ui/UndoBarView.java
index f5ea5d1ad..8c9836deb 100644
--- a/src/com/android/gallery3d/ui/UndoBarView.java
+++ b/src/com/android/gallery3d/ui/UndoBarView.java
@@ -24,6 +24,7 @@ import com.android.gallery3d.common.Utils;
import com.android.gallery3d.util.GalleryUtils;
public class UndoBarView extends GLView {
+ @SuppressWarnings("unused")
private static final String TAG = "UndoBarView";
private static final int WHITE = 0xFFFFFFFF;
@@ -55,16 +56,16 @@ public class UndoBarView extends GLView {
// +-+----+----------------+-+--+----+-+------+--+-+
// 4 16 1 12 32 8 16 4
public UndoBarView(Context context) {
- mBarHeight = (int) GalleryUtils.dpToPixel(48);
- mBarMargin = (int) GalleryUtils.dpToPixel(4);
- mUndoTextMargin = (int) GalleryUtils.dpToPixel(16);
- mIconMargin = (int) GalleryUtils.dpToPixel(8);
- mIconSize = (int) GalleryUtils.dpToPixel(32);
- mSeparatorRightMargin = (int) GalleryUtils.dpToPixel(12);
- mSeparatorTopMargin = (int) GalleryUtils.dpToPixel(10);
- mSeparatorBottomMargin = (int) GalleryUtils.dpToPixel(10);
- mSeparatorWidth = (int) GalleryUtils.dpToPixel(1);
- mDeletedTextMargin = (int) GalleryUtils.dpToPixel(16);
+ mBarHeight = GalleryUtils.dpToPixel(48);
+ mBarMargin = GalleryUtils.dpToPixel(4);
+ mUndoTextMargin = GalleryUtils.dpToPixel(16);
+ mIconMargin = GalleryUtils.dpToPixel(8);
+ mIconSize = GalleryUtils.dpToPixel(32);
+ mSeparatorRightMargin = GalleryUtils.dpToPixel(12);
+ mSeparatorTopMargin = GalleryUtils.dpToPixel(10);
+ mSeparatorBottomMargin = GalleryUtils.dpToPixel(10);
+ mSeparatorWidth = GalleryUtils.dpToPixel(1);
+ mDeletedTextMargin = GalleryUtils.dpToPixel(16);
mPanel = new NinePatchTexture(context, R.drawable.panel_undo_holo);
mUndoText = StringTexture.newInstance(context.getString(R.string.undo),
@@ -166,6 +167,7 @@ public class UndoBarView extends GLView {
return (visibility == VISIBLE) ? 1f : 0f;
}
+ @Override
public void setVisibility(int visibility) {
mAlpha = getTargetAlpha(visibility);
mAnimationStartTime = NO_ANIMATION;
diff --git a/src/com/android/gallery3d/ui/UploadedTexture.java b/src/com/android/gallery3d/ui/UploadedTexture.java
index 0fe506735..bb86d05ef 100644
--- a/src/com/android/gallery3d/ui/UploadedTexture.java
+++ b/src/com/android/gallery3d/ui/UploadedTexture.java
@@ -318,6 +318,7 @@ abstract class UploadedTexture extends BasicTexture {
mOpaque = isOpaque;
}
+ @Override
public boolean isOpaque() {
return mOpaque;
}
diff --git a/src/com/android/gallery3d/util/GalleryUtils.java b/src/com/android/gallery3d/util/GalleryUtils.java
index 05198f41b..3b73d344c 100644
--- a/src/com/android/gallery3d/util/GalleryUtils.java
+++ b/src/com/android/gallery3d/util/GalleryUtils.java
@@ -164,6 +164,7 @@ public class GalleryUtils {
public static void fakeBusy(JobContext jc, int timeout) {
final ConditionVariable cv = new ConditionVariable();
jc.setCancelListener(new CancelListener() {
+ @Override
public void onCancel() {
cv.open();
}
diff --git a/src/com/android/gallery3d/util/MediaSetUtils.java b/src/com/android/gallery3d/util/MediaSetUtils.java
index 3bb3f8bd1..b71326a39 100644
--- a/src/com/android/gallery3d/util/MediaSetUtils.java
+++ b/src/com/android/gallery3d/util/MediaSetUtils.java
@@ -50,6 +50,7 @@ public class MediaSetUtils {
// Sort MediaSets by name
public static class NameComparator implements Comparator<MediaSet> {
+ @Override
public int compare(MediaSet set1, MediaSet set2) {
int result = set1.getName().compareToIgnoreCase(set2.getName());
if (result != 0) return result;
diff --git a/src/com/android/gallery3d/util/PriorityThreadFactory.java b/src/com/android/gallery3d/util/PriorityThreadFactory.java
index 67b215274..30d8e4a96 100644
--- a/src/com/android/gallery3d/util/PriorityThreadFactory.java
+++ b/src/com/android/gallery3d/util/PriorityThreadFactory.java
@@ -35,6 +35,7 @@ public class PriorityThreadFactory implements ThreadFactory {
mPriority = priority;
}
+ @Override
public Thread newThread(Runnable r) {
return new Thread(r, mName + '-' + mNumber.getAndIncrement()) {
@Override
diff --git a/src/com/android/gallery3d/util/Profile.java b/src/com/android/gallery3d/util/Profile.java
index 6b6e5c3c3..7ed72c90e 100644
--- a/src/com/android/gallery3d/util/Profile.java
+++ b/src/com/android/gallery3d/util/Profile.java
@@ -32,6 +32,7 @@ import java.util.Random;
// can be called in onPause() to ensure all profiling is disabled when an
// activity is paused.
public class Profile {
+ @SuppressWarnings("unused")
private static final String TAG = "Profile";
private static final int NS_PER_MS = 1000000;
@@ -56,6 +57,7 @@ public class Profile {
private HandlerThread mHandlerThread;
private Handler mHandler;
private Runnable mProcessRunnable = new Runnable() {
+ @Override
public void run() {
synchronized (Watchdog.this) {
processList();
diff --git a/src/com/android/gallery3d/util/ProfileData.java b/src/com/android/gallery3d/util/ProfileData.java
index 02eb37a90..a1bb8e1e4 100644
--- a/src/com/android/gallery3d/util/ProfileData.java
+++ b/src/com/android/gallery3d/util/ProfileData.java
@@ -31,6 +31,7 @@ import java.util.Map.Entry;
// The addSample() method adds a sample. The dumpToFile() method saves the data
// to a file. The reset() method clears all samples.
public class ProfileData {
+ @SuppressWarnings("unused")
private static final String TAG = "ProfileData";
private static class Node {
diff --git a/src/com/android/gallery3d/util/ReverseGeocoder.java b/src/com/android/gallery3d/util/ReverseGeocoder.java
index 3df4c4933..a8b26d9b5 100644
--- a/src/com/android/gallery3d/util/ReverseGeocoder.java
+++ b/src/com/android/gallery3d/util/ReverseGeocoder.java
@@ -35,6 +35,7 @@ import java.util.List;
import java.util.Locale;
public class ReverseGeocoder {
+ @SuppressWarnings("unused")
private static final String TAG = "ReverseGeocoder";
public static final int EARTH_RADIUS_METERS = 6378137;
public static final int LAT_MIN = -90;
diff --git a/src/com/android/gallery3d/util/ThreadPool.java b/src/com/android/gallery3d/util/ThreadPool.java
index 71bb3c5b7..4c077c8f3 100644
--- a/src/com/android/gallery3d/util/ThreadPool.java
+++ b/src/com/android/gallery3d/util/ThreadPool.java
@@ -22,6 +22,7 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class ThreadPool {
+ @SuppressWarnings("unused")
private static final String TAG = "ThreadPool";
private static final int CORE_POOL_SIZE = 4;
private static final int MAX_POOL_SIZE = 8;
@@ -98,6 +99,7 @@ public class ThreadPool {
}
private class Worker<T> implements Runnable, Future<T>, JobContext {
+ @SuppressWarnings("hiding")
private static final String TAG = "Worker";
private Job<T> mJob;
private FutureListener<T> mListener;
@@ -114,6 +116,7 @@ public class ThreadPool {
}
// This is called by a thread in the thread pool.
+ @Override
public void run() {
T result = null;
@@ -137,6 +140,7 @@ public class ThreadPool {
}
// Below are the methods for Future.
+ @Override
public synchronized void cancel() {
if (mIsCancelled) return;
mIsCancelled = true;
@@ -150,14 +154,17 @@ public class ThreadPool {
}
}
+ @Override
public boolean isCancelled() {
return mIsCancelled;
}
+ @Override
public synchronized boolean isDone() {
return mIsDone;
}
+ @Override
public synchronized T get() {
while (!mIsDone) {
try {
@@ -170,12 +177,14 @@ public class ThreadPool {
return mResult;
}
+ @Override
public void waitDone() {
get();
}
// Below are the methods for JobContext (only called from the
// thread running the job)
+ @Override
public synchronized void setCancelListener(CancelListener listener) {
mCancelListener = listener;
if (mIsCancelled && mCancelListener != null) {
@@ -183,6 +192,7 @@ public class ThreadPool {
}
}
+ @Override
public boolean setMode(int mode) {
// Release old resource
ResourceCounter rc = modeToCounter(mMode);