Package com.medm.devicekit
Class DeviceSetting
java.lang.Object
com.medm.devicekit.DeviceSetting
- All Implemented Interfaces:
android.os.Parcelable
Represents setting as its kind and fixed array of possible string values.
You can get current selected value by using
getValue()
or getValueIndex()
and set value by using selectValueWithIndex(int)
}-
Nested Class Summary
-
Field Summary
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Method Summary
Modifier and TypeMethodDescriptionint
getKind()
Get device setting kindString[]
Get possible device setting variants.getValue()
Get current device setting valueint
Get current setting value position ingetPossibleValues()
arrayboolean
Is this setting readonly, usually means that you can set this setting only before adding.void
selectValueWithIndex
(int index) Select variant fromgetPossibleValues()
arrayvoid
Set setting valuevoid
writeToParcel
(android.os.Parcel parcel, int i)
-
Field Details
-
CREATOR
-
-
Method Details
-
getKind
Get device setting kind- Returns:
- kind of the setting
-
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:
UnsupportedOperationException
- ifisReadonly()
or if its kind isDeviceSetting.Kind.EncryptionKey
IllegalArgumentException
- if provided index is out of bounds
-
getValue
Get current device setting value- Returns:
- string representation of the currently selected value
-
setValue
Set setting value- Parameters:
value
- string representation of the new value. For all settings apart fromDeviceSetting.Kind.EncryptionKey
should be one ofgetPossibleValues()
- Throws:
UnsupportedOperationException
- ifisReadonly()
IllegalArgumentException
- if provided value isn't ingetPossibleValues()
-
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
-