1.修改布局允许水平旋转2.修复主页访问图层管理崩溃问题3.扩充轨迹字段
This commit is contained in:
@@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.room.Database;
|
||||
import androidx.room.Room;
|
||||
import androidx.room.RoomDatabase;
|
||||
import androidx.room.migration.Migration;
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
|
||||
import com.navinfo.collect.library.data.entity.NiLocation;
|
||||
@@ -18,7 +19,7 @@ import com.tencent.wcdb.repair.RecoverKit;
|
||||
import com.tencent.wcdb.room.db.WCDBDatabase;
|
||||
import com.tencent.wcdb.room.db.WCDBOpenHelperFactory;
|
||||
|
||||
@Database(entities = { NiLocation.class},version = 1, exportSchema = false)
|
||||
@Database(entities = { NiLocation.class},version = 2, exportSchema = false)
|
||||
public abstract class TraceDataBase extends RoomDatabase {
|
||||
// marking the instance as volatile to ensure atomic access to the variable
|
||||
/**
|
||||
@@ -63,7 +64,7 @@ public abstract class TraceDataBase extends RoomDatabase {
|
||||
// Wipes and rebuilds instead of migrating if no Migration object.
|
||||
// Migration is not part of this codelab.
|
||||
.fallbackToDestructiveMigration()
|
||||
.addCallback(sRoomDatabaseCallback)
|
||||
.addCallback(sRoomDatabaseCallback).addMigrations(MIGRATION_1_2)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -71,6 +72,18 @@ public abstract class TraceDataBase extends RoomDatabase {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
*扩充字段
|
||||
*/
|
||||
public static final Migration MIGRATION_1_2 = new Migration(1, 2) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase database) {
|
||||
// 增加字段
|
||||
database.execSQL("ALTER TABLE niLocation " + " ADD COLUMN groupId " + " TEXT");
|
||||
database.execSQL("ALTER TABLE niLocation " + " ADD COLUMN timeStamp " + " TEXT");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Override the onOpen method to populate the database.
|
||||
* For this sample, we clear the database every time it is created or opened.
|
||||
|
||||
@@ -61,6 +61,11 @@ public class NiLocation extends Feature{
|
||||
private int tilex;
|
||||
@ColumnInfo(name = "tiley")
|
||||
private int tiley;
|
||||
@ColumnInfo(name = "groupId")
|
||||
private String groupId;
|
||||
@ColumnInfo(name = "timeStamp")
|
||||
private String timeStamp;
|
||||
|
||||
private boolean isAccouracy;
|
||||
private boolean isSpeed;
|
||||
private boolean isAltitude;
|
||||
@@ -297,4 +302,20 @@ public class NiLocation extends Feature{
|
||||
public void setErrorCode(String errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getTimeStamp() {
|
||||
return timeStamp;
|
||||
}
|
||||
|
||||
public void setTimeStamp(String timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.baidu.location.LocationClientOption
|
||||
import com.baidu.location.LocationClientOption.LocationMode
|
||||
import com.navinfo.collect.library.data.entity.NiLocation
|
||||
import com.navinfo.collect.library.map.NIMapView
|
||||
import com.navinfo.collect.library.utils.DateUtils
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oscim.core.GeoPoint
|
||||
@@ -195,6 +196,7 @@ class LocationLayerHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
niLocation.address = mCurrentLocation!!.addrStr
|
||||
niLocation.street = mCurrentLocation!!.street
|
||||
niLocation.town = mCurrentLocation!!.town
|
||||
niLocation.speed = mCurrentLocation!!.speed
|
||||
niLocation.streetNumber = mCurrentLocation!!.streetNumber
|
||||
niLocation.errorCode = mCurrentLocation!!.locType.toString()
|
||||
return niLocation
|
||||
|
||||
Reference in New Issue
Block a user