Merge "Changed widget picker personal-work tab layout" into tm-qpr-dev
This commit is contained in:
commit
742294305f
|
@ -16,6 +16,7 @@
|
|||
|
||||
<com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:launcher="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/all_apps_header_pill_height"
|
||||
|
@ -24,7 +25,8 @@
|
|||
android:paddingBottom="@dimen/all_apps_tabs_vertical_padding"
|
||||
android:layout_marginTop="@dimen/all_apps_tabs_margin_top"
|
||||
android:orientation="horizontal"
|
||||
style="@style/TextHeadline">
|
||||
style="@style/TextHeadline"
|
||||
launcher:alignOnIcon="true">
|
||||
|
||||
<Button
|
||||
android:id="@+id/tab_personal"
|
||||
|
|
|
@ -89,8 +89,7 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:paddingVertical="8dp"
|
||||
android:paddingLeft="@dimen/widget_tabs_horizontal_padding"
|
||||
android:paddingRight="@dimen/widget_tabs_horizontal_padding"
|
||||
android:layout_marginHorizontal="@dimen/widget_list_horizontal_margin"
|
||||
android:background="?android:attr/colorBackground"
|
||||
style="@style/TextHeadline"
|
||||
launcher:layout_sticky="true">
|
||||
|
|
|
@ -214,6 +214,10 @@
|
|||
<attr name="c" format="float|dimension" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="PersonalWorkSlidingTabStrip">
|
||||
<attr name="alignOnIcon" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="ProfileDisplayOption">
|
||||
<attr name="name" />
|
||||
<attr name="minWidthDps" format="float" />
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package com.android.launcher3.workprofile;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
|
@ -24,6 +25,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.pageindicators.PageIndicator;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
|
||||
|
@ -31,11 +33,17 @@ import com.android.launcher3.views.ActivityContext;
|
|||
* Supports two indicator colors, dedicated for personal and work tabs.
|
||||
*/
|
||||
public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageIndicator {
|
||||
private final boolean mIsAlignOnIcon;
|
||||
private OnActivePageChangedListener mOnActivePageChangedListener;
|
||||
private int mLastActivePage = 0;
|
||||
|
||||
public PersonalWorkSlidingTabStrip(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs,
|
||||
R.styleable.PersonalWorkSlidingTabStrip);
|
||||
mIsAlignOnIcon = typedArray.getBoolean(
|
||||
R.styleable.PersonalWorkSlidingTabStrip_alignOnIcon, false);
|
||||
typedArray.recycle();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,7 +84,7 @@ public class PersonalWorkSlidingTabStrip extends LinearLayout implements PageInd
|
|||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
if (getPaddingLeft() == 0 && getPaddingRight() == 0) {
|
||||
if (mIsAlignOnIcon) {
|
||||
// If any padding is not specified, restrict the width to emulate padding
|
||||
int size = MeasureSpec.getSize(widthMeasureSpec);
|
||||
size = getTabWidth(getContext(), size);
|
||||
|
|
Loading…
Reference in New Issue