Skip to content

Commit

Permalink
Remove Realm related classes from project
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilJay committed Jun 27, 2016
1 parent da6ded7 commit a233e38
Show file tree
Hide file tree
Showing 28 changed files with 42 additions and 2,287 deletions.
2 changes: 1 addition & 1 deletion MPChartExample/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:versionName="3.0.0" >

<uses-sdk
android:minSdkVersion="8"
android:minSdkVersion="16"

This comment has been minimized.

Copy link
@danielgindi

danielgindi Aug 5, 2016

Collaborator

I think we should keep the SDK version as low as before. People may still be using it like this...
If we have an optional dependency that has a higher SDK version, we could just tell Gradle to ignore it...

This comment has been minimized.

Copy link
@PhilJay

PhilJay Aug 5, 2016

Author Owner

Yep min SDK for the library is still 9, just the example project needs level 16 for the MPAndroidChart-Realm dependency, which needs level 16 because of the Realm dependency (since v1.0)

android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Expand Down
7 changes: 4 additions & 3 deletions MPChartExample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
apply plugin: 'com.android.application'
apply plugin: 'realm-android'

android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 8
minSdkVersion 16
targetSdkVersion 23
versionCode 52
versionName '3.0.0'
Expand Down Expand Up @@ -54,8 +55,8 @@ repositories {

dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':MPChartLib') // remove this if you only imported the example project
compile project(':MPChartLib-Realm')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'io.realm:realm-android:0.87.5' // dependency for realm-database API (http://realm.io)
//compile 'io.realm:realm-android:0.87.5' // dependency for realm-database API (http://realm.io)
//compile 'com.github.PhilJay:MPAndroidChart:v2.2.5'
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,11 @@ protected void styleData(ChartData data) {
protected void onResume() {
super.onResume();

RealmConfiguration config = new RealmConfiguration.Builder(this)
.name("myrealm.realm")
.build();
// Create a RealmConfiguration that saves the Realm file in the app's "files" directory.
RealmConfiguration realmConfig = new RealmConfiguration.Builder(getApplicationContext()).build();
Realm.setDefaultConfiguration(realmConfig);

Realm.deleteRealm(config);

Realm.setDefaultConfiguration(config);

mRealm = Realm.getInstance(config);
mRealm = Realm.getDefaultInstance();
}

@Override
Expand All @@ -104,7 +100,7 @@ protected void writeToDB(int objectCount) {

mRealm.beginTransaction();

mRealm.clear(RealmDemoData.class);
mRealm.delete(RealmDemoData.class);

for (int i = 0; i < objectCount; i++) {

Expand All @@ -121,7 +117,7 @@ protected void writeToDBStack(int objectCount) {

mRealm.beginTransaction();

mRealm.clear(RealmDemoData.class);
mRealm.delete(RealmDemoData.class);

for (int i = 0; i < objectCount; i++) {

Expand All @@ -140,7 +136,7 @@ protected void writeToDBCandle(int objectCount) {

mRealm.beginTransaction();

mRealm.clear(RealmDemoData.class);
mRealm.delete(RealmDemoData.class);

for (int i = 0; i < objectCount; i++) {

Expand Down Expand Up @@ -168,7 +164,7 @@ protected void writeToDBBubble(int objectCount) {

mRealm.beginTransaction();

mRealm.clear(RealmDemoData.class);
mRealm.delete(RealmDemoData.class);

for (int i = 0; i < objectCount; i++) {

Expand All @@ -186,7 +182,7 @@ protected void writeToDBPie() {

mRealm.beginTransaction();

mRealm.clear(RealmDemoData.class);
mRealm.delete(RealmDemoData.class);

float value1 = 15f + (float) (Math.random() * 8f);
float value2 = 15f + (float) (Math.random() * 8f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void onResume() {

private void setData() {

RealmResults<RealmDemoData> result = mRealm.allObjects(RealmDemoData.class);
RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();

//RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "stackValues", "xIndex"); // normal entries
RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "xValue", "yValue"); // stacked entries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected void onResume() {

private void setData() {

RealmResults<RealmDemoData> result = mRealm.allObjects(RealmDemoData.class);
RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();

RealmBubbleDataSet<RealmDemoData> set = new RealmBubbleDataSet<RealmDemoData>(result, "xValue", "yValue", "bubbleSize");
set.setLabel("Realm BubbleDataSet");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected void onResume() {

private void setData() {

RealmResults<RealmDemoData> result = mRealm.allObjects(RealmDemoData.class);
RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();

RealmCandleDataSet<RealmDemoData> set = new RealmCandleDataSet<RealmDemoData>(result, "xValue", "high", "low", "open", "close");
set.setLabel("Realm CandleDataSet");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected void onResume() {

private void setData() {

RealmResults<RealmDemoData> result = mRealm.allObjects(RealmDemoData.class);
RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();

//RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "stackValues", "xIndex"); // normal entries
RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "xValue", "stackValues", "floatValue"); // stacked entries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected void onResume() {

private void setData() {

RealmResults<RealmDemoData> result = mRealm.allObjects(RealmDemoData.class);
RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();

RealmLineDataSet<RealmDemoData> set = new RealmLineDataSet<RealmDemoData>(result, "xValue", "yValue");
set.setDrawCubic(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected void onResume() {

private void setData() {

RealmResults<RealmDemoData> result = mRealm.allObjects(RealmDemoData.class);
RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();

//RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "stackValues", "xIndex"); // normal entries
RealmPieDataSet<RealmDemoData> set = new RealmPieDataSet<RealmDemoData>(result, "yValue", "label"); // stacked entries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ protected void onResume() {

private void setData() {

RealmResults<RealmDemoData> result = mRealm.allObjects(RealmDemoData.class);
RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();

//RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "stackValues", "xIndex"); // normal entries
RealmRadarDataSet<RealmDemoData> set = new RealmRadarDataSet<RealmDemoData>(result, "xValue", "yValue"); // stacked entries
RealmRadarDataSet<RealmDemoData> set = new RealmRadarDataSet<RealmDemoData>(result, "yValue"); // stacked entries
set.setLabel("Realm RadarDataSet");
set.setDrawFilled(true);
set.setColor(ColorTemplate.rgb("#009688"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected void onResume() {

private void setData() {

RealmResults<RealmDemoData> result = mRealm.allObjects(RealmDemoData.class);
RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();

RealmScatterDataSet<RealmDemoData> set = new RealmScatterDataSet<RealmDemoData>(result, "xValue", "yValue");
set.setLabel("Realm ScatterDataSet");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

import java.util.ArrayList;

import io.realm.Realm;
import io.realm.RealmConfiguration;

/**
* Created by Philipp Jahoda on 07/12/15.
*/
Expand Down Expand Up @@ -52,6 +55,15 @@ protected void onCreate(Bundle savedInstanceState) {
lv.setAdapter(adapter);

lv.setOnItemClickListener(this);

// Create a RealmConfiguration that saves the Realm file in the app's "files" directory.
RealmConfiguration realmConfig = new RealmConfiguration.Builder(getApplicationContext()).build();
Realm.setDefaultConfiguration(realmConfig);

Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
realm.deleteAll();
realm.commitTransaction();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected void onResume() {
private void setData() {

// LINE-CHART
final RealmResults<Score> results = mRealm.allObjects(Score.class);
final RealmResults<Score> results = mRealm.where(Score.class).findAll();


AxisValueFormatter formatter = new AxisValueFormatter() {
Expand Down
6 changes: 3 additions & 3 deletions MPChartLib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'com.github.dcendents.android-maven'
//apply plugin: 'com.github.dcendents.android-maven'
//apply plugin: 'realm-android'

android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
// resourcePrefix 'mpcht'
defaultConfig {
minSdkVersion 8
minSdkVersion 9
targetSdkVersion 23
versionCode 3
versionName '3.0.0'
Expand Down Expand Up @@ -36,7 +36,7 @@ repositories {
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:support-v4:19.+'
provided 'io.realm:realm-android:0.87.5' // "optional" dependency to realm-database API
//provided 'io.realm:realm-android:0.87.5' // "optional" dependency to realm-database API
testCompile 'junit:junit:4.12'
testCompile "org.mockito:mockito-core:1.9.5"
}
Expand Down

This file was deleted.

Loading

0 comments on commit a233e38

Please sign in to comment.