diff options
author | Julian Kast <julian@livio.com> | 2020-09-01 10:34:49 -0400 |
---|---|---|
committer | Julian Kast <julian@livio.com> | 2020-09-01 10:34:49 -0400 |
commit | 04ead8f26713a3ff954c3fb9c945eeaba4a55af2 (patch) | |
tree | 5c5b3040fa0eb5d353422c42ef408f6f15835be9 | |
parent | ff2c6e907c385674e267c1a0cf17d4512290a97b (diff) | |
download | sdl_android-TextAndGraphicsManager-Refactor-Queues.tar.gz |
Fixed Error with shouldUpdateSecondaryImage and made change to shouldUpdatePrimaryImage to be consistentTextAndGraphicsManager-Refactor-Queues
-rw-r--r-- | base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java index f7a2c7b89..5f29e0cf9 100644 --- a/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java +++ b/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java @@ -556,11 +556,12 @@ class TextAndGraphicUpdateOperation extends Task { */ private boolean shouldUpdatePrimaryImage() { boolean templateSupportsPrimaryArtwork = templateSupportsImageField(ImageFieldName.graphic); - String currentScreenDataPrimaryGraphicName = (currentScreenData != null && currentScreenData.getGraphic() != null) ? currentScreenData.getGraphic().getValue() : null; String primaryGraphicName = updatedState.getPrimaryGraphic() != null ? updatedState.getPrimaryGraphic().getName() : null; - return templateSupportsPrimaryArtwork - && !CompareUtils.areStringsEqual(currentScreenDataPrimaryGraphicName, primaryGraphicName, true, true); + + boolean graphicMatchesExisting = CompareUtils.areStringsEqual(currentScreenDataPrimaryGraphicName, primaryGraphicName, true, true); + + return templateSupportsPrimaryArtwork && !graphicMatchesExisting; } /** @@ -570,14 +571,16 @@ class TextAndGraphicUpdateOperation extends Task { */ private boolean shouldUpdateSecondaryImage() { boolean templateSupportsSecondaryArtwork = templateSupportsImageField(ImageFieldName.secondaryGraphic); - String currentScreenDataSecondaryGraphicName = (currentScreenData != null && currentScreenData.getSecondaryGraphic() != null) ? currentScreenData.getSecondaryGraphic().getValue() : null; String secondaryGraphicName = updatedState.getSecondaryGraphic() != null ? updatedState.getSecondaryGraphic().getName() : null; + + boolean graphicMatchesExisting = CompareUtils.areStringsEqual(currentScreenDataSecondaryGraphicName, secondaryGraphicName, true, true); + // Cannot detect if there is a secondary image below v5.0, so we'll just try to detect if the primary image is allowed and allow the secondary image if it is. if (internalInterface.get().getSdlMsgVersion().getMajorVersion() >= 5) { - return templateSupportsSecondaryArtwork && !CompareUtils.areStringsEqual(currentScreenDataSecondaryGraphicName, secondaryGraphicName, true, true); + return templateSupportsSecondaryArtwork && !graphicMatchesExisting; } else { - return templateSupportsImageField(ImageFieldName.graphic); + return templateSupportsImageField(ImageFieldName.graphic) && !graphicMatchesExisting; } } |