/*
* Copyright (C) 2008 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.launcher3;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.LayoutTransition;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.app.WallpaperManager;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.Region.Op;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.IBinder;
import android.os.Parcelable;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.view.Choreographer;
import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.TextView;
import com.android.launcher3.FolderIcon.FolderRingAnimator;
import com.android.launcher3.Launcher.CustomContentCallbacks;
import com.android.launcher3.LauncherSettings.Favorites;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
/**
* The workspace is a wide area with a wallpaper and a finite number of pages.
* Each page contains a number of icons, folders or widgets the user can
* interact with. A workspace is meant to be used with a fixed width only.
*/
public class Workspace extends SmoothPagedView
implements DropTarget, DragSource, DragScroller, View.OnTouchListener,
DragController.DragListener, LauncherTransitionable, ViewGroup.OnHierarchyChangeListener,
Insettable {
private static final String TAG = "Launcher.Workspace";
// Y rotation to apply to the workspace screens
private static final float WORKSPACE_OVERSCROLL_ROTATION = 24f;
private static final int CHILDREN_OUTLINE_FADE_OUT_DELAY = 0;
private static final int CHILDREN_OUTLINE_FADE_OUT_DURATION = 375;
private static final int CHILDREN_OUTLINE_FADE_IN_DURATION = 100;
private static final int BACKGROUND_FADE_OUT_DURATION = 350;
private static final int ADJACENT_SCREEN_DROP_DURATION = 300;
private static final int FLING_THRESHOLD_VELOCITY = 500;
private static final float ALPHA_CUTOFF_THRESHOLD = 0.01f;
// These animators are used to fade the children's outlines
private ObjectAnimator mChildrenOutlineFadeInAnimation;
private ObjectAnimator mChildrenOutlineFadeOutAnimation;
private float mChildrenOutlineAlpha = 0;
// These properties refer to the background protection gradient used for AllApps and Customize
private ValueAnimator mBackgroundFadeInAnimation;
private ValueAnimator mBackgroundFadeOutAnimation;
private Drawable mBackground;
boolean mDrawBackground = true;
private float mBackgroundAlpha = 0;
private static final long CUSTOM_CONTENT_GESTURE_DELAY = 200;
private long mTouchDownTime = -1;
private long mCustomContentShowTime = -1;
private LayoutTransition mLayoutTransition;
private final WallpaperManager mWallpaperManager;
private IBinder mWindowToken;
private int mOriginalDefaultPage;
private int mDefaultPage;
private ShortcutAndWidgetContainer mDragSourceInternal;
private static boolean sAccessibilityEnabled;
// The screen id used for the empty screen always present to the right.
private final static long EXTRA_EMPTY_SCREEN_ID = -201;
private final static long CUSTOM_CONTENT_SCREEN_ID = -301;
private HashMap<Long, CellLayout> mWorkspaceScreens = new HashMap<Long, CellLayout>();
private ArrayList<Long> mScreenOrder = new ArrayList<Long>();
/**
* CellInfo for the cell that is currently being dragged
*/
private CellLayout.CellInfo mDragInfo;
/**
* Target drop area calculated during last acceptDrop call.
*/
private int[] mTargetCell = new int[2];
private int mDragOverX = -1;
private int mDragOverY = -1;
static Rect mLandscapeCellLayoutMetrics = null;
static Rect mPortraitCellLayoutMetrics = null;
CustomContentCallbacks mCustomContentCallbacks;
boolean mCustomContentShowing;
private float mLastCustomContentScrollProgress = -1f;
private String mCustomContentDescription = "";
/**
* The CellLayout that is currently being dragged over
*/
private CellLayout mDragTargetLayout = null;
/**
* The CellLayout that we will show as glowing
*/
private CellLayout mDragOverlappingLayout = null;
/**
* The CellLayout which will be dropped to
*/
private CellLayout mDropToLayout = null;
private Launcher mLauncher;
private IconCache mIconCache;
private DragController mDragController;
// These are temporary variables to prevent having to allocate a new object just to
// return an (x, y) value from helper functions. Do NOT use them to maintain other state.
private int[] mTempCell = new int[2];
private int[] mTempPt = new int[2];
private int[] mTempEstimate = new int[2];
private float[] mDragViewVisualCenter = new float[2];
private float[] mTempCellLayoutCenterCoordinates = new float[2];
private Matrix mTempInverseMatrix = new Matrix();
private SpringLoadedDragController mSpringLoadedDragController;
private float mSpringLoadedShrinkFactor;
private float mOverviewModeShrinkFactor;
private int mOverviewModePageOffset;
// State variable that indicates whether the pages are small (ie when you're
// in all apps or customize mode)
enum State { NORMAL, SPRING_LOADED, SMALL, OVERVIEW};
private State mState = State.NORMAL;
private boolean mIsSwitchingState = false;
boolean mAnimatingViewIntoPlace = false;
boolean mIsDragOccuring = false;
boolean mChildrenLayersEnabled = true;
private boolean mStripScreensOnPageStopMoving = false;
/** Is the user is dragging an item near the edge of a page? */
private boolean mInScrollArea = false;
private HolographicOutlineHelper mOutlineHelper;
private Bitmap mDragOutline = null;
private final Rect mTempRect = new Rect();
private final int[] mTempXY = new int[2];
private int[] mTempVisiblePagesRange = new int[2];
private boolean mOverscrollTransformsSet;
private float mLastOverscrollPivotX;
public static final int DRAG_BITMAP_PADDING = 2;
private boolean mWorkspaceFadeInAdjacentScreens;
WallpaperOffsetInterpolator mWallpaperOffset;
p
没有合适的资源?快使用搜索试试~ 我知道了~
Launcher3原码
共1627个文件
png:748个
class:514个
xml:205个
需积分: 10 9 下载量 50 浏览量
2016-05-14
08:57:44
上传
评论
收藏 7.52MB ZIP 举报
温馨提示
Android 4.4中的Launcher3原码
资源详情
资源评论
资源推荐
收起资源包目录
Launcher3原码 (1627个子文件)
resources.ap_ 1.3MB
ToggleWeightWatcher.apk 1.93MB
jarlist.cache 120B
Launcher.class 106KB
Workspace.class 103KB
CellLayout.class 60KB
PagedView.class 52KB
AppsCustomizePagedView.class 48KB
LauncherModel.class 48KB
ExifInterface.class 40KB
Folder.class 35KB
LauncherModel$LoaderTask.class 34KB
LauncherProvider$DatabaseHelper.class 30KB
GLES20Canvas.class 26KB
WallpaperPickerActivity.class 24KB
DragLayer.class 22KB
FolderIcon.class 20KB
DragController.class 19KB
WidgetPreviewLoader.class 18KB
ExifParser.class 16KB
TiledImageRenderer.class 16KB
DeleteDropTarget.class 16KB
Cling.class 14KB
FocusHelper.class 14KB
WallpaperCropActivity.class 14KB
ExifTag.class 14KB
AppWidgetResizeFrame.class 13KB
InstallShortcutReceiver.class 12KB
DeviceProfile.class 12KB
WallpaperCropActivity$BitmapCropTask.class 12KB
ExifOutputStream.class 12KB
AppsCustomizeTabHost.class 12KB
BubbleTextView.class 11KB
Hotseat.class 11KB
LauncherProvider.class 10KB
PagedViewCellLayout.class 10KB
Utilities.class 10KB
IconCache.class 10KB
Utils.class 9KB
CropView.class 9KB
LauncherAppState.class 9KB
BitmapUtils.class 9KB
BitmapRegionTileSource.class 8KB
MemoryTracker.class 8KB
DragView.class 8KB
PagedViewWidget.class 8KB
LauncherModel$PackageUpdatedTask.class 8KB
MemoryDumpActivity.class 8KB
TiledImageView.class 7KB
SearchDropTargetBar.class 7KB
ShortcutAndWidgetContainer.class 7KB
SavedWallpaperImages.class 7KB
ShortcutInfo.class 7KB
ExifData.class 7KB
LauncherViewPropertyAnimator.class 7KB
PageIndicator.class 7KB
UploadedTexture.class 7KB
AllAppsList.class 6KB
BlockingGLTextureView$EglHelper.class 6KB
CellLayout$ViewCluster.class 6KB
Stats.class 6KB
HolographicOutlineHelper.class 6KB
AppInfo.class 6KB
ExifModifier.class 6KB
ThirdPartyWallpaperPickerListAdapter.class 6KB
InstallWidgetReceiver$WidgetListAdapter.class 6KB
Workspace$WallpaperOffsetInterpolator.class 5KB
LauncherModel$2.class 5KB
R$string.class 5KB
ButtonDropTarget.class 5KB
UninstallShortcutReceiver.class 5KB
BasicTexture.class 5KB
LiveWallpaperListAdapter$LiveWallpaperEnumerator.class 5KB
FolderIcon$FolderRingAnimator.class 5KB
R$drawable.class 5KB
CellLayout$ReorderHintAnimation.class 5KB
DynamicGrid.class 5KB
WeightWatcher$ProcessWatcher.class 5KB
PagedViewIconCache.class 5KB
PagedViewCellLayoutChildren.class 4KB
AppsCustomizeTabHost$3.class 4KB
FirstFrameAnimatorHelper.class 4KB
LiveWallpaperListAdapter.class 4KB
PagedViewIcon.class 4KB
InfoDropTarget.class 4KB
HolographicLinearLayout.class 4KB
ItemInfo.class 4KB
DeferredHandler.class 4KB
PagedViewWithDraggableItems.class 4KB
BlockingGLTextureView$RenderThread.class 4KB
WallpaperPickerActivity$6.class 4KB
CountedDataInputStream.class 4KB
LauncherAnimUtils.class 4KB
SmoothPagedView.class 4KB
R$styleable.class 4KB
HolographicImageView.class 4KB
TiledImageRenderer$Tile.class 4KB
CellLayout$LayoutParams.class 4KB
PagedView$5.class 4KB
PagedViewGridLayout.class 3KB
共 1627 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17
dztai
- 粉丝: 179
- 资源: 98
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0