Package com.medm.devicekit
Class DeviceSetting
- java.lang.Object
-
- com.medm.devicekit.DeviceSetting
-
- All Implemented Interfaces:
android.os.Parcelable
public class DeviceSetting extends java.lang.Object implements android.os.ParcelableRepresents setting as its kind and fixed array of possible string values. You can get current selected value by usinggetValue()orgetValueIndex()and set value by usingselectValueWithIndex(int)}
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDeviceSetting.Kind
-
Field Summary
Fields Modifier and Type Field Description static android.os.Parcelable.Creator<DeviceSetting>CREATOR
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdescribeContents()DeviceSetting.KindgetKind()Get device setting kindjava.lang.String[]getPossibleValues()Get possible device setting variants.java.lang.StringgetValue()Get current device setting valueintgetValueIndex()Get current setting value position ingetPossibleValues()arraybooleanisReadonly()Is this setting readonly, usually means that you can set this setting only before adding.voidselectValueWithIndex(int index)Select variant fromgetPossibleValues()arrayvoidwriteToParcel(android.os.Parcel parcel, int i)
-
-
-
Field Detail
-
CREATOR
public static final android.os.Parcelable.Creator<DeviceSetting> CREATOR
-
-
Method Detail
-
getKind
public DeviceSetting.Kind getKind()
Get device setting kind- Returns:
- kind of the setting
-
getPossibleValues
public java.lang.String[] getPossibleValues()
Get possible device setting variants. The array is fixed for the specific setting instance.- Returns:
- possible variants represented as strings
-
getValueIndex
public int getValueIndex()
Get current setting value position ingetPossibleValues()array- Returns:
- position of value in
getPossibleValues()array
-
selectValueWithIndex
public void selectValueWithIndex(int index)
Select variant fromgetPossibleValues()array- Parameters:
index- index ingetPossibleValues()array- Throws:
java.lang.UnsupportedOperationException- ifisReadonly()java.lang.IllegalArgumentException- if provided index is out of bounds
-
getValue
public java.lang.String getValue()
Get current device setting value- Returns:
- string representation of the currently selected value
-
isReadonly
public boolean isReadonly()
Is this setting readonly, usually means that you can set this setting only before adding. If true callingselectValueWithIndex(int)would result in exception.- Returns:
- is readonly
-
describeContents
public int describeContents()
- Specified by:
describeContentsin interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(android.os.Parcel parcel, int i)- Specified by:
writeToParcelin interfaceandroid.os.Parcelable
-
-