diff --git a/gallerycommon/src/com/android/gallery3d/common/FileCache.java b/gallerycommon/src/com/android/gallery3d/common/FileCache.java
index a69487f..d7deda6 100644
--- a/gallerycommon/src/com/android/gallery3d/common/FileCache.java
+++ b/gallerycommon/src/com/android/gallery3d/common/FileCache.java
@@ -92,6 +92,7 @@
         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 39fcf9e..2847e57 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 cb95e33..9e327aa 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.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 160f3ca..6cefd6f 100644
--- a/gallerycommon/src/com/android/gallery3d/common/Scroller.java
+++ b/gallerycommon/src/com/android/gallery3d/common/Scroller.java
@@ -342,7 +342,7 @@
         mFinalY = startY + dy;
         mDeltaX = dx;
         mDeltaY = dy;
-        mDurationReciprocal = 1.0f / (float) mDuration;
+        mDurationReciprocal = 1.0f / mDuration;
     }
 
     /**
@@ -370,8 +370,8 @@
         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 71a5756..8e6fcf5 100644
--- a/src/com/android/gallery3d/app/AlbumDataLoader.java
+++ b/src/com/android/gallery3d/app/AlbumDataLoader.java
@@ -201,6 +201,7 @@
     }
 
     private class MySourceListener implements ContentListener {
+        @Override
         public void onContentDirty() {
             if (mReloadTask != null) mReloadTask.notifyDirty();
         }
@@ -243,6 +244,7 @@
             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 b4e600b..be17f97 100644
--- a/src/com/android/gallery3d/app/AlbumPage.java
+++ b/src/com/android/gallery3d/app/AlbumPage.java
@@ -459,6 +459,7 @@
         });
         mActionModeHandler = new ActionModeHandler(mActivity, mSelectionManager);
         mActionModeHandler.setActionModeListener(new ActionModeListener() {
+            @Override
             public boolean onActionItemClicked(MenuItem item) {
                 return onItemSelected(item);
             }
@@ -483,6 +484,7 @@
         if (mDetailsHelper == null) {
             mDetailsHelper = new DetailsHelper(mActivity, mRootPane, mDetailsSource);
             mDetailsHelper.setCloseListener(new CloseListener() {
+                @Override
                 public void onClose() {
                     hideDetails();
                 }
@@ -607,6 +609,7 @@
         }
     }
 
+    @Override
     public void onSelectionModeChange(int mode) {
         switch (mode) {
             case SelectionManager.ENTER_SELECTION_MODE: {
@@ -627,6 +630,7 @@
         }
     }
 
+    @Override
     public void onSelectionChange(Path path, boolean selected) {
         Utils.assertTrue(mActionMode != null);
         int count = mSelectionManager.getSelectedCount();
@@ -693,16 +697,19 @@
     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 7509e63..65eb772 100644
--- a/src/com/android/gallery3d/app/AlbumPicker.java
+++ b/src/com/android/gallery3d/app/AlbumPicker.java
@@ -24,8 +24,6 @@
 
 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 33a30bc..9613f99 100644
--- a/src/com/android/gallery3d/app/AlbumSetDataLoader.java
+++ b/src/com/android/gallery3d/app/AlbumSetDataLoader.java
@@ -219,6 +219,7 @@
     }
 
     private class MySourceListener implements ContentListener {
+        @Override
         public void onContentDirty() {
             mReloadTask.notifyDirty();
         }
@@ -279,6 +280,7 @@
             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 5d6b1ec..f89b35a 100644
--- a/src/com/android/gallery3d/app/AppBridge.java
+++ b/src/com/android/gallery3d/app/AppBridge.java
@@ -23,10 +23,12 @@
 
 // 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 a587624..6faf8cb 100644
--- a/src/com/android/gallery3d/app/CropImage.java
+++ b/src/com/android/gallery3d/app/CropImage.java
@@ -249,6 +249,7 @@
             mCropRect = cropRect;
         }
 
+        @Override
         public Intent run(JobContext jc) {
             RectF cropRect = mCropRect;
             Bundle extra = getIntent().getExtras();
@@ -487,6 +488,7 @@
         // 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 @@
                 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 @@
         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 @@
         } 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 @@
             mItem = item;
         }
 
+        @Override
         public BitmapRegionDecoder run(JobContext jc) {
             return mItem == null ? null : mItem.requestLargeImage().run(jc);
         }
@@ -936,6 +942,7 @@
         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 89e0846..d99d97b 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.util.GalleryUtils;
 
 public class EyePosition {
+    @SuppressWarnings("unused")
     private static final String TAG = "EyePosition";
 
     public interface EyePositionListener {
@@ -180,9 +181,11 @@
     }
 
     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 c15457e..61a261f 100644
--- a/src/com/android/gallery3d/app/FilterUtils.java
+++ b/src/com/android/gallery3d/app/FilterUtils.java
@@ -54,6 +54,7 @@
 // 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 5c61648..2794b3f 100644
--- a/src/com/android/gallery3d/app/GalleryActionBar.java
+++ b/src/com/android/gallery3d/app/GalleryActionBar.java
@@ -36,6 +36,7 @@
 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 @@
 
     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 @@
         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 852926b..f725ccf 100644
--- a/src/com/android/gallery3d/app/GalleryAppImpl.java
+++ b/src/com/android/gallery3d/app/GalleryAppImpl.java
@@ -49,10 +49,12 @@
         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 @@
         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 @@
         }
     }
 
+    @Override
     public synchronized ThreadPool getThreadPool() {
         if (mThreadPool == null) {
             mThreadPool = new ThreadPool();
@@ -78,6 +82,7 @@
         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 cdbbfdc..1f10728 100644
--- a/src/com/android/gallery3d/app/ManageCachePage.java
+++ b/src/com/android/gallery3d/app/ManageCachePage.java
@@ -56,6 +56,7 @@
         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 f2c9e05..4781a1b 100644
--- a/src/com/android/gallery3d/app/MovieControllerOverlay.java
+++ b/src/com/android/gallery3d/app/MovieControllerOverlay.java
@@ -41,365 +41,387 @@
  * The playback controller for the Movie Player.
  */
 public class MovieControllerOverlay extends FrameLayout implements
