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

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

Merge changes Id401f273,I0b21c8ea,Ieb7936bd into ub-launcher3-qt-dev

* changes:
  Layout aligned to dp grid for portrait (3/3)
  Layout aligned to dp grid for portrait (2/3)
  Layout aligned to dp grid for portrait (1/3)
parents c6e7a38f fc3a79e4
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -14,22 +14,20 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<com.android.quickstep.views.ClearAllItemView
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/clear_all_item_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    android:layout_height="@dimen/clear_all_item_view_height">
    <Button
        android:id="@+id/clear_all_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginVertical="16dp"
        android:layout_width="@dimen/clear_all_button_width"
        android:layout_height="match_parent"
        android:layout_gravity="center_horizontal"
        android:paddingHorizontal="32dp"
        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"/>
</com.android.quickstep.views.ClearAllItemView>
</FrameLayout>
+2 −4
Original line number Diff line number Diff line
@@ -17,14 +17,13 @@
<com.android.quickstep.views.TaskItemView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_height="@dimen/task_item_height"
    android:orientation="horizontal">
    <com.android.quickstep.views.TaskThumbnailIconView
        android:id="@+id/task_icon_and_thumbnail"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginHorizontal="8dp"
        android:layout_marginTop="16dp">
        android:layout_marginHorizontal="@dimen/task_thumbnail_icon_horiz_margin">
        <ImageView
            android:id="@+id/task_thumbnail"
            android:layout_width="match_parent"
@@ -39,7 +38,6 @@
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginHorizontal="8dp"
        android:singleLine="true"
        android:textColor="@android:color/white"
        android:textSize="24sp"/>
+8 −0
Original line number Diff line number Diff line
@@ -15,5 +15,13 @@
     limitations under the License.
-->
<resources>
    <dimen name="task_item_height">60dp</dimen>
    <dimen name="task_item_top_margin">16dp</dimen>
    <dimen name="task_thumbnail_icon_horiz_margin">16dp</dimen>

    <dimen name="task_thumbnail_corner_radius">3dp</dimen>

    <dimen name="clear_all_item_view_height">36dp</dimen>
    <dimen name="clear_all_item_view_top_margin">20dp</dimen>
    <dimen name="clear_all_button_width">106dp</dimen>
</resources>
 No newline at end of file
+0 −41
Original line number Diff line number Diff line
/*
 * 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.
 */

package com.android.quickstep.views;

import static com.android.quickstep.views.TaskLayoutUtils.getClearAllItemHeight;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;

/**
 * Recycler view item that lays out the clear all button and measures the space it takes based on
 * the device height.
 */
public final class ClearAllItemView extends FrameLayout {

    public ClearAllItemView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int buttonHeight = getClearAllItemHeight(getContext());
        int newHeightSpec = MeasureSpec.makeMeasureSpec(buttonHeight, MeasureSpec.EXACTLY);
        super.onMeasure(widthMeasureSpec, newHeightSpec);
    }
}
+27 −1
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
import static androidx.recyclerview.widget.LinearLayoutManager.VERTICAL;

import static com.android.quickstep.TaskAdapter.CHANGE_EVENT_TYPE_EMPTY_TO_CONTENT;
import static com.android.quickstep.TaskAdapter.ITEM_TYPE_CLEAR_ALL;
import static com.android.quickstep.TaskAdapter.ITEM_TYPE_TASK;
import static com.android.quickstep.TaskAdapter.TASKS_START_POSITION;

import android.animation.Animator;
@@ -29,6 +31,7 @@ import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Rect;
import android.util.ArraySet;
import android.util.AttributeSet;
import android.util.FloatProperty;
@@ -44,6 +47,7 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver;
import androidx.recyclerview.widget.RecyclerView.ItemDecoration;
import androidx.recyclerview.widget.RecyclerView.OnChildAttachStateChangeListener;

import com.android.launcher3.BaseActivity;
@@ -174,6 +178,29 @@ public final class IconRecentsView extends FrameLayout {
            mTaskRecyclerView.setItemAnimator(mDefaultItemAnimator);
            mLoadingContentItemAnimator.setOnAnimationFinishedRunnable(
                    () -> mTaskRecyclerView.setItemAnimator(new DefaultItemAnimator()));
            ItemDecoration marginDecorator = new ItemDecoration() {
                @Override
                public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
                        @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
                    // TODO: Determine if current margins cause off screen item to be fully off
                    // screen and if so, modify them so that it is partially off screen.
                    int itemType = parent.getChildViewHolder(view).getItemViewType();
                    switch (itemType) {
                        case ITEM_TYPE_CLEAR_ALL:
                            outRect.top = (int) getResources().getDimension(
                                    R.dimen.clear_all_item_view_top_margin);
                            // TODO: In landscape, add bottom margin as well since we won't have
                            // nav bar to buffer things nicely.
                            break;
                        case ITEM_TYPE_TASK:
                            outRect.top = (int) getResources().getDimension(
                                    R.dimen.task_item_top_margin);
                            break;
                        default:
                    }
                }
            };
            mTaskRecyclerView.addItemDecoration(marginDecorator);

            mEmptyView = findViewById(R.id.recent_task_empty_view);
            mContentView = mTaskRecyclerView;
@@ -188,7 +215,6 @@ public final class IconRecentsView extends FrameLayout {
                    updateContentViewVisibility();
                }
            });
            // TODO: Move layout param logic into onMeasure
        }
    }

Loading