diff options
author | Chih-Chung Chang <chihchung@google.com> | 2012-04-02 17:31:55 +0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2012-04-02 18:48:58 +0800 |
commit | 2415a060b1cf69f5820e8d4d5c9954271cad2cd6 (patch) | |
tree | fec5fd132e151dcfd89c95c48c615a527a0fddd6 /src/com/android/gallery3d | |
parent | 948b5ffc4c004b6e4daf18f64165fb555bc4d6b2 (diff) | |
download | android_packages_apps_Snap-2415a060b1cf69f5820e8d4d5c9954271cad2cd6.tar.gz android_packages_apps_Snap-2415a060b1cf69f5820e8d4d5c9954271cad2cd6.tar.bz2 android_packages_apps_Snap-2415a060b1cf69f5820e8d4d5c9954271cad2cd6.zip |
Remove FilmStripView.
Change-Id: I45cee8c32863cc65eba4c5e83e667e104cf24e42
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r-- | src/com/android/gallery3d/app/AlbumPage.java | 3 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/Config.java | 36 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/PhotoDataAdapter.java | 5 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/PhotoPage.java | 50 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/SinglePhotoDataAdapter.java | 4 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/AlbumSlidingWindow.java | 47 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/AlbumView.java | 8 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/FilmStripView.java | 261 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/PhotoView.java | 7 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/StripDrawer.java | 73 |
10 files changed, 9 insertions, 485 deletions
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index ba2119842..43936e746 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -351,8 +351,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster mGridDrawer = new GridDrawer((Context) mActivity, mSelectionManager); Config.AlbumPage config = Config.AlbumPage.get((Context) mActivity); mSlotView = new SlotView((Context) mActivity, config.slotViewSpec); - mAlbumView = new AlbumView( - mActivity, mSlotView, 0/* don't cache thumbnail */); + mAlbumView = new AlbumView(mActivity, mSlotView); mSlotView.setSlotRenderer(mAlbumView); mAlbumView.setSelectionDrawer(mGridDrawer); mRootPane.addComponent(mSlotView); diff --git a/src/com/android/gallery3d/app/Config.java b/src/com/android/gallery3d/app/Config.java index 3cc045ccd..46ea7c89f 100644 --- a/src/com/android/gallery3d/app/Config.java +++ b/src/com/android/gallery3d/app/Config.java @@ -105,41 +105,5 @@ final class Config { cachePinMargin = r.getDimensionPixelSize(R.dimen.cache_pin_margin); } } - - public static class PhotoPage { - private static PhotoPage sInstance; - - // These are all height values. See the comment in FilmStripView for - // the meaning of these values. - public final int filmstripTopMargin; - public final int filmstripMidMargin; - public final int filmstripBottomMargin; - public final int filmstripThumbSize; - public final int filmstripContentSize; - public final int filmstripGripSize; - public final int filmstripBarSize; - - // These are width values. - public final int filmstripGripWidth; - - public static synchronized PhotoPage get(Context context) { - if (sInstance == null) { - sInstance = new PhotoPage(context); - } - return sInstance; - } - - public PhotoPage(Context context) { - Resources r = context.getResources(); - filmstripTopMargin = r.getDimensionPixelSize(R.dimen.filmstrip_top_margin); - filmstripMidMargin = r.getDimensionPixelSize(R.dimen.filmstrip_mid_margin); - filmstripBottomMargin = r.getDimensionPixelSize(R.dimen.filmstrip_bottom_margin); - filmstripThumbSize = r.getDimensionPixelSize(R.dimen.filmstrip_thumb_size); - filmstripContentSize = r.getDimensionPixelSize(R.dimen.filmstrip_content_size); - filmstripGripSize = r.getDimensionPixelSize(R.dimen.filmstrip_grip_size); - filmstripBarSize = r.getDimensionPixelSize(R.dimen.filmstrip_bar_size); - filmstripGripWidth = r.getDimensionPixelSize(R.dimen.filmstrip_grip_width); - } - } } diff --git a/src/com/android/gallery3d/app/PhotoDataAdapter.java b/src/com/android/gallery3d/app/PhotoDataAdapter.java index 109323c1c..f4bf5a57c 100644 --- a/src/com/android/gallery3d/app/PhotoDataAdapter.java +++ b/src/com/android/gallery3d/app/PhotoDataAdapter.java @@ -336,11 +336,6 @@ public class PhotoDataAdapter implements PhotoPage.Model { updateCurrentIndex(mCurrentIndex - 1); } - public void jumpTo(int index) { - if (mCurrentIndex == index) return; - updateCurrentIndex(index); - } - public ScreenNail getScreenNail() { return mTileProvider.getScreenNail(); } diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 050fad437..e16ac8a3e 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -50,7 +50,6 @@ import com.android.gallery3d.picasasource.PicasaSource; import com.android.gallery3d.ui.DetailsHelper; import com.android.gallery3d.ui.DetailsHelper.CloseListener; import com.android.gallery3d.ui.DetailsHelper.DetailsSource; -import com.android.gallery3d.ui.FilmStripView; import com.android.gallery3d.ui.GLCanvas; import com.android.gallery3d.ui.GLView; import com.android.gallery3d.ui.ImportCompleteListener; @@ -64,8 +63,7 @@ import com.android.gallery3d.ui.UserInteractionListener; import com.android.gallery3d.util.GalleryUtils; public class PhotoPage extends ActivityState - implements PhotoView.PhotoTapListener, FilmStripView.Listener, - UserInteractionListener { + implements PhotoView.PhotoTapListener, UserInteractionListener { private static final String TAG = "PhotoPage"; private static final int MSG_HIDE_BARS = 1; @@ -87,7 +85,6 @@ public class PhotoPage extends ActivityState private PhotoView mPhotoView; private PhotoPage.Model mModel; - private FilmStripView mFilmStripView; private DetailsHelper mDetailsHelper; private boolean mShowDetails; private Path mPendingSharePath; @@ -140,37 +137,12 @@ public class PhotoPage extends ActivityState protected void onLayout( boolean changed, int left, int top, int right, int bottom) { mPhotoView.layout(0, 0, right - left, bottom - top); - int filmStripHeight = 0; - if (mFilmStripView != null) { - mFilmStripView.measure( - MeasureSpec.makeMeasureSpec(right - left, MeasureSpec.EXACTLY), - MeasureSpec.UNSPECIFIED); - filmStripHeight = mFilmStripView.getMeasuredHeight(); - mFilmStripView.layout(0, bottom - top - filmStripHeight, - right - left, bottom - top); - } if (mShowDetails) { mDetailsHelper.layout(left, mActionBar.getHeight(), right, bottom); } } }; - private void initFilmStripView() { - Config.PhotoPage config = Config.PhotoPage.get((Context) mActivity); - mFilmStripView = new FilmStripView(mActivity, mMediaSet, - config.filmstripTopMargin, config.filmstripMidMargin, config.filmstripBottomMargin, - config.filmstripContentSize, config.filmstripThumbSize, config.filmstripBarSize, - config.filmstripGripSize, config.filmstripGripWidth); - mRootPane.addComponent(mFilmStripView); - mFilmStripView.setListener(this); - mFilmStripView.setUserInteractionListener(this); - mFilmStripView.setFocusIndex(mCurrentIndex); - mFilmStripView.setStartIndex(mCurrentIndex); - mRootPane.requestLayout(); - if (mIsActive) mFilmStripView.resume(); - if (!mShowBars) mFilmStripView.setVisibility(GLView.INVISIBLE); - } - @Override public void onCreate(Bundle data, Bundle restoreState) { mActionBar = mActivity.getGalleryActionBar(); @@ -223,7 +195,6 @@ public class PhotoPage extends ActivityState @Override public void onPhotoChanged(int index, Path item) { - if (mFilmStripView != null) mFilmStripView.setFocusIndex(index); mCurrentIndex = index; mResultIntent.putExtra(KEY_INDEX_HINT, index); if (item != null) { @@ -254,7 +225,6 @@ public class PhotoPage extends ActivityState @Override public void onPhotoAvailable(long version, boolean fullImage) { - if (mFilmStripView == null) initFilmStripView(); } }); } else { @@ -362,9 +332,6 @@ public class PhotoPage extends ActivityState WindowManager.LayoutParams params = ((Activity) mActivity).getWindow().getAttributes(); params.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE; ((Activity) mActivity).getWindow().setAttributes(params); - if (mFilmStripView != null) { - mFilmStripView.show(); - } } private void hideBars() { @@ -374,9 +341,6 @@ public class PhotoPage extends ActivityState WindowManager.LayoutParams params = ((Activity) mActivity).getWindow().getAttributes(); params.systemUiVisibility = View. SYSTEM_UI_FLAG_LOW_PROFILE; ((Activity) mActivity).getWindow().setAttributes(params); - if (mFilmStripView != null) { - mFilmStripView.hide(); - } } private void refreshHidingMessage() { @@ -580,12 +544,6 @@ public class PhotoPage extends ActivityState } } - // Called by FileStripView. - // Returns false if it cannot jump to the specified index at this time. - public boolean onSlotSelected(int slotIndex) { - return mPhotoView.jumpTo(slotIndex); - } - @Override protected void onStateResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { @@ -622,9 +580,6 @@ public class PhotoPage extends ActivityState public void onPause() { super.onPause(); mIsActive = false; - if (mFilmStripView != null) { - mFilmStripView.pause(); - } DetailsHelper.pause(); mPhotoView.pause(); mModel.pause(); @@ -641,9 +596,6 @@ public class PhotoPage extends ActivityState mModel.resume(); mPhotoView.resume(); - if (mFilmStripView != null) { - mFilmStripView.resume(); - } if (mMenuVisibilityListener == null) { mMenuVisibilityListener = new MyMenuVisibilityListener(); } diff --git a/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java b/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java index 66e7c20df..ad0d31a7d 100644 --- a/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java +++ b/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java @@ -174,10 +174,6 @@ public class SinglePhotoDataAdapter extends TileImageViewAdapter throw new UnsupportedOperationException(); } - public void jumpTo(int index) { - throw new UnsupportedOperationException(); - } - public MediaItem getCurrentMediaItem() { return mItem; } diff --git a/src/com/android/gallery3d/ui/AlbumSlidingWindow.java b/src/com/android/gallery3d/ui/AlbumSlidingWindow.java index 056bb5a51..b196e7e4d 100644 --- a/src/com/android/gallery3d/ui/AlbumSlidingWindow.java +++ b/src/com/android/gallery3d/ui/AlbumSlidingWindow.java @@ -22,7 +22,6 @@ import android.util.FloatMath; import com.android.gallery3d.app.GalleryActivity; import com.android.gallery3d.common.BitmapUtils; -import com.android.gallery3d.common.LruCache; import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.data.Path; @@ -69,12 +68,8 @@ public class AlbumSlidingWindow implements AlbumView.ModelListener { private int mActiveRequestCount = 0; private boolean mIsActive = false; - private int mCacheThumbSize; // 0: Don't cache the thumbnails - private LruCache<Path, Bitmap> mImageCache = new LruCache<Path, Bitmap>(1000); - public AlbumSlidingWindow(GalleryActivity activity, - AlbumView.Model source, int cacheSize, - int cacheThumbSize) { + AlbumView.Model source, int cacheSize) { source.setModelListener(this); mSource = source; mData = new AlbumDisplayItem[cacheSize]; @@ -82,7 +77,6 @@ public class AlbumSlidingWindow implements AlbumView.ModelListener { mWaitLoadingTexture = new ColorTexture(PLACEHOLDER_COLOR); mWaitLoadingTexture.setSize(1, 1); - mCacheThumbSize = cacheThumbSize; mHandler = new SynchronizedHandler(activity.getGLRoot()) { @Override @@ -273,7 +267,7 @@ public class AlbumSlidingWindow implements AlbumView.ModelListener { } private class AlbumDisplayItem extends AbstractDisplayItem - implements FutureListener<Bitmap>, Job<Bitmap> { + implements FutureListener<Bitmap> { private Future<Bitmap> mFuture; private final int mSlotIndex; private final int mMediaType; @@ -293,11 +287,7 @@ public class AlbumSlidingWindow implements AlbumView.ModelListener { @Override protected void recycleBitmap(Bitmap bitmap) { - // if mCacheThumbSize > 0, we will keep images in cache so that - // we cannot recycle the bitmap - if (mCacheThumbSize == 0) { - BitmapPool.recycle(BitmapPool.TYPE_MICRO_THUMB, bitmap); - } + BitmapPool.recycle(BitmapPool.TYPE_MICRO_THUMB, bitmap); } @Override @@ -364,30 +354,8 @@ public class AlbumSlidingWindow implements AlbumView.ModelListener { @Override public void startLoadBitmap() { - if (mCacheThumbSize > 0) { - Path path = mMediaItem.getPath(); - if (mImageCache.containsKey(path)) { - Bitmap bitmap = mImageCache.get(path); - updateImage(bitmap, false); - return; - } - mFuture = mThreadPool.submit(this, this); - } else { - mFuture = mThreadPool.submit(mMediaItem.requestImage( - MediaItem.TYPE_MICROTHUMBNAIL), this); - } - } - - // This gets the bitmap and scale it down. - public Bitmap run(JobContext jc) { - Job<Bitmap> job = mMediaItem.requestImage( - MediaItem.TYPE_MICROTHUMBNAIL); - Bitmap bitmap = job.run(jc); - if (bitmap != null) { - bitmap = BitmapUtils.resizeDownBySideLength( - bitmap, mCacheThumbSize, true); - } - return bitmap; + mFuture = mThreadPool.submit(mMediaItem.requestImage( + MediaItem.TYPE_MICROTHUMBNAIL), this); } @Override @@ -407,10 +375,6 @@ public class AlbumSlidingWindow implements AlbumView.ModelListener { mFuture = null; Bitmap bitmap = future.get(); boolean isCancelled = future.isCancelled(); - if (mCacheThumbSize > 0 && (bitmap != null || !isCancelled)) { - Path path = mMediaItem.getPath(); - mImageCache.put(path, bitmap); - } updateImage(bitmap, isCancelled); } @@ -446,6 +410,5 @@ public class AlbumSlidingWindow implements AlbumView.ModelListener { for (int i = mContentStart, n = mContentEnd; i < n; ++i) { freeSlotContent(i); } - mImageCache.clear(); } } diff --git a/src/com/android/gallery3d/ui/AlbumView.java b/src/com/android/gallery3d/ui/AlbumView.java index bf07ab2b1..1e7b247c6 100644 --- a/src/com/android/gallery3d/ui/AlbumView.java +++ b/src/com/android/gallery3d/ui/AlbumView.java @@ -27,7 +27,6 @@ public class AlbumView implements SlotView.SlotRenderer { private AlbumSlidingWindow mDataWindow; private final GalleryActivity mActivity; private SelectionDrawer mSelectionDrawer; - private int mCacheThumbSize; private final SlotView mSlotView; @@ -43,9 +42,7 @@ public class AlbumView implements SlotView.SlotRenderer { public void onSizeChanged(int size); } - public AlbumView(GalleryActivity activity, SlotView slotView, - int cacheThumbSize) { - mCacheThumbSize = cacheThumbSize; + public AlbumView(GalleryActivity activity, SlotView slotView) { mSlotView = slotView; mActivity = activity; } @@ -63,8 +60,7 @@ public class AlbumView implements SlotView.SlotRenderer { } if (model != null) { mDataWindow = new AlbumSlidingWindow( - mActivity, model, CACHE_SIZE, - mCacheThumbSize); + mActivity, model, CACHE_SIZE); mDataWindow.setSelectionDrawer(mSelectionDrawer); mDataWindow.setListener(new MyDataModelListener()); mSlotView.setSlotCount(model.size()); diff --git a/src/com/android/gallery3d/ui/FilmStripView.java b/src/com/android/gallery3d/ui/FilmStripView.java deleted file mode 100644 index 6f339e2a9..000000000 --- a/src/com/android/gallery3d/ui/FilmStripView.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.gallery3d.ui; - -import android.content.Context; -import android.view.MotionEvent; -import android.view.View.MeasureSpec; - -import com.android.gallery3d.R; -import com.android.gallery3d.anim.AlphaAnimation; -import com.android.gallery3d.app.AlbumDataAdapter; -import com.android.gallery3d.app.GalleryActivity; -import com.android.gallery3d.data.MediaItem; -import com.android.gallery3d.data.MediaSet; -import com.android.gallery3d.data.Path; - -public class FilmStripView extends GLView implements UserInteractionListener { - @SuppressWarnings("unused") - private static final String TAG = "FilmStripView"; - - private static final int HIDE_ANIMATION_DURATION = 300; // 0.3 sec - - public interface Listener { - // Returns false if it cannot jump to the specified index at this time. - boolean onSlotSelected(int slotIndex); - } - - private int mTopMargin, mMidMargin, mBottomMargin; - private int mContentSize, mBarSize, mGripSize; - private AlbumView mAlbumView; - private SlotView mSlotView; - private ScrollBarView mScrollBarView; - private AlbumDataAdapter mAlbumDataAdapter; - private StripDrawer mStripDrawer; - private Listener mListener; - private UserInteractionListener mUIListener; - private NinePatchTexture mBackgroundTexture; - - // The layout of FileStripView is - // topMargin - // ----+----+ - // / +----+--\ - // contentSize | | thumbSize - // \ +----+--/ - // ----+----+ - // midMargin - // ----+----+ - // / +----+--\ - // barSize | | gripSize - // \ +----+--/ - // ----+----+ - // bottomMargin - public FilmStripView(GalleryActivity activity, MediaSet mediaSet, - int topMargin, int midMargin, int bottomMargin, int contentSize, - int thumbSize, int barSize, int gripSize, int gripWidth) { - mTopMargin = topMargin; - mMidMargin = midMargin; - mBottomMargin = bottomMargin; - mContentSize = contentSize; - mBarSize = barSize; - mGripSize = gripSize; - - mStripDrawer = new StripDrawer((Context) activity); - SlotView.Spec spec = new SlotView.Spec(); - spec.slotWidth = thumbSize; - spec.slotHeight = thumbSize; - mSlotView = new SlotView((Context) activity, spec); - mAlbumView = new AlbumView(activity, mSlotView, thumbSize); - mSlotView.setSlotRenderer(mAlbumView); - mSlotView.setOverscrollEffect(SlotView.OVERSCROLL_NONE); - mAlbumView.setSelectionDrawer(mStripDrawer); - mSlotView.setListener(new SlotView.SimpleListener() { - @Override - public void onDown(int index) { - FilmStripView.this.onDown(index); - } - @Override - public void onUp() { - FilmStripView.this.onUp(); - } - @Override - public void onSingleTapUp(int slotIndex) { - FilmStripView.this.onSingleTapUp(slotIndex); - } - @Override - public void onLongTap(int slotIndex) { - FilmStripView.this.onLongTap(slotIndex); - } - @Override - public void onScrollPositionChanged(int position, int total) { - FilmStripView.this.onScrollPositionChanged(position, total); - } - }); - mSlotView.setUserInteractionListener(this); - mAlbumDataAdapter = new AlbumDataAdapter(activity, mediaSet); - addComponent(mSlotView); - mScrollBarView = new ScrollBarView(activity.getAndroidContext(), - mGripSize, gripWidth); - addComponent(mScrollBarView); - - mAlbumView.setModel(mAlbumDataAdapter); - mBackgroundTexture = new NinePatchTexture(activity.getAndroidContext(), - R.drawable.navstrip_translucent); - } - - public void setListener(Listener listener) { - mListener = listener; - } - - public void setUserInteractionListener(UserInteractionListener listener) { - mUIListener = listener; - } - - public void show() { - if (getVisibility() == GLView.VISIBLE) return; - startAnimation(null); - setVisibility(GLView.VISIBLE); - } - - public void hide() { - if (getVisibility() == GLView.INVISIBLE) return; - AlphaAnimation animation = new AlphaAnimation(1, 0); - animation.setDuration(HIDE_ANIMATION_DURATION); - startAnimation(animation); - setVisibility(GLView.INVISIBLE); - } - - @Override - protected void onVisibilityChanged(int visibility) { - super.onVisibilityChanged(visibility); - if (visibility == GLView.VISIBLE) { - onUserInteraction(); - } - } - - @Override - protected void onMeasure(int widthSpec, int heightSpec) { - int height = mTopMargin + mContentSize + mMidMargin + mBarSize + mBottomMargin; - MeasureHelper.getInstance(this) - .setPreferredContentSize(MeasureSpec.getSize(widthSpec), height) - .measure(widthSpec, heightSpec); - } - - @Override - protected void onLayout( - boolean changed, int left, int top, int right, int bottom) { - if (!changed) return; - mSlotView.layout(0, mTopMargin, right - left, mTopMargin + mContentSize); - int barStart = mTopMargin + mContentSize + mMidMargin; - mScrollBarView.layout(0, barStart, right - left, barStart + mBarSize); - int width = right - left; - int height = bottom - top; - } - - @Override - protected boolean onTouch(MotionEvent event) { - // consume all touch events on the "gray area", so they don't go to - // the photo view below. (otherwise you can scroll the picture through - // it). - return true; - } - - @Override - protected boolean dispatchTouchEvent(MotionEvent event) { - switch (event.getAction()) { - case MotionEvent.ACTION_DOWN: - case MotionEvent.ACTION_MOVE: - onUserInteractionBegin(); - break; - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_CANCEL: - onUserInteractionEnd(); - break; - } - - return super.dispatchTouchEvent(event); - } - - @Override - protected void render(GLCanvas canvas) { - mBackgroundTexture.draw(canvas, 0, 0, getWidth(), getHeight()); - super.render(canvas); - } - - private void onDown(int index) { - MediaItem item = mAlbumDataAdapter.get(index); - Path path = (item == null) ? null : item.getPath(); - mStripDrawer.setPressedPath(path); - mSlotView.invalidate(); - } - - private void onUp() { - mStripDrawer.setPressedPath(null); - mSlotView.invalidate(); - } - - private void onSingleTapUp(int slotIndex) { - if (mListener.onSlotSelected(slotIndex)) { - mAlbumView.setFocusIndex(slotIndex); - } - } - - private void onLongTap(int slotIndex) { - onSingleTapUp(slotIndex); - } - - private void onScrollPositionChanged(int position, int total) { - mScrollBarView.setContentPosition(position, total); - } - - // Called by AlbumView - @Override - public void onUserInteractionBegin() { - mUIListener.onUserInteractionBegin(); - } - - // Called by AlbumView - @Override - public void onUserInteractionEnd() { - mUIListener.onUserInteractionEnd(); - } - - // Called by AlbumView - @Override - public void onUserInteraction() { - mUIListener.onUserInteraction(); - } - - public void setFocusIndex(int slotIndex) { - mAlbumView.setFocusIndex(slotIndex); - mSlotView.makeSlotVisible(slotIndex); - } - - public void setStartIndex(int slotIndex) { - mSlotView.setStartIndex(slotIndex); - } - - public void pause() { - mAlbumView.pause(); - mAlbumDataAdapter.pause(); - } - - public void resume() { - mAlbumView.resume(); - mAlbumDataAdapter.resume(); - } -} diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java index 77e3d99e7..4bd4f3a75 100644 --- a/src/com/android/gallery3d/ui/PhotoView.java +++ b/src/com/android/gallery3d/ui/PhotoView.java @@ -621,12 +621,6 @@ public class PhotoView extends GLView { } } - public boolean jumpTo(int index) { - if (mTransitionMode != TRANS_NONE) return false; - mModel.jumpTo(index); - return true; - } - public void notifyOnNewImage() { mPositionController.setImageSize(0, 0); } @@ -688,7 +682,6 @@ public class PhotoView extends GLView { public static interface Model extends TileImageView.Model { public void next(); public void previous(); - public void jumpTo(int index); public int getImageRotation(); // Return null if the specified image is unavailable. diff --git a/src/com/android/gallery3d/ui/StripDrawer.java b/src/com/android/gallery3d/ui/StripDrawer.java deleted file mode 100644 index a4bb37825..000000000 --- a/src/com/android/gallery3d/ui/StripDrawer.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.gallery3d.ui; - -import android.content.Context; -import android.graphics.Rect; - -import com.android.gallery3d.R; -import com.android.gallery3d.data.Path; - -public class StripDrawer extends SelectionDrawer { - private NinePatchTexture mFramePressed; - private NinePatchTexture mFocusBox; - private Rect mFocusBoxPadding; - private Path mPressedPath; - - public StripDrawer(Context context) { - mFramePressed = new NinePatchTexture(context, R.drawable.grid_pressed); - mFocusBox = new NinePatchTexture(context, R.drawable.thumb_selected); - mFocusBoxPadding = mFocusBox.getPaddings(); - } - - public void setPressedPath(Path path) { - mPressedPath = path; - } - - private boolean isPressedPath(Path path) { - return path != null && path == mPressedPath; - } - - @Override - public void prepareDrawing() { - } - - @Override - public void draw(GLCanvas canvas, Texture content, - int width, int height, int rotation, Path path, - int dataSourceType, int mediaType, boolean isPanorama, - int labelBackgroundHeight, boolean wantCache, boolean isCaching) { - - int x = -width / 2; - int y = -height / 2; - - drawWithRotation(canvas, content, x, y, width, height, rotation); - - if (isPressedPath(path)) { - drawFrame(canvas, mFramePressed, x, y, width, height); - } - } - - @Override - public void drawFocus(GLCanvas canvas, int width, int height) { - int x = -width / 2; - int y = -height / 2; - Rect p = mFocusBoxPadding; - mFocusBox.draw(canvas, x - p.left, y - p.top, - width + p.left + p.right, height + p.top + p.bottom); - } -} |