-    ControllerOverlay,
-    OnClickListener,
-    AnimationListener,
-    TimeBar.Listener {
+        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 enum State {
+        PLAYING,
+        PAUSED,
+        ENDED,
+        ERROR,
+        LOADING
     }
-  }
 
-  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();
-  }
+    private static final float ERROR_MESSAGE_RELATIVE_PADDING = 1.0f / 6;
 
-  public void show() {
-    boolean wasHidden = hidden;
-    hidden = false;
-    updateViews();
-    setVisibility(View.VISIBLE);
-    setFocusable(false);
-    if (listener != null && wasHidden != hidden) {
-      listener.onShown();
+    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();
     }
-    maybeStartHiding();
-  }
 
-  private void maybeStartHiding() {
-    cancelHiding();
-    if (state == State.PLAYING) {
-      handler.postDelayed(startHidingRunnable, 2500);
+    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;
     }
-  }
 
-  private void startHiding() {
-    startHideAnimation(background);
-    startHideAnimation(timeBar);
-    startHideAnimation(playPauseReplayView);
-  }
-
-  private void startHideAnimation(View view) {
-    if (view.getVisibility() == View.VISIBLE) {
-      view.startAnimation(hideAnimation);
+    @Override
+    public void setListener(Listener listener) {
+        this.listener = listener;
     }
-  }
 
-  private void cancelHiding() {
-    handler.removeCallbacks(startHidingRunnable);
-    background.setAnimation(null);
-    timeBar.setAnimation(null);
-    playPauseReplayView.setAnimation(null);
-  }
+    @Override
+    public void setCanReplay(boolean canReplay) {
+        this.canReplay = canReplay;
+    }
 
-  public void onAnimationStart(Animation animation) {
-    // Do nothing.
-  }
+    @Override
+    public View getView() {
+        return this;
+    }
 
-  public void onAnimationRepeat(Animation animation) {
-    // Do nothing.
-  }
+    @Override
+    public void showPlaying() {
+        state = State.PLAYING;
+        showMainView(playPauseReplayView);
+    }
 
-  public void onAnimationEnd(Animation animation) {
-    hide();
-  }
+    @Override
+    public void showPaused() {
+        state = State.PAUSED;
+        showMainView(playPauseReplayView);
+    }
 
-  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 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();
         }
