mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
Refactor all apps to depend on activity context.
The current AllAppsContainerView has been split into a base class and a subclass for activities. The base class allows using all apps with an activity context. A-Z and work profile tabs are supported, but search and the hotseat still require an Activity. Test: Manual. All apps should work the same. Bug: 204696617 Change-Id: I3b146714bc11b3b3555d97623aab5d78ac836482
This commit is contained in:
@@ -26,12 +26,11 @@ import android.view.ViewGroup;
|
||||
import android.view.WindowInsets;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.android.launcher3.BaseDraggingActivity;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Insettable;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.KeyboardInsetAnimationCallback;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip;
|
||||
|
||||
/**
|
||||
@@ -73,7 +72,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
|
||||
new KeyboardInsetAnimationCallback(this);
|
||||
setWindowInsetsAnimationCallback(keyboardInsetAnimationCallback);
|
||||
}
|
||||
DeviceProfile grid = BaseDraggingActivity.fromContext(getContext()).getDeviceProfile();
|
||||
DeviceProfile grid = ActivityContext.lookupContext(getContext()).getDeviceProfile();
|
||||
setInsets(grid.getInsets());
|
||||
}
|
||||
|
||||
@@ -91,7 +90,7 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
|
||||
|
||||
@Override
|
||||
public void onActivePageChanged(int page) {
|
||||
mOnWorkTab = page == AllAppsContainerView.AdapterHolder.WORK;
|
||||
mOnWorkTab = page == ActivityAllAppsContainerView.AdapterHolder.WORK;
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
@@ -99,9 +98,9 @@ public class WorkModeSwitch extends Button implements Insettable, View.OnClickLi
|
||||
public void onClick(View view) {
|
||||
if (Utilities.ATLEAST_P && isEnabled()) {
|
||||
setFlag(FLAG_PROFILE_TOGGLE_ONGOING);
|
||||
Launcher launcher = Launcher.getLauncher(getContext());
|
||||
launcher.getStatsLogManager().logger().log(LAUNCHER_TURN_OFF_WORK_APPS_TAP);
|
||||
launcher.getAppsView().getWorkManager().setWorkProfileEnabled(false);
|
||||
ActivityContext activityContext = ActivityContext.lookupContext(getContext());
|
||||
activityContext.getStatsLogManager().logger().log(LAUNCHER_TURN_OFF_WORK_APPS_TAP);
|
||||
activityContext.getAppsView().getWorkManager().setWorkProfileEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user