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

 Conflicts:
	app/src/main/java/com/navinfo/omqs/ui/activity/PermissionsActivity.kt
	app/src/main/java/com/navinfo/omqs/ui/activity/map/MainViewModel.kt
	collect-library/src/main/java/com/navinfo/collect/library/map/handler/LayerManagerHandler.kt
This commit is contained in:
squallzhjch 2023-04-21 14:14:32 +08:00
commit 5db8bfaade
168 changed files with 11644 additions and 99 deletions

View File

@ -6,6 +6,8 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- 这个权限用于访问GPS定位-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- 这个权限用于访问GPS定位-->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<!-- 用于访问wifi网络信息wifi信息会用于进行网络定位-->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- 获取运营商信息,用于支持提供运营商信息相关的接口-->

View File

@ -2,8 +2,13 @@ package com.navinfo.omqs
import android.app.Application
import android.util.Log
import com.navinfo.collect.library.data.dao.impl.MapLifeDataBase
import com.navinfo.omqs.db.TraceDataBase
import com.navinfo.omqs.tools.FileManager
import com.navinfo.omqs.ui.manager.TakePhotoManager
import com.navinfo.omqs.util.NetUtils
import dagger.hilt.android.HiltAndroidApp
import org.videolan.vlc.Util
import io.realm.Realm
import io.realm.RealmConfiguration
import kotlinx.coroutines.launch
@ -16,10 +21,15 @@ class OMQSApplication : Application() {
override fun onCreate() {
super.onCreate()
FileManager.initRootDir(this)
Util.getInstance().init(applicationContext)
NetUtils.getInstance().init(this)
TakePhotoManager.getInstance().init(this, 1)
FileManager.initRootDir(this)
Realm.init(this)
val password = "encryp".encodeToByteArray().copyInto(ByteArray(64))
// 656e6372797000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Log.d("OMQSApplication", "密码是: ${byteArrayToHexString(password)}")
// 1110000011000010111001101110011011101110110111101110010011001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
val config = RealmConfiguration.Builder()
.directory(File(Constant.DATA_PATH))
.name("OMQS.realm")

View File

@ -2,6 +2,7 @@ package com.navinfo.omqs.db
import androidx.room.Database
import androidx.room.RoomDatabase
import com.navinfo.collect.library.data.entity.NiLocation
import com.navinfo.omqs.bean.OfflineMapCityBean
import com.navinfo.omqs.bean.ScProblemTypeBean
import com.navinfo.omqs.bean.ScRootCauseAnalysisBean

View File

@ -0,0 +1,181 @@
package com.navinfo.omqs.db;
import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import androidx.sqlite.db.SupportSQLiteDatabase;
import com.navinfo.collect.library.data.dao.impl.INiLocationDao;
import com.navinfo.collect.library.data.entity.NiLocation;
import com.tencent.wcdb.database.SQLiteCipherSpec;
import com.tencent.wcdb.database.SQLiteDatabase;
import com.tencent.wcdb.repair.BackupKit;
import com.tencent.wcdb.repair.RecoverKit;
import com.tencent.wcdb.room.db.WCDBDatabase;
import com.tencent.wcdb.room.db.WCDBOpenHelperFactory;
@Database(entities = { NiLocation.class},version = 1, exportSchema = false)
public abstract class TraceDataBase extends RoomDatabase {
// marking the instance as volatile to ensure atomic access to the variable
/**
* 数据库单例对象
*/
private static volatile TraceDataBase INSTANCE;
/**
* 地图坐标库类
*/
public abstract INiLocationDao getNiLocationDao();
/**
* 数据库秘钥
*/
private final static String DB_PASSWORD = "123456";
public static TraceDataBase getDatabase(final Context context, final String name) {
if (INSTANCE == null) {
synchronized (TraceDataBase.class) {
if (INSTANCE == null) {
// [WCDB] To use Room library with WCDB, pass a WCDBOpenHelper factory object
// to the database builder with .openHelperFactory(...). In the factory object,
// you can specify passphrase and cipher options to open or create encrypted
// database, as well as optimization options like asynchronous checkpoint.
SQLiteCipherSpec cipherSpec = new SQLiteCipherSpec()
.setPageSize(1024)
.setSQLCipherVersion(3);
WCDBOpenHelperFactory factory = new WCDBOpenHelperFactory()
.passphrase(DB_PASSWORD.getBytes()) // passphrase to the database, remove this line for plain-text
.cipherSpec(cipherSpec) // cipher to use, remove for default settings
.writeAheadLoggingEnabled(true) // enable WAL mode, remove if not needed
.asyncCheckpointEnabled(true); // enable asynchronous checkpoint, remove if not needed
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
TraceDataBase.class, name)
// [WCDB] Specify open helper to use WCDB database implementation instead
// of the Android framework.
.openHelperFactory(factory)
// Wipes and rebuilds instead of migrating if no Migration object.
// Migration is not part of this codelab.
.fallbackToDestructiveMigration()
.addCallback(sRoomDatabaseCallback)
.build();
}
}
}
return INSTANCE;
}
/**
* Override the onOpen method to populate the database.
* For this sample, we clear the database every time it is created or opened.
* <p>
* If you want to populate the database only when the database is created for the 1st time,
* override RoomDatabase.Callback()#onCreate
*/
private static Callback sRoomDatabaseCallback = new Callback() {
@Override
public void onOpen(@NonNull SupportSQLiteDatabase db) {
super.onOpen(db);
// If you want to keep the data through app restarts,
// comment out the following line.
new PopulateDbAsync(INSTANCE).execute();
}
};
/**
* Populate the database in the background.
* If you want to start with more words, just add them.
*/
private static class PopulateDbAsync extends AsyncTask<Void, Void, Void> {
PopulateDbAsync(TraceDataBase db) {
}
@Override
protected Void doInBackground(final Void... params) {
// Start the app with a clean database every time.
// Not needed if you only populate on creation.
//mDao.deleteAll();
Log.e("qj", "doInBackground");
return null;
}
}
/**
* 数据恢复
*/
protected boolean recoverData(){
if(INSTANCE!=null){
SQLiteDatabase sqlite = ((WCDBDatabase) INSTANCE.getOpenHelper().getWritableDatabase()).getInnerDatabase();
RecoverKit recover = new RecoverKit(
sqlite, // 要恢复到的目标 DB
sqlite.getPath() + "-backup", // 备份文件
DB_PASSWORD.getBytes() // 加密备份文件的密钥 DB 密钥
);
int result = recover.run(false); // fatal 参数传 false 表示遇到错误忽略并继续
// 若传 true 遇到错误则中止并返回 FAILED
switch (result) {
case RecoverKit.RESULT_OK:
/* 成功 */
Log.e("qj","sRoomDatabaseCallback==RecoverKit成功");
return true;
case RecoverKit.RESULT_CANCELED: /* 取消操作 */
Log.e("qj","sRoomDatabaseCallback==RecoverKit取消操作");
break;
case RecoverKit.RESULT_FAILED: /* 失败 */
Log.e("qj","sRoomDatabaseCallback==RecoverKit失败");
break;
}
recover.release();
}
return false;
}
/**
* 备份数据
*/
protected boolean backup() {
Log.e("qj", "sRoomDatabaseCallback===backup==start");
if (INSTANCE != null) {
//备份文件
SQLiteDatabase sqlite = ((WCDBDatabase) INSTANCE.getOpenHelper().getWritableDatabase()).getInnerDatabase();
BackupKit backup = new BackupKit(
sqlite, // 要备份的 DB
sqlite.getPath() + "-backup", // 备份文件
"123456".getBytes(), // 加密备份文件的密钥 DB 密钥
0, null);
int result = backup.run();
switch (result) {
case BackupKit.RESULT_OK:
/* 成功 */
Log.e("qj", "sRoomDatabaseCallback==成功");
return true;
case BackupKit.RESULT_CANCELED:
/* 取消操作 */
Log.e("qj", "sRoomDatabaseCallback==取消操作");
break;
case BackupKit.RESULT_FAILED:
/* 失败 */
Log.e("qj", "sRoomDatabaseCallback==失败");
break;
}
backup.release();
}
Log.e("qj", "sRoomDatabaseCallback===backup==end");
return false;
}
protected void release() {
INSTANCE = null;
}
}

View File

@ -0,0 +1,42 @@
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

@ -0,0 +1,799 @@
package com.navinfo.omqs.system;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* @ClassName: SystemDateTime.java
* @author qj
* @version V1.0
* @Date 2023年4月17日 下午1:56:02
* @Description: 时间工具类
*/
public class SystemDateTime {
// 时间字符串
private static String systemDate;
// 全部时间信息
private static String fullTime;
// 时间对象
static Date date = null;
/**
* 获取时间日期
* return
*/
public static String getDate() {
date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
systemDate = simpleDateFormat.format(date);
return systemDate;
}
/**
* 时间常量转日期
* @param time 时间常量
* return
*/
public static String getDateFromTime(long time) {
date = new Date(time);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
systemDate = simpleDateFormat.format(date);
return systemDate;
}
/**
* 获取时分秒HH:mm:ss
* return
*/
public static String getFullTime() {
date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
fullTime = simpleDateFormat.format(date);
return fullTime;
}
/**
* 格式化时间常量为yyyyMMddHHmmss
* @param time 时间常量
* return
*/
public static String getFullTimeFromTime(long time) {
date = new Date(time);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
fullTime = simpleDateFormat.format(date);
return fullTime;
}
/**
* 获取时间信息 yyyy-MM-dd HH:mm:ss
* return
*/
public static String getDataTime() {
date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
fullTime = simpleDateFormat.format(date);
return fullTime;
}
/**
* 简要格式时间HH:mm
* return
*/
public static String getShotDataTime() {
date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
"HH:mm");
fullTime = simpleDateFormat.format(date);
return fullTime;
}
/**
* 获取时间信息 yyyyMMddHHmmss
* return
*/
public static String getTime() {
date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
fullTime = simpleDateFormat.format(date);
return fullTime;
}
/**
* 获取时间信息 yyyyMMddHH
* return
*/
public static String getTimeyyyyMMddHH() {
date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHH");
fullTime = simpleDateFormat.format(date);
return fullTime;
}
/**
* 获取时间信息 yyyyMMddHHmmssSSS
* return
*/
public static String getTimeSSS() {
Date date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
fullTime = simpleDateFormat.format(date);
return fullTime;
}
/**
* 获取时间信息 yyyy-MM-dd HH:mm:ss:SSS
* return
*/
public static String getTimeMill() {
date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
fullTime = simpleDateFormat.format(date);
return fullTime;
}
/**
* 获取时间信息 yyyy-MM-dd HH:mm:ss
* return
*/
public static Date getNowDateShort() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(8);
Date currentTime_2 = formatter.parse(dateString, pos);
return currentTime_2;
}
/**
* 将yyyyMMddHHmmss转yyyy-MM-dd HH:mm:ss
* @param date 时间字符串
* return
*/
public static String dateToSimpleDate(String date) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
Date dDate = format.parse(date);
SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String reTime = format2.format(dDate);
return reTime;
}
/**
* 将yyyyMMddHHmmss转yyyy年MM月dd日
* @param date 时间字符串
* return
*/
public static String dateToChineseDate(String date) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
Date dDate = format.parse(date);
SimpleDateFormat format2 = new SimpleDateFormat("yyyy年MM月dd日");
String reTime = format2.format(dDate);
return reTime;
}
/**
* 将yyyy-MM-dd HH:mm:ss.SSS转换为yyyyMMddHHmmssSSS
* return
*/
public static String TimePointSSSToTime(String date) throws ParseException{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
Date dDate = format.parse(date);
SimpleDateFormat format2 = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String reTime = format2.format(dDate);
return reTime;
}
/**
* 将yyyy.MM.dd/HH时转yyyy-MM-dd HH:mm:ss
* @param date 时间字符串
* return
*/
public static String dateToSimpleDate2(String date) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd/HH时");
Date dDate = format.parse(date);
SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String reTime = format2.format(dDate);
return reTime;
}
/**
* 将yyyyMMddHHmmss转yyyy.MM.dd/HH时
* @param date 时间字符串
* return
*/
public static String dateToDialogTime(String date) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
Date dDate = format.parse(date);
SimpleDateFormat format2 = new SimpleDateFormat("yyyy.MM.dd/HH时");
String reTime = format2.format(dDate);
return reTime;
}
/**
* 将yyyyMMddHHmmss转yyyy-MM-dd HH:mm:ss:SSS
* @param date 时间字符串
* return
*/
public static String dateToSimpleDateSSS(String date) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
Date dDate = format.parse(date);
SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
String reTime = format2.format(dDate);
return reTime;
}
/**
* 将yyyyMMddHHmmssSSS转yyyy-MM-dd HH:mm:ss:SSS
* @param date 时间字符串
* return
*/
public static String iosDateToSimpleDateSSS(String date) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
Date dDate = format.parse(date);
SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
String reTime = format2.format(dDate);
return reTime;
}
/**
* 将yyyyMMddHHmmssSSS转yyyy-MM-dd HH:mm:ss
* @param date 时间字符串
* return
*/
public static String iosDateToSimpleDate(String date) throws ParseException {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
Date dDate = format.parse(date);
SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String reTime = format2.format(dDate);
return reTime;
}
/**
* 获取当前时间yyyy-MM-dd HH:mm:ss
* return
*/
public static Date getNowDate() throws ParseException {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(currentTime);
ParsePosition pos = new ParsePosition(8);
Date currentTime_2 = formatter.parse(dateString);
return currentTime_2;
}
/**
* 将时间常量转字符串HHmmss.SSS
* @param l 时间常量
* return
*/
public static String getTime(long l) {
if (l > 0) {
long utcL = l - 28800;
SimpleDateFormat sdf = new SimpleDateFormat("HHmmss.SSS");
return sdf.format(utcL);
}
return null;
}
/**
* 将时间常量转字符串yyyyMMddHHmmssSSS
* @param l 时间常量
* return
*/
public static String getDateSimpleTime(long l) {
if (l > 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
return sdf.format(l);
}
return null;
}
/**
* 将时间常量转字符串yyyy-MM-dd HH:mm:ss:SSS
* @param l 时间常量
* return
*/
public static String getDateSimpleTimeSSS(long l) {
if (l > 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
return sdf.format(l);
}
return null;
}
/**
* 格式化时间
*
* @param l
* @return yyyyMMddHH:mm:ss:SSS
*/
public static String getDateTimeSSS(long l) {
if (l > 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHH:mm:ss:SSS");
return sdf.format(l);
}
return null;
}
/**
* 将yyyyMMddHHmmss转long
*
* @param date
* @return
*/
public static long getTimeInfo(String date) {
if (date == null || date.equals(""))
return 0;
try {
String time = dateToSimpleDate(date);
long timeL = getTime(time);
return timeL;
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
}
/**
* 将yyyy-MM-dd HH:mm:ss时间转常量
*
* @param date
* @return
*/
public static long getTime(String date) {
long changeDate = 0;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date currentDate = formatter.parse(date);
changeDate = currentDate.getTime();
if (changeDate != 0) {
return changeDate;
}
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
}
/**
* 将yyyy-MM-dd HH:mm:ss时间转常量
*
* @param date
* @return
*/
public static long getPicTime(String date) {
long changeDate = 0;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");
try {
Date currentDate = formatter.parse(date);
changeDate = currentDate.getTime();
if (changeDate != 0) {
return changeDate;
}
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
}
/**
* 将yyyy-MM-dd HH:mm:ss.SSS时间转常量
*
* @param date
* @return
*/
public static long getTimePointSSS(String date) {
long changeDate = 0;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
try {
Date currentDate = formatter.parse(date);
changeDate = currentDate.getTime();
if (changeDate != 0) {
return changeDate;
}
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
}
/**
* 将yyyyMMddHHmmss时间转常量
*
* @param date
* @return
*/
public static long getTimePoint(String date) {
long changeDate = 0;
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
try {
Date currentDate = formatter.parse(date);
changeDate = currentDate.getTime();
if (changeDate != 0) {
return changeDate;
}
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
}
/**
* 将yyyy-MM-dd HH:mm:ss:SSS时间转常量
*
* @param date
* @return
*/
public static long getTimeSSS(String date) {
long changeDate = 0;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
try {
Date currentDate = formatter.parse(date);
changeDate = currentDate.getTime();
if (changeDate != 0) {
return changeDate;
}
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
}
/**
* 将yyyyMMddHHmmssSSS时间转常量
*
* @param date
* @return
*/
public static long getTrackTimeSSS(String date) {
long changeDate = 0;
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmssSSS");
try {
Date currentDate = formatter.parse(date);
changeDate = currentDate.getTime();
if (changeDate != 0) {
return changeDate;
}
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
}
/**
* 对比两个时间格式是否超过3000m
*
* @param startDate
* 起始时间
*@param endDate
* 结束时间
* @return true false
*/
public static boolean isTimeOut(long startDate, long endDate)
throws ParseException {
long result = startDate - endDate;
if (result > 300000 || result < -300000) {
return true;
}
return false;
}
/**
* 对比两个时间格式是否超过3000m
*
* @param startDate
* 起始时间
*@param endDate
* 结束时间
*@param dTime
* 时间常量
* @return true false
*/
public static boolean isTimeOut(long startDate, long endDate, long dTime)
throws ParseException {
long result = startDate - endDate;
if (result > dTime || result < -dTime) {
return true;
}
return false;
}
/**
* 对比两个时间间隔多少天yyyy-MM-dd
*
* @param date1
* 起始时间
*@param date2
* 结束时间
* @return
*
*/
public static int getDateSpan(String date1, String date2) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
try {
Date start = formatter.parse(date1);
Date end = formatter.parse(date2);
long span = end.getTime() - start.getTime();
float day = span / ((float) 1000 * 3600 * 24);
return (int) day;
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return 0;
}
/**
* 获取照片的时间
* return
*/
public static String getYYYYMMDDDate() {
date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
systemDate = simpleDateFormat.format(date);
return systemDate;
}
/**
* 获取照片的时间 yyyy年MM月dd日
* return YYYYMMDDD
*/
public static String getYYYYMMDDDateChinese() {
date = new Date();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
systemDate = simpleDateFormat.format(date);
return systemDate;
}
/**
* yyyy年MM月dd日 转date
*
* @param dateString
* @return
*/
public static Date stringYYYYMMDDHHToDate(String dateString) {
try {
SimpleDateFormat sim = new SimpleDateFormat("yyyy/MM/dd/HH时");
Date ticDate = sim.parse(dateString);
return ticDate;
} catch (Exception e) {
}
return null;
}
/**
* 当前时间前几天时间
* @param day
* 天数
* return
*/
public static String getCurrentDateBefore(int day) {
date = new Date();
Calendar now = Calendar.getInstance();
now.setTime(date);
now.set(Calendar.DATE, now.get(Calendar.DATE) - day);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
systemDate = simpleDateFormat.format(now.getTime());
return systemDate;
}
/**
* 当前时间前几天时间
* @param day
* 天数
* return
*/
public static String getCurrentDateAfter(String time,int day) {
try{
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHH");
Date dDate = format.parse(time);
Calendar now = Calendar.getInstance();
now.setTime(dDate);
now.set(Calendar.DATE, now.get(Calendar.DATE) + day);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
systemDate = simpleDateFormat.format(now.getTime());
}catch (Exception e){
}
return systemDate;
}
/**
* 获取时间
* @param time
* 时间
* return yyyy.MM.dd
*/
public static String getDateYYMMDD(String time) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
Date dDate = format.parse(time);
SimpleDateFormat format2 = new SimpleDateFormat("yyyy.MM.dd");
String reTime = format2.format(dDate);
return reTime;
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
/**
* 获取时间
* @param time
* 时间
* return yyyy.MM.dd
*/
public static String getDateYYMMDDPoint(String time) throws Exception{
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
Date dDate = format.parse(time);
SimpleDateFormat format2 = new SimpleDateFormat("yyyy.MM.dd");
String reTime = format2.format(dDate);
return reTime;
}
/**
* 获取时间
* @param time yyyyMMddHHmmss
* return HH:mm:ss
*/
public static String getDateHHMMSS(String time) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
Date dDate = format.parse(time);
SimpleDateFormat format2 = new SimpleDateFormat("HH:mm:ss");
String reTime = format2.format(dDate);
return reTime;
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 获取当前起始时间
* return yyyyMMddHHmmss
*/
public static String getCurrentDataStartTimeStr() {
return getYYYYMMDDDate() + "000000";
}
/**
* 获取当天结束时间
* return yyyyMMddHHmmss
*/
public static String getCurrentDataEndTimeStr() {
SimpleDateFormat format = null;
Date date = null;
Calendar myDate = Calendar.getInstance();
myDate.add(Calendar.DAY_OF_MONTH, 1);
date = myDate.getTime();
format = new SimpleDateFormat("yyyyMMdd000000");
return format.format(date);
}
public static int getDateSpanYYMMDDHHMMSS(String date1, String date2) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
try {
Date start = formatter.parse(date1);
Date end = formatter.parse(date2);
long span = end.getTime() - start.getTime();
float ss = Math.abs(span);
return (int) ss;
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return 0;
}
public static int getDateSpanIOSYYMMDDHHMMSSSSS(String date1, String date2) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmssSSS");
try {
Date start = formatter.parse(date1);
Date end = formatter.parse(date2);
long span = end.getTime() - start.getTime();
float ss = Math.abs(span);
return (int) ss;
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return 0;
}
/**
* 获取时间
* return
*/
public static String toDateYYMMDDHHSSMM(String time) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
Date dDate = format.parse(time);
SimpleDateFormat format2 = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒");
String reTime = format2.format(dDate);
return reTime;
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
/**
* 字符串格式时间转成Date格式
*
* @param dateString
* @return
*/
public static Date stringToDate(String dateString) {
try {
SimpleDateFormat sim = new SimpleDateFormat("yyyyMMddHHmmss");
Date ticDate = sim.parse(dateString);
return ticDate;
} catch (Exception e) {
}
return null;
}
/**
* 字符串格式时间转成Date格式
*
* @param dateString
* @return
*/
public static Date stringFullTimeToDate(String dateString) {
try {
SimpleDateFormat sim = new SimpleDateFormat("yyyyMMddHHmmssSSS");
Date ticDate = sim.parse(dateString);
return ticDate;
} catch (Exception e) {
}
return null;
}
/**
* 判断两个日期相差天数
* 大的日期放后面
*
* @param date1
* @param date2
* @return
*/
public static int differentDays(Date date1, Date date2) {
int days = (int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24));
return days;
}
}

View File

@ -31,8 +31,11 @@ open class PermissionsActivity : BaseActivity() {
permissionList.add(Permission.ACCESS_COARSE_LOCATION)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// permissionList.add(Permission.ACCESS_BACKGROUND_LOCATION)
//android10
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.Q) {
permissionList.add(Permission.ACCESS_BACKGROUND_LOCATION)
}
XXPermissions.with(this)
/* XXPermissions.with(this)
// 申请单个权限
.permission(permissionList)
// 设置权限请求拦截器(局部设置)
@ -72,7 +75,7 @@ open class PermissionsActivity : BaseActivity() {
onPermissionsDenied()
}
}
})
})*/
}
/**

View File

@ -1,19 +1,22 @@
package com.navinfo.omqs.ui.activity.map
import android.os.Bundle
import android.provider.ContactsContract.Contacts
import android.util.Log
import androidx.activity.viewModels
import androidx.core.view.WindowCompat
import androidx.databinding.DataBindingUtil
import com.blankj.utilcode.util.ToastUtils
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.viewModelScope
import androidx.navigation.findNavController
import com.navinfo.collect.library.map.NIMapController
import com.navinfo.collect.library.map.handler.NiLocationListener
import com.navinfo.omqs.Constant
import com.navinfo.omqs.R
import com.navinfo.omqs.databinding.ActivityMainBinding
import com.navinfo.omqs.db.TraceDataBase
import com.navinfo.omqs.http.offlinemapdownload.OfflineMapDownloadManager
import com.navinfo.omqs.system.SystemConstant
import com.navinfo.omqs.ui.activity.BaseActivity
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
@ -69,6 +72,13 @@ class MainActivity : BaseActivity() {
//开启定位
mapController.locationLayerHandler.startLocation()
//启动轨迹存储
mapController.locationLayerHandler.setNiLocationListener(NiLocationListener {
binding!!.viewModel!!.addSaveTrace(it)
binding!!.viewModel!!.startSaveTraceThread(this)
})
//显示轨迹图层
mapController.layerManagerHandler.showNiLocationLayer(Constant.DATA_PATH+ SystemConstant.USER_ID+"/trace.sqlite")
}
override fun onPause() {
@ -94,6 +104,13 @@ class MainActivity : BaseActivity() {
binding.mainActivityDrawer.open()
}
/**
* 打开相机预览
*/
fun openCamera() {
binding!!.viewModel!!.onClickCameraButton(this)
}
/**
* 点击录音按钮
*/

View File

@ -1,14 +1,28 @@
package com.navinfo.omqs.ui.activity.map
import android.content.Context
import android.content.DialogInterface
import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.navinfo.collect.library.data.entity.NiLocation
import com.blankj.utilcode.util.ToastUtils
import com.navinfo.collect.library.data.entity.NiLocation
import com.navinfo.collect.library.map.NIMapController
import com.navinfo.collect.library.map.handler.OnQsRecordItemClickListener
import com.navinfo.collect.library.utils.GeometryTools
import com.navinfo.collect.library.utils.GeometryToolsKt
import com.navinfo.omqs.Constant
import com.navinfo.omqs.R
import com.navinfo.omqs.db.TraceDataBase
import com.navinfo.omqs.system.SystemConstant
import com.navinfo.omqs.ui.dialog.CommonDialog
import com.navinfo.omqs.ui.manager.TakePhotoManager
import dagger.hilt.android.lifecycle.HiltViewModel
import dagger.hilt.android.scopes.ActivityRetainedScoped
import io.realm.RealmSet
import org.videolan.libvlc.LibVlcUtil
import java.util.*
import javax.inject.Inject
import javax.inject.Singleton
/**
* 创建Activity全局viewmode
@ -19,6 +33,9 @@ class MainViewModel @Inject constructor(
) : ViewModel() {
val liveDataQsRecordIdList = MutableLiveData<List<String>>()
private var mCameraDialog: CommonDialog? = null
private var niLocationList:MutableList<NiLocation> = ArrayList<NiLocation>()
init {
mapController.layerManagerHandler.setOnQsRecordItemClickListener(object :
@ -39,4 +56,81 @@ class MainViewModel @Inject constructor(
override fun onCleared() {
super.onCleared()
}
//点击相机按钮
fun onClickCameraButton(context: Context){
Log.e("qj", LibVlcUtil.hasCompatibleCPU(context).toString())
ToastUtils.showShort("点击了相机")
if (mCameraDialog == null) {
mCameraDialog = CommonDialog(context, context.resources.getDimension(R.dimen.head_img_width).toInt() * 3 + context.resources.getDimension(R.dimen.ten).toInt() + context.resources.getDimension(R.dimen.twenty_four).toInt(), context.resources.getDimension(R.dimen.head_img_width).toInt() + 10, 1)
mCameraDialog!!.setCancelable(true)
}
mCameraDialog!!.openCamear(mCameraDialog!!.getmShareUtil().continusTakePhotoState)
mCameraDialog!!.show()
mCameraDialog!!.setOnDismissListener(DialogInterface.OnDismissListener {
mCameraDialog!!.hideLoading()
mCameraDialog!!.stopVideo()
try {
if (!mCameraDialog!!.getmShareUtil().connectstate){
mCameraDialog!!.updateCameraResources(1, mCameraDialog!!.getmDeviceNum())
}
TakePhotoManager.getInstance().getCameraVedioClent(mCameraDialog!!.getmDeviceNum()).StopSearch()
} catch (e: Exception) {
}
})
mCameraDialog!!.setOnShowListener(DialogInterface.OnShowListener {
mCameraDialog!!.initmTakePhotoOrRecord(mCameraDialog!!.getmShareUtil().selectTakePhotoOrRecord)
if (!mCameraDialog!!.isShowVideo && mCameraDialog!!.getmShareUtil().connectstate && mCameraDialog!!.getmShareUtil().continusTakePhotoState) {
mCameraDialog!!.playVideo()
}
})
}
fun startSaveTraceThread(context: Context){
Thread(Runnable {
try {
while (true){
if(niLocationList!=null&&niLocationList.size>0){
var niLocation = niLocationList[0]
var doubleArray = doubleArrayOf()
doubleArray[0] = niLocation.longitude
doubleArray[1] = niLocation.latitude
val geometry = GeometryTools.createGeometry(doubleArray)
val tileX = RealmSet<Int>()
GeometryToolsKt.getTileXByGeometry(geometry.toString(), tileX)
val tileY = RealmSet<Int>()
GeometryToolsKt.getTileYByGeometry(geometry.toString(), tileY)
//遍历存储tile对应的x与y的值
tileX.forEach { x ->
tileY.forEach { y ->
niLocation.tilex = x
niLocation.tiley = y
}
}
TraceDataBase.getDatabase(context, Constant.DATA_PATH+ SystemConstant.USER_ID+"/trace.sqlite").niLocationDao.insert(niLocation)
niLocationList.removeAt(0)
Log.e("qj","saveTrace")
}
Thread.sleep(30)
}
} catch (e: InterruptedException) {
e.printStackTrace()
Log.e("qj","异常==${e.message}")
}
}).start()
}
//增加轨迹存储
fun addSaveTrace(niLocation: NiLocation){
if(niLocation!=null&&niLocationList!=null){
niLocationList.add(niLocation)
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
package com.navinfo.omqs.ui.dialog;
/**
* @ClassName: DataSource.java
* @author zcs
* @version V1.0
* @Date 2015年9月17日 下午1:20:08
* @Description: Dialog关闭时调用
*/
public abstract class DataSource {
public abstract void Data(String str,Object obg);
}

View File

@ -0,0 +1,510 @@
package com.navinfo.omqs.ui.dialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.navinfo.omqs.R;
/**
* @author zcs
* @version V1.0
* @ClassName: FirstDialog.java
* @Date 2015年11月18日 下午5:25:27
* @Description: 弹出默认的dialog
*/
public class FirstDialog extends MyDialog {
private CharSequence mPositiveButtonText;
private OnClickListener mPositiveButtonListener;
private CharSequence mNegativeButtonText;
private OnClickListener mNegativeButtonListener;
private CharSequence mMiddleButtonText;
private OnClickListener mMiddleButtonListener;
private Object tag;
public FirstDialog(Context context) {
super(context);
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
View rootView = LayoutInflater.from(context).inflate(R.layout.dialog_default, null);
setContentView(rootView/*, layoutParams*/);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void request(Object obj) {
}
/**
* 设置标题文字
*/
@Override
public void setTitle(CharSequence string) {
findViewById(R.id.ll_title).setVisibility(View.VISIBLE);
TextView tv = (TextView) findViewById(R.id.tv_title);
tv.setText(TextUtils.isEmpty(string) ? "" : string);
}
/**
* 设置标题颜色
*/
public void setTitleColor(int color) {
((TextView) findViewById(R.id.tv_title)).setTextColor(color);
}
/**
* 设置标题2文字
*/
public void setTitle2(CharSequence string) {
findViewById(R.id.tv_title2).setVisibility(View.VISIBLE);
TextView tv = (TextView) findViewById(R.id.tv_title2);
tv.setText(TextUtils.isEmpty(string) ? "" : string);
}
public void setTitle2Color(int color) {
((TextView) findViewById(R.id.tv_title2)).setTextColor(color);
}
/**
* 设置标题下分割线显隐
*/
public void setTitleDividerVisible(int visible) {
findViewById(R.id.title_divider).setVisibility(visible);
}
/**
* 设置标题下分割线显隐
*/
public void setTitleDividerVisible2(int visible) {
findViewById(R.id.title_divider2).setVisibility(visible);
}
public void setBottomDividerVisible(int visible) {
findViewById(R.id.v_divice).setVisibility(visible);
}
/**
* 确认按钮
*
* @param string
*/
public void setConfirm(CharSequence string) {
mPositiveButtonText = string;
TextView btn = (TextView) findViewById(R.id.btn_fm_confirm);
showBottomView();
btn.setText(TextUtils.isEmpty(string) ? "确定" : string);
}
public void setConfirmEnable(boolean enable) {
TextView btn = (TextView) findViewById(R.id.btn_fm_confirm);
btn.setEnabled(enable);
}
public void setConfirmVisibility(int visibility) {
findViewById(R.id.btn_fm_confirm).setVisibility(visibility);
}
/**
* 确认按钮
*
* @param colors
*/
public void setConfirmTxtColor(int colors) {
TextView btn = (TextView) findViewById(R.id.btn_fm_confirm);
btn.setTextColor(colors);
}
/**
* 确认按钮字体大小
*
* @param size
*/
public void setConfirmSize(float size) {
TextView btn = (TextView) findViewById(R.id.btn_fm_confirm);
btn.setTextSize(size);
}
/**
* 取消按钮
*
* @param string
*/
public void setCancel(CharSequence string) {
mNegativeButtonText = string;
TextView btn = (TextView) findViewById(R.id.btn_fm_cancel);
btn.setText(TextUtils.isEmpty(string) ? "取消" : string);
showBottomView();
btn.setVisibility(View.VISIBLE);
}
/**
* 取消按钮字体颜色
*
* @param color
*/
public void setCancelTxtColor(int color) {
TextView btn = (TextView) findViewById(R.id.btn_fm_cancel);
btn.setTextColor(color);
}
/**
* 取消按钮是否可点
*
* @param bl
*/
public void setCancelIsCanClick(Boolean bl) {
TextView btn = (TextView) findViewById(R.id.btn_fm_cancel);
btn.setEnabled(bl);
}
/**
* 取消按钮字体大小
*
* @param size
*/
public void setCancelSize(float size) {
TextView btn = (TextView) findViewById(R.id.btn_fm_cancel);
btn.setTextSize(size);
}
/**
* 中间按钮
*
* @param string
*/
public void setMiddle(CharSequence string) {
mNegativeButtonText = string;
TextView btn = (TextView) findViewById(R.id.btn_fm_middle);
btn.setText(TextUtils.isEmpty(string) ? "中间" : string);
showBottomView();
btn.setVisibility(View.VISIBLE);
}
/**
* 中间按钮字体颜色
*
* @param color
*/
public void setMiddleTxtColor(int color) {
TextView btn = (TextView) findViewById(R.id.btn_fm_middle);
btn.setTextColor(color);
}
/**
* 中间按钮是否可点
*
* @param bl
*/
public void setMiddleIsCanClick(Boolean bl) {
TextView btn = (TextView) findViewById(R.id.btn_fm_middle);
btn.setEnabled(bl);
}
/**
* 中间按钮字体大小
*
* @param size
*/
public void setMiddleSize(float size) {
TextView btn = (TextView) findViewById(R.id.btn_fm_middle);
btn.setTextSize(size);
}
/**
* 设置中间提示信息
*
* @param string
*/
public void setContentTxt(CharSequence string) {
TextView tv = (TextView) findViewById(R.id.tv_content);
tv.setText(TextUtils.isEmpty(string) ? "" : string);
}
/**
* 设置中间提示信息是否可长按复制
*
* @param isSelectable
*/
public void setTextIsSelectable(boolean isSelectable) {
TextView tv = (TextView) findViewById(R.id.tv_content);
tv.setTextIsSelectable(isSelectable);
}
/**
* 设置点击事件
*
* @param click
*/
public void setContentClickListener(View.OnClickListener click) {
findViewById(R.id.tv_content).setOnClickListener(click);
}
/**
* 设置中间显隐
*
* @param visable
*/
public void setContentTxtVisable(int visable) {
TextView tv = (TextView) findViewById(R.id.tv_content);
tv.setVisibility(visable);
}
/**
* 设置中间提示信息
*
* @param string
*/
public void setMessage(CharSequence string) {
setContentTxt(string);
}
/**
* 设置中间提示颜色
*
* @param color
*/
public void setMessageColor(int color) {
TextView tv = (TextView) findViewById(R.id.tv_content);
tv.setTextColor(color);
}
/**
* 设置中间提示文字
*
* @param txtId
*/
public void setMessage(int txtId) {
String txt = context.getResources().getString(txtId);
TextView tv = (TextView) findViewById(R.id.tv_content);
tv.setText(txt);
}
/**
* 设置中间显示的内容
*/
public void setMiddleView(View view) {
RelativeLayout rl = (RelativeLayout) findViewById(R.id.rl_content_view);
rl.removeAllViews();
if (view != null)
rl.addView(view);
}
public void setMiddleViewMatch(View view) {
RelativeLayout rl = (RelativeLayout) findViewById(R.id.rl_content_view);
rl.removeAllViews();
if (view != null)
rl.addView(view, new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
public void removeMideView() {
RelativeLayout rl = (RelativeLayout) findViewById(R.id.rl_content_view);
rl.removeAllViews();
}
/**
* 设置中间显示的内容
*/
public View setMiddleView(int id) {
RelativeLayout rl = (RelativeLayout) findViewById(R.id.rl_content_view);
rl.removeAllViews();
View inflate = View.inflate(getContext(), id, rl);
return rl.getChildAt(0);
}
/**
* 确定按钮 点击事件
*
* @param click
*/
public Dialog setConfirmListener(OnClickListener click) {
return setPositiveButton(mPositiveButtonText, click);
}
/**
* 取消按钮 点击事件
*
* @param click
*/
public Dialog setCancelListener(OnClickListener click) {
return setNegativeButton(mNegativeButtonText, click);
}
/**
* 取消按钮 点击事件
*
* @param click
*/
public Dialog setMiddleListener(OnClickListener click) {
return setMiddleButton(mMiddleButtonText, click);
}
/**
* 中间按钮 是否可点
*
* @param bl
*/
public void setMiddleButtonIsCanClick(Boolean bl) {
TextView btn_fm_confirm = (TextView) findViewById(R.id.btn_fm_middle);
btn_fm_confirm.setEnabled(bl);
}
public Dialog setMiddleButton(CharSequence text, OnClickListener listener) {
mMiddleButtonText = text;
mMiddleButtonListener = listener;
setMiddle(text);
findViewById(R.id.middle_view).setVisibility(View.VISIBLE);
TextView btn_fm_middle = (TextView) findViewById(R.id.btn_fm_middle);
btn_fm_middle.setVisibility(View.VISIBLE);
btn_fm_middle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mMiddleButtonListener != null) {
mMiddleButtonListener.onClick(FirstDialog.this, 3);
} else {
dismiss();
}
}
});
return this;
}
public Dialog setMiddleButton(int txtId, final OnClickListener listener) {
String text = context.getResources().getString(txtId);
return setMiddleButton(text, listener);
}
/**
* 确认按钮 是否可点
*
* @param bl
*/
public void setPositiveButtonIsCanClick(Boolean bl) {
TextView btn_fm_confirm = (TextView) findViewById(R.id.btn_fm_confirm);
btn_fm_confirm.setEnabled(bl);
}
public Dialog setPositiveButton(CharSequence text, OnClickListener listener) {
mPositiveButtonText = text;
mPositiveButtonListener = listener;
setConfirm(text);
findViewById(R.id.btn_fm_confirm).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mPositiveButtonListener != null) {
mPositiveButtonListener.onClick(FirstDialog.this, 2);
} else {
dismiss();
}
}
});
//如果设置了确定或取消按钮则不允许点击其他区域隐藏对话框
this.setCancelable(false);
return this;
}
public Dialog setPositiveButton(int txtId, final OnClickListener listener) {
String text = context.getResources().getString(txtId);
return setPositiveButton(text, listener);
}
public Dialog setNegativeButton(CharSequence text, OnClickListener listener) {
mNegativeButtonText = text;
mNegativeButtonListener = listener;
setCancel(text);
findViewById(R.id.btn_fm_cancel).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mNegativeButtonListener != null) {
mNegativeButtonListener.onClick(FirstDialog.this, 1);
} else {
dismiss();
}
}
});
//如果设置了确定或取消按钮则不允许点击其他区域隐藏对话框
this.setCancelable(false);
return this;
}
public Dialog setNegativeButton(int txtId, final OnClickListener listener) {
String text = context.getResources().getString(txtId);
return setNegativeButton(text, listener);
}
public interface OnClickListener {
/**
* This method will be invoked when a button in the dialog is clicked.
*
* @param dialog The dialog that received the click.
* @param which The button that was clicked (e.g.
* {@link DialogInterface#BUTTON1}) or the position
* of the item clicked.
*/
/* TODO: Change to use BUTTON_POSITIVE after API council */
public void onClick(Dialog dialog, int which);
}
private void showBottomView() {
findViewById(R.id.v_divice).setVisibility(View.VISIBLE);
findViewById(R.id.ll_bottom_btn).setVisibility(View.VISIBLE);
//如果设置了确定或取消按钮则不允许点击其他区域隐藏对话框
this.setCancelable(false);
}
public void setNegativeView(int View) {
findViewById(R.id.btn_fm_cancel).setVisibility(View);
findViewById(R.id.view_dialog).setVisibility(View);
}
public void setCancelVisibility(int isVisibility) {
findViewById(R.id.btn_fm_cancel).setVisibility(isVisibility);
}
public void setBottomLayoutVisibility(int isVisibility) {
findViewById(R.id.ll_bottom_layout).setVisibility(isVisibility);
}
public Object getTag() {
return tag;
}
public void setTag(Object tag) {
this.tag = tag;
}
public void setNegativeButtonEnable(boolean enable) {
findViewById(R.id.btn_fm_cancel).setEnabled(enable);
}
/**
* 设置北京资源
*/
public void setBackgroundColor(int res) {
LinearLayout rl = (LinearLayout) findViewById(R.id.ll_dialog);
if(rl!=null)
rl.setBackgroundColor(res);
}
}

