/*
* 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.hs.launcher;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.LayoutTransition;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.WallpaperManager;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
import android.content.Context;
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.Paint;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.Region.Op;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Parcelable;
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.accessibility.AccessibilityManager;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.TextView;
import com.hs.launcher.FolderIcon.FolderRingAnimator;
import com.hs.launcher.Launcher.CustomContentCallbacks;
import com.hs.launcher.Launcher.LauncherOverlay;
import com.hs.launcher.LauncherSettings.Favorites;
import com.hs.launcher.UninstallDropTarget.UninstallSource;
import com.hs.launcher.accessibility.LauncherAccessibilityDelegate;
import com.hs.launcher.accessibility.LauncherAccessibilityDelegate.AccessibilityDragSource;
import com.hs.launcher.accessibility.OverviewScreenAccessibilityDelegate;
import com.hs.launcher.compat.UserHandleCompat;
import com.hs.launcher.util.LongArrayMap;
import com.hs.launcher.util.Thunk;
import com.hs.launcher.util.WallpaperUtils;
import com.hs.launcher.widget.PendingAddShortcutInfo;
import com.hs.launcher.widget.PendingAddWidgetInfo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 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 PagedView
implements DropTarget, DragSource, DragScroller, View.OnTouchListener,
DragController.DragListener, LauncherTransitionable, ViewGroup.OnHierarchyChangeListener,
Insettable, UninstallSource, AccessibilityDragSource, Stats.LaunchSourceProvider {
private static final String TAG = "Launcher.Workspace";
private static boolean ENFORCE_DRAG_EVENT_ORDER = false;
protected static final int SNAP_OFF_EMPTY_SCREEN_DURATION = 400;
protected static final int FADE_EMPTY_SCREEN_DURATION = 150;
private static final int ADJACENT_SCREEN_DROP_DURATION = 300;
static final boolean MAP_NO_RECURSE = false;
static final boolean MAP_RECURSE = true;
private static final long CUSTOM_CONTENT_GESTURE_DELAY = 200;
private long mTouchDownTime = -1;
private long mCustomContentShowTime = -1;
private LayoutTransition mLayoutTransition;
@Thunk final WallpaperManager mWallpaperManager;
@Thunk IBinder mWindowToken;
private int mOriginalDefaultPage;
private int mDefaultPage;
private ShortcutAndWidgetContainer mDragSourceInternal;
// The screen id used for the empty screen always present to the right.
final static long EXTRA_EMPTY_SCREEN_ID = -201;
private final static long CUSTOM_CONTENT_SCREEN_ID = -301;
@Thunk LongArrayMap<CellLayout> mWorkspaceScreens = new LongArrayMap<>();
@Thunk ArrayList<Long> mScreenOrder = new ArrayList<Long>();
@Thunk Runnable mRemoveEmptyScreenRunnable;
@Thunk boolean mDeferRemoveExtraEmptyScreen = false;
@Thunk boolean mAddNewPageOnDrag = true;
/**
* CellInfo for the cell that is currently being dragged
*/
private CellLayout.CellInfo mDragInfo;
/**
* Target drop area calculated during last acceptDrop call.
*/
@Thunk 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
*/
@Thunk 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;
@Thunk Launcher mLauncher;
@Thunk IconCache mIconCache;
@Thunk 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];
@Thunk 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;
// State variable that indicates whether the pages are small (ie when you're
// in all apps or customize mode)
enum State {
NORMAL (SearchDropTargetBar.State.SEARCH_BAR),
NORMAL_HIDDEN (SearchDropTargetBar.State.INVISIBLE),
SPRING_LOADED (SearchDropTargetBar.State.DROP_TARGET),
OVERVIEW (SearchDropTargetBar.State.INVISIBLE),
OVERVIEW_HIDDEN (SearchDropTargetBar.State.INVISIBLE);
private final SearchDropTargetBar.State mBarState;
State(SearchDropTargetBar.State searchBarState) {
mBarState = searchBarState;
}
public SearchDropTargetBar.State getSearchDropTargetBarState() {
return mBarState;
}
};
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;
@Thunk Bitmap mDragOutline = null;
private static final Rect sTempRect = new Rect();
private final int[] mTempXY = new int[2];
private int[] mTe
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Launcher源码(Android 6.0系统原生) (545个子文件)
build.gradle 1KB
Workspace.java 177KB
LauncherModel.java 174KB
Launcher.java 171KB
CellLayout.java 114KB
ExifInterface.java 90KB
PagedView.java 87KB
LauncherBackupHelper.java 51KB
Folder.java 51KB
WallpaperPickerActivity.java 47KB
GLES20Canvas.java 37KB
DragLayer.java 37KB
IconCache.java 37KB
LauncherStateTransitionAnimation.java 35KB
LauncherProvider.java 35KB
ExifTag.java 34KB
ExifParser.java 34KB
MigrateFromRestoreTask.java 31KB
FolderIcon.java 30KB
DragController.java 30KB
WidgetPreviewLoader.java 28KB
Utilities.java 27KB
AutoInstallsLayout.java 27KB
TiledImageRenderer.java 27KB
AlphabeticalAppsList.java 25KB
FolderPagedView.java 24KB
AllAppsContainerView.java 24KB
AllAppsGridAdapter.java 23KB
BubbleTextView.java 23KB
DeviceProfile.java 22KB
WorkspaceStateTransitionAnimation.java 22KB
ExifOutputStream.java 20KB
FocusHelper.java 20KB
FocusLogic.java 19KB
AllAppsRecyclerView.java 19KB
AppWidgetResizeFrame.java 19KB
LauncherScroller.java 19KB
InstallShortcutReceiver.java 18KB
WallpaperCropActivity.java 18KB
LauncherAccessibilityDelegate.java 17KB
BitmapRegionTileSource.java 17KB
BitmapCropTask.java 16KB
WidgetsContainerView.java 14KB
LauncherEdgeEffect.java 13KB
ManagedProfileHeuristic.java 13KB
InvariantDeviceProfile.java 12KB
DragView.java 12KB
BaseRecyclerViewFastScrollBar.java 12KB
CropView.java 11KB
DefaultLayoutParser.java 11KB
PendingAppWidgetHostView.java 11KB
LauncherClings.java 10KB
TiledImageView.java 10KB
ButtonDropTarget.java 10KB
BaseRecyclerView.java 10KB
DefaultAppSearchController.java 10KB
LauncherSettings.java 10KB
ShortcutInfo.java 10KB
ExifData.java 10KB
LauncherAppsCompatV16.java 9KB
UploadedTexture.java 9KB
SearchDropTargetBar.java 9KB
SavedWallpaperImages.java 9KB
WeightWatcher.java 9KB
GLCanvas.java 8KB
AllAppsList.java 8KB
ShortcutAndWidgetContainer.java 8KB
PageIndicator.java 8KB
WidgetsListAdapter.java 8KB
PreloadIconDrawable.java 8KB
LauncherViewPropertyAnimator.java 8KB
MemoryTracker.java 8KB
WidgetCell.java 8KB
WidgetsModel.java 8KB
HolographicOutlineHelper.java 7KB
ExifModifier.java 7KB
FastBitmapDrawable.java 7KB
LiveWallpaperListAdapter.java 7KB
FocusIndicatorView.java 7KB
BasicTexture.java 6KB
WorkspaceAccessibilityHelper.java 6KB
MemoryDumpActivity.java 6KB
FirstFrameAnimatorHelper.java 6KB
DeleteDropTarget.java 6KB
AllAppsBackgroundDrawable.java 6KB
LauncherAppWidgetHostView.java 6KB
LauncherAppState.java 6KB
WidgetHostViewLoader.java 6KB
AlphabeticIndexCompat.java 6KB
ItemInfo.java 6KB
Stats.java 6KB
BaseRecyclerViewFastScrollPopup.java 6KB
DropTarget.java 6KB
BaseContainerView.java 6KB
ThirdPartyWallpaperPickerListAdapter.java 5KB
LauncherAppWidgetProviderInfo.java 5KB
Hotseat.java 5KB
Partner.java 5KB
WallpaperUtils.java 5KB
WidgetsRecyclerView.java 5KB
共 545 条
- 1
- 2
- 3
- 4
- 5
- 6
倔强青铜
- 粉丝: 17
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页