mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-11 06:44:00 +00:00
Unify split options into single option
* No more split left/right/top, only have splitscreen and icon shows vertical or horizontal split windows * Replace existing split icon for FreeForm Fixes: 264930810 Test: Tested landscape and portrait, workspace, overview, allapps Change-Id: I443f93b6b01760b726bf9f024fb1324fdf0ed03c
This commit is contained in:
@@ -109,7 +109,7 @@
|
||||
style="@style/GoOverviewActionButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableStart="@drawable/ic_split_screen"
|
||||
android:drawableStart="@drawable/ic_split_vertical"
|
||||
android:text="@string/action_split"
|
||||
android:theme="@style/ThemeControlHighlightWorkspaceColor"
|
||||
android:visibility="gone" />
|
||||
|
||||
@@ -211,7 +211,7 @@
|
||||
<!-- Label for a button that enters split screen selection mode. [CHAR_LIMIT=20] -->
|
||||
<string name="action_split">Split</string>
|
||||
<!-- Label for toast with instructions for split screen selection mode. [CHAR_LIMIT=50] -->
|
||||
<string name="toast_split_select_app">Tap another app to use splitscreen</string>
|
||||
<string name="toast_split_select_app">Tap another app to use split screen</string>
|
||||
<!-- Label for toast when app selected for split isn't supported. [CHAR_LIMIT=50] -->
|
||||
<string name="toast_split_app_unsupported">Choose another app to use split screen</string>
|
||||
<!-- Message shown when an action is blocked by a policy enforced by the app or the organization managing the device. [CHAR_LIMIT=NONE] -->
|
||||
|
||||
@@ -296,7 +296,8 @@ public interface TaskShortcutFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Collections.singletonList(new FreeformSystemShortcut(R.drawable.ic_split_screen,
|
||||
return Collections.singletonList(new FreeformSystemShortcut(
|
||||
R.drawable.ic_caption_desktop_button_foreground,
|
||||
R.string.recent_task_option_freeform, activity, taskContainer,
|
||||
LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP));
|
||||
}
|
||||
|
||||
33
res/drawable/ic_caption_desktop_button_foreground.xml
Normal file
33
res/drawable/ic_caption_desktop_button_foreground.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2023 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<group android:scaleX="3.375"
|
||||
android:scaleY="3.375">
|
||||
<group android:scaleX="0.5"
|
||||
android:scaleY="0.5"
|
||||
android:translateX="6.0"
|
||||
android:translateY="6.0">
|
||||
<path
|
||||
android:fillColor="@android:color/black"
|
||||
android:pathData="M5.958,37.708Q4.458,37.708 3.354,36.604Q2.25,35.5 2.25,34V18.292Q2.25,16.792 3.354,15.688Q4.458,14.583 5.958,14.583H9.5V5.958Q9.5,4.458 10.625,3.354Q11.75,2.25 13.208,2.25H34Q35.542,2.25 36.646,3.354Q37.75,4.458 37.75,5.958V21.667Q37.75,23.167 36.646,24.271Q35.542,25.375 34,25.375H30.5V34Q30.5,35.5 29.396,36.604Q28.292,37.708 26.792,37.708ZM5.958,34H26.792Q26.792,34 26.792,34Q26.792,34 26.792,34V21.542H5.958V34Q5.958,34 5.958,34Q5.958,34 5.958,34ZM30.5,21.667H34Q34,21.667 34,21.667Q34,21.667 34,21.667V9.208H13.208V14.583H26.833Q28.375,14.583 29.438,15.667Q30.5,16.75 30.5,18.25Z"/>
|
||||
</group>
|
||||
</group>
|
||||
</vector>
|
||||
@@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="16dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="16">
|
||||
<path
|
||||
android:pathData="M-0,2L-0,14C-0,15.1 0.9,16 2,16L7,16C8.1,16 9,15.1 9,14L9,2C9,0.9 8.1,-0 7,-0L2,-0C0.9,-0 -0,0.9 -0,2ZM13,2L18,2L18,14L13,14L13,2ZM11,2L11,14C11,15.1 11.9,16 13,16L18,16C19.1,16 20,15.1 20,14L20,2C20,0.9 19.1,-0 18,-0L13,-0C11.9,-0 11,0.9 11,2Z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
@@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="16dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="16">
|
||||
<path
|
||||
android:pathData="M20,14L20,2C20,0.9 19.1,-0 18,-0L13,-0C11.9,-0 11,0.9 11,2L11,14C11,15.1 11.9,16 13,16L18,16C19.1,16 20,15.1 20,14ZM7,14L2,14L2,2L7,2L7,14ZM9,14L9,2C9,0.9 8.1,-0 7,-0L2,-0C0.9,-0 -0,0.9 -0,2L-0,14C-0,15.1 0.9,16 2,16L7,16C8.1,16 9,15.1 9,14Z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2018 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?android:attr/textColorPrimary">
|
||||
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M18,4v5H6V4H18 M18,2H6C4.9,2,4,2.9,4,4v5c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V4C20,2.9,19.1,2,18,2L18,2z" />
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M18,15v5H6v-5H18 M18,13H6c-1.1,0-2,0.9-2,2v5c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2v-5C20,13.9,19.1,13,18,13L18,13z" />
|
||||
</vector>
|
||||
@@ -1,9 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="16dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="16"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M14,0H2C0.9,0 0,0.9 0,2V7C0,8.1 0.9,9 2,9H14C15.1,9 16,8.1 16,7V2C16,0.9 15.1,0 14,0ZM14,13V18H2V13H14ZM14,11H2C0.9,11 0,11.9 0,13V18C0,19.1 0.9,20 2,20H14C15.1,20 16,19.1 16,18V13C16,11.9 15.1,11 14,11Z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
@@ -40,9 +40,6 @@
|
||||
<!-- Options for recent tasks -->
|
||||
<!-- Title for an option to enter split screen mode for a given app -->
|
||||
<string name="recent_task_option_split_screen">Split screen</string>
|
||||
<string name="split_screen_position_top">Split top</string>
|
||||
<string name="split_screen_position_left">Split left</string>
|
||||
<string name="split_screen_position_right">Split right</string>
|
||||
<string name="split_app_info_accessibility">App info for %1$s</string>
|
||||
|
||||
<!-- Widgets -->
|
||||
|
||||
@@ -85,7 +85,7 @@ import com.android.launcher3.views.BaseDragLayer;
|
||||
import com.android.launcher3.widget.PendingAddShortcutInfo;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -691,37 +691,16 @@ public final class Utilities {
|
||||
|
||||
/**
|
||||
* Returns a list of screen-splitting options depending on the device orientation (split top for
|
||||
* portrait, split left for landscape, split left and right for landscape tablets, etc.)
|
||||
* portrait, split right for landscape)
|
||||
*/
|
||||
public static List<SplitPositionOption> getSplitPositionOptions(
|
||||
DeviceProfile dp) {
|
||||
List<SplitPositionOption> options = new ArrayList<>();
|
||||
// Add both left and right options if we're in tablet mode
|
||||
if (dp.isTablet && dp.isLandscape) {
|
||||
options.add(new SplitPositionOption(
|
||||
R.drawable.ic_split_left, R.string.split_screen_position_left,
|
||||
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
|
||||
options.add(new SplitPositionOption(
|
||||
R.drawable.ic_split_right, R.string.split_screen_position_right,
|
||||
STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
|
||||
} else {
|
||||
if (dp.isSeascape()) {
|
||||
// Add left/right options
|
||||
options.add(new SplitPositionOption(
|
||||
R.drawable.ic_split_right, R.string.split_screen_position_right,
|
||||
STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
|
||||
} else if (dp.isLandscape) {
|
||||
options.add(new SplitPositionOption(
|
||||
R.drawable.ic_split_left, R.string.split_screen_position_left,
|
||||
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
|
||||
} else {
|
||||
// Only add top option
|
||||
options.add(new SplitPositionOption(
|
||||
R.drawable.ic_split_top, R.string.split_screen_position_top,
|
||||
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
|
||||
}
|
||||
}
|
||||
return options;
|
||||
return Collections.singletonList(new SplitPositionOption(
|
||||
dp.isLandscape ? R.drawable.ic_split_horizontal : R.drawable.ic_split_vertical,
|
||||
R.string.recent_task_option_split_screen,
|
||||
dp.isLandscape ? STAGE_POSITION_BOTTOM_OR_RIGHT : STAGE_POSITION_TOP_OR_LEFT,
|
||||
STAGE_TYPE_MAIN
|
||||
));
|
||||
}
|
||||
|
||||
/** Logs the Scale and Translate properties of a matrix. Ignores skew and perspective. */
|
||||
|
||||
@@ -403,7 +403,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
|
||||
// Add "left" side of phone which is actually the top
|
||||
return Collections.singletonList(new SplitPositionOption(
|
||||
R.drawable.ic_split_left, R.string.split_screen_position_left,
|
||||
R.drawable.ic_split_horizontal, R.string.recent_task_option_split_screen,
|
||||
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import static com.android.launcher3.touch.SingleAxisSwipeDetector.VERTICAL;
|
||||
import static com.android.launcher3.util.NavigationMode.THREE_BUTTONS;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MAIN;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Matrix;
|
||||
@@ -57,6 +58,7 @@ import com.android.launcher3.util.SplitConfigurationOptions.SplitBounds;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
@@ -405,7 +407,26 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
|
||||
@Override
|
||||
public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
|
||||
return Utilities.getSplitPositionOptions(dp);
|
||||
if (dp.isTablet) {
|
||||
return Utilities.getSplitPositionOptions(dp);
|
||||
}
|
||||
|
||||
List<SplitPositionOption> options = new ArrayList<>();
|
||||
if (dp.isSeascape()) {
|
||||
options.add(new SplitPositionOption(
|
||||
R.drawable.ic_split_horizontal, R.string.recent_task_option_split_screen,
|
||||
STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
|
||||
} else if (dp.isLandscape) {
|
||||
options.add(new SplitPositionOption(
|
||||
R.drawable.ic_split_horizontal, R.string.recent_task_option_split_screen,
|
||||
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
|
||||
} else {
|
||||
// Only add top option
|
||||
options.add(new SplitPositionOption(
|
||||
R.drawable.ic_split_vertical, R.string.recent_task_option_split_screen,
|
||||
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -178,7 +178,7 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
|
||||
public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
|
||||
// Add "right" option which is actually the top
|
||||
return Collections.singletonList(new SplitPositionOption(
|
||||
R.drawable.ic_split_right, R.string.split_screen_position_right,
|
||||
R.drawable.ic_split_horizontal, R.string.recent_task_option_split_screen,
|
||||
STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_MAIN));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user