View File

@ -0,0 +1,34 @@
package com.navinfo.omqs.ui.dialog;
/**
* @ClassName: Dialog.java
* @author zcs
* @version V1.0
* @param <T>
* @Date 2023年4月14日 上午10:15:44
* @Description: 所有弹出框的父类
*/
public interface IDialog {
//void result(T t);
//public <T> void result(T t);
//public <T> void showData(T t);
/**
* 给弹出框赋值
* @param str
* @param obj
*/
public void setData(String str,Object obj);
/**
* 给Diaolog传递的数据显示时调用
* @param obj
*/
public void request(Object obj);
/**
* 获得数据
* @return
*/
public Object getData();
}

View File

@ -0,0 +1,83 @@
package com.navinfo.omqs.ui.dialog;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import com.navinfo.omqs.R;
/**
* @author zcs
* @version V1.0
* @ClassName: LoadingDialog.java
* @Date 2015年9月17日 下午1:34:39
* @Description: 弹出等待框
*/
public class LoadingDialog extends MyDialog {
private CharSequence text;
private View.OnClickListener textListener;
private TextView tv_msg;
public LoadingDialog(Context context) {
super(context);
// requestWindowFeature(Window.FEATURE_NO_TITLE);//不显示标题
}
@Override
public void request(Object obj) {
}
@Override
protected void onCreate(Bundle savedInstanceState) {
View customFrame = View.inflate(context, R.layout.dialog_loading_custom_frame_layout, null);
((AnimationDrawable) customFrame.findViewById(R.id.customFrameLoadImg).getBackground()).start();
tv_msg = (TextView) customFrame.findViewById(R.id.customFrameMsg);
tv_msg.setVisibility(TextUtils.isEmpty(text) ? View.GONE : View.VISIBLE);
tv_msg.setText(TextUtils.isEmpty(text) ? "" : text);
tv_msg.setOnClickListener(textListener);
setContentView(customFrame);
}
/**
* 设置等待提示文字
*
* @param text
*/
public void setText(CharSequence text) {
this.text = text;
if (tv_msg!=null){
tv_msg.setVisibility(TextUtils.isEmpty(this.text) ? View.GONE : View.VISIBLE);
tv_msg.setText(TextUtils.isEmpty(this.text) ? "" : this.text);
}
}
/**
* 设置文本点击事件
*
* @param listener
*/
public void setTextClickListener(View.OnClickListener listener){
this.textListener = listener;
if (tv_msg!=null){
tv_msg.setOnClickListener(listener);
}
}
}

