diff options
author | desperateCoder <echotodevnull@gmail.com> | 2020-10-04 12:19:17 +0300 |
---|---|---|
committer | desperateCoder <echotodevnull@gmail.com> | 2020-10-04 12:19:17 +0300 |
commit | 180983642de284cf60266c6cedc0012bf1cf4a17 (patch) | |
tree | a29e8cda496d889ed563ec6335a06256dfa393a0 /app/src/main/java/it/niedermann/nextcloud/deck/api | |
parent | 79b0f29b0c0b841d102e287975413154a8e31661 (diff) |
fixed color upsync
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/api')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/api/json/JsonColorSerializer.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/api/json/JsonColorSerializer.java b/app/src/main/java/it/niedermann/nextcloud/deck/api/json/JsonColorSerializer.java new file mode 100644 index 000000000..9ce238236 --- /dev/null +++ b/app/src/main/java/it/niedermann/nextcloud/deck/api/json/JsonColorSerializer.java @@ -0,0 +1,26 @@ +package it.niedermann.nextcloud.deck.api.json; + +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +import java.io.IOException; + +import it.niedermann.nextcloud.deck.util.ColorUtil; + +public class JsonColorSerializer extends TypeAdapter<Integer> { + @Override + public void write(JsonWriter out, Integer value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ColorUtil.intColorToHexString(value)); + } + } + + @Override + public Integer read(JsonReader in) throws IOException { + // currently not needed + return null; + } +} |