Merge "Extract footer preference as a widget lib"
This commit is contained in:
committed by
Android (Google) Code Review
commit
c49e071aeb
@@ -54,6 +54,7 @@ java_defaults {
|
||||
"SettingsLibEmergencyNumber",
|
||||
"SettingsLibTopIntroPreference",
|
||||
"SettingsLibBannerMessagePreference",
|
||||
"SettingsLibFooterPreference",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
13
packages/SettingsLib/FooterPreference/Android.bp
Normal file
13
packages/SettingsLib/FooterPreference/Android.bp
Normal file
@@ -0,0 +1,13 @@
|
||||
android_library {
|
||||
name: "SettingsLibFooterPreference",
|
||||
|
||||
srcs: ["src/**/*.java"],
|
||||
resource_dirs: ["res"],
|
||||
|
||||
static_libs: [
|
||||
"androidx.annotation_annotation",
|
||||
"androidx.preference_preference",
|
||||
],
|
||||
sdk_version: "system_current",
|
||||
min_sdk_version: "21",
|
||||
}
|
||||
23
packages/SettingsLib/FooterPreference/AndroidManifest.xml
Normal file
23
packages/SettingsLib/FooterPreference/AndroidManifest.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2020 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.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.settingslib.widget">
|
||||
|
||||
<uses-sdk android:minSdkVersion="21" />
|
||||
|
||||
</manifest>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2019 The Android Open Source Project
|
||||
Copyright (C) 2020 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.
|
||||
19
packages/SettingsLib/FooterPreference/res/values/attrs.xml
Normal file
19
packages/SettingsLib/FooterPreference/res/values/attrs.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2020 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.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<attr name="footerPreferenceStyle" format="reference" />
|
||||
</resources>
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2020 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.
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settingslib.widget;
|
||||
|
||||
import android.annotation.StringRes;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
@@ -24,20 +23,19 @@ import android.util.AttributeSet;
|
||||
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;
|
||||
|
||||
import com.android.settingslib.R;
|
||||
|
||||
/**
|
||||
* A custom preference acting as "footer" of a page. It has a field for icon and text. It is added
|
||||
* to screen as the last preference.
|
||||
*/
|
||||
public class FooterPreference extends Preference {
|
||||
|
||||
static final int ORDER_FOOTER = Integer.MAX_VALUE - 1;
|
||||
public static final String KEY_FOOTER = "footer_preference";
|
||||
static final int ORDER_FOOTER = Integer.MAX_VALUE - 1;
|
||||
|
||||
public FooterPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs, TypedArrayUtils.getAttr(
|
||||
@@ -46,8 +46,6 @@
|
||||
<attr name="wifi_signal" format="reference" />
|
||||
<attr name="wifi_friction" format="reference" />
|
||||
|
||||
<attr name="footerPreferenceStyle" format="reference" />
|
||||
|
||||
<!-- Workaround for b/74248169. These are duplicates of attrs in AndroidX preferences. -->
|
||||
<attr name="preferenceStyle" format="reference" />
|
||||
<attr name="switchPreferenceStyle" format="reference" />
|
||||
|
||||
Reference in New Issue
Block a user