mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
[Work] Fix duplicate work button issue
Bug: 195623679 Test: manual Change-Id: I882c5f7a196e07fa0dab3a2f27437abd233ec782
This commit is contained in:
@@ -51,6 +51,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
|
||||
|
||||
@Nullable
|
||||
private KeyboardInsetAnimationCallback mKeyboardInsetAnimationCallback;
|
||||
private boolean mWorkTabVisible;
|
||||
|
||||
public WorkModeSwitch(Context context) {
|
||||
this(context, null, 0);
|
||||
@@ -91,11 +92,10 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
|
||||
*/
|
||||
public void setWorkTabVisible(boolean workTabVisible) {
|
||||
clearAnimation();
|
||||
if (workTabVisible) {
|
||||
mWorkTabVisible = workTabVisible;
|
||||
if (workTabVisible && mWorkEnabled) {
|
||||
setEnabled(true);
|
||||
if (mWorkEnabled) {
|
||||
setVisibility(VISIBLE);
|
||||
}
|
||||
setVisibility(VISIBLE);
|
||||
setAlpha(0);
|
||||
animate().alpha(1).start();
|
||||
} else {
|
||||
@@ -105,7 +105,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (Utilities.ATLEAST_P) {
|
||||
if (Utilities.ATLEAST_P && mWorkTabVisible) {
|
||||
setEnabled(false);
|
||||
Launcher.fromContext(getContext()).getStatsLogManager().logger().log(
|
||||
LAUNCHER_TURN_OFF_WORK_APPS_TAP);
|
||||
@@ -137,7 +137,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
|
||||
|
||||
@Override
|
||||
public WindowInsets onApplyWindowInsets(WindowInsets insets) {
|
||||
if (Utilities.ATLEAST_R) {
|
||||
if (Utilities.ATLEAST_R && mWorkTabVisible) {
|
||||
setTranslationY(0);
|
||||
if (insets.isVisible(WindowInsets.Type.ime())) {
|
||||
Insets keyboardInsets = insets.getInsets(WindowInsets.Type.ime());
|
||||
|
||||
Reference in New Issue
Block a user