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

Commit b22bbffe authored by Raff Tsai's avatar Raff Tsai Committed by Android (Google) Code Review
Browse files

Merge "Modify preference_list_fragment to support tabLayout"

parents cdf01bb1 988a9122
Loading
Loading
Loading
Loading
+30 −33
Original line number Diff line number Diff line
@@ -17,7 +17,9 @@
*/
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/container_material"
    android:orientation="vertical"
    android:layout_width="match_parent"
@@ -49,44 +51,39 @@
        android:gravity="center_vertical"
        android:visibility="gone" />

    <RelativeLayout android:id="@+id/button_bar"
        android:layout_height="wrap_content"
    <LinearLayout
        android:theme="@style/Theme.MaterialComponents.DayNight"
        android:id="@+id/tab_container"
        android:clipToPadding="true"
        android:clipChildren="true"
        android:layout_width="match_parent"
        android:layout_weight="0"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:visibility="gone">

        <Button android:id="@+id/back_button"
            style="?android:attr/buttonBarButtonStyle"
            android:layout_width="150dip"
            android:layout_height="wrap_content"
            android:layout_margin="5dip"
            android:layout_alignParentStart="true"
            android:text="@*android:string/back_button_label" />

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true">

            <Button android:id="@+id/skip_button"
                style="?android:attr/buttonBarButtonStyle"
                android:layout_width="wrap_content"
        <com.google.android.material.tabs.TabLayout
            android:background="@android:color/transparent"
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
                android:layout_margin="5dip"
                android:text="@*android:string/skip_button_label"
                android:visibility="gone" />
            app:tabMaxWidth="0dp"
            app:tabGravity="fill"
            app:tabMode="fixed"
            app:tabIndicatorColor="@*android:color/accent_device_default"
            app:tabSelectedTextColor="@*android:color/accent_device_default"
            app:tabTextColor="?android:attr/textColorSecondary"/>
        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="?android:attr/listDivider"/>

            <Button android:id="@+id/next_button"
                style="?android:attr/buttonBarButtonStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="5dip"
                android:text="@*android:string/next_button_label" />
        <androidx.viewpager.widget.ViewPager
            android:id="@+id/view_pager"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

        </androidx.viewpager.widget.ViewPager>
    </LinearLayout>

    </RelativeLayout>

</LinearLayout>
+0 −3
Original line number Diff line number Diff line
@@ -250,9 +250,6 @@
    <dimen name="admin_details_dialog_learn_more_button_padding">8dp</dimen>
    <dimen name="admin_details_dialog_learn_more_button_minWidth">88dp</dimen>

    <!-- Button bar padding for unmount button. -->
    <dimen name="unmount_button_padding">8dp</dimen>

    <!-- Display, Screen zoom -->
    <dimen name="conversation_message_list_padding">10dp</dimen>
    <dimen name="conversation_message_contact_icon_text_size">32sp</dimen>
+0 −6
Original line number Diff line number Diff line
@@ -110,7 +110,6 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF

    @VisibleForTesting
    ViewGroup mPinnedHeaderFrameLayout;
    private ViewGroup mButtonBar;

    private LayoutPreference mHeader;

@@ -141,7 +140,6 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
            Bundle savedInstanceState) {
        final View root = super.onCreateView(inflater, container, savedInstanceState);
        mPinnedHeaderFrameLayout = root.findViewById(R.id.pinned_header);
        mButtonBar = root.findViewById(R.id.button_bar);
        return root;
    }

@@ -165,10 +163,6 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
        }
    }

    public ViewGroup getButtonBar() {
        return mButtonBar;
    }

    public View setPinnedHeaderView(int layoutResId) {
        final LayoutInflater inflater = getActivity().getLayoutInflater();
        final View pinnedHeader =
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Base fragment class for per profile settings.
 * Base fragment class for profile settings.
 */
public abstract class ProfileSelectFragment extends InstrumentedFragment {

+6 −12
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.settings.deviceinfo;
import android.app.ActivityManager;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.os.UserManager;
@@ -31,7 +30,6 @@ import android.os.storage.VolumeRecord;
import android.provider.DocumentsContract;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.text.format.Formatter.BytesResult;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
@@ -137,13 +135,8 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
            return;
        }

        final Resources resources = getResources();
        final int padding = resources.getDimensionPixelSize(
                R.dimen.unmount_button_padding);
        final ViewGroup buttonBar = getButtonBar();
        buttonBar.removeAllViews();
        buttonBar.setPadding(padding, padding, padding, padding);
        buttonBar.addView(mUnmount, new ViewGroup.LayoutParams(
        final ViewGroup container = getActivity().findViewById(R.id.container_material);
        container.addView(mUnmount, new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
    }
@@ -169,7 +162,8 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
            final long freeBytes = file.getFreeSpace();
            final long usedBytes = totalBytes - freeBytes;

            final BytesResult result = Formatter.formatBytes(getResources(), usedBytes, 0);
            final Formatter.BytesResult result = Formatter.formatBytes(getResources(), usedBytes,
                    0);
            mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),
                    result.value, result.units));
            mSummary.setSummary(getString(R.string.storage_volume_used,
@@ -180,8 +174,8 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
        if (mVolume.getState() == VolumeInfo.STATE_UNMOUNTED) {
            addPreference(mMount);
        }
        if (mVolume.isMountedReadable()) {
            getButtonBar().setVisibility(View.VISIBLE);
        if (!mVolume.isMountedReadable()) {
            mUnmount.setVisibility(View.GONE);
        }
        addPreference(mFormatPublic);
        if (mDisk.isAdoptable() && mIsPermittedToAdopt) {