Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04f05104 authored by Jon Miranda's avatar Jon Miranda
Browse files

Allow grids to specify if we should start align taskbar in 3 button

nav.

Bug: 259712417
Test: check layout on tablet
      check layout on multi_display devices

Change-Id: I282f51e5d76a30e9ad9d8c52d03d4853e965d65a
parent 08a13d6a
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
<?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.
-->
<!-- Applies to large tablet screens portrait -->
<resources>
    <!-- Taskbar -->
    <!-- Align the Taskbar to the start (Left/Right) of the device when 3 button nav is enabled. -->
    <bool name="start_align_taskbar">true</bool>
</resources>
 No newline at end of file
+0 −21
Original line number Diff line number Diff line
<?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.
-->
<!-- Applies to large tablet screens landscape -->
<resources>
    <!-- Taskbar -->
    <!-- Align the Taskbar to the start (Left/Right) of the device when 3 button nav is enabled. -->
    <bool name="start_align_taskbar">false</bool>
</resources>
 No newline at end of file
+0 −21
Original line number Diff line number Diff line
<?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.
-->
<!-- Applies to large tablet screens portrait -->
<resources>
    <!-- Taskbar -->
    <!-- Align the Taskbar to the start (Left/Right) of the device when 3 button nav is enabled. -->
    <bool name="start_align_taskbar">true</bool>
</resources>
 No newline at end of file
+0 −4
Original line number Diff line number Diff line
@@ -52,10 +52,6 @@

    <string name="setup_wizard_pkg" translatable="false" />

    <!-- Taskbar -->
    <!-- Align the Taskbar to the start (Left/Right) of the device when 3 button nav is enabled. -->
    <bool name="start_align_taskbar">false</bool>

    <!-- This is a float because it is converted to dp later in DeviceProfile -->
    <item name="taskbar_icon_size" type="dimen" format="float">44</item>
</resources>
+22 −4
Original line number Diff line number Diff line
@@ -57,7 +57,8 @@ import java.util.function.Predicate;
/**
 * Hosts the Taskbar content such as Hotseat and Recent Apps. Drawn on top of other apps.
 */
public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconParent, Insettable {
public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconParent, Insettable,
        DeviceProfile.OnDeviceProfileChangeListener {
    private static final String TAG = TaskbarView.class.getSimpleName();

    private static final Rect sTmpRect = new Rect();
@@ -92,7 +93,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar

    private float mTransientTaskbarAllAppsButtonTranslationXOffset;

    private final boolean mShouldTryStartAlign;
    private boolean mShouldTryStartAlign;

    public TaskbarView(@NonNull Context context) {
        this(context, null);
@@ -121,8 +122,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
                resources.getDimension(isTransientTaskbar
                        ? R.dimen.transient_taskbar_all_apps_button_translation_x_offset
                        : R.dimen.taskbar_all_apps_button_translation_x_offset);
        mShouldTryStartAlign = mActivityContext.isThreeButtonNav()
                && resources.getBoolean(R.bool.start_align_taskbar);

        onDeviceProfileChanged(mActivityContext.getDeviceProfile());

        int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing);
        int actualIconSize = mActivityContext.getDeviceProfile().taskbarIconSize;
@@ -161,6 +162,23 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
        mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false);
    }

    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        mActivityContext.addOnDeviceProfileChangeListener(this);
    }

    @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        mActivityContext.removeOnDeviceProfileChangeListener(this);
    }

    @Override
    public void onDeviceProfileChanged(DeviceProfile dp) {
        mShouldTryStartAlign = mActivityContext.isThreeButtonNav() && dp.startAlignTaskbar;
    }

    @Override
    public boolean performAccessibilityActionInternal(int action, Bundle arguments) {
        if (action == AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS) {
Loading