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

Commit 391404fc authored by Steven Ng's avatar Steven Ng
Browse files

Add personal / work tabs for work profile widgets

Video: https://drive.google.com/file/d/1TORRNcvVM7fIvNd_WZaajLbI7D9z4VFA/view?usp=sharing


Test: Main profile only: run AddConfigWidgetTest.
      With work profile: manually launch the full widgets sheet.
      Go to the personal tab: only personal widgets are shown.
      Go to the work tab: only work widgets are shown
      Successfully add personal / work widgets from the full widgets
      sheet.

Bug: 179797520

Change-Id: Iad8b90c2af35e0580319d7a05510ec88e4f8b86c
parent dfdeddc6
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -27,12 +27,6 @@
        android:background="?android:attr/colorPrimary"
        android:elevation="4dp">

        <com.android.launcher3.widget.picker.WidgetsRecyclerView
            android:id="@+id/widgets_list_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipToPadding="false" />

        <!-- Fast scroller popup -->
        <TextView
            android:id="@+id/fast_scroller_popup"
+44 −0
Original line number Diff line number Diff line
<?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.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:launcher="http://schemas.android.com/apk/res-auto">

    <include layout="@layout/personal_work_tabs" />

    <com.android.launcher3.workprofile.PersonalWorkPagedView
        android:id="@+id/widgets_view_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/tabs"
        android:clipToPadding="false"
        android:descendantFocusability="afterDescendants"
        launcher:pageIndicator="@+id/tabs">

        <com.android.launcher3.widget.picker.WidgetsRecyclerView
            android:id="@+id/primary_widgets_list_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipToPadding="false" />

        <com.android.launcher3.widget.picker.WidgetsRecyclerView
            android:id="@+id/work_widgets_list_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipToPadding="false" />

    </com.android.launcher3.workprofile.PersonalWorkPagedView>

</merge>
 No newline at end of file
+21 −0
Original line number Diff line number Diff line
<?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.
-->
<com.android.launcher3.widget.picker.WidgetsRecyclerView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/primary_widgets_list_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false" />
 No newline at end of file
+12 −0
Original line number Diff line number Diff line
@@ -96,6 +96,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
    private static final int MIN_FLING_VELOCITY = 250;

    private boolean mFreeScroll = false;
    /** If {@code false}, disable swipe gesture to switch between pages. */
    private boolean mSwipeGestureEnabled = true;

    protected final int mFlingThresholdVelocity;
    protected final int mEasyFlingThresholdVelocity;
@@ -857,6 +859,14 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
        }
    }

    /**
     * If {@code enableSwipeGesture} is {@code true}, enables swipe gesture to navigate between
     * pages. Otherwise, disables the navigation gesture.
     */
    public void setSwipeGestureEnabled(boolean swipeGestureEnabled) {
        mSwipeGestureEnabled = swipeGestureEnabled;
    }

    /**
     * {@inheritDoc}
     */
@@ -879,6 +889,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
         * scrolling there.
         */

        if (!mSwipeGestureEnabled) return false;

        // Skip touch handling if there are no pages to swipe
        if (getChildCount() <= 0) return false;

+1 −1
Original line number Diff line number Diff line
@@ -60,6 +60,6 @@ public class PackageItemInfo extends ItemInfoWithIcon {

    @Override
    public int hashCode() {
        return Objects.hash(packageName);
        return Objects.hash(packageName, user);
    }
}
Loading