Add local wallpaper color extraction to folder backgrounds.

- Starts listening to local wallpaper colors as soon as folder
  is positioned.
- The folder open animation already has a background color
  animator.
- For simplicity, folder open animation always starts
  first, and then we cancel its background color animator,
  and start a new animator to the extracted color.
- setAutoCancel would be handy here, but it does not work, will
  track in a separate bug.
- Since folders are reused, we clear our the color extractor on
  folder close.

Bug: 175329686
Test: multiple folders on rainbow background
      open each folder, ensure bg animates to proper color
Change-Id: Ie0f2c0632fa2361f7710ba247d74f882620dec16
This commit is contained in:
Jon Miranda
2021-05-05 15:36:27 -07:00
parent 7ef5456182
commit 0b6fa71deb
5 changed files with 145 additions and 23 deletions

View File

@@ -39,6 +39,7 @@ import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.BaseDragLayer;
import com.android.launcher3.widget.LocalColorExtractor;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -108,12 +109,21 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
protected boolean mIsOpen;
// Index used to get background color when using local wallpaper color extraction.
protected int mColorExtractionIndex;
public AbstractFloatingView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public AbstractFloatingView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
mColorExtractionIndex = LocalColorExtractor.getColorIndex(context);
}
/**