forked from lovejoy777/Showcase
/
DebugLayers.java
106 lines (84 loc) · 4.47 KB
/
DebugLayers.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package com.lovejoy777.showcase.debug;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.lovejoy777.showcase.beans.Layer;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class DebugLayers {
public static Collection<Layer> createDebugLayers() {
List<Layer> layers = new ArrayList<>();
String themeWithWrongScreenshotImages = "{\n" +
" \"title\": \"Theme with wrong images\",\n" +
" \"icon\": \"NO LINK HERE\",\n" +
" \"screenshot_1\": \"https://plus.google.com/u/0/communities\",\n" +
" \"screenshot_2\": \"https://inbox.google.com/u/1/?pli=1\",\n" +
" \"screenshot_3\": \"vasdvas\"\n" +
"}";
String themeWithBlackToolbar = "{\n" +
" \"title\": \"Theme with black toolbar\",\n" +
" \"icon\": \"NO LINK HERE\",\n" +
" \"link\": \"NO LINK HERE\",\n" +
" \"toolbar_background_color\": \"0\",\n" +
" \"screenshot_2\": \"https://inbox.google.com/u/1/?pli=1\",\n" +
" \"screenshot_3\": \"vasdvas\"\n" +
"}";
String themeWithWhiteToolbar = "{\n" +
" \"title\": \"Theme with white toolbar\",\n" +
" \"icon\": \"NO LINK HERE\",\n" +
" \"link\": \"NO LINK HERE\",\n" +
" \"toolbar_background_color\": \"FFFFFF\",\n" +
" \"screenshot_2\": \"https://inbox.google.com/u/1/?pli=1\",\n" +
" \"screenshot_3\": \"vasdvas\"\n" +
"}";
String themeWithBackupScreenshot = "{\n" +
" \"title\": \"Theme with backup screenshots\",\n" +
" \"icon\": \"NO LINK HERE\",\n" +
" \"link\": \"NO LINK HERE\",\n" +
" \"screenshot_1\": \"https://inbox.google.com/u/1/?pli=1, http://i.imgur.com/poo8Jvs.png \",\n" +
" \"screenshot_2\": \"https://inbox.google.com/u/1/?pli=1,http://i.imgur.com/NzyeZ6E.png \",\n" +
" \"screenshot_3\": \"vasdvas\"\n" +
"}";
String themeWithExistingDonatePackage = "{\n" +
" \"title\": \"Theme with existing donate package\",\n" +
" \"icon\": \"NO LINK HERE\",\n" +
" \"screenshot_1\": \"https://plus.google.com/u/0/communities\",\n" +
" \"screenshot_2\": \"https://inbox.google.com/u/1/?pli=1\",\n" +
" \"screenshot_3\": \"vasdvas\",\n" +
" \"link\": \"https://play.google.com/store/apps/details?id=this.will.never.exist\",\n" +
" \"donate_link\": \"https://play.google.com/store/apps/details?id=com.android.settings\"\n" +
"}";
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
try {
layers.add(objectMapper.readValue(themeWithWrongScreenshotImages, Layer.class));
layers.add(objectMapper.readValue(themeWithBlackToolbar, Layer.class));
layers.add(objectMapper.readValue(themeWithWhiteToolbar, Layer.class));
layers.add(objectMapper.readValue(themeWithBackupScreenshot, Layer.class));
layers.add(objectMapper.readValue(themeWithExistingDonatePackage, Layer.class));
return layers;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static Layer debugLayerWithBlackToolbar() {
String themeWithBlackToolbar = "{\n" +
" \"title\": \"Theme with black toolbar\",\n" +
" \"icon\": \"NO LINK HERE\",\n" +
" \"link\": \"NO LINK HERE\",\n" +
" \"toolbar_background_color\": \"0\",\n" +
" \"screenshot_2\": \"https://inbox.google.com/u/1/?pli=1\",\n" +
" \"screenshot_3\": \"vasdvas\"\n" +
"}";
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
try {
return objectMapper.readValue(themeWithBlackToolbar, Layer.class);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}