Rename Gallery prefix to AlbumSet.

Change-Id: I67a2a968449ea9fb898c1cee60e3561ac4f1ca7a
diff --git a/new3d/src/com/android/gallery3d/app/GalleryDataAdapter.java b/new3d/src/com/android/gallery3d/app/AlbumSetDataAdapter.java
similarity index 94%
rename from new3d/src/com/android/gallery3d/app/GalleryDataAdapter.java
rename to new3d/src/com/android/gallery3d/app/AlbumSetDataAdapter.java
index 094ff8b..909c2b1 100644
--- a/new3d/src/com/android/gallery3d/app/GalleryDataAdapter.java
+++ b/new3d/src/com/android/gallery3d/app/AlbumSetDataAdapter.java
@@ -7,14 +7,14 @@
 
 import com.android.gallery3d.data.MediaItem;
 import com.android.gallery3d.data.MediaSet;
-import com.android.gallery3d.ui.GalleryView;
+import com.android.gallery3d.ui.AlbumSetView;
 import com.android.gallery3d.ui.SynchronizedHandler;
 import com.android.gallery3d.util.Utils;
 
 import java.util.ArrayList;
 
-public class GalleryDataAdapter implements GalleryView.Model {
-    private static final String TAG = "GalleryDataAdapter";
+public class AlbumSetDataAdapter implements AlbumSetView.Model {
+    private static final String TAG = "AlbumSetDataAdapter";
 
     private static final int UPDATE_LIMIT = 32;
     private static final int MAX_COVER_COUNT = 4;
@@ -35,12 +35,12 @@
     private final MediaSet mSource;
     private int mSize;
 
-    private GalleryView.ModelListener mListener;
+    private AlbumSetView.ModelListener mListener;
 
     private Handler mMainHandler;
     private Handler mDataHandler;
 
-    public GalleryDataAdapter(GalleryContext context, MediaSet albumSet, int cacheSize) {
+    public AlbumSetDataAdapter(GalleryContext context, MediaSet albumSet, int cacheSize) {
         albumSet.setContentListener(new MySourceListener());
 
         mSource = albumSet;
@@ -157,7 +157,7 @@
         }
     }
 
-    public void setListener(GalleryView.ModelListener listener) {
+    public void setListener(AlbumSetView.ModelListener listener) {
         mListener = listener;
     }
 
diff --git a/new3d/src/com/android/gallery3d/app/GalleryPage.java b/new3d/src/com/android/gallery3d/app/AlbumSetPage.java
similarity index 88%
rename from new3d/src/com/android/gallery3d/app/GalleryPage.java
rename to new3d/src/com/android/gallery3d/app/AlbumSetPage.java
index 3d6ac56..92cbbc2 100644
--- a/new3d/src/com/android/gallery3d/app/GalleryPage.java
+++ b/new3d/src/com/android/gallery3d/app/AlbumSetPage.java
@@ -26,20 +26,20 @@
 import com.android.gallery3d.data.MediaSet;
 import com.android.gallery3d.ui.AdaptiveBackground;
 import com.android.gallery3d.ui.GLView;
-import com.android.gallery3d.ui.GalleryView;
+import com.android.gallery3d.ui.AlbumSetView;
 import com.android.gallery3d.ui.HeadUpDisplay;
 import com.android.gallery3d.ui.SelectionManager;
 import com.android.gallery3d.ui.SlotView;
 import com.android.gallery3d.ui.SynchronizedHandler;
 
-public class GalleryPage extends ActivityState implements SlotView.SlotTapListener {
+public class AlbumSetPage extends ActivityState implements SlotView.SlotTapListener {
     private static final int CHANGE_BACKGROUND = 1;
 
     private static final int MARGIN_HUD_SLOTVIEW = 5;
     private static final int DATA_CACHE_SIZE = 256;
 
     private AdaptiveBackground mBackground;
-    private GalleryView mGalleryView;
+    private AlbumSetView mAlbumSetView;
     private HeadUpDisplay mHud;
     private SynchronizedHandler mHandler;
 
@@ -59,7 +59,7 @@
             int slotViewBottom = mHud.getBottomBarTopPosition()
                     - MARGIN_HUD_SLOTVIEW;
 
-            mGalleryView.layout(0, slotViewTop, right - left, slotViewBottom);
+            mAlbumSetView.layout(0, slotViewTop, right - left, slotViewBottom);
         }
     };
 
@@ -79,16 +79,16 @@
             mContext.getStateManager().startState(AlbumPage.class, data);
         } else {
             mSelectionManager.selectSlot(slotIndex);
-            mGalleryView.invalidate();
+            mAlbumSetView.invalidate();
         }
     }
 
     public void onLongTap(int slotIndex) {
         mSelectionManager.switchSelectionMode(slotIndex);
-        mGalleryView.invalidate();
+        mAlbumSetView.invalidate();
     }
 
-    public GalleryPage() {}
+    public AlbumSetPage() {}
 
     @Override
     public void onCreate(Bundle data, Bundle restoreState) {
@@ -121,8 +121,8 @@
 
     private void intializeData() {
         MediaSet mediaSet = mContext.getDataManager().getRootSet();
-        mGalleryView.setModel(
-                new GalleryDataAdapter(mContext, mediaSet, DATA_CACHE_SIZE));
+        mAlbumSetView.setModel(
+                new AlbumSetDataAdapter(mContext, mediaSet, DATA_CACHE_SIZE));
     }
 
     private void initializeViews() {
@@ -130,10 +130,10 @@
 
         mBackground = new AdaptiveBackground();
         mRootPane.addComponent(mBackground);
-        mGalleryView = new GalleryView(mContext, mSelectionManager);
-        mGalleryView.setSlotTapListener(this);
+        mAlbumSetView = new AlbumSetView(mContext, mSelectionManager);
+        mAlbumSetView.setSlotTapListener(this);
 
-        mRootPane.addComponent(mGalleryView);
+        mRootPane.addComponent(mAlbumSetView);
         mHud = new HeadUpDisplay(mContext.getAndroidContext());
         mRootPane.addComponent(mHud);
 
diff --git a/new3d/src/com/android/gallery3d/app/Gallery.java b/new3d/src/com/android/gallery3d/app/Gallery.java
index 8df1263..4ba3f49 100644
--- a/new3d/src/com/android/gallery3d/app/Gallery.java
+++ b/new3d/src/com/android/gallery3d/app/Gallery.java
@@ -53,7 +53,7 @@
         if (savedInstanceState != null) {
             getStateManager().restoreFromState(savedInstanceState);
         } else {
-            getStateManager().startState(GalleryPage.class, new Bundle());
+            getStateManager().startState(AlbumSetPage.class, new Bundle());
         }
     }
 
diff --git a/new3d/src/com/android/gallery3d/ui/GallerySlidingWindow.java b/new3d/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java
similarity index 91%
rename from new3d/src/com/android/gallery3d/ui/GallerySlidingWindow.java
rename to new3d/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java
index ce8e282..f37e878 100644
--- a/new3d/src/com/android/gallery3d/ui/GallerySlidingWindow.java
+++ b/new3d/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java
@@ -23,11 +23,11 @@
 
 import com.android.gallery3d.app.GalleryContext;
 import com.android.gallery3d.data.MediaItem;
-import com.android.gallery3d.ui.GalleryView.GalleryItem;
+import com.android.gallery3d.ui.AlbumSetView.AlbumSetItem;
 import com.android.gallery3d.util.Future;
 import com.android.gallery3d.util.Utils;
 
-public class GallerySlidingWindow implements GalleryView.ModelListener {
+public class AlbumSetSlidingWindow implements AlbumSetView.ModelListener {
     private static final String TAG = "GallerySlidingWindow";
     private static final int MSG_UPDATE_IMAGE = 0;
 
@@ -35,10 +35,10 @@
         public void onSizeChanged(int size);
         public void onContentInvalidated();
         public void onWindowContentChanged(
-                int slot, GalleryItem old, GalleryItem update);
+                int slot, AlbumSetItem old, AlbumSetItem update);
     }
 
-    private final GalleryView.Model mSource;
+    private final AlbumSetView.Model mSource;
     private int mSize;
 
     private int mContentStart = 0;
@@ -49,7 +49,7 @@
 
     private Listener mListener;
 
-    private final GalleryItem mData[];
+    private final AlbumSetItem mData[];
     private final SelectionManager mSelectionManager;
     private final ColorTexture mWaitLoadingTexture;
 
@@ -57,12 +57,12 @@
 
     private int mActiveRequestCount = 0;
 
-    public GallerySlidingWindow(GalleryContext context,
-            SelectionManager manager, GalleryView.Model source, int cacheSize) {
+    public AlbumSetSlidingWindow(GalleryContext context,
+            SelectionManager manager, AlbumSetView.Model source, int cacheSize) {
         source.setListener(this);
         mSource = source;
         mSelectionManager = manager;
-        mData = new GalleryItem[cacheSize];
+        mData = new AlbumSetItem[cacheSize];
         mSize = source.size();
 
         mWaitLoadingTexture = new ColorTexture(Color.GRAY);
@@ -82,7 +82,7 @@
         mListener = listener;
     }
 
-    public GalleryItem get(int slotIndex) {
+    public AlbumSetItem get(int slotIndex) {
         if (!isActiveSlot(slotIndex)) {
             throw new IllegalArgumentException(
                     String.format("invalid slot: %s outsides (%s, %s)",
@@ -133,7 +133,7 @@
     public void setActiveWindow(int start, int end) {
         Utils.Assert(start <= end
                 && end - start <= mData.length && end <= mSize);
-        GalleryItem data[] = mData;
+        AlbumSetItem data[] = mData;
 
         mActiveStart = start;
         mActiveEnd = end;
@@ -173,7 +173,7 @@
 
     private void requestImagesInSlot(int slotIndex) {
         if (slotIndex < mContentStart || slotIndex >= mContentEnd) return;
-        GalleryItem items = mData[slotIndex % mData.length];
+        AlbumSetItem items = mData[slotIndex % mData.length];
         for (DisplayItem item : items.covers) {
             ((GalleryDisplayItem) item).requestImage();
         }
@@ -181,16 +181,16 @@
 
     private void cancelImagesInSlot(int slotIndex) {
         if (slotIndex < mContentStart || slotIndex >= mContentEnd) return;
-        GalleryItem items = mData[slotIndex % mData.length];
+        AlbumSetItem items = mData[slotIndex % mData.length];
         for (DisplayItem item : items.covers) {
             ((GalleryDisplayItem) item).cancelImageRequest();
         }
     }
 
     private void freeSlotContent(int slotIndex) {
-        GalleryItem data[] = mData;
+        AlbumSetItem data[] = mData;
         int index = slotIndex % data.length;
-        GalleryItem original = data[index];
+        AlbumSetItem original = data[index];
         if (original != null) {
             data[index] = null;
             for (DisplayItem item : original.covers) {
@@ -200,7 +200,7 @@
     }
 
     private void prepareSlotContent(final int slotIndex) {
-        GalleryItem item = new GalleryItem();
+        AlbumSetItem item = new AlbumSetItem();
         MediaItem[] coverItems = mSource.get(slotIndex);
         item.covers = new GalleryDisplayItem[coverItems.length];
         for (int i = 0; i < coverItems.length; ++i) {
@@ -210,11 +210,11 @@
     }
 
     private void updateSlotContent(final int slotIndex) {
-        GalleryItem data[] = mData;
+        AlbumSetItem data[] = mData;
 
         int index = slotIndex % data.length;
-        GalleryItem original = data[index];
-        GalleryItem update = new GalleryItem();
+        AlbumSetItem original = data[index];
+        AlbumSetItem update = new AlbumSetItem();
         data[index] = update;
 
         MediaItem[] coverItems = mSource.get(slotIndex);
@@ -304,8 +304,8 @@
             int width = mContent.getWidth();
             int height = mContent.getHeight();
 
-            float scalex = GalleryView.SLOT_WIDTH / (float) width;
-            float scaley = GalleryView.SLOT_HEIGHT / (float) height;
+            float scalex = AlbumSetView.SLOT_WIDTH / (float) width;
+            float scaley = AlbumSetView.SLOT_HEIGHT / (float) height;
             float scale = Math.min(scalex, scaley);
 
             width = (int) Math.floor(width * scale);
diff --git a/new3d/src/com/android/gallery3d/ui/GalleryView.java b/new3d/src/com/android/gallery3d/ui/AlbumSetView.java
similarity index 89%
rename from new3d/src/com/android/gallery3d/ui/GalleryView.java
rename to new3d/src/com/android/gallery3d/ui/AlbumSetView.java
index 2f89aab..1a19e3d 100644
--- a/new3d/src/com/android/gallery3d/ui/GalleryView.java
+++ b/new3d/src/com/android/gallery3d/ui/AlbumSetView.java
@@ -25,8 +25,8 @@
 
 import java.util.Random;
 
-public class GalleryView extends SlotView {
-    private static final String TAG = "GalleryView";
+public class AlbumSetView extends SlotView {
+    private static final String TAG = "AlbumSetView";
     private static final int CACHE_SIZE = 32;
 
     static final int SLOT_WIDTH = 144;
@@ -40,7 +40,7 @@
     private Random mRandom = new Random();
     private long mSeed = mRandom.nextLong();
 
-    private GallerySlidingWindow mDataWindow;
+    private AlbumSetSlidingWindow mDataWindow;
     private final GalleryContext mContext;
     private final SelectionManager mSelectionManager;
 
@@ -57,11 +57,11 @@
         public void onSizeChanged(int size);
     }
 
-    public static class GalleryItem {
+    public static class AlbumSetItem {
         public DisplayItem[] covers;
     }
 
-    public GalleryView(GalleryContext context, SelectionManager selectionManager) {
+    public AlbumSetView(GalleryContext context, SelectionManager selectionManager) {
         super(context.getAndroidContext(), context.getPositionRepository());
         mContext = context;
         mSelectionManager = selectionManager;
@@ -69,7 +69,7 @@
         setSlotGaps(HORIZONTAL_GAP, VERTICAL_GAP, false);
     }
 
-    public void setModel(GalleryView.Model model) {
+    public void setModel(AlbumSetView.Model model) {
 
         if (mDataWindow != null) {
             mDataWindow.setListener(null);
@@ -77,7 +77,7 @@
             mDataWindow = null;
         }
         if (model != null) {
-            mDataWindow = new GallerySlidingWindow(
+            mDataWindow = new AlbumSetSlidingWindow(
                         mContext, mSelectionManager, model, CACHE_SIZE);
             mDataWindow.setListener(new MyCacheListener());
             setSlotCount(mDataWindow.size());
@@ -85,7 +85,7 @@
         }
     }
 
-    private void putSlotContent(int slotIndex, GalleryItem entry) {
+    private void putSlotContent(int slotIndex, AlbumSetItem entry) {
         // Get displayItems from mItemsetMap or create them from MediaSet.
         Utils.Assert(entry != null);
         Rect rect = getSlotRect(slotIndex);
@@ -121,7 +121,7 @@
         }
     }
 
-    private void freeSlotContent(int index, GalleryItem entry) {
+    private void freeSlotContent(int index, AlbumSetItem entry) {
         if (entry == null) return;
         for (DisplayItem item : entry.covers) {
             removeDisplayItem(item);
@@ -174,14 +174,14 @@
         invalidate();
     }
 
-    private class MyCacheListener implements GallerySlidingWindow.Listener {
+    private class MyCacheListener implements AlbumSetSlidingWindow.Listener {
 
         public void onSizeChanged(int size) {
             setSlotCount(size);
             updateVisibleRange(getVisibleStart(), getVisibleEnd());
         }
 
-        public void onWindowContentChanged(int slot, GalleryItem old, GalleryItem update) {
+        public void onWindowContentChanged(int slot, AlbumSetItem old, AlbumSetItem update) {
             freeSlotContent(slot, old);
             putSlotContent(slot, update);
             invalidate();