summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Edgar Wang <edgarwang@google.com> 2021-01-10 18:14:49 +0800
committer Edgar Wang <edgarwang@google.com> 2021-01-11 11:03:37 +0800
commit0fde398849a796765f87a53d4a02fe26d78a612d (patch)
treeac991269f30f9cc15d594e129c418fe4d4d16965
parent1d30d73d0eef90522dcc46803042155405c6435d (diff)
Make file build pass after copy it to another path.
- androidx.core.content.res.TypedArrayUtils is not available in another path, remove it from dependency. - Move layout from SettingsLib to FooterPerference - Move FooterPreferenceStyle from SettingsLib to SettingsTheme Bug: 177181159 Test: manual & robotest Change-Id: Ieccc6b789704cf66b9cf67560951610deb250514
-rw-r--r--packages/SettingsLib/FooterPreference/Android.bp1
-rw-r--r--packages/SettingsLib/FooterPreference/res/layout/preference_footer.xml54
-rw-r--r--packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java5
-rw-r--r--packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/LinkTextView.java (renamed from packages/SettingsLib/src/com/android/settingslib/widget/LinkTextView.java)4
-rw-r--r--packages/SettingsLib/SettingsTheme/res/values/attrs.xml (renamed from packages/SettingsLib/FooterPreference/res/values/attrs.xml)0
-rw-r--r--packages/SettingsLib/SettingsTheme/res/values/styles_preference.xml1
-rw-r--r--packages/SettingsLib/res/values/styles_support_preference.xml6
7 files changed, 60 insertions, 11 deletions
diff --git a/packages/SettingsLib/FooterPreference/Android.bp b/packages/SettingsLib/FooterPreference/Android.bp
index 30d9bd23cd0c..1af967fef717 100644
--- a/packages/SettingsLib/FooterPreference/Android.bp
+++ b/packages/SettingsLib/FooterPreference/Android.bp
@@ -7,6 +7,7 @@ android_library {
static_libs: [
"androidx.annotation_annotation",
"androidx.preference_preference",
+ "SettingsLibSettingsTheme",
],
sdk_version: "system_current",
min_sdk_version: "21",
diff --git a/packages/SettingsLib/FooterPreference/res/layout/preference_footer.xml b/packages/SettingsLib/FooterPreference/res/layout/preference_footer.xml
new file mode 100644
index 000000000000..5496a0178094
--- /dev/null
+++ b/packages/SettingsLib/FooterPreference/res/layout/preference_footer.xml
@@ -0,0 +1,54 @@
+<?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.
+ -->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:background="?android:attr/selectableItemBackground"
+ android:clipToPadding="false">
+
+ <LinearLayout
+ android:id="@+id/icon_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:minWidth="56dp"
+ android:gravity="start|top"
+ android:orientation="horizontal"
+ android:paddingEnd="12dp"
+ android:paddingTop="16dp"
+ android:paddingBottom="4dp">
+ <ImageView
+ android:id="@android:id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+ </LinearLayout>
+
+ <com.android.settingslib.widget.LinkTextView
+ android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingBottom="16dp"
+ android:paddingTop="16dp"
+ android:maxLines="10"
+ android:textColor="?android:attr/textColorSecondary"
+ android:ellipsize="marquee" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java b/packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java
index 15301f616f8b..5ba1082e91ef 100644
--- a/packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java
+++ b/packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/FooterPreference.java
@@ -24,7 +24,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
-import androidx.core.content.res.TypedArrayUtils;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
@@ -38,8 +37,7 @@ public class FooterPreference extends Preference {
static final int ORDER_FOOTER = Integer.MAX_VALUE - 1;
public FooterPreference(Context context, AttributeSet attrs) {
- super(context, attrs, TypedArrayUtils.getAttr(
- context, R.attr.footerPreferenceStyle, android.R.attr.preferenceStyle));
+ super(context, attrs, R.attr.footerPreferenceStyle);
init();
}
@@ -72,6 +70,7 @@ public class FooterPreference extends Preference {
}
private void init() {
+ setLayoutResource(R.layout.preference_footer);
if (getIcon() == null) {
setIcon(R.drawable.ic_info_outline_24);
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/widget/LinkTextView.java b/packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/LinkTextView.java
index 8b9315c99d63..868feadf6b35 100644
--- a/packages/SettingsLib/src/com/android/settingslib/widget/LinkTextView.java
+++ b/packages/SettingsLib/FooterPreference/src/com/android/settingslib/widget/LinkTextView.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * 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.
@@ -48,4 +48,4 @@ public class LinkTextView extends TextView {
}
}
}
-} \ No newline at end of file
+}
diff --git a/packages/SettingsLib/FooterPreference/res/values/attrs.xml b/packages/SettingsLib/SettingsTheme/res/values/attrs.xml
index deba3af2b910..deba3af2b910 100644
--- a/packages/SettingsLib/FooterPreference/res/values/attrs.xml
+++ b/packages/SettingsLib/SettingsTheme/res/values/attrs.xml
diff --git a/packages/SettingsLib/SettingsTheme/res/values/styles_preference.xml b/packages/SettingsLib/SettingsTheme/res/values/styles_preference.xml
index d9c158619f63..6ca8f5775f42 100644
--- a/packages/SettingsLib/SettingsTheme/res/values/styles_preference.xml
+++ b/packages/SettingsLib/SettingsTheme/res/values/styles_preference.xml
@@ -16,6 +16,7 @@
-->
<resources>
<style name="PreferenceTheme" parent="@style/PreferenceThemeOverlay">
+ <item name="footerPreferenceStyle">@style/Preference.Material</item>
<item name="preferenceCategoryStyle">@style/SettingsCategoryPreference</item>
<!-- For preference category color -->
<item name="preferenceCategoryTitleTextAppearance">@style/TextAppearance.CategoryTitle
diff --git a/packages/SettingsLib/res/values/styles_support_preference.xml b/packages/SettingsLib/res/values/styles_support_preference.xml
index 8ba9033ef1fb..2b29a824aaac 100644
--- a/packages/SettingsLib/res/values/styles_support_preference.xml
+++ b/packages/SettingsLib/res/values/styles_support_preference.xml
@@ -20,13 +20,7 @@
<dimen name="preference_no_icon_padding_start">72dp</dimen>
- <!-- Footer Preferences -->
- <style name="Preference.FooterPreference.SettingsBase" parent="@style/Preference.Material">
- <item name="android:layout">@layout/preference_footer</item>
- </style>
-
<style name="PreferenceThemeOverlay.SettingsBase" parent="@style/PreferenceThemeOverlay">
- <item name="footerPreferenceStyle">@style/Preference.FooterPreference.SettingsBase</item>
</style>
</resources>