Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c3b570dad | ||
|
|
b29e3eaf03 |
+4
-5
@@ -37,8 +37,8 @@ android {
|
||||
applicationId "com.arpa.hndahesudintocctmsdriver"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 30
|
||||
versionCode 67
|
||||
versionName "3.3.7"
|
||||
versionCode 65
|
||||
versionName "3.3.5"
|
||||
flavorDimensions "CHANNEL_VALUE"
|
||||
flavorDimensions "app_icon"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@@ -105,7 +105,7 @@ android {
|
||||
JPUSH_CHANNEL: "developer-default"//暂时填写默认值即可.
|
||||
]
|
||||
buildConfigField("String", "OPEN_AL_URL", "\"https://oapi-staging.alct56.com\"")
|
||||
buildConfigField("String", "BASE_URL", "\"https://app.test.dahehuoyun.com/api/\"")
|
||||
buildConfigField("String", "BASE_URL", "\"http://app.test.dahehuoyun.com/api/\"")
|
||||
buildConfigField "boolean", "isTest", "true"
|
||||
//APP名称,可以在androidMainfest中引用
|
||||
resValue "string", "appName", "司机测试"
|
||||
@@ -114,7 +114,7 @@ android {
|
||||
applicationId "com.arpa.hndahesudintocctmsdriver"
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "大河好运司机",
|
||||
app_icon : "@drawable/diver_logo",
|
||||
GAODEKEY : "9480fd96746922630e9bf6c75a101059",
|
||||
GAODEKEY : "c68051b43e79e47a1556fc695371c902",
|
||||
JPUSH_PKGNAME: applicationId,
|
||||
JPUSH_APPKEY : "fba6f55621c670d8c1fe9191", //JPush 上注册的包名对应的 Appkey.
|
||||
JPUSH_CHANNEL: "developer-default"//暂时填写默认值即可.
|
||||
@@ -228,6 +228,5 @@ dependencies {
|
||||
implementation 'com.github.getActivity:XToast:8.2'
|
||||
|
||||
implementation project(path: ':mylibrary')
|
||||
implementation 'com.lk.mapsdk:sdk-full:2.3.7'
|
||||
|
||||
}
|
||||
Binary file not shown.
@@ -2,7 +2,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.arpa.hndahesudintocctmsdriver">
|
||||
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<!-- 白名单 -->
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||
@@ -12,11 +11,10 @@
|
||||
<!-- 录音 -->
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||
<!--播音-->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<!-- 地图截屏图片保存等 -->
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_PERMISSION" />
|
||||
<!-- 极光 -->
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.READ_PROFILE" />
|
||||
@@ -69,24 +67,19 @@
|
||||
android:name="com/alct/mdp"
|
||||
android:required="false" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.lk.lbsapi.API_KEY"
|
||||
android:value="EE1721986040968235494A762772C95410D9881BB10790FC0BCRFNPFKW4K6697" />
|
||||
|
||||
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.MainActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait"></activity>
|
||||
android:screenOrientation="portrait" ></activity>
|
||||
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.wallet.WithdrawalActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.wallet.UpBankActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.OrderAllActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
@@ -101,11 +94,11 @@
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.PhotoCarActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
android:windowSoftInputMode="adjustPan|stateHidden"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.VehicleAuthActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivity"
|
||||
android:screenOrientation="portrait">
|
||||
@@ -150,13 +143,13 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.GetShangChuanActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.AuthQualificationActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.OrderListActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.HuoYunDelActivity"
|
||||
android:screenOrientation="portrait">
|
||||
@@ -169,14 +162,14 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.CertificatesActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
android:windowSoftInputMode="adjustPan|stateHidden"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.AddCarSuccActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.login.LoginActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.login.WelcomeActivity"
|
||||
android:exported="true"
|
||||
@@ -200,10 +193,10 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.drivercircle.VideoReleaseActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.WebPDFActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.StartYunDanActivity"
|
||||
android:screenOrientation="portrait">
|
||||
@@ -211,13 +204,13 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.drivercircle.HomePageActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.alert.VehicleChoiceActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.OrderComplaintActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.web.WebActivity"
|
||||
android:screenOrientation="portrait"
|
||||
@@ -231,7 +224,7 @@
|
||||
<activity
|
||||
android:name=".ui.news.NewActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
|
||||
<service
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.service.TrackService"
|
||||
@@ -274,9 +267,10 @@
|
||||
<meta-data
|
||||
android:name="com.amap.api.v2.apikey"
|
||||
android:value="${GAODEKEY}" />
|
||||
<!-- android:value="702eaa84675618b8eb69298d9fd42ca3" />-->
|
||||
<!-- android:value="702eaa84675618b8eb69298d9fd42ca3" />-->
|
||||
|
||||
<service android:name="com.amap.api.location.APSService"></service>
|
||||
<service android:name="com.amap.api.location.APSService"
|
||||
android:foregroundServiceType="location"></service>
|
||||
|
||||
<!--百度地图-->
|
||||
<meta-data
|
||||
@@ -370,11 +364,10 @@
|
||||
|
||||
<activity
|
||||
android:name=".H5Activity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait">
|
||||
android:screenOrientation="portrait"
|
||||
android:launchMode="singleTask">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
|
||||
@@ -23,9 +23,6 @@ import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||
import com.gyf.cactus.Cactus;
|
||||
import com.gyf.cactus.callback.CactusBackgroundCallback;
|
||||
import com.gyf.cactus.callback.CactusCallback;
|
||||
import com.lk.mapsdk.base.mapapi.initializer.InitializerOptions;
|
||||
import com.lk.mapsdk.base.mapapi.initializer.SDKInitializer;
|
||||
import com.lk.mapsdk.base.mapapi.model.CoordType;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.umeng.commonsdk.UMConfigure;
|
||||
|
||||
@@ -52,18 +49,6 @@ public class App extends Application {
|
||||
CommonBaseLibrary.getInstance().init(this, Api.BASE_URL);
|
||||
CrashReport.initCrashReport(getApplicationContext(), "0fa55ffad8", false);
|
||||
String state = SPUtil.getSP(con, "state_data", "authorization_state");
|
||||
|
||||
InitializerOptions options = new InitializerOptions();
|
||||
// 设置是否使用Https网络请求,默认使用
|
||||
options.setHttpsEnable(true);
|
||||
// 设置坐标系,默认GCJ02
|
||||
options.setCoordType(CoordType.GCJ02);
|
||||
// SDK 初始化
|
||||
SDKInitializer.initialization(getApplicationContext(), options);
|
||||
|
||||
// Log 开关使能
|
||||
SDKInitializer.setLogEnable(true);
|
||||
|
||||
if ("1".equals(state)) {
|
||||
try {
|
||||
Context context = getApplicationContext();
|
||||
@@ -93,29 +78,30 @@ public class App extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
// PendingIntent pendingIntent =
|
||||
// PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
// Cactus.getInstance()
|
||||
// .isDebug(true)
|
||||
// //可选,设置通知栏点击事件
|
||||
// .setPendingIntent(pendingIntent)
|
||||
//// .setBackgroundMusicEnabled(true)//可选,退到后台是否可以播放音乐
|
||||
//// .setMusicId(R.raw.main) //可选,设置音乐
|
||||
//// .setPendingIntent(pendingIntent)//可选,设置通知栏点击事件
|
||||
//// .addCallback(new CactusCallback())//可选,运行时回调
|
||||
// .setCrashRestartUIEnabled(true) //可选,设置奔溃可以重启,google原生rom android 10以下可以正常重启
|
||||
// .setCrashRestartUIEnabled(true)//可选,设置奔溃可以重启,google原生rom android 10以下可以正常重启
|
||||
// .setTitle("大河好运")
|
||||
// .setSmallIcon(R.drawable.diver_logo)
|
||||
// .addBackgroundCallback(new CactusBackgroundCallback() {
|
||||
// @Override
|
||||
// public void onBackground(boolean b) {
|
||||
// if (b){
|
||||
// getBillLocation();
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// .register(this);
|
||||
PendingIntent pendingIntent =
|
||||
PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
Cactus.getInstance()
|
||||
.isDebug(true)
|
||||
//可选,设置通知栏点击事件
|
||||
.setPendingIntent(pendingIntent)
|
||||
.setBackgroundMusicEnabled(true)//可选,退到后台是否可以播放音乐
|
||||
.setMusicId(R.raw.main) //可选,设置音乐
|
||||
// .setPendingIntent(pendingIntent)//可选,设置通知栏点击事件
|
||||
// .addCallback(new CactusCallback())//可选,运行时回调
|
||||
.setCrashRestartUIEnabled(true) //可选,设置奔溃可以重启,google原生rom android 10以下可以正常重启
|
||||
.setCrashRestartUIEnabled(true)//可选,设置奔溃可以重启,google原生rom android 10以下可以正常重启
|
||||
.setTitle("大河好运")
|
||||
.setContent("大河好运司机端为您提供服务")
|
||||
.setSmallIcon(R.drawable.diver_logo)
|
||||
.addBackgroundCallback(new CactusBackgroundCallback() {
|
||||
@Override
|
||||
public void onBackground(boolean b) {
|
||||
if (b){
|
||||
getBillLocation();
|
||||
}
|
||||
}
|
||||
})
|
||||
.register(this);
|
||||
}
|
||||
|
||||
public static App getApp() {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,157 +0,0 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.bean;
|
||||
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.App;
|
||||
import com.dahe.mylibrary.utils.AppUtils;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @ClassName AppInfoBean
|
||||
* @Author john
|
||||
* @Date 2024/7/22 15:31
|
||||
* @Description TODO
|
||||
*/
|
||||
public class AppInfoBean {
|
||||
private String userPhone;
|
||||
private String macIpaddr = Settings.Secure.getString(App.getApp().getContentResolver(),Settings.Secure.ANDROID_ID);
|
||||
// private String macIpaddr = android.os.Build.ID;
|
||||
private String clientSource = "driver";
|
||||
private String status = "";
|
||||
private String mobilePhoneManufacturerName = android.os.Build.BRAND;
|
||||
private String mobilePhoneProductName = android.os.Build.MODEL;
|
||||
private String mobilePhoneMotherboardName = android.os.Build.BOARD;
|
||||
private String mobilePhoneHardwareName = android.os.Build.DEVICE;
|
||||
private String mobilePhoneMachineSystemLanguage = Locale.getDefault().getLanguage();
|
||||
private String androidVersion=android.os.Build.VERSION.RELEASE;
|
||||
private String androidSystemSdk = android.os.Build.VERSION.SDK_INT+"";
|
||||
private String appVersionName = AppUtils.getAppVersionName();
|
||||
private String appVersionNumber = AppUtils.getAppVersionCode()+"";
|
||||
|
||||
public String getUserPhone() {
|
||||
return userPhone;
|
||||
}
|
||||
|
||||
public void setUserPhone(String userPhone) {
|
||||
this.userPhone = userPhone;
|
||||
}
|
||||
|
||||
public String getMacIpaddr() {
|
||||
return macIpaddr;
|
||||
}
|
||||
|
||||
public void setMacIpaddr(String macIpaddr) {
|
||||
this.macIpaddr = macIpaddr;
|
||||
}
|
||||
|
||||
public String getClientSource() {
|
||||
return clientSource;
|
||||
}
|
||||
|
||||
public void setClientSource(String clientSource) {
|
||||
this.clientSource = clientSource;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getMobilePhoneManufacturerName() {
|
||||
return mobilePhoneManufacturerName;
|
||||
}
|
||||
|
||||
public void setMobilePhoneManufacturerName(String mobilePhoneManufacturerName) {
|
||||
this.mobilePhoneManufacturerName = mobilePhoneManufacturerName;
|
||||
}
|
||||
|
||||
public String getMobilePhoneProductName() {
|
||||
return mobilePhoneProductName;
|
||||
}
|
||||
|
||||
public void setMobilePhoneProductName(String mobilePhoneProductName) {
|
||||
this.mobilePhoneProductName = mobilePhoneProductName;
|
||||
}
|
||||
|
||||
public String getMobilePhoneMotherboardName() {
|
||||
return mobilePhoneMotherboardName;
|
||||
}
|
||||
|
||||
public void setMobilePhoneMotherboardName(String mobilePhoneMotherboardName) {
|
||||
this.mobilePhoneMotherboardName = mobilePhoneMotherboardName;
|
||||
}
|
||||
|
||||
public String getMobilePhoneHardwareName() {
|
||||
return mobilePhoneHardwareName;
|
||||
}
|
||||
|
||||
public void setMobilePhoneHardwareName(String mobilePhoneHardwareName) {
|
||||
this.mobilePhoneHardwareName = mobilePhoneHardwareName;
|
||||
}
|
||||
|
||||
public String getMobilePhoneMachineSystemLanguage() {
|
||||
return mobilePhoneMachineSystemLanguage;
|
||||
}
|
||||
|
||||
public void setMobilePhoneMachineSystemLanguage(String mobilePhoneMachineSystemLanguage) {
|
||||
this.mobilePhoneMachineSystemLanguage = mobilePhoneMachineSystemLanguage;
|
||||
}
|
||||
|
||||
public String getAndroidVersion() {
|
||||
return androidVersion;
|
||||
}
|
||||
|
||||
public void setAndroidVersion(String androidVersion) {
|
||||
this.androidVersion = androidVersion;
|
||||
}
|
||||
|
||||
public String getAndroidSystemSdk() {
|
||||
return androidSystemSdk;
|
||||
}
|
||||
|
||||
public void setAndroidSystemSdk(String androidSystemSdk) {
|
||||
this.androidSystemSdk = androidSystemSdk;
|
||||
}
|
||||
|
||||
public String getAppVersionName() {
|
||||
return appVersionName;
|
||||
}
|
||||
|
||||
public void setAppVersionName(String appVersionName) {
|
||||
this.appVersionName = appVersionName;
|
||||
}
|
||||
|
||||
public String getAppVersionNumber() {
|
||||
return appVersionNumber;
|
||||
}
|
||||
|
||||
public void setAppVersionNumber(String appVersionNumber) {
|
||||
this.appVersionNumber = appVersionNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AppInfoBean{" +
|
||||
"userPhone='" + userPhone + '\'' +
|
||||
", macIpaddr='" + macIpaddr + '\'' +
|
||||
", clientSource='" + clientSource + '\'' +
|
||||
", status='" + status + '\'' +
|
||||
", mobilePhoneManufacturerName='" + mobilePhoneManufacturerName + '\'' +
|
||||
", mobilePhoneProductName='" + mobilePhoneProductName + '\'' +
|
||||
", mobilePhoneMotherboardName='" + mobilePhoneMotherboardName + '\'' +
|
||||
", mobilePhoneHardwareName='" + mobilePhoneHardwareName + '\'' +
|
||||
", mobilePhoneMachineSystemLanguage='" + mobilePhoneMachineSystemLanguage + '\'' +
|
||||
", androidVersion='" + androidVersion + '\'' +
|
||||
", androidSystemSdk='" + androidSystemSdk + '\'' +
|
||||
", appVersionName='" + appVersionName + '\'' +
|
||||
", appVersionNumber='" + appVersionNumber + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -162,16 +162,11 @@ public class RequestConstant {
|
||||
|
||||
//车辆自动审核触发器
|
||||
private static final String CAR_AUDIT = "/app/carDriver/carAutomaticAudit";
|
||||
private static final String APP_INFO = "/common/app/logininfor";
|
||||
|
||||
public static String getCarAudit() {
|
||||
return BASE_URL + CAR_AUDIT;
|
||||
}
|
||||
|
||||
public static String postAppInfo() {
|
||||
return BASE_URL + APP_INFO;
|
||||
}
|
||||
|
||||
public static String getCarColor() {
|
||||
return BASE_URL + CAR_COLOR;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.AppInfoBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.event.VehicleEvent;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.auth.CertificatesActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.business.Md5Util;
|
||||
@@ -119,14 +118,6 @@ public class UserRequset {
|
||||
RequestUtil.start(1, WoDeFragment.VEHICLE_DEL, re, con, hd);
|
||||
}
|
||||
|
||||
//车辆详情
|
||||
public void vehicleDelTwo(String id) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("carId", id);
|
||||
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getGetCarDel(), MapUtil.mapJson(map)), getToken(con), con);
|
||||
RequestUtil.start(1, "onlyGetDetail", re, con, hd);
|
||||
}
|
||||
|
||||
//司机身份证认证
|
||||
public void driverIDAuth() {
|
||||
String url = RequestConstant.BASE_URL + "/app/driver/auth/authInfo";
|
||||
@@ -163,7 +154,7 @@ public class UserRequset {
|
||||
/**
|
||||
* 判断是否开启未知应用安装权限
|
||||
*/
|
||||
private void isOpenAppNoRe() {
|
||||
private void isOpenAppNoRe(){
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
boolean b = con.getPackageManager().canRequestPackageInstalls();
|
||||
if (!b) {
|
||||
@@ -178,8 +169,8 @@ public class UserRequset {
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
private void startInstallPermissionSettingActivity() {
|
||||
//注意这个是8.0新API
|
||||
Uri packageURI = Uri.parse("package:" + con.getPackageName());
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, packageURI);
|
||||
Uri packageURI = Uri.parse("package:" +con.getPackageName());
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES,packageURI);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
con.startActivity(intent);
|
||||
}
|
||||
@@ -230,18 +221,7 @@ public class UserRequset {
|
||||
public void carAudit(String carId) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("carId", carId);
|
||||
Request re = OkHttpUtil.get(new OkDate(RequestConstant.getCarAudit(), "get", Md5Util.resNoUrl(map)), getToken(con));
|
||||
Request re = OkHttpUtil.get(new OkDate(RequestConstant.getCarAudit(),"get", Md5Util.resNoUrl(map)),getToken(con));
|
||||
RequestUtil.start(1, VehicleAuthActivity.CAR_AUDIO, re, con, hd);
|
||||
}
|
||||
|
||||
public void postAppInfo(AppInfoBean appInfoBean, String type) {
|
||||
// Request re = OkHttpUtil.get(new OkDate(RequestConstant.getCarAudit(),"get", gson.toJson(appInfoBean)),getToken(con));
|
||||
Request re;
|
||||
if ("put".equals(type)) {
|
||||
re = OkHttpUtil.put(new OkDate(RequestConstant.postAppInfo(), type, gson.toJson(appInfoBean)), con);
|
||||
} else {
|
||||
re = OkHttpUtil.post(new OkDate(RequestConstant.postAppInfo(), type, gson.toJson(appInfoBean)), con);
|
||||
}
|
||||
RequestUtil.start(1, VehicleAuthActivity.APP_INFO, re, con, hd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,15 @@ package com.arpa.hndahesudintocctmsdriver.service;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.location.AMapLocation;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.FileIOUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.BaseBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.HuoYuanRequset;
|
||||
@@ -18,8 +21,13 @@ import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.cache.CacheGroup;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.http.RequsetCodeConstants;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.logging.Filter;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
@@ -32,7 +40,7 @@ public class TrackService extends Service {
|
||||
private Context con;
|
||||
private TrackInputBean tib=new TrackInputBean();
|
||||
private LocationGDUtil l;
|
||||
private int timeSum=1000*60*3;
|
||||
private int timeSum=1000*60;
|
||||
private String snn="";
|
||||
private Gson gson=new Gson();
|
||||
private HuoYuanRequset hyr;
|
||||
@@ -51,7 +59,30 @@ public class TrackService extends Service {
|
||||
}
|
||||
break;
|
||||
case LocationGDUtil.RES:
|
||||
genzong();
|
||||
if(CacheGroup.cacheList.get("getLocation")!=null){
|
||||
AMapLocation location = gson.fromJson(CacheGroup.cacheList.get("getLocation"), AMapLocation.class);
|
||||
String time2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
String time = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
||||
// 当前时间:${time2},经纬度:${it.latitude}:${it.longitude}
|
||||
FileIOUtils.writeFileFromString(
|
||||
Environment.getExternalStorageDirectory()
|
||||
.toString() + "/crashinfo/" + "crash-"+time+".txt",
|
||||
"当前时间:"+time2+",经纬度:"+location.getLatitude()+":"+location.getLongitude(),
|
||||
true
|
||||
);
|
||||
// genzong(location);
|
||||
CacheGroup.cacheList.remove("getLocation");
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
String time2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
String time = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
||||
FileIOUtils.writeFileFromString(
|
||||
Environment.getExternalStorageDirectory()
|
||||
.toString() + "/crashinfo/" + "crash-"+time+".txt",
|
||||
"当前时间:"+time2+",定位失败",
|
||||
true
|
||||
);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
@@ -94,13 +125,13 @@ public class TrackService extends Service {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
public void genzong(){
|
||||
public void genzong(AMapLocation location){
|
||||
//经度
|
||||
tib.setLatitude(l.getLatitude()+"");
|
||||
tib.setLatitude(location.getLatitude()+"");
|
||||
//纬度
|
||||
tib.setLongitude(l.getLongitude()+"");
|
||||
Log.e("经度",l.getLatitude()+"");
|
||||
Log.e("维度",l.getLongitude()+"");
|
||||
tib.setLongitude(location.getLongitude()+"");
|
||||
Log.e("经度",location.getLatitude()+"");
|
||||
Log.e("维度",location.getLongitude()+"");
|
||||
//单号
|
||||
tib.setShippingNoteNumber(snn);
|
||||
hyr.trackTracking(tib);
|
||||
|
||||
@@ -98,11 +98,6 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
}
|
||||
CacheGroup.cacheList.remove(WoDeFragment.VEHICLE_DEL);
|
||||
}
|
||||
if (CacheGroup.cacheList.get("onlyGetDetail") != null) {
|
||||
Log.e("--res--", CacheGroup.cacheList.get("onlyGetDetail"));
|
||||
cdb = gson.fromJson(CacheGroup.cacheList.get("onlyGetDetail"), CarDelBean.class);
|
||||
CacheGroup.cacheList.remove("onlyGetDetail");
|
||||
}
|
||||
|
||||
|
||||
if (CacheGroup.cacheList.get("upload") != null) {
|
||||
@@ -147,7 +142,6 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
Toast.makeText(con, "上传车辆登记证书照片", Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case 3:
|
||||
ur.vehicleDelTwo(carId);
|
||||
Toast.makeText(con, "上传道路运输证成功", Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case 4:
|
||||
@@ -366,7 +360,7 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
* 展示大图片
|
||||
*/
|
||||
private void showBigImg() {
|
||||
if ((type == 3 && TextUtils.isEmpty(cdb.getData().getRoadLicensePhoto())) || (type == 4 && TextUtils.isEmpty(cdb.getData().getPolicyPhotoUrl()))) {
|
||||
if ((type == 0 && TextUtils.isEmpty(cdb.getData().getRoadLicensePhoto())) || (type == 4 && TextUtils.isEmpty(cdb.getData().getPolicyPhotoUrl()))) {
|
||||
choicePhoto();
|
||||
return;
|
||||
}
|
||||
@@ -411,8 +405,8 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
// .asImageViewer(img, cdb.getData().getRoadLicensePhoto(), true, -1, -1, 50, false, new CertificatesActivity.ImageLoader())
|
||||
// .show();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (cdb.getData().getPolicyPhotoUrl() != null && !"".equals(cdb.getData().getPolicyPhotoUrl())) {
|
||||
@@ -424,8 +418,8 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
// .asImageViewer(img, cdb.getData().getRoadLicensePhoto(), true, -1, -1, 50, false, new CertificatesActivity.ImageLoader())
|
||||
// .show();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@ public class VehicleAuthActivity extends BaseAppCompatActivity {
|
||||
public String carId="";
|
||||
public static final String DEL_CAR="delete_che";
|
||||
public static final String CAR_AUDIO="CAR_AUDIO";
|
||||
public static final String APP_INFO="APP_INFO";
|
||||
private int submitIndex=0;
|
||||
private BaseBean bb;
|
||||
private ImageView show_img;
|
||||
|
||||
+215
-372
@@ -17,14 +17,30 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
|
||||
|
||||
import com.amap.api.location.AMapLocation;
|
||||
import com.amap.api.location.AMapLocationClient;
|
||||
import com.amap.api.location.AMapLocationClientOption;
|
||||
import com.amap.api.location.AMapLocationListener;
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.LocationSource;
|
||||
import com.amap.api.maps.MapView;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
|
||||
import com.amap.api.services.core.AMapException;
|
||||
import com.amap.api.services.core.LatLonPoint;
|
||||
import com.amap.api.services.route.BusRouteResult;
|
||||
import com.amap.api.services.route.DrivePath;
|
||||
import com.amap.api.services.route.DriveRouteResult;
|
||||
import com.amap.api.services.route.DriveStep;
|
||||
import com.amap.api.services.route.RideRouteResult;
|
||||
import com.amap.api.services.route.RouteSearch;
|
||||
import com.amap.api.services.route.WalkRouteResult;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.dahe.mylibrary.utils.TimeUtil;
|
||||
import com.dahe.mylibrary.utils.ToastUtils;
|
||||
@@ -51,27 +67,6 @@ import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseRecyclerView;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.ScoreView;
|
||||
import com.lk.mapsdk.base.mapapi.initializer.InitializerOptions;
|
||||
import com.lk.mapsdk.base.mapapi.initializer.SDKInitializer;
|
||||
import com.lk.mapsdk.base.mapapi.model.CoordType;
|
||||
import com.lk.mapsdk.base.mapapi.model.LatLng;
|
||||
import com.lk.mapsdk.base.mapapi.model.LatLngBounds;
|
||||
import com.lk.mapsdk.map.mapapi.annotation.Marker;
|
||||
import com.lk.mapsdk.map.mapapi.annotation.Polyline;
|
||||
import com.lk.mapsdk.map.mapapi.annotation.options.MarkerOptions;
|
||||
import com.lk.mapsdk.map.mapapi.annotation.options.PolylineOptions;
|
||||
import com.lk.mapsdk.map.mapapi.annotation.util.BitmapDescriptorFactory;
|
||||
import com.lk.mapsdk.map.mapapi.camera.MapStatusUpdateFactory;
|
||||
import com.lk.mapsdk.map.mapapi.map.LKMap;
|
||||
import com.lk.mapsdk.map.mapapi.map.MapView;
|
||||
import com.lk.mapsdk.map.platform.style.layers.Property;
|
||||
import com.lk.mapsdk.route.mapapi.base.AutoInfo;
|
||||
import com.lk.mapsdk.route.mapapi.base.DrivingCostingOptionsInfo;
|
||||
import com.lk.mapsdk.route.mapapi.base.LocationsInfo;
|
||||
import com.lk.mapsdk.route.mapapi.driving.DrivingRoutePlan;
|
||||
import com.lk.mapsdk.route.mapapi.driving.DrivingRoutePlanOptions;
|
||||
import com.lk.mapsdk.route.mapapi.driving.DrivingRoutePlanResult;
|
||||
import com.lk.mapsdk.route.mapapi.driving.OnDrivingRoutePlanListener;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -87,7 +82,7 @@ public class StartYunDanActivity extends BaseActivity {
|
||||
|
||||
private String TAG = "StartYunDanActivity";
|
||||
private NestedScrollView bottomSheet;
|
||||
private MapView mapView;
|
||||
private MapView map;
|
||||
private BaseRecyclerView brv;
|
||||
private AlphaAnimation mShowAnim, mHiddenAmin;//控件的显示和隐藏动画
|
||||
private LinearLayout protect;
|
||||
@@ -149,6 +144,7 @@ public class StartYunDanActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private UserBean ub;
|
||||
private AMap aMap;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -156,10 +152,6 @@ public class StartYunDanActivity extends BaseActivity {
|
||||
StateStyleUtil.stateTextColor(this);
|
||||
setContentView(R.layout.activity_yundan_start);
|
||||
con = this;
|
||||
mapView = findViewById(R.id.map);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mLKMap = mapView.getMap();
|
||||
initMap();
|
||||
id = getIntent().getExtras().getInt("id");
|
||||
brv = findViewById(R.id.brv);
|
||||
protect = findViewById(R.id.protect);
|
||||
@@ -169,10 +161,12 @@ public class StartYunDanActivity extends BaseActivity {
|
||||
mBottomSheetBehavior.setHideable(false);
|
||||
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
//mBottomSheetBehavior.set
|
||||
|
||||
|
||||
// initLoaction();
|
||||
|
||||
map = findViewById(R.id.map);
|
||||
map.onCreate(savedInstanceState);
|
||||
if (aMap == null) {
|
||||
aMap = map.getMap();
|
||||
initLoaction();
|
||||
}
|
||||
Log.e("--id--", "" + id);
|
||||
String userdata = SPUtil.getSP(con, "data", "userdata");
|
||||
if (!userdata.equals("")) {
|
||||
@@ -321,8 +315,7 @@ public class StartYunDanActivity extends BaseActivity {
|
||||
}
|
||||
initZX(upkey, v15, position, o, 1);
|
||||
});
|
||||
// search();
|
||||
doSearch();
|
||||
search();
|
||||
}
|
||||
|
||||
public void initZX(boolean key, View v, int position, Object o, int type) {
|
||||
@@ -456,8 +449,8 @@ public class StartYunDanActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (mapView != null) {
|
||||
mapView.onResume();
|
||||
if (map != null) {
|
||||
map.onResume();
|
||||
}
|
||||
hyr.startOrder(id);
|
||||
hyr.getEvaluate(id);
|
||||
@@ -466,352 +459,223 @@ public class StartYunDanActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
if (mapView != null) {
|
||||
mapView.onPause();
|
||||
if (map != null) {
|
||||
map.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mapView != null) {
|
||||
mapView.onDestroy();
|
||||
if (map != null) {
|
||||
map.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull @NotNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mapView.onSaveInstanceState(outState);
|
||||
map.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
LocationSource.OnLocationChangedListener mListener;
|
||||
AMapLocationClient mlocationClient;
|
||||
AMapLocationClientOption mLocationOption;
|
||||
|
||||
// public void initLoaction() {
|
||||
// // 设置定位监听
|
||||
// aMap.setLocationSource(new LocationSource() {
|
||||
// @Override
|
||||
// public void activate(OnLocationChangedListener onLocationChangedListener) {
|
||||
// mListener = onLocationChangedListener;
|
||||
// if (mlocationClient == null) {
|
||||
// //初始化定位
|
||||
// try {
|
||||
// mlocationClient = new AMapLocationClient(con);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// //初始化定位参数
|
||||
// mLocationOption = new AMapLocationClientOption();
|
||||
// //设置定位回调监听
|
||||
// mlocationClient.setLocationListener(new AMapLocationListener() {
|
||||
// @Override
|
||||
// public void onLocationChanged(AMapLocation aMapLocation) {
|
||||
// if (mListener != null && aMapLocation != null) {
|
||||
// if (aMapLocation != null
|
||||
// && aMapLocation.getErrorCode() == 0) {
|
||||
// mListener.onLocationChanged(aMapLocation);// 显示系统小蓝点
|
||||
// } else {
|
||||
// String errText = "定位失败," + aMapLocation.getErrorCode() + ": " + aMapLocation.getErrorInfo();
|
||||
// Log.e("AmapErr", errText);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// //设置为高精度定位模式
|
||||
// mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
|
||||
// // mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Battery_Saving);
|
||||
// //设置定位模式为AMapLocationMode.Device_Sensors,仅设备模式。
|
||||
// //mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Device_Sensors);
|
||||
// //获取一次定位结果:
|
||||
// //该方法默认为false。
|
||||
// mLocationOption.setOnceLocation(true);
|
||||
// //获取最近3s内精度最高的一次定位结果:
|
||||
// //设置setOnceLocationLatest(boolean b)接口为true,启动定位时SDK会返回最近3s内精度最高的一次定位结果。如果设置其为true,setOnceLocation(boolean b)接口也会被设置为true,反之不会,默认为false。
|
||||
// mLocationOption.setOnceLocationLatest(true);
|
||||
// //设置是否返回地址信息(默认返回地址信息)
|
||||
// mLocationOption.setNeedAddress(true);
|
||||
// //设置是否允许模拟位置,默认为true,允许模拟位置
|
||||
// mLocationOption.setMockEnable(true);
|
||||
// //单位是毫秒,默认30000毫秒,建议超时时间不要低于8000毫秒。
|
||||
// mLocationOption.setHttpTimeOut(20000);
|
||||
// //关闭缓存机制
|
||||
// mLocationOption.setLocationCacheEnable(false);
|
||||
// //设置定位参数
|
||||
// mlocationClient.setLocationOption(mLocationOption);
|
||||
// // 此方法为每隔固定时间会发起一次定位请求,为了减少电量消耗或网络流量消耗,
|
||||
// // 注意设置合适的定位时间的间隔(最小间隔支持为2000ms),并且在合适时间调用stopLocation()方法来取消定位请求
|
||||
// // 在定位结束后,在合适的生命周期调用onDestroy()方法
|
||||
// // 在单次定位情况下,定位无论成功与否,都无需调用stopLocation()方法移除请求,定位sdk内部会移除
|
||||
// mlocationClient.startLocation();//启动定位
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void deactivate() {
|
||||
// mListener = null;
|
||||
// if (mlocationClient != null) {
|
||||
// mlocationClient.stopLocation();
|
||||
// mlocationClient.onDestroy();
|
||||
// }
|
||||
// mlocationClient = null;
|
||||
// }
|
||||
// });
|
||||
// // 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
|
||||
//// aMap.setMyLocationEnabled(true);
|
||||
//// ld=new LocationGDUtil(con,hd);
|
||||
//// ld.onCreate();
|
||||
// }
|
||||
|
||||
private void initMap(){
|
||||
// 通过InitializerOptions指定初始化配置参数
|
||||
InitializerOptions options = new InitializerOptions();
|
||||
// 设置是否使用Https网络请求,默认使用
|
||||
// options.setIsHttpsEnable(true);
|
||||
// 设置坐标系,默认GCJ02
|
||||
// options.setCoorType(CoordType.GCJ02);
|
||||
|
||||
SDKInitializer.initialization(getApplicationContext(),options);
|
||||
}
|
||||
|
||||
private DrivingRoutePlanOptions drivingRoutePlanOptions;
|
||||
private List<LocationsInfo> locationsInfos;
|
||||
|
||||
private List<Polyline> polylines = new ArrayList<>();
|
||||
private List<Marker> markers = new ArrayList<>();
|
||||
|
||||
private LKMap mLKMap;
|
||||
|
||||
private void doSearch() {
|
||||
DrivingRoutePlan search = new DrivingRoutePlan();
|
||||
|
||||
drivingRoutePlanOptions = new DrivingRoutePlanOptions();
|
||||
locationsInfos = new ArrayList<>();
|
||||
// 设置开始坐标
|
||||
LocationsInfo origin = new LocationsInfo();
|
||||
origin.setLat(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()));
|
||||
origin.setLon(Double.parseDouble(sob.getData().getWayChildren().get((0)).getLongitude()));
|
||||
// 设置结束坐标
|
||||
LocationsInfo dest = new LocationsInfo();
|
||||
dest.setLat(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLatitude()));
|
||||
dest.setLon(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLongitude()));
|
||||
locationsInfos.add(origin);
|
||||
locationsInfos.add(dest);
|
||||
drivingRoutePlanOptions.setLocations(locationsInfos);
|
||||
AutoInfo autoInfo = new AutoInfo();
|
||||
DrivingCostingOptionsInfo drivingCostingOptionsInfo = new DrivingCostingOptionsInfo();
|
||||
drivingCostingOptionsInfo.setAuto(autoInfo);
|
||||
drivingRoutePlanOptions.setDrivingCostingOptions(drivingCostingOptionsInfo);
|
||||
|
||||
search.drivingRoutePlanRequest(drivingRoutePlanOptions, new OnDrivingRoutePlanListener() {
|
||||
public void initLoaction() {
|
||||
// 设置定位监听
|
||||
aMap.setLocationSource(new LocationSource() {
|
||||
@Override
|
||||
public void activate(OnLocationChangedListener onLocationChangedListener) {
|
||||
mListener = onLocationChangedListener;
|
||||
if (mlocationClient == null) {
|
||||
//初始化定位
|
||||
try {
|
||||
mlocationClient = new AMapLocationClient(con);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//初始化定位参数
|
||||
mLocationOption = new AMapLocationClientOption();
|
||||
//设置定位回调监听
|
||||
mlocationClient.setLocationListener(new AMapLocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(AMapLocation aMapLocation) {
|
||||
if (mListener != null && aMapLocation != null) {
|
||||
if (aMapLocation != null
|
||||
&& aMapLocation.getErrorCode() == 0) {
|
||||
mListener.onLocationChanged(aMapLocation);// 显示系统小蓝点
|
||||
} else {
|
||||
String errText = "定位失败," + aMapLocation.getErrorCode() + ": " + aMapLocation.getErrorInfo();
|
||||
Log.e("AmapErr", errText);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//设置为高精度定位模式
|
||||
mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
|
||||
// mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Battery_Saving);
|
||||
//设置定位模式为AMapLocationMode.Device_Sensors,仅设备模式。
|
||||
//mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Device_Sensors);
|
||||
//获取一次定位结果:
|
||||
//该方法默认为false。
|
||||
mLocationOption.setOnceLocation(true);
|
||||
//获取最近3s内精度最高的一次定位结果:
|
||||
//设置setOnceLocationLatest(boolean b)接口为true,启动定位时SDK会返回最近3s内精度最高的一次定位结果。如果设置其为true,setOnceLocation(boolean b)接口也会被设置为true,反之不会,默认为false。
|
||||
mLocationOption.setOnceLocationLatest(true);
|
||||
//设置是否返回地址信息(默认返回地址信息)
|
||||
mLocationOption.setNeedAddress(true);
|
||||
//设置是否允许模拟位置,默认为true,允许模拟位置
|
||||
mLocationOption.setMockEnable(true);
|
||||
//单位是毫秒,默认30000毫秒,建议超时时间不要低于8000毫秒。
|
||||
mLocationOption.setHttpTimeOut(20000);
|
||||
//关闭缓存机制
|
||||
mLocationOption.setLocationCacheEnable(false);
|
||||
//设置定位参数
|
||||
mlocationClient.setLocationOption(mLocationOption);
|
||||
// 此方法为每隔固定时间会发起一次定位请求,为了减少电量消耗或网络流量消耗,
|
||||
// 注意设置合适的定位时间的间隔(最小间隔支持为2000ms),并且在合适时间调用stopLocation()方法来取消定位请求
|
||||
// 在定位结束后,在合适的生命周期调用onDestroy()方法
|
||||
// 在单次定位情况下,定位无论成功与否,都无需调用stopLocation()方法移除请求,定位sdk内部会移除
|
||||
mlocationClient.startLocation();//启动定位
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetDrivingRoutePlanResult(DrivingRoutePlanResult routePlanResult) {
|
||||
addRoutePlanLine(routePlanResult);
|
||||
addRouteMarker();
|
||||
public void deactivate() {
|
||||
mListener = null;
|
||||
if (mlocationClient != null) {
|
||||
mlocationClient.stopLocation();
|
||||
mlocationClient.onDestroy();
|
||||
}
|
||||
mlocationClient = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加线路规划路线
|
||||
*
|
||||
* @param routePlanResult
|
||||
*/
|
||||
private void addRoutePlanLine(DrivingRoutePlanResult routePlanResult) {
|
||||
if (routePlanResult == null) {
|
||||
Toast.makeText(this, "没有检索到结果", Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (routePlanResult.getRouteInfos() == null || routePlanResult.getRouteInfos().isEmpty()) {
|
||||
Toast.makeText(this, "没有检索到结果", Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
List<LatLng> latLngs = new ArrayList<>();
|
||||
List<LatLng> all = new ArrayList<>();
|
||||
mLKMap.removeOverlay(polylines);
|
||||
polylines.clear();
|
||||
|
||||
if (routePlanResult.getRouteInfos().size()>0){
|
||||
latLngs.clear();
|
||||
latLngs.addAll(routePlanResult.getRouteInfos().get(0).getGeometry());
|
||||
PolylineOptions options = new PolylineOptions();
|
||||
options.width(8f)
|
||||
.joinStyle(Property.LINE_JOIN_ROUND)
|
||||
.points(latLngs)
|
||||
.color(getResources().getColor(R.color.theme_color));
|
||||
all.addAll(latLngs);
|
||||
polylines.add((Polyline) mLKMap.addOverlay(options));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// for (int i = 0;i < routePlanResult.getRouteInfos().size();i ++){
|
||||
// latLngs.clear();
|
||||
// latLngs.addAll(routePlanResult.getRouteInfos().get(i).getGeometry());
|
||||
// PolylineOptions options = new PolylineOptions();
|
||||
// if(i == routePlanResult.getRouteInfos().size() - 1){
|
||||
// options.width(8f)
|
||||
//// .pattern(BitmapDescriptorFactory.fromResource(R.drawable.icon_roud_type))
|
||||
// .joinStyle(Property.LINE_JOIN_ROUND)
|
||||
// .points(latLngs)
|
||||
// .color(getResources().getColor(R.color.theme_color));
|
||||
// }else{
|
||||
// options.width(8f)
|
||||
//// .joinStyle(Property.LINE_JOIN_ROUND)
|
||||
// .points(latLngs)
|
||||
// .color(getResources().getColor(R.color.theme_color));
|
||||
// }
|
||||
// all.addAll(latLngs);
|
||||
// polylines.add((Polyline) mLKMap.addOverlay(options));
|
||||
// }
|
||||
mLKMap.setMapStatus(MapStatusUpdateFactory.buildUpdateByLatLngBounds(new LatLngBounds(all),100,100,100,100));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加起始点标记
|
||||
*/
|
||||
private void addRouteMarker() {
|
||||
mLKMap.removeOverlay(markers);
|
||||
markers.clear();
|
||||
MarkerOptions originOptions = new MarkerOptions()
|
||||
.position(new LatLng(locationsInfos.get(0).getLat(),locationsInfos.get(0).getLon()))
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.mipmap.qi))
|
||||
.iconGravity(Property.ICON_ANCHOR_BOTTOM)
|
||||
.iconScale(0.5f);
|
||||
markers.add((Marker) mLKMap.addOverlay(originOptions));
|
||||
|
||||
MarkerOptions destinationOptions = new MarkerOptions()
|
||||
.position(new LatLng(locationsInfos.get(1).getLat(),locationsInfos.get(1).getLon()))
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.mipmap.zhong))
|
||||
.iconGravity(Property.ICON_ANCHOR_BOTTOM)
|
||||
.iconScale(0.5f);
|
||||
markers.add((Marker) mLKMap.addOverlay(destinationOptions));
|
||||
// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
|
||||
aMap.setMyLocationEnabled(true);
|
||||
// ld=new LocationGDUtil(con,hd);
|
||||
// ld.onCreate();
|
||||
}
|
||||
|
||||
|
||||
// private RouteSearch mRouteSearch;//路线查询器
|
||||
// private List<LatLonPoint> lists = new ArrayList<>();
|
||||
private RouteSearch mRouteSearch;//路线查询器
|
||||
private List<LatLonPoint> lists = new ArrayList<>();
|
||||
|
||||
|
||||
// public void search() {
|
||||
//// try {
|
||||
//// AMapLocationClient.updatePrivacyShow(con,true,true);
|
||||
//// AMapLocationClient.updatePrivacyAgree(con,true);
|
||||
// mRouteSearch = new RouteSearch(this);
|
||||
//// } catch (AMapException e) {
|
||||
//// e.printStackTrace();
|
||||
//// }
|
||||
// //设置数据回调监听器
|
||||
// mRouteSearch.setRouteSearchListener(new OnRouteSearchListener());
|
||||
// //设置开始位置坐标点(注意经纬度不能写反,会报错1800(只能规划到中国区域里的地图路线))
|
||||
// LatLonPoint startPoint = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()),
|
||||
// Double.parseDouble(sob.getData().getWayChildren().get((0)).getLongitude()));
|
||||
// //设置目的地坐标点
|
||||
// LatLonPoint endPoint = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLatitude()),
|
||||
// Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLongitude()));
|
||||
// //查询信息对象
|
||||
// for (int i = 0; i < sob.getData().getWayChildren().size(); i++) {
|
||||
// if (i != 0 && i != (sob.getData().getWayChildren().size() - 1)) {
|
||||
// LatLonPoint sp = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get(i).getLatitude()),
|
||||
// Double.parseDouble(sob.getData().getWayChildren().get((i)).getLongitude()));
|
||||
// lists.add(sp);
|
||||
// }
|
||||
public void search() {
|
||||
// try {
|
||||
// AMapLocationClient.updatePrivacyShow(con,true,true);
|
||||
// AMapLocationClient.updatePrivacyAgree(con,true);
|
||||
mRouteSearch = new RouteSearch(this);
|
||||
// } catch (AMapException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// RouteSearch.FromAndTo fromAndTo = new RouteSearch.FromAndTo(startPoint, endPoint);
|
||||
// //设置搜索参数 1.fromAndTo 路径的起点终点 2.路径规划的策略(这里是驾车模式,具体看高德API) 3.途
|
||||
// //经点,可选 4.避让区域,可选, 5.避让道路 ,可选
|
||||
// RouteSearch.DriveRouteQuery query = new
|
||||
// RouteSearch.DriveRouteQuery(fromAndTo, RouteSearch.DRIVING_SINGLE_DEFAULT, lists, null, "");
|
||||
// //开始异步查询
|
||||
// mRouteSearch.calculateDriveRouteAsyn(query);
|
||||
// }
|
||||
//设置数据回调监听器
|
||||
mRouteSearch.setRouteSearchListener(new OnRouteSearchListener());
|
||||
//设置开始位置坐标点(注意经纬度不能写反,会报错1800(只能规划到中国区域里的地图路线))
|
||||
LatLonPoint startPoint = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()),
|
||||
Double.parseDouble(sob.getData().getWayChildren().get((0)).getLongitude()));
|
||||
//设置目的地坐标点
|
||||
LatLonPoint endPoint = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLatitude()),
|
||||
Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLongitude()));
|
||||
//查询信息对象
|
||||
for (int i = 0; i < sob.getData().getWayChildren().size(); i++) {
|
||||
if (i != 0 && i != (sob.getData().getWayChildren().size() - 1)) {
|
||||
LatLonPoint sp = new LatLonPoint(Double.parseDouble(sob.getData().getWayChildren().get(i).getLatitude()),
|
||||
Double.parseDouble(sob.getData().getWayChildren().get((i)).getLongitude()));
|
||||
lists.add(sp);
|
||||
}
|
||||
}
|
||||
RouteSearch.FromAndTo fromAndTo = new RouteSearch.FromAndTo(startPoint, endPoint);
|
||||
//设置搜索参数 1.fromAndTo 路径的起点终点 2.路径规划的策略(这里是驾车模式,具体看高德API) 3.途
|
||||
//经点,可选 4.避让区域,可选, 5.避让道路 ,可选
|
||||
RouteSearch.DriveRouteQuery query = new
|
||||
RouteSearch.DriveRouteQuery(fromAndTo, RouteSearch.DRIVING_SINGLE_DEFAULT, lists, null, "");
|
||||
//开始异步查询
|
||||
mRouteSearch.calculateDriveRouteAsyn(query);
|
||||
}
|
||||
|
||||
|
||||
// class OnRouteSearchListener implements RouteSearch.OnRouteSearchListener {
|
||||
//
|
||||
// @Override
|
||||
// public void onBusRouteSearched(BusRouteResult busRouteResult, int i) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onDriveRouteSearched(DriveRouteResult driveRouteResult, int rCode) {
|
||||
// if (rCode == 1000) {//获取规划路线成功,获取到的是了,路线坐标点的集合
|
||||
// List<DrivePath> paths = driveRouteResult.getPaths();
|
||||
// //创建存储坐标点的集合
|
||||
// List<LatLng> latLngs = new ArrayList<>();
|
||||
// //遍历获取规划的所有路线坐标点
|
||||
// for (DrivePath mDrivePath : paths) {
|
||||
// for (DriveStep mDriveStep : mDrivePath.getSteps()) {
|
||||
// for (LatLonPoint mLatLonPoint : mDriveStep.getPolyline()) {
|
||||
// latLngs.add(new
|
||||
// LatLng(mLatLonPoint.getLatitude(), mLatLonPoint.getLongitude()));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //先清除一下,避免重复显示
|
||||
// aMap.clear();
|
||||
// //绘制起始位置和目的地marker
|
||||
// aMap.addMarker(new MarkerOptions()
|
||||
// .icon(BitmapDescriptorFactory.fromResource(R.mipmap.qi))
|
||||
// .position(new LatLng(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()),
|
||||
// Double.parseDouble(sob.getData().getWayChildren().get(0).getLongitude()))));
|
||||
// for (int i = 0; i < sob.getData().getWayChildren().size(); i++) {
|
||||
// if (i != 0 && i != (sob.getData().getWayChildren().size() - 1)) {
|
||||
// StartOrderBean.DataDTO.WayChildrenDTO sdw = sob.getData().getWayChildren().get(i);
|
||||
// int icon = 0;
|
||||
// if (sdw.getType() == 1) {
|
||||
// icon = R.mipmap.z_loc;
|
||||
// } else {
|
||||
// icon = R.mipmap.x_loc;
|
||||
// }
|
||||
// aMap.addMarker(new MarkerOptions()
|
||||
// .icon(BitmapDescriptorFactory.fromResource(icon))
|
||||
// .position(new LatLng(Double.parseDouble(sdw.getLatitude()), Double.parseDouble(sdw.getLongitude()))));
|
||||
// }
|
||||
// }
|
||||
// aMap.addMarker(new MarkerOptions()
|
||||
// .icon(BitmapDescriptorFactory.fromResource(R.mipmap.zhong))
|
||||
// .position(new LatLng(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLatitude()),
|
||||
// Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLongitude()))));
|
||||
// //绘制规划路径路线
|
||||
// aMap.addPolyline(new PolylineOptions()
|
||||
// //路线坐标点的集合
|
||||
// .addAll(latLngs)
|
||||
// //线的宽度
|
||||
// .width(8)
|
||||
// .color(getResources().getColor(R.color.theme_color)));
|
||||
// //设置画线的颜色
|
||||
//
|
||||
// //显示完整包含所有marker地图路线
|
||||
// LatLngBounds.Builder builder = LatLngBounds.builder();
|
||||
// for (int i = 0; i < latLngs.size(); i++) {
|
||||
// builder.include(latLngs.get(i));
|
||||
// }
|
||||
// //显示全部marker,第二个参数是四周留空宽度
|
||||
// aMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 200));
|
||||
// LatLng latLng = new LatLng(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()),
|
||||
// Double.parseDouble(sob.getData().getWayChildren().get((0)).getLongitude()));//构造一个位置
|
||||
// aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 6));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onWalkRouteSearched(WalkRouteResult walkRouteResult, int i) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onRideRouteSearched(RideRouteResult rideRouteResult, int i) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
class OnRouteSearchListener implements RouteSearch.OnRouteSearchListener {
|
||||
|
||||
@Override
|
||||
public void onBusRouteSearched(BusRouteResult busRouteResult, int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDriveRouteSearched(DriveRouteResult driveRouteResult, int rCode) {
|
||||
if (rCode == 1000) {//获取规划路线成功,获取到的是了,路线坐标点的集合
|
||||
List<DrivePath> paths = driveRouteResult.getPaths();
|
||||
//创建存储坐标点的集合
|
||||
List<LatLng> latLngs = new ArrayList<>();
|
||||
//遍历获取规划的所有路线坐标点
|
||||
for (DrivePath mDrivePath : paths) {
|
||||
for (DriveStep mDriveStep : mDrivePath.getSteps()) {
|
||||
for (LatLonPoint mLatLonPoint : mDriveStep.getPolyline()) {
|
||||
latLngs.add(new
|
||||
LatLng(mLatLonPoint.getLatitude(), mLatLonPoint.getLongitude()));
|
||||
}
|
||||
}
|
||||
}
|
||||
//先清除一下,避免重复显示
|
||||
aMap.clear();
|
||||
//绘制起始位置和目的地marker
|
||||
aMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.mipmap.qi))
|
||||
.position(new LatLng(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()),
|
||||
Double.parseDouble(sob.getData().getWayChildren().get(0).getLongitude()))));
|
||||
for (int i = 0; i < sob.getData().getWayChildren().size(); i++) {
|
||||
if (i != 0 && i != (sob.getData().getWayChildren().size() - 1)) {
|
||||
StartOrderBean.DataDTO.WayChildrenDTO sdw = sob.getData().getWayChildren().get(i);
|
||||
int icon = 0;
|
||||
if (sdw.getType() == 1) {
|
||||
icon = R.mipmap.z_loc;
|
||||
} else {
|
||||
icon = R.mipmap.x_loc;
|
||||
}
|
||||
aMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(icon))
|
||||
.position(new LatLng(Double.parseDouble(sdw.getLatitude()), Double.parseDouble(sdw.getLongitude()))));
|
||||
}
|
||||
}
|
||||
aMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.mipmap.zhong))
|
||||
.position(new LatLng(Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLatitude()),
|
||||
Double.parseDouble(sob.getData().getWayChildren().get((sob.getData().getWayChildren().size() - 1)).getLongitude()))));
|
||||
//绘制规划路径路线
|
||||
aMap.addPolyline(new PolylineOptions()
|
||||
//路线坐标点的集合
|
||||
.addAll(latLngs)
|
||||
//线的宽度
|
||||
.width(8)
|
||||
.color(getResources().getColor(R.color.theme_color)));
|
||||
//设置画线的颜色
|
||||
|
||||
//显示完整包含所有marker地图路线
|
||||
LatLngBounds.Builder builder = LatLngBounds.builder();
|
||||
for (int i = 0; i < latLngs.size(); i++) {
|
||||
builder.include(latLngs.get(i));
|
||||
}
|
||||
//显示全部marker,第二个参数是四周留空宽度
|
||||
aMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 200));
|
||||
LatLng latLng = new LatLng(Double.parseDouble(sob.getData().getWayChildren().get(0).getLatitude()),
|
||||
Double.parseDouble(sob.getData().getWayChildren().get((0)).getLongitude()));//构造一个位置
|
||||
aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 6));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalkRouteSearched(WalkRouteResult walkRouteResult, int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRideRouteSearched(RideRouteResult rideRouteResult, int i) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void up_traffic() {
|
||||
// ShippingNoteInfo[] snis=new ShippingNoteInfo[1];
|
||||
@@ -833,25 +697,4 @@ public class StartYunDanActivity extends BaseActivity {
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+21
-23
@@ -94,7 +94,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
switch (m.what) {
|
||||
case RequsetCodeConstants.SUCCESS:
|
||||
if (CacheGroup.cacheList.get("upload") != null) {
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
if (!isFinishing()&&customDialog!=null&&customDialog.isShowing()){
|
||||
customDialog.dismiss();
|
||||
}
|
||||
Log.e("upload", CacheGroup.cacheList.get("upload"));
|
||||
@@ -115,12 +115,12 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
for (int i = 0; i < TYPE_NAME.length; i++) {
|
||||
if (CacheGroup.cacheList.get(TYPE_NAME[i]) != null) {
|
||||
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(TYPE_NAME[i]), BaseBean.class);
|
||||
if (!isFinishing()&&customDialog!=null&&customDialog.isShowing()){
|
||||
customDialog.dismiss();
|
||||
}
|
||||
if (bb.getCode() == 200) {
|
||||
if (index == 2) {
|
||||
if (!keys) {//装货回单
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
customDialog.dismiss();
|
||||
}
|
||||
if (!keys){//装货回单
|
||||
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
@@ -156,7 +156,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
hyr.uploadFile(new File(path));
|
||||
}
|
||||
} else {//识别失败后返回code500
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
if (!isFinishing()&&customDialog!=null&&customDialog.isShowing()){
|
||||
customDialog.dismiss();
|
||||
}
|
||||
if (index == 0) {//装卸货车辆需要识别车牌号){
|
||||
@@ -171,7 +171,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
break;
|
||||
case 14://定位成功
|
||||
locationKey = true;
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
if (!isFinishing()&&customDialog!=null&&customDialog.isShowing()){
|
||||
customDialog.dismiss();
|
||||
}
|
||||
tv_loaction.setText("定位成功");
|
||||
@@ -181,7 +181,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
break;
|
||||
case 16://定位失败
|
||||
locationKey = false;
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
if (!isFinishing()&&customDialog!=null&&customDialog.isShowing()){
|
||||
customDialog.dismiss();
|
||||
}
|
||||
tv_loaction.setText("定位失败,点击重试");
|
||||
@@ -211,7 +211,6 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private LatLng latLng;
|
||||
|
||||
public LatLng convertGPSToBaidu(LatLng srLatLng) {
|
||||
@@ -340,7 +339,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
Log.e("图片地址:", path);
|
||||
gia.dis();
|
||||
|
||||
if (customDialog != null && !customDialog.isShowing()) {
|
||||
if (customDialog!=null&&!customDialog.isShowing()){
|
||||
customDialog = new CustomDialog(con, "网络请求中...");
|
||||
customDialog.show();
|
||||
}
|
||||
@@ -359,7 +358,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
Log.e("图片地址:", path);
|
||||
gia.dis();
|
||||
|
||||
if (customDialog != null && !customDialog.isShowing()) {
|
||||
if (customDialog!=null&&!customDialog.isShowing()){
|
||||
customDialog = new CustomDialog(con, "网络请求中...");
|
||||
customDialog.show();
|
||||
}
|
||||
@@ -377,12 +376,12 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
// for(int i=0;i<imgIds.size();i++){
|
||||
// Log.e("--imgIds--",imgIds.get(i)+"");
|
||||
// }
|
||||
if (customDialog != null && !customDialog.isShowing()) {
|
||||
customDialog = new CustomDialog(con, "网络请求中...");
|
||||
customDialog.show();
|
||||
}
|
||||
switch (index) {
|
||||
case 0:
|
||||
if (customDialog!=null&&!customDialog.isShowing()){
|
||||
customDialog = new CustomDialog(con, "网络请求中...");
|
||||
customDialog.show();
|
||||
}
|
||||
//装货
|
||||
if (imgIds != null && imgIds.size() > 0) {
|
||||
lub.setLatitude(lgdu.getLatitude() + "");
|
||||
@@ -564,7 +563,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
if (!isFinishing()&&customDialog!=null&&customDialog.isShowing()){
|
||||
customDialog.dismiss();
|
||||
}
|
||||
Log.e("上报安联", "装货照片上传成功");
|
||||
@@ -599,7 +598,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
if (!isFinishing()&&customDialog!=null&&customDialog.isShowing()){
|
||||
customDialog.dismiss();
|
||||
}
|
||||
Log.e("上报安联", "卸货照片上传成功");
|
||||
@@ -610,9 +609,6 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(卸货照片):", s + s1);
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
customDialog.dismiss();
|
||||
}
|
||||
// SPUtil.insSP(con,"make","卸货",sob.getData().getShippingNoteNumber());
|
||||
// SPUtil.insSP(con,"make","卸货-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
||||
// Intent serviceIn=new Intent(con, MakeUpAlService.class);
|
||||
@@ -638,7 +634,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
if (!isFinishing()&&customDialog!=null&&customDialog.isShowing()){
|
||||
customDialog.dismiss();
|
||||
}
|
||||
Log.e("上报安联", "回单照片上传成功");
|
||||
@@ -688,6 +684,8 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 上传安联和交通厅,平台-装货
|
||||
*/
|
||||
@@ -716,7 +714,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(装货):", s + s1);
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
if (!isFinishing()&&customDialog!=null&&customDialog.isShowing()){
|
||||
customDialog.dismiss();
|
||||
}
|
||||
new MessageUtils().showCenMessage(con, s1);
|
||||
@@ -756,7 +754,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(卸货):", s + s1);
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
if (!isFinishing()&&customDialog!=null&&customDialog.isShowing()){
|
||||
customDialog.dismiss();
|
||||
}
|
||||
new MessageUtils().showCenMessage(con, s1);
|
||||
|
||||
@@ -16,8 +16,6 @@ import android.text.style.ClickableSpan;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
@@ -26,7 +24,6 @@ import android.widget.Toast;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.cardview.widget.CardView;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.AppInfoBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.parts.ConfigParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.net.BaseObserver;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.net.DataManager;
|
||||
@@ -74,7 +71,8 @@ public class LoginActivity extends BaseActivity {
|
||||
private LoginBean loginBean;
|
||||
private TimerTask tt;
|
||||
private int timer_sum = 60;
|
||||
private CheckBox cb;
|
||||
private ImageButton agree_btn;
|
||||
private CardView no_btn;
|
||||
private UserRequset ur;
|
||||
|
||||
@Override
|
||||
@@ -97,22 +95,15 @@ public class LoginActivity extends BaseActivity {
|
||||
//存储登录记录
|
||||
loginBean = new Gson().fromJson(CacheGroup.cacheList.get(LOGIN_RESULT), LoginBean.class);
|
||||
Log.e("--登录信息--", new Gson().toJson(loginBean));
|
||||
AppInfoBean appInfoBean = new AppInfoBean();
|
||||
if (loginBean.getCode() == 200) {
|
||||
SPUtil.insSP(con, USER, USER_TOKEN, loginBean.getData().getToken());
|
||||
SPUtil.insSP(con, USER, USER_UNAME, loginBean.getData().getUname());
|
||||
SPUtil.insSP(con, USER, USER_RNAME, loginBean.getData().getRname());
|
||||
SPUtil.insSP(con, USER, USER_ID, loginBean.getData().getId() + "");
|
||||
JPushInterface.setAlias(con, 0, loginBean.getData().getUname());
|
||||
appInfoBean.setStatus("0");
|
||||
appInfoBean.setUserPhone(String.valueOf(input_phone.getText()));
|
||||
ur.postAppInfo(appInfoBean,"post");
|
||||
UiAuxiliary.homeRequest("登录成功");
|
||||
finish();
|
||||
} else {
|
||||
appInfoBean.setStatus("1");
|
||||
appInfoBean.setUserPhone(String.valueOf(input_phone.getText()));
|
||||
ur.postAppInfo(appInfoBean,"post");
|
||||
Toast.makeText(con, loginBean.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove(LOGIN_RESULT);
|
||||
@@ -134,7 +125,8 @@ public class LoginActivity extends BaseActivity {
|
||||
input_phone = findViewById(R.id.input_phone);
|
||||
input_code = findViewById(R.id.input_code);
|
||||
getCode = findViewById(R.id.getCode);
|
||||
cb = findViewById(R.id.cb);
|
||||
agree_btn = findViewById(R.id.agree_btn);
|
||||
no_btn = findViewById(R.id.no_btn);
|
||||
ur = new UserRequset(con, hd);
|
||||
initView(null);
|
||||
}
|
||||
@@ -147,18 +139,21 @@ public class LoginActivity extends BaseActivity {
|
||||
@Override
|
||||
public void initView(Object obj) {
|
||||
super.initView(obj);
|
||||
cb.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
if (isChecked) {
|
||||
key = true;
|
||||
} else {
|
||||
key = false;
|
||||
}
|
||||
agree_btn.setOnClickListener(v -> {
|
||||
agree_btn.setVisibility(View.GONE);
|
||||
no_btn.setVisibility(View.VISIBLE);
|
||||
key = false;
|
||||
});
|
||||
no_btn.setOnClickListener(v -> {
|
||||
agree_btn.setVisibility(View.VISIBLE);
|
||||
no_btn.setVisibility(View.GONE);
|
||||
key = true;
|
||||
|
||||
});
|
||||
ConfigBean cb = ConfigParts.getConfigParts(con);
|
||||
if (cb != null) {
|
||||
url1 = cb.getData().getUserUrl();
|
||||
url2 = "https://agreement.dahehuoyun.com/currency/#/";
|
||||
url2 = "http://agreement.dahehuoyun.com/currency/#/";
|
||||
}
|
||||
TextView tv_content = findViewById(R.id.tv_content);
|
||||
String str = "我已阅读并同意相关服务条款和隐私政策《用户服务协议》和《隐私政策》";
|
||||
|
||||
@@ -30,12 +30,10 @@ import androidx.core.app.ActivityCompat;
|
||||
|
||||
import com.alct.mdp.MDPLocationCollectionManager;
|
||||
import com.arpa.hndahesudintocctmsdriver.BuildConfig;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.AppInfoBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.ImageConfig;
|
||||
import com.arpa.hndahesudintocctmsdriver.parts.ConfigParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.UserRequset;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.UiAuxiliary;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.business.BusinessActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.SPUtils;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.cache.CacheGroup;
|
||||
@@ -140,8 +138,8 @@ public class WelcomeActivity extends BaseAppCompatActivity {
|
||||
new XPopup.Builder(con)
|
||||
.dismissOnBackPressed(false)
|
||||
.dismissOnTouchOutside(false)
|
||||
.asCustom(new AgreementAlert(con, "https://agreement.dahehuoyun.com/currency/#/",
|
||||
"https://agreement.dahehuoyun.com/rule/serviceAgreement/dist/index.html#/", hd))
|
||||
.asCustom(new AgreementAlert(con, "http://agreement.dahehuoyun.com/currency/#/",
|
||||
"http://agreement.dahehuoyun.com/rule/serviceAgreement/dist/index.html#/", hd))
|
||||
.show();
|
||||
}
|
||||
Glide.with(con)
|
||||
@@ -161,16 +159,6 @@ public class WelcomeActivity extends BaseAppCompatActivity {
|
||||
initRequest();
|
||||
}
|
||||
}, 1000);
|
||||
AppInfoBean appInfoBean = new AppInfoBean();
|
||||
|
||||
if (!UiAuxiliary.isLogin(con)) {
|
||||
ur.postAppInfo(appInfoBean, "post");
|
||||
}else{
|
||||
String sp = SPUtil.getSP(con, LoginActivity.USER, LoginActivity.USER_UNAME);
|
||||
appInfoBean.setUserPhone(sp);
|
||||
appInfoBean.setStatus("0");
|
||||
ur.postAppInfo(appInfoBean, "post");
|
||||
}
|
||||
|
||||
// String[] permissions=new String[]{
|
||||
// Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.arpa.hndahesudintocctmsdriver.parts.ConfigParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.parts.StartOrderParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.parts.UserParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.business.BusinessActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.PicturlUtil;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.google.gson.Gson;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
|
||||
@@ -73,9 +73,9 @@ public class SetupActivity extends BaseActivity {
|
||||
ConfigBean cb= ConfigParts.getConfigParts(con);
|
||||
if(cb!=null){
|
||||
// url1=cb.getData().getUserUrl();
|
||||
url1="https://agreement.dahehuoyun.com/rule/serviceAgreement/dist/index.html#/";
|
||||
url1="http://agreement.dahehuoyun.com/rule/serviceAgreement/dist/index.html#/";
|
||||
// url2=cb.getData().getPrivateUrl();
|
||||
url2="https://agreement.dahehuoyun.com/currency/#/";
|
||||
url2="http://agreement.dahehuoyun.com/currency/#/";
|
||||
kefu=cb.getData().getServiceMobile();
|
||||
url3=cb.getData().getSecurityUrl();
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class SetupActivity extends BaseActivity {
|
||||
r8.setOnClickListener(v12 -> {
|
||||
Intent in=new Intent(con,WebActivity.class);
|
||||
in.putExtra("title","交易规则");
|
||||
in.putExtra("url","https://agreement.dahehuoyun.com/rule/transactionRules/dist/index.html#/");
|
||||
in.putExtra("url","http://agreement.dahehuoyun.com/rule/transactionRules/dist/index.html#/");
|
||||
startActivity(in);
|
||||
});
|
||||
r6.setOnClickListener(v12 -> {
|
||||
|
||||
@@ -231,7 +231,6 @@ public class WalletFragment extends BaseFragment{
|
||||
bank_remove.setVisibility(View.VISIBLE);
|
||||
} else{
|
||||
bank_number.setVisibility(View.GONE);
|
||||
bank_title_1.setText("未添加银行卡");
|
||||
bank_add.setVisibility(View.VISIBLE);
|
||||
bank_remove.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -5,12 +5,9 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.net.http.SslError;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.SslErrorHandler;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
@@ -84,11 +81,6 @@ public class WebActivity extends BaseActivity {
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setDefaultTextEncodingName("utf-8");
|
||||
// 特别注意:5.1以上默认禁止了https和http混用,以下方式是开启
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
}
|
||||
|
||||
wv.addJavascriptInterface(new JavaScriptObject(con), "webObj");
|
||||
//PaxWebChromeClient chromeClient=new PaxWebChromeClient();
|
||||
//WebView加载web资源
|
||||
@@ -119,12 +111,6 @@ public class WebActivity extends BaseActivity {
|
||||
wv.loadUrl(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
||||
super.onReceivedSslError(view, handler, error);
|
||||
handler.proceed();
|
||||
}
|
||||
});
|
||||
wv.setWebChromeClient(chromeClient);
|
||||
wv.loadUrl(url);
|
||||
@@ -163,12 +149,6 @@ public class WebActivity extends BaseActivity {
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
||||
super.onReceivedSslError(view, handler, error);
|
||||
handler.proceed();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.util;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.FileUtils;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
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.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* @ClassName FileIOUtils
|
||||
* @Author john
|
||||
* @Date 2024/3/29 09:50
|
||||
* @Description TODO
|
||||
*/
|
||||
public class FileIOUtils {
|
||||
|
||||
private FileIOUtils() {
|
||||
throw new UnsupportedOperationException("u can't instantiate me...");
|
||||
}
|
||||
|
||||
private static final String LINE_SEP = System.getProperty("line.separator");
|
||||
|
||||
/**
|
||||
* 将输入流写入文件
|
||||
*
|
||||
* @param filePath 路径
|
||||
* @param is 输入流
|
||||
* @return {@code true}: 写入成功<br>{@code false}: 写入失败
|
||||
*/
|
||||
public static boolean writeFileFromIS(String filePath, final InputStream is) {
|
||||
return writeFileFromIS(FileUtils.getFileByPath(filePath), is, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将输入流写入文件
|
||||
*
|
||||
* @param filePath 路径
|
||||
* @param is 输入流
|
||||
* @param append 是否追加在文件末
|
||||
* @return {@code true}: 写入成功<br>{@code false}: 写入失败
|
||||
*/
|
||||
public static boolean writeFileFromIS(String filePath, final InputStream is, boolean append) {
|
||||
return writeFileFromIS(FileUtils.getFileByPath(filePath), is, append);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将输入流写入文件
|
||||
*
|
||||
* @param file 文件
|
||||
* @param is 输入流
|
||||
* @return {@code true}: 写入成功<br>{@code false}: 写入失败
|
||||
*/
|
||||
public static boolean writeFileFromIS(File file, final InputStream is) {
|
||||
return writeFileFromIS(file, is, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将输入流写入文件
|
||||
*
|
||||
* @param file 文件
|
||||
* @param is 输入流
|
||||
* @param append 是否追加在文件末
|
||||
* @return {@code true}: 写入成功<br>{@code false}: 写入失败
|
||||
*/
|
||||
public static boolean writeFileFromIS(File file, final InputStream is, boolean append) {
|
||||
if (!FileUtils.createOrExistsFile(file) || is == null) return false;
|
||||
OutputStream os = null;
|
||||
try {
|
||||
os = new BufferedOutputStream(new FileOutputStream(file, append));
|
||||
byte data[] = new byte[1024];
|
||||
int len;
|
||||
while ((len = is.read(data, 0, 1024)) != -1) {
|
||||
os.write(data, 0, len);
|
||||
}
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
try {
|
||||
is.close();
|
||||
os.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将字符串写入文件
|
||||
*
|
||||
* @param filePath 文件路径
|
||||
* @param content 写入内容
|
||||
* @return {@code true}: 写入成功<br>{@code false}: 写入失败
|
||||
*/
|
||||
public static boolean writeFileFromString(String filePath, String content) {
|
||||
return writeFileFromString(FileUtils.getFileByPath(filePath), content, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串写入文件
|
||||
*
|
||||
* @param filePath 文件路径
|
||||
* @param content 写入内容
|
||||
* @param append 是否追加在文件末
|
||||
* @return {@code true}: 写入成功<br>{@code false}: 写入失败
|
||||
*/
|
||||
public static boolean writeFileFromString(String filePath, String content, boolean append) {
|
||||
return writeFileFromString(FileUtils.getFileByPath(filePath), content, append);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串写入文件
|
||||
*
|
||||
* @param file 文件
|
||||
* @param content 写入内容
|
||||
* @return {@code true}: 写入成功<br>{@code false}: 写入失败
|
||||
*/
|
||||
public static boolean writeFileFromString(File file, String content) {
|
||||
return writeFileFromString(file, content, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串写入文件
|
||||
*
|
||||
* @param file 文件
|
||||
* @param content 写入内容
|
||||
* @param append 是否追加在文件末
|
||||
* @return {@code true}: 写入成功<br>{@code false}: 写入失败
|
||||
*/
|
||||
public static boolean writeFileFromString(File file, String content, boolean append) {
|
||||
if (file == null || content == null) return false;
|
||||
if (!FileUtils.createOrExistsFile(file)) return false;
|
||||
BufferedWriter bw = null;
|
||||
try {
|
||||
bw = new BufferedWriter(new FileWriter(file, append));
|
||||
bw.write(content);
|
||||
bw.newLine();
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
try {
|
||||
bw.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 读取文件到字符串中
|
||||
*
|
||||
* @param filePath 文件路径
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String readFile2String(String filePath) {
|
||||
return readFile2String(FileUtils.getFileByPath(filePath), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取文件到字符串中
|
||||
*
|
||||
* @param filePath 文件路径
|
||||
* @param charsetName 编码格式
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String readFile2String(String filePath, String charsetName) {
|
||||
return readFile2String(FileUtils.getFileByPath(filePath), charsetName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取文件到字符串中
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String readFile2String(File file) {
|
||||
return readFile2String(file, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取文件到字符串中
|
||||
*
|
||||
* @param file 文件
|
||||
* @param charsetName 编码格式
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String readFile2String(File file, String charsetName) {
|
||||
if (!FileUtils.isFileExists(file)) return null;
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (isSpace(charsetName)) {
|
||||
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
|
||||
} else {
|
||||
reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), charsetName));
|
||||
}
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
sb.append(line).append(LINE_SEP);
|
||||
}
|
||||
// delete the last line separator
|
||||
return sb.delete(sb.length() - LINE_SEP.length(), sb.length()).toString();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
} finally {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static boolean isSpace(String s) {
|
||||
if (s == null) return true;
|
||||
for (int i = 0, len = s.length(); i < len; ++i) {
|
||||
if (!Character.isWhitespace(s.charAt(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -81,39 +81,6 @@ public class OkHttpUtil {
|
||||
return request;
|
||||
}
|
||||
|
||||
public static Request put(OkDate od, Context con){
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
if(od.getMadiaType()!=null && od.getMadiaType().equals("")){
|
||||
od.setMadiaType("{}");
|
||||
}
|
||||
// JSONObject jsonObject = JSON.parseObject(od.getMadiaType());
|
||||
// jsonObject.put("timestamp", DateUtil.current());
|
||||
// jsonObject.put("deviceId", GetUtil.getDeviceId(con));
|
||||
// String sign = SecureUtil.signParamsSha1(jsonObject,SIGN_PASSWORD);
|
||||
// Log.e("jsonObject",jsonObject.toString());
|
||||
// Log.e("sign",sign);
|
||||
// Map<String,Object> map=new HashMap<>();
|
||||
// map.put("data",SecurityUtil.encrypt(jsonObject.toString()));
|
||||
// Log.e("参数1",od.getMadiaType());
|
||||
// Log.e("参数2",MapUtil.mapJson(map));
|
||||
//MapUtil.mapJson(map)
|
||||
RequestBody body = RequestBody.create(mediaType,od.getMadiaType());
|
||||
Headers.Builder hb=new Headers.Builder();
|
||||
hb.add("Content-Type","application/json");
|
||||
hb.add("Cache-Control","no-cache");
|
||||
Request request = new Request.Builder()
|
||||
.url(od.getUrl())
|
||||
.put(body)
|
||||
.headers(hb.build())
|
||||
.addHeader("Version", VersionUtil.getVersion(con))
|
||||
.addHeader("VersionCode",String.valueOf(AppUtils.getAppVersionCode()))
|
||||
//.addHeader("sign",sign)
|
||||
.removeHeader("User-Agent")
|
||||
.addHeader("User-Agent",GetUtil.getUserAgent(con))
|
||||
.build();
|
||||
return request;
|
||||
}
|
||||
|
||||
public static Request get(OkDate od){
|
||||
Headers.Builder hb=new Headers.Builder();
|
||||
hb.add("Content-Type","application/json");
|
||||
|
||||
@@ -8,7 +8,9 @@ import com.amap.api.location.AMapLocation;
|
||||
import com.amap.api.location.AMapLocationClient;
|
||||
import com.amap.api.location.AMapLocationClientOption;
|
||||
import com.amap.api.location.AMapLocationListener;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.cache.CacheGroup;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.msg.MsgUtil;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
@@ -74,6 +76,7 @@ public class LocationGDUtil {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = new Date(aMapLocation.getTime());
|
||||
df.format(date);
|
||||
CacheGroup.cacheList.put("getLocation",new Gson().toJson(aMapLocation));
|
||||
MsgUtil.addHdMsgWat(hd,RES);
|
||||
if (mLocationClient!=null) {
|
||||
mLocationClient.onDestroy();
|
||||
|
||||
-101
@@ -1,101 +0,0 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.util.location;
|
||||
|
||||
import static com.arpa.hndahesudintocctmsdriver.util.location.LocationGDUtil.RES;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.Address;
|
||||
import android.location.Criteria;
|
||||
import android.location.Geocoder;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Handler;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.util.cache.CacheGroup;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.msg.MsgUtil;
|
||||
import com.dahe.mylibrary.utils.ToastUtils;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @ClassName LocationManagerUtil
|
||||
* @Author john
|
||||
* @Date 2024/7/25 15:21
|
||||
* @Description LocationManager本地定位
|
||||
*/
|
||||
public class LocationManagerUtil {
|
||||
|
||||
public static LocationManagerUtil mInstance = null;
|
||||
|
||||
public static LocationManagerUtil getInstance() {
|
||||
if (null == mInstance) {
|
||||
synchronized (LocationManagerUtil.class) {
|
||||
if (null == mInstance) {
|
||||
mInstance = new LocationManagerUtil();
|
||||
}
|
||||
}
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
private LocationManagerUtil() {
|
||||
}
|
||||
|
||||
public void getLocation(Context ctx, Handler hd) {
|
||||
LocationManager locationManager = (LocationManager) ctx.getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
//创建定位条件器
|
||||
Criteria criteria = new Criteria();
|
||||
//设置精度,Criteria.ACCURACY_FINE表示精确,Criteria.ACCURACY_COARSE表示粗略
|
||||
criteria.setAccuracy(Criteria.ACCURACY_FINE);
|
||||
//设置是否需要海拔信息
|
||||
criteria.setAltitudeRequired(true);
|
||||
//设置是否需要方位信息
|
||||
criteria.setBearingRequired(true);
|
||||
//设置是否允许运营商扣费
|
||||
criteria.setCostAllowed(true);
|
||||
//设置对电源的需求
|
||||
criteria.setPowerRequirement(Criteria.POWER_LOW);
|
||||
|
||||
String bestProvider = locationManager.getBestProvider(criteria, true);
|
||||
if (bestProvider != null) {
|
||||
if (ActivityCompat.checkSelfPermission(ctx, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(ctx, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
ToastUtils.showToast(ctx, "请查看定位权限");
|
||||
return;
|
||||
}
|
||||
locationManager.requestLocationUpdates(bestProvider, 300, 0, new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(@NonNull Location location) {
|
||||
try {
|
||||
Geocoder geocoder = new Geocoder(ctx, Locale.getDefault());
|
||||
List<Address> fromLocation = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
|
||||
if (fromLocation != null && !fromLocation.isEmpty()) {
|
||||
Address address = fromLocation.get(0);
|
||||
String addressLine = address.getAddressLine(0);
|
||||
String adminArea = address.getAdminArea();//省
|
||||
String locality = address.getLocality();//市
|
||||
String subLocality = address.getSubLocality();//县
|
||||
String featureName = address.getFeatureName();//详细地址
|
||||
CacheGroup.cacheList.put("getLocation", new Gson().toJson(address));
|
||||
MsgUtil.addHdMsgWat(hd, RES);
|
||||
locationManager.removeUpdates(this);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtils.showToast(ctx, "定位失败,请查看定位权限");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 7.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB |
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/read_select" android:state_checked="true"></item>
|
||||
<item android:drawable="@drawable/read_nor" android:state_checked="false"></item>
|
||||
<item android:drawable="@drawable/read_nor"></item>
|
||||
</selector>
|
||||
@@ -104,15 +104,35 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<CheckBox
|
||||
android:layout_marginTop="@dimen/dp_3"
|
||||
android:id="@+id/cb"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_height="@dimen/dp_34"
|
||||
android:button="@null"
|
||||
android:checked="false"
|
||||
android:drawableStart="@drawable/select_read"/>
|
||||
<androidx.cardview.widget.CardView
|
||||
android:padding="@dimen/dp_7"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_width="@dimen/dp_14"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
app:cardCornerRadius="@dimen/dp_7"
|
||||
app:cardBackgroundColor="@color/theme_color"
|
||||
app:cardElevation="@dimen/dp_0">
|
||||
<androidx.cardview.widget.CardView
|
||||
android:padding="@dimen/dp_7"
|
||||
android:id="@+id/no_btn"
|
||||
android:layout_width="@dimen/dp_12"
|
||||
android:layout_height="@dimen/dp_12"
|
||||
app:cardCornerRadius="@dimen/dp_6"
|
||||
app:cardBackgroundColor="#fff"
|
||||
android:layout_gravity="center"
|
||||
app:cardElevation="@dimen/dp_0">
|
||||
</androidx.cardview.widget.CardView>
|
||||
<ImageButton
|
||||
android:id="@+id/agree_btn"
|
||||
android:layout_width="@dimen/dp_14"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:src="@mipmap/choice"
|
||||
android:scaleType="fitXY"
|
||||
android:background="#fff"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -4,12 +4,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<!-- <com.amap.api.maps.MapView-->
|
||||
<!-- android:id="@+id/map"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"/>-->
|
||||
|
||||
<com.lk.mapsdk.map.mapapi.map.MapView
|
||||
<com.amap.api.maps.MapView
|
||||
android:id="@+id/map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
+1
-3
@@ -12,7 +12,6 @@ buildscript {
|
||||
maven {
|
||||
url 'https://maven.aliyun.com/repository/releases'
|
||||
}
|
||||
maven { url 'http://lbs-sdk.luokuang.com/repository/maven-releases/' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.2.2'
|
||||
@@ -32,10 +31,9 @@ allprojects {
|
||||
maven {
|
||||
url 'https://maven.aliyun.com/repository/releases'
|
||||
}
|
||||
maven { url 'http://lbs-sdk.luokuang.com/repository/maven-releases/' }
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user