mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-25 12:32:31 +01:00
Add close() method to NewPipeDatabase
This commit is contained in:
parent
7c3f5a62c5
commit
9ca2691a2c
@ -51,4 +51,15 @@ public final class NewPipeDatabase {
|
|||||||
throw new RuntimeException("Checkpoint was blocked from completing");
|
throw new RuntimeException("Checkpoint was blocked from completing");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void close() {
|
||||||
|
if (databaseInstance != null) {
|
||||||
|
synchronized (NewPipeDatabase.class) {
|
||||||
|
if (databaseInstance != null) {
|
||||||
|
databaseInstance.close();
|
||||||
|
databaseInstance = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ public final class NavigationHelper {
|
|||||||
* @param activity the activity to finish
|
* @param activity the activity to finish
|
||||||
*/
|
*/
|
||||||
public static void restartApp(final Activity activity) {
|
public static void restartApp(final Activity activity) {
|
||||||
NewPipeDatabase.getInstance(activity).close();
|
NewPipeDatabase.close();
|
||||||
activity.finishAffinity();
|
activity.finishAffinity();
|
||||||
final Intent intent = new Intent(activity, MainActivity.class);
|
final Intent intent = new Intent(activity, MainActivity.class);
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
|
Loading…
Reference in New Issue
Block a user