diff options
Diffstat (limited to 'src/com/android/launcher3/allapps/WorkPausedCard.java')
-rw-r--r-- | src/com/android/launcher3/allapps/WorkPausedCard.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/com/android/launcher3/allapps/WorkPausedCard.java b/src/com/android/launcher3/allapps/WorkPausedCard.java index 729622f519..7908b63ec2 100644 --- a/src/com/android/launcher3/allapps/WorkPausedCard.java +++ b/src/com/android/launcher3/allapps/WorkPausedCard.java @@ -16,6 +16,7 @@ package com.android.launcher3.allapps; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TURN_ON_WORK_APPS_TAP; +import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import android.content.Context; import android.content.res.Configuration; @@ -24,16 +25,16 @@ import android.view.View; import android.widget.Button; import android.widget.LinearLayout; +import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.Utilities; -import com.android.launcher3.views.ActivityContext; /** * Work profile toggle switch shown at the bottom of AllApps work tab */ public class WorkPausedCard extends LinearLayout implements View.OnClickListener { - private final ActivityContext mActivityContext; + private final Launcher mLauncher; private Button mBtn; public WorkPausedCard(Context context) { @@ -46,7 +47,7 @@ public class WorkPausedCard extends LinearLayout implements View.OnClickListener public WorkPausedCard(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); - mActivityContext = ActivityContext.lookupContext(getContext()); + mLauncher = Launcher.getLauncher(getContext()); } @@ -61,8 +62,8 @@ public class WorkPausedCard extends LinearLayout implements View.OnClickListener public void onClick(View view) { if (Utilities.ATLEAST_P) { setEnabled(false); - mActivityContext.getAppsView().getWorkManager().setWorkProfileEnabled(true); - mActivityContext.getStatsLogManager().logger().log(LAUNCHER_TURN_ON_WORK_APPS_TAP); + mLauncher.getStatsLogManager().logger().log(LAUNCHER_TURN_ON_WORK_APPS_TAP); + UI_HELPER_EXECUTOR.post(() -> WorkModeSwitch.setWorkProfileEnabled(getContext(), true)); } } |