View File

@ -0,0 +1,92 @@
package com.navinfo.omqs.ui.dialog;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.view.Window;
/**
* @param <T>
* @param <T>
* @author qj
* @version V1.0
* @ClassName: MyDialog.java
* @Date 2023年4月14日 上午10:18:52
* @Description: 所有提示框的父类在onCreate设置布局
*/
public abstract class MyDialog extends Dialog implements IDialog {
protected Context context;
private Object obj;
private DataSource dataSource;
private String str;
public MyDialog(Context context) {
super(context);
this.context = context;
requestWindowFeature(Window.FEATURE_NO_TITLE);//不显示标题
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
@Override
public void dismiss() {
if (dataSource != null) {
dataSource.Data(str, obj);
}
super.dismiss();
}
public void setWidthHeight(int width, int height) {
getWindow().setLayout(width, height);
}
@Override
public void show() {
request(obj);
super.show();
}
@Override
public void setData(String str, Object obj) {
this.str = str;
this.obj = obj;
}
@Override
public Object getData() {
return obj;
}
public void getResponse(DataSource dataSource) {
this.dataSource = dataSource;
}
/**
* 设置背景色
*
* @param drawable
*/
public void setBackground(Drawable drawable) {
getWindow().setBackgroundDrawable(drawable);
}
}

View File

@ -0,0 +1,578 @@
package com.navinfo.omqs.ui.manager;
import android.content.Context;
import android.graphics.Bitmap;
import android.text.TextUtils;
import android.util.Log;
import com.android.volley.VolleyError;
import com.navinfo.collect.library.garminvirbxe.CameraEventListener;
import com.navinfo.collect.library.garminvirbxe.CameraGarminVirbXE;
import com.navinfo.collect.library.garminvirbxe.HostBean;
import com.navinfo.collect.library.garminvirbxe.SensorParams;
import com.navinfo.collect.library.sensor.ISensor.enmConnectionStatus;
import com.navinfo.collect.library.sensor.ISensor.enmSensorModel;
import com.navinfo.collect.library.sensor.ISensor.SensorWorkingMode;
import com.navinfo.collect.library.sensor.ISensor.enmSensorType;
import com.navinfo.collect.library.sensor.ISensor.enmSignalQuality;
import com.navinfo.collect.library.sensor.SensorManager;
import com.navinfo.omqs.system.SystemConstant;
import com.navinfo.omqs.util.ShareUtil;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* @author qj
* @version V1.0
* @Date 2023/4/14.
* @Description: (外设相机控制类)
*/
public class TakePhotoManager {
/**
* 拍照控制类集合
*/
private List<CameraGarminVirbXE> mSensorInstanceList;
/**
* 拍照过程回调监听
*/
/**
* 拍照管理类
*/
private static volatile TakePhotoManager mInstance;
//外设相机连接状态
private HashMap<String, enmConnectionStatus> mConnectionStatusHashMap;
//上下文
private Context mCon;
/**
* 装拍照过程回调数组
*/
private final List<CameraEventListener> mOnCameraEventListeners = new ArrayList<CameraEventListener>();
public static TakePhotoManager getInstance() {
if (mInstance == null) {
synchronized (TakePhotoManager.class) {
if (mInstance == null) {
mInstance = new TakePhotoManager();
}
}
}
return mInstance;
}
public void init(Context context, int cameraCount) {
mCon = context;
if (cameraCount == 0)
cameraCount = 1;
mSensorInstanceList = new ArrayList<CameraGarminVirbXE>();
mConnectionStatusHashMap = new HashMap<String, enmConnectionStatus>();
CameraEventListener cameraEevent = new CameraEventListener() {
@Override
public void OnSnapPictureResponse(HostBean hostBean, Bitmap bitmap, String picName, int tag) {
Log.i("info", "bitmap:" + bitmap);
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnSnapPictureResponse(hostBean, bitmap, picName, tag);
}
}
}
}
@Override
public void requestError(HostBean hostBean, com.android.volley.VolleyError e, CameraGarminVirbXE.enmCommandType commandType, int tag) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.requestError(hostBean, e, commandType, tag);
}
}
}
}
@Override
public void OnStartRecordResponse(HostBean hostBean, int tag) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnStartRecordResponse(hostBean, tag);
}
}
}
}
@Override
public void OnStopRecordResponse(HostBean hostBean, int tag) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnStopRecordResponse(hostBean, tag);
}
}
}
}
@Override
public void OnStatusResponse(HostBean hostBean, int tag) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnStatusResponse(hostBean, tag);
}
}
}
}
@Override
public void OnSearchResponse(int tag, ArrayList<HostBean> scanIpList) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnSearchResponse(tag, scanIpList);
}
}
}
}
@Override
public void OnConnectStatusChanged(HostBean hostBean, enmConnectionStatus connectStatus, int tag) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnConnectStatusChanged(hostBean, connectStatus, tag);
}
}
}
}
@Override
public void OnGetGpsStatusResponse(HostBean hostBean, boolean status, int tag) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnGetGpsStatusResponse(hostBean, status, tag);
}
}
}
}
@Override
public void OnConnectionStatusChanged(HostBean hostBean, enmConnectionStatus cs, int tag) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnConnectionStatusChanged(hostBean, cs, tag);
}
}
}
}
@Override
public void OnContinuousPhototTimeLapseRateResponse(HostBean hostBean, int tag) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnContinuousPhototTimeLapseRateResponse(hostBean, tag);
}
}
}
}
@Override
public void OnContinuousPhototTimeLapseRateStartResponse(HostBean hostBean, int tag) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnContinuousPhototTimeLapseRateStartResponse(hostBean, tag);
}
}
}
}
@Override
public void OnContinuousPhototTimeLapseRateStopResponse(HostBean hostBean, int tag) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnContinuousPhototTimeLapseRateStopResponse(hostBean, tag);
}
}
}
}
@Override
public void OnContinuousPhototSingle(HostBean hostBean, String url, String name, int tag) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnContinuousPhototSingle(hostBean, url, name, tag);
}
}
}
}
@Override
public void OnGetMediaList(HostBean hostBean, String json, int tag) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnGetMediaList(hostBean, json, tag);
}
}
}
}
@Override
public void OnSensorEvent() {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnSensorEvent();
}
}
}
}
@Override
public void OnConnectionStatusChanged(enmConnectionStatus cs) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnConnectionStatusChanged(cs);
}
}
}
}
@Override
public void OnGetDeviceInfo(HostBean hostBean, String devicesId, int tag) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnGetDeviceInfo(hostBean, devicesId, tag);
}
}
}
}
@Override
public void OnSignalQualityChanged(enmSignalQuality sq) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null) {
weakRef.OnSignalQualityChanged(sq);
}
}
}
}
};
for (int i = 0; i < cameraCount; i++) {
CameraGarminVirbXE clent = (CameraGarminVirbXE) SensorManager.getInstance().CreateSensor(context, enmSensorType.SENSOR_CAMEAR, enmSensorModel.CAMERA_GARMIN_VIRB_XE);
clent.setmTag(i + 1);
clent.RegisterSensorEvent(cameraEevent);
mSensorInstanceList.add(clent);
}
}
//连接网络
public boolean connect(int indexClent, HostBean hostBean, SensorParams params) {
if (hostBean != null) {
CameraGarminVirbXE cameraGarminVirbXE = getCameraVedioClent(indexClent);
if (cameraGarminVirbXE != null) {
cameraGarminVirbXE.Connect(hostBean, params);
return true;
}
}
return false;
}
public enmConnectionStatus getConnectionStatus(HostBean hostBean) {
if (hostBean != null && mConnectionStatusHashMap != null && mConnectionStatusHashMap.containsKey(hostBean.hardwareAddress)) {
return mConnectionStatusHashMap.get(hostBean.hardwareAddress);
}
return enmConnectionStatus.DISCONNECTTED;
}
public enmConnectionStatus getConnectionStatus() {
if (mSensorInstanceList != null && mConnectionStatusHashMap != null) {
enmConnectionStatus mEnmConnectionStatus = enmConnectionStatus.DISCONNECTTED;
for (CameraGarminVirbXE cameraGarminVirbXE : mSensorInstanceList) {
mEnmConnectionStatus = cameraGarminVirbXE.GetConnectionStatus();
if (mEnmConnectionStatus == enmConnectionStatus.CONNECTTED)
return enmConnectionStatus.CONNECTTED;
}
}
return enmConnectionStatus.DISCONNECTTED;
}
//设置相机模式
public void setCameraMode(int indexClent, SensorWorkingMode mode) {
if (indexClent > 0 && mSensorInstanceList!=null && indexClent <= mSensorInstanceList.size()) {
getCameraVedioClent(indexClent).SetMode(mode);
}
}
//获取当前相机模式
public SensorWorkingMode getCameraMode(int indexClent) {
if (mSensorInstanceList != null && indexClent > 0 && indexClent <= mSensorInstanceList.size()) {
return getCameraVedioClent(indexClent).GetMode();
}
return null;
}
public String mediaList(int indexClent, String path) {
if (mSensorInstanceList != null && indexClent > 0 && indexClent <= mSensorInstanceList.size()) {
getCameraVedioClent(indexClent).mediaList(path);
}
return null;
}
//搜索网络
public void SearchNet(HostBean hostBean, int indexClent, boolean isReadCache) {
if (mSensorInstanceList != null && mSensorInstanceList.size() > 0 && indexClent > 0 && indexClent <= mSensorInstanceList.size()) {
mSensorInstanceList.get(indexClent - 1).Search(isReadCache);
return;
}
}
//连续拍照
public void StartRecording(HostBean hostBean, int indexCamera) {
if (mSensorInstanceList != null && indexCamera > 0 && indexCamera <= mSensorInstanceList.size()) {
getCameraVedioClent(indexCamera).StartRecording();
}
}
public void getGpsStatus() {
if (mSensorInstanceList != null && mSensorInstanceList.size() > 0) {
for (CameraGarminVirbXE cameraGarminVirbXE : mSensorInstanceList) {
cameraGarminVirbXE.GetGpsStatus();
}
}
}
//获取GPS状态
public void getGpsStatus(HostBean hostBean, int index) {
if (hostBean != null) {
CameraGarminVirbXE cameraGarminVirbXE = findCameraGarminVirbXE(hostBean, index);
if (cameraGarminVirbXE != null) {
cameraGarminVirbXE.GetGpsStatus();
}
}
}
public void startCameraVedio(HostBean hostBean, int indexClent) {
if (hostBean != null) {
StopContinuousTakePhoto(hostBean, indexClent);
setCameraMode(indexClent, SensorWorkingMode.CAMERA_VEDIO_TIMELAPSE);
ShareUtil.getCameraMode(mCon).setContinusTakePhotoState(SystemConstant.USER_ID, false);
StartRecording(hostBean, indexClent);
}
}
//抓拍
public void SnapShot(HostBean hostBean, int index) {
if (hostBean != null) {
CameraGarminVirbXE cameraGarminVirbXE = findCameraGarminVirbXE(hostBean, index);
if (cameraGarminVirbXE != null) {
cameraGarminVirbXE.snapPicture(SystemConstant.getUuid(true));
}
}
}
public Long getGoogleTime() {
if (mSensorInstanceList != null && mSensorInstanceList.size() > 0) {
for (CameraGarminVirbXE cameraGarminVirbXE : mSensorInstanceList) {
if (cameraGarminVirbXE.getGoogleGpsTime() > 0) {
return cameraGarminVirbXE.getGoogleGpsTime();
}
}
}
return 0l;
}
//停止时间线程减少电量消耗
public void stopTimeThread() {
if (mSensorInstanceList != null && mSensorInstanceList.size() > 0) {
for (CameraGarminVirbXE cameraGarminVirbXE : mSensorInstanceList) {
cameraGarminVirbXE.stopTimeThread();
}
}
}
//设置拍照路径
public void setSavePath(HostBean hostBean, String path, int index) {
if (path == null || path.equals("")) {
return;
}
if (hostBean != null) {
CameraGarminVirbXE cameraGarminVirbXE = findCameraGarminVirbXE(hostBean, index);
if (cameraGarminVirbXE != null) {
File file = new File(path);
if (file.exists() && file.isDirectory()) {
cameraGarminVirbXE.SetCameraPictureSavaPath(path);
}
}
}
}
//停止搜索
public void StopSearchNet(HostBean hostBean, int indexClent) {
if (hostBean != null) {
CameraGarminVirbXE cameraGarminVirbXE = findCameraGarminVirbXE(hostBean, indexClent);
if (cameraGarminVirbXE != null) {
cameraGarminVirbXE.StopSearch();
}
}
}
//停止连拍
public void StopContinuousTakePhoto(HostBean hostBean, int indexCamera) {
if (mSensorInstanceList != null && indexCamera > 0 && indexCamera <= mSensorInstanceList.size()) {
getCameraVedioClent(indexCamera).StopRecording();
}
}
//停止所有相机
public void StopContinuousTakePhotoAll() {
if (mSensorInstanceList != null) {
for (CameraGarminVirbXE cameraGarminVirbXE : mSensorInstanceList) {
cameraGarminVirbXE.StopRecording();
}
}
}
//查找对应控制类
private CameraGarminVirbXE findCameraGarminVirbXE(HostBean hostBean, int index) {
if (mSensorInstanceList != null && mSensorInstanceList.size() > 0) {
for (CameraGarminVirbXE cameraGarminVirbXE : mSensorInstanceList) {
if (cameraGarminVirbXE.getmHostBean() != null && hostBean != null && !TextUtils.isEmpty(cameraGarminVirbXE.getmHostBean().hardwareAddress)
&& !TextUtils.isEmpty(hostBean.hardwareAddress) && cameraGarminVirbXE.getmHostBean().hardwareAddress.equalsIgnoreCase(hostBean.hardwareAddress) && cameraGarminVirbXE.getmTag() == index) {
return cameraGarminVirbXE;
}
}
return mSensorInstanceList.get(0);
}
return null;
}
public void setOnCameraEventChangeListener(CameraEventListener listener) {
synchronized (mOnCameraEventListeners) {
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (CameraEventListener weakRef : mOnCameraEventListeners) {
if (weakRef != null
&& weakRef == listener) {
return;
}
}
}
mOnCameraEventListeners.add(listener);
}
}
public void removeCameraEventListener(HostBean hostBean, CameraEventListener listener) {
synchronized (mOnCameraEventListeners) {
CameraEventListener weakRef;
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (int idx = 0; idx < mOnCameraEventListeners.size(); idx++) {
if ((weakRef = mOnCameraEventListeners.get(idx)) != null) {
if (weakRef == listener) {
mOnCameraEventListeners.remove(idx);
return;
}
} else {
mOnCameraEventListeners.remove(idx);
idx--;
}
}
}
}
}
public void removeCameraEventListenerAll(CameraEventListener listener) {
synchronized (mOnCameraEventListeners) {
CameraEventListener weakRef;
if (mOnCameraEventListeners != null && mOnCameraEventListeners.size() > 0) {
for (int idx = 0; idx < mOnCameraEventListeners.size(); idx++) {
if ((weakRef = mOnCameraEventListeners.get(idx)) != null) {
if (weakRef == listener) {
mOnCameraEventListeners.remove(idx);
return;
}
} else {
mOnCameraEventListeners.remove(idx);
idx--;
}
}
}
}
}
//根据拍照模式获取控制类
public CameraGarminVirbXE getCameraVedioClent(SensorWorkingMode mode) {
if (mode == null)
return null;
if (mSensorInstanceList != null && mSensorInstanceList.size() > 0) {
for (CameraGarminVirbXE cameraGarminVirbXE : mSensorInstanceList) {
if (cameraGarminVirbXE.GetMode() != null && cameraGarminVirbXE.GetMode() == mode) {
return cameraGarminVirbXE;
}
}
}
return null;
}
public CameraGarminVirbXE getCameraVedioClent(int indexClent) {
if (indexClent <= 0)
return null;
if (mSensorInstanceList != null && mSensorInstanceList.size() > 0 && indexClent <= mSensorInstanceList.size()) {
return mSensorInstanceList.get(indexClent - 1);
}
return null;
}
}

