summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-06-15 00:34:47 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-06-15 00:34:48 +0000
commitb25b2c41c2fa277e16d708ad827e283efcb86452 (patch)
tree425ac87ddffe38acee29ed8c5af45ac75039dd58
parent90bcafb08ce50800c1d6b8b4844696c109163f05 (diff)
parente8b5d20d94cb03878137a7fdf65d7a88270b73f8 (diff)
downloadandroid_packages_apps_Trebuchet-b25b2c41c2fa277e16d708ad827e283efcb86452.tar.gz
android_packages_apps_Trebuchet-b25b2c41c2fa277e16d708ad827e283efcb86452.tar.bz2
android_packages_apps_Trebuchet-b25b2c41c2fa277e16d708ad827e283efcb86452.zip
Merge "Fixing bug in getDescendantCoordRelativeToParent where it was calculating the coordinates relative to the root's parent" into ub-launcher3-calgary
-rw-r--r--src/com/android/launcher3/Utilities.java11
-rw-r--r--src/com/android/launcher3/dragndrop/DragLayer.java4
2 files changed, 6 insertions, 9 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 4aaa02fd3..35113758a 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -331,7 +331,7 @@ public final class Utilities {
* coordinates.
*
* @param descendant The descendant to which the passed coordinate is relative.
- * @param root The root view to make the coordinates relative to.
+ * @param ancestor The root view to make the coordinates relative to.
* @param coord The coordinate that we want mapped.
* @param includeRootScroll Whether or not to account for the scroll of the descendant:
* sometimes this is relevant as in a child's coordinates within the descendant.
@@ -339,18 +339,17 @@ public final class Utilities {
* this scale factor is assumed to be equal in X and Y, and so if at any point this
* assumption fails, we will need to return a pair of scale factors.
*/
- public static float getDescendantCoordRelativeToParent(View descendant, View root,
- int[] coord, boolean includeRootScroll) {
+ public static float getDescendantCoordRelativeToAncestor(
+ View descendant, View ancestor, int[] coord, boolean includeRootScroll) {
ArrayList<View> ancestorChain = new ArrayList<View>();
float[] pt = {coord[0], coord[1]};
View v = descendant;
- while(v != root && v != null) {
+ while(v != ancestor && v != null) {
ancestorChain.add(v);
v = (View) v.getParent();
}
- ancestorChain.add(root);
float scale = 1.0f;
int count = ancestorChain.size();
@@ -375,7 +374,7 @@ public final class Utilities {
}
/**
- * Inverse of {@link #getDescendantCoordRelativeToParent(View, View, int[], boolean)}.
+ * Inverse of {@link #getDescendantCoordRelativeToAncestor(View, View, int[], boolean)}.
*/
public static float mapCoordInSelfToDescendent(View descendant, View root,
int[] coord) {
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index 765ad64e9..5d212d8aa 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -42,7 +42,6 @@ import android.widget.FrameLayout;
import android.widget.TextView;
import com.android.launcher3.AppWidgetResizeFrame;
-import com.android.launcher3.BaseContainerView;
import com.android.launcher3.CellLayout;
import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.ItemInfo;
@@ -56,7 +55,6 @@ import com.android.launcher3.ShortcutAndWidgetContainer;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
-import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.Folder;
@@ -468,7 +466,7 @@ public class DragLayer extends InsettableFrameLayout {
*/
public float getDescendantCoordRelativeToSelf(View descendant, int[] coord,
boolean includeRootScroll) {
- return Utilities.getDescendantCoordRelativeToParent(descendant, this,
+ return Utilities.getDescendantCoordRelativeToAncestor(descendant, this,
coord, includeRootScroll);
}