[Update]升级数据库并展示摄像头信息
This commit is contained in:
Binary file not shown.
@@ -4,9 +4,11 @@ import android.content.Context
|
||||
import androidx.room.Database
|
||||
import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
import com.mogo.eagle.core.data.map.Infrastructure
|
||||
|
||||
@Database(entities = [Infrastructure::class], version = 1, exportSchema = false)
|
||||
@Database(entities = [Infrastructure::class], version = 2, exportSchema = false)
|
||||
abstract class OverviewDb: RoomDatabase() {
|
||||
abstract fun overviewDao(): OverviewDao
|
||||
|
||||
@@ -14,12 +16,18 @@ abstract class OverviewDb: RoomDatabase() {
|
||||
private const val DB_PATH = "database/t_device.db"
|
||||
private const val INTERNAL_DB_NAME = "t_device.db"
|
||||
|
||||
private val MIGRATION_1_2 = object : Migration(1, 2) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
}
|
||||
}
|
||||
|
||||
private var db: OverviewDb? = null
|
||||
|
||||
fun getDb(context: Context): OverviewDb {
|
||||
if (db == null) {
|
||||
db = Room.databaseBuilder(context.applicationContext, OverviewDb::class.java, INTERNAL_DB_NAME)
|
||||
.createFromAsset(DB_PATH)
|
||||
.addMigrations(MIGRATION_1_2)
|
||||
.fallbackToDestructiveMigration()
|
||||
.build()
|
||||
}
|
||||
|
||||
@@ -106,10 +106,6 @@ public class OverviewMapFragment extends BaseFragment
|
||||
if (mAMapCustomView != null) {
|
||||
mAMapCustomView.onResume();
|
||||
}
|
||||
Map<String, ArrayList<Infrastructure>> map = InfStructureManager.INSTANCE.getPathData();
|
||||
if (!map.isEmpty()) {
|
||||
mAMapCustomView.drawInfMarkers(map);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user