View File

@ -0,0 +1,77 @@
package com.navinfo.omqs.ui.other;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.navinfo.omqs.R;
/**
* 在屏幕中间出现toast提示
*/
public class BaseToast extends Toast{
final Context mContext;
private static int height;
static Toast result;
public BaseToast(Context context) {
super(context);
mContext = context;
DisplayMetrics dm = new DisplayMetrics();
// 获取屏幕信息
((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm);
height = dm.heightPixels;
}
/**
* 屏幕中间显示toast
* @param context
* @param text 显示内容
* @param duration 显示时长
* @return
*/
public static Toast makeText(Context context, CharSequence text, int duration) {
try{
DisplayMetrics dm = new DisplayMetrics();
((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm);
height = dm.heightPixels;
result =result==null? new Toast(context):result;
LayoutInflater inflate = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflate.inflate(R.layout.transient_notification, null);
TextView tv = (TextView) v.findViewById(android.R.id.message);
tv.setText(text);
result.setView(v);
if(duration<Toast.LENGTH_SHORT)
duration = Toast.LENGTH_SHORT;
result.setDuration(duration);
result.setGravity(Gravity.CENTER, 0, height/6);
}catch (Exception e){
}
return result;
}
/**
* 屏幕中心显示toast
* @param context
* @param resId 文字资源id
* @param duration 显示时长
* @return
* @throws Resources.NotFoundException
*/
public static Toast makeText(Context context, int resId, int duration)
throws Resources.NotFoundException {
return makeText(context, context.getResources().getText(resId),
duration);
}
}

View File

@ -0,0 +1,616 @@
package com.navinfo.omqs.util;
import android.content.Context;
import android.media.ExifInterface;
import android.text.TextUtils;
import android.util.Log;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author qj
* @version V1.0
* @ClassName: FileUtils
* @Date 2023/4/17
* @Description: ${文件类)
*/
public class FileUtils {
//类标识
private static final String TAG = "FileUtils";
// 本类输出的日志文件名称
private static String TrackFILEName = "Track.txt";
// 本类输出的日志文件名称
private static String AdasTrackFILEName = "AdasTrack.txt";
//日志文件格式
private static SimpleDateFormat logfile = new SimpleDateFormat("yyyy-MM-dd");
//文件集合
private static List<File> filelist = new ArrayList<File>();
/**
* 复制文件到sd卡
*
* @param context 上下文
* @param fileDir 文件目录
* @param filePath 文件路径
* @param files 文件集合
*/
public static void copyFileToSdcard(Context context, String fileDir,
String filePath, Field[] files) {
for (Field r : files) {
try {
int id = context.getResources().getIdentifier(r.getName(),
"raw", context.getPackageName());
Log.i(TAG, new File(filePath).length() + "=====文件长度===="
+ filePath);
if (!new File(fileDir).exists()) {
new File(fileDir).mkdirs();
}
// new File(path).delete();
if (new File(filePath).exists())
new File(filePath).delete();
new File(filePath).createNewFile();
BufferedOutputStream bufEcrivain = new BufferedOutputStream(
(new FileOutputStream(new File(filePath))));
BufferedInputStream VideoReader = new BufferedInputStream(
context.getResources().openRawResource(id));
byte[] buff = new byte[20 * 1024];
int len;
while ((len = VideoReader.read(buff)) > 0) {
bufEcrivain.write(buff, 0, len);
}
bufEcrivain.flush();
bufEcrivain.close();
VideoReader.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* 复制单个文件
*
* @param oldPath String 原文件路径 c:/fqf.txt
* @param newPath String 复制后路径 f:/fqf.txt
* @return boolean
*/
public static boolean copyFile(String oldPath, String newPath) {
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPath);
if (oldfile.exists()) { // 文件存在时
InputStream inStream = new FileInputStream(oldPath); // 读入原文件
FileOutputStream fs = new FileOutputStream(newPath);
byte[] buffer = new byte[1444];
while ((byteread = inStream.read(buffer)) != -1) {
bytesum += byteread; // 字节数 文件大小
System.out.println(bytesum);
fs.write(buffer, 0, byteread);
}
inStream.close();
return true;
}
} catch (Exception e) {
System.out.println("复制单个文件操作出错");
e.printStackTrace();
}
return false;
}
/**
* 实时轨迹信息写入文件
*
* @param info 信息
* @param isNewLine 是否换行写入
*/
public static void writeRealTimeTrackToFile(String filePath, String info, boolean isNewLine) {
if (new File(filePath).exists() == false) {
new File(filePath).mkdirs();
}
File file = new File(filePath, "monitor_track.txt");
FileWriter filerWriter = null;
BufferedWriter bufWriter = null;
try {
if (!file.exists())
file.createNewFile();
//文件流
filerWriter = new FileWriter(file, true);//后面这个参数代表是不是要接上文件中原来的数据不进行覆盖
//字符缓冲输出流
bufWriter = new BufferedWriter(filerWriter);
bufWriter.write(info);
if (isNewLine)
bufWriter.newLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
try{
if(bufWriter!=null)
bufWriter.close();
if(filerWriter!=null)
filerWriter.close();
}catch (Exception e){
}
}
}
/**
* 轨迹信息写入文件
*
* @param info 信息
* @param isNewLine 是否换行写入
*/
public static void writeTrackToFile(String filePath, String info, boolean isNewLine) {
Date nowtime = new Date();
String needWriteFiel = logfile.format(nowtime);
if (TextUtils.isEmpty(filePath))
return;
if (new File(filePath).exists() == false) {
new File(filePath).mkdirs();
}
File file = new File(filePath, needWriteFiel + TrackFILEName);
FileWriter filerWriter = null;
BufferedWriter bufWriter = null;
try {
if (!file.exists())
file.createNewFile();
//文件流
filerWriter = new FileWriter(file, true);//后面这个参数代表是不是要接上文件中原来的数据不进行覆盖
//字符缓冲输出流
bufWriter = new BufferedWriter(filerWriter);
bufWriter.write(info);
if (isNewLine)
bufWriter.newLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
try{
if(bufWriter!=null)
bufWriter.close();
if(filerWriter!=null)
filerWriter.close();
}catch (Exception e){
}
}
}
/**
* 实时轨迹偏差信息写入文件
*
* @param info 信息
* @param isNewLine 是否换行写入
*/
public static void writeTrackLogToFile(String filePath, String info, boolean isNewLine) {
if (new File(filePath).exists() == false) {
new File(filePath).mkdirs();
}
File file = new File(filePath, "TrackLog.txt");
FileWriter filerWriter = null;
BufferedWriter bufWriter = null;
try {
if (!file.exists())
file.createNewFile();
//文件流
filerWriter = new FileWriter(file, true);//后面这个参数代表是不是要接上文件中原来的数据不进行覆盖
//字符缓冲输出流
bufWriter = new BufferedWriter(filerWriter);
bufWriter.write(info);
if (isNewLine)
bufWriter.newLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
try{
if(bufWriter!=null)
bufWriter.close();
if(filerWriter!=null)
filerWriter.close();
}catch (Exception e){
}
}
}
/**
* 逐行写入
*
* @param info 信息
*/
public static void writeLine(String filePath,String fileName, String info) {
if (TextUtils.isEmpty(filePath))
return;
if (new File(filePath).exists() == false) {
new File(filePath).mkdirs();
}
File file = new File(filePath + fileName);
FileWriter filerWriter = null;
BufferedWriter bufWriter = null;
try {
if (!file.exists())
file.createNewFile();
//文件流
filerWriter = new FileWriter(file, true);//后面这个参数代表是不是要接上文件中原来的数据不进行覆盖
//字符缓冲输出流
bufWriter = new BufferedWriter(filerWriter);
bufWriter.write(info);
bufWriter.newLine();
} catch (IOException e) {
e.printStackTrace();
}finally {
try{
if(bufWriter!=null)
bufWriter.close();
if(filerWriter!=null)
filerWriter.close();
}catch (Exception e){
}
}
}
/**
* Adas轨迹信息写入文件
*
* @param info 信息
* @param isNewLine 是否换行写入
*/
public static void writeAdasTrackToFile(String filePath, String info, boolean isNewLine) {
Date nowtime = new Date();
String needWriteFiel = logfile.format(nowtime);
if (TextUtils.isEmpty(filePath))
return;
if (new File(filePath).exists() == false) {
new File(filePath).mkdirs();
}
File file = new File(filePath, needWriteFiel + AdasTrackFILEName);
FileWriter filerWriter = null;
BufferedWriter bufWriter = null;
try {
if (!file.exists())
file.createNewFile();
//文件流
filerWriter = new FileWriter(file, true);//后面这个参数代表是不是要接上文件中原来的数据不进行覆盖
//字符缓冲输出流
bufWriter = new BufferedWriter(filerWriter);
bufWriter.write(info);
if (isNewLine)
bufWriter.newLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
try{
if(bufWriter!=null)
bufWriter.close();
if(filerWriter!=null)
filerWriter.close();
}catch (Exception e){
}
}
}
/**
* 获取文件绝对路径
*
* @return list
* 文件绝对路径集合
*/
public static List<File> getFileList(String strPath, String[] suffix) {
File dir = new File(strPath);
File[] files = dir.listFiles(); // 该文件目录下文件全部放入数组
if (files != null) {
for (int i = 0; i < files.length; i++) {
String fileName = files[i].getName();
if (files[i].isDirectory()) { // 判断是文件还是文件夹
getFileList(files[i].getAbsolutePath(), suffix); // 获取文件绝对路径
} else {
if (suffix != null && suffix.length > 0) {
for (String str : suffix) {
if (fileName.endsWith(str)) { // 判断文件名是否以
String strFileName = files[i].getAbsolutePath();
System.out.println("---" + strFileName);
filelist.add(files[i]);
}
}
}
}
}
}
return filelist;
}
/**
* 清理缓存文件
*/
public static void clearCacheFile() {
filelist.clear();
}
/**
* 获取文件目录大小
*
* @param file
*/
public static double getDirSize(File file) {
//判断文件是否存在
if (file.exists()) {
//如果是目录则递归计算其内容的总大小
if (file.isDirectory()) {
File[] children = file.listFiles();
double size = 0;
for (File f : children)
size += getDirSize(f);
return size;
} else {//如果是文件则直接返回其大小,为单位
double size = (double) file.length() / 1024 / 1024;
return size;
}
} else {
System.out.println("文件或者文件夹不存在,请检查路径是否正确!");
return 0.0;
}
}
public static byte[] readFileByBytes(String url) throws IOException {
File file = new File(url);
if (file.exists() && !file.mkdir()) {
long fileSize = file.length();
if (fileSize > Integer.MAX_VALUE) {
// System.out.println("file too big...");
return null;
}
FileInputStream fi = new FileInputStream(file);
byte[] buffer = new byte[(int) fileSize];
int offset = 0;
int numRead = 0;
while (offset < buffer.length
&& (numRead = fi.read(buffer, offset, buffer.length - offset)) >= 0) {
offset += numRead;
}
// 确保所有数据均被读取
if (offset != buffer.length) {
throw new IOException("Could not completely read file "
+ file.getName());
}
fi.close();
return buffer;
}
return null;
}
//把从服务器获得图片的输入流InputStream写到本地磁盘
public static void saveImageToDisk(String url, String savePath) {
InputStream inputStream = getInputStream(url);
if(inputStream==null)
return;
byte[] data = new byte[1024];
int len = 0;
FileOutputStream fileOutputStream = null;
try {
fileOutputStream = new FileOutputStream(savePath);
while ((len = inputStream.read(data)) != -1) {
fileOutputStream.write(data, 0, len);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
// 从服务器获得一个输入流(本例是指从服务器获得一个image输入流)
public static InputStream getInputStream(String urlPath) {
InputStream inputStream = null;
HttpURLConnection httpURLConnection = null;
try {
URL url = new URL(urlPath);
httpURLConnection = (HttpURLConnection) url.openConnection();
// 设置网络连接超时时间
httpURLConnection.setConnectTimeout(3000);
// 设置应用程序要从网络连接读取数据
httpURLConnection.setDoInput(true);
httpURLConnection.setRequestMethod("GET");
int responseCode = httpURLConnection.getResponseCode();
if (responseCode == 200) {
// 从服务器返回一个输入流
inputStream = httpURLConnection.getInputStream();
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return inputStream;
}
public static String getExifTime(String jpegFile) {
try {
ExifInterface exif = new ExifInterface(jpegFile);
String time = exif.getAttribute(ExifInterface.TAG_DATETIME);
return time;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
/**
* 轨迹信息写入文件
*
* @param info 信息
* @param isNewLine 是否换行写入
*/
public static void writeToFile(String filePath, String info, boolean isNewLine) {
if (TextUtils.isEmpty(filePath))
return;
File file = new File(filePath);
FileWriter filerWriter = null;
BufferedWriter bufWriter = null;
try {
if (!file.exists())
file.createNewFile();
//文件流
filerWriter = new FileWriter(file, true);//后面这个参数代表是不是要接上文件中原来的数据不进行覆盖
//字符缓冲输出流
bufWriter = new BufferedWriter(filerWriter);
bufWriter.write(info);
if (isNewLine)
bufWriter.newLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
try{
if(bufWriter!=null)
bufWriter.close();
if(filerWriter!=null)
filerWriter.close();
}catch (Exception e){
}
}
}
}

View File

@ -0,0 +1,78 @@
package com.navinfo.omqs.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* @ClassName: NetUtils.java
* @author qj
* @version V1.0
* @Date 2016年12月17日 下午1:56:02
* @Description: 网络类
*/
public class NetUtils {
//单例对象
private static volatile NetUtils mInstance;
//上下文
private Context mCon;
public static NetUtils getInstance() {
if (mInstance == null) {
synchronized (NetUtils.class) {
if (mInstance == null) {
mInstance = new NetUtils();
}
}
}
return mInstance;
}
/**
* 初始化
* @param context
* 上下文
*/
public void init(Context context){
this.mCon = context;
}
/**
* 是否wifi
* @return true false
*/
public boolean isExistWifi(boolean isNeedMobile){
//获取系统服务
ConnectivityManager manager = (ConnectivityManager)mCon.getSystemService(Context.CONNECTIVITY_SERVICE);
try{
//获取状态
final NetworkInfo.State wifi = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState();
if(wifi == NetworkInfo.State.CONNECTED||wifi==NetworkInfo.State.CONNECTING){
return true;
}
}catch (Exception e){
}
if(isNeedMobile){
try{
//获取状态
final NetworkInfo mobileNetwork = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if(mobileNetwork!=null&&mobileNetwork.getState()!=null&& (mobileNetwork.getState()== NetworkInfo.State.CONNECTED||mobileNetwork.getState()==NetworkInfo.State.CONNECTING)){
return true;
}
}catch (Exception e){
}
}
return false;
}
}

View File

@ -0,0 +1,373 @@
package com.navinfo.omqs.util;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import com.navinfo.omqs.system.SystemConstant;
/**
* @ClassName: ShareUtil.java
* @author qj
* @version V1.0
* @Date 2016年12月17日 下午1:56:02
* @Description: 相机数据存储
*/
public class ShareUtil {
//系统数据存储对象
private static SharedPreferences mSharePre=null;
//安卓编辑器
private static Editor editor;
//拍照状态标识
private final static String CONTINUS_TAKE_PHOTO_STATE = "continue_take_photo_state";
//外设相机按钮状态标识
private final static String SELECT_TAKE_PHOTO_OR_RECORD = "select_take_photo_or_record";
//外设相机种别标识
private final static String SELECT_CAMERA_KIND = "select_take_kind";
//外设相机连接标识
private final static String CAMERA_CONNECT_STATE = "camera_connect_state";
//外设相机工作模式
private final static String TAKE_CAMERA_MODE = "take_camera_mode";
//连接相机ip
private final static String TAKE_CAMERA_IP = "take_camera_ip";
//连接相机Mac
private final static String TAKE_CAMERA_MAC = "take_camera_mac";
//外设相机编号应对多个相机连接使用识别存储某一个设备连接状态等信息
private int mDeviceNum = 1;
//上下文
private Context mContext;
private ShareUtil() {
}
public ShareUtil(Context context, int deviceNum) {
mContext = context;
mDeviceNum = deviceNum;
}
/**
* method : getSelectCameraKind
* Author : qj
* Describe : 获取相机类型
* param : context 上下文
* return true 相机 false视频
* Date : 2018/4/23
*/
public boolean getSelectCameraKind(){
if(mContext==null)
return false;
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.SELECT_CAMERA_STATE, Context.MODE_PRIVATE);
}
return mSharePre.getBoolean(mDeviceNum+SystemConstant.USER_ID+SELECT_CAMERA_KIND, false);
}
/**
* method : setSelectCameraKind
* Author : qj
* Describe : 设置相机类型
* param : context 上下文
* param : userid用户id
* param : true 内置相机 false 外置相机
* Date : 2018/4/23
*/
public void setSelectCameraKind(String userId,Boolean bll){
if(mContext==null)
return ;
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.SELECT_CAMERA_STATE, Context.MODE_PRIVATE);
}
editor=mSharePre.edit();
editor.putBoolean(mDeviceNum+userId+SELECT_CAMERA_KIND,bll).commit();
}
/**
* method : getSelectTakePhotoOrRecord
* Author : qj
* Describe : 获取相机使用类型
* param : context 上下文
* param : true 相机拍照 false 录像视频
* Date : 2018/4/23
*/
public boolean getSelectTakePhotoOrRecord(){
if(mContext==null)
return true;
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.SELECT_TAKEPHOTO_OR_RECORD, Context.MODE_PRIVATE);
}
return mSharePre.getBoolean(mDeviceNum+SystemConstant.USER_ID+SELECT_TAKE_PHOTO_OR_RECORD, mDeviceNum==1?true:false);
}
/**
* method : setSelectTakePhotoOrRecord
* Author : qj
* Describe : 设置相机使用类型
* param : context 上下文
* param : userid 用户id
* param : true 相机拍照 false 录像视频
* Date : 2018/4/23
*/
public void setSelectTakePhotoOrRecord(String userId,Boolean bll){
if(mContext==null)
return ;
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.SELECT_TAKEPHOTO_OR_RECORD, Context.MODE_PRIVATE);
}
editor=mSharePre.edit();
editor.putBoolean(mDeviceNum+userId+SELECT_TAKE_PHOTO_OR_RECORD,bll).commit();
}
/**
* method : getContinusTakePhotoState
* Author : qj
* Describe : 获取相机工作状态
* param : context 上下文
* Date : 2018/4/23
*/
public boolean getContinusTakePhotoState(){
if(mContext==null)
return true;
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.SELECT_CAMERA_STATE, Context.MODE_PRIVATE);
}
return mSharePre.getBoolean(mDeviceNum+SystemConstant.USER_ID+CONTINUS_TAKE_PHOTO_STATE, true);
}
/**
* method : setContinusTakePhotoState
* Author : qj
* Describe : 设置相机工作状态
* param : context 上下文
* param : userid 用户id
* param : true 停止 false
* Date : 2018/4/23
*/
public void setContinusTakePhotoState(String userId,Boolean bll){
if(mContext==null)
return ;
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.SELECT_CAMERA_STATE, Context.MODE_PRIVATE);
}
editor=mSharePre.edit();
editor.putBoolean(mDeviceNum+userId+CONTINUS_TAKE_PHOTO_STATE,bll).commit();
}
/**
* method : getConnectstate
* Author : qj
* Describe : 获取相机连接状态
* param : context 上下文
* Date : 2018/4/23
*/
public boolean getConnectstate(){
if(mContext==null)
return false;
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.CAMERA_CONNECT_STATE, Context.MODE_PRIVATE);
}
return mSharePre.getBoolean(mDeviceNum+SystemConstant.USER_ID+CAMERA_CONNECT_STATE, false);
}
/**
* method : setConnectstate
* Author : qj
* Describe : 设置相机连接状态
* param : context 上下文
* param : userid 用户id
* param : true 连接 false
* Date : 2018/4/23
*/
public void setConnectstate(String userId,Boolean bll){
if(mContext==null)
return ;
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.CAMERA_CONNECT_STATE, Context.MODE_PRIVATE);
}
editor=mSharePre.edit();
editor.putBoolean(mDeviceNum+userId+CAMERA_CONNECT_STATE,bll).commit();
}
/**
* method : getTakeCameraMode
* Author : qj
* Describe : 获取相机模式
* param : context 上下文
* Date : 2018/4/23
*/
public int getTakeCameraMode(){
if(mContext==null)
return 0;
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.TAKE_CAMERA_MODE, Context.MODE_PRIVATE);
}
return mSharePre.getInt(mDeviceNum+SystemConstant.USER_ID+TAKE_CAMERA_MODE, mDeviceNum==1?0:1);
}
/**
* method : setTakeCameraMode
* Author : qj
* Describe : 设置相机模式
* param : context 上下文
* param : userid 用户id
* param : int 0 视频 1 拍照
* Date : 2018/4/23
*/
public void setTakeCameraMode(String userId,int mode){
if(mContext==null)
return ;
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.TAKE_CAMERA_MODE, Context.MODE_PRIVATE);
}
editor=mSharePre.edit();
editor.putInt(mDeviceNum+userId+TAKE_CAMERA_MODE,mode).commit();
}
/**
* method : getTakeCameraIP
* Author : qj
* Describe : 获取相机ip
* param : context 上下文
* Date : 2018/4/23
*/
public String getTakeCameraIP(){
if(mContext==null)
return "";
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.TAKE_CAMERA_IP, Context.MODE_PRIVATE);
}
String ip=mSharePre.getString(mDeviceNum+SystemConstant.USER_ID+TAKE_CAMERA_IP, "");
return ip;
}
/**
* method : setTakeCameraIP
* Author : qj
* Describe : 设置相机ip
* param : context 上下文
* param : userid 用户id
* param : ip 连接地址
* Date : 2018/4/23
*/
public void setTakeCameraIP(String userId,String ip){
if(mContext==null)
return ;
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.TAKE_CAMERA_IP, Context.MODE_PRIVATE);
}
editor=mSharePre.edit();
editor.putString(mDeviceNum+userId+TAKE_CAMERA_IP,ip).commit();
}
/**
* method : getTakeCameraMac
* Author : qj
* param : mac 硬件信息
* param : context 上下文
* Date : 2018/4/23
*/
public String getTakeCameraMac(){
if(mContext==null)
return "";
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.TAKE_CAMERA_MAC, Context.MODE_PRIVATE);
}
String mac=mSharePre.getString(mDeviceNum+SystemConstant.USER_ID+TAKE_CAMERA_MAC, "");
return mac;
}
/**
* method : setTakeCameraMac
* Author : qj
* Describe : 设置相机mac
* param : context 上下文
* param : userid 用户id
* param : mac 硬件信息
* Date : 2018/4/23
*/
public void setTakeCameraMac(String userId,String mac){
if(mContext==null)
return ;
if(mSharePre==null){
mSharePre = mContext.getSharedPreferences(SystemConstant.TAKE_CAMERA_MAC, Context.MODE_PRIVATE);
}
editor=mSharePre.edit();
editor.putString(mDeviceNum+userId+TAKE_CAMERA_MAC,mac).commit();
}
/**
* method : getConnectstateMac
* Author : qj
* param : mac 硬件信息
* Date : 2018/4/23
*/
public static String getConnectstateMac(Context context){
if(context==null)
return "";
ShareUtil shareUtil = new ShareUtil(context,1);
if(shareUtil.getConnectstate())
return shareUtil.getTakeCameraMac();
shareUtil = new ShareUtil(context,2);
if(shareUtil.getConnectstate())
return shareUtil.getTakeCameraMac();
return "";
}
/**
* method : getConnectstateMac
* Author : qj
* param : mac 硬件信息
* Date : 2018/4/23
*/
public static ShareUtil getCameraMode(Context context){
if(context==null)
return null;
ShareUtil shareUtil = new ShareUtil(context,1);
if(shareUtil.getConnectstate()/*&&shareUtil.getTakeCameraMode()==0不需要判断相机类型*/)
return shareUtil;
shareUtil = new ShareUtil(context,2);
if(shareUtil.getConnectstate()/*&&shareUtil.getTakeCameraMode()==0不需要判断相机类型*/)
return shareUtil;
return null;
}
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="#9F9F9F"/>
<item android:state_checked="true" android:color="@color/white"></item>
<item android:state_selected="true" android:color="@color/white"></item>
<item android:state_pressed="true" android:color="@color/white"></item>
<item android:color="#9F9F9F"></item>
</selector>

