Merge "Show all nav buttons when IME showing" into sc-v2-dev am: fd5e2ff933
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15780327 Change-Id: I858a91d254b5d300905eb8aa55184b5dbb60456c
This commit is contained in:
@@ -52,6 +52,7 @@
|
|||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingLeft="@dimen/taskbar_nav_buttons_spacing"
|
android:paddingLeft="@dimen/taskbar_nav_buttons_spacing"
|
||||||
android:paddingRight="@dimen/taskbar_nav_buttons_spacing"
|
android:paddingRight="@dimen/taskbar_nav_buttons_spacing"
|
||||||
|
android:layout_marginEnd="@dimen/taskbar_contextual_button_margin"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_gravity="end"/>
|
android:layout_gravity="end"/>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2021 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.
|
||||||
|
-->
|
||||||
|
<ImageView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="@dimen/taskbar_contextual_buttons_size"
|
||||||
|
android:layout_height="@dimen/taskbar_contextual_buttons_size"
|
||||||
|
android:layout_marginTop="@dimen/taskbar_contextual_button_margin"
|
||||||
|
android:paddingStart="@dimen/taskbar_nav_buttons_spacing"
|
||||||
|
android:background="@drawable/taskbar_icon_click_feedback_roundrect"
|
||||||
|
android:scaleType="center"/>
|
||||||
@@ -1,4 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2021 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.
|
||||||
|
-->
|
||||||
<ImageView
|
<ImageView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="@dimen/taskbar_nav_buttons_size"
|
android:layout_width="@dimen/taskbar_nav_buttons_size"
|
||||||
|
|||||||
@@ -163,6 +163,8 @@
|
|||||||
<dimen name="taskbar_folder_margin">16dp</dimen>
|
<dimen name="taskbar_folder_margin">16dp</dimen>
|
||||||
<dimen name="taskbar_nav_buttons_spacing">16dp</dimen>
|
<dimen name="taskbar_nav_buttons_spacing">16dp</dimen>
|
||||||
<dimen name="taskbar_nav_buttons_size">48dp</dimen>
|
<dimen name="taskbar_nav_buttons_size">48dp</dimen>
|
||||||
|
<dimen name="taskbar_contextual_button_margin">16dp</dimen>
|
||||||
|
<dimen name="taskbar_contextual_buttons_size">35dp</dimen>
|
||||||
<dimen name="taskbar_stashed_size">24dp</dimen>
|
<dimen name="taskbar_stashed_size">24dp</dimen>
|
||||||
<dimen name="taskbar_stashed_handle_width">220dp</dimen>
|
<dimen name="taskbar_stashed_handle_width">220dp</dimen>
|
||||||
<dimen name="taskbar_stashed_handle_height">6dp</dimen>
|
<dimen name="taskbar_stashed_handle_height">6dp</dimen>
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_O
|
|||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.annotation.DrawableRes;
|
import android.annotation.DrawableRes;
|
||||||
import android.annotation.IdRes;
|
import android.annotation.IdRes;
|
||||||
|
import android.annotation.LayoutRes;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.Region;
|
import android.graphics.Region;
|
||||||
import android.graphics.Region.Op;
|
import android.graphics.Region.Op;
|
||||||
@@ -123,21 +124,16 @@ public class NavbarButtonsViewController {
|
|||||||
.getProperty(ALPHA_INDEX_IME),
|
.getProperty(ALPHA_INDEX_IME),
|
||||||
flags -> (flags & FLAG_IME_VISIBLE) == 0, MultiValueAlpha.VALUE, 1, 0));
|
flags -> (flags & FLAG_IME_VISIBLE) == 0, MultiValueAlpha.VALUE, 1, 0));
|
||||||
|
|
||||||
|
boolean isThreeButtonNav = mContext.isThreeButtonNav();
|
||||||
// IME switcher
|
// IME switcher
|
||||||
View imeSwitcherButton = addButton(R.drawable.ic_ime_switcher, BUTTON_IME_SWITCH,
|
View imeSwitcherButton = addButton(R.drawable.ic_ime_switcher, BUTTON_IME_SWITCH,
|
||||||
mEndContextualContainer, mControllers.navButtonController, R.id.ime_switcher);
|
isThreeButtonNav ? mStartContextualContainer : mEndContextualContainer,
|
||||||
|
mControllers.navButtonController, R.id.ime_switcher);
|
||||||
mPropertyHolders.add(new StatePropertyHolder(imeSwitcherButton,
|
mPropertyHolders.add(new StatePropertyHolder(imeSwitcherButton,
|
||||||
flags -> ((flags & MASK_IME_SWITCHER_VISIBLE) == MASK_IME_SWITCHER_VISIBLE)
|
flags -> ((flags & MASK_IME_SWITCHER_VISIBLE) == MASK_IME_SWITCHER_VISIBLE)
|
||||||
&& ((flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0)
|
&& ((flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0)
|
||||||
&& ((flags & FLAG_A11Y_VISIBLE) == 0)));
|
&& ((flags & FLAG_A11Y_VISIBLE) == 0)));
|
||||||
|
|
||||||
View imeDownButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK,
|
|
||||||
mStartContextualContainer, mControllers.navButtonController, R.id.back);
|
|
||||||
imeDownButton.setRotation(Utilities.isRtl(mContext.getResources()) ? 90 : -90);
|
|
||||||
// Rotate when Ime visible
|
|
||||||
mPropertyHolders.add(new StatePropertyHolder(imeDownButton,
|
|
||||||
flags -> (flags & FLAG_IME_VISIBLE) != 0));
|
|
||||||
|
|
||||||
mPropertyHolders.add(new StatePropertyHolder(
|
mPropertyHolders.add(new StatePropertyHolder(
|
||||||
mControllers.taskbarViewController.getTaskbarIconAlpha()
|
mControllers.taskbarViewController.getTaskbarIconAlpha()
|
||||||
.getProperty(ALPHA_INDEX_KEYGUARD),
|
.getProperty(ALPHA_INDEX_KEYGUARD),
|
||||||
@@ -150,7 +146,7 @@ public class NavbarButtonsViewController {
|
|||||||
// Force nav buttons (specifically back button) to be visible during setup wizard.
|
// Force nav buttons (specifically back button) to be visible during setup wizard.
|
||||||
boolean areButtonsForcedVisible = !SettingsCache.INSTANCE.get(mContext).getValue(
|
boolean areButtonsForcedVisible = !SettingsCache.INSTANCE.get(mContext).getValue(
|
||||||
Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE), 0);
|
Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE), 0);
|
||||||
if (mContext.isThreeButtonNav() || areButtonsForcedVisible) {
|
if (isThreeButtonNav || areButtonsForcedVisible) {
|
||||||
initButtons(mNavButtonContainer, mEndContextualContainer,
|
initButtons(mNavButtonContainer, mEndContextualContainer,
|
||||||
mControllers.navButtonController);
|
mControllers.navButtonController);
|
||||||
|
|
||||||
@@ -163,11 +159,18 @@ public class NavbarButtonsViewController {
|
|||||||
|
|
||||||
// Rotation button
|
// Rotation button
|
||||||
RotationButton rotationButton = new RotationButtonImpl(
|
RotationButton rotationButton = new RotationButtonImpl(
|
||||||
addButton(mEndContextualContainer, R.id.rotate_suggestion));
|
addButton(mEndContextualContainer, R.id.rotate_suggestion,
|
||||||
|
R.layout.taskbar_contextual_button));
|
||||||
rotationButton.hide();
|
rotationButton.hide();
|
||||||
mControllers.rotationButtonController.setRotationButton(rotationButton);
|
mControllers.rotationButtonController.setRotationButton(rotationButton);
|
||||||
} else {
|
} else {
|
||||||
mControllers.rotationButtonController.setRotationButton(new RotationButton() {});
|
mControllers.rotationButtonController.setRotationButton(new RotationButton() {});
|
||||||
|
View imeDownButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK,
|
||||||
|
mStartContextualContainer, mControllers.navButtonController, R.id.back);
|
||||||
|
imeDownButton.setRotation(Utilities.isRtl(mContext.getResources()) ? 90 : -90);
|
||||||
|
// Rotate when Ime visible
|
||||||
|
mPropertyHolders.add(new StatePropertyHolder(imeDownButton,
|
||||||
|
flags -> (flags & FLAG_IME_VISIBLE) != 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
applyState();
|
applyState();
|
||||||
@@ -180,8 +183,11 @@ public class NavbarButtonsViewController {
|
|||||||
mBackButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK,
|
mBackButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK,
|
||||||
mNavButtonContainer, mControllers.navButtonController, R.id.back);
|
mNavButtonContainer, mControllers.navButtonController, R.id.back);
|
||||||
mPropertyHolders.add(new StatePropertyHolder(mBackButton,
|
mPropertyHolders.add(new StatePropertyHolder(mBackButton,
|
||||||
flags -> (flags & FLAG_IME_VISIBLE) == 0 &&
|
flags -> (flags & FLAG_DISABLE_BACK) == 0));
|
||||||
(flags & FLAG_DISABLE_BACK) == 0));
|
boolean isRtl = Utilities.isRtl(mContext.getResources());
|
||||||
|
mPropertyHolders.add(new StatePropertyHolder(
|
||||||
|
mBackButton, flags -> (flags & FLAG_IME_VISIBLE) != 0, View.ROTATION,
|
||||||
|
isRtl ? 90 : -90, 0));
|
||||||
// Hide when keyguard is showing, show when bouncer is showing
|
// Hide when keyguard is showing, show when bouncer is showing
|
||||||
mPropertyHolders.add(new StatePropertyHolder(mBackButton,
|
mPropertyHolders.add(new StatePropertyHolder(mBackButton,
|
||||||
flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0 ||
|
flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0 ||
|
||||||
@@ -191,19 +197,18 @@ public class NavbarButtonsViewController {
|
|||||||
View homeButton = addButton(R.drawable.ic_sysbar_home, BUTTON_HOME, navContainer,
|
View homeButton = addButton(R.drawable.ic_sysbar_home, BUTTON_HOME, navContainer,
|
||||||
navButtonController, R.id.home);
|
navButtonController, R.id.home);
|
||||||
mPropertyHolders.add(new StatePropertyHolder(homeButton,
|
mPropertyHolders.add(new StatePropertyHolder(homeButton,
|
||||||
flags -> (flags & FLAG_IME_VISIBLE) == 0 &&
|
flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0 &&
|
||||||
(flags & FLAG_KEYGUARD_VISIBLE) == 0 &&
|
|
||||||
(flags & FLAG_DISABLE_HOME) == 0));
|
(flags & FLAG_DISABLE_HOME) == 0));
|
||||||
View recentsButton = addButton(R.drawable.ic_sysbar_recent, BUTTON_RECENTS,
|
View recentsButton = addButton(R.drawable.ic_sysbar_recent, BUTTON_RECENTS,
|
||||||
navContainer, navButtonController, R.id.recent_apps);
|
navContainer, navButtonController, R.id.recent_apps);
|
||||||
mPropertyHolders.add(new StatePropertyHolder(recentsButton,
|
mPropertyHolders.add(new StatePropertyHolder(recentsButton,
|
||||||
flags -> (flags & FLAG_IME_VISIBLE) == 0 &&
|
flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0 &&
|
||||||
(flags & FLAG_KEYGUARD_VISIBLE) == 0 &&
|
|
||||||
(flags & FLAG_DISABLE_RECENTS) == 0));
|
(flags & FLAG_DISABLE_RECENTS) == 0));
|
||||||
|
|
||||||
// A11y button
|
// A11y button
|
||||||
mA11yButton = addButton(R.drawable.ic_sysbar_accessibility_button, BUTTON_A11Y,
|
mA11yButton = addButton(R.drawable.ic_sysbar_accessibility_button, BUTTON_A11Y,
|
||||||
endContainer, navButtonController, R.id.accessibility_button);
|
endContainer, navButtonController, R.id.accessibility_button,
|
||||||
|
R.layout.taskbar_contextual_button);
|
||||||
mPropertyHolders.add(new StatePropertyHolder(mA11yButton,
|
mPropertyHolders.add(new StatePropertyHolder(mA11yButton,
|
||||||
flags -> (flags & FLAG_A11Y_VISIBLE) != 0
|
flags -> (flags & FLAG_A11Y_VISIBLE) != 0
|
||||||
&& (flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0));
|
&& (flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0));
|
||||||
@@ -306,15 +311,22 @@ public class NavbarButtonsViewController {
|
|||||||
|
|
||||||
private ImageView addButton(@DrawableRes int drawableId, @TaskbarButton int buttonType,
|
private ImageView addButton(@DrawableRes int drawableId, @TaskbarButton int buttonType,
|
||||||
ViewGroup parent, TaskbarNavButtonController navButtonController, @IdRes int id) {
|
ViewGroup parent, TaskbarNavButtonController navButtonController, @IdRes int id) {
|
||||||
ImageView buttonView = addButton(parent, id);
|
return addButton(drawableId, buttonType, parent, navButtonController, id,
|
||||||
|
R.layout.taskbar_nav_button);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ImageView addButton(@DrawableRes int drawableId, @TaskbarButton int buttonType,
|
||||||
|
ViewGroup parent, TaskbarNavButtonController navButtonController, @IdRes int id,
|
||||||
|
@LayoutRes int layoutId) {
|
||||||
|
ImageView buttonView = addButton(parent, id, layoutId);
|
||||||
buttonView.setImageResource(drawableId);
|
buttonView.setImageResource(drawableId);
|
||||||
buttonView.setOnClickListener(view -> navButtonController.onButtonClick(buttonType));
|
buttonView.setOnClickListener(view -> navButtonController.onButtonClick(buttonType));
|
||||||
return buttonView;
|
return buttonView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImageView addButton(ViewGroup parent, int id) {
|
private ImageView addButton(ViewGroup parent, @IdRes int id, @LayoutRes int layoutId) {
|
||||||
ImageView buttonView = (ImageView) mContext.getLayoutInflater()
|
ImageView buttonView = (ImageView) mContext.getLayoutInflater()
|
||||||
.inflate(R.layout.taskbar_nav_button, parent, false);
|
.inflate(layoutId, parent, false);
|
||||||
buttonView.setId(id);
|
buttonView.setId(id);
|
||||||
parent.addView(buttonView);
|
parent.addView(buttonView);
|
||||||
mAllButtons.add(buttonView);
|
mAllButtons.add(buttonView);
|
||||||
|
|||||||
@@ -56,8 +56,14 @@ public class ApiWrapper {
|
|||||||
public static int getHotseatEndOffset(Context context) {
|
public static int getHotseatEndOffset(Context context) {
|
||||||
if (SysUINavigationMode.INSTANCE.get(context).getMode() == Mode.THREE_BUTTONS) {
|
if (SysUINavigationMode.INSTANCE.get(context).getMode() == Mode.THREE_BUTTONS) {
|
||||||
Resources res = context.getResources();
|
Resources res = context.getResources();
|
||||||
|
/*
|
||||||
|
* 2 (left + right) x Padding +
|
||||||
|
* 3 nav buttons +
|
||||||
|
* Little space at the end for contextual buttons
|
||||||
|
*/
|
||||||
return 2 * res.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_spacing)
|
return 2 * res.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_spacing)
|
||||||
+ 3 * res.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size);
|
+ 3 * res.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size)
|
||||||
|
+ res.getDimensionPixelSize(R.dimen.taskbar_contextual_button_margin);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user