Skip to content

Commit c16ad71

Browse files
committed
FIX restart app
1 parent 0b6b618 commit c16ad71

File tree

5 files changed

+21
-15
lines changed

5 files changed

+21
-15
lines changed

app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ android {
5151
dependencies {
5252
implementation fileTree(dir: "libs", include: ["*.jar"])
5353
implementation 'androidx.core:core-ktx:1.9.0'
54-
implementation 'androidx.appcompat:appcompat:1.5.1'
54+
implementation 'androidx.appcompat:appcompat:1.6.0'
5555
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
5656
implementation project(path: ':core')
5757
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
5858
testImplementation 'junit:junit:4.13.2'
59-
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
60-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
59+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
60+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
6161

6262
//ROOM SQLite
63-
def room_version = "2.4.3"
63+
def room_version = "2.5.0"
6464

6565
implementation "androidx.room:room-runtime:$room_version"
6666
kapt "androidx.room:room-compiler:$room_version"
@@ -84,6 +84,6 @@ dependencies {
8484
implementation 'androidx.recyclerview:recyclerview:1.2.1'
8585

8686
//Material Design Implementation
87-
implementation 'com.google.android.material:material:1.7.0'
87+
implementation 'com.google.android.material:material:1.8.0'
8888

8989
}

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
3-
ext.kotlin_version = '1.7.10'
3+
ext.kotlin_version = '1.8.0'
44
repositories {
55
google()
66
mavenCentral()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.3.1'
9+
classpath 'com.android.tools.build:gradle:7.4.1'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111

1212
// NOTE: Do not place your application dependencies here; they belong

core/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
6262
dependencies {
6363
implementation fileTree(dir: "libs", include: ["*.jar"])
6464
implementation 'androidx.core:core-ktx:1.9.0'
65-
implementation 'androidx.appcompat:appcompat:1.5.1'
65+
implementation 'androidx.appcompat:appcompat:1.6.0'
6666
testImplementation 'junit:junit:4.13.2'
67-
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
68-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
67+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
68+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
6969

7070
//ROOM SQLite
71-
def room_version = "2.4.3"
71+
def room_version = "2.5.0"
7272

7373
implementation "androidx.room:room-runtime:$room_version"
7474
kapt "androidx.room:room-compiler:$room_version"
@@ -86,10 +86,10 @@ dependencies {
8686
testImplementation "androidx.room:room-testing:$room_version"
8787

8888
//Material Design Implementation
89-
implementation 'com.google.android.material:material:1.6.1'
89+
implementation 'com.google.android.material:material:1.8.0'
9090

9191
//Androidx Security
92-
implementation "androidx.security:security-crypto:1.1.0-alpha03"
92+
implementation "androidx.security:security-crypto:1.1.0-alpha04"
9393

9494
//Google Guava
9595
implementation 'com.google.guava:guava:31.0.1-jre'

core/src/main/java/de/raphaelebner/roomdatabasebackup/core/RoomBackup.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,11 @@ class RoomBackup(var context: Context) : FragmentActivity() {
331331
*/
332332
private fun restartApp() {
333333
restartIntent!!.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
334+
context.startActivity(restartIntent)
334335
if (context is Activity) {
335336
(context as Activity).finish()
336337
}
337-
context.startActivity(restartIntent)
338+
Runtime.getRuntime().exit(0)
338339
}
339340

340341
/**
@@ -386,6 +387,7 @@ class RoomBackup(var context: Context) : FragmentActivity() {
386387
private fun doBackup(destination: File) {
387388
//Close the database
388389
roomDatabase!!.close()
390+
roomDatabase = null
389391
if (backupIsEncrypted) {
390392
val encryptedBytes = encryptBackup() ?: return
391393
val bos = BufferedOutputStream(FileOutputStream(destination, false))
@@ -415,6 +417,7 @@ class RoomBackup(var context: Context) : FragmentActivity() {
415417
private fun doBackup(destination: OutputStream) {
416418
//Close the database
417419
roomDatabase!!.close()
420+
roomDatabase = null
418421
if (backupIsEncrypted) {
419422
val encryptedBytes = encryptBackup() ?: return
420423
destination.write(encryptedBytes)
@@ -561,6 +564,7 @@ class RoomBackup(var context: Context) : FragmentActivity() {
561564
private fun doRestore(source: File) {
562565
//Close the database
563566
roomDatabase!!.close()
567+
roomDatabase = null
564568
val fileExtension = source.extension
565569
if (backupIsEncrypted) {
566570
copy(source, TEMP_BACKUP_FILE)
@@ -608,6 +612,7 @@ class RoomBackup(var context: Context) : FragmentActivity() {
608612

609613
//Close the database if decryption is succesfull
610614
roomDatabase!!.close()
615+
roomDatabase = null
611616

612617
val bos = BufferedOutputStream(FileOutputStream(DATABASE_FILE, false))
613618
bos.write(decryptedBytes)
@@ -616,6 +621,7 @@ class RoomBackup(var context: Context) : FragmentActivity() {
616621
} else {
617622
//Close the database
618623
roomDatabase!!.close()
624+
roomDatabase = null
619625

620626
//Copy back database and replace current database
621627
source.use { input ->

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

0 commit comments

Comments
 (0)