Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e21a11f authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 8209 into donut

* changes:
  Work around StateListDrawable padding in search suggestions
parents 356d4a14 8051172a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableContainer;
import android.graphics.drawable.StateListDrawable;
import android.net.Uri;
import android.os.Bundle;
@@ -359,6 +360,10 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
            newBg.addState(new int[]{android.R.attr.state_selected}, transparent);
            newBg.addState(new int[]{android.R.attr.state_pressed}, transparent);
            newBg.addState(new int[]{}, background);
            // Workaround for the fact that StateListDrawable.getPadding(Rect) always returns
            // true, and thus sets the padding of any view that has it as a background.
            ((DrawableContainer.DrawableContainerState) newBg.getConstantState())
                    .setVariablePadding(true);
            mBackgroundsCache.put(backgroundColor, newBg.getConstantState());
            return newBg;
        }