Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 1 | /* |
kaiyiz | 99cfa4d | 2014-09-03 16:02:55 +0800 | [diff] [blame] | 2 | * Copyright (c) 2014, The Linux Foundation. All rights reserved. |
| 3 | * Not a Contribution. |
| 4 | * |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 5 | * Copyright (C) 2010 The Android Open Source Project |
| 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
| 18 | */ |
| 19 | |
| 20 | package com.android.gallery3d.app; |
| 21 | |
Ray Chen | 1f4e6d1 | 2011-09-27 15:48:08 +0800 | [diff] [blame] | 22 | import android.app.Activity; |
| 23 | import android.content.Context; |
Owen Lin | 28cb416 | 2012-08-29 11:53:10 +0800 | [diff] [blame] | 24 | import android.content.Intent; |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 25 | import android.graphics.Color; |
Ray Chen | 1f4e6d1 | 2011-09-27 15:48:08 +0800 | [diff] [blame] | 26 | import android.graphics.Rect; |
kaiyiz | 99cfa4d | 2014-09-03 16:02:55 +0800 | [diff] [blame] | 27 | import android.net.Uri; |
Ray Chen | 1f4e6d1 | 2011-09-27 15:48:08 +0800 | [diff] [blame] | 28 | import android.os.Bundle; |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 29 | import android.os.Handler; |
| 30 | import android.os.Message; |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 31 | import android.util.TypedValue; |
| 32 | import android.view.Gravity; |
Bobby Georgescu | bcb4278 | 2012-10-31 16:33:56 -0700 | [diff] [blame] | 33 | import android.view.HapticFeedbackConstants; |
John Reck | 2abaaf7 | 2012-12-12 13:43:43 -0800 | [diff] [blame] | 34 | import android.view.Menu; |
| 35 | import android.view.MenuInflater; |
| 36 | import android.view.MenuItem; |
Bobby Georgescu | d208e12 | 2012-09-14 13:54:54 -0700 | [diff] [blame] | 37 | import android.view.View; |
| 38 | import android.view.View.OnClickListener; |
| 39 | import android.widget.Button; |
| 40 | import android.widget.RelativeLayout; |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 41 | import android.widget.TextView; |
Ray Chen | 1f4e6d1 | 2011-09-27 15:48:08 +0800 | [diff] [blame] | 42 | import android.widget.Toast; |
| 43 | |
Likai Ding | c83b5b7 | 2016-05-25 14:48:41 +0800 | [diff] [blame] | 44 | import org.codeaurora.gallery.R; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 45 | import com.android.gallery3d.common.Utils; |
| 46 | import com.android.gallery3d.data.DataManager; |
| 47 | import com.android.gallery3d.data.MediaDetails; |
Hung-ying Tyan | 27565de | 2012-10-04 18:49:01 +0800 | [diff] [blame] | 48 | import com.android.gallery3d.data.MediaItem; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 49 | import com.android.gallery3d.data.MediaObject; |
| 50 | import com.android.gallery3d.data.MediaSet; |
| 51 | import com.android.gallery3d.data.Path; |
John Reck | a4eae1a | 2012-12-11 14:42:27 -0800 | [diff] [blame] | 52 | import com.android.gallery3d.glrenderer.FadeTexture; |
| 53 | import com.android.gallery3d.glrenderer.GLCanvas; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 54 | import com.android.gallery3d.picasasource.PicasaSource; |
| 55 | import com.android.gallery3d.settings.GallerySettings; |
| 56 | import com.android.gallery3d.ui.ActionModeHandler; |
| 57 | import com.android.gallery3d.ui.ActionModeHandler.ActionModeListener; |
Owen Lin | c3d8ac3 | 2012-04-06 16:46:32 +0800 | [diff] [blame] | 58 | import com.android.gallery3d.ui.AlbumSetSlotRenderer; |
Ray Chen | 4105e22 | 2011-08-24 11:40:04 +0800 | [diff] [blame] | 59 | import com.android.gallery3d.ui.DetailsHelper; |
| 60 | import com.android.gallery3d.ui.DetailsHelper.CloseListener; |
Owen Lin | 71632ac | 2012-04-05 12:02:01 +0800 | [diff] [blame] | 61 | import com.android.gallery3d.ui.GLRoot; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 62 | import com.android.gallery3d.ui.GLView; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 63 | import com.android.gallery3d.ui.SelectionManager; |
| 64 | import com.android.gallery3d.ui.SlotView; |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 65 | import com.android.gallery3d.ui.SynchronizedHandler; |
Hung-ying Tyan | 57cbaa1 | 2011-09-30 14:42:50 +0800 | [diff] [blame] | 66 | import com.android.gallery3d.util.Future; |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 67 | import com.android.gallery3d.util.GalleryUtils; |
Ray Chen | daf88fe | 2012-05-17 16:37:13 +0800 | [diff] [blame] | 68 | import com.android.gallery3d.util.HelpUtils; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 69 | |
Bobby Georgescu | 0999529 | 2012-09-09 15:15:45 -0700 | [diff] [blame] | 70 | import java.lang.ref.WeakReference; |
Hung-ying Tyan | 27565de | 2012-10-04 18:49:01 +0800 | [diff] [blame] | 71 | import java.util.ArrayList; |
Bobby Georgescu | 0999529 | 2012-09-09 15:15:45 -0700 | [diff] [blame] | 72 | |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 73 | public class AlbumSetPage extends ActivityState implements |
| 74 | SelectionManager.SelectionListener, GalleryActionBar.ClusterRunner, |
Hung-ying Tyan | 57cbaa1 | 2011-09-30 14:42:50 +0800 | [diff] [blame] | 75 | EyePosition.EyePositionListener, MediaSet.SyncListener { |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 76 | @SuppressWarnings("unused") |
| 77 | private static final String TAG = "AlbumSetPage"; |
| 78 | |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 79 | private static final int MSG_PICK_ALBUM = 1; |
| 80 | |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 81 | public static final String KEY_MEDIA_PATH = "media-path"; |
| 82 | public static final String KEY_SET_TITLE = "set-title"; |
| 83 | public static final String KEY_SET_SUBTITLE = "set-subtitle"; |
Ray Chen | b5f8d90 | 2011-09-13 18:35:28 +0800 | [diff] [blame] | 84 | public static final String KEY_SELECTED_CLUSTER_TYPE = "selected-cluster"; |
Owen Lin | 6cf8074 | 2011-08-28 10:50:21 +0800 | [diff] [blame] | 85 | |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 86 | private static final int DATA_CACHE_SIZE = 256; |
| 87 | private static final int REQUEST_DO_ANIMATION = 1; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 88 | |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 89 | private static final int BIT_LOADING_RELOAD = 1; |
| 90 | private static final int BIT_LOADING_SYNC = 2; |
| 91 | |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 92 | private boolean mIsActive = false; |
Owen Lin | 7260f6f | 2012-03-22 14:14:40 +0800 | [diff] [blame] | 93 | private SlotView mSlotView; |
Owen Lin | c3d8ac3 | 2012-04-06 16:46:32 +0800 | [diff] [blame] | 94 | private AlbumSetSlotRenderer mAlbumSetView; |
Bobby Georgescu | f0c8937 | 2012-08-13 14:27:08 -0700 | [diff] [blame] | 95 | private Config.AlbumSetPage mConfig; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 96 | |
| 97 | private MediaSet mMediaSet; |
Ray Chen | 9c21268 | 2011-10-26 11:36:55 +0800 | [diff] [blame] | 98 | private String mTitle; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 99 | private String mSubtitle; |
Ray Chen | b5f8d90 | 2011-09-13 18:35:28 +0800 | [diff] [blame] | 100 | private boolean mShowClusterMenu; |
Ray Chen | 8cab3e8 | 2012-03-20 16:32:57 +0800 | [diff] [blame] | 101 | private GalleryActionBar mActionBar; |
Ray Chen | b5f8d90 | 2011-09-13 18:35:28 +0800 | [diff] [blame] | 102 | private int mSelectedAction; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 103 | |
| 104 | protected SelectionManager mSelectionManager; |
Owen Lin | c3d8ac3 | 2012-04-06 16:46:32 +0800 | [diff] [blame] | 105 | private AlbumSetDataLoader mAlbumSetDataAdapter; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 106 | |
| 107 | private boolean mGetContent; |
| 108 | private boolean mGetAlbum; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 109 | private ActionModeHandler mActionModeHandler; |
Ray Chen | 4105e22 | 2011-08-24 11:40:04 +0800 | [diff] [blame] | 110 | private DetailsHelper mDetailsHelper; |
| 111 | private MyDetailsSource mDetailsSource; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 112 | private boolean mShowDetails; |
| 113 | private EyePosition mEyePosition; |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 114 | private Handler mHandler; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 115 | |
| 116 | // The eyes' position of the user, the origin is at the center of the |
| 117 | // device and the unit is in pixels. |
| 118 | private float mX; |
| 119 | private float mY; |
| 120 | private float mZ; |
| 121 | |
Hung-ying Tyan | 57cbaa1 | 2011-09-30 14:42:50 +0800 | [diff] [blame] | 122 | private Future<Integer> mSyncTask = null; |
| 123 | |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 124 | private int mLoadingBits = 0; |
| 125 | private boolean mInitialSynced = false; |
| 126 | |
Bobby Georgescu | d208e12 | 2012-09-14 13:54:54 -0700 | [diff] [blame] | 127 | private Button mCameraButton; |
| 128 | private boolean mShowedEmptyToastForSelf = false; |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 129 | private TextView tvEmptyAlbum; |
Bobby Georgescu | d208e12 | 2012-09-14 13:54:54 -0700 | [diff] [blame] | 130 | |
Bobby Georgescu | 915c2c5 | 2012-08-23 13:05:53 -0700 | [diff] [blame] | 131 | @Override |
| 132 | protected int getBackgroundColorId() { |
| 133 | return R.color.albumset_background; |
| 134 | } |
| 135 | |
Ray Chen | dbf4ba1 | 2011-10-04 15:19:44 +0800 | [diff] [blame] | 136 | private final GLView mRootPane = new GLView() { |
| 137 | private final float mMatrix[] = new float[16]; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 138 | |
| 139 | @Override |
| 140 | protected void onLayout( |
| 141 | boolean changed, int left, int top, int right, int bottom) { |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 142 | mEyePosition.resetPosition(); |
| 143 | |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 144 | int paddingLeft; |
| 145 | int paddingBottom; |
| 146 | int paddingRight; |
| 147 | int paddingTop; |
| 148 | |
| 149 | if (right - left > bottom - top) { |
| 150 | paddingTop = mConfig.paddingTopLand; |
| 151 | paddingBottom = mConfig.paddingBottomLand; |
| 152 | paddingRight = mConfig.paddingRightLand; |
| 153 | paddingLeft = mConfig.paddingLeftLand; |
| 154 | } |
| 155 | else |
| 156 | { |
| 157 | paddingTop = mConfig.paddingTop; |
| 158 | paddingBottom = mConfig.paddingBottom; |
| 159 | paddingRight = mConfig.paddingRight; |
| 160 | paddingLeft = mConfig.paddingLeft; |
| 161 | } |
| 162 | |
Chao Zhang | fea8b88 | 2016-03-30 10:51:46 +0800 | [diff] [blame] | 163 | int slotViewTop; |
| 164 | android.widget.Toolbar toolbar = mActivity.getToolbar(); |
| 165 | if (toolbar != null) { |
| 166 | slotViewTop = toolbar.getLayoutParams().height + paddingTop; |
| 167 | } else { |
| 168 | slotViewTop = mActivity.getGalleryActionBar().getHeight() + paddingTop; |
| 169 | } |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 170 | int slotViewBottom = bottom - top - paddingBottom; |
| 171 | int slotViewRight = right - left - paddingRight; |
| 172 | int slotViewLeft = paddingLeft ; |
| 173 | |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 174 | |
| 175 | if (mShowDetails) { |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 176 | mDetailsHelper.layout(slotViewLeft, slotViewTop, slotViewRight, slotViewBottom); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 177 | } else { |
Owen Lin | 31cac30 | 2012-04-04 10:24:08 +0800 | [diff] [blame] | 178 | mAlbumSetView.setHighlightItemPath(null); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 179 | } |
| 180 | |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 181 | mSlotView.layout(slotViewLeft, slotViewTop, slotViewRight, slotViewBottom); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | @Override |
| 185 | protected void render(GLCanvas canvas) { |
| 186 | canvas.save(GLCanvas.SAVE_FLAG_MATRIX); |
| 187 | GalleryUtils.setViewPointMatrix(mMatrix, |
| 188 | getWidth() / 2 + mX, getHeight() / 2 + mY, mZ); |
| 189 | canvas.multiplyMatrix(mMatrix, 0); |
| 190 | super.render(canvas); |
| 191 | canvas.restore(); |
| 192 | } |
| 193 | }; |
| 194 | |
| 195 | @Override |
| 196 | public void onEyePositionChanged(float x, float y, float z) { |
| 197 | mRootPane.lockRendering(); |
| 198 | mX = x; |
| 199 | mY = y; |
| 200 | mZ = z; |
| 201 | mRootPane.unlockRendering(); |
| 202 | mRootPane.invalidate(); |
| 203 | } |
| 204 | |
| 205 | @Override |
| 206 | public void onBackPressed() { |
| 207 | if (mShowDetails) { |
| 208 | hideDetails(); |
| 209 | } else if (mSelectionManager.inSelectionMode()) { |
| 210 | mSelectionManager.leaveSelectionMode(); |
| 211 | } else { |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 212 | super.onBackPressed(); |
| 213 | } |
| 214 | } |
| 215 | |
Owen Lin | 2341c19 | 2012-03-23 14:59:14 +0800 | [diff] [blame] | 216 | private void getSlotCenter(int slotIndex, int center[]) { |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 217 | Rect offset = new Rect(); |
Owen Lin | 7260f6f | 2012-03-22 14:14:40 +0800 | [diff] [blame] | 218 | mRootPane.getBoundsOf(mSlotView, offset); |
Owen Lin | 7260f6f | 2012-03-22 14:14:40 +0800 | [diff] [blame] | 219 | Rect r = mSlotView.getSlotRect(slotIndex); |
| 220 | int scrollX = mSlotView.getScrollX(); |
| 221 | int scrollY = mSlotView.getScrollY(); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 222 | center[0] = offset.left + (r.left + r.right) / 2 - scrollX; |
| 223 | center[1] = offset.top + (r.top + r.bottom) / 2 - scrollY; |
| 224 | } |
| 225 | |
| 226 | public void onSingleTapUp(int slotIndex) { |
Owen Lin | cf06397 | 2012-04-13 12:33:29 +0800 | [diff] [blame] | 227 | if (!mIsActive) return; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 228 | |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 229 | if (mSelectionManager.inSelectionMode()) { |
| 230 | MediaSet targetSet = mAlbumSetDataAdapter.getMediaSet(slotIndex); |
| 231 | if (targetSet == null) return; // Content is dirty, we shall reload soon |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 232 | mSelectionManager.toggle(targetSet.getPath()); |
Owen Lin | 7260f6f | 2012-03-22 14:14:40 +0800 | [diff] [blame] | 233 | mSlotView.invalidate(); |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 234 | } else { |
| 235 | // Show pressed-up animation for the single-tap. |
| 236 | mAlbumSetView.setPressedIndex(slotIndex); |
| 237 | mAlbumSetView.setPressedUp(); |
| 238 | mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PICK_ALBUM, slotIndex, 0), |
| 239 | FadeTexture.DURATION); |
| 240 | } |
| 241 | } |
| 242 | |
Bobby Georgescu | 7eea4d3 | 2012-09-06 17:14:02 -0700 | [diff] [blame] | 243 | private static boolean albumShouldOpenInFilmstrip(MediaSet album) { |
Bobby Georgescu | b265ebb | 2012-09-12 16:37:53 -0700 | [diff] [blame] | 244 | int itemCount = album.getMediaItemCount(); |
Hung-ying Tyan | 27565de | 2012-10-04 18:49:01 +0800 | [diff] [blame] | 245 | ArrayList<MediaItem> list = (itemCount == 1) ? album.getMediaItem(0, 1) : null; |
Bobby Georgescu | 7a84c57 | 2012-10-08 19:26:54 -0700 | [diff] [blame] | 246 | // open in film strip only if there's one item in the album and the item exists |
| 247 | return (list != null && !list.isEmpty()); |
Bobby Georgescu | 7eea4d3 | 2012-09-06 17:14:02 -0700 | [diff] [blame] | 248 | } |
| 249 | |
Bobby Georgescu | 0999529 | 2012-09-09 15:15:45 -0700 | [diff] [blame] | 250 | WeakReference<Toast> mEmptyAlbumToast = null; |
| 251 | |
| 252 | private void showEmptyAlbumToast(int toastLength) { |
c_yongga | 5a7bd5d | 2016-01-05 17:26:44 +0800 | [diff] [blame] | 253 | //CRs-Fixed:951767 java.lang.NullPointerException: Attempt to invoke virtual method |
| 254 | // 'void android.widget.RelativeLayout.addView(android.view.View |
| 255 | RelativeLayout galleryRoot = (RelativeLayout) ((Activity) mActivity) |
| 256 | .findViewById(R.id.gallery_root); |
| 257 | if (galleryRoot == null) return ; |
yongga | b7e0055 | 2016-01-11 18:39:11 +0800 | [diff] [blame] | 258 | if (tvEmptyAlbum == null) { |
| 259 | tvEmptyAlbum = new TextView(mActivity); |
| 260 | tvEmptyAlbum.setText(R.string.tvEmptyAlbum); |
| 261 | tvEmptyAlbum.setTextColor(Color.parseColor("#8A000000")); |
| 262 | tvEmptyAlbum.setGravity(Gravity.CENTER); |
| 263 | tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20); |
| 264 | RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( |
| 265 | RelativeLayout.LayoutParams.WRAP_CONTENT, |
| 266 | RelativeLayout.LayoutParams.WRAP_CONTENT); |
| 267 | lp.addRule(RelativeLayout.CENTER_IN_PARENT); |
| 268 | galleryRoot.addView(tvEmptyAlbum, lp); |
| 269 | } |
| 270 | tvEmptyAlbum.setVisibility(View.VISIBLE); |
Bobby Georgescu | 0999529 | 2012-09-09 15:15:45 -0700 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | private void hideEmptyAlbumToast() { |
yongga | b7e0055 | 2016-01-11 18:39:11 +0800 | [diff] [blame] | 274 | if (tvEmptyAlbum != null) { |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 275 | tvEmptyAlbum.setVisibility(View.GONE); |
Bobby Georgescu | 0999529 | 2012-09-09 15:15:45 -0700 | [diff] [blame] | 276 | } |
| 277 | } |
| 278 | |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 279 | private void pickAlbum(int slotIndex) { |
| 280 | if (!mIsActive) return; |
| 281 | |
| 282 | MediaSet targetSet = mAlbumSetDataAdapter.getMediaSet(slotIndex); |
| 283 | if (targetSet == null) return; // Content is dirty, we shall reload soon |
Bobby Georgescu | 0999529 | 2012-09-09 15:15:45 -0700 | [diff] [blame] | 284 | if (targetSet.getTotalMediaItemCount() == 0) { |
| 285 | showEmptyAlbumToast(Toast.LENGTH_SHORT); |
| 286 | return; |
| 287 | } |
| 288 | hideEmptyAlbumToast(); |
| 289 | |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 290 | String mediaPath = targetSet.getPath().toString(); |
| 291 | |
| 292 | Bundle data = new Bundle(getData()); |
| 293 | int[] center = new int[2]; |
| 294 | getSlotCenter(slotIndex, center); |
| 295 | data.putIntArray(AlbumPage.KEY_SET_CENTER, center); |
| 296 | if (mGetAlbum && targetSet.isLeafAlbum()) { |
Owen Lin | b21b8e5 | 2012-08-24 12:25:57 +0800 | [diff] [blame] | 297 | Activity activity = mActivity; |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 298 | Intent result = new Intent() |
| 299 | .putExtra(AlbumPicker.KEY_ALBUM_PATH, targetSet.getPath().toString()); |
| 300 | activity.setResult(Activity.RESULT_OK, result); |
| 301 | activity.finish(); |
| 302 | } else if (targetSet.getSubMediaSetCount() > 0) { |
| 303 | data.putString(AlbumSetPage.KEY_MEDIA_PATH, mediaPath); |
| 304 | mActivity.getStateManager().startStateForResult( |
| 305 | AlbumSetPage.class, REQUEST_DO_ANIMATION, data); |
| 306 | } else { |
Bobby Georgescu | d3aac52 | 2012-12-26 00:52:28 -0800 | [diff] [blame] | 307 | if (!mGetContent && albumShouldOpenInFilmstrip(targetSet)) { |
Bobby Georgescu | 6b64c06 | 2012-09-13 22:24:29 -0700 | [diff] [blame] | 308 | data.putParcelable(PhotoPage.KEY_OPEN_ANIMATION_RECT, |
| 309 | mSlotView.getSlotRect(slotIndex, mRootPane)); |
Bobby Georgescu | 7eea4d3 | 2012-09-06 17:14:02 -0700 | [diff] [blame] | 310 | data.putInt(PhotoPage.KEY_INDEX_HINT, 0); |
| 311 | data.putString(PhotoPage.KEY_MEDIA_SET_PATH, |
| 312 | mediaPath); |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 313 | data.putBoolean(PhotoPage.KEY_START_IN_FILMSTRIP, false); |
Bobby Georgescu | 45f089d | 2012-10-02 13:30:09 -0700 | [diff] [blame] | 314 | data.putBoolean(PhotoPage.KEY_IN_CAMERA_ROLL, targetSet.isCameraRoll()); |
Bobby Georgescu | 7eea4d3 | 2012-09-06 17:14:02 -0700 | [diff] [blame] | 315 | mActivity.getStateManager().startStateForResult( |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 316 | SinglePhotoPage.class, AlbumPage.REQUEST_PHOTO, data); |
Bobby Georgescu | 7eea4d3 | 2012-09-06 17:14:02 -0700 | [diff] [blame] | 317 | return; |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 318 | } |
| 319 | data.putString(AlbumPage.KEY_MEDIA_PATH, mediaPath); |
Bobby Georgescu | 7eea4d3 | 2012-09-06 17:14:02 -0700 | [diff] [blame] | 320 | |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 321 | // We only show cluster menu in the first AlbumPage in stack |
Bobby Georgescu | 7eea4d3 | 2012-09-06 17:14:02 -0700 | [diff] [blame] | 322 | boolean inAlbum = mActivity.getStateManager().hasStateClass(AlbumPage.class); |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 323 | data.putBoolean(AlbumPage.KEY_SHOW_CLUSTER_MENU, !inAlbum); |
| 324 | mActivity.getStateManager().startStateForResult( |
| 325 | AlbumPage.class, REQUEST_DO_ANIMATION, data); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 326 | } |
| 327 | } |
| 328 | |
Chih-Chung Chang | bc21541 | 2011-09-19 11:09:39 +0800 | [diff] [blame] | 329 | private void onDown(int index) { |
Owen Lin | 31cac30 | 2012-04-04 10:24:08 +0800 | [diff] [blame] | 330 | mAlbumSetView.setPressedIndex(index); |
Chih-Chung Chang | bc21541 | 2011-09-19 11:09:39 +0800 | [diff] [blame] | 331 | } |
| 332 | |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 333 | private void onUp(boolean followedByLongPress) { |
| 334 | if (followedByLongPress) { |
| 335 | // Avoid showing press-up animations for long-press. |
| 336 | mAlbumSetView.setPressedIndex(-1); |
| 337 | } else { |
| 338 | mAlbumSetView.setPressedUp(); |
| 339 | } |
Chih-Chung Chang | bc21541 | 2011-09-19 11:09:39 +0800 | [diff] [blame] | 340 | } |
| 341 | |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 342 | public void onLongTap(int slotIndex) { |
| 343 | if (mGetContent || mGetAlbum) return; |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 344 | MediaSet set = mAlbumSetDataAdapter.getMediaSet(slotIndex); |
| 345 | if (set == null) return; |
| 346 | mSelectionManager.setAutoLeaveSelectionMode(true); |
| 347 | mSelectionManager.toggle(set.getPath()); |
| 348 | mSlotView.invalidate(); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 349 | } |
| 350 | |
Owen Lin | 2341c19 | 2012-03-23 14:59:14 +0800 | [diff] [blame] | 351 | @Override |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 352 | public void doCluster(int clusterType) { |
| 353 | String basePath = mMediaSet.getPath().toString(); |
| 354 | String newPath = FilterUtils.switchClusterPath(basePath, clusterType); |
| 355 | Bundle data = new Bundle(getData()); |
| 356 | data.putString(AlbumSetPage.KEY_MEDIA_PATH, newPath); |
Ray Chen | b5f8d90 | 2011-09-13 18:35:28 +0800 | [diff] [blame] | 357 | data.putInt(KEY_SELECTED_CLUSTER_TYPE, clusterType); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 358 | mActivity.getStateManager().switchState(this, AlbumSetPage.class, data); |
| 359 | } |
| 360 | |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 361 | @Override |
| 362 | public void onCreate(Bundle data, Bundle restoreState) { |
Bobby Georgescu | 45c56f2 | 2012-08-26 23:47:19 -0700 | [diff] [blame] | 363 | super.onCreate(data, restoreState); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 364 | initializeViews(); |
| 365 | initializeData(data); |
Ray Chen | 1f4e6d1 | 2011-09-27 15:48:08 +0800 | [diff] [blame] | 366 | Context context = mActivity.getAndroidContext(); |
Mangesh Ghiware | 06c0276 | 2013-09-11 15:59:59 -0700 | [diff] [blame] | 367 | mGetContent = data.getBoolean(GalleryActivity.KEY_GET_CONTENT, false); |
| 368 | mGetAlbum = data.getBoolean(GalleryActivity.KEY_GET_ALBUM, false); |
Ray Chen | 9c21268 | 2011-10-26 11:36:55 +0800 | [diff] [blame] | 369 | mTitle = data.getString(AlbumSetPage.KEY_SET_TITLE); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 370 | mSubtitle = data.getString(AlbumSetPage.KEY_SET_SUBTITLE); |
Ray Chen | 1f4e6d1 | 2011-09-27 15:48:08 +0800 | [diff] [blame] | 371 | mEyePosition = new EyePosition(context, this); |
Ray Chen | 4105e22 | 2011-08-24 11:40:04 +0800 | [diff] [blame] | 372 | mDetailsSource = new MyDetailsSource(); |
Ray Chen | 8cab3e8 | 2012-03-20 16:32:57 +0800 | [diff] [blame] | 373 | mActionBar = mActivity.getGalleryActionBar(); |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 374 | //mSelectedAction = data.getInt(AlbumSetPage.KEY_SELECTED_CLUSTER_TYPE, |
| 375 | // FilterUtils.CLUSTER_BY_ALBUM); |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 376 | mHandler = new SynchronizedHandler(mActivity.getGLRoot()) { |
| 377 | @Override |
| 378 | public void handleMessage(Message message) { |
| 379 | switch (message.what) { |
| 380 | case MSG_PICK_ALBUM: { |
| 381 | pickAlbum(message.arg1); |
| 382 | break; |
| 383 | } |
| 384 | default: throw new AssertionError(message.what); |
| 385 | } |
| 386 | } |
| 387 | }; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 388 | } |
| 389 | |
Bobby Georgescu | d208e12 | 2012-09-14 13:54:54 -0700 | [diff] [blame] | 390 | @Override |
| 391 | public void onDestroy() { |
Bobby Georgescu | d208e12 | 2012-09-14 13:54:54 -0700 | [diff] [blame] | 392 | super.onDestroy(); |
Bobby Georgescu | a2d0d34 | 2012-12-03 13:56:00 -0800 | [diff] [blame] | 393 | cleanupCameraButton(); |
| 394 | mActionModeHandler.destroy(); |
Bobby Georgescu | d208e12 | 2012-09-14 13:54:54 -0700 | [diff] [blame] | 395 | } |
| 396 | |
| 397 | private boolean setupCameraButton() { |
Bobby Georgescu | 4f69a05 | 2012-10-12 18:00:51 -0700 | [diff] [blame] | 398 | if (!GalleryUtils.isCameraAvailable(mActivity)) return false; |
Bobby Georgescu | d208e12 | 2012-09-14 13:54:54 -0700 | [diff] [blame] | 399 | RelativeLayout galleryRoot = (RelativeLayout) ((Activity) mActivity) |
| 400 | .findViewById(R.id.gallery_root); |
| 401 | if (galleryRoot == null) return false; |
| 402 | |
| 403 | mCameraButton = new Button(mActivity); |
| 404 | mCameraButton.setText(R.string.camera_label); |
Bobby Georgescu | 8cfc7f0 | 2012-09-17 11:07:51 -0700 | [diff] [blame] | 405 | mCameraButton.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.frame_overlay_gallery_camera, 0, 0); |
Bobby Georgescu | d208e12 | 2012-09-14 13:54:54 -0700 | [diff] [blame] | 406 | mCameraButton.setOnClickListener(new OnClickListener() { |
| 407 | @Override |
| 408 | public void onClick(View arg0) { |
| 409 | GalleryUtils.startCameraActivity(mActivity); |
| 410 | } |
| 411 | }); |
| 412 | RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( |
| 413 | RelativeLayout.LayoutParams.WRAP_CONTENT, |
| 414 | RelativeLayout.LayoutParams.WRAP_CONTENT); |
| 415 | lp.addRule(RelativeLayout.CENTER_IN_PARENT); |
| 416 | galleryRoot.addView(mCameraButton, lp); |
| 417 | return true; |
| 418 | } |
| 419 | |
| 420 | private void cleanupCameraButton() { |
| 421 | if (mCameraButton == null) return; |
| 422 | RelativeLayout galleryRoot = (RelativeLayout) ((Activity) mActivity) |
| 423 | .findViewById(R.id.gallery_root); |
| 424 | if (galleryRoot == null) return; |
| 425 | galleryRoot.removeView(mCameraButton); |
| 426 | mCameraButton = null; |
| 427 | } |
| 428 | |
Bobby Georgescu | d208e12 | 2012-09-14 13:54:54 -0700 | [diff] [blame] | 429 | private void hideCameraButton() { |
| 430 | if (mCameraButton == null) return; |
| 431 | mCameraButton.setVisibility(View.GONE); |
| 432 | } |
| 433 | |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 434 | private void clearLoadingBit(int loadingBit) { |
| 435 | mLoadingBits &= ~loadingBit; |
Chih-Chung Chang | d05b0be | 2012-01-09 12:41:57 +0800 | [diff] [blame] | 436 | if (mLoadingBits == 0 && mIsActive) { |
Bobby Georgescu | d208e12 | 2012-09-14 13:54:54 -0700 | [diff] [blame] | 437 | if (mAlbumSetDataAdapter.size() == 0) { |
Bobby Georgescu | 0999529 | 2012-09-09 15:15:45 -0700 | [diff] [blame] | 438 | // If this is not the top of the gallery folder hierarchy, |
| 439 | // tell the parent AlbumSetPage instance to handle displaying |
| 440 | // the empty album toast, otherwise show it within this |
| 441 | // instance |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 442 | if (mActivity.getStateManager().getStateCount() > 1) { |
Bobby Georgescu | 0999529 | 2012-09-09 15:15:45 -0700 | [diff] [blame] | 443 | Intent result = new Intent(); |
| 444 | result.putExtra(AlbumPage.KEY_EMPTY_ALBUM, true); |
| 445 | setStateResult(Activity.RESULT_OK, result); |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 446 | mActivity.getStateManager().finishState(this); |
Bobby Georgescu | 5992daf | 2012-08-22 18:26:03 -0700 | [diff] [blame] | 447 | } else { |
Bobby Georgescu | 0999529 | 2012-09-09 15:15:45 -0700 | [diff] [blame] | 448 | mShowedEmptyToastForSelf = true; |
| 449 | showEmptyAlbumToast(Toast.LENGTH_LONG); |
Bobby Georgescu | 77fa1d2 | 2012-10-09 16:23:36 -0700 | [diff] [blame] | 450 | mSlotView.invalidate(); |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 451 | } |
Bobby Georgescu | 0999529 | 2012-09-09 15:15:45 -0700 | [diff] [blame] | 452 | return; |
yongga | b7e0055 | 2016-01-11 18:39:11 +0800 | [diff] [blame] | 453 | } else { |
| 454 | hideEmptyAlbumToast(); |
| 455 | hideCameraButton(); |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 456 | } |
| 457 | } |
Bobby Georgescu | 0999529 | 2012-09-09 15:15:45 -0700 | [diff] [blame] | 458 | // Hide the empty album toast if we are in the root instance of |
| 459 | // AlbumSetPage and the album is no longer empty (for instance, |
| 460 | // after a sync is completed and web albums have been synced) |
| 461 | if (mShowedEmptyToastForSelf) { |
| 462 | mShowedEmptyToastForSelf = false; |
| 463 | hideEmptyAlbumToast(); |
Bobby Georgescu | d208e12 | 2012-09-14 13:54:54 -0700 | [diff] [blame] | 464 | hideCameraButton(); |
Bobby Georgescu | 5992daf | 2012-08-22 18:26:03 -0700 | [diff] [blame] | 465 | } |
Bobby Georgescu | 5992daf | 2012-08-22 18:26:03 -0700 | [diff] [blame] | 466 | } |
| 467 | |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 468 | private void setLoadingBit(int loadingBit) { |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 469 | mLoadingBits |= loadingBit; |
| 470 | } |
| 471 | |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 472 | @Override |
| 473 | public void onPause() { |
| 474 | super.onPause(); |
| 475 | mIsActive = false; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 476 | mAlbumSetDataAdapter.pause(); |
| 477 | mAlbumSetView.pause(); |
Bobby Georgescu | a2d0d34 | 2012-12-03 13:56:00 -0800 | [diff] [blame] | 478 | mActionModeHandler.pause(); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 479 | mEyePosition.pause(); |
Ray Chen | 4105e22 | 2011-08-24 11:40:04 +0800 | [diff] [blame] | 480 | DetailsHelper.pause(); |
Ray Chen | fe1625c | 2012-02-17 13:12:32 +0800 | [diff] [blame] | 481 | // Call disableClusterMenu to avoid receiving callback after paused. |
| 482 | // Don't hide menu here otherwise the list menu will disappear earlier than |
| 483 | // the action bar, which is janky and unwanted behavior. |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 484 | //mActionBar.disableClusterMenu(false); |
Hung-ying Tyan | 57cbaa1 | 2011-09-30 14:42:50 +0800 | [diff] [blame] | 485 | if (mSyncTask != null) { |
| 486 | mSyncTask.cancel(); |
| 487 | mSyncTask = null; |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 488 | clearLoadingBit(BIT_LOADING_SYNC); |
Hung-ying Tyan | 57cbaa1 | 2011-09-30 14:42:50 +0800 | [diff] [blame] | 489 | } |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | @Override |
| 493 | public void onResume() { |
| 494 | super.onResume(); |
| 495 | mIsActive = true; |
| 496 | setContentPane(mRootPane); |
Owen Lin | fe49be4 | 2011-11-24 11:59:52 +0800 | [diff] [blame] | 497 | |
| 498 | // Set the reload bit here to prevent it exit this page in clearLoadingBit(). |
| 499 | setLoadingBit(BIT_LOADING_RELOAD); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 500 | mAlbumSetDataAdapter.resume(); |
Owen Lin | fe49be4 | 2011-11-24 11:59:52 +0800 | [diff] [blame] | 501 | |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 502 | mAlbumSetView.resume(); |
| 503 | mEyePosition.resume(); |
| 504 | mActionModeHandler.resume(); |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 505 | /*if (mShowClusterMenu) { |
Ray Chen | 8cab3e8 | 2012-03-20 16:32:57 +0800 | [diff] [blame] | 506 | mActionBar.enableClusterMenu(mSelectedAction, this); |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 507 | }*/ |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 508 | if (!mInitialSynced) { |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 509 | setLoadingBit(BIT_LOADING_SYNC); |
Owen Lin | fe49be4 | 2011-11-24 11:59:52 +0800 | [diff] [blame] | 510 | mSyncTask = mMediaSet.requestSync(AlbumSetPage.this); |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 511 | } |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 512 | } |
| 513 | |
| 514 | private void initializeData(Bundle data) { |
| 515 | String mediaPath = data.getString(AlbumSetPage.KEY_MEDIA_PATH); |
| 516 | mMediaSet = mActivity.getDataManager().getMediaSet(mediaPath); |
| 517 | mSelectionManager.setSourceMediaSet(mMediaSet); |
Owen Lin | c3d8ac3 | 2012-04-06 16:46:32 +0800 | [diff] [blame] | 518 | mAlbumSetDataAdapter = new AlbumSetDataLoader( |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 519 | mActivity, mMediaSet, DATA_CACHE_SIZE); |
Kedi Xu | de4bbef | 2016-08-04 18:21:04 +0800 | [diff] [blame] | 520 | mSelectionManager.setAlbumSetDataLoader(mAlbumSetDataAdapter); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 521 | mAlbumSetDataAdapter.setLoadingListener(new MyLoadingListener()); |
| 522 | mAlbumSetView.setModel(mAlbumSetDataAdapter); |
| 523 | } |
| 524 | |
| 525 | private void initializeViews() { |
| 526 | mSelectionManager = new SelectionManager(mActivity, true); |
| 527 | mSelectionManager.setSelectionListener(this); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 528 | |
Owen Lin | b21b8e5 | 2012-08-24 12:25:57 +0800 | [diff] [blame] | 529 | mConfig = Config.AlbumSetPage.get(mActivity); |
Bobby Georgescu | f0c8937 | 2012-08-13 14:27:08 -0700 | [diff] [blame] | 530 | mSlotView = new SlotView(mActivity, mConfig.slotViewSpec); |
Owen Lin | c3d8ac3 | 2012-04-06 16:46:32 +0800 | [diff] [blame] | 531 | mAlbumSetView = new AlbumSetSlotRenderer( |
Bobby Georgescu | 915c2c5 | 2012-08-23 13:05:53 -0700 | [diff] [blame] | 532 | mActivity, mSelectionManager, mSlotView, mConfig.labelSpec, |
| 533 | mConfig.placeholderColor); |
Owen Lin | 7260f6f | 2012-03-22 14:14:40 +0800 | [diff] [blame] | 534 | mSlotView.setSlotRenderer(mAlbumSetView); |
| 535 | mSlotView.setListener(new SlotView.SimpleListener() { |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 536 | @Override |
Chih-Chung Chang | bc21541 | 2011-09-19 11:09:39 +0800 | [diff] [blame] | 537 | public void onDown(int index) { |
| 538 | AlbumSetPage.this.onDown(index); |
| 539 | } |
| 540 | |
| 541 | @Override |
Yuli Huang | 90fe70f | 2012-04-24 15:20:28 +0800 | [diff] [blame] | 542 | public void onUp(boolean followedByLongPress) { |
| 543 | AlbumSetPage.this.onUp(followedByLongPress); |
Chih-Chung Chang | bc21541 | 2011-09-19 11:09:39 +0800 | [diff] [blame] | 544 | } |
| 545 | |
| 546 | @Override |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 547 | public void onSingleTapUp(int slotIndex) { |
| 548 | AlbumSetPage.this.onSingleTapUp(slotIndex); |
| 549 | } |
Chih-Chung Chang | bc21541 | 2011-09-19 11:09:39 +0800 | [diff] [blame] | 550 | |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 551 | @Override |
| 552 | public void onLongTap(int slotIndex) { |
| 553 | AlbumSetPage.this.onLongTap(slotIndex); |
| 554 | } |
| 555 | }); |
| 556 | |
| 557 | mActionModeHandler = new ActionModeHandler(mActivity, mSelectionManager); |
| 558 | mActionModeHandler.setActionModeListener(new ActionModeListener() { |
Owen Lin | 2341c19 | 2012-03-23 14:59:14 +0800 | [diff] [blame] | 559 | @Override |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 560 | public boolean onActionItemClicked(MenuItem item) { |
| 561 | return onItemSelected(item); |
| 562 | } |
| 563 | }); |
Owen Lin | 7260f6f | 2012-03-22 14:14:40 +0800 | [diff] [blame] | 564 | mRootPane.addComponent(mSlotView); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 565 | } |
| 566 | |
| 567 | @Override |
| 568 | protected boolean onCreateActionBar(Menu menu) { |
Owen Lin | b21b8e5 | 2012-08-24 12:25:57 +0800 | [diff] [blame] | 569 | Activity activity = mActivity; |
Owen Lin | 2bb717f | 2012-07-13 17:23:05 +0800 | [diff] [blame] | 570 | final boolean inAlbum = mActivity.getStateManager().hasStateClass(AlbumPage.class); |
Owen Lin | b21b8e5 | 2012-08-24 12:25:57 +0800 | [diff] [blame] | 571 | MenuInflater inflater = getSupportMenuInflater(); |
| 572 | |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 573 | if (mGetContent) { |
Owen Lin | b21b8e5 | 2012-08-24 12:25:57 +0800 | [diff] [blame] | 574 | inflater.inflate(R.menu.pickup, menu); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 575 | int typeBits = mData.getInt( |
Mangesh Ghiware | 06c0276 | 2013-09-11 15:59:59 -0700 | [diff] [blame] | 576 | GalleryActivity.KEY_TYPE_BITS, DataManager.INCLUDE_IMAGE); |
Ahbong Chang | 9a93949 | 2012-08-22 14:38:18 +0800 | [diff] [blame] | 577 | mActionBar.setTitle(GalleryUtils.getSelectionModePrompt(typeBits)); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 578 | } else if (mGetAlbum) { |
Owen Lin | b21b8e5 | 2012-08-24 12:25:57 +0800 | [diff] [blame] | 579 | inflater.inflate(R.menu.pickup, menu); |
Ray Chen | 8cab3e8 | 2012-03-20 16:32:57 +0800 | [diff] [blame] | 580 | mActionBar.setTitle(R.string.select_album); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 581 | } else { |
Owen Lin | b21b8e5 | 2012-08-24 12:25:57 +0800 | [diff] [blame] | 582 | inflater.inflate(R.menu.albumset, menu); |
Bobby Georgescu | 3fd7640 | 2012-09-25 17:23:22 -0700 | [diff] [blame] | 583 | boolean wasShowingClusterMenu = mShowClusterMenu; |
Ray Chen | b5f8d90 | 2011-09-13 18:35:28 +0800 | [diff] [blame] | 584 | mShowClusterMenu = !inAlbum; |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 585 | /*if (mShowClusterMenu != wasShowingClusterMenu) { |
kaiyiz | 807e83e | 2014-04-26 10:27:13 +0800 | [diff] [blame] | 586 | if (mShowClusterMenu) { |
| 587 | mActionBar.enableClusterMenu(mSelectedAction, this); |
| 588 | } else { |
| 589 | mActionBar.disableClusterMenu(true); |
| 590 | } |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 591 | }*/ |
| 592 | boolean selectAlbums = !inAlbum ;// && |
| 593 | // mActionBar.getClusterTypeAction() == FilterUtils.CLUSTER_BY_ALBUM; |
Owen Lin | b21b8e5 | 2012-08-24 12:25:57 +0800 | [diff] [blame] | 594 | MenuItem selectItem = menu.findItem(R.id.action_select); |
| 595 | selectItem.setTitle(activity.getString( |
Owen Lin | 2bb717f | 2012-07-13 17:23:05 +0800 | [diff] [blame] | 596 | selectAlbums ? R.string.select_album : R.string.select_group)); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 597 | |
Owen Lin | b21b8e5 | 2012-08-24 12:25:57 +0800 | [diff] [blame] | 598 | MenuItem cameraItem = menu.findItem(R.id.action_camera); |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 599 | cameraItem.setVisible(GalleryUtils.isAnyCameraAvailable(activity)); |
Owen Lin | b21b8e5 | 2012-08-24 12:25:57 +0800 | [diff] [blame] | 600 | |
Ray Chen | 8cab3e8 | 2012-03-20 16:32:57 +0800 | [diff] [blame] | 601 | FilterUtils.setupMenuItems(mActionBar, mMediaSet.getPath(), false); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 602 | |
John Reck | 06e34ad | 2013-07-17 09:50:01 -0700 | [diff] [blame] | 603 | Intent helpIntent = HelpUtils.getHelpIntent(activity); |
Owen Lin | b21b8e5 | 2012-08-24 12:25:57 +0800 | [diff] [blame] | 604 | |
| 605 | MenuItem helpItem = menu.findItem(R.id.action_general_help); |
| 606 | helpItem.setVisible(helpIntent != null); |
| 607 | if (helpIntent != null) helpItem.setIntent(helpIntent); |
| 608 | |
kaiyiz | 99cfa4d | 2014-09-03 16:02:55 +0800 | [diff] [blame] | 609 | MenuItem moreItem = menu.findItem(R.id.action_more_image); |
| 610 | moreItem.setVisible(mActivity.getResources().getBoolean( |
| 611 | R.bool.config_show_more_images)); |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 612 | mActionBar.setTitle(R.string.albums_title); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 613 | } |
Owen Lin | b21b8e5 | 2012-08-24 12:25:57 +0800 | [diff] [blame] | 614 | return true; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 615 | } |
| 616 | |
| 617 | @Override |
| 618 | protected boolean onItemSelected(MenuItem item) { |
Owen Lin | b21b8e5 | 2012-08-24 12:25:57 +0800 | [diff] [blame] | 619 | Activity activity = mActivity; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 620 | switch (item.getItemId()) { |
kaiyiz | 99cfa4d | 2014-09-03 16:02:55 +0800 | [diff] [blame] | 621 | case R.id.action_more_image: |
| 622 | Uri moreUri = Uri.parse(mActivity.getString(R.string.website_for_more_image)); |
| 623 | Intent moreIntent = new Intent(Intent.ACTION_VIEW, moreUri); |
| 624 | mActivity.startActivity(moreIntent); |
| 625 | return true; |
Ray Chen | bd8e025 | 2011-08-25 11:43:40 +0800 | [diff] [blame] | 626 | case R.id.action_cancel: |
| 627 | activity.setResult(Activity.RESULT_CANCELED); |
| 628 | activity.finish(); |
| 629 | return true; |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 630 | case R.id.action_select: |
| 631 | mSelectionManager.setAutoLeaveSelectionMode(false); |
| 632 | mSelectionManager.enterSelectionMode(); |
| 633 | return true; |
| 634 | case R.id.action_details: |
| 635 | if (mAlbumSetDataAdapter.size() != 0) { |
| 636 | if (mShowDetails) { |
| 637 | hideDetails(); |
| 638 | } else { |
| 639 | showDetails(); |
| 640 | } |
| 641 | } else { |
| 642 | Toast.makeText(activity, |
| 643 | activity.getText(R.string.no_albums_alert), |
| 644 | Toast.LENGTH_SHORT).show(); |
| 645 | } |
| 646 | return true; |
| 647 | case R.id.action_camera: { |
Chih-Chung Chang | 402237b | 2012-05-03 17:53:05 +0800 | [diff] [blame] | 648 | GalleryUtils.startCameraActivity(activity); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 649 | return true; |
| 650 | } |
| 651 | case R.id.action_manage_offline: { |
Owen Lin | 6cf8074 | 2011-08-28 10:50:21 +0800 | [diff] [blame] | 652 | Bundle data = new Bundle(); |
| 653 | String mediaPath = mActivity.getDataManager().getTopSetPath( |
| 654 | DataManager.INCLUDE_ALL); |
| 655 | data.putString(AlbumSetPage.KEY_MEDIA_PATH, mediaPath); |
| 656 | mActivity.getStateManager().startState(ManageCachePage.class, data); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 657 | return true; |
| 658 | } |
kaiyiz | 953f7e1 | 2014-10-30 10:09:20 +0800 | [diff] [blame] | 659 | /*case R.id.action_settings: { |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 660 | activity.startActivity(new Intent(activity, GallerySettings.class)); |
| 661 | return true; |
kaiyiz | 953f7e1 | 2014-10-30 10:09:20 +0800 | [diff] [blame] | 662 | }*/ |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 663 | default: |
| 664 | return false; |
| 665 | } |
| 666 | } |
| 667 | |
| 668 | @Override |
| 669 | protected void onStateResult(int requestCode, int resultCode, Intent data) { |
Bobby Georgescu | 0999529 | 2012-09-09 15:15:45 -0700 | [diff] [blame] | 670 | if (data != null && data.getBooleanExtra(AlbumPage.KEY_EMPTY_ALBUM, false)) { |
| 671 | showEmptyAlbumToast(Toast.LENGTH_SHORT); |
| 672 | } |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 673 | switch (requestCode) { |
| 674 | case REQUEST_DO_ANIMATION: { |
Owen Lin | 2341c19 | 2012-03-23 14:59:14 +0800 | [diff] [blame] | 675 | mSlotView.startRisingAnimation(); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 676 | } |
| 677 | } |
| 678 | } |
| 679 | |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 680 | /*private String getSelectedString() { |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 681 | int count = mSelectionManager.getSelectedCount(); |
Ray Chen | 8cab3e8 | 2012-03-20 16:32:57 +0800 | [diff] [blame] | 682 | int action = mActionBar.getClusterTypeAction(); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 683 | int string = action == FilterUtils.CLUSTER_BY_ALBUM |
| 684 | ? R.plurals.number_of_albums_selected |
| 685 | : R.plurals.number_of_groups_selected; |
| 686 | String format = mActivity.getResources().getQuantityString(string, count); |
| 687 | return String.format(format, count); |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 688 | }*/ |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 689 | |
Owen Lin | 2341c19 | 2012-03-23 14:59:14 +0800 | [diff] [blame] | 690 | @Override |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 691 | public void onSelectionModeChange(int mode) { |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 692 | switch (mode) { |
| 693 | case SelectionManager.ENTER_SELECTION_MODE: { |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 694 | //mActionBar.disableClusterMenu(true); |
Owen Lin | 2bb717f | 2012-07-13 17:23:05 +0800 | [diff] [blame] | 695 | mActionModeHandler.startActionMode(); |
Bobby Georgescu | bcb4278 | 2012-10-31 16:33:56 -0700 | [diff] [blame] | 696 | performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); |
Joey Rizzoli | 0a42172 | 2016-06-01 14:04:38 +0200 | [diff] [blame^] | 697 | ((GalleryActivity)mActivity).toggleNavBar(false); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 698 | break; |
| 699 | } |
| 700 | case SelectionManager.LEAVE_SELECTION_MODE: { |
Owen Lin | 2bb717f | 2012-07-13 17:23:05 +0800 | [diff] [blame] | 701 | mActionModeHandler.finishActionMode(); |
Joey Rizzoli | 0a42172 | 2016-06-01 14:04:38 +0200 | [diff] [blame^] | 702 | ((GalleryActivity)mActivity).toggleNavBar(true); |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 703 | /*if (mShowClusterMenu) { |
Ray Chen | 8cab3e8 | 2012-03-20 16:32:57 +0800 | [diff] [blame] | 704 | mActionBar.enableClusterMenu(mSelectedAction, this); |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 705 | }*/ |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 706 | mRootPane.invalidate(); |
| 707 | break; |
| 708 | } |
| 709 | case SelectionManager.SELECT_ALL_MODE: { |
Ray Chen | 21c2e66 | 2012-05-03 13:10:51 +0800 | [diff] [blame] | 710 | mActionModeHandler.updateSupportedOperation(); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 711 | mRootPane.invalidate(); |
| 712 | break; |
| 713 | } |
| 714 | } |
| 715 | } |
| 716 | |
Owen Lin | 2341c19 | 2012-03-23 14:59:14 +0800 | [diff] [blame] | 717 | @Override |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 718 | public void onSelectionChange(Path path, boolean selected) { |
Ravi Banuri | 49f14dd | 2015-10-21 15:54:59 +0530 | [diff] [blame] | 719 | // mActionModeHandler.setTitle(getSelectedString()); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 720 | mActionModeHandler.updateSupportedOperation(path, selected); |
| 721 | } |
| 722 | |
| 723 | private void hideDetails() { |
| 724 | mShowDetails = false; |
Ray Chen | 4105e22 | 2011-08-24 11:40:04 +0800 | [diff] [blame] | 725 | mDetailsHelper.hide(); |
Owen Lin | 31cac30 | 2012-04-04 10:24:08 +0800 | [diff] [blame] | 726 | mAlbumSetView.setHighlightItemPath(null); |
Owen Lin | 7260f6f | 2012-03-22 14:14:40 +0800 | [diff] [blame] | 727 | mSlotView.invalidate(); |
Joey Rizzoli | 0a42172 | 2016-06-01 14:04:38 +0200 | [diff] [blame^] | 728 | ((GalleryActivity)mActivity).toggleNavBar(true); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 729 | } |
| 730 | |
| 731 | private void showDetails() { |
| 732 | mShowDetails = true; |
Ray Chen | 4105e22 | 2011-08-24 11:40:04 +0800 | [diff] [blame] | 733 | if (mDetailsHelper == null) { |
Joey Rizzoli | 0a42172 | 2016-06-01 14:04:38 +0200 | [diff] [blame^] | 734 | ((GalleryActivity)mActivity).toggleNavBar(false); |
Ray Chen | 4105e22 | 2011-08-24 11:40:04 +0800 | [diff] [blame] | 735 | mDetailsHelper = new DetailsHelper(mActivity, mRootPane, mDetailsSource); |
| 736 | mDetailsHelper.setCloseListener(new CloseListener() { |
Owen Lin | 2341c19 | 2012-03-23 14:59:14 +0800 | [diff] [blame] | 737 | @Override |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 738 | public void onClose() { |
| 739 | hideDetails(); |
| 740 | } |
| 741 | }); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 742 | } |
Ray Chen | 4105e22 | 2011-08-24 11:40:04 +0800 | [diff] [blame] | 743 | mDetailsHelper.show(); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 744 | } |
| 745 | |
Hung-ying Tyan | 57cbaa1 | 2011-09-30 14:42:50 +0800 | [diff] [blame] | 746 | @Override |
| 747 | public void onSyncDone(final MediaSet mediaSet, final int resultCode) { |
| 748 | if (resultCode == MediaSet.SYNC_RESULT_ERROR) { |
| 749 | Log.d(TAG, "onSyncDone: " + Utils.maskDebugInfo(mediaSet.getName()) + " result=" |
| 750 | + resultCode); |
| 751 | } |
| 752 | ((Activity) mActivity).runOnUiThread(new Runnable() { |
| 753 | @Override |
| 754 | public void run() { |
Owen Lin | 71632ac | 2012-04-05 12:02:01 +0800 | [diff] [blame] | 755 | GLRoot root = mActivity.getGLRoot(); |
| 756 | root.lockRenderThread(); |
| 757 | try { |
| 758 | if (resultCode == MediaSet.SYNC_RESULT_SUCCESS) { |
| 759 | mInitialSynced = true; |
| 760 | } |
| 761 | clearLoadingBit(BIT_LOADING_SYNC); |
| 762 | if (resultCode == MediaSet.SYNC_RESULT_ERROR && mIsActive) { |
Ray Chen | e8c1e69 | 2012-05-17 12:29:12 +0800 | [diff] [blame] | 763 | Log.w(TAG, "failed to load album set"); |
Owen Lin | 71632ac | 2012-04-05 12:02:01 +0800 | [diff] [blame] | 764 | } |
| 765 | } finally { |
| 766 | root.unlockRenderThread(); |
Hung-ying Tyan | 57cbaa1 | 2011-09-30 14:42:50 +0800 | [diff] [blame] | 767 | } |
| 768 | } |
| 769 | }); |
| 770 | } |
| 771 | |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 772 | private class MyLoadingListener implements LoadingListener { |
Owen Lin | 2341c19 | 2012-03-23 14:59:14 +0800 | [diff] [blame] | 773 | @Override |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 774 | public void onLoadingStarted() { |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 775 | setLoadingBit(BIT_LOADING_RELOAD); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 776 | } |
| 777 | |
Owen Lin | 2341c19 | 2012-03-23 14:59:14 +0800 | [diff] [blame] | 778 | @Override |
Hung-ying Tyan | 05da3f5 | 2012-10-30 17:47:35 +0800 | [diff] [blame] | 779 | public void onLoadingFinished(boolean loadingFailed) { |
Owen Lin | fbdd338 | 2011-11-08 19:05:56 +0800 | [diff] [blame] | 780 | clearLoadingBit(BIT_LOADING_RELOAD); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 781 | } |
| 782 | } |
| 783 | |
Ray Chen | 4105e22 | 2011-08-24 11:40:04 +0800 | [diff] [blame] | 784 | private class MyDetailsSource implements DetailsHelper.DetailsSource { |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 785 | private int mIndex; |
Owen Lin | 2341c19 | 2012-03-23 14:59:14 +0800 | [diff] [blame] | 786 | |
| 787 | @Override |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 788 | public int size() { |
| 789 | return mAlbumSetDataAdapter.size(); |
| 790 | } |
| 791 | |
Owen Lin | 2341c19 | 2012-03-23 14:59:14 +0800 | [diff] [blame] | 792 | @Override |
Michael Kolb | 995c456 | 2012-07-20 12:23:09 -0700 | [diff] [blame] | 793 | public int setIndex() { |
| 794 | Path id = mSelectionManager.getSelected(false).get(0); |
| 795 | mIndex = mAlbumSetDataAdapter.findSet(id); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 796 | return mIndex; |
| 797 | } |
| 798 | |
Owen Lin | 2341c19 | 2012-03-23 14:59:14 +0800 | [diff] [blame] | 799 | @Override |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 800 | public MediaDetails getDetails() { |
| 801 | MediaObject item = mAlbumSetDataAdapter.getMediaSet(mIndex); |
| 802 | if (item != null) { |
Owen Lin | 31cac30 | 2012-04-04 10:24:08 +0800 | [diff] [blame] | 803 | mAlbumSetView.setHighlightItemPath(item.getPath()); |
Owen Lin | f9a0a43 | 2011-08-17 22:07:43 +0800 | [diff] [blame] | 804 | return item.getDetails(); |
| 805 | } else { |
| 806 | return null; |
| 807 | } |
| 808 | } |
| 809 | } |
| 810 | } |