-      }
-    }
-  }
-
-  @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;
+    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();
     }
-    switch (event.getAction()) {
-      case MotionEvent.ACTION_DOWN:
-        cancelHiding();
-        if (state == State.PLAYING || state == State.PAUSED) {
-          listener.onPlayPause();
+
+    @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 maybeStartHiding() {
+        cancelHiding();
+        if (state == State.PLAYING) {
+            handler.postDelayed(startHidingRunnable, 2500);
+        }
     }
-  }
 
-  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;
+    private void startHiding() {
+        startHideAnimation(background);
+        startHideAnimation(timeBar);
+        startHideAnimation(playPauseReplayView);
     }
-    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 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();
-  }
+                ? View.VISIBLE : View.GONE);
+        requestLayout();
+    }
 
-  // TimeBar listener
+    // TimeBar listener
 
-  public void onScrubbingStart() {
-    cancelHiding();
-    listener.onSeekStart();
-  }
+    @Override
+    public void onScrubbingStart() {
+        cancelHiding();
+        listener.onSeekStart();
+    }
 
-  public void onScrubbingMove(int time) {
-    cancelHiding();
-    listener.onSeekMove(time);
-  }
+    @Override
+    public void onScrubbingMove(int time) {
+        cancelHiding();
+        listener.onSeekMove(time);
+    }
 
-  public void onScrubbingEnd(int time) {
-    maybeStartHiding();
-    listener.onSeekEnd(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 c3e91fb..f5cbf06 100644
--- a/src/com/android/gallery3d/app/OrientationManager.java
+++ b/src/com/android/gallery3d/app/OrientationManager.java
@@ -24,7 +24,6 @@
 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 555ea89..5339e7e 100644
--- a/src/com/android/gallery3d/app/PhotoDataAdapter.java
+++ b/src/com/android/gallery3d/app/PhotoDataAdapter.java
@@ -341,6 +341,7 @@
         updateImageRequests();
     }
 
+    @Override
     public void resume() {
         mIsActive = true;
         mSource.addContentListener(mSourceListener);
@@ -353,6 +354,7 @@
         fireDataChange();
     }
 
+    @Override
     public void pause() {
         mIsActive = false;
 
@@ -485,35 +487,43 @@
         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 @@
         return null;
     }
 
+    @Override
     public void setCurrentPhoto(Path path, int indexHint) {
         if (mItemPath == path) return;
         mItemPath = path;
@@ -537,10 +548,12 @@
         }
     }
 
+    @Override
     public void setFocusHintDirection(int direction) {
         mFocusHintDirection = direction;
     }
 
+    @Override
     public void setFocusHintPath(Path path) {
         mFocusHintPath = path;
     }
@@ -848,6 +861,7 @@
     }
 
     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 950f8c5..678ba6d 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -26,15 +26,12 @@
 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 f5b2cbd..d5bb218 100644
--- a/src/com/android/gallery3d/app/PickerActivity.java
+++ b/src/com/android/gallery3d/app/PickerActivity.java
@@ -25,7 +25,6 @@
 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 f5b22d1..6885456 100644
--- a/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java
+++ b/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java
@@ -84,6 +84,7 @@
 
     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 @@
 
     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 @@
         }
     }
 
