diff --git a/.idea/compiler.xml b/.idea/compiler.xml index fb7f4a8..61a9130 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 561b289..dd95f50 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -18,5 +18,5 @@ - + \ No newline at end of file diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index fb95255..948c000 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -10,8 +10,8 @@ { "type": "SINGLE", "filters": [], - "versionCode": 2, - "versionName": "0.2", + "versionCode": 3, + "versionName": "0.3.1", "outputFile": "app-release.apk" } ] diff --git a/app/src/main/java/it/danieleverducci/nextcloudmaps/utils/Color.java b/app/src/main/java/it/danieleverducci/nextcloudmaps/utils/Color.java new file mode 100644 index 0000000..f92fc48 --- /dev/null +++ b/app/src/main/java/it/danieleverducci/nextcloudmaps/utils/Color.java @@ -0,0 +1,22 @@ +package it.danieleverducci.nextcloudmaps.utils; + +public class Color { + + /** + * Based on Nextcloud Maps's getLetterColor util + * @see "https://github.com/nextcloud/maps/blob/master/src/utils.js" + * @param catName category name + */ + public static generareCategoryColor(String catName) { + // If category is default, return default color + + // Else + int letter1Index = letter1.toLowerCase().charCodeAt(0); + int letter2Index = letter2.toLowerCase().charCodeAt(0); + var letterCoef = ((letter1Index * letter2Index) % 100) / 100; + var h = letterCoef * 360; + var s = 75 + letterCoef * 10; + var l = 50 + letterCoef * 10; + return {h: Math.round(h), s: Math.round(s), l: Math.round(l)}; + } +}