final int oldDragCellX = mDragCell[0];
final int oldDragCellY = mDragCell[1];
- if (outlineProvider == null || outlineProvider.gerenatedDragOutline == null) {
+ if (outlineProvider == null || outlineProvider.generatedDragOutline == null) {
return;
}
- Bitmap dragOutline = outlineProvider.gerenatedDragOutline;
+ Bitmap dragOutline = outlineProvider.generatedDragOutline;
if (cellX != oldDragCellX || cellY != oldDragCellY) {
Point dragOffset = dragObject.dragView.getDragVisualizeOffset();
Rect dragRegion = dragObject.dragView.getDragRegion();
/**
* Handle an object being dropped on the DropTarget
- *
- * @param source DragSource where the drag started
- * @param x X coordinate of the drop location
- * @param y Y coordinate of the drop location
- * @param xOffset Horizontal offset with the object being dragged where the original
- * touch happened
- * @param yOffset Vertical offset with the object being dragged where the original
- * touch happened
- * @param dragView The DragView that's being dragged around on screen.
- * @param dragInfo Data associated with the object being dragged
- *
*/
void onDrop(DragObject dragObject);
/**
* Check if a drop action can occur at, or near, the requested location.
* This will be called just before onDrop.
- *
- * @param source DragSource where the drag started
- * @param x X coordinate of the drop location
- * @param y Y coordinate of the drop location
- * @param xOffset Horizontal offset with the object being dragged where the
- * original touch happened
- * @param yOffset Vertical offset with the object being dragged where the
- * original touch happened
- * @param dragView The DragView that's being dragged around on screen.
- * @param dragInfo Data associated with the object being dragged
* @return True if the drop will be accepted, false otherwise.
*/
boolean acceptDrop(DragObject dragObject);
}
/**
- * Updates {@param values} to contain versoning information and adds it to the DB.
+ * Updates {@param values} to contain versioning information and adds it to the DB.
* @param values {@link ContentValues} containing icon & title
*/
private void addIconToDB(ContentValues values, ComponentName key,
public long container = NO_ID;
/**
- * Iindicates the screen in which the shortcut appears.
+ * Indicates the screen in which the shortcut appears.
*/
public long screenId = -1;
}
// Setup the drag controller (drop targets have to be added in reverse order in priority)
- mDragController.setDragScoller(mWorkspace);
+ mDragController.setDragScroller(mWorkspace);
mDragController.setScrollView(mDragLayer);
mDragController.setMoveTarget(mWorkspace);
mDragController.addDropTarget(mWorkspace);
* on the home screen.
*/
public void onClickWallpaperPicker(View v) {
- if (!Utilities.isWallapaperAllowed(this)) {
+ if (!Utilities.isWallpaperAllowed(this)) {
Toast.makeText(this, R.string.msg_disabled_by_admin, Toast.LENGTH_SHORT).show();
return;
}
if (DEBUG_WIDGETS) {
Log.d(TAG, "Removing restored widget: id=" + item.appWidgetId
+ " belongs to component " + item.providerName
- + ", as the povider is null");
+ + ", as the provider is null");
}
LauncherModel.deleteItemFromDatabase(this, item);
return;
private LauncherAppState() {
if (sContext == null) {
- throw new IllegalStateException("LauncherAppState inited before app context set");
+ throw new IllegalStateException("LauncherAppState initiated before app context set");
}
- Log.v(Launcher.TAG, "LauncherAppState inited");
+ Log.v(Launcher.TAG, "LauncherAppState initiated");
if (TestingUtils.MEMORY_DUMP_ENABLED) {
TestingUtils.startTrackingMemory(sContext);
canvas.translate(display.left, display.top);
canvas.rotate(270);
- getEdgeVerticalPostion(sTmpIntPoint);
+ getEdgeVerticalPosition(sTmpIntPoint);
canvas.translate(display.top - sTmpIntPoint[1], 0);
mEdgeGlowLeft.setSize(sTmpIntPoint[1] - sTmpIntPoint[0], display.width());
if (mEdgeGlowLeft.draw(canvas)) {
canvas.translate(display.left + mPageScrolls[mIsRtl ? 0 : (getPageCount() - 1)], display.top);
canvas.rotate(90);
- getEdgeVerticalPostion(sTmpIntPoint);
+ getEdgeVerticalPosition(sTmpIntPoint);
canvas.translate(sTmpIntPoint[0] - display.top, -display.width());
mEdgeGlowRight.setSize(sTmpIntPoint[1] - sTmpIntPoint[0], display.width());
/**
* Returns the top and bottom position for the edge effect.
*/
- protected abstract void getEdgeVerticalPostion(int[] pos);
+ protected abstract void getEdgeVerticalPosition(int[] pos);
@Override
public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
/**
* Meta data that is used for deferred binding.
- * e.g., this object is used to pass information on dragable targets when they are dropped onto
+ * e.g., this object is used to pass information on draggable targets when they are dropped onto
* the workspace from another container.
*/
public class PendingAddItemInfo extends ItemInfo {
private static final float ANIMATION_PROGRESS_STARTED = 0f;
private static final float ANIMATION_PROGRESS_COMPLETED = 1.0f;
- private static final float MIN_SATUNATION = 0.2f;
+ private static final float MIN_SATURATION = 0.2f;
private static final float MIN_LIGHTNESS = 0.6f;
private static final float ICON_SCALE_FACTOR = 0.5f;
// Make sure that the dominant color has enough saturation to be visible properly.
float[] hsv = new float[3];
Color.colorToHSV(mIndicatorColor, hsv);
- if (hsv[1] < MIN_SATUNATION) {
+ if (hsv[1] < MIN_SATURATION) {
mIndicatorColor = DEFAULT_COLOR;
return mIndicatorColor;
}
return ATLEAST_LOLLIPOP && powerManager.isPowerSaveMode();
}
- public static boolean isWallapaperAllowed(Context context) {
+ public static boolean isWallpaperAllowed(Context context) {
if (isNycOrAbove()) {
try {
WallpaperManager wm = context.getSystemService(WallpaperManager.class);
import com.android.launcher3.Launcher.CustomContentCallbacks;
import com.android.launcher3.Launcher.LauncherOverlay;
import com.android.launcher3.UninstallDropTarget.DropTargetSource;
-import com.android.launcher3.accessibility.AccessibileDragListenerAdapter;
+import com.android.launcher3.accessibility.AccessibleDragListenerAdapter;
import com.android.launcher3.accessibility.OverviewAccessibilityDelegate;
import com.android.launcher3.accessibility.OverviewScreenAccessibilityDelegate;
import com.android.launcher3.accessibility.WorkspaceAccessibilityHelper;
LauncherOverlay mLauncherOverlay;
boolean mScrollInteractionBegan;
boolean mStartedSendingScrollEvents;
- float mLastOverlaySroll = 0;
+ float mLastOverlayScroll = 0;
// Total over scrollX in the overlay direction.
private int mUnboundedScrollX;
private boolean mForceDrawAdjacentPages = false;
@Override
public void onDragStart(DropTarget.DragObject dragObject, DragOptions options) {
if (ENFORCE_DRAG_EVENT_ORDER) {
- enfoceDragParity("onDragStart", 0, 0);
+ enforceDragParity("onDragStart", 0, 0);
}
if (mOutlineProvider != null) {
@Override
public void onDragEnd() {
if (ENFORCE_DRAG_EVENT_ORDER) {
- enfoceDragParity("onDragEnd", 0, 0);
+ enforceDragParity("onDragEnd", 0, 0);
}
if (!mDeferRemoveExtraEmptyScreen) {
/**
* Initializes and binds the first page
- * @param qsb an exisitng qsb to recycle or null.
+ * @param qsb an existing qsb to recycle or null.
*/
public void bindAndInitFirstWorkspaceScreen(View qsb) {
if (!FeatureFlags.QSB_ON_FIRST_SCREEN) {
boolean shouldScrollOverlay = mLauncherOverlay != null &&
((amount <= 0 && !mIsRtl) || (amount >= 0 && mIsRtl));
- boolean shouldZeroOverlay = mLauncherOverlay != null && mLastOverlaySroll != 0 &&
+ boolean shouldZeroOverlay = mLauncherOverlay != null && mLastOverlayScroll != 0 &&
((amount >= 0 && !mIsRtl) || (amount <= 0 && mIsRtl));
if (shouldScrollOverlay) {
mLauncherOverlay.onScrollInteractionBegin();
}
- mLastOverlaySroll = Math.abs(amount / getViewportWidth());
- mLauncherOverlay.onScrollChange(mLastOverlaySroll, mIsRtl);
+ mLastOverlayScroll = Math.abs(amount / getViewportWidth());
+ mLauncherOverlay.onScrollChange(mLastOverlayScroll, mIsRtl);
} else if (shouldOverScroll) {
dampedOverScroll(amount);
}
}
@Override
- protected void getEdgeVerticalPostion(int[] pos) {
+ protected void getEdgeVerticalPosition(int[] pos) {
View child = getChildAt(getPageCount() - 1);
pos[0] = child.getTop();
pos[1] = child.getBottom();
layout.prepareChildForDrag(child);
if (options.isAccessibleDrag) {
- mDragController.addDragListener(new AccessibileDragListenerAdapter(
+ mDragController.addDragListener(new AccessibleDragListenerAdapter(
this, CellLayout.WORKSPACE_ACCESSIBILITY_DRAG) {
@Override
protected void enableAccessibleDrag(boolean enable) {
@Override
public void onDragEnter(DragObject d) {
if (ENFORCE_DRAG_EVENT_ORDER) {
- enfoceDragParity("onDragEnter", 1, 1);
+ enforceDragParity("onDragEnter", 1, 1);
}
mCreateUserFolderOnDrop = false;
@Override
public void onDragExit(DragObject d) {
if (ENFORCE_DRAG_EVENT_ORDER) {
- enfoceDragParity("onDragExit", -1, 0);
+ enforceDragParity("onDragExit", -1, 0);
}
// Here we store the final page that will be dropped to, if the workspace in fact
mLauncher.getDragLayer().hidePageHints();
}
- private void enfoceDragParity(String event, int update, int expectedValue) {
- enfoceDragParity(this, event, update, expectedValue);
+ private void enforceDragParity(String event, int update, int expectedValue) {
+ enforceDragParity(this, event, update, expectedValue);
for (int i = 0; i < getChildCount(); i++) {
- enfoceDragParity(getChildAt(i), event, update, expectedValue);
+ enforceDragParity(getChildAt(i), event, update, expectedValue);
}
}
- private void enfoceDragParity(View v, String event, int update, int expectedValue) {
+ private void enforceDragParity(View v, String event, int update, int expectedValue) {
Object tag = v.getTag(R.id.drag_event_parity);
int value = tag == null ? 0 : (Integer) tag;
value += update;
mTempXY[0] = (int) xy[0];
mTempXY[1] = (int) xy[1];
mLauncher.getDragLayer().getDescendantCoordRelativeToSelf(this, mTempXY, true);
- mLauncher.getDragLayer().mapCoordInSelfToDescendent(hotseat.getLayout(), mTempXY);
+ mLauncher.getDragLayer().mapCoordInSelfToDescendant(hotseat.getLayout(), mTempXY);
xy[0] = mTempXY[0];
xy[1] = mTempXY[1];
* Utility listener to enable/disable accessibility drag flags for a ViewGroup
* containing CellLayouts
*/
-public class AccessibileDragListenerAdapter implements DragListener {
+public class AccessibleDragListenerAdapter implements DragListener {
private final ViewGroup mViewGroup;
private final int mDragType;
* @param dragType either {@link CellLayout#WORKSPACE_ACCESSIBILITY_DRAG} or
* {@link CellLayout#FOLDER_ACCESSIBILITY_DRAG}
*/
- public AccessibileDragListenerAdapter(ViewGroup parent, int dragType) {
+ public AccessibleDragListenerAdapter(ViewGroup parent, int dragType) {
mViewGroup = parent;
mDragType = dragType;
}
Context context = host.getContext();
info.addAction(new AccessibilityAction(OVERVIEW, context.getText(OVERVIEW)));
- if (Utilities.isWallapaperAllowed(context)) {
+ if (Utilities.isWallpaperAllowed(context)) {
info.addAction(new AccessibilityAction(WALLPAPERS, context.getText(WALLPAPERS)));
}
info.addAction(new AccessibilityAction(WIDGETS, context.getText(WIDGETS)));
private AllAppsRecyclerView mRv;
private AlphabeticalAppsList mApps;
- // Keeps track of the current and targetted fast scroll section (the section to scroll to after
+ // Keeps track of the current and targeted fast scroll section (the section to scroll to after
// the initial delay)
int mTargetFastScrollPosition = -1;
@Thunk String mCurrentFastScrollSection;
return item;
}
- public static AdapterItem asSearchDivder(int pos) {
+ public static AdapterItem asSearchDivider(int pos) {
AdapterItem item = new AdapterItem();
item.viewType = AllAppsGridAdapter.VIEW_TYPE_SEARCH_DIVIDER;
item.position = pos;
}
// Add the search divider
- mAdapterItems.add(AdapterItem.asSearchDivder(position++));
+ mAdapterItems.add(AdapterItem.asSearchDivider(position++));
// Process the predicted app components
mPredictedApps.clear();
private void reportDragEnd() {
if (DBG) {
- Log.d(TAG, String.format("onScrolEnd disp=%.1f, velocity=%.1f",
+ Log.d(TAG, String.format("onScrollEnd disp=%.1f, velocity=%.1f",
mDisplacementY, mVelocity));
}
mListener.onDragEnd(mVelocity, Math.abs(mVelocity) > RELEASE_VELOCITY_PX_MS);
HashMap<String, Integer> activePackages = new HashMap<>();
UserHandleCompat user = UserHandleCompat.myUserHandle();
for (SessionInfo info : mInstaller.getAllSessions()) {
- addSessionInfoToCahce(info, user);
+ addSessionInfoToCache(info, user);
if (info.getAppPackageName() != null) {
activePackages.put(info.getAppPackageName(), (int) (info.getProgress() * 100));
mActiveSessions.put(info.getSessionId(), info.getAppPackageName());
return activePackages;
}
- @Thunk void addSessionInfoToCahce(SessionInfo info, UserHandleCompat user) {
+ @Thunk void addSessionInfoToCache(SessionInfo info, UserHandleCompat user) {
String packageName = info.getAppPackageName();
if (packageName != null) {
mCache.cachePackageInstallInfo(packageName, user, info.getAppIcon(),
private void pushSessionDisplayToLauncher(int sessionId) {
SessionInfo session = mInstaller.getSessionInfo(sessionId);
if (session != null && session.getAppPackageName() != null) {
- addSessionInfoToCahce(session, UserHandleCompat.myUserHandle());
+ addSessionInfoToCache(session, UserHandleCompat.myUserHandle());
LauncherAppState app = LauncherAppState.getInstanceNoCreate();
if (app != null) {
dropCoordinates[0] = x;
dropCoordinates[1] = y;
- mLauncher.getDragLayer().mapCoordInSelfToDescendent((View) target, dropCoordinates);
+ mLauncher.getDragLayer().mapCoordInSelfToDescendant((View) target, dropCoordinates);
return target;
}
return null;
}
- public void setDragScoller(DragScroller scroller) {
+ public void setDragScroller(DragScroller scroller) {
mDragScroller = scroller;
}
}
/**
- * Sets the drag listner which will be notified when a drag starts or ends.
+ * Sets the drag listener which will be notified when a drag starts or ends.
*/
public void addDragListener(DragListener l) {
mListeners.add(l);
/**
* Inverse of {@link #getDescendantCoordRelativeToSelf(View, int[])}.
*/
- public float mapCoordInSelfToDescendent(View descendant, int[] coord) {
+ public float mapCoordInSelfToDescendant(View descendant, int[] coord) {
return Utilities.mapCoordInSelfToDescendent(descendant, this, coord);
}
import com.android.launcher3.UninstallDropTarget.DropTargetSource;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace.ItemOperator;
-import com.android.launcher3.accessibility.AccessibileDragListenerAdapter;
+import com.android.launcher3.accessibility.AccessibleDragListenerAdapter;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragController.DragListener;
mDragController.addDragListener(this);
if (options.isAccessibleDrag) {
- mDragController.addDragListener(new AccessibileDragListenerAdapter(
+ mDragController.addDragListener(new AccessibleDragListenerAdapter(
mContent, CellLayout.FOLDER_ACCESSIBILITY_DRAG) {
@Override
}
@Override
- protected void getEdgeVerticalPostion(int[] pos) {
+ protected void getEdgeVerticalPosition(int[] pos) {
pos[0] = 0;
pos[1] = getViewportHeight();
}
// The padding added to the drag view during the preview generation.
public final int previewPadding;
- public Bitmap gerenatedDragOutline;
+ public Bitmap generatedDragOutline;
public DragPreviewProvider(View view) {
mView = view;
}
public final void generateDragOutline(Canvas canvas) {
- if (ProviderConfig.IS_DOGFOOD_BUILD && gerenatedDragOutline != null) {
+ if (ProviderConfig.IS_DOGFOOD_BUILD && generatedDragOutline != null) {
throw new RuntimeException("Drag outline generated twice");
}
- gerenatedDragOutline = createDragOutline(canvas);
+ generatedDragOutline = createDragOutline(canvas);
}
/**
}
/**
- * Modifies {@param xCordinates} to represent a convex border. Fills in all missing values
+ * Modifies {@param xCoordinates} to represent a convex border. Fills in all missing values
* (except on either ends) with appropriate values.
- * @param xCordinates map of x coordinate per y.
+ * @param xCoordinates map of x coordinate per y.
* @param direction 1 for left border and -1 for right border.
* @param topY the first Y position (inclusive) with a valid value.
* @param bottomY the last Y position (inclusive) with a valid value.
*/
private static void convertToConvexArray(
- float[] xCordinates, int direction, int topY, int bottomY) {
- int total = xCordinates.length;
+ float[] xCoordinates, int direction, int topY, int bottomY) {
+ int total = xCoordinates.length;
// The tangent at each pixel.
float[] angles = new float[total - 1];
float lastAngle = Float.MAX_VALUE;
for (int i = topY + 1; i <= bottomY; i++) {
- if (xCordinates[i] <= -1) {
+ if (xCoordinates[i] <= -1) {
continue;
}
int start;
if (lastAngle == Float.MAX_VALUE) {
start = first;
} else {
- float currentAngle = (xCordinates[i] - xCordinates[last]) / (i - last);
+ float currentAngle = (xCoordinates[i] - xCoordinates[last]) / (i - last);
start = last;
// If this position creates a concave angle, keep moving up until we find a
// position which creates a convex angle.
if ((currentAngle - lastAngle) * direction < 0) {
while (start > first) {
start --;
- currentAngle = (xCordinates[i] - xCordinates[start]) / (i - start);
+ currentAngle = (xCoordinates[i] - xCoordinates[start]) / (i - start);
if ((currentAngle - angles[start]) * direction >= 0) {
break;
}
}
// Reset from last check
- lastAngle = (xCordinates[i] - xCordinates[start]) / (i - start);
+ lastAngle = (xCoordinates[i] - xCoordinates[start]) / (i - start);
// Update all the points from start.
for (int j = start; j < i; j++) {
angles[j] = lastAngle;
- xCordinates[j] = xCordinates[start] + lastAngle * (j - start);
+ xCoordinates[j] = xCoordinates[start] + lastAngle * (j - start);
}
last = i;
}
/**
* Manages the creation of {@link LauncherEvent}.
- * To debug this class, execute following command before sideloading a new apk.
+ * To debug this class, execute following command before side loading a new apk.
*
* $ adb shell setprop log.tag.UserEvent VERBOSE
*/
if (screenIds.get(0) != 0) {
// First screen is not 0, we need to rename screens
if (screenIds.indexOf(0L) > -1) {
- // There is already a screen 0. First rename it to a differen screen.
+ // There is already a screen 0. First rename it to a different screen.
long newScreenId = 1;
while (screenIds.indexOf(newScreenId) > -1) newScreenId++;
renameScreen(db, 0, newScreenId);
@Override
public boolean onLongClick(View v) {
if (LOGD) {
- Log.d(TAG, String.format("onLonglick [v=%s]", v));
+ Log.d(TAG, String.format("onLongClick [v=%s]", v));
}
// Return early if this is not initiated from a touch
if (!v.isInTouchMode()) return false;