View File

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

View File

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

View File

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

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/line_gray" />
<item android:color="@color/white" />
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="false" android:drawable="@color/white"></item>
<item android:state_checked="true" android:drawable="@drawable/icon_btn_bg_gray_press"></item>
<item android:state_selected="true" android:drawable="@drawable/icon_btn_bg_gray_press"></item>
<item android:state_pressed="true" android:drawable="@drawable/icon_btn_bg_gray_press"></item>
<item android:drawable="@drawable/icon_btn_bg_white_nor"></item>
</selector>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/blue" />
<corners android:radius="@dimen/five" />
</shape>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#fe1a1a" />
<corners android:radius="@dimen/five" />
</shape>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@mipmap/icon_camera_on">
</item>
<item android:state_selected="true" android:drawable="@mipmap/icon_camera_on">
</item>
<item android:drawable="@mipmap/icon_camera_off">
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@mipmap/record_select">
</item>
<item android:state_selected="true" android:drawable="@mipmap/record_select">
</item>
<item android:drawable="@mipmap/takephoto_select">
</item>
</selector>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:state_enabled="true" android:drawable="@mipmap/icon_camera_start">
</item>
<item android:state_selected="true" android:state_enabled="true" android:drawable="@mipmap/icon_camera_start">
</item>
<item android:state_enabled="false" android:drawable="@mipmap/icon_camera_start_disable">
</item>
<item android:drawable="@mipmap/icon_camera_end">
</item>
</selector>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners
android:bottomLeftRadius="@dimen/five"
android:bottomRightRadius="@dimen/five"
android:topLeftRadius="@dimen/five"
android:topRightRadius="@dimen/five" />
<solid android:color="@color/white" />
<!-- <solid android:color="@color/fm_kit_white" /> -->
</shape>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
>
<item android:state_enabled="false">
<shape android:shape="rectangle" >
<corners android:bottomLeftRadius="@dimen/five" />
<solid android:color="@color/line_gray" />
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle" >
<corners android:bottomLeftRadius="@dimen/five" />
<solid android:color="#f1f1f1" />
</shape>
</item>
<!-- <solid android:color="@color/fm_card_default_bg_color" /> -->
<item >
<shape android:shape="rectangle" >
<corners android:bottomLeftRadius="@dimen/five" />
<solid android:color="@android:color/white" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
>
<item android:state_enabled="false">
<shape android:shape="rectangle" >
<corners android:bottomRightRadius="@dimen/five" />
<solid android:color="#e1e1e1" />
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle" >
<corners android:bottomRightRadius="@dimen/five" />
<solid android:color="#f1f1f1" />
</shape>
</item>
<!-- <solid android:color="@color/fm_card_default_bg_color" /> -->
<item >
<shape android:shape="rectangle" >
<corners android:bottomRightRadius="@dimen/five" />
<solid android:color="@android:color/white" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/blue" />
<corners
android:bottomLeftRadius="5dp"
android:bottomRightRadius="5dp"
android:topLeftRadius="5dp"
android:topRightRadius="5dp" />
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp"/>
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/icon_camera_close_press" android:state_focused="true"></item>
<item android:drawable="@mipmap/icon_camera_close_press" android:state_pressed="true"></item>
<item android:drawable="@mipmap/icon_camera_close_press" android:state_selected="true"></item>
<item android:drawable="@mipmap/icon_camera_close_press" android:state_checked="true"></item>
<item android:drawable="@mipmap/icon_camera_close_normal"></item>
</selector>

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false" >
<item
android:drawable="@mipmap/loading_01"
android:duration="60"/>
<item
android:drawable="@mipmap/loading_02"
android:duration="60"/>
<item
android:drawable="@mipmap/loading_03"
android:duration="60"/>
<item
android:drawable="@mipmap/loading_04"
android:duration="60"/>
<item
android:drawable="@mipmap/loading_05"
android:duration="60"/>
<item
android:drawable="@mipmap/loading_06"
android:duration="60"/>
<item
android:drawable="@mipmap/loading_07"
android:duration="60"/>
<item
android:drawable="@mipmap/loading_08"
android:duration="60"/>
<item
android:drawable="@mipmap/loading_09"
android:duration="60"/>
<item
android:drawable="@mipmap/loading_10"
android:duration="60"/>
<item
android:drawable="@mipmap/loading_11"
android:duration="60"/>
<item
android:drawable="@mipmap/loading_12"
android:duration="60"/>
</animation-list>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="@mipmap/icon_page_video_a3" android:duration="1000" />
<item android:drawable="@mipmap/icon_page_video_a0" android:duration="1000" />
<item android:drawable="@mipmap/icon_page_video_a3" android:duration="1000" />
<item android:drawable="@mipmap/icon_page_video_a0" android:duration="1000" />
</animation-list>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="@mipmap/icon_page_take_photo_a3" android:duration="1000" />
<item android:drawable="@mipmap/icon_page_take_photo_a3" android:duration="1000" />
<item android:drawable="@mipmap/icon_page_take_photo_a3" android:duration="1000" />
<item android:drawable="@mipmap/icon_page_take_photo_a0" android:duration="1000" />
</animation-list>

