Add a way to stash/unstash transient taskbar.
- Adds threshold to show taskbar during swipe - Introduces FLAG_STASHED_IN_APP_AUTO flag - Adds logic for taskbar to auto hide based on time and touch Bug: 252905206 Test: manual Change-Id: I070cd619487fdd4498a988ae5aadce6dd14313f7
This commit is contained in:
@@ -33,21 +33,28 @@ import java.util.StringJoiner;
|
||||
public class TaskbarAutohideSuspendController implements
|
||||
TaskbarControllers.LoggableTaskbarController {
|
||||
|
||||
// Taskbar window is fullscreen.
|
||||
public static final int FLAG_AUTOHIDE_SUSPEND_FULLSCREEN = 1 << 0;
|
||||
// User is dragging item.
|
||||
public static final int FLAG_AUTOHIDE_SUSPEND_DRAGGING = 1 << 1;
|
||||
// User has touched down but has not lifted finger.
|
||||
public static final int FLAG_AUTOHIDE_SUSPEND_TOUCHING = 1 << 2;
|
||||
|
||||
@IntDef(flag = true, value = {
|
||||
FLAG_AUTOHIDE_SUSPEND_FULLSCREEN,
|
||||
FLAG_AUTOHIDE_SUSPEND_DRAGGING,
|
||||
FLAG_AUTOHIDE_SUSPEND_TOUCHING,
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface AutohideSuspendFlag {}
|
||||
|
||||
private final TaskbarActivityContext mActivity;
|
||||
private final SystemUiProxy mSystemUiProxy;
|
||||
|
||||
private @AutohideSuspendFlag int mAutohideSuspendFlags = 0;
|
||||
|
||||
public TaskbarAutohideSuspendController(TaskbarActivityContext activity) {
|
||||
mActivity = activity;
|
||||
mSystemUiProxy = SystemUiProxy.INSTANCE.get(activity);
|
||||
}
|
||||
|
||||
@@ -59,12 +66,27 @@ public class TaskbarAutohideSuspendController implements
|
||||
* Adds or removes the given flag, then notifies system UI proxy whether to suspend auto-hide.
|
||||
*/
|
||||
public void updateFlag(@AutohideSuspendFlag int flag, boolean enabled) {
|
||||
int flagsBefore = mAutohideSuspendFlags;
|
||||
if (enabled) {
|
||||
mAutohideSuspendFlags |= flag;
|
||||
} else {
|
||||
mAutohideSuspendFlags &= ~flag;
|
||||
}
|
||||
mSystemUiProxy.notifyTaskbarAutohideSuspend(mAutohideSuspendFlags != 0);
|
||||
if (flagsBefore == mAutohideSuspendFlags) {
|
||||
// Nothing has changed, no need to notify.
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isSuspended = isSuspended();
|
||||
mSystemUiProxy.notifyTaskbarAutohideSuspend(isSuspended);
|
||||
mActivity.onTransientAutohideSuspendFlagChanged(isSuspended);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true iff taskbar autohide is currently suspended.
|
||||
*/
|
||||
public boolean isSuspended() {
|
||||
return mAutohideSuspendFlags != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,6 +101,7 @@ public class TaskbarAutohideSuspendController implements
|
||||
appendFlag(str, flags, FLAG_AUTOHIDE_SUSPEND_FULLSCREEN,
|
||||
"FLAG_AUTOHIDE_SUSPEND_FULLSCREEN");
|
||||
appendFlag(str, flags, FLAG_AUTOHIDE_SUSPEND_DRAGGING, "FLAG_AUTOHIDE_SUSPEND_DRAGGING");
|
||||
appendFlag(str, flags, FLAG_AUTOHIDE_SUSPEND_TOUCHING, "FLAG_AUTOHIDE_SUSPEND_TOUCHING");
|
||||
return str.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user