+    @Override
     public void resume() {
         if (mTask == null) {
             if (mHasFullImage) {
@@ -150,6 +154,7 @@
         }
     }
 
+    @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 7c934ee..7a0fba5 100644
--- a/src/com/android/gallery3d/app/SlideshowDataAdapter.java
+++ b/src/com/android/gallery3d/app/SlideshowDataAdapter.java
@@ -92,6 +92,7 @@
     }
 
     private class ReloadTask implements Job<Void> {
+        @Override
         public Void run(JobContext jc) {
             while (true) {
                 synchronized (SlideshowDataAdapter.this) {
@@ -145,6 +146,7 @@
     }
 
     private class SourceListener implements ContentListener {
+        @Override
         public void onContentDirty() {
             synchronized (SlideshowDataAdapter.this) {
                 mNeedReload.set(true);
@@ -168,8 +170,10 @@
         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 @@
         }, listener);
     }
 
+    @Override
     public void pause() {
         synchronized (this) {
             mIsActive = false;
@@ -188,6 +193,7 @@
         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 a6ae527..5ec447f 100644
--- a/src/com/android/gallery3d/app/SlideshowPage.java
+++ b/src/com/android/gallery3d/app/SlideshowPage.java
@@ -134,6 +134,7 @@
 
     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 @@
             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 @@
             return item;
         }
 
+        @Override
         public long reload() {
             long version = mMediaSet.reload();
             if (version != mSourceVersion) {
@@ -284,10 +288,12 @@
             }
         }
 
+        @Override
         public void addContentListener(ContentListener listener) {
             mMediaSet.addContentListener(listener);
         }
 
+        @Override
         public void removeContentListener(ContentListener listener) {
             mMediaSet.removeContentListener(listener);
         }
@@ -307,10 +313,12 @@
             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 @@
             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 @@
             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 1151dde..5bc6d67 100644
--- a/src/com/android/gallery3d/data/BitmapPool.java
+++ b/src/com/android/gallery3d/data/BitmapPool.java
@@ -23,6 +23,7 @@
 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 569e5a4..8681952 100644
--- a/src/com/android/gallery3d/data/ClusterAlbum.java
+++ b/src/com/android/gallery3d/data/ClusterAlbum.java
@@ -19,6 +19,7 @@
 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 @@
         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 @@
         return mDataVersion;
     }
 
+    @Override
     public void onContentDirty() {
         notifyContentChanged();
     }
@@ -123,6 +126,7 @@
     @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 863e94a..a32ba87 100644
--- a/src/com/android/gallery3d/data/ClusterAlbumSet.java
+++ b/src/com/android/gallery3d/data/ClusterAlbumSet.java
@@ -25,6 +25,7 @@
 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 @@
         return mDataVersion;
     }
 
+    @Override
     public void onContentDirty() {
         notifyContentChanged();
     }
@@ -125,6 +127,7 @@
     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 73c8ef3..e100dc3 100644
--- a/src/com/android/gallery3d/data/ComboAlbum.java
+++ b/src/com/android/gallery3d/data/ComboAlbum.java
@@ -24,6 +24,7 @@
 // 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 @@
         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 6d9a2a3..3f36745 100644
--- a/src/com/android/gallery3d/data/ComboAlbumSet.java
+++ b/src/com/android/gallery3d/data/ComboAlbumSet.java
@@ -24,6 +24,7 @@
 // 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 @@
         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 9ffdc0b..9485b02 100644
--- a/src/com/android/gallery3d/data/DataManager.java
+++ b/src/com/android/gallery3d/data/DataManager.java
@@ -88,6 +88,7 @@
             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 7505dac..be7820b 100644
--- a/src/com/android/gallery3d/data/DownloadCache.java
+++ b/src/com/android/gallery3d/data/DownloadCache.java
@@ -282,6 +282,7 @@
             mProxySet.add(proxy);
         }
 
+        @Override
         public void onFutureDone(Future<File> future) {
             File file = future.get();
             long id = 0;
@@ -310,6 +311,7 @@
             }
         }
 
