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

Commit 1bfb0c1c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add clear all button to Recents Go" into ub-launcher3-master

parents 9cb820f6 fefe8b6d
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2019 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.
-->
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@color/clear_all_button_bg"/>
    <corners android:radius="4dp"/>
</shape>
+23 −5
Original line number Diff line number Diff line
@@ -19,13 +19,31 @@
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <LinearLayout
        android:id="@+id/recent_task_content_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:visibility="gone">
        <androidx.recyclerview.widget.RecyclerView
        xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/recent_task_recycler_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
        android:scrollbars="none"
        android:visibility="gone"/>
            android:layout_weight="1"
            android:scrollbars="none"/>
        <Button
            android:id="@+id/clear_all_button"
            android:layout_width="@dimen/clear_all_button_width"
            android:layout_height="@dimen/clear_all_button_height"
            android:layout_gravity="center_horizontal"
            android:layout_marginVertical="@dimen/task_item_half_vert_margin"
            android:background="@drawable/clear_all_button"
            android:gravity="center"
            android:text="@string/recents_clear_all"
            android:textAllCaps="false"
            android:textColor="@color/clear_all_button_text"
            android:textSize="14sp"/>
    </LinearLayout>
    <TextView
        android:id="@+id/recent_task_empty_view"
        android:layout_width="match_parent"
+20 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2019 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.
-->
<resources>
    <color name="clear_all_button_bg">#FFDADCE0</color>
    <color name="clear_all_button_text">#FF5F6368</color>
</resources>
+3 −0
Original line number Diff line number Diff line
@@ -20,4 +20,7 @@
    <dimen name="task_thumbnail_height">60dp</dimen>
    <dimen name="task_thumbnail_width">36dp</dimen>
    <dimen name="task_icon_size">36dp</dimen>

    <dimen name="clear_all_button_width">106dp</dimen>
    <dimen name="clear_all_button_height">36dp</dimen>
</resources>
 No newline at end of file
+10 −2
Original line number Diff line number Diff line
@@ -61,6 +61,14 @@ public final class TaskInputController {
        mAdapter.notifyItemRemoved(position);
    }

    // TODO: Implement "Clear all" and notify adapter that data has updated

    /**
     * Logic that occurs when clear all is triggered.
     */
    public void onClearAllClicked(View view) {
        // TODO: Play an animation so transition is more natural.
        int count = mAdapter.getItemCount();
        ActivityManagerWrapper.getInstance().removeAllRecentTasks();
        mLoader.clearAllTasks();
        mAdapter.notifyItemRangeRemoved(0 /* positionStart */, count);
    }
}
Loading