Merge "Ensure the icon load request matches the ItemInfo for the floating view." into ub-launcher3-qt-qpr1-dev
This commit is contained in:
commit
8aee0b2cb5
1 file changed
+13
-5
@@ -721,7 +721,7 @@ public class FloatingIconView extends View implements
|
|||||||
*/
|
*/
|
||||||
@UiThread
|
@UiThread
|
||||||
public static IconLoadResult fetchIcon(Launcher l, View v, ItemInfo info, boolean isOpening) {
|
public static IconLoadResult fetchIcon(Launcher l, View v, ItemInfo info, boolean isOpening) {
|
||||||
IconLoadResult result = new IconLoadResult();
|
IconLoadResult result = new IconLoadResult(info);
|
||||||
new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(() -> {
|
new Handler(LauncherModel.getWorkerLooper()).postAtFrontOfQueue(() -> {
|
||||||
RectF position = new RectF();
|
RectF position = new RectF();
|
||||||
getLocationBoundsForView(l, v, isOpening, position);
|
getLocationBoundsForView(l, v, isOpening, position);
|
||||||
@@ -750,10 +750,13 @@ public class FloatingIconView extends View implements
|
|||||||
|
|
||||||
// Get the drawable on the background thread
|
// Get the drawable on the background thread
|
||||||
boolean shouldLoadIcon = originalView.getTag() instanceof ItemInfo && hideOriginal;
|
boolean shouldLoadIcon = originalView.getTag() instanceof ItemInfo && hideOriginal;
|
||||||
view.mIconLoadResult = sIconLoadResult;
|
if (shouldLoadIcon) {
|
||||||
if (shouldLoadIcon && view.mIconLoadResult == null) {
|
if (sIconLoadResult != null && sIconLoadResult.itemInfo == originalView.getTag()) {
|
||||||
view.mIconLoadResult = fetchIcon(launcher, originalView,
|
view.mIconLoadResult = sIconLoadResult;
|
||||||
(ItemInfo) originalView.getTag(), isOpening);
|
} else {
|
||||||
|
view.mIconLoadResult = fetchIcon(launcher, originalView,
|
||||||
|
(ItemInfo) originalView.getTag(), isOpening);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sIconLoadResult = null;
|
sIconLoadResult = null;
|
||||||
|
|
||||||
@@ -895,10 +898,15 @@ public class FloatingIconView extends View implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class IconLoadResult {
|
private static class IconLoadResult {
|
||||||
|
final ItemInfo itemInfo;
|
||||||
Drawable drawable;
|
Drawable drawable;
|
||||||
Drawable badge;
|
Drawable badge;
|
||||||
int iconOffset;
|
int iconOffset;
|
||||||
Runnable onIconLoaded;
|
Runnable onIconLoaded;
|
||||||
boolean isIconLoaded;
|
boolean isIconLoaded;
|
||||||
|
|
||||||
|
public IconLoadResult(ItemInfo itemInfo) {
|
||||||
|
this.itemInfo = itemInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user