Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS

This commit is contained in:
xiaoyan 2023-04-24 17:21:31 +08:00
commit d174c82cb6
55 changed files with 1346 additions and 648 deletions

View File

@ -22,13 +22,26 @@ class Constant {
/** /**
* 当前用户ID * 当前用户ID
*/ */
lateinit var CURRENT_USER_ID: String lateinit var USER_ID: String
//数据版本
lateinit var VERSION_ID: String
/**
* 用户数据目录
*/
lateinit var USER_DATA_PATH: String
/** /**
* 离线地图目录 * 离线地图目录
*/ */
lateinit var OFFLINE_MAP_PATH: String lateinit var OFFLINE_MAP_PATH: String
/**
* 下载目录
*/
lateinit var DOWNLOAD_PATH: String
/** /**
* 服务器地址 * 服务器地址
*/ */
@ -41,6 +54,28 @@ class Constant {
const val message_version_right_off = "1" //立即发送 const val message_version_right_off = "1" //立即发送
const val MESSAGE_PAGE_SIZE = 30 //消息列表一页最多数量 const val MESSAGE_PAGE_SIZE = 30 //消息列表一页最多数量
lateinit var realm: Realm
//选择相机默认或者外设
const val SELECT_CAMERA_STATE = "select_camera_state"
//是否连接
const val CAMERA_CONNECT_STATE = "camera_connect_state"
//是否可以点击
const val CAMERA_CLICK_STATE = "camera_click_state"
//拍照模式
const val TAKE_CAMERA_MODE = "take_camera_mode"
const val TAKE_CAMERA_IP = "take_camera_ip"
const val TAKE_CAMERA_MAC = "take_camera_mac"
//选择拍照或者录像
const val SELECT_TAKEPHOTO_OR_RECORD = "select_takephoto_or_record"
const val OMDB_CONFIG = "omdb.config" const val OMDB_CONFIG = "omdb.config"
} }

View File

@ -1,16 +1,11 @@
package com.navinfo.omqs package com.navinfo.omqs
import android.app.Application import android.app.Application
import android.util.Log
import com.navinfo.omqs.db.MyRealmModule
import com.navinfo.omqs.tools.FileManager import com.navinfo.omqs.tools.FileManager
import com.navinfo.omqs.ui.manager.TakePhotoManager import com.navinfo.omqs.ui.manager.TakePhotoManager
import com.navinfo.omqs.util.NetUtils import com.navinfo.omqs.util.NetUtils
import dagger.hilt.android.HiltAndroidApp import dagger.hilt.android.HiltAndroidApp
import org.videolan.vlc.Util import org.videolan.vlc.Util
import io.realm.Realm
import io.realm.RealmConfiguration
import java.io.File
import java.security.MessageDigest import java.security.MessageDigest
@HiltAndroidApp @HiltAndroidApp

View File

@ -2,7 +2,6 @@ package com.navinfo.omqs.bean
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import com.navinfo.omqs.Constant import com.navinfo.omqs.Constant
import com.navinfo.omqs.system.SystemConstant
import com.navinfo.omqs.tools.FileManager.Companion.FileDownloadStatus import com.navinfo.omqs.tools.FileManager.Companion.FileDownloadStatus
import io.realm.RealmList import io.realm.RealmList
import io.realm.RealmObject import io.realm.RealmObject

View File

@ -36,7 +36,7 @@ class ImportOMDBHelper @AssistedInject constructor(@Assisted("context") val cont
@Inject @Inject
lateinit var gson: Gson lateinit var gson: Gson
private val database by lazy { omdbHiltFactory.obtainOmdbDataBaseHelper(context, omdbFile.absolutePath, 1).writableDatabase } private val database by lazy { omdbHiltFactory.obtainOmdbDataBaseHelper(context, omdbFile.absolutePath, 1).writableDatabase }
private val configFile: File = File("${Constant.DATA_PATH}/${Constant.CURRENT_USER_ID}", Constant.OMDB_CONFIG) private val configFile: File = File("${Constant.USER_DATA_PATH}", Constant.OMDB_CONFIG)
/** /**
* 读取config的配置文件 * 读取config的配置文件

View File

@ -104,13 +104,13 @@ class TaskDownloadScope(
var randomAccessFile: RandomAccessFile? = null var randomAccessFile: RandomAccessFile? = null
try { try {
//创建离线地图 下载文件夹,.map文件夹的下一级 //创建离线地图 下载文件夹,.map文件夹的下一级
val fileDir = File("${Constant.OFFLINE_MAP_PATH}download") val fileDir = File("${Constant.DOWNLOAD_PATH}download")
if (!fileDir.exists()) { if (!fileDir.exists()) {
fileDir.mkdirs() fileDir.mkdirs()
} }
val fileTemp = val fileTemp =
File("${Constant.OFFLINE_MAP_PATH}download/${taskBean.id}_${taskBean.dataVersion}") File("${Constant.DOWNLOAD_PATH}${taskBean.id}_${taskBean.dataVersion}")
val startPosition = taskBean.currentSize val startPosition = taskBean.currentSize
//验证断点有效性 //验证断点有效性
if (startPosition < 0) throw IOException("jingo Start position less than zero") if (startPosition < 0) throw IOException("jingo Start position less than zero")
@ -119,8 +119,13 @@ class TaskDownloadScope(
url = taskBean.getDownLoadUrl() url = taskBean.getDownLoadUrl()
) )
val responseBody = response.body() val responseBody = response.body()
change(FileDownloadStatus.LOADING) change(FileDownloadStatus.LOADING)
responseBody ?: throw IOException("jingo ResponseBody is null") responseBody ?: throw IOException("jingo ResponseBody is null")
if (startPosition == 0L) {
taskBean.fileSize = responseBody.contentLength()
}
//写入文件 //写入文件
randomAccessFile = RandomAccessFile(fileTemp, "rwd") randomAccessFile = RandomAccessFile(fileTemp, "rwd")
randomAccessFile.seek(startPosition) randomAccessFile.seek(startPosition)
@ -144,7 +149,7 @@ class TaskDownloadScope(
Log.e("jingo", "文件下载完成 ${taskBean.currentSize} == ${taskBean.fileSize}") Log.e("jingo", "文件下载完成 ${taskBean.currentSize} == ${taskBean.fileSize}")
if (taskBean.currentSize == taskBean.fileSize) { if (taskBean.currentSize == taskBean.fileSize) {
val res = val res =
fileTemp.renameTo(File("${Constant.OFFLINE_MAP_PATH}${taskBean.evaluationTaskName}.zip")) fileTemp.renameTo(File("${Constant.DOWNLOAD_PATH}${taskBean.evaluationTaskName}.zip"))
Log.e("jingo", "文件下载完成 修改文件 $res") Log.e("jingo", "文件下载完成 修改文件 $res")
change(FileDownloadStatus.DONE) change(FileDownloadStatus.DONE)
} else { } else {

View File

@ -1,42 +0,0 @@
package com.navinfo.omqs.system;
import java.util.UUID;
/**
* 系统变量对象
*/
public class SystemConstant {
public static String USER_ID = "1";
//选择相机默认或者外设
public static String SELECT_CAMERA_STATE = "select_camera_state";
//是否连接
public static String CAMERA_CONNECT_STATE = "camera_connect_state";
//是否可以点击
public static String CAMERA_CLICK_STATE = "camera_click_state";
//拍照模式
public static String TAKE_CAMERA_MODE = "take_camera_mode";
public static String TAKE_CAMERA_IP = "take_camera_ip";
public static String TAKE_CAMERA_MAC = "take_camera_mac";
//选择拍照或者录像
public static String SELECT_TAKEPHOTO_OR_RECORD = "select_takephoto_or_record";
/**
* 获取uuid
* @param isUpperCase
* true 大写 false 小写
*/
public static String getUuid(boolean isUpperCase){
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
if(isUpperCase)
uuid = uuid.toUpperCase();
return uuid;
}
}

View File

@ -3,6 +3,7 @@ package com.navinfo.omqs.tools
import android.content.Context import android.content.Context
import com.navinfo.omqs.Constant import com.navinfo.omqs.Constant
import com.navinfo.omqs.bean.OfflineMapCityBean import com.navinfo.omqs.bean.OfflineMapCityBean
import com.navinfo.omqs.bean.TaskBean
import java.io.File import java.io.File
class FileManager { class FileManager {
@ -20,13 +21,14 @@ class FileManager {
} }
//初始化数据文件夹 //初始化数据文件夹
fun initRootDir(context:Context){ fun initRootDir(context: Context) {
// 在SD卡创建项目目录 // 在SD卡创建项目目录
val sdCardPath = context.getExternalFilesDir(null) val sdCardPath = context.getExternalFilesDir(null)
sdCardPath?.let { sdCardPath?.let {
Constant.ROOT_PATH = sdCardPath.absolutePath Constant.ROOT_PATH = sdCardPath.absolutePath
Constant.MAP_PATH = Constant.ROOT_PATH + "/map/" Constant.MAP_PATH = Constant.ROOT_PATH + "/map/"
Constant.OFFLINE_MAP_PATH = Constant.MAP_PATH + "offline/" Constant.OFFLINE_MAP_PATH = Constant.MAP_PATH + "offline/"
Constant.DOWNLOAD_PATH = Constant.ROOT_PATH + "/download/"
val file = File(Constant.MAP_PATH) val file = File(Constant.MAP_PATH)
if (!file.exists()) { if (!file.exists()) {
file.mkdirs() file.mkdirs()
@ -37,7 +39,7 @@ class FileManager {
with(File(Constant.DATA_PATH)) { with(File(Constant.DATA_PATH)) {
if (!this.exists()) this.mkdirs() if (!this.exists()) this.mkdirs()
} }
}else{ } else {
Constant.DATA_PATH = Constant.ROOT_PATH + "/data/" Constant.DATA_PATH = Constant.ROOT_PATH + "/data/"
} }
} }
@ -102,5 +104,65 @@ class FileManager {
} }
} }
} }
/**
* 检查离线地图文件
*/
suspend fun checkOMDBFileInfo(taskBean: TaskBean) {
//访问离线地图文件夹
val fileDir = File("${Constant.DOWNLOAD_PATH}")
//如果连本地文件夹还没有,就不用修改任何数据了
if (!fileDir.exists()) {
return
}
//访问离线地图临时下载文件夹
val fileTempDir = File(Constant.DOWNLOAD_PATH)
//是否有一份.map文件了
var mapFile: File? = null
//文件夹里文件挨个访问
for (item in fileDir.listFiles()) {
//先找到对应的省市文件例如540000_西藏自治区_20230401195018.map",以id开头
if (item.isFile && item.name.startsWith("${taskBean.id}_")) {
//如果本地文件与从网络获取到版本号一致,表示这个文件已经下载完毕,不用处理了
if (item.name == "${taskBean.id}_${taskBean.dataVersion}") {
taskBean.status = FileDownloadStatus.DONE
return
}
//文件存在,版本号不对应,留给下面流程处理
mapFile = item
break
}
}
//临时下载文件夹
if (fileTempDir.exists()) {
for (item in fileTempDir.listFiles()) {
//先找到对应的省市文件例如540000_20230401195018",以id开头
if (item.isFile && item.name.startsWith("${taskBean.id}_")) {
//如果本地文件与从网络获取到版本号一致,表示这个文件已经在下载列表中
if (item.name == "${taskBean.id}_${taskBean.dataVersion}") {
//如果这个临时文件的大小和下载大小是一致的,说明已经下载完了,但是在下载环节没有更名移动成功,需要重命名和移动文件夹
if (item.length() == taskBean.fileSize) {
//移动更名文件后删除旧数据,修改状态
if (item.renameTo(File("${Constant.OFFLINE_MAP_PATH}${taskBean.evaluationTaskName}.zip"))) {
//删除旧版本数据
mapFile?.delete()
taskBean.status = FileDownloadStatus.DONE
return
}
} else { // 临时文件大小和目标不一致,说明下载了一半
taskBean.status = FileDownloadStatus.PAUSE
taskBean.currentSize = item.length()
return
}
} else { //虽然省市id开头一致但是版本号不一致说明之前版本下载了一部分现在要更新了原来下载的文件直接删除
taskBean.status = FileDownloadStatus.UPDATE
item.delete()
return
}
break
}
}
}
}
} }
} }

View File

