/*
* 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.launcher2;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.app.AlertDialog;
import android.app.WallpaperManager;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ClipData;
import android.content.ClipDescription;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Camera;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region.Op;
import android.graphics.drawable.Drawable;
import android.os.IBinder;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Pair;
import android.view.Display;
import android.view.DragEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.android.launcher.R;
import com.android.launcher2.FolderIcon.FolderRingAnimator;
import com.android.launcher2.InstallWidgetReceiver.WidgetMimeTypeHandlerData;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
/**
* 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 {
@SuppressWarnings({"UnusedDeclaration"})
private static final String TAG = "Launcher.Workspace";
// Y rotation to apply to the workspace screens
private static final float WORKSPACE_ROTATION = 12.5f;
private static final float WORKSPACE_OVERSCROLL_ROTATION = 24f;
private static float CAMERA_DISTANCE = 6500;
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;
// 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 float mOverScrollMaxBackgroundAlpha = 0.0f;
private int mOverScrollPageIndex = -1;
private AnimatorSet mDividerAnimator;
private float mWallpaperScrollRatio = 1.0f;
private final WallpaperManager mWallpaperManager;
private IBinder mWindowToken;
private static final float WALLPAPER_SCREENS_SPAN = 2f;
private int mDefaultPage;
/**
* 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];
/**
* The CellLayout that is currently being dragged over
*/
private CellLayout mDragTargetLayout = 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[] mTempEstimate = new int[2];
private float[] mDragViewVisualCenter = new float[2];
private float[] mTempDragCoordinates = new float[2];
private float[] mTempCellLayoutCenterCoordinates = new float[2];
private float[] mTempDragBottomRightCoordinates = new float[2];
private Matrix mTempInverseMatrix = new Matrix();
private SpringLoadedDragController mSpringLoadedDragController;
private float mSpringLoadedShrinkFactor;
private static final int DEFAULT_CELL_COUNT_X = 4;
private static final int DEFAULT_CELL_COUNT_Y = 4;
// 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 };
private State mState = State.NORMAL;
private boolean mIsSwitchingState = false;
private boolean mSwitchStateAfterFirstLayout = false;
private State mStateAfterFirstLayout;
private AnimatorSet mAnimator;
private AnimatorListener mChangeStateAnimationListener;
boolean mAnimatingViewIntoPlace = false;
boolean mIsDragOccuring = false;
boolean mChildrenLayersEnabled = true;
/** Is the user is dragging an item near the edge of a page? */
private boolean mInScrollArea = false;
private final HolographicOutlineHelper mOutlineHelper = new HolographicOutlineHelper();
private Bitmap mDragOutline = null;
private final Rect mTempRect = new Rect();
private final int[] mTempXY = new int[2];
private int mDragViewMultiplyColor;
// Paint used to draw external drop outline
private final Paint mExternalDragOutlinePaint = new Paint();
// Camera and Matrix used to determine the final position of a neighboring CellLayout
private final Matrix mMatrix = new Matrix();
private final Camera mCamera = new Camera();
private final float mTempFloat2[] = new float[2];
enum WallpaperVerticalOffset { TOP, MIDDLE, BOTTOM };
int mWallpaperWidth;
int mWallpaperHeight;
WallpaperOffsetInterpolator mWallpaperOffset;
boolean mUpdateWallpaperOffsetImmediately = false;
private Runnable mDelayedResizeRunnable;
private int mDisplayWidth;
private int mDisplayHeight;
private boolean mIsStaticWallpaper;
private int mWallpaperTravelWidth;
// Variables relating to the creation of user folders by hovering shortcuts over shortcuts
private static final int FOLDER_CREATION_TIMEOUT = 250;
private final Alarm mFolderCreationAlarm = new Alarm();
private FolderRingAnimator mDragFolderRingAnimator = null;
private View mLastDragOverView = null;
private boolean mCreateUserFolderOnDrop = false;
// Variables relating to touch disambiguation (scrolling workspace vs. scrolling a widget)
private float mX
没有合适的资源?快使用搜索试试~ 我知道了~
Android 4.0 Launcher2可导入eclipse中直接运行
共1258个文件
png:504个
class:289个
xml:236个
4星 · 超过85%的资源 需积分: 12 66 下载量 43 浏览量
2014-05-15
17:51:39
上传
评论 1
收藏 38.81MB RAR 举报
温馨提示
下载后导入eclipse中,可直接运行,如果代码出现红叉叉,请点project-->clean消除,再运行
资源推荐
资源详情
资源评论
收起资源包目录
Android 4.0 Launcher2可导入eclipse中直接运行 (1258个子文件)
resources.ap_ 13.16MB
jarlist.cache 120B
Workspace.class 80KB
Launcher.class 78KB
AppsCustomizePagedView.class 42KB
CellLayout.class 40KB
PagedView.class 37KB
LauncherModel.class 31KB
Folder.class 30KB
LauncherProvider$DatabaseHelper.class 24KB
LauncherModel$LoaderTask.class 21KB
FolderIcon.class 16KB
DragController.class 16KB
DragLayer.class 15KB
FocusHelper.class 14KB
AppWidgetResizeFrame.class 11KB
PagedViewCellLayout.class 10KB
AppsCustomizeTabHost.class 9KB
BubbleTextView.class 9KB
DeleteDropTarget.class 9KB
IconCache.class 9KB
WallpaperChooserDialogFragment.class 9KB
PagedViewWidget.class 9KB
R$drawable.class 8KB
Utilities.class 7KB
LauncherProvider.class 7KB
Cling.class 7KB
DragView.class 7KB
SearchDropTargetBar.class 7KB
AllAppsList.class 6KB
HolographicOutlineHelper.class 6KB
PagedViewIcon.class 6KB
RocketLauncher$Board.class 6KB
RocketLauncher$Board$FlyingIcon.class 6KB
InstallWidgetReceiver$WidgetListAdapter.class 6KB
CachedTextView.class 5KB
ApplicationInfo.class 5KB
Launcher$RenameFolder.class 5KB
Hotseat.class 5KB
StrokedTextView.class 5KB
CellLayoutChildren.class 5KB
LauncherApplication.class 5KB
ShortcutInfo.class 5KB
LauncherModel$PackageUpdatedTask.class 5KB
Workspace$12.class 5KB
PagedViewCellLayoutChildren.class 5KB
PagedViewIconCache.class 5KB
InfoDropTarget.class 5KB
R$dimen.class 4KB
InstallShortcutReceiver.class 4KB
R$string.class 4KB
PagedViewWithDraggableItems.class 4KB
SmoothPagedView.class 4KB
FolderIcon$FolderRingAnimator.class 4KB
ItemInfo.class 4KB
ButtonDropTarget.class 4KB
Workspace$WallpaperOffsetInterpolator.class 3KB
R$styleable.class 3KB
AppsCustomizeTabHost$3.class 3KB
WallpaperChooserDialogFragment$WallpaperLoader.class 3KB
Launcher$CreateShortcut.class 3KB
CellLayout$LayoutParams.class 3KB
UninstallShortcutReceiver.class 3KB
PagedViewCellLayout$LayoutParams.class 3KB
InterruptibleInOutAnimator.class 3KB
WallpaperChooserDialogFragment$ImageAdapter.class 3KB
LauncherAppWidgetHostView.class 3KB
PagedViewGridLayout.class 3KB
BasicDream.class 3KB
AddAdapter.class 3KB
HolographicViewHelper.class 3KB
FolderInfo.class 3KB
HandleView.class 3KB
R$integer.class 3KB
DragLayer$2.class 3KB
LauncherModel$7.class 3KB
R$id.class 3KB
LauncherModel$ShortcutNameComparator.class 3KB
AsyncTaskPageData.class 3KB
AppsCustomizePagedView$5.class 2KB
FastBitmapDrawable.class 2KB
RocketLauncher$Board$2.class 2KB
DeferredHandler.class 2KB
LauncherModel$6.class 2KB
PagedViewIconCache$Key.class 2KB
LauncherSettings$Favorites.class 2KB
LauncherModel$9.class 2KB
Launcher$11.class 2KB
Workspace$11.class 2KB
Launcher$FunkeyListener.class 2KB
SpringLoadedDragController.class 2KB
FocusOnlyTabWidget.class 2KB
AppsCustomizeAsyncTask.class 2KB
Workspace$5.class 2KB
Workspace$FolderCreationAlarmListener.class 2KB
DragView$1.class 2KB
LauncherModel$WidgetAndShortcutNameComparator.class 2KB
BasicDream$1.class 2KB
R$attr.class 2KB
LauncherProvider$SqlArguments.class 2KB
共 1258 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
星海之辰
- 粉丝: 24
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 卷积神经网络(Convolutional Neural Network,CNN)是一种深度学习模型
- DHT11温湿度传感器是一款常用的数字温湿度传感器,它结合了温度和湿度的测量功能,能够准确感知环境中的温度和湿度,并输出相应的数
- 45-45.渗透测试-天境漏洞扫描工具安装使用
- 当提及“奇怪的数列”时,我首先想到的是斐波那契数列和康托尔数列,这两个数列因其独特的生成规则和性质而显得与众不同 以下是关于这两
- hbase的安装与简单操作
- LAW100-AI大模型测试集
- Pandas 是一个功能强大的 Python 数据分析库
- Windows 安装docker.md
- 4.12作业.sql.sql
- move-base全局路径和局部路径规划
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页