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.Parcelable
Represents 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 class
DeviceSetting.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 int
describeContents()
DeviceSetting.Kind
getKind()
Get device setting kindjava.lang.String[]
getPossibleValues()
Get possible device setting variants.java.lang.String
getValue()
Get current device setting valueint
getValueIndex()
Get current setting value position ingetPossibleValues()
arrayboolean
isReadonly()
Is this setting readonly, usually means that you can set this setting only before adding.void
selectValueWithIndex(int index)
Select variant fromgetPossibleValues()
arrayvoid
writeToParcel(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:
describeContents
in interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(android.os.Parcel parcel, int i)
- Specified by:
writeToParcel
in interfaceandroid.os.Parcelable
-
-