Skip to content

Commit e93443d

Browse files
committed
CATROID-1114: [GSOC21] Room Integration
CATROID-1115: [GSOC21] Save FeaturedProject locally CATROID-1116: [GSOC21] Save ProjectResponse locally
1 parent 936a065 commit e93443d

33 files changed

+3256
-227
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2525

2626
buildscript {
27-
ext.kotlin_version = '1.4.21'
27+
ext.kotlin_version = '1.4.32'
2828
ext.koin_version = '2.1.5'
2929
ext.lifecycle_version = '2.2.0'
3030
ext.jacoco_core_version = '0.8.7'

catroid/build.gradle

+32-5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ ext {
5252
espressoVersion = "3.1.0"
5353
playServicesVersion = "17.0.0"
5454
cameraXVersion = "1.0.0-beta07"
55+
room_version = "2.3.0"
56+
coroutines_version = "1.3.2"
57+
work_manager_version = "2.5.0"
5558
}
5659

5760
apply plugin: 'com.android.application'
@@ -161,6 +164,12 @@ android {
161164
resValue "string", "FEATURE_AI_PREFERENCES_ENABLED", "false"
162165
resValue "string", "SNACKBAR_HINTS_ENABLED", "false"
163166
resValue "string", "DEBUG_MODE", "false"
167+
168+
javaCompileOptions {
169+
annotationProcessorOptions {
170+
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
171+
}
172+
}
164173
}
165174

166175
lintOptions {
@@ -347,7 +356,11 @@ dependencies {
347356

348357
// Kotlin
349358
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
350-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.8'
359+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
360+
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
361+
androidTestImplementation ('androidx.arch.core:core-testing:2.1.0') {
362+
exclude group: 'org.mockito', module: 'mockito-core'
363+
}
351364

352365
// Support libraries
353366
implementation 'androidx.appcompat:appcompat:1.2.0'
@@ -377,22 +390,34 @@ dependencies {
377390
// Glide (Images downloader)
378391
implementation 'com.github.bumptech.glide:glide:4.11.0'
379392

380-
// Shimmer effect
381-
implementation 'com.facebook.shimmer:shimmer:0.5.0'
382-
383393
// Lifecycle
384394
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
385395
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
386396
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
387397

398+
// Room
399+
implementation("androidx.room:room-runtime:$room_version")
400+
kapt("androidx.room:room-compiler:$room_version")
401+
// Kotlin Extensions and Coroutines support for Room
402+
implementation("androidx.room:room-ktx:$room_version")
403+
404+
// WorkManager
405+
implementation "androidx.work:work-runtime-ktx:$work_manager_version"
406+
407+
// Android Debug Database
408+
debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'
409+
410+
// Encrypted shared preferences
411+
implementation("androidx.security:security-crypto:1.0.0")
412+
388413
// CAST
389414
implementation "com.google.android.gms:play-services-cast:$playServicesVersion"
390415

391416
// Analytics
392417
implementation "com.google.android.gms:play-services-analytics:$playServicesVersion"
393418

394419
implementation 'com.google.guava:guava:28.2-android'
395-
implementation 'com.google.code.gson:gson:2.8.0'
420+
implementation 'com.google.code.gson:gson:2.8.7'
396421

397422
implementation 'com.koushikdutta.async:androidasync:2.2.1'
398423
implementation 'com.squareup.picasso:picasso:2.71828'
@@ -481,6 +506,8 @@ dependencies {
481506
androidTestImplementation "androidx.test.espresso:espresso-intents:$espressoVersion"
482507

483508
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
509+
// Room Test helpers
510+
testImplementation("androidx.room:room-testing:$room_version")
484511
}
485512

486513
static def getGitCommitInfo() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"formatVersion": 1,
3+
"database": {
4+
"version": 1,
5+
"identityHash": "0dbcd5b00fefe59860e174c9266dcc79",
6+
"entities": [
7+
{
8+
"tableName": "featured_project",
9+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `project_id` TEXT NOT NULL, `project_url` TEXT NOT NULL, `name` TEXT NOT NULL, `author` TEXT NOT NULL, `featured_image` TEXT NOT NULL, PRIMARY KEY(`id`))",
10+
"fields": [
11+
{
12+
"fieldPath": "id",
13+
"columnName": "id",
14+
"affinity": "TEXT",
15+
"notNull": true
16+
},
17+
{
18+
"fieldPath": "project_id",
19+
"columnName": "project_id",
20+
"affinity": "TEXT",
21+
"notNull": true
22+
},
23+
{
24+
"fieldPath": "project_url",
25+
"columnName": "project_url",
26+
"affinity": "TEXT",
27+
"notNull": true
28+
},
29+
{
30+
"fieldPath": "name",
31+
"columnName": "name",
32+
"affinity": "TEXT",
33+
"notNull": true
34+
},
35+
{
36+
"fieldPath": "author",
37+
"columnName": "author",
38+
"affinity": "TEXT",
39+
"notNull": true
40+
},
41+
{
42+
"fieldPath": "featured_image",
43+
"columnName": "featured_image",
44+
"affinity": "TEXT",
45+
"notNull": true
46+
}
47+
],
48+
"primaryKey": {
49+
"columnNames": [
50+
"id"
51+
],
52+
"autoGenerate": false
53+
},
54+
"indices": [],
55+
"foreignKeys": []
56+
}
57+
],
58+
"views": [],
59+
"setupQueries": [
60+
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
61+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '0dbcd5b00fefe59860e174c9266dcc79')"
62+
]
63+
}
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
{
2+
"formatVersion": 1,
3+
"database": {
4+
"version": 2,
5+
"identityHash": "c60ebf67428479ff4619d56d1eb30d08",
6+
"entities": [
7+
{
8+
"tableName": "featured_project",
9+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `project_id` TEXT NOT NULL, `project_url` TEXT NOT NULL, `name` TEXT NOT NULL, `author` TEXT NOT NULL, `featured_image` TEXT NOT NULL, PRIMARY KEY(`id`))",
10+
"fields": [
11+
{
12+
"fieldPath": "id",
13+
"columnName": "id",
14+
"affinity": "TEXT",
15+
"notNull": true
16+
},
17+
{
18+
"fieldPath": "project_id",
19+
"columnName": "project_id",
20+
"affinity": "TEXT",
21+
"notNull": true
22+
},
23+
{
24+
"fieldPath": "project_url",
25+
"columnName": "project_url",
26+
"affinity": "TEXT",
27+
"notNull": true
28+
},
29+
{
30+
"fieldPath": "name",
31+
"columnName": "name",
32+
"affinity": "TEXT",
33+
"notNull": true
34+
},
35+
{
36+
"fieldPath": "author",
37+
"columnName": "author",
38+
"affinity": "TEXT",
39+
"notNull": true
40+
},
41+
{
42+
"fieldPath": "featured_image",
43+
"columnName": "featured_image",
44+
"affinity": "TEXT",
45+
"notNull": true
46+
}
47+
],
48+
"primaryKey": {
49+
"columnNames": [
50+
"id"
51+
],
52+
"autoGenerate": false
53+
},
54+
"indices": [],
55+
"foreignKeys": []
56+
},
57+
{
58+
"tableName": "project_category",
59+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`type` TEXT NOT NULL, `name` TEXT NOT NULL, PRIMARY KEY(`type`))",
60+
"fields": [
61+
{
62+
"fieldPath": "type",
63+
"columnName": "type",
64+
"affinity": "TEXT",
65+
"notNull": true
66+
},
67+
{
68+
"fieldPath": "name",
69+
"columnName": "name",
70+
"affinity": "TEXT",
71+
"notNull": true
72+
}
73+
],
74+
"primaryKey": {
75+
"columnNames": [
76+
"type"
77+
],
78+
"autoGenerate": false
79+
},
80+
"indices": [],
81+
"foreignKeys": []
82+
},
83+
{
84+
"tableName": "project_response",
85+
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `author` TEXT NOT NULL, `description` TEXT NOT NULL, `version` TEXT NOT NULL, `views` INTEGER NOT NULL, `download` INTEGER NOT NULL, `flavor` TEXT NOT NULL, `tags` TEXT NOT NULL, `uploaded` INTEGER NOT NULL, `uploadedString` TEXT NOT NULL, `screenshotLarge` TEXT NOT NULL, `screenshotSmall` TEXT NOT NULL, `projectUrl` TEXT NOT NULL, `downloadUrl` TEXT NOT NULL, `fileSize` REAL NOT NULL, `categoryType` TEXT NOT NULL, PRIMARY KEY(`id`, `categoryType`))",
86+
"fields": [
87+
{
88+
"fieldPath": "id",
89+
"columnName": "id",
90+
"affinity": "TEXT",
91+
"notNull": true
92+
},
93+
{
94+
"fieldPath": "name",
95+
"columnName": "name",
96+
"affinity": "TEXT",
97+
"notNull": true
98+
},
99+
{
100+
"fieldPath": "author",
101+
"columnName": "author",
102+
"affinity": "TEXT",
103+
"notNull": true
104+
},
105+
{
106+
"fieldPath": "description",
107+
"columnName": "description",
108+
"affinity": "TEXT",
109+
"notNull": true
110+
},
111+
{
112+
"fieldPath": "version",
113+
"columnName": "version",
114+
"affinity": "TEXT",
115+
"notNull": true
116+
},
117+
{
118+
"fieldPath": "views",
119+
"columnName": "views",
120+
"affinity": "INTEGER",
121+
"notNull": true
122+
},
123+
{
124+
"fieldPath": "download",
125+
"columnName": "download",
126+
"affinity": "INTEGER",
127+
"notNull": true
128+
},
129+
{
130+
"fieldPath": "flavor",
131+
"columnName": "flavor",
132+
"affinity": "TEXT",
133+
"notNull": true
134+
},
135+
{
136+
"fieldPath": "tags",
137+
"columnName": "tags",
138+
"affinity": "TEXT",
139+
"notNull": true
140+
},
141+
{
142+
"fieldPath": "uploaded",
143+
"columnName": "uploaded",
144+
"affinity": "INTEGER",
145+
"notNull": true
146+
},
147+
{
148+
"fieldPath": "uploadedString",
149+
"columnName": "uploadedString",
150+
"affinity": "TEXT",
151+
"notNull": true
152+
},
153+
{
154+
"fieldPath": "screenshotLarge",
155+
"columnName": "screenshotLarge",
156+
"affinity": "TEXT",
157+
"notNull": true
158+
},
159+
{
160+
"fieldPath": "screenshotSmall",
161+
"columnName": "screenshotSmall",
162+
"affinity": "TEXT",
163+
"notNull": true
164+
},
165+
{
166+
"fieldPath": "projectUrl",
167+
"columnName": "projectUrl",
168+
"affinity": "TEXT",
169+
"notNull": true
170+
},
171+
{
172+
"fieldPath": "downloadUrl",
173+
"columnName": "downloadUrl",
174+
"affinity": "TEXT",
175+
"notNull": true
176+
},
177+
{
178+
"fieldPath": "fileSize",
179+
"columnName": "fileSize",
180+
"affinity": "REAL",
181+
"notNull": true
182+
},
183+
{
184+
"fieldPath": "categoryType",
185+
"columnName": "categoryType",
186+
"affinity": "TEXT",
187+
"notNull": true
188+
}
189+
],
190+
"primaryKey": {
191+
"columnNames": [
192+
"id",
193+
"categoryType"
194+
],
195+
"autoGenerate": false
196+
},
197+
"indices": [],
198+
"foreignKeys": []
199+
}
200+
],
201+
"views": [],
202+
"setupQueries": [
203+
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
204+
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'c60ebf67428479ff4619d56d1eb30d08')"
205+
]
206+
}
207+
}

0 commit comments

Comments
 (0)