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