Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Commit

Permalink
🆙 Realm 2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Oct 16, 2016
1 parent 1eaed3f commit 892be8a
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 22 deletions.
7 changes: 4 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ In your module `build.gradle` file, add the Kolumbus dependency:

```gradle
dependencies {
compile 'com.github.MGaetan89.Kolumbus:kolumbus:v0.8'
compile 'com.github.MGaetan89.Kolumbus:kolumbus:v0.9'
}
```

If you only want to use Kolumbus in your debug build, you can use the following configuration instead:

```gradle
dependencies {
debugCompile 'com.github.MGaetan89.Kolumbus:kolumbus:v0.8'
releaseCompile 'com.github.MGaetan89.Kolumbus:kolumbus-no-op:v0.8'
debugCompile 'com.github.MGaetan89.Kolumbus:kolumbus:v0.9'
releaseCompile 'com.github.MGaetan89.Kolumbus:kolumbus-no-op:v0.9'
}
```

Expand Down Expand Up @@ -154,6 +154,7 @@ The following table presents the compatibility matrix between Kolumbus versions

| Kolumbus version | Realm version |
| ----- | ----- |
| SNAPSHOT | 2.0.0 - 2.0.2 |
| 0.9 | 1.0.0 - 1.0.1 |
| 0.7 - 0.8 | 0.89.0 - 1.0.0 |
| 0.5 - 0.6 | 0.88.0 - 0.88.3 |
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/kotlin/io/kolumbus/demo/AppModule.kt

This file was deleted.

12 changes: 5 additions & 7 deletions app/src/main/kotlin/io/kolumbus/demo/DemoActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package io.kolumbus.demo
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import io.kolumbus.Kolumbus
import io.kolumbus.KolumbusModule
import io.kolumbus.demo.model.Category
import io.kolumbus.demo.model.Product
import io.realm.Realm
Expand All @@ -19,9 +18,10 @@ class DemoActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

val realmConfiguration = RealmConfiguration.Builder(this)
Realm.init(this)

val realmConfiguration = RealmConfiguration.Builder()
.deleteRealmIfMigrationNeeded()
.modules(AppModule(), KolumbusModule())
.build()
Realm.setDefaultConfiguration(realmConfiguration)

Expand All @@ -41,15 +41,14 @@ class DemoActivity : AppCompatActivity() {
val productsCount = this.where(Product::class.java).count()

for (i in 1..CATEGORIES_COUNT) {
with(createObject(Category::class.java)) {
with(createObject(Category::class.java, (categoriesCount + i).toInt())) {
color = random.nextColor()
id = (categoriesCount + i).toInt()
name = "Category $id"
}
}

for (i in 1..PRODUCTS_COUNT) {
with(createObject(Product::class.java)) {
with(createObject(Product::class.java, (productsCount + i).toInt())) {
categories = RealmList<Category>()

for (j in 0..(random.nextInt(MAX_LINKED_CATEGORIES) - 1)) {
Expand All @@ -61,7 +60,6 @@ class DemoActivity : AppCompatActivity() {
}

description = "<b>Lorem ipsum</b> dolor sit amet, <i>consectetur adipiscing</i> elit. <b><u>Maecenas mollis</u></b> eget nibh et condimentum."
id = (productsCount + i).toInt()
name = "Product $id"
}
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'io.realm:realm-gradle-plugin:1.0.1'
classpath 'io.realm:realm-gradle-plugin:2.0.2'
classpath 'org.jacoco:org.jacoco.core:0.7.7.201606060606'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.4'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.6.3'
Expand Down
23 changes: 23 additions & 0 deletions kolumbus-no-op/src/main/kotlin/io/kolumbus/KolumbusModel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (C) 2016 MGaetan89
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.kolumbus

import io.realm.RealmObject

open class KolumbusModel : RealmObject() {
open var id = 0
}
3 changes: 1 addition & 2 deletions kolumbus-no-op/src/main/kotlin/io/kolumbus/KolumbusModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
* limitations under the License.
*/


package io.kolumbus

import io.realm.annotations.RealmModule

@RealmModule(library = true, allClasses = true)
@RealmModule(library = true, classes = arrayOf(KolumbusModel::class))
class KolumbusModule {
}
23 changes: 23 additions & 0 deletions kolumbus/src/main/kotlin/io/kolumbus/KolumbusModel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (C) 2016 MGaetan89
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.kolumbus

import io.realm.RealmObject

open class KolumbusModel : RealmObject() {
open var int = 0
}
2 changes: 1 addition & 1 deletion kolumbus/src/main/kotlin/io/kolumbus/KolumbusModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ package io.kolumbus

import io.realm.annotations.RealmModule

@RealmModule(library = true, allClasses = true)
@RealmModule(library = true, classes = arrayOf(KolumbusModel::class))
class KolumbusModule {
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ class TableActivity : AppCompatActivity(), RealmChangeListener<RealmResults<Real

override fun onStop() {
if (this.entries is RealmResults<*>) {
(this.entries as RealmResults<*>).removeChangeListeners()
val entries = this.entries as RealmResults<*>

if (entries.isValid) {
entries.removeChangeListeners()
}
}

this.realm.close()
Expand Down

0 comments on commit 892be8a

Please sign in to comment.