diff options
author | Kyrylo Mikos <kiril.mik.os@gmail.com> | 2014-11-17 13:26:26 +0200 |
---|---|---|
committer | Clark Scheff <clark@cyngn.com> | 2015-11-11 08:13:07 -0800 |
commit | dd6f7452d4bc5e6a4cb6497d48ed61e3f1d1faba (patch) | |
tree | de038362ec662ee36979980616474066661edc8d /src/com/android/settings/widget | |
parent | f078f436f98fafab84c39df92958befab000728c (diff) | |
download | packages_apps_Settings-dd6f7452d4bc5e6a4cb6497d48ed61e3f1d1faba.zip packages_apps_Settings-dd6f7452d4bc5e6a4cb6497d48ed61e3f1d1faba.tar.gz packages_apps_Settings-dd6f7452d4bc5e6a4cb6497d48ed61e3f1d1faba.tar.bz2 |
Settings: Squashed commit for expanded desktop
Settings: Bringup expanded desktop and implement per-user configuration.
Change-Id: Ib673d278d23423fe6885c73f1eb3dd858633e5b6
Settings: Don't load per-app extdesk into memory if not USER_CONFIGURABLE.
Change-Id: Iae4857e0cd95d75ae29222bb45a8fdcf0ff1ec48
Settings: Only save settings on destroy if we're user configurable.
Change-Id: Ie459053b4614f818dfa19948709a3dd0fdb8f427
Settings: Fix off-by-one SectionIndexer in Expanded Desktop.
Change-Id: I7bdd1081114b40cc2ab6372d16bb247401f83a86
Settings: Create default expanded desktop style fragment.
Change-Id: Ia5bebb45a953c2a8efdffbab2ddcbfa3d3c3d486
Diffstat (limited to 'src/com/android/settings/widget')
-rw-r--r-- | src/com/android/settings/widget/SwitchBar.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/com/android/settings/widget/SwitchBar.java b/src/com/android/settings/widget/SwitchBar.java index 094b95f..8cf064d 100644 --- a/src/com/android/settings/widget/SwitchBar.java +++ b/src/com/android/settings/widget/SwitchBar.java @@ -56,6 +56,9 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC private String mLabel; private String mSummary; + private int mStateOnLabel = R.string.switch_on_text; + private int mStateOffLabel = R.string.switch_off_text; + private ArrayList<OnSwitchChangeListener> mSwitchChangeListeners = new ArrayList<OnSwitchChangeListener>(); @@ -111,6 +114,14 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC setVisibility(View.GONE); } + public void setOnStateOnLabel(int stringRes) { + mStateOnLabel = stringRes; + } + + public void setOnStateOffLabel(int stringRes) { + mStateOffLabel = stringRes; + } + public void setTextViewLabel(boolean isChecked) { mLabel = getResources() .getString(isChecked ? R.string.switch_on_text : R.string.switch_off_text); @@ -211,6 +222,8 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC static class SavedState extends BaseSavedState { boolean checked; boolean visible; + int resOnLabel; + int resOffLabel; SavedState(Parcelable superState) { super(superState); @@ -223,6 +236,8 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC super(in); checked = (Boolean)in.readValue(null); visible = (Boolean)in.readValue(null); + resOnLabel = in.readInt(); + resOffLabel = in.readInt(); } @Override @@ -230,6 +245,8 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC super.writeToParcel(out, flags); out.writeValue(checked); out.writeValue(visible); + out.writeInt(resOnLabel); + out.writeInt(resOffLabel); } @Override @@ -237,7 +254,10 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC return "SwitchBar.SavedState{" + Integer.toHexString(System.identityHashCode(this)) + " checked=" + checked - + " visible=" + visible + "}"; + + " visible=" + visible + + " resOnLabel = " + resOnLabel + + " resOffLabel = " + resOffLabel + + "}"; } public static final Parcelable.Creator<SavedState> CREATOR @@ -259,6 +279,8 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC SavedState ss = new SavedState(superState); ss.checked = mSwitch.isChecked(); ss.visible = isShowing(); + ss.resOnLabel = mStateOnLabel; + ss.resOffLabel = mStateOffLabel; return ss; } @@ -269,6 +291,8 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC super.onRestoreInstanceState(ss.getSuperState()); mSwitch.setCheckedInternal(ss.checked); + setOnStateOnLabel(ss.resOnLabel); + setOnStateOffLabel(ss.resOffLabel); setTextViewLabel(ss.checked); setVisibility(ss.visible ? View.VISIBLE : View.GONE); mSwitch.setOnCheckedChangeListener(ss.visible ? this : null); |