@ -18,8 +18,8 @@ import dagger.hilt.android.lifecycle.HiltViewModel
import io.realm.Realm import io.realm.Realm
import io.realm.RealmConfiguration import io.realm.RealmConfiguration
import kotlinx.coroutines.* import kotlinx.coroutines.*
import okio.IOException
import java.io.File import java.io.File
import java.io.IOException
import javax.inject.Inject import javax.inject.Inject
enum class LoginStatus { enum class LoginStatus {
@ -154,11 +154,12 @@ class LoginViewModel @Inject constructor(
/** /**
* 创建用户目录 * 创建用户目录
*/ */
@Throws(IOException::class)
private fun createUserFolder(context: Context, userId: String) { private fun createUserFolder(context: Context, userId: String) {
Constant.USER_ID = userId
Constant.VERSION_ID = userId
Constant.USER_DATA_PATH = Constant.DATA_PATH + Constant.USER_ID + "/" + Constant.VERSION_ID
// 在SD卡创建用户目录解压资源等 // 在SD卡创建用户目录解压资源等
val userFolder = File("${Constant.DATA_PATH}/${userId}") val userFolder = File("${Constant.DATA_PATH}/${userId}")
Constant.CURRENT_USER_ID = userId
// 初始化Realm // 初始化Realm
Realm.init(context.applicationContext) Realm.init(context.applicationContext)
val password = "encryp".encodeToByteArray().copyInto(ByteArray(64)) val password = "encryp".encodeToByteArray().copyInto(ByteArray(64))

View File

@ -14,10 +14,7 @@ import com.navinfo.omqs.Constant
import com.navinfo.omqs.R import com.navinfo.omqs.R
import com.navinfo.omqs.databinding.ActivityMainBinding import com.navinfo.omqs.databinding.ActivityMainBinding
import com.navinfo.omqs.http.offlinemapdownload.OfflineMapDownloadManager import com.navinfo.omqs.http.offlinemapdownload.OfflineMapDownloadManager
import com.navinfo.omqs.system.SystemConstant
import com.navinfo.omqs.ui.activity.BaseActivity import com.navinfo.omqs.ui.activity.BaseActivity
import com.navinfo.omqs.ui.fragment.evaluationresult.EvaluationResultFragment
import com.navinfo.omqs.ui.fragment.evaluationresult.EvaluationResultViewModel
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject import javax.inject.Inject
@ -48,7 +45,7 @@ class MainActivity : BaseActivity() {
binding.mainActivityMap, binding.mainActivityMap,
null, null,
Constant.MAP_PATH, Constant.MAP_PATH,
Constant.DATA_PATH+ SystemConstant.USER_ID+"/trace.sqlite" Constant.USER_DATA_PATH+"/trace.sqlite"
) )
//关联生命周期 //关联生命周期
binding.lifecycleOwner = this binding.lifecycleOwner = this
@ -71,8 +68,9 @@ class MainActivity : BaseActivity() {
mapController.locationLayerHandler.startLocation() mapController.locationLayerHandler.startLocation()
//启动轨迹存储 //启动轨迹存储
mapController.locationLayerHandler.setNiLocationListener(NiLocationListener { mapController.locationLayerHandler.setNiLocationListener(NiLocationListener {
viewModel.addSaveTrace(it) ToastUtils.showLong("定位${it.longitude}")
// binding.viewModel!!.startSaveTraceThread(this) binding!!.viewModel!!.addSaveTrace(it)
binding!!.viewModel!!.startSaveTraceThread(this)
}) })
//显示轨迹图层 //显示轨迹图层
// mapController.layerManagerHandler.showNiLocationLayer(Constant.DATA_PATH+ SystemConstant.USER_ID+"/trace.sqlite") // mapController.layerManagerHandler.showNiLocationLayer(Constant.DATA_PATH+ SystemConstant.USER_ID+"/trace.sqlite")
@ -106,9 +104,8 @@ class MainActivity : BaseActivity() {
* 打开相机预览 * 打开相机预览
*/ */
fun openCamera() { fun openCamera() {
binding.viewModel!!.onClickCameraButton(this)
//显示轨迹图层 //显示轨迹图层
//binding!!.viewModel!!.onClickCameraButton(this) binding!!.viewModel!!.onClickCameraButton(this)
} }
/** /**

View File

@ -16,7 +16,6 @@ import com.navinfo.collect.library.utils.GeometryTools
import com.navinfo.collect.library.utils.GeometryToolsKt import com.navinfo.collect.library.utils.GeometryToolsKt
import com.navinfo.omqs.Constant import com.navinfo.omqs.Constant
import com.navinfo.omqs.R import com.navinfo.omqs.R
import com.navinfo.omqs.system.SystemConstant
import com.navinfo.omqs.ui.dialog.CommonDialog import com.navinfo.omqs.ui.dialog.CommonDialog
import com.navinfo.omqs.ui.manager.TakePhotoManager import com.navinfo.omqs.ui.manager.TakePhotoManager
import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.lifecycle.HiltViewModel
@ -39,7 +38,7 @@ class MainViewModel @Inject constructor(
private var niLocationList: MutableList<NiLocation> = ArrayList<NiLocation>() private var niLocationList: MutableList<NiLocation> = ArrayList<NiLocation>()
init { init {
mapController.layerManagerHandler.setOnQsRecordItemClickListener(object : mapController.markerHandle.setOnQsRecordItemClickListener(object :
OnQsRecordItemClickListener { OnQsRecordItemClickListener {
override fun onQsRecordList(list: MutableList<String>) { override fun onQsRecordList(list: MutableList<String>) {
liveDataQsRecordIdList.value = list liveDataQsRecordIdList.value = list
@ -122,7 +121,7 @@ class MainViewModel @Inject constructor(
TraceDataBase.getDatabase( TraceDataBase.getDatabase(
context, context,
Constant.DATA_PATH + SystemConstant.USER_ID + "/trace.sqlite" Constant.USER_DATA_PATH + "/trace.sqlite"
).niLocationDao.insert(niLocation) ).niLocationDao.insert(niLocation)
niLocationList.removeAt(0) niLocationList.removeAt(0)
Log.e("qj", "saveTrace") Log.e("qj", "saveTrace")

View File

@ -36,11 +36,10 @@ import com.navinfo.collect.library.garminvirbxe.SensorParams;
import com.navinfo.collect.library.garminvirbxe.HostBean; import com.navinfo.collect.library.garminvirbxe.HostBean;
import com.navinfo.omqs.Constant; import com.navinfo.omqs.Constant;
import com.navinfo.omqs.R; import com.navinfo.omqs.R;
import com.navinfo.omqs.system.SystemConstant;
import com.navinfo.omqs.system.SystemDateTime;
import com.navinfo.omqs.ui.activity.map.MainActivity; import com.navinfo.omqs.ui.activity.map.MainActivity;
import com.navinfo.omqs.ui.manager.TakePhotoManager; import com.navinfo.omqs.ui.manager.TakePhotoManager;
import com.navinfo.omqs.ui.other.BaseToast; import com.navinfo.omqs.ui.other.BaseToast;
import com.navinfo.omqs.util.DateTimeUtil;
import com.navinfo.omqs.util.FileUtils; import com.navinfo.omqs.util.FileUtils;
import com.navinfo.omqs.util.NetUtils; import com.navinfo.omqs.util.NetUtils;
import com.navinfo.omqs.util.ShareUtil; import com.navinfo.omqs.util.ShareUtil;
@ -282,13 +281,13 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
Log.e("AAA", "连接中"); Log.e("AAA", "连接中");
connectstate = false; connectstate = false;
mShareUtil.setConnectstate(SystemConstant.USER_ID, connectstate); mShareUtil.setConnectstate(Constant.USER_ID, connectstate);
mOneBtConnect.setText("连接中"); mOneBtConnect.setText("连接中");
updateCameraResources(2, getmDeviceNum()); updateCameraResources(2, getmDeviceNum());
} else { } else {
connectstate = false; connectstate = false;
mShareUtil.setConnectstate(SystemConstant.USER_ID, connectstate); mShareUtil.setConnectstate(Constant.USER_ID, connectstate);
click_state = true; click_state = true;
mOneBtConnect.setEnabled(click_state); mOneBtConnect.setEnabled(click_state);
@ -357,11 +356,11 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
Message msg = new Message(); Message msg = new Message();
String picPath = Constant.DATA_PATH + "/" + SystemConstant.USER_ID + "/pic.jpg"; String picPath = Constant.DATA_PATH + "/" + Constant.USER_ID + "/pic.jpg";
//创建目录 //创建目录
if(!new File(Constant.DATA_PATH + "/" + SystemConstant.USER_ID).exists()){ if(!new File(Constant.DATA_PATH + "/" + Constant.USER_ID).exists()){
new File(Constant.DATA_PATH + "/" + SystemConstant.USER_ID).mkdirs(); new File(Constant.DATA_PATH + "/" + Constant.USER_ID).mkdirs();
} }
//多次获取照片信息解决概率事件无法获取有效照片问题 //多次获取照片信息解决概率事件无法获取有效照片问题
@ -376,7 +375,7 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
Log.e("AAA", "获取单张拍照时间" + time+"次数"+i); Log.e("AAA", "获取单张拍照时间" + time+"次数"+i);
if (!TextUtils.isEmpty(time)) { if (!TextUtils.isEmpty(time)) {
long picTime = SystemDateTime.getPicTime(time); long picTime = DateTimeUtil.getPicTime(time);
long disTime = mStartCheckTime - picTime / 1000; long disTime = mStartCheckTime - picTime / 1000;
@ -482,7 +481,7 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
updateCameraResources(0, getmDeviceNum()); updateCameraResources(0, getmDeviceNum());
connectstate = true; connectstate = true;
mShareUtil.setConnectstate(SystemConstant.USER_ID, connectstate); mShareUtil.setConnectstate(Constant.USER_ID, connectstate);
stopVideo(); stopVideo();
mOneBtConnect.setPressed(true); mOneBtConnect.setPressed(true);
mOneBtConnect.setBackgroundResource(R.drawable.btn_red_disconnect_bg); mOneBtConnect.setBackgroundResource(R.drawable.btn_red_disconnect_bg);
@ -614,7 +613,7 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
mGpsTv.setText("相机GPS信号差请稍等片刻或将相机移到开发地带。"); mGpsTv.setText("相机GPS信号差请稍等片刻或将相机移到开发地带。");
mGpsTv.setVisibility(View.VISIBLE); mGpsTv.setVisibility(View.VISIBLE);
mStartOrEndTakePicture.setEnabled(status); mStartOrEndTakePicture.setEnabled(status);
mShareUtil.setContinusTakePhotoState(SystemConstant.USER_ID, true); mShareUtil.setContinusTakePhotoState(Constant.USER_ID, true);
} }
} }
@ -778,7 +777,7 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
ImageView ivStatus = (ImageView) findViewById(resId); ImageView ivStatus = (ImageView) findViewById(resId);
if (ivStatus != null) { if (ivStatus != null) {
String time = SystemDateTime.getDateSimpleTime(SystemDateTime.getTimeInfo(SystemDateTime.getTime()) - 0/*MainActivity.disGoogleTime*/); String time = DateTimeUtil.getDateSimpleTime(DateTimeUtil.getTimeInfo(DateTimeUtil.getTime()) - 0/*MainActivity.disGoogleTime*/);
ivStatus.setImageDrawable(null); ivStatus.setImageDrawable(null);
@ -810,7 +809,7 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
if (connectstate) { if (connectstate) {
Log.i("chentao", "打开/结束连拍:" + arg1); Log.i("chentao", "打开/结束连拍:" + arg1);
mShareUtil.setContinusTakePhotoState(SystemConstant.USER_ID, arg1); mShareUtil.setContinusTakePhotoState(Constant.USER_ID, arg1);
if (!arg1) { if (!arg1) {
@ -829,7 +828,7 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
mStartOrEndTakePicture.setChecked(true); mStartOrEndTakePicture.setChecked(true);
mShareUtil.setContinusTakePhotoState(SystemConstant.USER_ID, true); mShareUtil.setContinusTakePhotoState(Constant.USER_ID, true);
BaseToast.makeText(context, "外接相机没有连接成功!不能进行连续拍照!", Toast.LENGTH_SHORT).show(); BaseToast.makeText(context, "外接相机没有连接成功!不能进行连续拍照!", Toast.LENGTH_SHORT).show();
} }
@ -845,9 +844,9 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
connectstate = false; connectstate = false;
mShareUtil.setContinusTakePhotoState(SystemConstant.USER_ID, true); mShareUtil.setContinusTakePhotoState(Constant.USER_ID, true);
mShareUtil.setConnectstate(SystemConstant.USER_ID, connectstate); mShareUtil.setConnectstate(Constant.USER_ID, connectstate);
mStartOrEndTakePicture.setChecked(true); mStartOrEndTakePicture.setChecked(true);
@ -908,10 +907,10 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
public void onCheckedChanged(CompoundButton arg0, boolean arg1) { public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
if (connectstate) { if (connectstate) {
Log.i("chentao", "选择相机:" + arg1); Log.i("chentao", "选择相机:" + arg1);
mShareUtil.setSelectCameraKind(SystemConstant.USER_ID, arg1); mShareUtil.setSelectCameraKind(Constant.USER_ID, arg1);
} else { } else {
mSelectCamera.setChecked(false); mSelectCamera.setChecked(false);
mShareUtil.setSelectCameraKind(SystemConstant.USER_ID, false); mShareUtil.setSelectCameraKind(Constant.USER_ID, false);
BaseToast.makeText(context, "外接相机没有连接成功!只能使用系统相机,谢谢!", Toast.LENGTH_SHORT).show(); BaseToast.makeText(context, "外接相机没有连接成功!只能使用系统相机,谢谢!", Toast.LENGTH_SHORT).show();
} }
} }
@ -962,7 +961,7 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
} }
//重置拍照按钮 //重置拍照按钮
mShareUtil.setContinusTakePhotoState(SystemConstant.USER_ID, true); mShareUtil.setContinusTakePhotoState(Constant.USER_ID, true);
} }
//设置另外一台相机状态 //设置另外一台相机状态
@ -980,11 +979,11 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
} }
shareUtilOther.setSelectTakePhotoOrRecord(SystemConstant.USER_ID, !isCheck); shareUtilOther.setSelectTakePhotoOrRecord(Constant.USER_ID, !isCheck);
shareUtilOther.setContinusTakePhotoState(SystemConstant.USER_ID, true); shareUtilOther.setContinusTakePhotoState(Constant.USER_ID, true);
mShareUtil.setSelectTakePhotoOrRecord(SystemConstant.USER_ID, isCheck); mShareUtil.setSelectTakePhotoOrRecord(Constant.USER_ID, isCheck);
if (isCheck) { if (isCheck) {
@ -993,18 +992,18 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
takephotoManager.setCameraMode(getmDeviceNum(), SensorWorkingMode.CAMERA_VEDIO_TIMELAPSE); takephotoManager.setCameraMode(getmDeviceNum(), SensorWorkingMode.CAMERA_VEDIO_TIMELAPSE);
mShareUtil.setTakeCameraMode(SystemConstant.USER_ID, 0); mShareUtil.setTakeCameraMode(Constant.USER_ID, 0);
shareUtilOther.setTakeCameraMode(SystemConstant.USER_ID, 1); shareUtilOther.setTakeCameraMode(Constant.USER_ID, 1);
} else { } else {
mTakePhotoOrRecord.setText("拍照"); mTakePhotoOrRecord.setText("拍照");
setmImgViewImageDrawable(1); setmImgViewImageDrawable(1);
mShareUtil.setTakeCameraMode(SystemConstant.USER_ID, 1); mShareUtil.setTakeCameraMode(Constant.USER_ID, 1);
shareUtilOther.setTakeCameraMode(SystemConstant.USER_ID, 0); shareUtilOther.setTakeCameraMode(Constant.USER_ID, 0);
takephotoManager.setCameraMode(getmDeviceNum(), SensorWorkingMode.CAMEAR_PHOTO_CONTINUOUS_PHOTO); takephotoManager.setCameraMode(getmDeviceNum(), SensorWorkingMode.CAMEAR_PHOTO_CONTINUOUS_PHOTO);
@ -1074,7 +1073,7 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
BaseToast.makeText(context, TextUtils.isEmpty(msg) ? "相机丢失连接,请检查网络是否畅通!" : msg, Toast.LENGTH_SHORT).show(); BaseToast.makeText(context, TextUtils.isEmpty(msg) ? "相机丢失连接,请检查网络是否畅通!" : msg, Toast.LENGTH_SHORT).show();
connectstate = false; connectstate = false;
mShareUtil.setConnectstate(SystemConstant.USER_ID, connectstate); mShareUtil.setConnectstate(Constant.USER_ID, connectstate);
mOneBtConnect.setPressed(false); mOneBtConnect.setPressed(false);
mOneBtConnect.setBackgroundResource(R.drawable.btn_connect_bg_enabled); mOneBtConnect.setBackgroundResource(R.drawable.btn_connect_bg_enabled);
mOneBtConnect.setText("一键连接"); mOneBtConnect.setText("一键连接");
@ -1536,9 +1535,9 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
mHostBean = hostBean; mHostBean = hostBean;
mShareUtil.setTakeCameraIP(SystemConstant.USER_ID, hostBean.ipAddress.toString()); mShareUtil.setTakeCameraIP(Constant.USER_ID, hostBean.ipAddress.toString());
mShareUtil.setTakeCameraMac(SystemConstant.USER_ID, hostBean.hardwareAddress.toString()); mShareUtil.setTakeCameraMac(Constant.USER_ID, hostBean.hardwareAddress.toString());
takephotoManager.connect(getmDeviceNum(), hostBean, params); takephotoManager.connect(getmDeviceNum(), hostBean, params);
} }