View File

@ -14,7 +14,7 @@
<clip android:clipOrientation="horizontal">
<shape>
<corners android:radius="4dp" />
<solid android:color="@color/default_blue" />
<solid android:color="@color/blue" />
</shape>
</clip>
</item>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:drawable="@drawable/shade_btn_gray_bg_4_radius_hd"></item>
<item android:state_checked="true" android:drawable="@drawable/drawable_bg_blue_bg_4_radius"/>
<item android:state_pressed="true" android:drawable="@drawable/drawable_bg_blue_bg_4_radius"/>
<item android:state_selected="true" android:drawable="@drawable/drawable_bg_blue_bg_4_radius"></item>
<item android:drawable="@drawable/drawable_bg_blue_bg_4_radius"/>
</selector>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/line_gray" />
<item android:color="@color/white" />
</selector>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/gray_121" />
<corners
android:bottomLeftRadius="5dp"
android:bottomRightRadius="5dp"
android:topLeftRadius="5dp"
android:topRightRadius="5dp" />
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp"/>
</shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:topLeftRadius="3dp" android:topRightRadius="3dp" android:bottomLeftRadius="3dp" android:bottomRightRadius="3dp"></corners>
<padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp"/>
<solid android:color="#AA535353"></solid>
</shape>

View File

