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

Commit b4a668f

Browse files
author
florent champigny
committed
Freezer.onCreate is no longer dynamic
1 parent 5427c73 commit b4a668f

File tree

11 files changed

+247
-107
lines changed

11 files changed

+247
-107
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ buildscript {
1818
apply plugin: 'com.neenbedankt.android-apt'
1919

2020
dependencies {
21-
compile 'fr.xebia.android.freezer:freezer:2.0.2'
22-
provided 'fr.xebia.android.freezer:freezer-annotations:2.0.2'
23-
apt 'fr.xebia.android.freezer:freezer-compiler:2.0.2'
21+
compile 'fr.xebia.android.freezer:freezer:2.0.3'
22+
provided 'fr.xebia.android.freezer:freezer-annotations:2.0.3'
23+
apt 'fr.xebia.android.freezer:freezer-compiler:2.0.3'
2424
}
2525
```
2626

@@ -351,6 +351,10 @@ Introduced Migration Engine.
351351
352352
- Added query.in(...values...)
353353
354+
## 2.0.3
355+
356+
- Freezer.onCreate is no longer dynamic
357+
354358
#A project initiated by Xebia
355359
356360
This project was first developed by Xebia and has been open-sourced since. We will continue working on it.

app/src/main/java/com/github/florent37/orm/DatabaseMigration.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
package com.github.florent37.orm;
22

33
import fr.xebia.android.freezer.annotations.Migration;
4-
import fr.xebia.android.freezer.migration.ColumnType;
54
import fr.xebia.android.freezer.migration.Migrator;
65

76
/**
87
* Created by florentchampigny on 28/01/2016.
98
*/
109
public class DatabaseMigration {
1110

12-
//@Migration(2)
13-
//public static void migrateTo2(Migrator migrator) {
14-
// migrator.update("User")
15-
// .removeField("age")
16-
// .renameTo("Man");
17-
//}
11+
@Migration(2)
12+
public static void migrateTo2(Migrator migrator) {
13+
//migrator.update("User")
14+
// .removeField("age")
15+
// .renameTo("Man");
16+
}
1817

1918
//@Migration(3)
2019
//public static void migrateTo3(Migrator migrator) {

app/src/main/java/com/github/florent37/orm/MyApplication.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ public class MyApplication extends Application {
1111

1212
@Override public void onCreate() {
1313
super.onCreate();
14-
Freezer.getInstance().onCreate(this);
14+
Freezer.onCreate(this);
1515
}
1616

17-
@Override public void onTerminate() {
18-
super.onTerminate();
19-
Freezer.getInstance().onDestroy();
20-
}
2117
}
Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
package com.github.florent37.orm.model;
22

3+
import android.os.Parcel;
4+
import android.os.Parcelable;
5+
36
import fr.xebia.android.freezer.annotations.Model;
47

58
/**
69
* Created by florentchampigny on 21/01/2016.
710
*/
811
@Model
9-
public class Dog {
12+
public class Dog implements Parcelable {
13+
public static final Creator<Dog> CREATOR = new Creator<Dog>() {
14+
@Override
15+
public Dog createFromParcel(Parcel in) {
16+
return new Dog(in);
17+
}
18+
19+
@Override
20+
public Dog[] newArray(int size) {
21+
return new Dog[size];
22+
}
23+
};
1024
String name;
1125

1226
public Dog(){}
@@ -15,11 +29,25 @@ public Dog(String name) {
1529
this.name = name;
1630
}
1731

18-
public void setName(String name) {
19-
this.name = name;
32+
protected Dog(Parcel in) {
33+
name = in.readString();
2034
}
2135

2236
public String getName() {
2337
return name;
2438
}
39+
40+
public void setName(String name) {
41+
this.name = name;
42+
}
43+
44+
@Override
45+
public int describeContents() {
46+
return 0;
47+
}
48+
49+
@Override
50+
public void writeToParcel(Parcel dest, int flags) {
51+
dest.writeString(name);
52+
}
2553
}

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ buildscript {
1818
ext{
1919
COMPILE_SDK=23
2020
TARGET_SDK=23
21-
BUILD_TOOL="23.0.2"
21+
BUILD_TOOL = "23.0.3"
2222
minSdkVersion = 14
2323
sourceCompatibilityVersion = JavaVersion.VERSION_1_7
2424
targetCompatibilityVersion = JavaVersion.VERSION_1_7
2525

26-
libraryVersion = "2.0.2"
26+
libraryVersion = "2.0.3"
2727
}
2828

2929
allprojects {

freezer-compiler/src/main/java/fr/xebia/android/freezer/Constants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,6 @@ public class Constants {
8181
public static final ClassName entityProxyClass = ClassName.bestGuess(entityProxyClassString);
8282

8383
public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
84+
85+
public static final String PARCEL_CREATOR = "CREATOR";
8486
}

0 commit comments

Comments
 (0)