mirror of
https://github.com/MaintainTeam/LastPipeBender.git
synced 2025-03-04 15:28:21 +03:00
-Added UI to create playlist from service player activity. -Added state saving to playlist dialogs. -Removed access to history activity on service player activity. -Made StreamEntity serializable.
41 lines
1.1 KiB
Java
41 lines
1.1 KiB
Java
package org.schabi.newpipe;
|
|
|
|
import android.arch.persistence.room.Room;
|
|
import android.content.Context;
|
|
import android.support.annotation.NonNull;
|
|
|
|
import org.schabi.newpipe.database.AppDatabase;
|
|
|
|
import static org.schabi.newpipe.database.AppDatabase.DATABASE_NAME;
|
|
import static org.schabi.newpipe.database.Migrations.MIGRATION_11_12;
|
|
|
|
public final class NewPipeDatabase {
|
|
|
|
private static AppDatabase databaseInstance;
|
|
|
|
private NewPipeDatabase() {
|
|
//no instance
|
|
}
|
|
|
|
public static void init(Context context) {
|
|
databaseInstance = Room
|
|
.databaseBuilder(context, AppDatabase.class, DATABASE_NAME)
|
|
.addMigrations(MIGRATION_11_12)
|
|
.fallbackToDestructiveMigration()
|
|
.build();
|
|
}
|
|
|
|
@NonNull
|
|
@Deprecated
|
|
public static AppDatabase getInstance() {
|
|
if (databaseInstance == null) throw new RuntimeException("Database not initialized");
|
|
|
|
return databaseInstance;
|
|
}
|
|
|
|
@NonNull
|
|
public static AppDatabase getInstance(Context context) {
|
|
if (databaseInstance == null) init(context);
|
|
return databaseInstance;
|
|
}
|
|
}
|