Skip to content

Commit 30cb069

Browse files
committed
Brought back the Realm demos, were removed by mistake
1 parent 86d05e9 commit 30cb069

18 files changed

Lines changed: 1352 additions & 2 deletions

MPChartExample/AndroidManifest.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,22 @@
4747
<activity android:name="RadarChartActivitry"></activity>
4848
<activity android:name="LineChartActivityColored"></activity>
4949
<activity android:name="DynamicalAddingActivity"></activity>
50+
<activity android:name=".realm.RealmDatabaseActivityLine"></activity>
51+
<activity android:name=".realm.RealmDatabaseActivityBar"></activity>
52+
<activity android:name=".realm.RealmDatabaseActivityHorizontalBar"></activity>
53+
<activity android:name=".realm.RealmDatabaseActivityScatter"></activity>
54+
<activity android:name=".realm.RealmDatabaseActivityCandle"></activity>
55+
<activity android:name=".realm.RealmDatabaseActivityBubble"></activity>
56+
<activity android:name=".realm.RealmDatabaseActivityPie"></activity>
57+
<activity android:name=".realm.RealmDatabaseActivityRadar"></activity>
58+
<activity android:name=".realm.RealmMainActivity"></activity>
5059
<activity android:name="RealtimeLineChartActivity"></activity>
5160
<activity android:name="CombinedChartActivity"></activity>
5261
<activity android:name="PerformanceLineChart"></activity>
5362
<activity android:name="BarChartActivitySinus"></activity>
5463
<activity android:name="ScrollViewActivity"></activity>
5564
<activity android:name="StackedBarActivityNegative"></activity>
65+
<activity android:name=".realm.RealmWikiExample"></activity>
5666
<activity android:name=".BarChartPositiveNegative"></activity>
5767
<activity android:name=".FilledLineActivity"></activity>
5868
<activity android:name=".HalfPieChartActivity"></activity>

MPChartExample/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apply plugin: 'com.android.application'
2-
//apply plugin: 'realm-android'
2+
apply plugin: 'realm-android'
33