+        @Override
         public File run(JobContext jc) {
             // TODO: utilize etag
             jc.setMode(ThreadPool.MODE_NETWORK);
@@ -345,6 +347,7 @@
 
         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 9e35c45..137898e 100644
--- a/src/com/android/gallery3d/data/DownloadUtils.java
+++ b/src/com/android/gallery3d/data/DownloadUtils.java
@@ -49,6 +49,7 @@
         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 29af27f..d2dc22b 100644
--- a/src/com/android/gallery3d/data/Face.java
+++ b/src/com/android/gallery3d/data/Face.java
@@ -58,6 +58,7 @@
         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 126286c..819915e 100644
--- a/src/com/android/gallery3d/data/FaceClustering.java
+++ b/src/com/android/gallery3d/data/FaceClustering.java
@@ -94,6 +94,7 @@
         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 dbd85d5..2738387 100644
--- a/src/com/android/gallery3d/data/FilterDeleteSet.java
+++ b/src/com/android/gallery3d/data/FilterDeleteSet.java
@@ -28,6 +28,7 @@
 // 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 b3e6ee3..e3f350f 100644
--- a/src/com/android/gallery3d/data/FilterSource.java
+++ b/src/com/android/gallery3d/data/FilterSource.java
@@ -19,6 +19,7 @@
 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 1983a39..477ef73 100644
--- a/src/com/android/gallery3d/data/FilterTypeSet.java
+++ b/src/com/android/gallery3d/data/FilterTypeSet.java
@@ -100,6 +100,7 @@
         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 @@
     @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 c432ab4..370ef26 100644
--- a/src/com/android/gallery3d/data/LocalImage.java
+++ b/src/com/android/gallery3d/data/LocalImage.java
@@ -218,6 +218,7 @@
             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 7a54e80..fdc973e 100644
--- a/src/com/android/gallery3d/data/LocalMediaItem.java
+++ b/src/com/android/gallery3d/data/LocalMediaItem.java
@@ -99,6 +99,7 @@
         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 6735b16..a2e3d14 100644
--- a/src/com/android/gallery3d/data/LocalSource.java
+++ b/src/com/android/gallery3d/data/LocalSource.java
@@ -245,6 +245,7 @@
 
     // 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 b36bd63..540322a 100644
--- a/src/com/android/gallery3d/data/LocationClustering.java
+++ b/src/com/android/gallery3d/data/LocationClustering.java
@@ -29,6 +29,7 @@
 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 @@
         // 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 @@
 
         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 c18365d..2982247 100644
--- a/src/com/android/gallery3d/data/MediaDetails.java
+++ b/src/com/android/gallery3d/data/MediaDetails.java
@@ -88,6 +88,7 @@
         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 67525b1..d5d1048 100644
--- a/src/com/android/gallery3d/data/MediaSet.java
+++ b/src/com/android/gallery3d/data/MediaSet.java
@@ -32,6 +32,7 @@
 // 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 @@
     }
 
     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 dd65f9e..737b5b6 100644
