use of com.android.gallery3d.data.Path in project android_packages_apps_Gallery2 by LineageOS.
the class PhotoPage method on3DButtonClicked.
@Override
public void on3DButtonClicked() {
if (mCurrentPhoto != null) {
Path p = mCurrentPhoto.getPath();
Uri uri = mActivity.getDataManager().getContentUri(p);
Intent intent = new Intent();
intent.setClass(mActivity, ThreeDimensionalActivity.class);
intent.setData(uri);
mActivity.startActivity(intent);
}
}
use of com.android.gallery3d.data.Path in project android_packages_apps_Gallery2 by LineageOS.
the class PhotoDataAdapter method updateImageCache.
private void updateImageCache() {
HashSet<Path> toBeRemoved = new HashSet<Path>(mImageCache.keySet());
for (int i = mActiveStart; i < mActiveEnd; ++i) {
MediaItem item = mData[i % DATA_CACHE_SIZE];
if (item == null)
continue;
Path path = item.getPath();
ImageEntry entry = mImageCache.get(path);
toBeRemoved.remove(path);
if (entry != null) {
if (Math.abs(i - mCurrentIndex) > 1) {
if (entry.fullImageTask != null) {
entry.fullImageTask.cancel();
entry.fullImageTask = null;
}
entry.fullImage = null;
entry.requestedFullImage = MediaObject.INVALID_DATA_VERSION;
}
if (entry.requestedScreenNail != item.getDataVersion()) {
// still a placeholder.
if (entry.screenNail instanceof TiledScreenNail) {
TiledScreenNail s = (TiledScreenNail) entry.screenNail;
s.updatePlaceholderSize(item.getWidth(), item.getHeight());
}
}
if (Math.abs(i - mCurrentIndex) > 0) {
if (entry.gifDecoderTask != null) {
entry.gifDecoderTask.cancel();
entry.gifDecoderTask = null;
}
entry.gifDecoder = null;
entry.requestedGif = MediaItem.INVALID_DATA_VERSION;
if (null != entry.currentGifFrame) {
// recycle cached gif frame
entry.currentGifFrame.recycle();
entry.currentGifFrame = null;
}
}
} else {
entry = new ImageEntry();
mImageCache.put(path, entry);
}
}
// Clear the data and requests for ImageEntries outside the new window.
for (Path path : toBeRemoved) {
ImageEntry entry = mImageCache.remove(path);
if (entry.fullImageTask != null)
entry.fullImageTask.cancel();
if (entry.screenNailTask != null)
entry.screenNailTask.cancel();
if (entry.screenNail != null)
entry.screenNail.recycle();
}
updateScreenNailUploadQueue();
}
use of com.android.gallery3d.data.Path in project android_packages_apps_Gallery2 by LineageOS.
the class TimeLinePage method onLongTap.
public void onLongTap(int slotIndex, boolean isTitle) {
if (mGetContent)
return;
if (isTitle) {
MediaSet targetSet = mAlbumDataAdapter.getMediaSet(slotIndex);
if (targetSet == null)
return;
ArrayList<Path> paths = ((ClusterAlbum) targetSet).getMediaItems();
if (paths == null || paths.size() <= 0)
return;
mSelectionManager.setAutoLeaveSelectionMode(true);
mSelectionManager.toggleTimeLineSet(paths);
mSlotView.invalidate();
} else {
MediaItem item = mAlbumDataAdapter.get(slotIndex);
if (item == null)
return;
mSelectionManager.setAutoLeaveSelectionMode(true);
mSelectionManager.toggle(item.getPath());
mSlotView.invalidate();
}
}
use of com.android.gallery3d.data.Path in project android_packages_apps_Gallery2 by LineageOS.
the class TimeLinePage method onSingleTapUp.
private void onSingleTapUp(int slotIndex, boolean isTitle) {
if (!mIsActive)
return;
if (mSelectionManager.inSelectionMode()) {
if (isTitle) {
MediaSet targetSet = mAlbumDataAdapter.getMediaSet(slotIndex);
if (targetSet == null)
return;
ArrayList<Path> paths = ((ClusterAlbum) targetSet).getMediaItems();
if (paths == null || paths.size() <= 0)
return;
mSelectionManager.toggleTimeLineSet(paths);
mSlotView.invalidate();
} else {
MediaItem item = mAlbumDataAdapter.get(slotIndex);
// Item not ready yet, ignore the click
if (item == null)
return;
if (mSelectionManager.getSelectedCount() > 0) {
if (!ActionModeHandler.isThreadComplete)
return;
}
mSelectionManager.toggle(item.getPath());
mSlotView.invalidate();
}
} else if (!isTitle) {
// Render transition in pressed state
mAlbumView.setPressedIndex(slotIndex);
mAlbumView.setPressedUp();
mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PICK_PHOTO, slotIndex, 0), FadeTexture.DURATION);
}
}
use of com.android.gallery3d.data.Path in project android_packages_apps_Gallery2 by LineageOS.
the class GalleryProvider method query.
// TODO: consider concurrent access
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
long token = Binder.clearCallingIdentity();
try {
Path path = Path.fromString(uri.getPath());
MediaObject object = mDataManager.getMediaObject(path);
if (object == null) {
Log.w(TAG, "cannot find: " + uri);
return null;
}
if (PicasaSource.isPicasaImage(object)) {
return queryPicasaItem(object, projection, selection, selectionArgs, sortOrder);
} else {
return null;
}
} finally {
Binder.restoreCallingIdentity(token);
}
}
Aggregations