Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

Commit 6945b36

Browse files
authored
Update sample app with new sections (#83)
1. Add showcase for TreeSection 2. Refactor decoration sample section 3. Overall design of the sample app is improved
1 parent a23dc58 commit 6945b36

File tree

142 files changed

+2569
-1065
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+2569
-1065
lines changed

.idea/codeStyles/Project.xml

Lines changed: 28 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sample/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,5 @@ dependencies {
5757
implementation Config.RX_JAVA
5858
implementation Config.RX_ANDROID
5959
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
60+
implementation 'com.mikepenz:itemanimators:1.0.2'
6061
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3-
<background android:drawable="@mipmap/ic_launcher_background"/>
4-
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
3+
<background android:drawable="@mipmap/ic_launcher_background"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
55
</adaptive-icon>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3-
<background android:drawable="@mipmap/ic_launcher_background"/>
4-
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
3+
<background android:drawable="@mipmap/ic_launcher_background"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
55
</adaptive-icon>

sample/src/main/java/dev/ahamed/mva/sample/data/DataManager.java

Lines changed: 97 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
import android.graphics.Color;
2020
import dev.ahamed.mva.sample.R;
2121
import dev.ahamed.mva.sample.data.model.ColoredItem;
22+
import dev.ahamed.mva.sample.data.model.Comment;
2223
import dev.ahamed.mva.sample.data.model.FaqItem;
23-
import dev.ahamed.mva.sample.data.model.MoviePosterItem;
2424
import dev.ahamed.mva.sample.data.model.NewsItem;
2525
import dev.ahamed.mva.sample.data.model.NumberItem;
26+
import dev.ahamed.mva.sample.data.model.Person;
2627
import dev.ahamed.mva.sample.data.model.SelectableItem;
2728
import dev.ahamed.mva.sample.data.model.TextItem;
2829
import java.util.ArrayList;
@@ -38,7 +39,7 @@ public class DataManager {
3839
Color.parseColor("#FFAB91")
3940
};
4041
private static final int[] newsThumbnails = new int[] {
41-
R.drawable.ic_circle, R.drawable.ic_heart, R.drawable.ic_star
42+
R.drawable.ic_circle_variant, R.drawable.ic_heart, R.drawable.ic_star
4243
};
4344
private static String[] newsDummyTitles = {
4445
"Introducing new Android Excellence apps and games on Google Play ",
@@ -47,12 +48,6 @@ public class DataManager {
4748
"Announcing Apps for Android and Google developer podcast",
4849
"Congrats to the new Android Excellence apps and games on Google Play "
4950
};
50-
//private static String[] movieNames = {
51-
// "A", "B", "C", "D", "E", "F", "G", "H", "I"
52-
//};
53-
private static String[] movieNames = {
54-
"A", "B", "C", "D"
55-
};
5651
private static String[] languages = {
5752
"Arabic", "English", "French", "Hindi", "Russian", "Spanish"
5853
};
@@ -69,6 +64,51 @@ public class DataManager {
6964
private static String[] websites = {
7065
"Reddit", "Google News", "Yahoo News", "Huffington Post", "Reuters"
7166
};
67+
private static String[] cast = {
68+
"Tony Stark", "Hans Olo", "Alice", "Petey Cruiser"
69+
};
70+
private static String[] castOverline = {
71+
"as ROBIN BANKS", "as LUKE WARM", "as MARIA HILL", "as PETE SARIYA"
72+
};
73+
private static String[] crew = {
74+
"John Doe", "Jane Doe", "Mario Speedwagon", "Rick O'Shea"
75+
};
76+
private static String[] crewOverline = {
77+
"DIRECTOR", "DIRECTOR", "WRITER", "WRITER"
78+
};
79+
private static String[] producer = {
80+
"Monty Carlo", "Jimmy Changa", "Barry Wine", "Buster Hyman"
81+
};
82+
private static String[] producerOverline = {
83+
"EXECUTIVE PRODUCER", "PRODUCER", "PRODUCER", "ASSOCIATE PRODUCER"
84+
};
85+
private static String[] authors = {
86+
"Concurag", "CrazyBilki", "emakerOf", "patA1", "trollicon", "iAmThere", "silento",
87+
"silentreader"
88+
};
89+
private static String[] comments = {
90+
"You are so inspiring! Such illustration, many avatar, so sublime",
91+
"Vastly sick notification :-) Just fab, friend.",
92+
"Excellent =) I want to make love to the use of button and background image!",
93+
"Sleek work you have here. Let me take a nap... great shot, anyway.",
94+
"Nice use of violet in this shot :-) Mission accomplished. It's strong :-)",
95+
"These are graceful and engaging mate", "I want to learn this kind of shot! Teach me. ",
96+
"This shot has navigated right into my heart.",
97+
"Immensely thought out! Excellent shot! Ahhhhhhh...",
98+
"Nice use of light in this style dude, and Those icons blew my mind.",
99+
"Button, gradient, boldness, texture – excellent =)",
100+
"Sky blue. I wonder what would have happened if I made this",
101+
"This work has navigated right into my heart.",
102+
"Engaging. It keeps your mind occupied while you wait.",
103+
"Background, hero, experience, colour – incredible :-)",
104+
"Very thought out! I wonder what would have happened if I made this",
105+
"Strong mate I approve the use of layout and lines!", "This is magical work :)",
106+
"Classic animation! Just delightful!", "Nice use of magenta in this shapes!!"
107+
};
108+
private static String[] postedTime = {
109+
"Yesterday", "12 hours ago", "5 hours ago", "2 hours ago", "1 hour ago", "5 minutes ago",
110+
"2 minutes ago", "1 minute ago", "Just now"
111+
};
72112
private final Random random = new Random();
73113

74114
public List<FaqItem> getAccountFaq() {
@@ -81,6 +121,15 @@ public List<FaqItem> getAccountFaq() {
81121
return items;
82122
}
83123

124+
public List<Person> getCast() {
125+
List<Person> items = new ArrayList<>(cast.length);
126+
int i = 0;
127+
for (String name : cast) {
128+
items.add(new Person(name, name.substring(0, 1), castOverline[i++]));
129+
}
130+
return items;
131+
}
132+
84133
public List<ColoredItem> getColoredItems(int count) {
85134
List<ColoredItem> coloredItems = new ArrayList<>(count);
86135
for (int i = 1; i <= count; i++) {
@@ -89,6 +138,20 @@ public List<ColoredItem> getColoredItems(int count) {
89138
return coloredItems;
90139
}
91140

141+
public List<Comment> getComments() {
142+
int totalComments = random.nextInt(10) + 2;
143+
return generateComment(totalComments, 0);
144+
}
145+
146+
public List<Person> getCrew() {
147+
List<Person> items = new ArrayList<>(crew.length);
148+
int i = 0;
149+
for (String name : crew) {
150+
items.add(new Person(name, name.substring(0, 1), crewOverline[i++]));
151+
}
152+
return items;
153+
}
154+
92155
public List<SelectableItem> getLanguages() {
93156
List<SelectableItem> items = new ArrayList<>(languages.length);
94157
for (String language : languages) {
@@ -106,22 +169,14 @@ public List<FaqItem> getMiscFaq() {
106169
return items;
107170
}
108171

109-
public List<MoviePosterItem> getMovies() {
110-
List<MoviePosterItem> textItems = new ArrayList<>(movieNames.length);
111-
for (String movieName : movieNames) {
112-
textItems.add(new MoviePosterItem(movieName, newsColorsList[random.nextInt(9)]));
113-
}
114-
return textItems;
115-
}
116-
117172
public List<NewsItem> getNewsList(boolean isOffline) {
118173
List<NewsItem> numberItems = new ArrayList<>(5);
119174
for (int i = 0; i < 5; i++) {
120175
int newsSource = random.nextInt(2);
121176
numberItems.add(new NewsItem(i, newsSource == 0 ? "Umbrella News" : "Fake News",
122177
newsSource == 0 ? R.drawable.ic_umbrella : R.drawable.ic_fake_news,
123178
Color.parseColor(newsSource == 0 ? "#01CC9D" : "#FE1743"),
124-
newsThumbnails[random.nextInt(2)], newsColorsList[random.nextInt(9)], newsDummyTitles[i],
179+
newsThumbnails[random.nextInt(3)], newsColorsList[random.nextInt(9)], newsDummyTitles[i],
125180
"14-July-2018", isOffline));
126181
}
127182
return numberItems;
@@ -158,6 +213,15 @@ public List<FaqItem> getPaymentFaq() {
158213
return items;
159214
}
160215

216+
public List<Person> getProducers() {
217+
List<Person> items = new ArrayList<>(producer.length);
218+
int i = 0;
219+
for (String name : producer) {
220+
items.add(new Person(name, name.substring(0, 1), producerOverline[i++]));
221+
}
222+
return items;
223+
}
224+
161225
public List<SelectableItem> getTelevisionChannels() {
162226
List<SelectableItem> items = new ArrayList<>(televisions.length);
163227
for (String channel : televisions) {
@@ -189,4 +253,20 @@ public List<SelectableItem> getWebsites() {
189253
}
190254
return items;
191255
}
256+
257+
private List<Comment> generateComment(int count, int level) {
258+
if (level > 7) {
259+
return new ArrayList<>();
260+
}
261+
List<Comment> comments = new ArrayList<>();
262+
for (int i = 0; i < count; i++) {
263+
comments.add(generateComment(level));
264+
}
265+
return comments;
266+
}
267+
268+
private Comment generateComment(int level) {
269+
return new Comment(authors[random.nextInt(8)], comments[random.nextInt(20)],
270+
postedTime[random.nextInt(2) + level], generateComment(random.nextInt(5), level + 1));
271+
}
192272
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package dev.ahamed.mva.sample.data.model;
2+
3+
import java.util.List;
4+
5+
public class Comment {
6+
7+
private final String author;
8+
private final String comment;
9+
private final String postedTime;
10+
private final List<Comment> childComments;
11+
12+
public Comment(String author, String comment, String postedTime, List<Comment> childComments) {
13+
this.author = author;
14+
this.comment = comment;
15+
this.postedTime = postedTime;
16+
this.childComments = childComments;
17+
}
18+
19+
public String getAuthor() {
20+
return author;
21+
}
22+
23+
public List<Comment> getChildComments() {
24+
return childComments;
25+
}
26+
27+
public String getComment() {
28+
return comment;
29+
}
30+
31+
public String getPostedTime() {
32+
return postedTime;
33+
}
34+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package dev.ahamed.mva.sample.data.model;
2+
3+
import android.support.annotation.StringRes;
4+
5+
public class Hint {
6+
7+
private final int description;
8+
9+
public Hint(@StringRes int description) {
10+
this.description = description;
11+
}
12+
13+
public @StringRes int getDescription() {
14+
return description;
15+
}
16+
}

0 commit comments

Comments
 (0)