@ -92,6 +92,29 @@
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/right_fragment_nav_graph" />
<ImageButton
android:id="@+id/main_activity_camera"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="160dp"
android:layout_marginTop="20dp"
android:onClick="@{()->mainActivity.openCamera()}"
android:src="@mipmap/icon_page_video_a1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/main_activity_camera2"
android:layout_width="48dp"
android:layout_height="48dp"
android:visibility="gone"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:onClick="@{()->mainActivity.openCamera()}"
android:src="@drawable/baseline_person_24"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
<ImageView
android:id="@+id/cancel_dialog"
android:layout_width="40dp"
android:layout_height="10dp"
android:visibility="invisible"
android:src="@drawable/icon_camera_close_xml" />
<LinearLayout
android:id="@+id/layer_connectCamera_operate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/fl_layout"
android:background="@color/white"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingBottom="15dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="默认外设相机拍照"
android:textColor="@android:color/black"
android:textSize="15sp" />
<CheckBox
android:id="@+id/select_camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:button="@drawable/chk_icon_camera_open_close_xml" />
</RelativeLayout>
<TextView
android:id="@+id/gps_status_hint"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="1dp"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center"
android:marqueeRepeatLimit="marquee_forever"
android:padding="@dimen/ten"
android:textColor="@color/red"
android:scrollHorizontally="true"
android:visibility="gone"
android:singleLine="true"
android:text="相机GPS信号差请稍等片刻或将相机移到开发地带。"
android:textSize="@dimen/card_title_font_2size" />
<TextView
android:id="@+id/one_bt_connect"
style="@style/fm_btn_default_blue_white"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:padding="@dimen/ten"
android:text="一键连接"
android:textSize="@dimen/card_title_font_2size" />
</LinearLayout>
<FrameLayout
android:id="@+id/fl_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/camear_dialog_hight"
android:layout_below="@+id/cancel_dialog"
android:background="@color/bg_gray2">
<CheckBox
android:id="@+id/startorendtakepicture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:button="@drawable/chk_icon_camera_start_stop_xml"
android:checked="true"
android:enabled="false" />
<CheckBox
android:id="@+id/takephoto_or_record"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:layout_margin="10dp"
android:button="@drawable/chk_icon_camera_record_or_takephoto_xml"
android:checked="true"
android:paddingLeft="@dimen/five"
android:text="录像"
android:textColor="@color/white" />
<ImageView
android:id="@+id/video_defalut"
android:layout_width="148.5dp"
android:layout_height="@dimen/camear_dialog_iv_hight"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/camear_dialog_iv_margin_top"
android:src="@mipmap/icon_camera_img" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_gravity="bottom"
android:background="@color/bg_dark"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/five"
android:src="@mipmap/icon_camera_time" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/five"
android:text="00:00:00"
android:textColor="@color/white"
android:textSize="15sp" />
</LinearLayout>
<SurfaceView
android:id="@+id/video"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="@color/bg_gray2"
android:fitsSystemWindows="true"
android:visibility="gone" />
</FrameLayout>
</RelativeLayout>
</ScrollView>