View File

@ -212,7 +212,7 @@ class EvaluationResultViewModel @Inject constructor(
it.copyToRealmOrUpdate(liveDataQsRecordBean.value) it.copyToRealmOrUpdate(liveDataQsRecordBean.value)
} }
// realm.close() // realm.close()
mapController.layerManagerHandler.addOrUpdateQsRecordMark(liveDataQsRecordBean.value!!) mapController.markerHandle.addOrUpdateQsRecordMark(liveDataQsRecordBean.value!!)
liveDataFinish.postValue(true) liveDataFinish.postValue(true)
} }
} }
@ -228,7 +228,7 @@ class EvaluationResultViewModel @Inject constructor(
objects?.deleteFromRealm() objects?.deleteFromRealm()
} }
// realm.close() // realm.close()
mapController.layerManagerHandler.removeQsRecordMark(liveDataQsRecordBean.value!!) mapController.markerHandle.removeQsRecordMark(liveDataQsRecordBean.value!!)
liveDataFinish.postValue(true) liveDataFinish.postValue(true)
} }
} }

View File

@ -125,6 +125,9 @@ class PersonalCenterFragment : BaseFragment(), FSAFActivityCallbacks {
R.id.personal_center_menu_task_list -> { R.id.personal_center_menu_task_list -> {
findNavController().navigate(R.id.TaskListFragment) findNavController().navigate(R.id.TaskListFragment)
} }
R.id.personal_center_menu_qs_record_list -> {
findNavController().navigate(R.id.QsRecordListFragment)
}
} }
true true
} }

View File

@ -0,0 +1,64 @@
package com.navinfo.omqs.ui.fragment.tasklist
import android.content.Context
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.Observer
import com.navinfo.collect.library.data.entity.QsRecordBean
import com.navinfo.omqs.R
import com.navinfo.omqs.bean.TaskBean
import com.navinfo.omqs.databinding.AdapterQsRecordListBinding
import com.navinfo.omqs.databinding.AdapterTaskListBinding
import com.navinfo.omqs.http.taskdownload.TaskDownloadManager
import com.navinfo.omqs.tools.FileManager.Companion.FileDownloadStatus
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
import com.navinfo.omqs.ui.other.BaseViewHolder
/**
* 离线地图城市列表 RecyclerView 适配器
*
* RecycleView ViewHolder 中监听 ViewModel LiveData然后此时传递的 lifecycleOwner 是对应的 Fragment由于 ViewHolder 的生命周期是比 Fragment 短的所以当 ViewHolder 销毁时由于 Fragment Lifecycle 还没有结束此时 ViewHolder 会发生内存泄露监听的 LiveData 没有解绑
* 这种场景下有两种解决办法
*使用 LiveData observeForever 然后在 ViewHolder 销毁前手动调用 removeObserver
*使用 LifecycleRegistry ViewHolder 分发生命周期(这里使用了这个)
*/
class QsRecordListAdapter(
private val context: Context
) : BaseRecyclerViewAdapter<QsRecordBean>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
val viewBinding =
AdapterQsRecordListBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return BaseViewHolder(viewBinding)
}
override fun onViewRecycled(holder: BaseViewHolder) {
super.onViewRecycled(holder)
//页面滑动时会用holder重构页面但是对进度条的监听回调会一直返回扰乱UI所以当当前holder去重构的时候移除监听
}
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
val binding: AdapterQsRecordListBinding =
holder.viewBinding as AdapterQsRecordListBinding
val qsRecordBean = data[position]
//tag 方便onclick里拿到数据
holder.tag = qsRecordBean.id.toString()
changeViews(binding, qsRecordBean)
}
private fun changeViews(binding: AdapterQsRecordListBinding, qsRecordBean: QsRecordBean) {
binding.qsRecordClassType.text = qsRecordBean.classType
binding.qsRecordProblemType.text = qsRecordBean.problemType
binding.qsRecordPhenomenon.text = qsRecordBean.phenomenon
binding.qsRecordProblemLink.text = qsRecordBean.problemLink
}
override fun getItemViewRes(position: Int): Int {
return R.layout.adapter_qs_record_list
}
}

View File

@ -0,0 +1,60 @@
package com.navinfo.omqs.ui.fragment.qsrecordlist
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView.VERTICAL
import com.navinfo.omqs.R
import com.navinfo.omqs.databinding.FragmentQsRecordListBinding
import com.navinfo.omqs.ui.fragment.BaseFragment
import com.navinfo.omqs.ui.fragment.tasklist.QsRecordListAdapter
import com.navinfo.omqs.ui.widget.RecycleViewDivider
import dagger.hilt.android.AndroidEntryPoint
import org.apache.poi.xwpf.usermodel.VerticalAlign
import javax.inject.Inject
@AndroidEntryPoint
class QsRecordListFragment : BaseFragment(){
private var _binding: FragmentQsRecordListBinding? = null
private val viewModel by viewModels<QsRecordListViewModel>()
private val binding get() = _binding!!
private val adapter: QsRecordListAdapter by lazy {
QsRecordListAdapter(
requireContext()
)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentQsRecordListBinding.inflate(inflater, container, false)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val layoutManager = LinearLayoutManager(context)
//// 设置 RecyclerView 的固定大小,避免在滚动时重新计算视图大小和布局,提高性能
binding.qsRecyclerview.setHasFixedSize(true)
binding.qsRecyclerview.layoutManager = layoutManager
binding.qsRecyclerview.adapter = adapter
viewModel.liveDataQSList.observe(viewLifecycleOwner) {
adapter.refreshData(it)
}
val itemDecoration = DividerItemDecoration(context, DividerItemDecoration.VERTICAL)
itemDecoration.setDrawable(resources.getDrawable(R.drawable.separator))
binding.qsRecyclerview.addItemDecoration(itemDecoration)
viewModel.getList(requireContext())
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}

View File

@ -0,0 +1,30 @@
package com.navinfo.omqs.ui.fragment.qsrecordlist
import android.content.Context
import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.navinfo.collect.library.data.entity.QsRecordBean
import dagger.hilt.android.lifecycle.HiltViewModel
import io.realm.Realm
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import javax.inject.Inject
@HiltViewModel
class QsRecordListViewModel @Inject constructor(
) : ViewModel() {
val liveDataQSList = MutableLiveData<List<QsRecordBean>>()
fun getList(context: Context) {
viewModelScope.launch(Dispatchers.IO) {
val realm = Realm.getDefaultInstance()
Log.e("jingo","realm hashCOde ${realm.hashCode()}")
val objects = realm.where(QsRecordBean::class.java).findAll()
liveDataQSList.postValue(realm.copyFromRealm(objects))
}
}
}

View File

@ -23,7 +23,7 @@ import com.navinfo.omqs.ui.other.BaseViewHolder
*使用 LifecycleRegistry ViewHolder 分发生命周期(这里使用了这个) *使用 LifecycleRegistry ViewHolder 分发生命周期(这里使用了这个)
*/ */
class TaskListAdapter( class TaskListAdapter(
private val downloadManager: TaskDownloadManager, private val context: Context private val downloadManager: TaskDownloadManager
) : BaseRecyclerViewAdapter<TaskBean>() { ) : BaseRecyclerViewAdapter<TaskBean>() {
@ -70,6 +70,8 @@ class TaskListAdapter(
binding.taskDownloadBtn.tag = position binding.taskDownloadBtn.tag = position
binding.taskDownloadBtn.setOnClickListener(downloadBtnClick) binding.taskDownloadBtn.setOnClickListener(downloadBtnClick)
binding.taskName.text = taskBean.evaluationTaskName binding.taskName.text = taskBean.evaluationTaskName
binding.taskCityName.text = taskBean.cityName
binding.taskDataVersion.text = "版本号:${taskBean.dataVersion}"
// binding.offlineMapCitySize.text = cityBean.getFileSizeText() // binding.offlineMapCitySize.text = cityBean.getFileSizeText()
} }
@ -82,10 +84,12 @@ class TaskListAdapter(
} }
private fun changeViews(binding: AdapterTaskListBinding, cityBean: TaskBean) { private fun changeViews(binding: AdapterTaskListBinding, taskBean: TaskBean) {
binding.taskProgress.progress = if (taskBean.fileSize > 0L) {
(cityBean.currentSize * 100 / cityBean.fileSize).toInt() binding.taskProgress.progress =
when (cityBean.status) { (taskBean.currentSize * 100 / taskBean.fileSize).toInt()
}
when (taskBean.status) {
FileDownloadStatus.NONE -> { FileDownloadStatus.NONE -> {
if (binding.taskProgress.visibility == View.VISIBLE) binding.taskProgress.visibility = if (binding.taskProgress.visibility == View.VISIBLE) binding.taskProgress.visibility =
View.INVISIBLE View.INVISIBLE

View File

@ -5,6 +5,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.viewModels import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.navinfo.omqs.databinding.FragmentTaskListBinding import com.navinfo.omqs.databinding.FragmentTaskListBinding
import com.navinfo.omqs.http.taskdownload.TaskDownloadManager import com.navinfo.omqs.http.taskdownload.TaskDownloadManager
@ -22,7 +23,6 @@ class TaskListFragment : BaseFragment(){
private val adapter: TaskListAdapter by lazy { private val adapter: TaskListAdapter by lazy {
TaskListAdapter( TaskListAdapter(
downloadManager, downloadManager,
requireContext()
) )
} }
@ -46,6 +46,9 @@ class TaskListFragment : BaseFragment(){
adapter.refreshData(it) adapter.refreshData(it)
} }
viewModel.getTaskList(requireContext()) viewModel.getTaskList(requireContext())
binding.taskBack.setOnClickListener{
findNavController().navigateUp()
}
} }
override fun onDestroyView() { override fun onDestroyView() {

View File

@ -52,8 +52,11 @@ class TaskListViewModel @Inject constructor(
else -> {} else -> {}
} }
val objects = realm.where(TaskBean::class.java).findAll() val objects = realm.where(TaskBean::class.java).findAll()
liveDataTaskList.postValue(realm.copyFromRealm(objects)) val taskList = realm.copyFromRealm(objects)
// realm.close() for(item in taskList){
FileManager.checkOMDBFileInfo(item)
}
liveDataTaskList.postValue(taskList)
} }
} }

View File

@ -16,9 +16,9 @@ import com.navinfo.collect.library.sensor.ISensor.SensorWorkingMode;
import com.navinfo.collect.library.sensor.ISensor.enmSensorType; import com.navinfo.collect.library.sensor.ISensor.enmSensorType;
import com.navinfo.collect.library.sensor.ISensor.enmSignalQuality; import com.navinfo.collect.library.sensor.ISensor.enmSignalQuality;
import com.navinfo.collect.library.sensor.SensorManager; import com.navinfo.collect.library.sensor.SensorManager;
import com.navinfo.omqs.system.SystemConstant; import com.navinfo.collect.library.utils.StringUtil;
import com.navinfo.omqs.Constant;
import com.navinfo.omqs.util.ShareUtil; import com.navinfo.omqs.util.ShareUtil;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -392,7 +392,7 @@ public class TakePhotoManager {
setCameraMode(indexClent, SensorWorkingMode.CAMERA_VEDIO_TIMELAPSE); setCameraMode(indexClent, SensorWorkingMode.CAMERA_VEDIO_TIMELAPSE);
ShareUtil.getCameraMode(mCon).setContinusTakePhotoState(SystemConstant.USER_ID, false); ShareUtil.getCameraMode(mCon).setContinusTakePhotoState(Constant.USER_ID, false);
StartRecording(hostBean, indexClent); StartRecording(hostBean, indexClent);
@ -405,7 +405,7 @@ public class TakePhotoManager {
if (hostBean != null) { if (hostBean != null) {
CameraGarminVirbXE cameraGarminVirbXE = findCameraGarminVirbXE(hostBean, index); CameraGarminVirbXE cameraGarminVirbXE = findCameraGarminVirbXE(hostBean, index);
if (cameraGarminVirbXE != null) { if (cameraGarminVirbXE != null) {
cameraGarminVirbXE.snapPicture(SystemConstant.getUuid(true)); cameraGarminVirbXE.snapPicture(StringUtil.Companion.createUUID());
} }
} }
} }

View File

@ -0,0 +1,144 @@
package com.navinfo.omqs.ui.widget
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.Rect
import android.graphics.drawable.Drawable
import android.view.View
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
/**
* Create by --- on 2018/12/6 0006.
*@description:
*/
/**
* 默认分割线高度为2px颜色为灰色
*
* @param context
* @param orientation 列表方向 LinearLayoutManager.VERTICAL或LinearLayoutManager.HORIZONTAL
*/
class RecycleViewDivider(context: Context, private val mOrientation: Int) : RecyclerView.ItemDecoration() {
private var mPaint: Paint? = null
private var mDivider: Drawable? = null
private var mDividerHeight = 2//分割线高度默认为1px
init {
if (mOrientation != LinearLayoutManager.VERTICAL && mOrientation != LinearLayoutManager.HORIZONTAL) {
throw IllegalArgumentException("请输入正确的参数!")
}
val a = context.obtainStyledAttributes(ATTRS)
mDivider = a.getDrawable(0)
a.recycle()
}
/**
* 自定义分割线
*
* @param context
* @param orientation 列表方向
* @param drawableId 分割线图片
*/
constructor(context: Context, orientation: Int, drawableId: Int) : this(context, orientation) {
mDivider = ContextCompat.getDrawable(context, drawableId)
mDividerHeight = mDivider!!.intrinsicHeight
}
/**
* 自定义分割线
*
* @param context
* @param orientation 列表方向
* @param dividerHeight 分割线高度
* @param dividerColor 分割线颜色
*/
constructor(context: Context, orientation: Int, dividerHeight: Int, dividerColor: Int) : this(
context,
orientation
) {
mDividerHeight = dividerHeight
mPaint = Paint(Paint.ANTI_ALIAS_FLAG)
mPaint!!.color = dividerColor
mPaint!!.style = Paint.Style.FILL
}
//获取分割线尺寸
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
super.getItemOffsets(outRect, view, parent, state)
if (mOrientation == LinearLayoutManager.VERTICAL) {
outRect.set(0, 0, 0, mDividerHeight)
} else {
outRect.set(0, 0, mDividerHeight, 0)
}
}
//绘制分割线
override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
super.onDraw(c, parent, state)
if (mOrientation == LinearLayoutManager.VERTICAL) {
drawVertical(c, parent)
} else {
drawHorizontal(c, parent)
}
}
/**
* 绘制纵向列表时的分隔线 这时分隔线是横着的
* 每次 left相同top根据child变化right相同bottom也变化
* @param canvas
* @param parent
*/
private fun drawVertical(canvas: Canvas, parent: RecyclerView) {
val left = parent.paddingLeft
val right = parent.measuredWidth - parent.paddingRight
val childSize = parent.childCount
for (i in 0 until childSize) {
val child = parent.getChildAt(i)
val layoutParams = child.layoutParams as RecyclerView.LayoutParams
val top = child.bottom + layoutParams.bottomMargin
val bottom = top + mDividerHeight
if (mDivider != null) {
mDivider!!.setBounds(left, top, right, bottom)
mDivider!!.draw(canvas)
}
if (mPaint != null) {
canvas.drawRect(left.toFloat(), top.toFloat(), right.toFloat(), bottom.toFloat(), mPaint!!)
}
}
}
/**
* 绘制横向列表时的分隔线 这时分隔线是竖着的
* lr 变化 tb 不变
* @param canvas
* @param parent
*/
private fun drawHorizontal(canvas: Canvas, parent: RecyclerView) {
val top = parent.paddingTop
val bottom = parent.measuredHeight - parent.paddingBottom
val childSize = parent.childCount
for (i in 0 until childSize) {
val child = parent.getChildAt(i)
val layoutParams = child.layoutParams as RecyclerView.LayoutParams
val left = child.right + layoutParams.rightMargin
val right = left + mDividerHeight
if (mDivider != null) {
mDivider!!.setBounds(left, top, right, bottom)
mDivider!!.draw(canvas)
}
if (mPaint != null) {
canvas.drawRect(left.toFloat(), top.toFloat(), right.toFloat(), bottom.toFloat(), mPaint!!)
}
}
}
companion object {
private val ATTRS = intArrayOf(android.R.attr.listDivider)
}
}

