Converting widget panel into a floating view
> The widget panel is only inflated when needed > Using the swipe up/down interaction for widgets tray > Removing additional view wrappers from all-apps > Widget tray is preserved across activity recreation > Launcher no longer has WIDGET state, the actual code around the states will be removed in a follow-up cl Bug: 67678570 Bug: 67585158 Change-Id: Ia29a7c33ec81e6c53cc24e2906b7022b6f41755b
This commit is contained in:
1 parent
10a1bd0e65
commit
f1fbc3fbe7
33 files changed
+1026
-1611
No files matched your search
@@ -75,6 +75,9 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
protected CancellationSignal mActiveRequest;
|
||||
private boolean mAnimatePreview = true;
|
||||
|
||||
private boolean mApplyBitmapDeferred = false;
|
||||
private Bitmap mDeferredBitmap;
|
||||
|
||||
protected final BaseActivity mActivity;
|
||||
|
||||
public WidgetCell(Context context) {
|
||||
@@ -150,15 +153,31 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
return mWidgetImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if applying bitmap preview should be deferred. The UI will still load the bitmap, but
|
||||
* will not cause invalidate, so that when deferring is disabled later, all the bitmaps are
|
||||
* ready.
|
||||
* This prevents invalidates while the animation is running.
|
||||
*/
|
||||
public void setApplyBitmapDeferred(boolean isDeferred) {
|
||||
if (mApplyBitmapDeferred != isDeferred) {
|
||||
mApplyBitmapDeferred = isDeferred;
|
||||
if (!mApplyBitmapDeferred && mDeferredBitmap != null) {
|
||||
applyPreview(mDeferredBitmap);
|
||||
mDeferredBitmap = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setAnimatePreview(boolean shouldAnimate) {
|
||||
mAnimatePreview = shouldAnimate;
|
||||
}
|
||||
|
||||
public void applyPreview(Bitmap bitmap) {
|
||||
applyPreview(bitmap, true);
|
||||
}
|
||||
|
||||
public void applyPreview(Bitmap bitmap, boolean animate) {
|
||||
if (mApplyBitmapDeferred) {
|
||||
mDeferredBitmap = bitmap;
|
||||
return;
|
||||
}
|
||||
if (bitmap != null) {
|
||||
mWidgetImage.setBitmap(bitmap,
|
||||
DrawableFactory.get(getContext()).getBadgeForUser(mItem.user, getContext()));
|
||||
@@ -173,15 +192,11 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
}
|
||||
|
||||
public void ensurePreview() {
|
||||
ensurePreview(true);
|
||||
}
|
||||
|
||||
public void ensurePreview(boolean animate) {
|
||||
if (mActiveRequest != null) {
|
||||
return;
|
||||
}
|
||||
mActiveRequest = mWidgetPreviewLoader.getPreview(
|
||||
mItem, mPresetPreviewSize, mPresetPreviewSize, this, animate);
|
||||
mItem, mPresetPreviewSize, mPresetPreviewSize, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user