Skip to content

Commit

Permalink
Merge branch 'refs/heads/anildahiya/BugFix_KeyBoardProperty_ImageType…
Browse files Browse the repository at this point in the history
…Supported' into sdl_android_parent/develop
  • Loading branch information
Mike Burke committed Dec 17, 2014
2 parents eccc2c9 + 7a5c0ff commit 9d7016d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
47 changes: 31 additions & 16 deletions sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ImageField.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.smartdevicelink.proxy.rpc;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.FileType;
Expand Down Expand Up @@ -41,22 +43,35 @@ public void setName( ImageFieldName name ) {
store.remove(KEY_NAME);
}
}
public FileType getImageTypeSupported() {
Object obj = store.get(KEY_IMAGE_TYPE_SUPPORTED);
if (obj instanceof FileType) {
return (FileType) obj;
} else if (obj instanceof String) {
FileType theCode = null;
try {
theCode = FileType.valueForString((String) obj);
} catch (Exception e) {
DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + KEY_IMAGE_TYPE_SUPPORTED, e);
}
return theCode;
}
return null;
}
public void setImageTypeSupported( FileType imageTypeSupported ) {
@SuppressWarnings("unchecked")
public List<FileType> getImageTypeSupported() {
if (store.get(KEY_IMAGE_TYPE_SUPPORTED) instanceof List<?>) {
List<?> list = (List<?>)store.get(KEY_IMAGE_TYPE_SUPPORTED);
if (list != null && list.size() > 0) {
Object obj = list.get(0);
if (obj instanceof FileType) {
return (List<FileType>) list;
} else if (obj instanceof String) {
List<FileType> newList = new ArrayList<FileType>();
for (Object hashObj : list) {
String strFormat = (String)hashObj;
FileType theCode = null;
try {
theCode = FileType.valueForString(strFormat);
} catch (Exception e) {
DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + KEY_IMAGE_TYPE_SUPPORTED, e);
}
if (theCode != null) {
newList.add(theCode);
}
}
return newList;
}
}
}
return null;
}
public void setImageTypeSupported( List<FileType> imageTypeSupported ) {
if (imageTypeSupported != null) {
store.put(KEY_IMAGE_TYPE_SUPPORTED, imageTypeSupported );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.rpc.enums.DisplayType;
import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
import com.smartdevicelink.proxy.rpc.enums.LayoutMode;
import com.smartdevicelink.util.DebugTool;
Expand Down Expand Up @@ -377,7 +376,7 @@ public void setVrHelp(List<VrHelpItem> vrHelp) {

public LayoutMode getInteractionLayout() {
Object obj = parameters.get(KEY_INTERACTION_LAYOUT);
if (obj instanceof DisplayType) {
if (obj instanceof LayoutMode) {
return (LayoutMode) obj;
} else if (obj instanceof String) {
LayoutMode theCode = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public void setKeyboardProperties(KeyboardProperties keyboardProperties) {
@SuppressWarnings("unchecked")
public KeyboardProperties getKeyboardProperties() {
Object obj = parameters.get(KEY_KEYBOARD_PROPERTIES);
if (obj instanceof Image) {
if (obj instanceof KeyboardProperties) {
return (KeyboardProperties) obj;
} else if (obj instanceof Hashtable) {
try {
Expand Down

0 comments on commit 9d7016d

Please sign in to comment.