1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.launcher3.popup;
17 
18 import android.view.View;
19 
20 import com.android.launcher3.model.data.ItemInfo;
21 import com.android.launcher3.splitscreen.SplitShortcut;
22 import com.android.launcher3.uioverrides.QuickstepLauncher;
23 import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
24 
25 /** {@link SystemShortcut.Factory} implementation to create workspace split shortcuts */
26 public interface QuickstepSystemShortcut {
27 
28     String TAG = "QuickstepSystemShortcut";
29 
getSplitSelectShortcutByPosition( SplitPositionOption position)30     static SystemShortcut.Factory<QuickstepLauncher> getSplitSelectShortcutByPosition(
31             SplitPositionOption position) {
32         return (activity, itemInfo, originalView) ->
33                 new QuickstepSystemShortcut.SplitSelectSystemShortcut(activity, itemInfo,
34                         originalView, position);
35     }
36 
37     class SplitSelectSystemShortcut extends SplitShortcut<QuickstepLauncher> {
38 
SplitSelectSystemShortcut(QuickstepLauncher launcher, ItemInfo itemInfo, View originalView, SplitPositionOption position)39         public SplitSelectSystemShortcut(QuickstepLauncher launcher, ItemInfo itemInfo,
40                 View originalView, SplitPositionOption position) {
41             super(position.iconResId, position.textResId, launcher, itemInfo, originalView,
42                     position);
43         }
44     }
45 }
46