View File

@ -0,0 +1,165 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/ll_dialog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/dialog_bg"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="@+id/tv_title"
style="@style/content_font_default"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:paddingBottom="@dimen/three"
android:paddingLeft="@dimen/eight"
android:paddingRight="@dimen/eight"
android:paddingTop="@dimen/eight"
android:text="title"
android:textColor="@color/black"
android:textSize="@dimen/card_title_font_2size" />
<View
android:id="@+id/title_divider"
android:layout_width="match_parent"
android:layout_height="0.6dp"
android:layout_marginBottom="@dimen/five"
android:layout_marginTop="@dimen/five"
android:background="@color/line_gray" />
<TextView
android:id="@+id/tv_title2"
style="@style/content_font_default"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:paddingBottom="@dimen/eight"
android:text="title"
android:textColor="@color/black"
android:textSize="@dimen/card_title_font_3size"
android:visibility="gone" />
<View
android:id="@+id/title_divider2"
android:layout_width="match_parent"
android:layout_height="0.6dp"
android:background="@color/line_gray"
android:visibility="gone" />
</LinearLayout>
<RelativeLayout
android:id="@+id/rl_content_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center">
<TextView
android:id="@+id/tv_content"
style="@style/content_font_default"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:gravity="center"
android:paddingBottom="@dimen/twenty_two"
android:paddingLeft="@dimen/twelve"
android:paddingRight="@dimen/twelve"
android:paddingTop="@dimen/twenty"
android:text="提示内容"
android:textColor="@color/black"
android:textSize="@dimen/card_title_font_3size" />
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_bottom_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center"
android:orientation="vertical">
<View
android:id="@+id/v_divice"
android:layout_width="match_parent"
android:layout_height="0.6dp"
android:background="@color/line_gray"
android:visibility="visible" />
<LinearLayout
android:id="@+id/ll_bottom_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:id="@+id/btn_fm_cancel"
style="@style/btn_default_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/dialog_bg_cancel"
android:gravity="center"
android:padding="@dimen/twelve"
android:text="取消"
android:textColor="@color/common_dialog_cancel_text_selector" />
<View
android:id="@+id/middle_view"
android:layout_width="0.6dp"
android:layout_height="match_parent"
android:background="@drawable/dialog_bg_cancel"
android:visibility="gone" />
<TextView
android:id="@+id/btn_fm_middle"
style="@style/btn_default_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/dialog_bg_ok"
android:gravity="center"
android:padding="@dimen/twelve"
android:text="中间"
android:textColor="@color/common_dialog_middle_text_selector"
android:visibility="gone" />
<View
android:id="@+id/view_dialog"
android:layout_width="0.6dp"
android:layout_height="match_parent"
android:background="@color/line_gray" />
<TextView
android:id="@+id/btn_fm_confirm"
style="@style/btn_default_style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/dialog_bg_ok"
android:gravity="center"
android:padding="@dimen/twelve"
android:text="确定"
android:textColor="@color/common_dialog_confirm_text_selector" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/parentPanel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:background="@color/white"
android:orientation="horizontal" >
<ImageView
android:id="@+id/customFrameLoadImg"
android:layout_width="60dp"
android:layout_height="60dp"
android:background="@drawable/loading_anim" />
<TextView
android:id="@+id/customFrameMsg"
android:layout_width="wrap_content"
android:textColor="@color/black"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:singleLine="true"
android:textSize="14sp" />
</LinearLayout>

View File

@ -11,7 +11,7 @@
android:id="@+id/offline_map_tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/default_blue"
android:background="@color/blue"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">

View File

@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@color/default_blue"
android:background="@color/blue"
android:gravity="bottom"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/res/layout/transient_notification.xml
**
** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/transient_toast_bg"
android:orientation="vertical" >
<TextView
android:textSize="@dimen/card_title_font_2size"
android:id="@android:id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:shadowColor="#BB000000"
android:shadowRadius="2.75"
android:textAppearance="@android:style/TextAppearance.Small"
android:textColor="@android:color/background_light" />
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -2,8 +2,21 @@
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="red">#FF0000</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="cv_gray_153">#999999</color>
<color name="cvm_red">#FF3B30</color>
<color name="cv_bg_color">#553C3F41</color>
<color name="btn_blue_solid">#108ee9</color>
<color name="background_light">#ffffffff</color>
<!-- 一键连接对话框背景色 -->
<color name="bg_gray2">#d1d1d1</color>
<!-- 一键连接时间显示区域背景色 -->
<color name="bg_dark">#999999</color>
<color name="gray_121">#797979</color>
<color name="gray_59">#595959</color>
<color name="text_hint_gray" comment="输入框内默认字体颜色,输入框边框颜色">#c1c1c1</color>
</resources>

View File

@ -9,4 +9,28 @@
<dimen name="default_font_size" comment="默认字体大小style中父最顶层">15dp</dimen>
<dimen name="card_title_font_2size">13sp</dimen>
<dimen name="card_title_font_3size">10sp</dimen>
<dimen name="one">1dp</dimen>
<dimen name="two">2dp</dimen>
<dimen name="three">3dp</dimen>
<dimen name="four">4dp</dimen>
<dimen name="five">5dp</dimen>
<dimen name="six">6dp</dimen>
<dimen name="eight">8dp</dimen>
<dimen name="nine">9dp</dimen>
<dimen name="ten">10dp</dimen>
<dimen name="twelve">12dp</dimen>
<dimen name="twefour">14dp</dimen>
<dimen name="fifteen">15dp</dimen>
<dimen name="sixteen">16dp</dimen>
<dimen name="eighteen">18dp</dimen>
<dimen name="twenty">20dp</dimen>
<dimen name="twenty_two">22dp</dimen>
<dimen name="twenty_four">24dp</dimen>
<!-- 相机设置iv距离上方间距-->
<dimen name="camear_dialog_iv_margin_top" comment="相机设置窗体高度">25dp</dimen>
<!-- 相机设置窗体高度-->
<dimen name="camear_dialog_hight" comment="相机设置窗体高度">150dp</dimen>
<!-- 相机设置窗体IV高度-->
<dimen name="camear_dialog_iv_hight" comment="相机设置窗体高度">75dp</dimen>
<dimen name="head_img_width">48dp</dimen>
</resources>

View File

@ -6,7 +6,7 @@
<item name="android:clickable">true</item>
<item name="android:focusable">true</item>
<item name="android:layout_alignParentTop">true</item>
<item name="android:background">@color/default_blue</item>
<item name="android:background">@color/blue</item>
<item name="android:paddingBottom">6dp</item>
<item name="android:paddingLeft">14dp</item>
<item name="android:paddingRight">14dp</item>
@ -54,4 +54,33 @@
<item name="android:textColor">@color/btn_blue_white</item>
<item name="android:textSize">15sp</item>
</style>
<!-- 默认按钮样式 -->
<style name="btn_default_style" parent="content_font_default">
<item name="android:textColor">@color/btn_select_color</item>
<item name="android:background">@drawable/btn_bg_default</item>
<item name="android:clickable">true</item>
<item name="android:focusable">true</item>
<item name="android:gravity">center</item>
<item name="android:paddingBottom">1dp</item>
</style>
<style name="fm_btn_default_blue_white" parent="@android:style/Widget.Button">
<item name="android:background">@drawable/selector_bg_blue_gray_bg_4_radius</item>
<item name="android:textColor">@color/selector_default_text_color_white_enable_gray</item>
<item name="android:padding">@dimen/five</item>
</style>
<style name="MyDialog" parent="Theme.AppCompat.DialogWhenLarge">
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
<!-- 连续拍照对话框 -->
<style name="MyCustomDialog" parent="@style/MyDialog">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MissingDefaultResource">
<base-config cleartextTrafficPermitted="true" />
</network-security-config>

View File

@ -76,7 +76,6 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
// implementation 'com.yanzhenjie:kalle:0.1.7'
// VTM依赖
implementation "net.sf.kxml:kxml2:2.3.0"
implementation 'org.slf4j:slf4j-api:2.0.7'

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More