Loading src/com/android/launcher3/InvariantDeviceProfile.java +2 −13 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,7 @@ import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.io.IOException; import java.util.ArrayList; import java.util.ArrayList; import java.util.Collections; import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting; Loading Loading @@ -135,7 +136,7 @@ public class InvariantDeviceProfile { float minWidthDps = Utilities.dpiFromPx(Math.min(smallestSize.x, smallestSize.y), dm); float minWidthDps = Utilities.dpiFromPx(Math.min(smallestSize.x, smallestSize.y), dm); float minHeightDps = Utilities.dpiFromPx(Math.min(largestSize.x, largestSize.y), dm); float minHeightDps = Utilities.dpiFromPx(Math.min(largestSize.x, largestSize.y), dm); // Sort the profiles based on the closeness to the device size // Sort the profiles based on the closeness to the device size allOptions.sort((a, b) -> Collections.sort(allOptions, (a, b) -> Float.compare(dist(minWidthDps, minHeightDps, a.minWidthDps, a.minHeightDps), Float.compare(dist(minWidthDps, minHeightDps, a.minWidthDps, a.minHeightDps), dist(minWidthDps, minHeightDps, b.minWidthDps, b.minHeightDps))); dist(minWidthDps, minHeightDps, b.minWidthDps, b.minHeightDps))); DisplayOption interpolatedDisplayOption = DisplayOption interpolatedDisplayOption = Loading Loading @@ -314,18 +315,6 @@ public class InvariantDeviceProfile { return (float) Math.hypot(x1 - x0, y1 - y0); return (float) Math.hypot(x1 - x0, y1 - y0); } } /** * Returns the closest device profiles ordered by closeness to the specified width and height */ @VisibleForTesting static ArrayList<DisplayOption> sortByClosenessToSize( float width, float height, ArrayList<DisplayOption> points) { points.sort((a, b) -> Float.compare(dist(width, height, a.minWidthDps, a.minHeightDps), dist(width, height, b.minWidthDps, b.minHeightDps))); return points; } @VisibleForTesting @VisibleForTesting static DisplayOption invDistWeightedInterpolate(float width, float height, static DisplayOption invDistWeightedInterpolate(float width, float height, ArrayList<DisplayOption> points) { ArrayList<DisplayOption> points) { Loading Loading
src/com/android/launcher3/InvariantDeviceProfile.java +2 −13 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,7 @@ import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.io.IOException; import java.util.ArrayList; import java.util.ArrayList; import java.util.Collections; import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting; Loading Loading @@ -135,7 +136,7 @@ public class InvariantDeviceProfile { float minWidthDps = Utilities.dpiFromPx(Math.min(smallestSize.x, smallestSize.y), dm); float minWidthDps = Utilities.dpiFromPx(Math.min(smallestSize.x, smallestSize.y), dm); float minHeightDps = Utilities.dpiFromPx(Math.min(largestSize.x, largestSize.y), dm); float minHeightDps = Utilities.dpiFromPx(Math.min(largestSize.x, largestSize.y), dm); // Sort the profiles based on the closeness to the device size // Sort the profiles based on the closeness to the device size allOptions.sort((a, b) -> Collections.sort(allOptions, (a, b) -> Float.compare(dist(minWidthDps, minHeightDps, a.minWidthDps, a.minHeightDps), Float.compare(dist(minWidthDps, minHeightDps, a.minWidthDps, a.minHeightDps), dist(minWidthDps, minHeightDps, b.minWidthDps, b.minHeightDps))); dist(minWidthDps, minHeightDps, b.minWidthDps, b.minHeightDps))); DisplayOption interpolatedDisplayOption = DisplayOption interpolatedDisplayOption = Loading Loading @@ -314,18 +315,6 @@ public class InvariantDeviceProfile { return (float) Math.hypot(x1 - x0, y1 - y0); return (float) Math.hypot(x1 - x0, y1 - y0); } } /** * Returns the closest device profiles ordered by closeness to the specified width and height */ @VisibleForTesting static ArrayList<DisplayOption> sortByClosenessToSize( float width, float height, ArrayList<DisplayOption> points) { points.sort((a, b) -> Float.compare(dist(width, height, a.minWidthDps, a.minHeightDps), dist(width, height, b.minWidthDps, b.minHeightDps))); return points; } @VisibleForTesting @VisibleForTesting static DisplayOption invDistWeightedInterpolate(float width, float height, static DisplayOption invDistWeightedInterpolate(float width, float height, ArrayList<DisplayOption> points) { ArrayList<DisplayOption> points) { Loading