Merge "Fine tune Widget library" into sc-dev am: 3b28d923c8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15001190 Change-Id: I3283cfc697ada05273840497509c4b4a2d91b74d
This commit is contained in:
@@ -149,7 +149,7 @@ public class FooterPreference extends Preference {
|
||||
private void init() {
|
||||
setLayoutResource(R.layout.preference_footer);
|
||||
if (getIcon() == null) {
|
||||
setIcon(R.drawable.ic_info_outline_24);
|
||||
setIcon(R.drawable.settingslib_ic_info_outline_24);
|
||||
}
|
||||
setOrder(ORDER_FOOTER);
|
||||
if (TextUtils.isEmpty(getKey())) {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
-->
|
||||
|
||||
<resources xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
|
||||
<color name="settingslib_switchbar_background_color">@*android:color/material_grey_600</color>
|
||||
<color name="settingslib_switchbar_switch_track_tint">#BFFFFFFF</color>
|
||||
<color name="settingslib_switchbar_switch_thumb_tint">@android:color/white</color>
|
||||
</resources>
|
||||
|
||||
@@ -79,7 +79,7 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec
|
||||
final TypedArray a = context.obtainStyledAttributes(
|
||||
new int[]{android.R.attr.colorAccent});
|
||||
mBackgroundActivatedColor = a.getColor(0, 0);
|
||||
mBackgroundColor = context.getColor(R.color.settingslib_switchbar_background_color);
|
||||
mBackgroundColor = context.getColor(R.color.material_grey_600);
|
||||
a.recycle();
|
||||
}
|
||||
|
||||
@@ -89,11 +89,12 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec
|
||||
mFrameView = findViewById(R.id.frame);
|
||||
mTextView = (TextView) findViewById(R.id.switch_text);
|
||||
mSwitch = (Switch) findViewById(android.R.id.switch_widget);
|
||||
mBackgroundOn = getContext().getDrawable(R.drawable.settingslib_switch_bar_bg_on);
|
||||
mBackgroundOff = getContext().getDrawable(R.drawable.settingslib_switch_bar_bg_off);
|
||||
mBackgroundDisabled = getContext().getDrawable(
|
||||
R.drawable.settingslib_switch_bar_bg_disabled);
|
||||
|
||||
if (BuildCompat.isAtLeastS()) {
|
||||
mBackgroundOn = getContext().getDrawable(R.drawable.settingslib_switch_bar_bg_on);
|
||||
mBackgroundOff = getContext().getDrawable(R.drawable.settingslib_switch_bar_bg_off);
|
||||
mBackgroundDisabled = getContext().getDrawable(
|
||||
R.drawable.settingslib_switch_bar_bg_disabled);
|
||||
}
|
||||
addOnSwitchChangeListener((switchView, isChecked) -> setChecked(isChecked));
|
||||
|
||||
setChecked(mSwitch.isChecked());
|
||||
@@ -195,9 +196,7 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec
|
||||
* Remove a listener for switch changes
|
||||
*/
|
||||
public void removeOnSwitchChangeListener(OnMainSwitchChangeListener listener) {
|
||||
if (mSwitchChangeListeners.contains(listener)) {
|
||||
mSwitchChangeListeners.remove(listener);
|
||||
}
|
||||
mSwitchChangeListeners.remove(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,10 +267,12 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec
|
||||
|
||||
public static final Parcelable.Creator<SavedState> CREATOR =
|
||||
new Parcelable.Creator<SavedState>() {
|
||||
@Override
|
||||
public SavedState createFromParcel(Parcel in) {
|
||||
return new SavedState(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SavedState[] newArray(int size) {
|
||||
return new SavedState[size];
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<!-- Dialog accent color -->
|
||||
<color name="settingslib_dialog_accent">@android:color/system_accent1_600</color>
|
||||
<!-- Dialog background color -->
|
||||
<color name="settingslib_dialog_background">@android:color/system_neutral1_800</color>
|
||||
<color name="settingslib_dialog_background">@*android:color/surface_light</color>
|
||||
<!-- Dialog error color. -->
|
||||
<color name="settingslib_dialog_colorError">#d93025</color> <!-- Red 600 -->
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</style>
|
||||
|
||||
<style name="Theme.AlertDialog.SettingsLib" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert">
|
||||
<item name="colorAccent">@*android:color/accent_device_default_light</item>
|
||||
<item name="colorAccent">@color/settingslib_dialog_accent</item>
|
||||
<item name="android:colorError">@color/settingslib_dialog_colorError</item>
|
||||
<item name="android:colorBackground">@color/settingslib_dialog_background</item>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user