View File

@ -1,4 +1,4 @@
package com.navinfo.omqs.system; package com.navinfo.omqs.util;
import java.text.ParseException; import java.text.ParseException;
import java.text.ParsePosition; import java.text.ParsePosition;
@ -13,7 +13,7 @@ import java.util.Date;
* @Date 2023年4月17日 下午1:56:02 * @Date 2023年4月17日 下午1:56:02
* @Description: 时间工具类 * @Description: 时间工具类
*/ */
public class SystemDateTime { public class DateTimeUtil {
// 时间字符串 // 时间字符串
private static String systemDate; private static String systemDate;
// 全部时间信息 // 全部时间信息

View File

@ -3,7 +3,7 @@ package com.navinfo.omqs.util;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.Editor;
import com.navinfo.omqs.system.SystemConstant; import com.navinfo.omqs.Constant;
/** /**
* @ClassName: ShareUtil.java * @ClassName: ShareUtil.java
@ -57,9 +57,9 @@ public class ShareUtil {
return false; return false;
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.SELECT_CAMERA_STATE, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.SELECT_CAMERA_STATE, Context.MODE_PRIVATE);
} }
return mSharePre.getBoolean(mDeviceNum+SystemConstant.USER_ID+SELECT_CAMERA_KIND, false); return mSharePre.getBoolean(mDeviceNum+Constant.USER_ID+SELECT_CAMERA_KIND, false);
} }
/** /**
@ -76,7 +76,7 @@ public class ShareUtil {
return ; return ;
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.SELECT_CAMERA_STATE, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.SELECT_CAMERA_STATE, Context.MODE_PRIVATE);
} }
editor=mSharePre.edit(); editor=mSharePre.edit();
@ -98,10 +98,10 @@ public class ShareUtil {
return true; return true;
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.SELECT_TAKEPHOTO_OR_RECORD, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.SELECT_TAKEPHOTO_OR_RECORD, Context.MODE_PRIVATE);
} }
return mSharePre.getBoolean(mDeviceNum+SystemConstant.USER_ID+SELECT_TAKE_PHOTO_OR_RECORD, mDeviceNum==1?true:false); return mSharePre.getBoolean(mDeviceNum+Constant.USER_ID+SELECT_TAKE_PHOTO_OR_RECORD, mDeviceNum==1?true:false);
} }
@ -119,7 +119,7 @@ public class ShareUtil {
return ; return ;
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.SELECT_TAKEPHOTO_OR_RECORD, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.SELECT_TAKEPHOTO_OR_RECORD, Context.MODE_PRIVATE);
} }
editor=mSharePre.edit(); editor=mSharePre.edit();
@ -139,9 +139,9 @@ public class ShareUtil {
return true; return true;
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.SELECT_CAMERA_STATE, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.SELECT_CAMERA_STATE, Context.MODE_PRIVATE);
} }
return mSharePre.getBoolean(mDeviceNum+SystemConstant.USER_ID+CONTINUS_TAKE_PHOTO_STATE, true); return mSharePre.getBoolean(mDeviceNum+Constant.USER_ID+CONTINUS_TAKE_PHOTO_STATE, true);
} }
@ -159,7 +159,7 @@ public class ShareUtil {
return ; return ;
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.SELECT_CAMERA_STATE, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.SELECT_CAMERA_STATE, Context.MODE_PRIVATE);
} }
editor=mSharePre.edit(); editor=mSharePre.edit();
@ -178,9 +178,9 @@ public class ShareUtil {
return false; return false;
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.CAMERA_CONNECT_STATE, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.CAMERA_CONNECT_STATE, Context.MODE_PRIVATE);
} }
return mSharePre.getBoolean(mDeviceNum+SystemConstant.USER_ID+CAMERA_CONNECT_STATE, false); return mSharePre.getBoolean(mDeviceNum+Constant.USER_ID+CAMERA_CONNECT_STATE, false);
} }
/** /**
@ -197,7 +197,7 @@ public class ShareUtil {
return ; return ;
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.CAMERA_CONNECT_STATE, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.CAMERA_CONNECT_STATE, Context.MODE_PRIVATE);
} }
editor=mSharePre.edit(); editor=mSharePre.edit();
@ -216,10 +216,10 @@ public class ShareUtil {
return 0; return 0;
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.TAKE_CAMERA_MODE, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.TAKE_CAMERA_MODE, Context.MODE_PRIVATE);
} }
return mSharePre.getInt(mDeviceNum+SystemConstant.USER_ID+TAKE_CAMERA_MODE, mDeviceNum==1?0:1); return mSharePre.getInt(mDeviceNum+Constant.USER_ID+TAKE_CAMERA_MODE, mDeviceNum==1?0:1);
} }
@ -238,7 +238,7 @@ public class ShareUtil {
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.TAKE_CAMERA_MODE, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.TAKE_CAMERA_MODE, Context.MODE_PRIVATE);
} }
editor=mSharePre.edit(); editor=mSharePre.edit();
@ -257,9 +257,9 @@ public class ShareUtil {
return ""; return "";
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.TAKE_CAMERA_IP, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.TAKE_CAMERA_IP, Context.MODE_PRIVATE);
} }
String ip=mSharePre.getString(mDeviceNum+SystemConstant.USER_ID+TAKE_CAMERA_IP, ""); String ip=mSharePre.getString(mDeviceNum+Constant.USER_ID+TAKE_CAMERA_IP, "");
return ip; return ip;
} }
@ -277,7 +277,7 @@ public class ShareUtil {
return ; return ;
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.TAKE_CAMERA_IP, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.TAKE_CAMERA_IP, Context.MODE_PRIVATE);
} }
editor=mSharePre.edit(); editor=mSharePre.edit();
@ -297,9 +297,9 @@ public class ShareUtil {
return ""; return "";
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.TAKE_CAMERA_MAC, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.TAKE_CAMERA_MAC, Context.MODE_PRIVATE);
} }
String mac=mSharePre.getString(mDeviceNum+SystemConstant.USER_ID+TAKE_CAMERA_MAC, ""); String mac=mSharePre.getString(mDeviceNum+Constant.USER_ID+TAKE_CAMERA_MAC, "");
return mac; return mac;
} }
@ -317,7 +317,7 @@ public class ShareUtil {
return ; return ;
if(mSharePre==null){ if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.TAKE_CAMERA_MAC, Context.MODE_PRIVATE); mSharePre = mContext.getSharedPreferences(Constant.TAKE_CAMERA_MAC, Context.MODE_PRIVATE);
} }
editor=mSharePre.edit(); editor=mSharePre.edit();

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true" android:color="@color/blue"/> <item android:state_enabled="true" android:color="@color/deepskyblue"/>
<item android:state_enabled="false" android:color="@color/text_hint_gray"/> <item android:state_enabled="false" android:color="@color/text_hint_gray"/>
</selector> </selector>

View File

@ -0,0 +1,6 @@
<vector android:height="24dp" android:tint="#1717E0"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0"/>
<path android:fillColor="@android:color/white" android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z"/>
</vector>

View File

@ -1,4 +1,4 @@
<vector android:height="24dp" android:tint="#18FD00" <vector android:height="24dp" android:tint="#1717E0"
android:viewportHeight="24" android:viewportWidth="24" android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,15c1.66,0 2.99,-1.34 2.99,-3L15,6c0,-1.66 -1.34,-3 -3,-3S9,4.34 9,6v6c0,1.66 1.34,3 3,3zM17.3,12c0,3 -2.54,5.1 -5.3,5.1S6.7,15 6.7,12L5,12c0,3.42 2.72,6.23 6,6.72L11,22h2v-3.28c3.28,-0.48 6,-3.3 6,-6.72h-1.7z"/> <path android:fillColor="@android:color/white" android:pathData="M12,15c1.66,0 2.99,-1.34 2.99,-3L15,6c0,-1.66 -1.34,-3 -3,-3S9,4.34 9,6v6c0,1.66 1.34,3 3,3zM17.3,12c0,3 -2.54,5.1 -5.3,5.1S6.7,15 6.7,12L5,12c0,3.42 2.72,6.23 6,6.72L11,22h2v-3.28c3.28,-0.48 6,-3.3 6,-6.72h-1.7z"/>

View File

@ -0,0 +1,9 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<size android:height="2dp"/>
<stroke
android:color="@color/skyblue"
android:dashWidth="2px"
android:dashGap="2px"
android:width="1dp"/>
</shape>

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/cv_bg_color" android:background="@color/ivory"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingRight="10dp" android:paddingRight="10dp"
android:paddingTop="5dp" android:paddingTop="5dp"
@ -15,19 +15,18 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="省市名称" android:text="省市名称"
android:textColor="@color/white" style="@style/map_size_font_style"
android:textSize="@dimen/default_font_size" /> android:textSize="@dimen/default_font_size" />
<TextView <TextView
android:id="@+id/offline_map_city_size" android:id="@+id/offline_map_city_size"
style="@style/map_size_font_style" style="@style/content_font_default_size_13sp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/offline_map_city_name" android:layout_below="@id/offline_map_city_name"
android:drawableLeft="@mipmap/point_blue" android:drawableLeft="@mipmap/point_blue"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:text="文件大小" android:text="文件大小" />
android:textSize="@dimen/card_title_font_3size" />
<TextView <TextView
@ -52,8 +51,7 @@
android:clickable="true" android:clickable="true"
android:focusable="false" android:focusable="false"
android:shadowColor="@android:color/transparent" android:shadowColor="@android:color/transparent"
android:textColor="@color/white" style="@style/content_font_default_size_13sp" />
android:textSize="@dimen/card_title_font_2size" />
<com.navinfo.omqs.ui.widget.MyProgressBar <com.navinfo.omqs.ui.widget.MyProgressBar
android:id="@+id/offline_map_progress" android:id="@+id/offline_map_progress"

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/ivory"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
tools:context="com.navinfo.omqs.ui.fragment.qsrecordlist.QsRecordListAdapter">
<TextView
android:id="@+id/qs_record_classType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@mipmap/point_blue"
android:text="问题分类"
style="@style/content_font_default"
android:textSize="@dimen/default_font_size" />
<TextView
android:id="@+id/qs_record_problemLink"
style="@style/content_font_default"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/qs_record_classType"
android:drawableLeft="@mipmap/point_blue"
android:layout_marginLeft="@dimen/default_widget_padding"
android:text="问题环节" />
<TextView
android:id="@+id/qs_record_problem_type"
style="@style/content_font_default_size_13sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/qs_record_classType"
android:drawableLeft="@mipmap/point_blue"
android:layout_marginTop="5dp"
android:text="问题类型" />
<TextView
android:id="@+id/qs_record_phenomenon"
style="@style/content_font_default_size_13sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/qs_record_problem_type"
android:layout_below="@id/qs_record_classType"
android:drawableLeft="@mipmap/point_blue"
android:layout_marginLeft="@dimen/default_widget_padding"
android:layout_marginTop="5dp"
android:text="问题现象" />
</RelativeLayout>

View File

@ -4,28 +4,50 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/cv_bg_color" android:background="@color/ivory"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp" android:paddingTop="5dp"
android:paddingRight="10dp"
tools:context="com.navinfo.omqs.ui.fragment.tasklist.TaskListAdapter"> tools:context="com.navinfo.omqs.ui.fragment.tasklist.TaskListAdapter">
<TextView <TextView
android:id="@+id/task_name" android:id="@+id/task_name"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="省市名称" android:layout_toLeftOf="@id/task_download_btn"
android:text="任务名称"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/default_font_size" /> android:textSize="@dimen/default_font_size" />
<TextView
android:id="@+id/task_city_name"
style="@style/map_size_font_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/task_name"
android:layout_marginTop="5dp"
android:text="省市名称"
android:textSize="@dimen/card_title_font_3size" />
<TextView
android:id="@+id/task_data_version"
style="@style/map_size_font_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/task_city_name"
android:layout_alignTop="@id/task_city_name"
android:layout_marginLeft="5dp"
android:text="版本号"
android:textSize="@dimen/card_title_font_3size" />
<TextView <TextView
android:id="@+id/task_size" android:id="@+id/task_size"
style="@style/map_size_font_style" style="@style/map_size_font_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/task_name" android:layout_below="@id/task_city_name"
android:drawableLeft="@mipmap/point_blue"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:drawableLeft="@mipmap/point_blue"
android:text="文件大小" android:text="文件大小"
android:textSize="@dimen/card_title_font_3size" /> android:textSize="@dimen/card_title_font_3size" />
@ -34,9 +56,9 @@
android:id="@+id/task_download_btn" android:id="@+id/task_download_btn"
style="@style/map_download_style_btn" style="@style/map_download_style_btn"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_alignTop="@id/task_name"
android:layout_alignBottom="@id/task_size"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="center"
android:shadowColor="@android:color/transparent" android:shadowColor="@android:color/transparent"
android:text="下载" android:text="下载"
android:textColor="@color/btn_blue_solid" android:textColor="@color/btn_blue_solid"
@ -60,8 +82,8 @@
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="16dp" android:layout_height="16dp"
android:layout_below="@id/task_download_btn" android:layout_below="@id/task_size"
android:progressDrawable="@drawable/progress_bg"
android:paddingTop="10dp" android:paddingTop="10dp"
android:progressDrawable="@drawable/progress_bg"
android:visibility="invisible" /> android:visibility="invisible" />
</RelativeLayout> </RelativeLayout>

View File

@ -4,10 +4,11 @@
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<data> <data>
<variable <variable
name="fragment" name="fragment"
type="com.navinfo.omqs.ui.fragment.evaluationresult.EvaluationResultFragment" type="com.navinfo.omqs.ui.fragment.evaluationresult.EvaluationResultFragment" />
/>
<variable <variable
name="viewModel" name="viewModel"
type="com.navinfo.omqs.ui.fragment.evaluationresult.EvaluationResultViewModel" /> type="com.navinfo.omqs.ui.fragment.evaluationresult.EvaluationResultViewModel" />
@ -42,7 +43,7 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:padding="10dp" android:padding="10dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toTopOf="@id/evaluation_camera"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/evaluation_appbar_layout"> app:layout_constraintTop_toBottomOf="@id/evaluation_appbar_layout">
@ -59,77 +60,98 @@
<TextView <TextView
android:id="@+id/evaluation_class_type" android:id="@+id/evaluation_class_type"
android:text="@{viewModel.liveDataQsRecordBean.classType}"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:background="@drawable/fm_card_map_down_status_bg"
android:onClick="@{fragment.onClick}" android:onClick="@{fragment.onClick}"
android:background="@drawable/fm_card_map_down_status_bg" /> android:text="@{viewModel.liveDataQsRecordBean.classType}" />
<TextView <TextView
android:id="@+id/evaluation_problem_type" android:id="@+id/evaluation_problem_type"
android:text="@{viewModel.liveDataQsRecordBean.problemType}"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:background="@drawable/fm_card_map_down_status_bg"
android:onClick="@{fragment.onClick}" android:onClick="@{fragment.onClick}"
android:background="@drawable/fm_card_map_down_status_bg" /> android:text="@{viewModel.liveDataQsRecordBean.problemType}" />
<TextView <TextView
android:id="@+id/evaluation_phenomenon" android:id="@+id/evaluation_phenomenon"
android:text="@{viewModel.liveDataQsRecordBean.phenomenon}"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:background="@drawable/fm_card_map_down_status_bg"
android:onClick="@{fragment.onClick}" android:onClick="@{fragment.onClick}"
android:background="@drawable/fm_card_map_down_status_bg" /> android:text="@{viewModel.liveDataQsRecordBean.phenomenon}" />
<TextView <TextView
android:id="@+id/evaluation_link" android:id="@+id/evaluation_link"
android:text="@{viewModel.liveDataQsRecordBean.problemLink}"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:background="@drawable/fm_card_map_down_status_bg"
android:onClick="@{fragment.onClick}" android:onClick="@{fragment.onClick}"
android:background="@drawable/fm_card_map_down_status_bg" /> android:text="@{viewModel.liveDataQsRecordBean.problemLink}" />
<TextView <TextView
android:id="@+id/evaluation_cause" android:id="@+id/evaluation_cause"
android:text="@{viewModel.liveDataQsRecordBean.cause}"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:background="@drawable/fm_card_map_down_status_bg"
android:onClick="@{fragment.onClick}" android:onClick="@{fragment.onClick}"
android:background="@drawable/fm_card_map_down_status_bg" /> android:text="@{viewModel.liveDataQsRecordBean.cause}" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="备注信息" /> android:text="备注信息" />
<com.navinfo.omqs.ui.widget.MyEditeText <com.navinfo.omqs.ui.widget.MyEditeText
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="请输入备注信息"
android:gravity="start"
android:maxLines="3"
android:lines="3"
android:text="@={viewModel.liveDataQsRecordBean.description}"
android:inputType="textMultiLine"
android:background="@drawable/fm_card_map_down_status_bg" android:background="@drawable/fm_card_map_down_status_bg"
/> android:gravity="start"
<!-- <com.google.android.material.tabs.TabLayout--> android:hint="请输入备注信息"
<!-- android:id="@+id/evaluation_class_tab_layout"--> android:inputType="textMultiLine"
<!-- android:layout_width="match_parent"--> android:lines="3"
<!-- android:layout_height="wrap_content"--> android:maxLines="3"
<!-- android:layout_marginTop="5dp" />--> android:text="@={viewModel.liveDataQsRecordBean.description}" />
<!-- <androidx.viewpager2.widget.ViewPager2--> <View
<!-- android:id="@+id/evaluation_viewpager"--> android:layout_width="match_parent"
<!-- android:layout_width="match_parent"--> android:layout_height="1dp"
<!-- android:layout_height="match_parent"--> android:layout_margin="5dp"
<!-- android:layout_marginTop="5dp" />--> android:background="@color/gray_121" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/evaluation_voice_recyclerview"
android:layout_width="match_parent"
android:layout_height="80dp" />
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<ImageView
android:id="@+id/evaluation_camera"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:src="@drawable/baseline_camera_alt_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/evaluation_voice" />
<ImageView
android:id="@+id/evaluation_voice"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:src="@drawable/baseline_keyboard_voice_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toRightOf="@id/evaluation_camera"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".ui.fragment.qsrecordlist.QsRecordListFragment">
<EditText
android:id="@+id/task_search"
style="@style/input_blue_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="搜索"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/qs_recyclerview"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/task_search"
app:layout_constraintVertical_bias="0.0"
tools:layout_editor_absoluteX="0dp" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -7,6 +7,28 @@
android:background="@color/white" android:background="@color/white"
tools:context=".ui.fragment.tasklist.TaskListFragment"> tools:context=".ui.fragment.tasklist.TaskListFragment">
<TextView
android:id="@+id/task_title"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="任务列表"
android:gravity="center"
android:textSize="18sp"
android:textColor="@color/white"
android:background="@color/default_blue"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/task_back"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:src="@drawable/btn_back_xml"
android:paddingLeft="15dp"
android:paddingRight="10dp"
app:layout_constraintLeft_toLeftOf="@id/task_title"
app:layout_constraintTop_toTopOf="@id/task_title"
app:layout_constraintBottom_toBottomOf="@id/task_title"
/>
<EditText <EditText
android:id="@+id/task_search" android:id="@+id/task_search"
style="@style/input_blue_type" style="@style/input_blue_type"
@ -14,7 +36,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="搜索" android:hint="搜索"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toBottomOf="@id/task_title" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/task_recyclerview" android:id="@+id/task_recyclerview"

View File

@ -32,6 +32,6 @@
android:shadowColor="#BB000000" android:shadowColor="#BB000000"
android:shadowRadius="2.75" android:shadowRadius="2.75"
android:textAppearance="@android:style/TextAppearance.Small" android:textAppearance="@android:style/TextAppearance.Small"
android:textColor="@android:color/background_light" /> android:textColor="@android:color/white" />
</LinearLayout> </LinearLayout>

View File

@ -37,9 +37,9 @@
android:icon="@drawable/baseline_person_24" android:icon="@drawable/baseline_person_24"
android:title="任务列表" /> android:title="任务列表" />
<item <item
android:id="@+id/personal_center_menu_offline_map3" android:id="@+id/personal_center_menu_qs_record_list"
android:icon="@drawable/baseline_person_24" android:icon="@drawable/baseline_person_24"
android:title="menu_home" /> android:title="我的数据" />
<item <item
android:id="@+id/personal_center_menu_offline_map4" android:id="@+id/personal_center_menu_offline_map4"
android:icon="@drawable/baseline_person_24" android:icon="@drawable/baseline_person_24"

View File

@ -29,4 +29,12 @@
tools:layout="@layout/fragment_task_list"> tools:layout="@layout/fragment_task_list">
</fragment> </fragment>
<fragment
android:id="@+id/QsRecordListFragment"
android:name="com.navinfo.omqs.ui.fragment.qsrecordlist.QsRecordListFragment"
android:label="我的数据"
tools:layout="@layout/fragment_qs_record_list">
</fragment>
</navigation> </navigation>

View File

@ -1,17 +1,160 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="red">#FF0000</color>
<color name="transp">#00000000</color> <color name="transp">#00000000</color>
<color name="orange">#ff8d36</color>
<color name="blue" comment="应用主要色调">#1abbfe</color>
<color name="line_gray" comment="轻度灰色,一般用于下划线,不可点击按钮的边框">#dadade</color> <color name="line_gray" comment="轻度灰色,一般用于下划线,不可点击按钮的边框">#dadade</color>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="white">#FFFFFF</color> <!--白色 -->
<color name="ivory">#FFFFF0</color> <!--象牙色 -->
<color name="lightyellow">#FFFFE0</color> <!--亮黄色 -->
<color name="yellow">#FFFF00</color> <!--黄色 -->
<color name="snow">#FFFAFA</color> <!--雪白色 -->
<color name="floralwhite">#FFFAF0</color> <!--花白色 -->
<color name="lemonchiffon">#FFFACD</color> <!--柠檬绸色 -->
<color name="cornsilk">#FFF8DC</color> <!--米绸色 -->
<color name="seashell">#FFF5EE</color> <!--海贝色 -->
<color name="lavenderblush">#FFF0F5</color> <!--淡紫红 -->
<color name="papayawhip">#FFEFD5</color> <!--番木色 -->
<color name="blanchedalmond">#FFEBCD</color> <!--白杏色 -->
<color name="mistyrose">#FFE4E1</color> <!--浅玫瑰色 -->
<color name="bisque">#FFE4C4</color> <!--桔黄色 -->
<color name="moccasin">#FFE4B5</color> <!--鹿皮色 -->
<color name="navajowhite">#FFDEAD</color> <!--纳瓦白 -->
<color name="peachpuff">#FFDAB9</color> <!--桃色 -->
<color name="gold">#FFD700</color> <!--金色 -->
<color name="pink">#FFC0CB</color> <!--粉红色 -->
<color name="lightpink">#FFB6C1</color> <!--亮粉红色 -->
<color name="orange">#FFA500</color> <!--橙色 -->
<color name="lightsalmon">#FFA07A</color> <!--亮肉色 -->
<color name="darkorange">#FF8C00</color> <!--暗桔黄色 -->
<color name="coral">#FF7F50</color> <!--珊瑚色 -->
<color name="hotpink">#FF69B4</color> <!--热粉红色 -->
<color name="tomato">#FF6347</color> <!--西红柿色 -->
<color name="orangered">#FF4500</color> <!--红橙色 -->
<color name="deeppink">#FF1493</color> <!--深粉红色 -->
<color name="fuchsia">#FF00FF</color> <!--紫红色 -->
<color name="magenta">#FF00FF</color> <!--红紫色 -->
<color name="red">#FF0000</color> <!--红色 -->
<color name="oldlace">#FDF5E6</color> <!--老花色 -->
<color name="lightgoldenrodyellow">#FAFAD2</color> <!--亮金黄色 -->
<color name="linen">#FAF0E6</color> <!--亚麻色 -->
<color name="antiquewhite">#FAEBD7</color> <!--古董白 -->
<color name="salmon">#FA8072</color> <!--鲜肉色 -->
<color name="ghostwhite">#F8F8FF</color> <!--幽灵白 -->
<color name="mintcream">#F5FFFA</color> <!--薄荷色 -->
<color name="whitesmoke">#F5F5F5</color> <!--烟白色 -->
<color name="beige">#F5F5DC</color> <!--米色 -->
<color name="wheat">#F5DEB3</color> <!--浅黄色 -->
<color name="sandybrown">#F4A460</color> <!--沙褐色 -->
<color name="azure">#F0FFFF</color> <!--天蓝色 -->
<color name="honeydew">#F0FFF0</color> <!--蜜色 -->
<color name="aliceblue">#F0F8FF</color> <!--艾利斯兰 -->
<color name="khaki">#F0E68C</color> <!--黄褐色 -->
<color name="lightcoral">#F08080</color> <!--亮珊瑚色 -->
<color name="palegoldenrod">#EEE8AA</color> <!--苍麒麟色 -->
<color name="violet">#EE82EE</color> <!--紫罗兰色 -->
<color name="darksalmon">#E9967A</color> <!--暗肉色 -->
<color name="lavender">#E6E6FA</color> <!--淡紫色 -->
<color name="lightcyan">#E0FFFF</color> <!--亮青色 -->
<color name="burlywood">#DEB887</color> <!--实木色 -->
<color name="plum">#DDA0DD</color> <!--洋李色 -->
<color name="gainsboro">#DCDCDC</color> <!--淡灰色 -->
<color name="crimson">#DC143C</color> <!--暗深红色 -->
<color name="palevioletred">#DB7093</color> <!--苍紫罗兰色 -->
<color name="goldenrod">#DAA520</color> <!--金麒麟色 -->
<color name="orchid">#DA70D6</color> <!--淡紫色 -->
<color name="thistle">#D8BFD8</color> <!--蓟色 -->
<color name="lightgray">#D3D3D3</color> <!--亮灰色 -->
<color name="lightgrey">#D3D3D3</color> <!--亮灰色 -->
<color name="tan">#D2B48C</color> <!--茶色 -->
<color name="chocolate">#D2691E</color> <!--巧可力色 -->
<color name="peru">#CD853F</color> <!--秘鲁色 -->
<color name="indianred">#CD5C5C</color> <!--印第安红 -->
<color name="mediumvioletred">#C71585</color> <!--中紫罗兰色 -->
<color name="silver">#C0C0C0</color> <!--银色 -->
<color name="darkkhaki">#BDB76B</color> <!--暗黄褐色-->
<color name="rosybrown">#BC8F8F</color> <!--褐玫瑰红 -->
<color name="mediumorchid">#BA55D3</color> <!--中粉紫色 -->
<color name="darkgoldenrod">#B8860B</color> <!--暗金黄色 -->
<color name="firebrick">#B22222</color> <!--火砖色 -->
<color name="powderblue">#B0E0E6</color> <!--粉蓝色 -->
<color name="lightsteelblue">#B0C4DE</color> <!--亮钢兰色-->
<color name="paleturquoise">#AFEEEE</color> <!--苍宝石绿 -->
<color name="greenyellow">#ADFF2F</color> <!--黄绿色 -->
<color name="lightblue">#ADD8E6</color> <!--亮蓝色 -->
<color name="darkgray">#A9A9A9</color> <!--暗灰色 -->
<color name="darkgrey">#A9A9A9</color> <!--暗灰色 -->
<color name="brown">#A52A2A</color> <!--褐色 -->
<color name="sienna">#A0522D</color> <!--赭色 -->
<color name="darkorchid">#9932CC</color> <!--暗紫色 -->
<color name="palegreen">#98FB98</color> <!--苍绿色 -->
<color name="darkviolet">#9400D3</color> <!--暗紫罗兰色 -->
<color name="mediumpurple">#9370DB</color> <!--中紫色 -->
<color name="lightgreen">#90EE90</color> <!--亮绿色 -->
<color name="darkseagreen">#8FBC8F</color> <!--暗海兰色 -->
<color name="saddlebrown">#8B4513</color> <!--重褐色 -->
<color name="darkmagenta">#8B008B</color> <!--暗洋红 -->
<color name="darkred">#8B0000</color> <!--暗红色 -->
<color name="blueviolet">#8A2BE2</color> <!--紫罗兰蓝色 -->
<color name="lightskyblue">#87CEFA</color> <!--亮天蓝色 -->
<color name="skyblue">#87CEEB</color> <!--天蓝色 -->
<color name="gray">#808080</color> <!--灰色 -->
<color name="grey">#808080</color> <!--灰色 -->
<color name="olive">#808000</color> <!--橄榄色 -->
<color name="purple">#800080</color> <!--紫色 -->
<color name="maroon">#800000</color> <!--粟色 -->
<color name="aquamarine">#7FFFD4</color> <!--碧绿色 -->
<color name="chartreuse">#7FFF00</color> <!--黄绿色 -->
<color name="lawngreen">#7CFC00</color> <!--草绿色 -->
<color name="mediumslateblue">#7B68EE</color> <!--中暗蓝色 -->
<color name="lightslategray">#778899</color> <!--亮蓝灰 -->
<color name="lightslategrey">#778899</color> <!--亮蓝灰 -->
<color name="slategray">#708090</color> <!--灰石色 -->
<color name="slategrey">#708090</color> <!--灰石色 -->
<color name="olivedrab">#6B8E23</color> <!--深绿褐色 -->
<color name="slateblue">#6A5ACD</color> <!--石蓝色 -->
<color name="dimgray">#696969</color> <!--暗灰色 -->
<color name="dimgrey">#696969</color> <!--暗灰色 -->
<color name="mediumaquamarine">#66CDAA</color> <!--中绿色 -->
<color name="cornflowerblue">#6495ED</color> <!--菊兰色 -->
<color name="cadetblue">#5F9EA0</color> <!--军兰色 -->
<color name="darkolivegreen">#556B2F</color> <!--暗橄榄绿-->
<color name="indigo">#4B0082</color> <!--靛青色 -->
<color name="mediumturquoise">#48D1CC</color> <!--中绿宝石 -->
<color name="darkslateblue">#483D8B</color> <!--暗灰蓝色 -->
<color name="steelblue">#4682B4</color> <!--钢兰色 -->
<color name="royalblue">#4169E1</color> <!--皇家蓝 -->
<color name="turquoise">#40E0D0</color> <!--青绿色 -->
<color name="mediumseagreen">#3CB371</color> <!--中海蓝 -->
<color name="limegreen">#32CD32</color> <!--橙绿色 -->
<color name="darkslategray">#2F4F4F</color> <!--暗瓦灰色 -->
<color name="darkslategrey">#2F4F4F</color> <!--暗瓦灰色 -->
<color name="seagreen">#2E8B57</color> <!--海绿色 -->
<color name="forestgreen">#228B22</color> <!--森林绿 -->
<color name="lightseagreen">#20B2AA</color> <!--亮海蓝色 -->
<color name="dodgerblue">#1E90FF</color> <!--闪兰色 -->
<color name="midnightblue">#191970</color> <!--中灰兰色 -->
<color name="aqua">#00FFFF</color> <!--浅绿色 -->
<color name="cyan">#00FFFF</color> <!--青色 -->
<color name="springgreen">#00FF7F</color> <!--春绿色 -->
<color name="lime">#00FF00</color> <!--酸橙色 -->
<color name="mediumspringgreen">#00FA9A</color> <!--中春绿色 -->
<color name="darkturquoise">#00CED1</color> <!--暗宝石绿 -->
<color name="deepskyblue">#00BFFF</color> <!--深天蓝色 -->
<color name="darkcyan">#008B8B</color> <!--暗青色 -->
<color name="teal">#008080</color> <!--水鸭色 -->
<color name="green">#008000</color> <!--绿色 -->
<color name="darkgreen">#006400</color> <!--暗绿色 -->
<color name="blue">#0000FF</color> <!--蓝色 -->
<color name="mediumblue">#0000CD</color> <!--中兰色 -->
<color name="darkblue">#00008B</color> <!--暗蓝色 -->
<color name="navy">#000080</color> <!--海军色 -->
<color name="black">#000000</color> <!--黑色 -->
<color name="cv_gray_153">#999999</color> <color name="cv_gray_153">#999999</color>
<color name="cvm_red">#FF3B30</color> <color name="cvm_red">#FF3B30</color>
<color name="cv_bg_color">#553C3F41</color>
<color name="btn_blue_solid">#108ee9</color> <color name="btn_blue_solid">#108ee9</color>
<color name="background_light">#ffffffff</color>
<!-- 一键连接对话框背景色 --> <!-- 一键连接对话框背景色 -->
<color name="bg_gray2">#d1d1d1</color> <color name="bg_gray2">#d1d1d1</color>
<!-- 一键连接时间显示区域背景色 --> <!-- 一键连接时间显示区域背景色 -->

View File

@ -6,7 +6,7 @@
<dimen name="nav_header_vertical_spacing">8dp</dimen> <dimen name="nav_header_vertical_spacing">8dp</dimen>
<dimen name="nav_header_height">176dp</dimen> <dimen name="nav_header_height">176dp</dimen>
<dimen name="default_widget_padding">10dp</dimen> <dimen name="default_widget_padding">10dp</dimen>
<dimen name="default_font_size" comment="默认字体大小style中父最顶层">15dp</dimen> <dimen name="default_font_size" comment="默认字体大小style中父最顶层">15sp</dimen>
<dimen name="card_title_font_2size">13sp</dimen> <dimen name="card_title_font_2size">13sp</dimen>
<dimen name="card_title_font_3size">10sp</dimen> <dimen name="card_title_font_3size">10sp</dimen>
<dimen name="one">1dp</dimen> <dimen name="one">1dp</dimen>

View File

@ -17,17 +17,27 @@
<!-- 默认字体 --> <!-- 默认字体 -->
<style name="content_font_default"> <style name="content_font_default">
<item name="android:gravity">center_vertical</item> <item name="android:gravity">center_vertical</item>
<item name="android:textSize">15dp</item> <item name="android:textSize">@dimen/default_font_size</item>
<item name="android:textColor">@color/black</item>
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
</style> </style>
<!-- 默认字体 -->
<style name="content_font_default_size_13sp">
<item name="android:gravity">center_vertical</item>
<item name="android:textSize">@dimen/card_title_font_2size</item>
<item name="android:textColor">@color/black</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
<!-- 输入框基本样式 --> <!-- 输入框基本样式 -->
<style name="input_blue_type" parent="content_font_default"> <style name="input_blue_type" parent="content_font_default">
<item name="android:textSize">16sp</item> <item name="android:textSize">16sp</item>
<item name="android:background">#FFFFFF</item> <item name="android:background">#FFFFFF</item>
<item name="android:textColor">#1890ff</item> <item name="android:textColor">#1890ff</item>
<item name="android:textColorHint">@color/text_hint_gray</item>
<item name="android:padding">10dp</item> <item name="android:padding">10dp</item>
<item name="android:imeOptions">actionDone</item> <item name="android:imeOptions">actionDone</item>
<item name="android:singleLine">true</item> <item name="android:singleLine">true</item>
@ -38,7 +48,7 @@
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:drawablePadding">4dp</item> <item name="android:drawablePadding">4dp</item>
<item name="android:textColor">@color/white</item> <item name="android:textColor">@color/black</item>
<item name="android:textSize">9sp</item> <item name="android:textSize">9sp</item>
<item name="android:focusable">false</item> <item name="android:focusable">false</item>
<item name="android:clickable">false</item> <item name="android:clickable">false</item>

View File

@ -18,10 +18,6 @@ android {
compileSdk 30 compileSdk 30
defaultConfig { defaultConfig {
minSdk 23
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro" consumerProguardFiles "consumer-rules.pro"
@ -132,7 +128,7 @@ dependencies {
androidTestImplementation "android.arch.persistence.room:testing:1.1.1" androidTestImplementation "android.arch.persistence.room:testing:1.1.1"
api 'com.tencent.wcdb:wcdb-android:1.1-19' api 'com.tencent.wcdb:wcdb-android:1.1-19'
//api 'de.mrmaffen:libvlc-android:2.1.12@aar'
// // // //
// implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4' // implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
// // Android支持库 // // Android支持库

Binary file not shown.

Binary file not shown.

View File

@ -12,6 +12,9 @@
<meta-data <meta-data
android:name="com.baidu.lbsapi.API_KEY" android:name="com.baidu.lbsapi.API_KEY"
android:value="IxQi4mZGTlfv6Z9M2GRdqn4KKRbOATUU" /> android:value="IxQi4mZGTlfv6Z9M2GRdqn4KKRbOATUU" />
<!--<meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="IxQi4mZGTlfv6Z9M2GRdqn4KKRbOATUU" />--><!--BMnHEAZ8Ypq44GOBf4UqENgvCmncfFU6-->
<application <application
android:allowBackup="true" android:allowBackup="true"
android:networkSecurityConfig="@xml/network_security_config"> android:networkSecurityConfig="@xml/network_security_config">

View File

@ -32,7 +32,6 @@ import org.oscim.backend.CanvasAdapter
import org.oscim.backend.canvas.Bitmap import org.oscim.backend.canvas.Bitmap
import org.oscim.backend.canvas.Paint import org.oscim.backend.canvas.Paint
import org.oscim.core.GeoPoint import org.oscim.core.GeoPoint
import org.oscim.event.EventListener
import org.oscim.layers.GroupLayer import org.oscim.layers.GroupLayer
import org.oscim.layers.marker.MarkerInterface import org.oscim.layers.marker.MarkerInterface
import org.oscim.layers.marker.MarkerItem import org.oscim.layers.marker.MarkerItem
@ -56,23 +55,6 @@ open class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tr
private var baseGroupLayer // 用于盛放所有基础底图的图层组,便于统一管理 private var baseGroupLayer // 用于盛放所有基础底图的图层组,便于统一管理
: GroupLayer? = null : GroupLayer? = null
protected val mTracePath:String = tracePath protected val mTracePath:String = tracePath
/**
* 默认文字颜色
*/
private val mDefaultTextColor = "#4E55AF"
/**
* 文字画笔
*/
private lateinit var paint: Paint
//画布
private lateinit var canvas: org.oscim.backend.canvas.Canvas
private lateinit var itemizedLayer: MyItemizedLayer
private lateinit var markerRendererFactory: MarkerRendererFactory
private var resId = R.mipmap.map_icon_point_add
private var itemListener: OnQsRecordItemClickListener? = null
/** /**
* 轨迹渲染图层 * 轨迹渲染图层
@ -88,6 +70,7 @@ open class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tr
* 增加作业渲染 * 增加作业渲染
*/ */
private lateinit var labelNiLocationLayer: LabelLayer private lateinit var labelNiLocationLayer: LabelLayer
/** /**
* 显示待测评OMDB数据的图层 * 显示待测评OMDB数据的图层
* */ * */
@ -108,8 +91,6 @@ open class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tr
private fun initMap() { private fun initMap() {
loadBaseMap() loadBaseMap()
//初始化之间数据图层
initQsRecordDataLayer()
initOMDBVectorTileLayer() initOMDBVectorTileLayer()
@ -131,26 +112,10 @@ open class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tr
mMapView.switchTileVectorLayerTheme(NIMapView.MAP_THEME.DEFAULT) mMapView.switchTileVectorLayerTheme(NIMapView.MAP_THEME.DEFAULT)
//初始化之间数据图层
initQsRecordDataLayer()
mMapView.updateMap() mMapView.updateMap()
// initMapLifeSource() // initMapLifeSource()
// 设置矢量图层均在12级以上才显示
mMapView.vtmMap.events.bind(UpdateListener { e, mapPosition ->
if (e == org.oscim.map.Map.SCALE_EVENT) {
itemizedLayer.isEnabled = mapPosition.getZoomLevel() >= 12
// 测评数据图层在指定Zoom后开始显示
val isOmdbZoom = mapPosition.zoomLevel>=Constant.OMDB_MIN_ZOOM
baseGroupLayer?.layers?.forEach {
it.isEnabled = !isOmdbZoom
}
omdbVectorTileLayer.isEnabled = isOmdbZoom
omdbLabelLayer.isEnabled = isOmdbZoom
}
})
} }
private fun initOMDBVectorTileLayer() { private fun initOMDBVectorTileLayer() {
@ -228,405 +193,6 @@ open class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tr
mMapView.updateMap() mMapView.updateMap()
} }
fun setOnQsRecordItemClickListener(listener: OnQsRecordItemClickListener?) {
itemListener = listener
}
/**
* 增加或更新marker
*/
suspend fun addOrUpdateQsRecordMark(data: QsRecordBean) {
for (item in itemizedLayer.itemList) {
if (item is MarkerItem) {
if (item.title == data.id) {
itemizedLayer.itemList.remove(item)
break
}
}
}
createMarkerItem(data)
withContext(Dispatchers.Main) {
mMapView.updateMap(true)
}
}
/**
* 删除marker
*/
suspend fun removeQsRecordMark(data: QsRecordBean) {
for (item in itemizedLayer.itemList) {
if (item is MarkerItem) {
if (item.title == data.id) {
itemizedLayer.itemList.remove(item)
itemizedLayer.populate()
return
}
}
}
}
/**
* 初始话质检数据图层
*/
private fun initQsRecordDataLayer() {
canvas = CanvasAdapter.newCanvas()
paint = CanvasAdapter.newPaint()
paint.setTypeface(Paint.FontFamily.DEFAULT, Paint.FontStyle.NORMAL)
paint.setTextSize(NUM_13 * CanvasAdapter.getScale())
paint.strokeWidth = 2 * CanvasAdapter.getScale()
paint.color = Color.parseColor(mDefaultTextColor)
val bitmapPoi: Bitmap = AndroidBitmap(
BitmapFactory.decodeResource(
mContext.resources,
R.mipmap.map_icon_blue2
)
)
val symbol = MarkerSymbol(bitmapPoi, MarkerSymbol.HotspotPlace.BOTTOM_CENTER)
markerRendererFactory = MarkerRendererFactory { markerLayer ->
object : ClusterMarkerRenderer(
mContext,
markerLayer,
symbol,
ClusterStyle(
org.oscim.backend.canvas.Color.WHITE,
org.oscim.backend.canvas.Color.BLUE
)
) {
// override fun getClusterBitmap(size: Int): Bitmap? {
// return super.getclusterbitmap(size)
// }
}
}
itemizedLayer =
MyItemizedLayer(
mMapView.vtmMap,
mutableListOf(),
markerRendererFactory,
object : MyItemizedLayer.OnItemGestureListener {
override fun onItemSingleTapUp(
list: MutableList<Int>,
nearest: Int
): Boolean {
itemListener?.let {
val idList = mutableListOf<String>()
if (list.size == 0) {
} else {
for (i in list) {
val markerInterface: MarkerInterface =
itemizedLayer.itemList[i]
if (markerInterface is MarkerItem) {
idList.add(markerInterface.title)
}
}
it.onQsRecordList(idList.distinct().toMutableList())
}
}
return true
}
override fun onItemLongPress(
list: MutableList<Int>?,
nearest: Int
): Boolean {
return true
}
})
addLayer(itemizedLayer, NIMapView.LAYER_GROUPS.OPERATE)
mContext.lifecycleScope.launch(Dispatchers.IO) {
var list = mutableListOf<QsRecordBean>()
val realm = Realm.getDefaultInstance()
Log.e("jingo","realm hashCOde ${realm.hashCode()}")
realm.executeTransaction {
val objects = realm.where<QsRecordBean>().findAll()
list = realm.copyFromRealm(objects)
}
// realm.close()
for (item in list) {
createMarkerItem(item)
}
}
}
private suspend fun createMarkerItem(item: QsRecordBean) {
val bitmap: Bitmap = createTextMarkerBitmap(mContext, item.description, resId)
if (item.t_lifecycle != 2) {
val geometry: Geometry? = GeometryTools.createGeometry(item.geometry)
if (geometry != null) {
var geoPoint: GeoPoint? = null
if (geometry.geometryType != null) {
when (geometry.geometryType.uppercase(Locale.getDefault())) {
"POINT" -> geoPoint =
GeoPoint(geometry.coordinate.y, geometry.coordinate.x)
// "LINESTRING" -> {
// val lineString = geometry as LineString
// if (lineString != null && lineString.coordinates.size > 0) {
// geoPoint = GeoPoint(
// lineString.coordinates[0].y,
// lineString.coordinates[0].x
// )
// }
// val drawableLine: Drawable =
// convertGeometry2Drawable(geometry, lineStyle)
// if (drawableLine != null) {
// dataVectorLayer.add(drawableLine)
// }
// }
// "POLYGON" -> {
// val polygon = geometry as Polygon
// if (polygon != null && polygon.coordinates.size > 0) {
// geoPoint = GeoPoint(
// polygon.coordinates[0].y,
// polygon.coordinates[0].x
// )
// }
// val drawablePolygon: Drawable =
// convertGeometry2Drawable(geometry, polygonStyle)
// if (drawablePolygon != null) {
// dataVectorLayer.add(drawablePolygon)
// }
// }
}
}
if (geoPoint != null) {
var geoMarkerItem: MarkerItem
// if (item.getType() === 1) {
geoMarkerItem = ClusterMarkerItem(
1, item.id, item.description, geoPoint
)
// } else {
// geoMarkerItem = MarkerItem(
// ePointTemp.getType(),
// ePointTemp.getId(),
// ePointTemp.getStyleText(),
// geoPoint
// )
// }
val markerSymbol =
MarkerSymbol(bitmap, MarkerSymbol.HotspotPlace.CENTER)
geoMarkerItem.marker = markerSymbol
itemizedLayer.itemList.add(geoMarkerItem)
}
}
}
itemizedLayer.populate()
}
/**
* 文字和图片拼装文字换行
*
* @param context
* @param text
* @param resId
* @return
*/
private fun createTextMarkerBitmap(context: Context, text: String, resId: Int): Bitmap {
var text: String? = text
return if (text == null || text.trim { it <= ' ' }.isEmpty()) {
val drawable = ResourcesCompat.getDrawable(context.resources, resId, null)
val originBitmap = android.graphics.Bitmap.createBitmap(
drawable!!.intrinsicWidth,
drawable.intrinsicHeight * 2,
android.graphics.Bitmap.Config.ARGB_8888
)
val androidCanvas = Canvas(originBitmap)
val startX = (originBitmap.width - drawable.intrinsicWidth) / 2
drawable.setBounds(
startX, 0, startX + drawable.intrinsicWidth, drawable.intrinsicHeight
)
drawable.draw(androidCanvas)
val bitmap: Bitmap = AndroidBitmap(originBitmap)
canvas.setBitmap(bitmap)
bitmap
} else {
val drawable = ResourcesCompat.getDrawable(context.resources, resId, null)
val textList: MutableList<String> = ArrayList()
val fontSize: Float = NUM_13 * CanvasAdapter.getScale()
paint.setTextSize(fontSize)
var maxWidth = 0f
//最多4行一行7个
if (text.trim { it <= ' ' }.length > 24) {
val size = (drawable!!.intrinsicHeight / 4).toFloat()
if (size < fontSize) paint.setTextSize(size)
if (text.trim { it <= ' ' }.length > 28) text = text.substring(0, 26) + "..."
val temp1 = text.substring(0, 7)
textList.add(temp1)
text = text.substring(7)
maxWidth = paint.getTextWidth(temp1)
val temp2 = text.substring(0, 7)
textList.add(temp2)
text = text.substring(7)
var newWidth = paint.getTextWidth(temp2)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
val temp3 = text.substring(0, 7)
textList.add(temp3)
text = text.substring(7)
newWidth = paint.getTextWidth(temp3)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
textList.add(text)
newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 21) {
val size = (drawable!!.intrinsicHeight / 4).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 6)
textList.add(temp1)
text = text.substring(6)
maxWidth = paint.getTextWidth(temp1)
val temp2 = text.substring(0, 6)
textList.add(temp2)
text = text.substring(6)
var newWidth = paint.getTextWidth(temp2)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
val temp3 = text.substring(0, 6)
textList.add(temp3)
text = text.substring(6)
newWidth = paint.getTextWidth(temp3)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
textList.add(text)
newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 18) {
val size = (drawable!!.intrinsicHeight / 3).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 7)
textList.add(temp1)
text = text.substring(7)
maxWidth = paint.getTextWidth(temp1)
val temp2 = text.substring(0, 7)
textList.add(temp2)
text = text.substring(7)
var newWidth = paint.getTextWidth(temp2)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
textList.add(text)
newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 18) {
val size = (drawable!!.intrinsicHeight / 3).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 7)
textList.add(temp1)
text = text.substring(7)
maxWidth = paint.getTextWidth(temp1)
val temp2 = text.substring(0, 7)
textList.add(temp2)
text = text.substring(7)
var newWidth = paint.getTextWidth(temp2)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
textList.add(text)
newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 14) {
val size = (drawable!!.intrinsicHeight / 3).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 6)
textList.add(temp1)
text = text.substring(6)
maxWidth = paint.getTextWidth(temp1)
val temp2 = text.substring(0, 6)
textList.add(temp2)
text = text.substring(6)
var newWidth = paint.getTextWidth(temp2)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
textList.add(text)
newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 12) {
val size = (drawable!!.intrinsicHeight / 2).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 7)
textList.add(temp1)
text = text.substring(7)
maxWidth = paint.getTextWidth(temp1)
textList.add(text)
val newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 10) {
val size = (drawable!!.intrinsicHeight / 2).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 6)
textList.add(temp1)
text = text.substring(6)
maxWidth = paint.getTextWidth(temp1)
textList.add(text)
val newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 7) {
val size = (drawable!!.intrinsicHeight / 2).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 5)
textList.add(temp1)
text = text.substring(5)
maxWidth = paint.getTextWidth(temp1)
textList.add(text)
val newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else {
val size = drawable!!.intrinsicHeight.toFloat()
if (size < fontSize) paint.setTextSize(size)
textList.add(text)
maxWidth = paint.getTextWidth(text)
}
paint.color = Color.parseColor(mDefaultTextColor)
val originBitmap = android.graphics.Bitmap.createBitmap(
if (drawable.intrinsicWidth > maxWidth) drawable.intrinsicWidth else maxWidth.toInt(),
drawable.intrinsicHeight * 2,
android.graphics.Bitmap.Config.ARGB_4444
)
val androidCanvas = Canvas(originBitmap)
val startX = (originBitmap.width - drawable.intrinsicWidth) / 2
drawable.setBounds(
startX, 0, startX + drawable.intrinsicWidth, drawable.intrinsicHeight
)
drawable.draw(androidCanvas)
val bitmap: Bitmap = AndroidBitmap(originBitmap)
canvas.setBitmap(bitmap)
var startHeight = (drawable.intrinsicHeight + paint.getTextHeight(text)).toInt()
for (txt in textList) {
canvas.drawText(
txt, (bitmap.width - paint.getTextWidth(txt)) / 2, startHeight.toFloat(), paint
)
startHeight += paint.getTextHeight(txt).toInt()
}
bitmap
}
}
//显示轨迹图层 //显示轨迹图层
fun showNiLocationLayer() { fun showNiLocationLayer() {
@ -639,12 +205,8 @@ open class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tr
vectorNiLocationTileLayer.isEnabled = false vectorNiLocationTileLayer.isEnabled = false
labelNiLocationLayer.isEnabled = false labelNiLocationLayer.isEnabled = false
} }
} }
interface OnQsRecordItemClickListener {
fun onQsRecordList(list: MutableList<String>)
}
/** /**
* 基础 * 基础

View File

@ -100,7 +100,7 @@ class LocationLayerHandler(context: AppCompatActivity, mapView: NIMapView) : Bas
// locationOption.setOpenAutoNotifyMode() // locationOption.setOpenAutoNotifyMode()
//设置打开自动回调位置模式该开关打开后期间只要定位SDK检测到位置变化就会主动回调给开发者 //设置打开自动回调位置模式该开关打开后期间只要定位SDK检测到位置变化就会主动回调给开发者
locationOption.setOpenAutoNotifyMode( locationOption.setOpenAutoNotifyMode(
1000, 1, LocationClientOption.LOC_SENSITIVITY_HIGHT 5, 1, LocationClientOption.LOC_SENSITIVITY_HIGHT
) )
//需将配置好的LocationClientOption对象通过setLocOption方法传递给LocationClient对象使用 //需将配置好的LocationClientOption对象通过setLocOption方法传递给LocationClient对象使用
locationClient.locOption = locationOption locationClient.locOption = locationOption

View File

@ -2,17 +2,36 @@ package com.navinfo.collect.library.map.handler
import android.content.Context import android.content.Context
import android.graphics.BitmapFactory import android.graphics.BitmapFactory
import android.graphics.Canvas
import android.graphics.Color
import android.util.Log
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.res.ResourcesCompat
import androidx.lifecycle.lifecycleScope
import com.navinfo.collect.library.R import com.navinfo.collect.library.R
import com.navinfo.collect.library.data.entity.QsRecordBean
import com.navinfo.collect.library.map.GeoPoint import com.navinfo.collect.library.map.GeoPoint
import com.navinfo.collect.library.map.NIMapView import com.navinfo.collect.library.map.NIMapView
import com.navinfo.collect.library.map.cluster.ClusterMarkerItem
import com.navinfo.collect.library.map.cluster.ClusterMarkerRenderer
import com.navinfo.collect.library.map.layers.MyItemizedLayer
import com.navinfo.collect.library.utils.GeometryTools
import com.navinfo.collect.library.utils.StringUtil import com.navinfo.collect.library.utils.StringUtil
import io.realm.Realm
import io.realm.kotlin.where
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.locationtech.jts.geom.Geometry
import org.oscim.android.canvas.AndroidBitmap import org.oscim.android.canvas.AndroidBitmap
import org.oscim.layers.marker.ItemizedLayer import org.oscim.backend.CanvasAdapter
import org.oscim.backend.canvas.Bitmap
import org.oscim.backend.canvas.Paint
import org.oscim.layers.marker.*
import org.oscim.layers.marker.ItemizedLayer.OnItemGestureListener import org.oscim.layers.marker.ItemizedLayer.OnItemGestureListener
import org.oscim.layers.marker.MarkerInterface import org.oscim.map.Map
import org.oscim.layers.marker.MarkerItem import java.util.*
import org.oscim.layers.marker.MarkerSymbol import kotlin.collections.ArrayList
/** /**
* marker 操作 * marker 操作
@ -23,6 +42,29 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
// //默认marker图层 // //默认marker图层
private var mDefaultMarkerLayer: ItemizedLayer private var mDefaultMarkerLayer: ItemizedLayer
/**
* 默认文字颜色
*/
private val mDefaultTextColor = "#4E55AF"
/**
* 文字画笔
*/
private lateinit var paint: Paint
//画布
private lateinit var canvas: org.oscim.backend.canvas.Canvas
private lateinit var itemizedLayer: MyItemizedLayer
private lateinit var markerRendererFactory: MarkerRendererFactory
private var resId = R.mipmap.map_icon_point_add
private var itemListener: OnQsRecordItemClickListener? = null
/**
* 文字大小
*/
private val NUM_13 = 13
init { init {
//新增marker图标样式 //新增marker图标样式
val mDefaultBitmap = val mDefaultBitmap =
@ -49,6 +91,19 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
} }
) )
addLayer(mDefaultMarkerLayer, NIMapView.LAYER_GROUPS.OPERATE); addLayer(mDefaultMarkerLayer, NIMapView.LAYER_GROUPS.OPERATE);
//初始化之间数据图层
initQsRecordDataLayer()
// 设置矢量图层均在12级以上才显示
mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
if (e == Map.SCALE_EVENT) {
itemizedLayer.isEnabled = mapPosition.getZoomLevel() >= 12
}
})
mMapView.updateMap()
}
fun setOnQsRecordItemClickListener(listener: OnQsRecordItemClickListener?) {
itemListener = listener
} }
//增加marker //增加marker
@ -99,4 +154,404 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
} }
} }
/**
* 增加或更新marker
*/
suspend fun addOrUpdateQsRecordMark(data: QsRecordBean) {
for (item in itemizedLayer.itemList) {
if (item is MarkerItem) {
if (item.title == data.id) {
itemizedLayer.itemList.remove(item)
break
}
}
}
createMarkerItem(data)
withContext(Dispatchers.Main) {
mMapView.updateMap(true)
}
}
/**
* 删除marker
*/
suspend fun removeQsRecordMark(data: QsRecordBean) {
for (item in itemizedLayer.itemList) {
if (item is MarkerItem) {
if (item.title == data.id) {
itemizedLayer.itemList.remove(item)
itemizedLayer.populate()
return
}
}
}
}
/**
* 初始话质检数据图层
*/
private fun initQsRecordDataLayer() {
canvas = CanvasAdapter.newCanvas()
paint = CanvasAdapter.newPaint()
paint.setTypeface(Paint.FontFamily.DEFAULT, Paint.FontStyle.NORMAL)
paint.setTextSize(NUM_13 * CanvasAdapter.getScale())
paint.strokeWidth = 2 * CanvasAdapter.getScale()
paint.color = Color.parseColor(mDefaultTextColor)
val bitmapPoi: Bitmap = AndroidBitmap(
BitmapFactory.decodeResource(
mContext.resources,
R.mipmap.map_icon_blue2
)
)
val symbol = MarkerSymbol(bitmapPoi, MarkerSymbol.HotspotPlace.BOTTOM_CENTER)
markerRendererFactory = MarkerRendererFactory { markerLayer ->
object : ClusterMarkerRenderer(
mContext,
markerLayer,
symbol,
ClusterStyle(
org.oscim.backend.canvas.Color.WHITE,
org.oscim.backend.canvas.Color.BLUE
)
) {
// override fun getClusterBitmap(size: Int): Bitmap? {
// return super.getclusterbitmap(size)
// }
}
}
itemizedLayer =
MyItemizedLayer(
mMapView.vtmMap,
mutableListOf(),
markerRendererFactory,
object : MyItemizedLayer.OnItemGestureListener {
override fun onItemSingleTapUp(
list: MutableList<Int>,
nearest: Int
): Boolean {
itemListener?.let {
val idList = mutableListOf<String>()
if (list.size == 0) {
} else {
for (i in list) {
val markerInterface: MarkerInterface =
itemizedLayer.itemList[i]
if (markerInterface is MarkerItem) {
idList.add(markerInterface.title)
}
}
it.onQsRecordList(idList.distinct().toMutableList())
}
}
return true
}
override fun onItemLongPress(
list: MutableList<Int>?,
nearest: Int
): Boolean {
return true
}
})
addLayer(itemizedLayer, NIMapView.LAYER_GROUPS.OPERATE)
mContext.lifecycleScope.launch(Dispatchers.IO) {
var list = mutableListOf<QsRecordBean>()
val realm = Realm.getDefaultInstance()
Log.e("jingo", "realm hashCOde ${realm.hashCode()}")
realm.executeTransaction {
val objects = realm.where<QsRecordBean>().findAll()
list = realm.copyFromRealm(objects)
}
// realm.close()
for (item in list) {
createMarkerItem(item)
}
}
}
private suspend fun createMarkerItem(item: QsRecordBean) {
val bitmap: Bitmap = createTextMarkerBitmap(mContext, item.description, resId)
if (item.t_lifecycle != 2) {
val geometry: Geometry? = GeometryTools.createGeometry(item.geometry)
if (geometry != null) {
var geoPoint: org.oscim.core.GeoPoint? = null
if (geometry.geometryType != null) {
when (geometry.geometryType.uppercase(Locale.getDefault())) {
"POINT" -> geoPoint =
org.oscim.core.GeoPoint(geometry.coordinate.y, geometry.coordinate.x)
// "LINESTRING" -> {
// val lineString = geometry as LineString
// if (lineString != null && lineString.coordinates.size > 0) {
// geoPoint = GeoPoint(
// lineString.coordinates[0].y,
// lineString.coordinates[0].x
// )
// }
// val drawableLine: Drawable =
// convertGeometry2Drawable(geometry, lineStyle)
// if (drawableLine != null) {
// dataVectorLayer.add(drawableLine)
// }
// }
// "POLYGON" -> {
// val polygon = geometry as Polygon
// if (polygon != null && polygon.coordinates.size > 0) {
// geoPoint = GeoPoint(
// polygon.coordinates[0].y,
// polygon.coordinates[0].x
// )
// }
// val drawablePolygon: Drawable =
// convertGeometry2Drawable(geometry, polygonStyle)
// if (drawablePolygon != null) {
// dataVectorLayer.add(drawablePolygon)
// }
// }
}
}
if (geoPoint != null) {
var geoMarkerItem: MarkerItem
// if (item.getType() === 1) {
geoMarkerItem = ClusterMarkerItem(
1, item.id, item.description, geoPoint
)
// } else {
// geoMarkerItem = MarkerItem(
// ePointTemp.getType(),
// ePointTemp.getId(),
// ePointTemp.getStyleText(),
// geoPoint
// )
// }
val markerSymbol =
MarkerSymbol(bitmap, MarkerSymbol.HotspotPlace.CENTER)
geoMarkerItem.marker = markerSymbol
itemizedLayer.itemList.add(geoMarkerItem)
}
}
}
itemizedLayer.populate()
}
/**
* 文字和图片拼装文字换行
*
* @param context
* @param text
* @param resId
* @return
*/
private fun createTextMarkerBitmap(context: Context, text: String, resId: Int): Bitmap {
var text: String? = text
return if (text == null || text.trim { it <= ' ' }.isEmpty()) {
val drawable = ResourcesCompat.getDrawable(context.resources, resId, null)
val originBitmap = android.graphics.Bitmap.createBitmap(
drawable!!.intrinsicWidth,
drawable.intrinsicHeight * 2,
android.graphics.Bitmap.Config.ARGB_8888
)
val androidCanvas = Canvas(originBitmap)
val startX = (originBitmap.width - drawable.intrinsicWidth) / 2
drawable.setBounds(
startX, 0, startX + drawable.intrinsicWidth, drawable.intrinsicHeight
)
drawable.draw(androidCanvas)
val bitmap: Bitmap = AndroidBitmap(originBitmap)
canvas.setBitmap(bitmap)
bitmap
} else {
val drawable = ResourcesCompat.getDrawable(context.resources, resId, null)
val textList: MutableList<String> = java.util.ArrayList()
val fontSize: Float = NUM_13 * CanvasAdapter.getScale()
paint.setTextSize(fontSize)
var maxWidth = 0f
//最多4行一行7个
if (text.trim { it <= ' ' }.length > 24) {
val size = (drawable!!.intrinsicHeight / 4).toFloat()
if (size < fontSize) paint.setTextSize(size)
if (text.trim { it <= ' ' }.length > 28) text = text.substring(0, 26) + "..."
val temp1 = text.substring(0, 7)
textList.add(temp1)
text = text.substring(7)
maxWidth = paint.getTextWidth(temp1)
val temp2 = text.substring(0, 7)
textList.add(temp2)
text = text.substring(7)
var newWidth = paint.getTextWidth(temp2)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
val temp3 = text.substring(0, 7)
textList.add(temp3)
text = text.substring(7)
newWidth = paint.getTextWidth(temp3)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
textList.add(text)
newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 21) {
val size = (drawable!!.intrinsicHeight / 4).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 6)
textList.add(temp1)
text = text.substring(6)
maxWidth = paint.getTextWidth(temp1)
val temp2 = text.substring(0, 6)
textList.add(temp2)
text = text.substring(6)
var newWidth = paint.getTextWidth(temp2)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
val temp3 = text.substring(0, 6)
textList.add(temp3)
text = text.substring(6)
newWidth = paint.getTextWidth(temp3)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
textList.add(text)
newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 18) {
val size = (drawable!!.intrinsicHeight / 3).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 7)
textList.add(temp1)
text = text.substring(7)
maxWidth = paint.getTextWidth(temp1)
val temp2 = text.substring(0, 7)
textList.add(temp2)
text = text.substring(7)
var newWidth = paint.getTextWidth(temp2)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
textList.add(text)
newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 18) {
val size = (drawable!!.intrinsicHeight / 3).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 7)
textList.add(temp1)
text = text.substring(7)
maxWidth = paint.getTextWidth(temp1)
val temp2 = text.substring(0, 7)
textList.add(temp2)
text = text.substring(7)
var newWidth = paint.getTextWidth(temp2)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
textList.add(text)
newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 14) {
val size = (drawable!!.intrinsicHeight / 3).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 6)
textList.add(temp1)
text = text.substring(6)
maxWidth = paint.getTextWidth(temp1)
val temp2 = text.substring(0, 6)
textList.add(temp2)
text = text.substring(6)
var newWidth = paint.getTextWidth(temp2)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
textList.add(text)
newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 12) {
val size = (drawable!!.intrinsicHeight / 2).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 7)
textList.add(temp1)
text = text.substring(7)
maxWidth = paint.getTextWidth(temp1)
textList.add(text)
val newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 10) {
val size = (drawable!!.intrinsicHeight / 2).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 6)
textList.add(temp1)
text = text.substring(6)
maxWidth = paint.getTextWidth(temp1)
textList.add(text)
val newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else if (text.trim { it <= ' ' }.length > 7) {
val size = (drawable!!.intrinsicHeight / 2).toFloat()
if (size < fontSize) paint.setTextSize(size)
val temp1 = text.substring(0, 5)
textList.add(temp1)
text = text.substring(5)
maxWidth = paint.getTextWidth(temp1)
textList.add(text)
val newWidth = paint.getTextWidth(text)
if (newWidth > maxWidth) {
maxWidth = newWidth
}
} else {
val size = drawable!!.intrinsicHeight.toFloat()
if (size < fontSize) paint.setTextSize(size)
textList.add(text)
maxWidth = paint.getTextWidth(text)
}
paint.color = Color.parseColor(mDefaultTextColor)
val originBitmap = android.graphics.Bitmap.createBitmap(
if (drawable.intrinsicWidth > maxWidth) drawable.intrinsicWidth else maxWidth.toInt(),
drawable.intrinsicHeight * 2,
android.graphics.Bitmap.Config.ARGB_4444
)
val androidCanvas = Canvas(originBitmap)
val startX = (originBitmap.width - drawable.intrinsicWidth) / 2
drawable.setBounds(
startX, 0, startX + drawable.intrinsicWidth, drawable.intrinsicHeight
)
drawable.draw(androidCanvas)
val bitmap: Bitmap = AndroidBitmap(originBitmap)
canvas.setBitmap(bitmap)
var startHeight = (drawable.intrinsicHeight + paint.getTextHeight(text)).toInt()
for (txt in textList) {
canvas.drawText(
txt, (bitmap.width - paint.getTextWidth(txt)) / 2, startHeight.toFloat(), paint
)
startHeight += paint.getTextHeight(txt).toInt()
}
bitmap
}
}
}
interface OnQsRecordItemClickListener {
fun onQsRecordList(list: MutableList<String>)
} }

BIN
fastmap.keystore Normal file

Binary file not shown.