Merge "[WorkProfile] Update work/personal tab to pills" into sc-dev

This commit is contained in:
Samuel Fufa
2021-05-06 23:33:06 +00:00
committed by Android (Google) Code Review
9 changed files with 41 additions and 12 deletions
+1 -1
View File
@@ -14,6 +14,6 @@
limitations under the License.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?android:attr/colorAccent" android:state_selected="true"/>
<item android:color="@android:color/white" android:state_selected="true"/>
<item android:color="?android:attr/textColorTertiary"/>
</selector>
+21
View File
@@ -0,0 +1,21 @@
<?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.
-->
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
<solid android:color="?androidprv:attr/colorSurfaceVariant" />
<corners android:radius="@dimen/all_apps_header_pill_corner_radius" />
</shape>
+2 -1
View File
@@ -19,7 +19,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="@dimen/all_apps_header_tab_height"
android:layout_height="@dimen/all_apps_header_pill_height"
android:background="@drawable/all_apps_tabs_background"
android:layout_marginLeft="@dimen/all_apps_tabs_side_padding"
android:layout_marginRight="@dimen/all_apps_tabs_side_padding"
android:orientation="horizontal"
+1 -1
View File
@@ -22,7 +22,7 @@
android:layout_height="match_parent"
android:layout_below="@id/search_container_all_apps"
android:layout_gravity="center_horizontal|top"
android:layout_marginTop="@dimen/all_apps_header_tab_height"
android:layout_marginTop="@dimen/all_apps_header_pill_height"
android:clipChildren="true"
android:clipToPadding="false"
android:descendantFocusability="afterDescendants"
+1 -1
View File
@@ -70,7 +70,7 @@
<com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="@dimen/all_apps_header_tab_height"
android:layout_height="@dimen/all_apps_header_pill_height"
android:layout_marginLeft="@dimen/all_apps_tabs_side_padding"
android:layout_marginRight="@dimen/all_apps_tabs_side_padding"
android:orientation="horizontal"
+1 -1
View File
@@ -19,7 +19,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="@dimen/all_apps_header_tab_height"
android:layout_height="@dimen/all_apps_header_pill_height"
android:layout_marginLeft="@dimen/all_apps_tabs_side_padding"
android:layout_marginRight="@dimen/all_apps_tabs_side_padding"
android:orientation="horizontal"
+2 -1
View File
@@ -91,7 +91,8 @@
<dimen name="all_apps_empty_search_bg_top_offset">144dp</dimen>
<dimen name="all_apps_background_canvas_width">700dp</dimen>
<dimen name="all_apps_background_canvas_height">475dp</dimen>
<dimen name="all_apps_header_tab_height">50dp</dimen>
<dimen name="all_apps_header_pill_height">50dp</dimen>
<dimen name="all_apps_header_pill_corner_radius">50dp</dimen>
<dimen name="all_apps_tabs_indicator_height">2dp</dimen>
<dimen name="all_apps_header_top_padding">36dp</dimen>
<dimen name="all_apps_work_profile_tab_footer_top_padding">16dp</dimen>
@@ -146,7 +146,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
mAdapters.put(AdapterHolder.SEARCH, new AdapterHolder(AdapterHolder.SEARCH));
mTabsHeight = mHasWorkProfile
? getContext().getResources()
.getDimensionPixelSize(R.dimen.all_apps_header_tab_height)
.getDimensionPixelSize(R.dimen.all_apps_header_pill_height)
: 0;
mWidgetCellHorizontalPadding = 2 * getResources().getDimensionPixelOffset(
R.dimen.widget_cell_horizontal_padding);
@@ -39,6 +39,8 @@ public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageInd
private final Paint mDividerPaint;
private int mSelectedIndicatorHeight;
private final int mSelectedIndicatorRadius;
private int mIndicatorLeft = -1;
private int mIndicatorRight = -1;
private float mScrollOffset;
@@ -54,7 +56,10 @@ public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageInd
setWillNotDraw(false);
mSelectedIndicatorHeight =
getResources().getDimensionPixelSize(R.dimen.all_apps_tabs_indicator_height);
getResources().getDimensionPixelSize(R.dimen.all_apps_header_pill_height);
mSelectedIndicatorRadius = getResources().getDimensionPixelSize(
R.dimen.all_apps_header_pill_corner_radius);
mSelectedIndicatorPaint = new Paint();
mSelectedIndicatorPaint.setColor(
@@ -118,9 +123,9 @@ public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageInd
super.onDraw(canvas);
float y = getHeight() - mDividerPaint.getStrokeWidth();
canvas.drawLine(getPaddingLeft(), y, getWidth() - getPaddingRight(), y, mDividerPaint);
canvas.drawRect(mIndicatorLeft, getHeight() - mSelectedIndicatorHeight,
mIndicatorRight, getHeight(), mSelectedIndicatorPaint);
canvas.drawRoundRect(mIndicatorLeft, getHeight() - mSelectedIndicatorHeight,
mIndicatorRight, getHeight(), mSelectedIndicatorRadius, mSelectedIndicatorRadius,
mSelectedIndicatorPaint);
}
@Override
@@ -144,7 +149,8 @@ public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageInd
}
@Override
public void setMarkersCount(int numMarkers) { }
public void setMarkersCount(int numMarkers) {
}
@Override
public boolean hasOverlappingRendering() {