44
android {
55
compileSdkVersion 23
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
package com.xxmassdeveloper.mpchartexample.custom;
2+
3+
4+
import io.realm.RealmList;
5+
import io.realm.RealmObject;
6+
7+
/**
8+
* Demo class that encapsulates data stored in realm.io database.
9+
* This class represents data suitable for all chart-types.
10+
*/
11+
public class RealmDemoData extends RealmObject {
12+
13+
private float yValue;
14+
private float xValue;
15+
16+
private float open, close, high, low;
17+
18+
private float bubbleSize;
19+
20+
private RealmList<RealmFloat> stackValues;
21+
22+
private String someStringField;
23+
24+
/**
25+
* label for pie entries
26+
*/
27+
private String label;
28+
29+
// ofc there could me more fields here...
30+
31+
public RealmDemoData() {
32+
33+
}
34+
35+
public RealmDemoData(float yValue) {
36+
this.yValue = yValue;
37+
}
38+
39+
public RealmDemoData(float xValue, float yValue) {
40+
this.xValue = xValue;
41+
this.yValue = yValue;
42+
}
43+
44+
/**
45+
* Constructor for stacked bars.
46+
*
47+
* @param xValue
48+
* @param stackValues
49+
*/
50+
public RealmDemoData(float xValue, float[] stackValues) {
51+
this.xValue = xValue;
52+
this.stackValues = new RealmList<RealmFloat>();
53+
54+
for (float val : stackValues) {
55+
this.stackValues.add(new RealmFloat(val));
56+
}
57+
}
58+
59+
/**
60+
* Constructor for candles.
61+
*
62+
* @param xValue
63+
* @param high
64+
* @param low
65+
* @param open
66+
* @param close
67+
*/
68+
public RealmDemoData(float xValue, float high, float low, float open, float close) {
69+
this.yValue = (high + low) / 2f;
70+
this.high = high;
71+
this.low = low;
72+
this.open = open;
73+
this.close = close;
74+
this.xValue = xValue;
75+
}
76+
77+
/**
78+
* Constructor for bubbles.
79+
*
80+
* @param xValue
81+
* @param yValue
82+
* @param bubbleSize
83+
*/
84+
public RealmDemoData(float xValue, float yValue, float bubbleSize) {
85+
this.xValue = xValue;
86+
this.yValue = yValue;
87+
this.bubbleSize = bubbleSize;
88+
}
89+
90+
/**
91+
* Constructor for pie chart.
92+
*
93+
* @param yValue
94+
* @param label
95+
*/
96+
public RealmDemoData(float yValue, String label) {
97+
this.yValue = yValue;
98+
this.label = label;
99+
}
100+
101+
public float getyValue() {
102+
return yValue;
103+
}
104+
105+
public void setyValue(float yValue) {
106+
this.yValue = yValue;
107+
}
108+
109+
public float getxValue() {
110+
return xValue;
111+
}
112+
113+
public void setxValue(float xValue) {
114+
this.xValue = xValue;
115+
}
116+
117+
public RealmList<RealmFloat> getStackValues() {
118+
return stackValues;
119+
}
120+
121+
public void setStackValues(RealmList<RealmFloat> stackValues) {
122+
this.stackValues = stackValues;
123+
}
124+
125+
public float getOpen() {
126+
return open;
127+
}
128+
129+
public void setOpen(float open) {
130+
this.open = open;
131+
}
132+
133+
public float getClose() {
134+
return close;
135+
}
136+
137+
public void setClose(float close) {
138+
this.close = close;
139+
}
140+
141+
public float getHigh() {
142+
return high;
143+
}
144+
145+
public void setHigh(float high) {
146+
this.high = high;
147+
}
148+
149+
public float getLow() {
150+
return low;
151+
}
152+
153+
public void setLow(float low) {
154+
this.low = low;
155+
}
156+
157+
public float getBubbleSize() {
158+
return bubbleSize;
159+
}
160+
161+
public void setBubbleSize(float bubbleSize) {
162+
this.bubbleSize = bubbleSize;
163+
}
164+
165+
public String getSomeStringField() {
166+
return someStringField;
167+
}
168+
169+
public void setSomeStringField(String someStringField) {
170+
this.someStringField = someStringField;
171+
}
172+
173+
public String getLabel() {
174+
return label;
175+
}
176+
177+
public void setLabel(String label) {
178+
this.label = label;
179+
}
180+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.xxmassdeveloper.mpchartexample.custom;
2+
3+
import io.realm.RealmObject;
4+
5+
/**
6+
* Created by Philipp Jahoda on 09/11/15.
7+
*/
8+
public class RealmFloat extends RealmObject {
9+
10+
private float floatValue;
11+
12+
public RealmFloat() {
13+
14+
}
15+
16+
public RealmFloat(float floatValue) {
17+
this.floatValue = floatValue;
18+
}
19+
20+
public float getFloatValue() {
21+
return floatValue;
22+
}
23+
24+
public void setFloatValue(float value) {
25+
this.floatValue = value;
26+
}
27+
}

MPChartExample/src/com/xxmassdeveloper/mpchartexample/notimportant/MainActivity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import com.xxmassdeveloper.mpchartexample.StackedBarActivity;
4747
import com.xxmassdeveloper.mpchartexample.StackedBarActivityNegative;
4848
import com.xxmassdeveloper.mpchartexample.fragments.SimpleChartDemo;
49+
import com.xxmassdeveloper.mpchartexample.realm.RealmMainActivity;
4950

5051
import java.util.ArrayList;
5152

@@ -130,6 +131,10 @@ protected void onCreate(Bundle savedInstanceState) {
130131
"BarChart positive / negative",
131132
"This demonstrates how to create a BarChart with positive and negative values in different colors."));
132133

134+
ContentItem realm = new ContentItem(
135+
"Realm.io Database",
136+
"This demonstrates how to use this library with Realm.io mobile database.");
137+
objects.add(realm);
133138

134139
ContentItem time = new ContentItem(
135140
"Time Chart",
@@ -269,6 +274,10 @@ public void onItemClick(AdapterView<?> av, View v, int pos, long arg3) {
269274
i = new Intent(this, BarChartPositiveNegative.class);
270275
startActivity(i);
271276
break;
277+
case 28:
278+
i = new Intent(this, RealmMainActivity.class);
279+
startActivity(i);
280+
break;
272281
case 29:
273282
i = new Intent(this, LineChartTime.class);
274283
startActivity(i);

0 commit comments

Comments
 (0)