Fixing same drawable instance being used with 2 views

Drawable contain a reference to the view which is used to invalidate the view.
If the same drawable is used with two views, only once view will get invalidated.

Bug: 32575647
Change-Id: Ia22310a6bda55ce0a591712761ec8ab1cdbaccdf
This commit is contained in:
Sunny Goyal
2016-11-01 13:42:23 -07:00
parent cc42c5bd10
commit 8b16b96b38
2 changed files with 67 additions and 45 deletions

View File

@@ -16,7 +16,10 @@
package com.android.launcher3.allapps;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.InsetDrawable;
import android.support.v7.widget.RecyclerView;
import android.text.Selection;
import android.text.Spannable;
@@ -100,6 +103,24 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
Selection.setSelection(mSearchQueryBuilder, 0);
}
@Override
protected void updateBackground(
int paddingLeft, int paddingTop, int paddingRight, int paddingBottom) {
if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
if (mLauncher.getDeviceProfile().isVerticalBarLayout()) {
getRevealView().setBackground(new InsetDrawable(mBaseDrawable,
paddingLeft, paddingTop, paddingRight, paddingBottom));
getContentView().setBackground(
new InsetDrawable(new ColorDrawable(Color.TRANSPARENT),
paddingLeft, paddingTop, paddingRight, paddingBottom));
} else {
getRevealView().setBackground(mBaseDrawable);
}
} else {
super.updateBackground(paddingLeft, paddingTop, paddingRight, paddingBottom);
}
}
/**
* Sets the current set of predicted apps.
*/