--- a/src/com/android/gallery3d/data/MtpClient.java
+++ b/src/com/android/gallery3d/data/MtpClient.java
@@ -179,7 +179,7 @@
      * 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 @@
     }
 
     /**
-     * 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 @@
     }
 
     /**
-     * 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 056211c..53b6faa 100644
--- a/src/com/android/gallery3d/data/MtpContext.java
+++ b/src/com/android/gallery3d/data/MtpContext.java
@@ -81,11 +81,13 @@
         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 1d0f88d..801a1d2 100644
--- a/src/com/android/gallery3d/data/MtpImage.java
+++ b/src/com/android/gallery3d/data/MtpImage.java
@@ -80,6 +80,7 @@
     @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 @@
     @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 aaf50ad..47a2e6c 100644
--- a/src/com/android/gallery3d/data/MtpSource.java
+++ b/src/com/android/gallery3d/data/MtpSource.java
@@ -19,6 +19,7 @@
 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 2dbe49d..0bde55e 100644
--- a/src/com/android/gallery3d/data/SizeClustering.java
+++ b/src/com/android/gallery3d/data/SizeClustering.java
@@ -53,6 +53,7 @@
         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 cd4f803..18905fb 100644
--- a/src/com/android/gallery3d/data/SnailAlbum.java
+++ b/src/com/android/gallery3d/data/SnailAlbum.java
@@ -21,6 +21,7 @@
 
 // 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 fdb1b0d..3586d2c 100644
--- a/src/com/android/gallery3d/data/SnailItem.java
+++ b/src/com/android/gallery3d/data/SnailItem.java
@@ -27,6 +27,7 @@
 // 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 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 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 5f663d2..7f971d3 100644
--- a/src/com/android/gallery3d/data/SnailSource.java
+++ b/src/com/android/gallery3d/data/SnailSource.java
@@ -18,6 +18,7 @@
 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 849f885..407ca84 100644
--- a/src/com/android/gallery3d/data/TagClustering.java
+++ b/src/com/android/gallery3d/data/TagClustering.java
@@ -43,6 +43,7 @@
         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 9a0ae1d..35cbab1 100644
--- a/src/com/android/gallery3d/data/TimeClustering.java
+++ b/src/com/android/gallery3d/data/TimeClustering.java
@@ -28,6 +28,7 @@
 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 @@
             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 @@
         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 b5bfe96..8fc873e 100644
--- a/src/com/android/gallery3d/data/UriImage.java
+++ b/src/com/android/gallery3d/data/UriImage.java
@@ -134,6 +134,7 @@
 
     private boolean prepareInputFile(JobContext jc) {
         jc.setCancelListener(new CancelListener() {
+            @Override
             public void onCancel() {
                 synchronized (this) {
                     notifyAll();
@@ -166,6 +167,7 @@
     }
 
     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 6ec41f6..4e94e8d 100644
--- a/src/com/android/gallery3d/gadget/LocalPhotoSource.java
+++ b/src/com/android/gallery3d/gadget/LocalPhotoSource.java
@@ -41,6 +41,7 @@
 
 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 @@
                 .registerContentObserver(CONTENT_URI, true, mContentObserver);
     }
 
+    @Override
     public void close() {
         mContext.getContentResolver().unregisterContentObserver(mContentObserver);
     }
@@ -152,6 +154,7 @@
         }
     }
 
+    @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 786092b..caeff2a 100644
--- a/src/com/android/gallery3d/gadget/MediaSetSource.java
+++ b/src/com/android/gallery3d/gadget/MediaSetSource.java
@@ -32,6 +32,7 @@
 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 83e37a6..334b15a 100644
--- a/src/com/android/gallery3d/gadget/WidgetService.java
+++ b/src/com/android/gallery3d/gadget/WidgetService.java
@@ -120,22 +120,27 @@
             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 @@
             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 4d85baa..0187cba 100644
--- a/src/com/android/gallery3d/onetimeinitializer/GalleryWidgetMigrator.java
+++ b/src/com/android/gallery3d/onetimeinitializer/GalleryWidgetMigrator.java
@@ -23,7 +23,6 @@
 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 80d2500..0b5cd54 100644
--- a/src/com/android/gallery3d/ui/ActionModeHandler.java
+++ b/src/com/android/gallery3d/ui/ActionModeHandler.java
@@ -51,6 +51,7 @@
 
 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 @@
         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 @@
         return true;
     }
 
+    @Override
     public void onDestroyActionMode(ActionMode mode) {
         mSelectionManager.leaveSelectionMode();
     }
 
+    @Override
     public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
         return true;
     }
@@ -291,6 +296,7 @@
         // 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 @@
                 // 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 7855927..784b499 100644
--- a/src/com/android/gallery3d/ui/BasicTexture.java
+++ b/src/com/android/gallery3d/ui/BasicTexture.java
@@ -87,10 +87,12 @@
         return mId;
     }
 
+    @Override
     public int getWidth() {
         return mWidth;
     }
 
+    @Override
     public int getHeight() {
         return mHeight;
     }
@@ -124,10 +126,12 @@
         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 0043e0c..6cb36b0 100644
--- a/src/com/android/gallery3d/ui/BitmapScreenNail.java
+++ b/src/com/android/gallery3d/ui/BitmapScreenNail.java
@@ -31,6 +31,7 @@
 // - 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 c65d77e..611648a 100644
--- a/src/com/android/gallery3d/ui/CacheStorageUsageInfo.java
+++ b/src/com/android/gallery3d/ui/CacheStorageUsageInfo.java
@@ -25,6 +25,7 @@
 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 24e8914..733c056 100644
--- a/src/com/android/gallery3d/ui/ColorTexture.java
+++ b/src/com/android/gallery3d/ui/ColorTexture.java
@@ -31,14 +31,17 @@
         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 @@
         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 78d5d37..8c2c3df 100644
--- a/src/com/android/gallery3d/ui/CropView.java
+++ b/src/com/android/gallery3d/ui/CropView.java
@@ -44,6 +44,7 @@
  * 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 f543923..3dd20a5 100644
--- a/src/com/android/gallery3d/ui/DetailsAddressResolver.java
+++ b/src/com/android/gallery3d/ui/DetailsAddressResolver.java
@@ -43,6 +43,7 @@
             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 @@
         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 c90ab40..a556600 100644
--- a/src/com/android/gallery3d/ui/DialogDetailsView.java
+++ b/src/com/android/gallery3d/ui/DialogDetailsView.java
@@ -59,15 +59,18 @@
         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 @@
             .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 @@
             .create();
 
         mDialog.setOnDismissListener(new OnDismissListener() {
+            @Override
             public void onDismiss(DialogInterface dialog) {
                 if (mListener != null) {
                     mListener.onClose();
@@ -198,18 +203,22 @@
             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 @@
             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 362b8fe..ed36973 100644
--- a/src/com/android/gallery3d/ui/EdgeEffect.java
+++ b/src/com/android/gallery3d/ui/EdgeEffect.java
@@ -51,6 +51,7 @@
  * {@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 bf97108..4aff049 100644
--- a/src/com/android/gallery3d/ui/EdgeView.java
+++ b/src/com/android/gallery3d/ui/EdgeView.java
@@ -21,6 +21,7 @@
 
 // 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 9319d8c..eac504f 100644
--- a/src/com/android/gallery3d/ui/ExtTexture.java
+++ b/src/com/android/gallery3d/ui/ExtTexture.java
@@ -77,6 +77,7 @@
         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 1cddcdb..6f98c64 100644
--- a/src/com/android/gallery3d/ui/FlingScroller.java
+++ b/src/com/android/gallery3d/ui/FlingScroller.java
@@ -26,6 +26,7 @@
 // (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 45ea058..7b7a317 100644
--- a/src/com/android/gallery3d/ui/GLCanvasImpl.java
+++ b/src/com/android/gallery3d/ui/GLCanvasImpl.java
@@ -92,6 +92,7 @@
         initialize();
     }
 
+    @Override
     public void setSize(int width, int height) {
         Utils.assertTrue(width >= 0 && height >= 0);
 
@@ -119,15 +120,18 @@
         }
     }
 
+    @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 @@
         // 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 @@
         mCountDrawLine++;
     }
 
+    @Override
     public void drawLine(float x1, float y1, float x2, float y2, GLPaint paint) {
         GL11 gl = mGL;
 
@@ -200,6 +206,7 @@
         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 @@
         mCountFillRect++;
     }
 
+    @Override
     public void translate(float x, float y, float z) {
         Matrix.translateM(mMatrixValues, 0, x, y, z);
     }
@@ -222,6 +230,7 @@
     // 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 @@
         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 @@
         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 @@
         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 @@
         }
     }
 
+    @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 @@
         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 @@
         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 @@
         }
     }
 
+    @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 @@
         }
     }
 
+    @Override
     public GL11 getGLInstance() {
         return mGL;
     }
 
+    @Override
     public void clearBuffer() {
         mGL.glClear(GL10.GL_COLOR_BUFFER_BIT);
     }
@@ -659,6 +678,7 @@
 
     // 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 @@
         }
     }
 
+    @Override
     public void deleteBuffer(int bufferId) {
         synchronized (mUnboundTextures) {
             mDeleteBuffers.add(bufferId);
         }
     }
 
+    @Override
     public void deleteRecycledResources() {
         synchronized (mUnboundTextures) {
             IntArray ids = mUnboundTextures;
@@ -689,10 +711,12 @@
         }
     }
 
+    @Override
     public void save() {
         save(SAVE_FLAG_ALL);
     }
 
+    @Override
     public void save(int saveFlags) {
         ConfigState config = obtainRestoreConfig();
 
@@ -712,6 +736,7 @@
         mRestoreStack.add(config);
     }
 
+    @Override
     public void restore() {
         if (mRestoreStack.isEmpty()) throw new IllegalStateException();
         ConfigState config = mRestoreStack.remove(mRestoreStack.size() - 1);
@@ -746,6 +771,7 @@
         }
     }
 
+    @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 0d5643f..7089d3c 100644
--- a/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java
+++ b/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java
@@ -39,6 +39,7 @@
             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 780c548..e4e0c49 100644
--- a/src/com/android/gallery3d/ui/GestureRecognizer.java
+++ b/src/com/android/gallery3d/ui/GestureRecognizer.java
@@ -25,6 +25,7 @@
 // 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 3619ca0..aaf5d39 100644
--- a/src/com/android/gallery3d/ui/MenuExecutor.java
+++ b/src/com/android/gallery3d/ui/MenuExecutor.java
@@ -380,6 +380,7 @@
             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 3b67a04..3bd0a21 100644
--- a/src/com/android/gallery3d/ui/Paper.java
+++ b/src/com/android/gallery3d/ui/Paper.java
@@ -25,6 +25,7 @@
 
 // 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 @@
 
 // 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 2525433..ec042da 100644
--- a/src/com/android/gallery3d/ui/PhotoView.java
+++ b/src/com/android/gallery3d/ui/PhotoView.java
@@ -539,7 +539,7 @@
         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 @@
                     || !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 dd9b7ce..fd16b35 100644
--- a/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
+++ b/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
@@ -19,12 +19,12 @@
 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 f5ea5d1..8c9836d 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.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 @@
     //    +-+----+----------------+-+--+----+-+------+--+-+
     //     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 @@
         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 0fe5067..bb86d05 100644
--- a/src/com/android/gallery3d/ui/UploadedTexture.java
+++ b/src/com/android/gallery3d/ui/UploadedTexture.java
@@ -318,6 +318,7 @@
         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 05198f4..3b73d34 100644
--- a/src/com/android/gallery3d/util/GalleryUtils.java
+++ b/src/com/android/gallery3d/util/GalleryUtils.java
@@ -164,6 +164,7 @@
     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 3bb3f8b..b71326a 100644
--- a/src/com/android/gallery3d/util/MediaSetUtils.java
+++ b/src/com/android/gallery3d/util/MediaSetUtils.java
@@ -50,6 +50,7 @@
 
     // 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 67b2152..30d8e4a 100644
--- a/src/com/android/gallery3d/util/PriorityThreadFactory.java
+++ b/src/com/android/gallery3d/util/PriorityThreadFactory.java
@@ -35,6 +35,7 @@
         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 6b6e5c3..7ed72c9 100644
--- a/src/com/android/gallery3d/util/Profile.java
+++ b/src/com/android/gallery3d/util/Profile.java
@@ -32,6 +32,7 @@
 // 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 @@
         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 02eb37a..a1bb8e1 100644
--- a/src/com/android/gallery3d/util/ProfileData.java
+++ b/src/com/android/gallery3d/util/ProfileData.java
@@ -31,6 +31,7 @@
 // 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 3df4c49..a8b26d9 100644
--- a/src/com/android/gallery3d/util/ReverseGeocoder.java
+++ b/src/com/android/gallery3d/util/ReverseGeocoder.java
@@ -35,6 +35,7 @@
 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 71bb3c5..4c077c8 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.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 @@
     }
 
     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 @@
         }
 
         // This is called by a thread in the thread pool.
+        @Override
         public void run() {
             T result = null;
 
@@ -137,6 +140,7 @@
         }
 
         // Below are the methods for Future.
+        @Override
         public synchronized void cancel() {
             if (mIsCancelled) return;
             mIsCancelled = true;
@@ -150,14 +154,17 @@
             }
         }
 
+        @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 @@
             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 @@
             }
         }
 
+        @Override
         public boolean setMode(int mode) {
             // Release old resource
             ResourceCounter rc = modeToCounter(mMode);
