Color codes

This commit is contained in:
2019-06-04 20:51:46 +02:00
parent a84c571595
commit 7a55313646
3 changed files with 32 additions and 0 deletions
Binary file not shown.
+32
View File
@@ -3,8 +3,13 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
@@ -35,6 +40,24 @@ public class CalendarQuickstart {
private static final List<String> SCOPES = Collections.singletonList(CalendarScopes.CALENDAR);
private static final String CREDENTIALS_FILE_PATH = "/credentials.json";
private static HashMap<String, String> colorMap;
static {
colorMap = new HashMap<String, String>();
colorMap.put("1", "7986cb"); // Lavendel
colorMap.put("2", "33b679"); // Salbei
colorMap.put("3", "8e24aa"); // Weintraube
colorMap.put("4", "e67c73"); // Flamingo
colorMap.put("5", "f6bf26"); // Banane
colorMap.put("6", "f4511e"); // Mandarine
colorMap.put("7", "039be5"); // Pfau
colorMap.put("8", "616161"); // Grafit
colorMap.put("9", "3f51b5"); // Heidelbeere
colorMap.put("10", "0b8043"); // Basilikum
colorMap.put("11", "d50000"); // Tomate
}
/**
* Creates an authorized Credential object.
* @param HTTP_TRANSPORT The network HTTP Transport.
@@ -86,6 +109,8 @@ public class CalendarQuickstart {
int hitCt = 0;
int pageCt = 0;
HashSet<String> colSet = new HashSet<String>();
String srcId = "tero23q0dqqfc45r4jjcecl7bs@group.calendar.google.com";
String trgId = "rpg91b8ls4e437a2gu63jhmlfk@group.calendar.google.com";
@@ -163,6 +188,8 @@ public class CalendarQuickstart {
+ ", DESCRIPTION: " + event.getDescription()
+ ", SUMMARY: " + event.getSummary());
colSet.add(event.getColorId());
if (event.getColorId() != null) {
colCt++;
@@ -194,5 +221,10 @@ public class CalendarQuickstart {
System.out.println("Colored source events: " + colCt);
System.out.println("Target hits: " + hitCt);
System.out.println("Colors used:");
for (String str : colSet) {
System.out.println(str);
}
}
}
Binary file not shown.