/*
* Copyright (C) 2009 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.cooliris.media;
import java.util.ArrayList;
import javax.microedition.khronos.opengles.GL11;
import android.hardware.SensorEvent;
import android.opengl.GLU;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.content.Context;
import com.cooliris.app.App;
import com.cooliris.app.Res;
public final class GridLayer extends RootLayer implements MediaFeed.Listener, TimeBar.Listener {
private static final String TAG = "GridLayer";
public static final int STATE_MEDIA_SETS = 0;
public static final int STATE_GRID_VIEW = 1;
public static final int STATE_FULL_SCREEN = 2;
public static final int STATE_TIMELINE = 3;
public static final int ANCHOR_LEFT = 0;
public static final int ANCHOR_RIGHT = 1;
public static final int ANCHOR_CENTER = 2;
public static final int MAX_ITEMS_PER_SLOT = 32;
public static final int MAX_DISPLAYED_ITEMS_PER_SLOT = 4;
public static final int MAX_DISPLAYED_ITEMS_PER_FOCUSED_SLOT = 32;
public static final int MAX_DISPLAY_SLOTS = 96;
public static final int MAX_ITEMS_DRAWABLE = MAX_ITEMS_PER_SLOT * MAX_DISPLAY_SLOTS;
private static final float SLIDESHOW_TRANSITION_TIME = 3.5f;
private HudLayer mHud;
private int mState;
private final IndexRange mBufferedVisibleRange = new IndexRange();
private final IndexRange mVisibleRange = new IndexRange();
private final IndexRange mPreviousDataRange = new IndexRange();
private final IndexRange mCompleteRange = new IndexRange();
private final Pool<Vector3f> mTempVec;
private final Pool<Vector3f> mTempVecAlt;
private final ArrayList<MediaItem> mTempList = new ArrayList<MediaItem>();
private final MediaItem[] mTempHash = new MediaItem[64];
private final Vector3f mDeltaAnchorPositionUncommited = new Vector3f();
private Vector3f mDeltaAnchorPosition = new Vector3f();
// The display primitives.
final private GridDrawables mDrawables;
private float mSelectedAlpha = 0.0f;
private float mTargetAlpha = 0.0f;
final private GridCamera mCamera;
final private GridCameraManager mCameraManager;
final private GridDrawManager mDrawManager;
final private GridInputProcessor mInputProcessor;
private boolean mFeedAboutToChange;
private boolean mPerformingLayoutChange;
private boolean mFeedChanged;
private final LayoutInterface mLayoutInterface;
private static final LayoutInterface sfullScreenLayoutInterface = new GridLayoutInterface(1);
private static final float DEPTH_POSITION = 0.55f;
private MediaFeed mMediaFeed;
private boolean mInAlbum = false;
private int mCurrentExpandedSlot;
private final DisplayList mDisplayList = new DisplayList();
private final DisplayItem[] mDisplayItems = new DisplayItem[MAX_ITEMS_DRAWABLE];
private final DisplaySlot[] mDisplaySlots = new DisplaySlot[MAX_DISPLAY_SLOTS];
private ArrayList<MediaItem> mVisibleItems;
private final BackgroundLayer mBackground;
private boolean mLocationFilter;
private float mZoomValue = 1.0f;
private float mCurrentFocusItemWidth = 1.0f;
private float mCurrentFocusItemHeight = 1.0f;
private float mTimeElapsedSinceGridViewReady = 0.0f;
private boolean mSlideshowMode;
private boolean mNoDeleteMode = false;
private float mTimeElapsedSinceView;
private final MediaBucketList mSelectedBucketList = new MediaBucketList();
private final MediaBucketList mMarkedBucketList = new MediaBucketList();
private float mTimeElapsedSinceStackViewReady;
private Context mContext;
private RenderView mView;
private boolean mPickIntent;
private boolean mViewIntent;
private WakeLock mWakeLock;
private int mStartMemoryRange;
private int mFramesDirty;
private String mRequestFocusContentUri;
private int mFrameCount;
private boolean mRequestToEnterSelection;
private boolean mLayoutChanged = false;
// private ArrayList<Integer> mBreakSlots = new ArrayList<Integer>();
// private ArrayList<Integer> mOldBreakSlots;
// private LongSparseArray<Integer> mBreakSlots = new
// LongSparseArray<Integer>();
// private LongSparseArray<Integer> mOldBreakSlots;
public GridLayer(Context context, int itemWidth, int itemHeight, LayoutInterface layoutInterface, RenderView view) {
mBackground = new BackgroundLayer(this);
mContext = context;
mView = view;
Vector3f[] vectorPool = new Vector3f[128];
int length = vectorPool.length;
for (int i = 0; i < length; ++i) {
vectorPool[i] = new Vector3f();
}
Vector3f[] vectorPoolRenderThread = new Vector3f[128];
length = vectorPoolRenderThread.length;
for (int i = 0; i < length; ++i) {
vectorPoolRenderThread[i] = new Vector3f();
}
mTempVec = new Pool<Vector3f>(vectorPool);
mTempVecAlt = new Pool<Vector3f>(vectorPoolRenderThread);
DisplaySlot[] displaySlots = mDisplaySlots;
for (int i = 0; i < MAX_DISPLAY_SLOTS; ++i) {
DisplaySlot slot = new DisplaySlot();
displaySlots[i] = slot;
}
mLayoutInterface = layoutInterface;
mCamera = new GridCamera(0, 0, itemWidth, itemHeight);
mDrawables = new GridDrawables(itemWidth, itemHeight);
mBufferedVisibleRange.set(Shared.INVALID, Shared.INVALID);
mVisibleRange.set(Shared.INVALID, Shared.INVALID);
mCompleteRange.set(Shared.INVALID, Shared.INVALID);
mPreviousDataRange.set(Shared.INVALID, Shared.INVALID);
mDeltaAnchorPosition.set(0, 0, 0);
mDeltaAnchorPositionUncommited.set(0, 0, 0);
mSelectedBucketList.clear();
mVisibleItems = new ArrayList<MediaItem>();
mHud = new HudLayer(context);
mHud.setContext(context);
mHud.setGridLayer(this);
mHud.getPathBar().clear();
mHud.setGridLayer(this);
mHud.getTimeBar().setListener(this);
mHud.getPathBar().pushLabel(Res.drawable.icon_home_small, context.getResources().getString(Res.string.app_name),
new Runnable() {
public void run() {
if (mHud.getAlpha() == 1.0f) {
if (!mFeedAboutToChange) {
setState(STATE_MEDIA_SETS);
}
} else {
mHud.setAlpha(1.0f);
}
}
});
mCameraManager = new GridCameraManager(mCamera);
mDrawManager = new GridDrawManager(context, mCamera, mDrawables, mDisplayList, mDisplayItems, mDisplaySlots);
mInputProcessor = new GridInputProcessor(context, mCamera, this, mView, mTempVec, mDisplayItems);
setState(STATE_MEDIA_SETS);
}
public HudLayer getHud() {
return mHud;
}
public void shutdown() {
if (mMediaFeed != null) {
mMediaFeed.shutdown();
}
mContext = null;
mSelectedBucketList.clear();
mView = null;
}
public void stop() {
endSlideshow();
mBackground.clear();
handleLowMemory();
}
@Override
public void generate(Rende
没有合适的资源?快使用搜索试试~ 我知道了~
Android系统图库源码
共665个文件
png:248个
class:241个
java:113个
5星 · 超过95%的资源 需积分: 9 643 下载量 10 浏览量
2011-12-09
21:48:04
上传
评论 4
收藏 2.86MB ZIP 举报
温馨提示
Android系统图库源码、Android系统图库源码、Android系统图库源码
资源推荐
资源详情
资源评论
收起资源包目录
Android系统图库源码 (665个子文件)
resources.ap_ 476KB
Gallery.apk 711KB
GridLayer.class 40KB
CacheService.class 37KB
RenderView.class 25KB
MediaFeed.class 23KB
GridInputProcessor.class 22KB
HudLayer.class 22KB
GridDrawManager.class 21KB
CropImage.class 17KB
TimeBar.class 15KB
LocalDataSource.class 15KB
PicasaContentProvider.class 15KB
EntrySchema.class 13KB
ReverseGeocoder.class 12KB
Gallery.class 12KB
UriTexture.class 12KB
PicasaApi.class 11KB
MenuBar.class 11KB
PicasaDataSource.class 11KB
PopupMenu.class 10KB
ImageManager.class 9KB
DiskCache.class 9KB
HighlightView.class 9KB
DisplayItem.class 9KB
GridQuad.class 9KB
DetailMode.class 9KB
MediaSet.class 8KB
ImageViewTouchBase.class 8KB
GDataClient.class 8KB
GridCameraManager.class 8KB
MovieViewControl.class 8KB
Util.class 8KB
Utils.class 8KB
GridCamera.class 8KB
PathBarLayer.class 8KB
MediaItemTexture.class 7KB
TableContentProvider.class 7KB
PicasaService.class 7KB
StringTexture.class 7KB
MediaClustering.class 7KB
Slideshow.class 7KB
CropImageView.class 7KB
MediaBucketList.class 6KB
SortCursor.class 6KB
Photographs.class 6KB
ScaleGestureDetector.class 6KB
Wallpaper.class 6KB
GridQuadFrame.class 6KB
BackgroundLayer.class 6KB
LongSparseArray.class 5KB
DisplayList.class 5KB
PhotoAppWidgetProvider$PhotoDatabaseHelper.class 5KB
GridDrawables.class 5KB
MovieView.class 5KB
MatrixStack.class 5KB
GDataParser.class 5KB
PhotoEntry.class 5KB
CropImage$1.class 5KB
AdaptiveBackgroundTexture.class 5KB
GridQuadMesh.class 4KB
DisplaySlot.class 4KB
CanvasTexture.class 4KB
BitmapManager.class 4KB
App.class 4KB
MediaItem.class 4KB
ImageButton.class 4KB
LoadingLayer.class 4KB
MediaClustering$Cluster.class 4KB
IconTitleDrawable.class 4KB
AlbumEntry.class 4KB
PopupMenu$PopupTexture.class 3KB
PicasaContentProvider$1.class 3KB
PhotoAppWidgetConfigure.class 3KB
CrossFadingTexture.class 3KB
ImageManager$AddImageCancelable.class 3KB
ConcatenatedDataSource.class 3KB
SimpleStringTexture.class 3KB
R$drawable.class 3KB
ArrayUtils.class 3KB
MenuBar$Menu$Builder.class 3KB
MediaFeed$1.class 3KB
PicasaSyncAdapter.class 3KB
PhotoAppWidgetBind.class 3KB
BaseCancelable.class 3KB
R$string.class 3KB
Deque.class 3KB
PicasaContentProvider$2.class 3KB
CropImage$2.class 3KB
LongSparseArray$ArrayUtils.class 3KB
MenuBar$Menu.class 3KB
PhotoAppWidgetProvider.class 3KB
PicasaContentProvider$SyncContext.class 3KB
HudLayer$14.class 3KB
HudLayer$19.class 3KB
Layer.class 2KB
PathBarLayer$Component.class 2KB
BootReceiver.class 2KB
LocationMediaFilter.class 2KB
Util$BackgroundJob.class 2KB
共 665 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
幻影浪子
- 粉丝: 6017
- 资源: 20
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页