diff options
author | Julian Kast <julian@livio.com> | 2020-03-27 12:54:32 -0400 |
---|---|---|
committer | Julian Kast <julian@livio.com> | 2020-03-27 12:54:32 -0400 |
commit | 08dc7ac1e4a295a75c1a0f217e18714b68a81e31 (patch) | |
tree | 3e01249369993dfd58ff58e731817fc6a0bbdd42 | |
parent | 153f02cc27178335306bf76f721e8683c41acfb1 (diff) | |
download | sdl_android-08dc7ac1e4a295a75c1a0f217e18714b68a81e31.tar.gz |
Moved ManagerUtility class and created symlink
-rw-r--r-- | base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java | 72 | ||||
l--------- | baseAndroid/src/main/java/com/smartdevicelink/managers/ManagerUtility.java | 1 |
2 files changed, 73 insertions, 0 deletions
diff --git a/base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java b/base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java new file mode 100644 index 000000000..42c2a0e95 --- /dev/null +++ b/base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java @@ -0,0 +1,72 @@ +package com.smartdevicelink.managers; + +import com.smartdevicelink.proxy.rpc.ImageField; +import com.smartdevicelink.proxy.rpc.TextField; +import com.smartdevicelink.proxy.rpc.WindowCapability; +import com.smartdevicelink.proxy.rpc.enums.ImageFieldName; +import com.smartdevicelink.proxy.rpc.enums.TextFieldName; + +import java.util.List; + +public class ManagerUtility { + + public static class WindowCapabilityUtility { + + /** + * Check to see if WindowCapability has an ImageFieldName of a given name. + * @param name ImageFieldName representing a name of a given Image field that would be stored in WindowCapability + * @return true if name exist in WindowCapability else false + */ + public static boolean hasImageFieldOfName(ImageFieldName name, WindowCapability windowCapability) { + if (windowCapability == null ){ return false; } + if (windowCapability.getImageFields() != null) { + for (ImageField field : windowCapability.getImageFields()) { + if (field != null && field.getName() != null && field.getName().equals(name)) { + return true; + } + } + } + return false; + } + + /** + * Check to see if WindowCapability has a textField of a given name. + * @param name - TextFieldName representing a name of a given text field that would be stored in WindowCapability + * @return true if name exist in WindowCapability else false + */ + public static boolean hasTextFieldOfName(TextFieldName name, WindowCapability windowCapability) { + if (windowCapability == null ){ return false; } + if (windowCapability.getTextFields() != null) { + for (TextField field : windowCapability.getTextFields()) { + if (field != null && field.getName() != null && field.getName().equals(name)) { + return true; + } + } + } + return false; + } + + /** + * Method to get number of textFields allowed to be set according to WindowCapability + * @return linesFound - Number of textFields found in WindowCapability + */ + public static int getMaxNumberOfMainFieldLines(WindowCapability windowCapability) { + int linesFound = 0; + + List<TextField> textFields = windowCapability.getTextFields(); + TextFieldName name; + if (textFields != null && !textFields.isEmpty()) { + for (TextField field : textFields) { + if (field.getName() != null) { + name = field.getName(); + if (name == TextFieldName.mainField1 || name == TextFieldName.mainField2 || name == TextFieldName.mainField3 || name == TextFieldName.mainField4) { + linesFound += 1; + } + } + } + } + return linesFound; + } + } + +} diff --git a/baseAndroid/src/main/java/com/smartdevicelink/managers/ManagerUtility.java b/baseAndroid/src/main/java/com/smartdevicelink/managers/ManagerUtility.java new file mode 120000 index 000000000..55d1ecb8b --- /dev/null +++ b/baseAndroid/src/main/java/com/smartdevicelink/managers/ManagerUtility.java @@ -0,0 +1 @@ +../../../../../../../base/src/main/java/com/smartdevicelink/managers/ManagerUtility.java
\ No newline at end of file |