/*
* 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.AnimatorListenerAdapter;
import android.animation.LayoutTransition;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.Resources;
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.drawable.Drawable;
import android.os.IBinder;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Property;
import android.util.SparseArray;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.TextView;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.config.ProviderConfig;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.dragndrop.DragScroller;
import com.android.launcher3.dragndrop.DragView;
import com.android.launcher3.dragndrop.SpringLoadedDragController;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.graphics.DragPreviewProvider;
import com.android.launcher3.nano.LauncherLogProto;
import com.android.launcher3.nano.LauncherLogProto.Target;
import com.android.launcher3.util.LongArrayMap;
import com.android.launcher3.util.Thunk;
import com.android.launcher3.util.VerticalFlingDetector;
import com.example.customerlauncher3.DeviceDJMainActivity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import com.example.customerlauncher3.R;
/**
* 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 {
private static final String TAG = "Launcher.Workspace";
private static boolean ENFORCE_DRAG_EVENT_ORDER = false;
private static final int SNAP_OFF_EMPTY_SCREEN_DURATION = 400;
private static final int FADE_EMPTY_SCREEN_DURATION = 150;
private static final int ADJACENT_SCREEN_DROP_DURATION = 300;
private static final boolean MAP_NO_RECURSE = false;
private static final boolean MAP_RECURSE = true;
// The screen id used for the empty screen always present to the right.
public static final long EXTRA_EMPTY_SCREEN_ID = -201;
// The is the first screen. It is always present, even if its empty.
public static final long FIRST_SCREEN_ID = 0;
private final static long CUSTOM_CONTENT_SCREEN_ID = -301;
private static final long CUSTOM_CONTENT_GESTURE_DELAY = 200;
private long mTouchDownTime = -1;
private long mCustomContentShowTime = -1;
private LayoutTransition mLayoutTransition;
private ShortcutAndWidgetContainer mDragSourceInternal;
@Thunk
LongArrayMap<CellLayout> mWorkspaceScreens = new LongArrayMap<>();
@Thunk
ArrayList<Long> mScreenOrder = new ArrayList<Long>();
@Thunk
Runnable mRemoveEmptyScreenRunnable;
@Thunk
boolean mDeferRemoveExtraEmptyScreen = false;
/**
* 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;
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 highlighted
*/
private CellLayout mDragOverlappingLayout = null;
/**
* The CellLayout which will be dropped to
*/
private CellLayout mDropToLayout = null;
@Thunk
DeviceDJMainActivity mDeviceDJMainActivity;
@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 static final Rect sTempRect = new Rect();
private final int[] mTempXY = new int[2];
@Thunk
float[] mDragViewVisualCenter = new float[2];
private float[] mTempCellLayoutCenterCoordinates = new float[2];
private int[] mTempVisiblePagesRange = new int[2];
private Matrix mTempMatrix = new Matrix();
private SpringLoadedDragController mSpringLoadedDragController;
private float mOverviewModeShrinkFactor;
// State variable that indicates whether the pages are small (ie when you're
// in all apps or customize mode)
public enum State {
NORMAL(false, false),
NORMAL_HIDDEN(false, false),
SPRING_LOADED(false, true),
OVERVIEW(true, true),
OVERVIEW_HIDDEN(true, false);
public final boolean shouldUpdateWidget;
public final boolean hasMultipleVisiblePages;
State(boolean shouldUpdateWidget, boolean hasMultipleVisiblePages) {
this.shouldUpdateWidget = shouldUpdateWidget;
this.hasMultipleVisiblePages = hasMultipleVisiblePages;
}
}
// Direction used for moving the workspace and launcher_hotseat UI
public enum Direction {
X(TRANSLATION_X),
Y(TRANSLATION_Y);
private final Property<View, Float> viewProperty;
Direction(Property<View, Float> viewProperty) {
this.viewProperty = viewProperty;
}
}
/**
* These values correspond to {@link Direction#X} & {@link Direction#Y}
*/
private float[] mPageAlpha = new float[]{1, 1};
private float[] mHotseatAlpha = new float[]{1, 1, 1};
@ViewDebug.ExportedProperty(category = "launcher")
private State mState = State.NORMAL;
private boolean mIsSwitchingState = false;
boolean mAnimatingViewIntoPlace = 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 DragPreviewProvider mOutlineProvider = null;
public static final int DRAG_BITMAP_PADDING = DragPreviewProvider.DRAG_BITMAP_PADDING;
private boolean mWorkspaceFadeInAdjacentScreens;
private boolean mUnlockWallpaperFromDefaultPageOnLayout;
@Thunk
Runnable mDelayedResizeRunnable;
private Runnable mDelayedSnapToPageRunnable;
//
没有合适的资源?快使用搜索试试~ 我知道了~
Android仿google系统桌面自定义桌面
共272个文件
xml:108个
java:106个
png:36个
需积分: 0 1 下载量 138 浏览量
2023-05-04
10:06:01
上传
评论
收藏 597KB ZIP 举报
温馨提示
对Google桌面源码进行改造,符合自己需求的桌面程序,可修改图标夜色,文字颜色,拖动规则 小工具:AppWidget 快捷方式:应用图标 文件夹:Folder container:表明图标是放在哪里的,是放在Workspace还是Hotseat,还是文件夹里面的。如果是放在Workspace上的,那么值是LauncherSettings.Favorites.CONTAINER_DESKTOP,如果是放在文件夹里面的那么container的值就是文件夹FolderInfo的id。 cellX,cellY:表明所在屏幕的哪个位置,cellY表明第几行,cellX表明第几列。如果是小工具占用多行多列的情况,就记录他左上角的位置。 spanX,spanY:宽度和高度,快捷方式和文件夹宽高都是1,小工具的宽高就要看具体情况了。 title:标题,显示应用的名字,文件夹的名字,小工具的话就不需要这个属性了。 itemType: 数据库里保存的表明这个ItemInfo具体是哪种类型的ItemInfo,启动的时候好生成具体的ItemInfo子类对象。 ————————
资源推荐
资源详情
资源评论
收起资源包目录
Android仿google系统桌面自定义桌面 (272个子文件)
gradlew.bat 3KB
.gitignore 6B
build.gradle 1KB
settings.gradle 758B
build.gradle 745B
build.gradle 684B
gradlew 6KB
gradle-wrapper.jar 58KB
Workspace.java 131KB
CellLayout.java 110KB
PagedView.java 85KB
LauncherModel.java 62KB
DeviceDJMainActivity.java 61KB
Folder.java 58KB
FolderIcon.java 45KB
DragLayer.java 37KB
DragController.java 29KB
BubbleTextView.java 26KB
FolderPagedView.java 24KB
FocusLogic.java 22KB
DeviceProfile.java 22KB
Utilities.java 21KB
LauncherScroller.java 19KB
InvariantDeviceProfile.java 14KB
DragView.java 13KB
LauncherEdgeEffect.java 13KB
FastBitmapDrawable.java 12KB
PageIndicatorDots.java 12KB
PinchToOverviewListener.java 9KB
UserEventDispatcher.java 9KB
HolographicOutlineHelper.java 9KB
PageIndicatorLineCaret.java 9KB
LightEquipment.java 8KB
PreloadIconDrawable.java 8KB
ShortcutAndWidgetContainer.java 8KB
FileLog.java 8KB
LauncherViewPropertyAnimator.java 8KB
FocusIndicatorHelper.java 7KB
PinchAnimationManager.java 7KB
LoggerUtils.java 7KB
ClippedFolderIconLayoutRule.java 7KB
FirstFrameAnimatorHelper.java 6KB
DragPreviewProvider.java 6KB
ConfirmEditDialog.java 6KB
ItemInfo.java 6KB
SelectMenu2Dialog.java 5KB
DJCell.java 5KB
CaretDrawable.java 5KB
FlingAnimation.java 5KB
ClickShadowView.java 5KB
BorderBitmapDrawable.java 5KB
CommonDaoUtils.java 5KB
InterruptibleInOutAnimator.java 4KB
ScreenUtils.java 4KB
DropTarget.java 4KB
LightEquipmentGroup.java 4KB
ShortcutInfo.java 4KB
FolderInfo.java 4KB
LauncherAnimUtils.java 4KB
PinchThresholdManager.java 3KB
StylusEventHelper.java 3KB
StackFolderIconLayoutRule.java 3KB
InsettableFrameLayout.java 3KB
ViewOnDrawExecutor.java 3KB
ExtendedEditText.java 3KB
DeferredHandler.java 3KB
LauncherRootView.java 3KB
VerticalFlingDetector.java 3KB
DragDriver.java 3KB
Alarm.java 3KB
LauncherLogProto.java 3KB
GridOccupancy.java 3KB
DaoManager.java 3KB
ExternalDragPreviewProvider.java 3KB
ViewGroupFocusHelper.java 3KB
CheckLongPressHelper.java 3KB
LauncherAppState.java 3KB
DragOptions.java 2KB
PageIndicatorCaretLandscape.java 2KB
EditTextClearable.java 2KB
SpringLoadedDragController.java 2KB
PageIndicator.java 2KB
DragSource.java 2KB
MainThreadExecutor.java 2KB
DJScreens.java 2KB
AnotherWindowDragSource.java 2KB
ParcelableSparseArray.java 2KB
FeatureFlags.java 2KB
Thunk.java 2KB
LongArrayMap.java 2KB
LauncherCallbacks.java 2KB
DaoUtilsStore.java 1KB
EventUpdateDJCell.java 1KB
DragScroller.java 1KB
SelectMenu2Adapter.java 1KB
PendingAddItemInfo.java 1KB
SelectMenuBean.java 1KB
LauncherTransitionable.java 1KB
FolderEditText.java 1010B
CellAndSpan.java 983B
共 272 条
- 1
- 2
- 3
资源评论
12345,catchatiger
- 粉丝: 204
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于matlab实现串口发送接收数据 可配置端口,波特率等 发送可选择ASCII方式或HEX方式
- matlab基于BP神经网络手写字母识别(单一).zip代码9
- 基于matlab实现编写的串口调试工具,数据接收部分采用中断方式,保证了实时的数据显示
- 基于matlab实现39节点电力系统合闸角调控过程中的机组和负荷的灵敏度计算.rar
- HBase数据库性能调优
- 原生微信小程序源码 - -首字母排序选择
- 基于QT+C++开发的保卫萝卜塔防游戏+源码(毕业设计&课程设计&项目开发)
- newapp.apk
- 项目申报管理系统论文Java项目
- 8数码、α-β搜索的博弈树算法编写一字棋游戏、Fisher线性分类器、感知器算法、SVM 分类器、卷积神经网络 CNN 框架
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功