mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 09:56:49 +00:00
Fixing preloaded widget not getting used for animation
> The preloaded widget was being set in a different instance of PendingAddWidgetInfo and was never getting used for animation. bug: 20699153 Change-Id: Iaec13640e49c66993b4695e4a52dc3a3a2133fb2
This commit is contained in:
@@ -21,7 +21,6 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.RecyclerView.State;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
@@ -74,7 +73,6 @@ public class WidgetsContainerView extends BaseContainerView
|
||||
|
||||
/* Rendering related. */
|
||||
private WidgetPreviewLoader mWidgetPreviewLoader;
|
||||
private WidgetHostViewLoader mWidgetHostViewLoader;
|
||||
|
||||
private Rect mPadding = new Rect();
|
||||
|
||||
@@ -90,7 +88,6 @@ public class WidgetsContainerView extends BaseContainerView
|
||||
super(context, attrs, defStyleAttr);
|
||||
mLauncher = (Launcher) context;
|
||||
mDragController = mLauncher.getDragController();
|
||||
mWidgetHostViewLoader = new WidgetHostViewLoader(mLauncher);
|
||||
mAdapter = new WidgetsListAdapter(context, this, this, mLauncher);
|
||||
mIconCache = (LauncherAppState.getInstance()).getIconCache();
|
||||
|
||||
@@ -170,8 +167,13 @@ public class WidgetsContainerView extends BaseContainerView
|
||||
if (!mLauncher.isDraggingEnabled()) return false;
|
||||
|
||||
boolean status = beginDragging(v);
|
||||
if (status) {
|
||||
mWidgetHostViewLoader.load(v);
|
||||
if (status && v.getTag() instanceof PendingAddWidgetInfo) {
|
||||
WidgetHostViewLoader hostLoader = new WidgetHostViewLoader(mLauncher, v);
|
||||
boolean preloadStatus = hostLoader.preloadWidget();
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, String.format("preloading widget [status=%s]", preloadStatus));
|
||||
}
|
||||
mLauncher.getDragController().addDragListener(hostLoader);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
@@ -325,10 +327,6 @@ public class WidgetsContainerView extends BaseContainerView
|
||||
}
|
||||
d.deferDragViewCleanupPostAnimation = false;
|
||||
}
|
||||
//TODO(hyunyoungs): if drop fails, this call cleans up correctly.
|
||||
// However, in rare corner case where drop succeeds but doesn't end up using the widget
|
||||
// id created by the loader, this finish will leave dangling widget id.
|
||||
mWidgetHostViewLoader.finish(success);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user