Properly color taskbar nav buttons when slide-in view is shown.

Supports overriding the current nav bar color with one that would be
visible over a slide-in view.

Demo:
https://drive.google.com/file/d/1MB26QM5qeeyVB6Bj14IGoPCWVT_P7K-3/view?usp=sharing&resourcekey=0-wnMgciNrUXC_l7gI3JFm8A

Test: Manually with light and dark themes, as well as All Apps and EDU
views.
Fix: 248359789

Change-Id: I134ae719b10f3de78ea18220a835de56a82ecb02
This commit is contained in:
Brian Isganitis
2022-09-23 17:13:32 -07:00
parent ae81433665
commit 731ef0c301
7 changed files with 55 additions and 18 deletions

View File

@@ -33,6 +33,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Interpolator;
import androidx.annotation.Nullable;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.Interpolators;
@@ -41,6 +43,7 @@ import com.android.launcher3.touch.SingleAxisSwipeDetector;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
* Extension of {@link AbstractFloatingView} with common methods for sliding in from bottom.
@@ -79,6 +82,7 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
protected float mTranslationShift = TRANSLATION_SHIFT_CLOSED;
protected boolean mNoIntercept;
protected @Nullable OnCloseListener mOnCloseBeginListener;
protected List<OnCloseListener> mOnCloseListeners = new ArrayList<>();
public AbstractSlideInView(Context context, AttributeSet attrs, int defStyleAttr) {
@@ -204,6 +208,11 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
}
}
/** Callback invoked when the view is beginning to close (e.g. close animation is started). */
public void setOnCloseBeginListener(@Nullable OnCloseListener onCloseBeginListener) {
mOnCloseBeginListener = onCloseBeginListener;
}
/** Registers an {@link OnCloseListener}. */
public void addOnCloseListener(OnCloseListener listener) {
mOnCloseListeners.add(listener);
@@ -213,6 +222,8 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
if (!mIsOpen) {
return;
}
Optional.ofNullable(mOnCloseBeginListener).ifPresent(OnCloseListener::onSlideInViewClosed);
if (!animate) {
mOpenCloseAnimator.cancel();
setTranslationShift(TRANSLATION_SHIFT_CLOSED);