Modify preference_list_fragment to support tabLayout
- Remove buttonBar because it is only used in PublicVolumeSettings - Add tabLayout in preference_list_fragment.xml Bug: 141601408 Test: manual Change-Id: Ieb84ccf2e685a03abec7b07cb8f9f4b64ee475e0
This commit is contained in:
@@ -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:id="@+id/container_material"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -49,44 +51,39 @@
|
|||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<RelativeLayout android:id="@+id/button_bar"
|
<LinearLayout
|
||||||
android:layout_height="wrap_content"
|
android:theme="@style/Theme.MaterialComponents.DayNight"
|
||||||
|
android:id="@+id/tab_container"
|
||||||
|
android:clipToPadding="true"
|
||||||
|
android:clipChildren="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_weight="0"
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<Button android:id="@+id/back_button"
|
<com.google.android.material.tabs.TabLayout
|
||||||
style="?android:attr/buttonBarButtonStyle"
|
android:background="@android:color/transparent"
|
||||||
android:layout_width="150dip"
|
android:id="@+id/tabs"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="5dip"
|
app:tabMaxWidth="0dp"
|
||||||
android:layout_alignParentStart="true"
|
app:tabGravity="fill"
|
||||||
android:text="@*android:string/back_button_label" />
|
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"/>
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.viewpager.widget.ViewPager
|
||||||
android:orientation="horizontal"
|
android:id="@+id/view_pager"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent">
|
||||||
android:layout_alignParentEnd="true">
|
|
||||||
|
|
||||||
<Button android:id="@+id/skip_button"
|
</androidx.viewpager.widget.ViewPager>
|
||||||
style="?android:attr/buttonBarButtonStyle"
|
</LinearLayout>
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="5dip"
|
|
||||||
android:text="@*android:string/skip_button_label"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<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" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@@ -250,9 +250,6 @@
|
|||||||
<dimen name="admin_details_dialog_learn_more_button_padding">8dp</dimen>
|
<dimen name="admin_details_dialog_learn_more_button_padding">8dp</dimen>
|
||||||
<dimen name="admin_details_dialog_learn_more_button_minWidth">88dp</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 -->
|
<!-- Display, Screen zoom -->
|
||||||
<dimen name="conversation_message_list_padding">10dp</dimen>
|
<dimen name="conversation_message_list_padding">10dp</dimen>
|
||||||
<dimen name="conversation_message_contact_icon_text_size">32sp</dimen>
|
<dimen name="conversation_message_contact_icon_text_size">32sp</dimen>
|
||||||
|
@@ -110,7 +110,6 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
ViewGroup mPinnedHeaderFrameLayout;
|
ViewGroup mPinnedHeaderFrameLayout;
|
||||||
private ViewGroup mButtonBar;
|
|
||||||
|
|
||||||
private LayoutPreference mHeader;
|
private LayoutPreference mHeader;
|
||||||
|
|
||||||
@@ -141,7 +140,6 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
final View root = super.onCreateView(inflater, container, savedInstanceState);
|
final View root = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
mPinnedHeaderFrameLayout = root.findViewById(R.id.pinned_header);
|
mPinnedHeaderFrameLayout = root.findViewById(R.id.pinned_header);
|
||||||
mButtonBar = root.findViewById(R.id.button_bar);
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,10 +163,6 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ViewGroup getButtonBar() {
|
|
||||||
return mButtonBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public View setPinnedHeaderView(int layoutResId) {
|
public View setPinnedHeaderView(int layoutResId) {
|
||||||
final LayoutInflater inflater = getActivity().getLayoutInflater();
|
final LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||||
final View pinnedHeader =
|
final View pinnedHeader =
|
||||||
|
@@ -36,7 +36,7 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base fragment class for per profile settings.
|
* Base fragment class for profile settings.
|
||||||
*/
|
*/
|
||||||
public abstract class ProfileSelectFragment extends InstrumentedFragment {
|
public abstract class ProfileSelectFragment extends InstrumentedFragment {
|
||||||
|
|
||||||
|
@@ -19,7 +19,6 @@ package com.android.settings.deviceinfo;
|
|||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
@@ -31,7 +30,6 @@ import android.os.storage.VolumeRecord;
|
|||||||
import android.provider.DocumentsContract;
|
import android.provider.DocumentsContract;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.format.Formatter;
|
import android.text.format.Formatter;
|
||||||
import android.text.format.Formatter.BytesResult;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@@ -137,13 +135,8 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Resources resources = getResources();
|
final ViewGroup container = getActivity().findViewById(R.id.container_material);
|
||||||
final int padding = resources.getDimensionPixelSize(
|
container.addView(mUnmount, new ViewGroup.LayoutParams(
|
||||||
R.dimen.unmount_button_padding);
|
|
||||||
final ViewGroup buttonBar = getButtonBar();
|
|
||||||
buttonBar.removeAllViews();
|
|
||||||
buttonBar.setPadding(padding, padding, padding, padding);
|
|
||||||
buttonBar.addView(mUnmount, new ViewGroup.LayoutParams(
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT));
|
ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
}
|
}
|
||||||
@@ -169,7 +162,8 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
|
|||||||
final long freeBytes = file.getFreeSpace();
|
final long freeBytes = file.getFreeSpace();
|
||||||
final long usedBytes = totalBytes - freeBytes;
|
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),
|
mSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large),
|
||||||
result.value, result.units));
|
result.value, result.units));
|
||||||
mSummary.setSummary(getString(R.string.storage_volume_used,
|
mSummary.setSummary(getString(R.string.storage_volume_used,
|
||||||
@@ -180,8 +174,8 @@ public class PublicVolumeSettings extends SettingsPreferenceFragment {
|
|||||||
if (mVolume.getState() == VolumeInfo.STATE_UNMOUNTED) {
|
if (mVolume.getState() == VolumeInfo.STATE_UNMOUNTED) {
|
||||||
addPreference(mMount);
|
addPreference(mMount);
|
||||||
}
|
}
|
||||||
if (mVolume.isMountedReadable()) {
|
if (!mVolume.isMountedReadable()) {
|
||||||
getButtonBar().setVisibility(View.VISIBLE);
|
mUnmount.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
addPreference(mFormatPublic);
|
addPreference(mFormatPublic);
|
||||||
if (mDisk.isAdoptable() && mIsPermittedToAdopt) {
|
if (mDisk.isAdoptable() && mIsPermittedToAdopt) {
|
||||||
|
Reference in New Issue
Block a user