• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 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 
17 package com.android.launcher3.util;
18 
19 import static java.lang.annotation.RetentionPolicy.SOURCE;
20 
21 import androidx.annotation.IntDef;
22 
23 import java.lang.annotation.Retention;
24 
25 public final class SplitConfigurationOptions {
26 
27     ///////////////////////////////////
28     // Taken from
29     // frameworks/base/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreen.java
30     /**
31      * Stage position isn't specified normally meaning to use what ever it is currently set to.
32      */
33     public static final int STAGE_POSITION_UNDEFINED = -1;
34     /**
35      * Specifies that a stage is positioned at the top half of the screen if
36      * in portrait mode or at the left half of the screen if in landscape mode.
37      */
38     public static final int STAGE_POSITION_TOP_OR_LEFT = 0;
39 
40     /**
41      * Specifies that a stage is positioned at the bottom half of the screen if
42      * in portrait mode or at the right half of the screen if in landscape mode.
43      */
44     public static final int STAGE_POSITION_BOTTOM_OR_RIGHT = 1;
45 
46     @Retention(SOURCE)
47     @IntDef({STAGE_POSITION_UNDEFINED, STAGE_POSITION_TOP_OR_LEFT, STAGE_POSITION_BOTTOM_OR_RIGHT})
48     public @interface StagePosition {}
49 
50     /**
51      * Stage type isn't specified normally meaning to use what ever the default is.
52      * E.g. exit split-screen and launch the app in fullscreen.
53      */
54     public static final int STAGE_TYPE_UNDEFINED = -1;
55     /**
56      * The main stage type.
57      */
58     public static final int STAGE_TYPE_MAIN = 0;
59 
60     /**
61      * The side stage type.
62      */
63     public static final int STAGE_TYPE_SIDE = 1;
64 
65     @IntDef({STAGE_TYPE_UNDEFINED, STAGE_TYPE_MAIN, STAGE_TYPE_SIDE})
66     public @interface StageType {}
67     ///////////////////////////////////
68 
69     public static class SplitPositionOption {
70         public final int mIconResId;
71         public final int mTextResId;
72         @StagePosition
73         public final int mStagePosition;
74 
75         @StageType
76         public final int mStageType;
77 
SplitPositionOption(int iconResId, int textResId, int stagePosition, int stageType)78         public SplitPositionOption(int iconResId, int textResId, int stagePosition, int stageType) {
79             mIconResId = iconResId;
80             mTextResId = textResId;
81             mStagePosition = stagePosition;
82             mStageType = stageType;
83         }
84     }
85 }
86