Compare commits
37 Commits
Author | SHA1 | Date | |
---|---|---|---|
e3b6ba4f1c | |||
58a3f502da | |||
80a257273b | |||
5a846d220d | |||
01bd0e03ff | |||
82b1413429 | |||
8b2007a11d | |||
d181d819b0 | |||
1042fbd283 | |||
f1ffdd31af | |||
3b7a77c45b | |||
7fdb48817f | |||
496319c04b | |||
86d3599110 | |||
23ca8f1411 | |||
cfc32bfe66 | |||
ab59be9f94 | |||
e59e2d0fa4 | |||
041bcaf2ec | |||
291578cd72 | |||
1ef4f3b9ca | |||
ab34920c8f | |||
63026819f8 | |||
83fc537c8d | |||
7a02706b75 | |||
d78ec09c04 | |||
40d344e245 | |||
866a46a7cb | |||
e4bdf1384f | |||
cabbe363a9 | |||
6fc87c0d2e | |||
61c22800f7 | |||
deb11d4d99 | |||
77481c73f6 | |||
2da410bcd4 | |||
c6005ee9a1 | |||
65994b8eda |
@ -38,8 +38,8 @@ android {
|
||||
applicationId "com.arpa.hndahesudintocctmsdriver"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 30
|
||||
versionCode 72
|
||||
versionName "3.4.2"
|
||||
versionCode 76
|
||||
versionName "3.4.6"
|
||||
flavorDimensions "CHANNEL_VALUE"
|
||||
flavorDimensions "app_icon"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
@ -2,6 +2,7 @@
|
||||
<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" />
|
||||
@ -71,14 +72,14 @@
|
||||
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" />
|
||||
@ -93,11 +94,11 @@
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.PhotoCarActivity"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<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">
|
||||
@ -142,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">
|
||||
@ -161,14 +162,19 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.CertificatesActivity"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden"
|
||||
android:screenOrientation="portrait"/>
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.AddCarSuccActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.FaceSuccActivity"
|
||||
android:exported="true"
|
||||
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"
|
||||
@ -192,28 +198,33 @@
|
||||
</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:launchMode="singleTop"
|
||||
android:screenOrientation="portrait">
|
||||
|
||||
</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"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.web.WebOnlyOneActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.web.WebKfActivity"
|
||||
android:screenOrientation="portrait"
|
||||
@ -223,7 +234,7 @@
|
||||
<activity
|
||||
android:name=".ui.news.NewActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
|
||||
<service
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.service.TrackService"
|
||||
@ -266,7 +277,7 @@
|
||||
<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>
|
||||
|
||||
@ -362,10 +373,11 @@
|
||||
|
||||
<activity
|
||||
android:name=".H5Activity"
|
||||
android:screenOrientation="portrait"
|
||||
android:launchMode="singleTask">
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
@ -377,16 +389,23 @@
|
||||
android:host="demo"
|
||||
android:path="/realBack"
|
||||
android:scheme="esign" />
|
||||
|
||||
<data
|
||||
android:host="driver"
|
||||
android:path="/realBack"
|
||||
android:port="8088"
|
||||
android:scheme="dahe" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
|
||||
<activity
|
||||
android:name=".H5Activity2"
|
||||
android:screenOrientation="portrait"
|
||||
android:launchMode="singleTask">
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
|
@ -41,9 +41,11 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.cuspop.SimCenterPop;
|
||||
import com.arpa.hndahesudintocctmsdriver.event.FaceEvent;
|
||||
import com.arpa.hndahesudintocctmsdriver.event.HomeEvent;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.UserRequset;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.MainActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.UiAuxiliary;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.auth.CertificatesActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.auth.FaceSuccActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.home.StartYunDanActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
|
||||
import com.dahe.mylibrary.utils.ActivityUtils;
|
||||
@ -99,13 +101,13 @@ public class H5Activity extends AppCompatActivity {
|
||||
WebSettings webSetting = mWebView.getSettings();
|
||||
|
||||
String title = getIntent().getStringExtra("title");
|
||||
if (!TextUtils.isEmpty(title)){
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
tvTitle.setText(title);
|
||||
}
|
||||
|
||||
back.setOnClickListener(v -> {
|
||||
if (isOk){
|
||||
ActivityUtils.finishToActivity(MainActivity.class,false);
|
||||
if (isOk) {
|
||||
ActivityUtils.finishToActivity(MainActivity.class, false);
|
||||
return;
|
||||
}
|
||||
if (mWebView.canGoBack()) {
|
||||
@ -116,8 +118,8 @@ public class H5Activity extends AppCompatActivity {
|
||||
});
|
||||
|
||||
close.setOnClickListener(v -> {
|
||||
if (isOk){
|
||||
ActivityUtils.finishToActivity(MainActivity.class,false);
|
||||
if (isOk) {
|
||||
ActivityUtils.finishToActivity(MainActivity.class, false);
|
||||
return;
|
||||
}
|
||||
if (mWebView.canGoBack()) {
|
||||
@ -209,6 +211,15 @@ public class H5Activity extends AppCompatActivity {
|
||||
if (uri != null) {
|
||||
// 芝麻认证刷脸结束返回获取后续操作页面地址
|
||||
// String callbackUrl = uri.getQueryParameter("callback");
|
||||
String urlString = uri.toString();
|
||||
if ("dahe://driver:8088/realBack".equals(urlString)) {
|
||||
Intent in = new Intent(ctx, FaceSuccActivity.class);
|
||||
in.putExtra("isGoCar", true);
|
||||
startActivity(in);
|
||||
ActivityUtils.finishToActivity(MainActivity.class, false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
String callbackUrl = uri.getQueryParameter("realnameUrl");
|
||||
if (!TextUtils.isEmpty(callbackUrl)) {
|
||||
@ -221,15 +232,29 @@ public class H5Activity extends AppCompatActivity {
|
||||
|
||||
} else {
|
||||
String url = intent.getStringExtra("url");
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
ActivityUtils.finishToActivity(MainActivity.class, false);
|
||||
return;
|
||||
}
|
||||
viewFile = intent.getBooleanExtra("view_file", false);
|
||||
if (url.startsWith("alipay")) {
|
||||
|
||||
try {
|
||||
Intent intent2 = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
intent2.putExtra("isGoCar", isGoCar);
|
||||
startActivity(intent2);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
// }else if (url.startsWith("https://agreement.dahehuoyun.com/#/1ba5c216/912f4c9587/5eb5184653/6ef9")) {
|
||||
} else if (url.startsWith("https://agreement.dahehuoyun.com")) {
|
||||
Intent in = new Intent(ctx, FaceSuccActivity.class);
|
||||
startActivity(in);
|
||||
if (isGoCar) {
|
||||
ActivityUtils.finishToActivity(MainActivity.class, false);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (curUrl == null) {
|
||||
curUrl = url;
|
||||
@ -249,17 +274,30 @@ public class H5Activity extends AppCompatActivity {
|
||||
Uri uri = Uri.parse(url);
|
||||
Log.e("test", "要加载的地址:" + uri.getScheme() + " " + url + " ");
|
||||
if (uri.getScheme().equals("http") || uri.getScheme().equals("https")) {
|
||||
if (isGoCar&&url.startsWith("http://agreement.dahehuoyun.com/#/1ba5c216/912f4c9587/5eb5184653/6ef9")){
|
||||
isOk = true;
|
||||
view.loadUrl(url);
|
||||
new MessageUtils().showSimCenPop(ctx, "个人信息上传成功,请添加车辆信息!", "去添加",() -> {
|
||||
Intent in = new Intent(ctx, CertificatesActivity.class);
|
||||
in.putExtra("index", 2);
|
||||
startActivity(in);
|
||||
ActivityUtils.finishToActivity(MainActivity.class,false);
|
||||
});
|
||||
// if (url.startsWith("https://agreement.dahehuoyun.com/#/1ba5c216/912f4c9587/5eb5184653/6ef9")) {
|
||||
if (url.startsWith("https://agreement.dahehuoyun.com")) {
|
||||
Intent in = new Intent(ctx, FaceSuccActivity.class);
|
||||
in.putExtra("isGoCar", isGoCar);
|
||||
startActivity(in);
|
||||
if (isGoCar) {
|
||||
ActivityUtils.finishToActivity(MainActivity.class, false);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// if (isGoCar&&url.startsWith("https://agreement.dahehuoyun.com/#/1ba5c216/912f4c9587/5eb5184653/6ef9")){
|
||||
// isOk = true;
|
||||
// view.loadUrl(url);
|
||||
// new MessageUtils().showSimCenPop(ctx, "个人信息上传成功,请添加车辆信息!", "去添加",() -> {
|
||||
// Intent in = new Intent(ctx, CertificatesActivity.class);
|
||||
// in.putExtra("index", 2);
|
||||
// startActivity(in);
|
||||
// ActivityUtils.finishToActivity(MainActivity.class,false);
|
||||
// });
|
||||
// return true;
|
||||
// }
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
} else if (uri.getScheme().equals("js") || uri.getScheme().equals("jsbridge")) {
|
||||
@ -320,11 +358,11 @@ public class H5Activity extends AppCompatActivity {
|
||||
if (status) {
|
||||
//认证成功返回
|
||||
//认证成功返回
|
||||
new Handler().postDelayed(() -> {
|
||||
FaceEvent he = new FaceEvent("刷脸成功");
|
||||
EventBus.getDefault().post(he);
|
||||
finish();
|
||||
}, 800);
|
||||
// new Handler().postDelayed(() -> {
|
||||
// FaceEvent he = new FaceEvent("刷脸成功");
|
||||
// EventBus.getDefault().post(he);
|
||||
// finish();
|
||||
// }, 800);
|
||||
Toast.makeText(H5Activity.this, "认证成功", Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
}
|
||||
|
@ -99,10 +99,19 @@ public class CarInfoBean2 implements Serializable {
|
||||
private String threeImageStatus;
|
||||
private String towAuality;
|
||||
private String trailer;
|
||||
private String trailerId;
|
||||
private String type;
|
||||
private String vehicleAxis;
|
||||
private String vehicleNumber;
|
||||
|
||||
public String getTrailerId() {
|
||||
return trailerId;
|
||||
}
|
||||
|
||||
public void setTrailerId(String trailerId) {
|
||||
this.trailerId = trailerId;
|
||||
}
|
||||
|
||||
public String getAllAuality() {
|
||||
return allAuality;
|
||||
}
|
||||
|
@ -83,6 +83,8 @@ public class HuoYuanDelBean {
|
||||
private String vehicleTypeName;
|
||||
private int vehicleLength;
|
||||
private String vehicleLengthName;
|
||||
private String carNumber;
|
||||
private String carId;
|
||||
private String namedDrivers;
|
||||
private String requirement;
|
||||
private String totalFreight;
|
||||
@ -97,6 +99,23 @@ public class HuoYuanDelBean {
|
||||
private Object contactName;
|
||||
private Object contactPhone;
|
||||
|
||||
|
||||
public String getCarNumber() {
|
||||
return carNumber == null ? "" : carNumber;
|
||||
}
|
||||
|
||||
public void setCarNumber(String carNumber) {
|
||||
this.carNumber = carNumber;
|
||||
}
|
||||
|
||||
public String getCarId() {
|
||||
return carId == null ? "" : carId;
|
||||
}
|
||||
|
||||
public void setCarId(String carId) {
|
||||
this.carId = carId;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -119,6 +119,9 @@ public class JTTProcess {
|
||||
//参数 ShippingNoteInfo 和 start 接口中的参数 ShippingNoteInfo 相
|
||||
//同,这里 shippingNoteInfo 信息只需传入运单号和分单号即可
|
||||
public static void send(Context con,StartOrderBean sob,String remark){
|
||||
if (sob.getData()==null){
|
||||
return;
|
||||
}
|
||||
ShippingNoteInfo[] snis=new ShippingNoteInfo[1];
|
||||
ShippingNoteInfo sni=new ShippingNoteInfo();
|
||||
sni.setShippingNoteNumber(sob.getData().getShippingNoteNumber());
|
||||
|
@ -80,6 +80,12 @@ public class UserRequset {
|
||||
RequestUtil.start(1, "userdata", re, con, hd);
|
||||
}
|
||||
|
||||
//账户信息
|
||||
public void User2() {
|
||||
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getUserUrl(), ""), getToken(con), con);
|
||||
RequestUtil.start(1, "userdata2", re, con, hd);
|
||||
}
|
||||
|
||||
//司机认证信息
|
||||
public void driverAuthData() {
|
||||
String mt = "{}";
|
||||
|
@ -14,6 +14,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.web.WebOnlyOneActivity;
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.web.WebActivity;
|
||||
@ -68,7 +69,7 @@ public class AgreementAlert extends CenterPopupView {
|
||||
@Override
|
||||
public void onClick(View widget) {
|
||||
//用户服务协议点击事件
|
||||
Intent in=new Intent(getContext(), WebActivity.class);
|
||||
Intent in=new Intent(getContext(), WebOnlyOneActivity.class);
|
||||
in.putExtra("url",url2);
|
||||
in.putExtra("title","用户服务协议");
|
||||
getContext().startActivity(in);
|
||||
@ -87,7 +88,7 @@ public class AgreementAlert extends CenterPopupView {
|
||||
@Override
|
||||
public void onClick(View widget) {
|
||||
//用户服务协议点击事件
|
||||
Intent in=new Intent(getContext(), WebActivity.class);
|
||||
Intent in=new Intent(getContext(), WebOnlyOneActivity.class);
|
||||
in.putExtra("url",url);
|
||||
in.putExtra("title","隐私政策");
|
||||
getContext().startActivity(in);
|
||||
|
@ -25,6 +25,7 @@ import com.arpa.hndahesudintocctmsdriver.parts.UserParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.OCRRequest;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.string.StringUtil;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.dahe.mylibrary.utils.ImageLoader;
|
||||
import com.dahe.mylibrary.utils.TimeUtil;
|
||||
import com.esign.esignsdk.EsignSdk;
|
||||
import com.esign.esignsdk.data.AuthEvent;
|
||||
@ -91,7 +92,7 @@ public class AuthQualificationActivity extends BaseAppCompatActivity {
|
||||
}
|
||||
|
||||
url = ub.getData().getUrl();
|
||||
Glide.with(con).load(url).into(img);
|
||||
ImageLoader.getInstance().loadImage(con,url,img);
|
||||
up_img.setVisibility(View.GONE);
|
||||
img.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@ -104,7 +105,7 @@ public class AuthQualificationActivity extends BaseAppCompatActivity {
|
||||
List<OCRQualiBean.DataDTO.QualificationCategoryListDTO> qualificationCategoryList = ocrQualiBean.getData().getQualification_category_list();
|
||||
if (qualificationCategoryList != null && qualificationCategoryList.size() > 0) {
|
||||
String expiryDate = qualificationCategoryList.get(0).getExpiry_date();
|
||||
if (expiryDate.contains("-")){
|
||||
if (!TextUtils.isEmpty(expiryDate)&&expiryDate.contains("-")){
|
||||
value2.setText(expiryDate);
|
||||
}
|
||||
}
|
||||
@ -143,7 +144,6 @@ public class AuthQualificationActivity extends BaseAppCompatActivity {
|
||||
}, 3000);
|
||||
}
|
||||
} else {
|
||||
finish();
|
||||
if (isOverCar) {//从业资格证=》道路运输许可证
|
||||
Intent in = new Intent(con, PhotoCarActivity.class);
|
||||
in.putExtra("type", 3);
|
||||
@ -154,6 +154,7 @@ public class AuthQualificationActivity extends BaseAppCompatActivity {
|
||||
in.putExtra("type", 3);
|
||||
con.startActivity(in);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
@ -371,13 +372,13 @@ public class AuthQualificationActivity extends BaseAppCompatActivity {
|
||||
value2.setText(ib.getData().getQualificationCertificateValidity());
|
||||
up_img.setVisibility(View.GONE);
|
||||
img.setVisibility(View.VISIBLE);
|
||||
Glide.with(con).load(url).into(img);
|
||||
ImageLoader.getInstance().loadImage(con,url,img);
|
||||
upload_img.setText("已上传");
|
||||
} else {
|
||||
submit.setBackgroundResource(R.drawable.bg_btn_grey);
|
||||
isAuth = true;
|
||||
url = userBean.getData().getPartyMemberUrl();
|
||||
Glide.with(con).load(url).into(img);
|
||||
ImageLoader.getInstance().loadImage(con,url,img);
|
||||
up_img.setVisibility(View.GONE);
|
||||
img.setVisibility(View.VISIBLE);
|
||||
upload_img.setText("已上传");
|
||||
|
@ -1,11 +1,13 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.ui.auth;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@ -35,8 +37,10 @@ import com.arpa.hndahesudintocctmsdriver.event.VehicleEvent;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.wallet.UpBankActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.PickerUtils;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.PicturlUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.map.MapUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.weight.OnLimitClickHelper;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
@ -85,6 +89,8 @@ import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseRecyclerView;
|
||||
import com.lxj.xpopup.photoview.PhotoView;
|
||||
import com.lxj.xpopup.util.SmartGlideImageLoader;
|
||||
import com.lxj.xpopup.util.XPermission;
|
||||
import com.permissionx.guolindev.PermissionX;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -120,6 +126,7 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
private int[] typeImgTwo = {R.mipmap.id_back, R.mipmap.license_back, R.mipmap.vehicle_license_back, R.mipmap.vehicle_license_back};
|
||||
private int index = 0;
|
||||
private String carExistCarId = "";
|
||||
private String trailerId = "";
|
||||
private DicBean.DataDTO curColor, curEnergy;
|
||||
private TextView zj_name, zjimg_name, zjimg2_name, zj_name2, zj_name3;
|
||||
private TextView name1, name2, name3, name4, value5, value6;
|
||||
@ -209,8 +216,6 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
key = true;
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
Toast.makeText(con, bb.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -221,12 +226,25 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
Log.e("url", CacheGroup.cacheList.get("authUrl"));
|
||||
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get("authUrl"), BaseBean.class);
|
||||
if (bb.getCode() == 200) {
|
||||
Intent intent = new Intent(this, H5Activity.class);
|
||||
intent.putExtra("url", (String) bb.getData());
|
||||
intent.putExtra("view_file", false);
|
||||
intent.putExtra("title", "人脸识别");
|
||||
intent.putExtra("isGoCar", true);
|
||||
startActivity(intent);
|
||||
PermissionX.init(this)
|
||||
.permissions(Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (allGranted) {
|
||||
Intent intent = new Intent(this, H5Activity.class);
|
||||
intent.putExtra("url", (String) bb.getData());
|
||||
intent.putExtra("view_file", false);
|
||||
intent.putExtra("title", "人脸识别");
|
||||
intent.putExtra("isGoCar", true);
|
||||
startActivity(intent);
|
||||
} else {
|
||||
new MessageUtils().showSimCenPop(act, "缺少相机,媒体权限,将无法为您提供服务,去开启!", "取消", "确认", () -> {
|
||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
Uri uri = Uri.fromParts("package", getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
act.startActivity(intent);
|
||||
});
|
||||
}
|
||||
});
|
||||
// EsignSdk.getInstance().startH5Activity(act, StringUtil.isNull(String.valueOf(bb.getData()), ""));
|
||||
} else {
|
||||
Toast.makeText(con, bb.getMsg(), Toast.LENGTH_LONG).show();
|
||||
@ -280,22 +298,6 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
con.startActivity(in);
|
||||
}
|
||||
finish();
|
||||
// if ("1".equals(needUpQCPhoto)) {
|
||||
// //现逻辑:上传行驶证信息后 判断是否跳转从业资格证
|
||||
// Intent in = new Intent(con, AuthQualificationActivity.class);
|
||||
// in.putExtra("type", "0");
|
||||
// in.putExtra("isOverCar", false);
|
||||
// in.putExtra("carId", String.valueOf(czb.getData().getCarId()));
|
||||
// startActivity(in);
|
||||
// } else {
|
||||
// //原逻辑:上传行驶证信息后 跳转车辆照片页面
|
||||
// Intent in = new Intent(con, PhotoCarActivity.class);
|
||||
// in.putExtra("type", 0);
|
||||
// in.putExtra("carId", String.valueOf(czb.getData().getCarId()));
|
||||
// con.startActivity(in);
|
||||
// }
|
||||
|
||||
|
||||
} else {
|
||||
Toast.makeText(con, czb.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -311,7 +313,7 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
String needUpQCPhoto = bb.getData().getNeedUpQCPhoto();
|
||||
String needUpRLPhoto = bb.getData().getNeedUpRLPhoto();//是否需要上传道路运输证到
|
||||
Toast.makeText(con, "挂车信息保存成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
|
||||
VehicleEvent ve = new VehicleEvent("挂");
|
||||
EventBus.getDefault().post(ve);
|
||||
|
||||
@ -335,6 +337,8 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
in.putExtra("carId", carId);
|
||||
con.startActivity(in);
|
||||
}
|
||||
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(con, "挂车信息保存失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -459,12 +463,25 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
Log.e("url", CacheGroup.cacheList.get("authUrl"));
|
||||
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get("authUrl"), BaseBean.class);
|
||||
if (bb.getCode() == 200) {
|
||||
Intent intent = new Intent(this, H5Activity.class);
|
||||
intent.putExtra("url", (String) bb.getData());
|
||||
intent.putExtra("view_file", false);
|
||||
intent.putExtra("title", "人脸识别");
|
||||
intent.putExtra("isGoCar", true);
|
||||
startActivity(intent);
|
||||
PermissionX.init(this)
|
||||
.permissions(Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (allGranted) {
|
||||
Intent intent = new Intent(this, H5Activity.class);
|
||||
intent.putExtra("url", (String) bb.getData());
|
||||
intent.putExtra("view_file", false);
|
||||
intent.putExtra("title", "人脸识别");
|
||||
intent.putExtra("isGoCar", true);
|
||||
startActivity(intent);
|
||||
} else {
|
||||
new MessageUtils().showSimCenPop(act, "缺少相机,媒体权限,将无法为您提供服务,去开启!", "取消", "确认", () -> {
|
||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
Uri uri = Uri.fromParts("package", getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
act.startActivity(intent);
|
||||
});
|
||||
}
|
||||
});
|
||||
// EsignSdk.getInstance().startH5Activity(act, StringUtil.isNull(String.valueOf(bb.getData()), ""));
|
||||
} else {
|
||||
Toast.makeText(con, bb.getMsg(), Toast.LENGTH_LONG).show();
|
||||
@ -476,6 +493,7 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
if (bb.getCode() == 200 && bb.getData() != null) {
|
||||
if (!TextUtils.isEmpty(bb.getData().getCarId())) {
|
||||
carExistCarId = bb.getData().getCarId();
|
||||
trailerId = bb.getData().getTrailerId();
|
||||
value1.setEnabled(false);
|
||||
value2.setEnabled(false);
|
||||
value3.setEnabled(false);
|
||||
@ -483,7 +501,7 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
// img2.setEnabled(false);
|
||||
u_img2.setEnabled(false);
|
||||
url2 = bb.getData().getBackImage();
|
||||
Glide.with(con).load(bb.getData().getBackImage()).into(img2);
|
||||
ImageLoader.getInstance().loadImage(con,bb.getData().getBackImage(),img2);
|
||||
// url2 = olb.getData().getExistCarInfo().getBackImage();
|
||||
ToastUtils.showLongToast(con, "该车辆已存在,请仔细核对相关信息");
|
||||
}
|
||||
@ -497,16 +515,25 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
if (bb.getCode() == 200) {
|
||||
VehicleEvent ve = new VehicleEvent(String.valueOf(carExistCarId));
|
||||
EventBus.getDefault().postSticky(ve);
|
||||
finish();
|
||||
if (("0".equals(trailerId) || TextUtils.isEmpty(trailerId)) && value2.getText().toString().contains("牵")) {
|
||||
Intent in = new Intent(con, CertificatesActivity.class);
|
||||
in.putExtra("index", 3);
|
||||
in.putExtra("carId", carExistCarId);
|
||||
startActivity(in);
|
||||
finish();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
|
||||
ToastUtils.showToast(con, bb.getMsg());
|
||||
}else{
|
||||
} else {
|
||||
ToastUtils.showToast(con, bb.getMsg());
|
||||
}
|
||||
CacheGroup.cacheList.remove("bindCarInfo");
|
||||
} else {
|
||||
pathOrcRes();
|
||||
//重复代码?
|
||||
initView(null);
|
||||
// initView(null);
|
||||
if (!(CacheGroup.cacheList.get(TYPE_NAME_BANK[2]) != null || CacheGroup.cacheList.get(TYPE_NAME_BANK[3]) != null)) {
|
||||
initData();
|
||||
}
|
||||
@ -611,6 +638,7 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
initView(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -721,7 +749,7 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
}
|
||||
});
|
||||
|
||||
submit.setOnClickListener(v -> {
|
||||
submit.setOnClickListener(new OnLimitClickHelper(v->{
|
||||
if (!isAuth) {
|
||||
subimt();
|
||||
} else {
|
||||
@ -765,7 +793,7 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -788,8 +816,8 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
value2.setText(iacb.getData().getIdcard());
|
||||
value3.setText(iacb.getData().getIdcardAddress());
|
||||
value4.setText(iacb.getData().getIdcardValidity());
|
||||
Glide.with(con).load(url1).into(img1);
|
||||
Glide.with(con).load(url2).into(img2);
|
||||
ImageLoader.getInstance().loadImage(con,url1,img1);
|
||||
ImageLoader.getInstance().loadImage(con,url2,img2);
|
||||
submit.setBackgroundResource(R.drawable.bg_btn_grey);
|
||||
u_img.setText("已上传");
|
||||
u_img2.setText("已上传");
|
||||
@ -809,8 +837,8 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
value3.setText(iadalb.getData().getAllowType());
|
||||
value4.setText(iadalb.getData().getDriverLicenseValidity());
|
||||
submit.setBackgroundResource(R.drawable.bg_btn_grey);
|
||||
Glide.with(con).load(url1).into(img1);
|
||||
Glide.with(con).load(url2).into(img2);
|
||||
ImageLoader.getInstance().loadImage(con,url1,img1);
|
||||
ImageLoader.getInstance().loadImage(con,url2,img2);
|
||||
u_img.setText("已上传");
|
||||
u_img2.setText("已上传");
|
||||
isAuth = true;
|
||||
@ -829,9 +857,9 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
value5.setText(StringUtil.isNull(cdb.getData().getCarPlateColorValue(), "空数据"));
|
||||
value6.setText(StringUtil.isNull(cdb.getData().getCarEnergyTypValue(), "空数据"));
|
||||
submit.setBackgroundResource(R.drawable.bg_btn_grey);
|
||||
Glide.with(con).load(url1).into(img1);
|
||||
Glide.with(con).load(url2).into(img2);
|
||||
Glide.with(con).load(url3).into(img3);
|
||||
ImageLoader.getInstance().loadImage(con,url1,img1);
|
||||
ImageLoader.getInstance().loadImage(con,url2,img2);
|
||||
ImageLoader.getInstance().loadImage(con,url3,img3);
|
||||
u_img.setText("已上传");
|
||||
u_img2.setText("已上传");
|
||||
u_img3.setText("点击查看");
|
||||
@ -851,9 +879,9 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
value3.setText(StringUtil.isNull(cdb.getData().getTrailerResVo().getOwner(), "空数据"));
|
||||
value4.setText(StringUtil.isNull(cdb.getData().getTrailerResVo().getVehicleNumber(), "空数据"));
|
||||
value6.setText(StringUtil.isNull(cdb.getData().getCarEnergyTypValue(), "空数据"));
|
||||
Glide.with(con).load(url1).into(img1);
|
||||
Glide.with(con).load(url2).into(img2);
|
||||
Glide.with(con).load(url3).into(img3);
|
||||
ImageLoader.getInstance().loadImage(con,url1,img1);
|
||||
ImageLoader.getInstance().loadImage(con,url2,img2);
|
||||
ImageLoader.getInstance().loadImage(con,url3,img3);
|
||||
if (cdb.getRes() != 1) {
|
||||
submit.setBackgroundResource(R.drawable.bg_btn_grey);
|
||||
u_img.setText("已上传");
|
||||
@ -915,27 +943,29 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
case 0:
|
||||
if (CacheGroup.cacheList.get(TYPE_NAME[0]) != null) {
|
||||
ocb = gson.fromJson(CacheGroup.cacheList.get(TYPE_NAME[0]), OCRCardBean.class);
|
||||
ImageLoader.getInstance().loadImage(con, path, img1, typeImgOne[index]);
|
||||
if (ocb.getCode() == 200 && ocb.getData() != null) {
|
||||
// url1 = ocb.getData().getUrl();
|
||||
value1.setText(ocb.getData().getName());
|
||||
value2.setText(ocb.getData().getIdcard());
|
||||
value3.setText(ocb.getData().getAddress());
|
||||
Glide.with(con).load(path).into(img1);
|
||||
// Glide.with(con).load(path).into(img1);
|
||||
} else {
|
||||
Toast.makeText(con, "识别失败", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(con, "识别失败请重新上传", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove(TYPE_NAME[0]);
|
||||
}
|
||||
if (CacheGroup.cacheList.get(TYPE_NAME_BANK[0]) != null) {
|
||||
ocbb = gson.fromJson(CacheGroup.cacheList.get(TYPE_NAME_BANK[0]), OCRCardBackBean.class);
|
||||
ImageLoader.getInstance().loadImage(con, path, img2, typeImgTwo[index]);
|
||||
if (ocbb.getCode() == 200 && ocbb.getData() != null) {
|
||||
value4.setText(ocbb.getData().getValidTo());
|
||||
Glide.with(con).load(path).into(img2);
|
||||
// Glide.with(con).load(path).into(img2);
|
||||
startTime = ocbb.getData().getValidFrom();
|
||||
//自动调取提交功能,实现页面自动跳转
|
||||
subimt();
|
||||
} else {
|
||||
Toast.makeText(con, "识别失败", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(con, "识别失败请重新上传", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove(TYPE_NAME_BANK[0]);
|
||||
}
|
||||
@ -944,6 +974,7 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
//{"档案编号","初次领证日期","准驾车型","有效期限(止)"},
|
||||
if (CacheGroup.cacheList.get(TYPE_NAME[1]) != null) {
|
||||
odl = gson.fromJson(CacheGroup.cacheList.get(TYPE_NAME[1]), OCRDrivingLicenseBean.class);
|
||||
ImageLoader.getInstance().loadImage(con, path, img1, typeImgOne[index]);
|
||||
if (odl.getCode() == 200 && odl.getData() != null) {
|
||||
OCRDrivingLicenseBean.DataDTO od = odl.getData();
|
||||
// url1 = odl.getData().getUrl();
|
||||
@ -952,20 +983,22 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
value2.setText(StringUtil.isNull(od.getFirstGetDocDate(), "识别异常"));
|
||||
value3.setText(StringUtil.isNull(od.getQuasiDriveType(), "识别异常"));
|
||||
value4.setText(StringUtil.isNull(od.getEndDate(), "识别异常"));
|
||||
Glide.with(con).load(path).into(img1);
|
||||
|
||||
// Glide.with(con).load(path).into(img1);
|
||||
} else {
|
||||
Toast.makeText(con, "识别失败", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(con, "识别失败请重新上传", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove(TYPE_NAME[1]);
|
||||
}
|
||||
if (CacheGroup.cacheList.get(TYPE_NAME_BANK[1]) != null) {
|
||||
odlb = gson.fromJson(CacheGroup.cacheList.get(TYPE_NAME_BANK[1]), OCRDrivingLicenseBackBean.class);
|
||||
ImageLoader.getInstance().loadImage(con, path, img2, typeImgTwo[index]);
|
||||
if (odlb.getCode() == 200 && odlb.getData() != null) {
|
||||
Glide.with(con).load(path).into(img2);
|
||||
// Glide.with(con).load(path).into(img2);
|
||||
//自动调取提交功能,实现页面自动跳转
|
||||
subimt();
|
||||
} else {
|
||||
Toast.makeText(con, "识别失败", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(con, "识别失败请重新上传", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove(TYPE_NAME_BANK[1]);
|
||||
}
|
||||
@ -976,16 +1009,17 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
if (CacheGroup.cacheList.get(TYPE_NAME[2]) != null) {
|
||||
Log.e("olb", CacheGroup.cacheList.get(TYPE_NAME[2]));
|
||||
olb = gson.fromJson(CacheGroup.cacheList.get(TYPE_NAME[2]), OCRVehicleLicenseBean.class);
|
||||
if (2==index&&olb.getData().getVclN().contains("挂")){
|
||||
Toast.makeText(con,"该证件为挂车,请上传行驶证证件",Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (3==index&&!olb.getData().getVclN().contains("挂")){
|
||||
Toast.makeText(con,"未识别到挂车相关信息,请上传挂车行驶证证件",Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
ImageLoader.getInstance().loadImage(con, path, img1, typeImgOne[index]);
|
||||
if (olb.getCode() == 200 && olb.getData() != null) {
|
||||
if (2 == index && olb.getData().getVclN().contains("挂")) {
|
||||
Toast.makeText(con, "该证件为挂车,请上传行驶证证件", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (3 == index && !olb.getData().getVclN().contains("挂")) {
|
||||
Toast.makeText(con, "未识别到挂车相关信息,请上传挂车行驶证证件", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
carExistCarId = "";
|
||||
value1.setEnabled(true);
|
||||
value2.setEnabled(true);
|
||||
@ -1000,27 +1034,30 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
value4.setText(olb.getData().getVin());
|
||||
// fontId = olb.getData().getId();
|
||||
// Glide.with(con).load(url1).into(img1);
|
||||
Glide.with(con).load(path).into(img1);
|
||||
// Glide.with(con).load(path).into(img1);
|
||||
|
||||
oCrcarId = olb.getData().getCarId() + "";
|
||||
if (!TextUtils.isEmpty(olb.getData().getVclN())&&!olb.getData().getVclN().contains("挂"))
|
||||
if (!TextUtils.isEmpty(olb.getData().getVclN()) && !olb.getData().getVclN().contains("挂"))
|
||||
new AuthRequest().getCarInfo(con, hd, olb.getData().getVclN());
|
||||
Log.e("-cardId-", oCrcarId);
|
||||
} else {
|
||||
Toast.makeText(con, "识别失败", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(con, "识别失败请重新上传", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove(TYPE_NAME[2]);
|
||||
}
|
||||
if (CacheGroup.cacheList.get(TYPE_NAME_BANK[2]) != null) {
|
||||
oblb = gson.fromJson(CacheGroup.cacheList.get(TYPE_NAME_BANK[2]), OCRVehicleBackLicenseBean.class);
|
||||
ImageLoader.getInstance().loadImage(con, path, img2, typeImgTwo[index]);
|
||||
if (oblb.getCode() == 200 && oblb.getData() != null) {
|
||||
// url2 = oblb.getData().getUrl();
|
||||
// backId = oblb.getData().getId();
|
||||
// Glide.with(con).load(url2).into(img2);
|
||||
Glide.with(con).load(path).into(img2);
|
||||
|
||||
// Glide.with(con).load(path).into(img2);
|
||||
//自动调取提交功能,实现页面自动跳转实现页面自动跳转
|
||||
subimt();
|
||||
} else {
|
||||
Toast.makeText(con, "识别失败", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(con, "识别失败请重新上传", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove(TYPE_NAME_BANK[2]);
|
||||
}
|
||||
@ -1111,16 +1148,30 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
String str2 = value2.getText().toString().trim();
|
||||
String str3 = value3.getText().toString().trim();
|
||||
String str4 = value4.getText().toString().trim();
|
||||
if ("".equals(str1) || "".equals(str2) || "".equals(str3) || "".equals(str4) || "".equals(url1) || "".equals(url2)) {
|
||||
Toast.makeText(con, "请补充完整的信息", Toast.LENGTH_LONG).show();
|
||||
// Toast.makeText(con, "请补充完整的" + name[index], Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
// if ("".equals(str1) || "".equals(str2) || "".equals(str3) || "".equals(url1) || "".equals(url2)) {
|
||||
// Toast.makeText(con, "请补充完整的信息", Toast.LENGTH_LONG).show();
|
||||
//// Toast.makeText(con, "请补充完整的" + name[index], Toast.LENGTH_LONG).show();
|
||||
// return;
|
||||
// }
|
||||
switch (index) {
|
||||
case 0:
|
||||
if ("".equals(str1) || "".equals(str2) || "".equals(str3) || "".equals(str4) || "".equals(url1) || "".equals(url2)) {
|
||||
Toast.makeText(con, "请补充完整的信息", Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
if (ocb != null && ocbb != null) {
|
||||
if (ocb.getData() == null) {
|
||||
ToastUtils.showToast(con, "主页照片识别失败,请重新上传");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ocbb == null || ocbb.getData() == null) {
|
||||
ToastUtils.showToast(con, "副页照片识别失败,请重新上传");
|
||||
return;
|
||||
}
|
||||
customDialog = new CustomDialog(con, "网络请求中...");
|
||||
customDialog.show();
|
||||
|
||||
IDInputBean ib = new IDInputBean();
|
||||
ib.setIdcarName(str1);
|
||||
ib.setIdcard(str2);
|
||||
@ -1142,9 +1193,25 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
case 1:
|
||||
//olb
|
||||
//{"档案编号","初次领证日期","准驾车型","有效期限(止)"},
|
||||
if ("".equals(str1) || "".equals(str2) || "".equals(str3) || "".equals(str4) || "".equals(url1) || "".equals(url2)) {
|
||||
Toast.makeText(con, "请补充完整的信息", Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
if (odl != null && odlb != null) {
|
||||
|
||||
if (odl.getData() == null) {
|
||||
ToastUtils.showToast(con, "主页照片识别失败,请重新上传");
|
||||
return;
|
||||
}
|
||||
|
||||
if (odlb == null || odlb.getData() == null) {
|
||||
ToastUtils.showToast(con, "副页照片识别失败,请重新上传");
|
||||
return;
|
||||
}
|
||||
|
||||
customDialog = new CustomDialog(con, "网络请求中...");
|
||||
customDialog.show();
|
||||
|
||||
Log.e("ocr", new Gson().toJson(odl));
|
||||
LicenseInputBean iib = new LicenseInputBean();
|
||||
iib.setArchivesName(odlb.getData().getFileNumber());
|
||||
@ -1177,11 +1244,26 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
new AuthRequest().bindCar(con, hd, carExistCarId);
|
||||
return;
|
||||
}
|
||||
if ("".equals(str1) || "".equals(str2) || "".equals(str3) || "".equals(str4) || "".equals(url1) || "".equals(url2)) {
|
||||
Toast.makeText(con, "请补充完整的信息", Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
if ((olb != null && !olb.getData().isCarExist() && oblb != null) || (olb != null && olb.getData().isCarExist())) {
|
||||
// if (curColor == null || curEnergy == null) {
|
||||
// Toast.makeText(con, "请完善内容", Toast.LENGTH_SHORT).show();
|
||||
// return;
|
||||
// }
|
||||
if (olb.getData() == null) {
|
||||
ToastUtils.showToast(con, "主页照片识别失败,请重新上传");
|
||||
return;
|
||||
}
|
||||
|
||||
if (oblb == null || oblb.getData() == null) {
|
||||
ToastUtils.showToast(con, "副页照片识别失败,请重新上传");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
customDialog = new CustomDialog(con, "网络请求中...");
|
||||
customDialog.show();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
@ -1194,6 +1276,7 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
// map.put("ownerName", str3);
|
||||
// map.put("vin", str4);//车辆识别代号
|
||||
|
||||
|
||||
String carLong = "";
|
||||
String carWidth = "";
|
||||
String carHeight = "";
|
||||
@ -1287,11 +1370,20 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if ("".equals(str1) || "".equals(str2) || "".equals(str3) || "".equals(str4) || "".equals(url1) || "".equals(url2)) {
|
||||
Toast.makeText(con, "请补充完整的信息", Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
if (olb != null || (cdb != null && cdb.getRes() == 1)) {
|
||||
// if (curEnergy==null){
|
||||
// Toast.makeText(con,"请完善内容",Toast.LENGTH_SHORT).show();
|
||||
// return;
|
||||
// }
|
||||
if (olb.getData() == null) {
|
||||
ToastUtils.showToast(con, "主页照片识别失败,请重新上传");
|
||||
return;
|
||||
}
|
||||
|
||||
if (oblb == null || oblb.getData() == null) {
|
||||
ToastUtils.showToast(con, "副页照片识别失败,请重新上传");
|
||||
return;
|
||||
}
|
||||
customDialog = new CustomDialog(con, "网络请求中...");
|
||||
customDialog.show();
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
@ -1328,7 +1420,6 @@ public class CertificatesActivity extends BaseAppCompatActivity {
|
||||
// map.put("fileNumber", oblb.getData().getRecordId());//档案编号
|
||||
// map.put("towAuality", oblb.getData().getVclDrwTn());//准牵引总质量
|
||||
|
||||
|
||||
String carLong = "";
|
||||
String carWidth = "";
|
||||
String carHeight = "";
|
||||
|
@ -0,0 +1,62 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.ui.auth;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.event.PersonEvent;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.MainActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity;
|
||||
import com.dahe.mylibrary.utils.ActivityUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
* @ClassName FaceSuccActivity
|
||||
* @Author john
|
||||
* @Date 2024/12/2 10:27
|
||||
* @Description TODO
|
||||
*/
|
||||
public class FaceSuccActivity extends BaseAppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
StateStyleUtil.stateTextColor(this);
|
||||
setContentView(R.layout.activity_face_succ_result);
|
||||
con = this;
|
||||
initView(null);
|
||||
Button btnHome = findViewById(R.id.btnHome);
|
||||
Button btnAddCar = findViewById(R.id.btnAddCar);
|
||||
boolean isGoCar = getIntent().getBooleanExtra("isGoCar", false);
|
||||
if (isGoCar) {
|
||||
btnHome.setText("返回首页");
|
||||
btnAddCar.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
btnHome.setText("返回");
|
||||
btnAddCar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
btnHome.setOnClickListener(v -> {
|
||||
finish();
|
||||
});
|
||||
btnAddCar.setOnClickListener(v -> {
|
||||
Intent in = new Intent(con, CertificatesActivity.class);
|
||||
in.putExtra("index", 2);
|
||||
startActivity(in);
|
||||
finish();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
EventBus.getDefault().post(new PersonEvent("刷脸成功"));
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.ui.auth;
|
||||
|
||||
import static com.sdk.base.framework.utils.app.AppUtils.getPackageName;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@ -27,6 +29,7 @@ import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.PermissionUtils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.dahe.mylibrary.utils.ActivityUtils;
|
||||
import com.dahe.mylibrary.utils.ImageLoader;
|
||||
import com.esign.esignsdk.EsignSdk;
|
||||
import com.esign.esignsdk.data.AuthEvent;
|
||||
import com.google.gson.Gson;
|
||||
@ -74,15 +77,15 @@ public class PersonalAuthActivity extends BaseAppCompatActivity {
|
||||
super.msgMethod(m);
|
||||
switch (m.what) {
|
||||
case RequsetCodeConstants.SUCCESS:
|
||||
if (CacheGroup.cacheList.get("userdata") != null) {
|
||||
ub = gson.fromJson(CacheGroup.cacheList.get("userdata"), UserBean.class);
|
||||
if (CacheGroup.cacheList.get("userdata2") != null) {
|
||||
ub = gson.fromJson(CacheGroup.cacheList.get("userdata2"), UserBean.class);
|
||||
if (ub.getCode() == 200) {
|
||||
initView(ub);
|
||||
SPUtil.insSP(con, "data", "userdata", CacheGroup.cacheList.get("userdata"));
|
||||
SPUtil.insSP(con, "data", "userdata", CacheGroup.cacheList.get("userdata2"));
|
||||
} else {
|
||||
Toast.makeText(con, ub.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove("userdata");
|
||||
CacheGroup.cacheList.remove("userdata2");
|
||||
}
|
||||
if (CacheGroup.cacheList.get("upload") != null) {
|
||||
upb = gson.fromJson(CacheGroup.cacheList.get("upload"), UploadBean.class);
|
||||
@ -207,7 +210,22 @@ public class PersonalAuthActivity extends BaseAppCompatActivity {
|
||||
});
|
||||
//头像
|
||||
up_img.setOnClickListener(v -> {
|
||||
gia.showPopueWindow(this);
|
||||
PermissionUtils.Companion.getInstance().showPermissionMessage(this, "拍摄,媒体查询权限使用说明", "用于拍照或者选择图片用于上传头像功能",
|
||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.CAMERA},
|
||||
(allGranted, grantedList, deniedList) -> {
|
||||
if (allGranted) {
|
||||
gia.showPopueWindow(this);
|
||||
} else {
|
||||
new MessageUtils().showSimCenPop(con, "缺少拍摄,媒体查询权限,将无法为您提供服务,去开启!", "取消", "确认", () -> {
|
||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
Uri uri = Uri.fromParts("package", getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
startActivity(intent);
|
||||
});
|
||||
// Toast.makeText(act.getBaseContext(), "请先开启定位权限", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
up_head.setOnClickListener(v -> {
|
||||
if (ub.getData().getHeadportraitUrl() != null && !ub.getData().getHeadportraitUrl().equals("")) {
|
||||
@ -221,10 +239,15 @@ public class PersonalAuthActivity extends BaseAppCompatActivity {
|
||||
});
|
||||
hyr = new HuoYuanRequset(con, hd);
|
||||
ur = new UserRequset(con, hd);
|
||||
ur.User();
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
ur.User2();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
@ -240,7 +263,7 @@ public class PersonalAuthActivity extends BaseAppCompatActivity {
|
||||
TextView name = findViewById(R.id.rname);
|
||||
name.setText(StringUtil.isNull(ub.getData().getRname(), "未实名"));
|
||||
if (ub.getData().getHeadportraitUrl() != null && !ub.getData().getHeadportraitUrl().equals("")) {
|
||||
Glide.with(con).load(ub.getData().getHeadportraitUrl()).into(up_head);
|
||||
ImageLoader.getInstance().loadImage(con,ub.getData().getHeadportraitUrl(),up_head);
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,7 +271,7 @@ public class PersonalAuthActivity extends BaseAppCompatActivity {
|
||||
public void personResult(PersonEvent home) {
|
||||
Log.e("-res-", home.getMessage());
|
||||
if (ur != null) {
|
||||
ur.User();
|
||||
ur.User2();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.arpa.hndahesudintocctmsdriver.ui.auth;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.text.InputType;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@ -35,7 +36,7 @@ import com.arpa.hndahesudintocctmsdriver.util.img.GetImageAlert;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseRecyclerView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.dahe.mylibrary.utils.ImageLoader;
|
||||
import com.dahe.mylibrary.utils.PatternUtils;
|
||||
import com.github.gzuliyujiang.wheelpicker.DatePicker;
|
||||
import com.github.gzuliyujiang.wheelpicker.annotation.DateMode;
|
||||
@ -110,9 +111,10 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
}
|
||||
|
||||
if (CacheGroup.cacheList.get("ORCRoadLicZj") != null) {
|
||||
if (customDialog != null && customDialog.isShowing())
|
||||
customDialog.dismiss();
|
||||
OCRRoadBean ib = new Gson().fromJson(CacheGroup.cacheList.get("ORCRoadLicZj"), OCRRoadBean.class);
|
||||
customDialog.dismiss();
|
||||
if (ib.getCode() == 200 && ib.getData() != null) {
|
||||
if (ib.getCode() == 200 && ib.getData() != null&&!TextUtils.isEmpty(ib.getData().getLicenseNumber())) {
|
||||
value1.setText(PatternUtils.getNumByStr(ib.getData().getLicenseNumber()));
|
||||
} else {
|
||||
Toast.makeText(con, "识别失败", Toast.LENGTH_SHORT).show();
|
||||
@ -148,15 +150,17 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
}
|
||||
url = ub.getData().getUrl();
|
||||
// Glide.with(con).load(url).into(img);
|
||||
Glide.with(con).load(path).into(img);
|
||||
ImageLoader.getInstance().loadImage(con,path,img);
|
||||
|
||||
|
||||
CacheGroup.cacheList.remove("upload");
|
||||
}
|
||||
|
||||
if (CacheGroup.cacheList.get("saveCarImg") != null) {
|
||||
if (customDialog != null && customDialog.isShowing())
|
||||
customDialog.dismiss();
|
||||
if (type!=3){
|
||||
if (customDialog != null && customDialog.isShowing())
|
||||
customDialog.dismiss();
|
||||
}
|
||||
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get("saveCarImg"), BaseBean.class);
|
||||
if (bb.getCode() == 200) {
|
||||
switch (type) {
|
||||
@ -171,7 +175,7 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
break;
|
||||
case 3:
|
||||
ur.vehicleDelTwo(carId);
|
||||
Toast.makeText(con, "上传道路运输证成功", Toast.LENGTH_SHORT).show();
|
||||
// Toast.makeText(con, "上传道路运输证成功", Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case 4:
|
||||
Toast.makeText(con, "交强险证件上传成功", Toast.LENGTH_SHORT).show();
|
||||
@ -186,11 +190,11 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
Log.e("is", CacheGroup.cacheList.get("saveCarRegisterNo"));
|
||||
IsAuthDriverAuthQualificationBean ib = gson.fromJson(CacheGroup.cacheList.get("saveCarRegisterNo"), IsAuthDriverAuthQualificationBean.class);
|
||||
if (ib.getCode() == 200) {
|
||||
finish();
|
||||
Intent in = new Intent(con, PhotoCarActivity.class);
|
||||
in.putExtra("type", 3);
|
||||
in.putExtra("carId", carId);
|
||||
con.startActivity(in);
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(con, ib.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -204,12 +208,11 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
//判断是否需要跳转挂车行驶证页面
|
||||
if (!"".equals(carId) && cdb.getData() != null) {
|
||||
if (cdb.getData().getIsTrailer() == 1 && cdb.getData().getTrailerResVo() != null && !TextUtils.isEmpty(cdb.getData().getTrailerResVo().getCarNumber())) {//需要挂车,并且传过挂车直接结束
|
||||
finish();
|
||||
Intent in = new Intent(con, AddCarSuccActivity.class);
|
||||
in.putExtra("type", 3);
|
||||
con.startActivity(in);
|
||||
} else if (cdb.getData().getIsTrailer() == 1 && cdb.getData().getTrailerResVo() != null && TextUtils.isEmpty(cdb.getData().getTrailerResVo().getCarNumber())) {//需要挂车,没传过挂车,到挂车页面
|
||||
finish();
|
||||
} else if (cdb.getData().getIsTrailer() == 1 && cdb.getData().getTrailerResVo() != null && TextUtils.isEmpty(cdb.getData().getTrailerResVo().getCarNumber())) {//需要挂车,没传过挂车,到挂车页面
|
||||
Intent in = new Intent(con, CertificatesActivity.class);
|
||||
in.putExtra("index", 3);
|
||||
in.putExtra("carId", carId);
|
||||
@ -217,6 +220,7 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
in.putExtra("cheData", new Gson().toJson(cdb));
|
||||
}
|
||||
startActivity(in);
|
||||
finish();
|
||||
} else if (cdb.getData().getIsTrailer() == 0) {//不需要挂车
|
||||
if ("1".equals(cdb.getData().getNeedUpQCPhoto())) {//需要从业资格证
|
||||
Intent in = new Intent(con, AuthQualificationActivity.class);
|
||||
@ -225,10 +229,10 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
in.putExtra("isOverCar", false);
|
||||
startActivity(in);
|
||||
} else {
|
||||
finish();
|
||||
Intent in = new Intent(con, AddCarSuccActivity.class);
|
||||
in.putExtra("type", 3);
|
||||
con.startActivity(in);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -517,26 +521,26 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
if (null != cdb) {
|
||||
if (0 == type) {
|
||||
if (!TextUtils.isEmpty(cdb.getData().getCarImage())) {
|
||||
Glide.with(con).load(cdb.getData().getCarImage()).into(img);
|
||||
ImageLoader.getInstance().loadImage(con,cdb.getData().getCarImage(),img);
|
||||
submit.setBackgroundResource(R.drawable.bg_btn_grey);
|
||||
upload_img.setText("已上传");
|
||||
}
|
||||
} else if (1 == type) {
|
||||
if (!TextUtils.isEmpty(cdb.getData().getNfcImage())) {
|
||||
Glide.with(con).load(cdb.getData().getNfcImage()).into(img);
|
||||
ImageLoader.getInstance().loadImage(con,cdb.getData().getNfcImage(),img);
|
||||
submit.setBackgroundResource(R.drawable.bg_btn_grey);
|
||||
upload_img.setText("已上传");
|
||||
}
|
||||
} else if (2 == type) {
|
||||
if (!TextUtils.isEmpty(cdb.getData().getRegisterImage())) {
|
||||
Glide.with(con).load(cdb.getData().getRegisterImage()).into(img);
|
||||
ImageLoader.getInstance().loadImage(con,cdb.getData().getRegisterImage(),img);
|
||||
value1.setText(cdb.getData().getRegisterNo());
|
||||
submit.setBackgroundResource(R.drawable.bg_btn_grey);
|
||||
upload_img.setText("已上传");
|
||||
}
|
||||
} else if (3 == type) {
|
||||
if (!TextUtils.isEmpty(cdb.getData().getRoadLicensePhoto())) {
|
||||
Glide.with(con).load(cdb.getData().getRoadLicensePhoto()).into(img);
|
||||
ImageLoader.getInstance().loadImage(con,cdb.getData().getRoadLicensePhoto(),img);
|
||||
value1.setText(cdb.getData().getRoadLicense());
|
||||
if (!carExist) {
|
||||
submit.setBackgroundResource(R.drawable.bg_btn_grey);
|
||||
@ -546,7 +550,7 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
}
|
||||
} else if (4 == type) {
|
||||
if (!TextUtils.isEmpty(cdb.getData().getPolicyPhotoUrl())) {
|
||||
Glide.with(con).load(cdb.getData().getPolicyPhotoUrl()).into(img);
|
||||
ImageLoader.getInstance().loadImage(con,cdb.getData().getPolicyPhotoUrl(),img);
|
||||
value1.setText(cdb.getData().getInsuranceCompany());
|
||||
value2.setText(cdb.getData().getInsuranceEndDay());
|
||||
submit.setBackgroundResource(R.drawable.bg_btn_grey);
|
||||
@ -635,8 +639,11 @@ public class PhotoCarActivity extends BaseAppCompatActivity implements View.OnCl
|
||||
tvSkip.setVisibility(isShowSkip[type] ? View.GONE : View.VISIBLE);
|
||||
llInfo.setVisibility(isShowEdit[type] ? View.VISIBLE : View.GONE);
|
||||
if (type == 4) {
|
||||
value1.setInputType(InputType.TYPE_CLASS_TEXT);
|
||||
llDate.setVisibility(View.VISIBLE);
|
||||
title3.setText("保险公司");
|
||||
}else {
|
||||
value1.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@ import com.arpa.hndahesudintocctmsdriver.ui.auth.CertificatesActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.news.NewActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.wallet.UpBankActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.web.WebOnlyOneActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.OneDayShowUtils;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.PermissionUtils;
|
||||
@ -68,6 +69,7 @@ import com.google.gson.Gson;
|
||||
import com.gyf.cactus.Cactus;
|
||||
import com.hjq.xtoast.XToast;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BasePopupView;
|
||||
import com.lxj.xpopup.interfaces.OnConfirmListener;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.report.ALProcess;
|
||||
@ -101,6 +103,7 @@ import com.arpa.hndahesudintocctmsdriver.util.http.RequsetCodeConstants;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.time.Timer;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseFragment;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseRecyclerView;
|
||||
import com.lxj.xpopup.interfaces.SimpleCallback;
|
||||
import com.permissionx.guolindev.PermissionX;
|
||||
import com.youth.banner.Banner;
|
||||
import com.youth.banner.BannerConfig;
|
||||
@ -151,6 +154,8 @@ public class HomeFragment extends BaseFragment {
|
||||
|
||||
private XToast xToast;
|
||||
|
||||
private boolean isUpAppShow = false;
|
||||
|
||||
|
||||
@Override
|
||||
public void msgMethod(Message m) {
|
||||
@ -239,6 +244,19 @@ public class HomeFragment extends BaseFragment {
|
||||
new XPopup.Builder(con)
|
||||
.dismissOnBackPressed(false)
|
||||
.dismissOnTouchOutside(false)
|
||||
.setPopupCallback(new SimpleCallback() {
|
||||
@Override
|
||||
public void onShow(BasePopupView popupView) {
|
||||
super.onShow(popupView);
|
||||
isUpAppShow = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(BasePopupView popupView) {
|
||||
super.onDismiss(popupView);
|
||||
isUpAppShow = false;
|
||||
}
|
||||
})
|
||||
.asCustom(new UpAppAlert(con, uab.getData().getDownloadUrl(), uab.getData().getContent(), uab.getData().getVersion(), uab.getData().getForce()))
|
||||
.show();
|
||||
}
|
||||
@ -258,8 +276,13 @@ public class HomeFragment extends BaseFragment {
|
||||
if (CacheGroup.cacheList.get(WoDeFragment.AUTH_DATA) != null) {
|
||||
DriverAuthDataBean dad = gson.fromJson(CacheGroup.cacheList.get(WoDeFragment.AUTH_DATA), DriverAuthDataBean.class);
|
||||
if (dad.getCode() == 200) {
|
||||
if (isUpAppShow) {
|
||||
CacheGroup.cacheList.remove(WoDeFragment.AUTH_DATA);
|
||||
return;
|
||||
}
|
||||
|
||||
if (dad.getData() == null) {
|
||||
new MessageUtils().showSimCenPop(con, "该司机缺少身份证,未认证无法接单。是否去添加!","去添加", () -> {
|
||||
new MessageUtils().showSimCenPop(con, "该司机缺少身份证,未认证无法接单。是否去添加!", "去添加", () -> {
|
||||
Intent in = new Intent(con, CertificatesActivity.class);
|
||||
in.putExtra("index", 0);
|
||||
startActivity(in);
|
||||
@ -268,19 +291,19 @@ public class HomeFragment extends BaseFragment {
|
||||
return;
|
||||
}
|
||||
if (dad.getData() != null && TextUtils.isEmpty(dad.getData().getIdcard())) {
|
||||
new MessageUtils().showSimCenPop(con, "该司机缺少身份证,未认证无法接单。是否去添加!", "去添加",() -> {
|
||||
new MessageUtils().showSimCenPop(con, "该司机缺少身份证,未认证无法接单。是否去添加!", "去添加", () -> {
|
||||
Intent in = new Intent(con, CertificatesActivity.class);
|
||||
in.putExtra("index", 0);
|
||||
startActivity(in);
|
||||
});
|
||||
} else if (dad.getData() != null && TextUtils.isEmpty(dad.getData().getCardNo())) {
|
||||
new MessageUtils().showSimCenPop(con, "该司机缺少银行卡,未认证无法接单。是否去添加!", "去添加",() -> {
|
||||
new MessageUtils().showSimCenPop(con, "该司机缺少银行卡,未认证无法接单。是否去添加!", "去添加", () -> {
|
||||
Intent in333 = new Intent(con, UpBankActivity.class);
|
||||
in333.putExtra("type", 1);
|
||||
startActivity(in333);
|
||||
});
|
||||
} else if (dad.getData() != null && TextUtils.isEmpty(dad.getData().getDriverLicense())) {
|
||||
new MessageUtils().showSimCenPop(con, "该司机缺少驾驶证,未认证无法接单。是否去添加!", "去添加",() -> {
|
||||
new MessageUtils().showSimCenPop(con, "该司机缺少驾驶证,未认证无法接单。是否去添加!", "去添加", () -> {
|
||||
Intent in = new Intent(con, CertificatesActivity.class);
|
||||
in.putExtra("index", 0);
|
||||
startActivity(in);
|
||||
@ -1022,7 +1045,7 @@ public class HomeFragment extends BaseFragment {
|
||||
banner.isAutoPlay(true);
|
||||
banner.setIndicatorGravity(BannerConfig.CENTER);
|
||||
banner.setOnBannerListener(position -> {//System.out.println("跳转");
|
||||
Intent in = new Intent(con, WebActivity.class);
|
||||
Intent in = new Intent(con, WebOnlyOneActivity.class);
|
||||
Intent inL = new Intent(con, LoginActivity.class);
|
||||
in.putExtra("url", ic.getData().get(position).getJumpUrl());
|
||||
in.putExtra("title", ic.getData().get(position).getTitle());
|
||||
@ -1043,7 +1066,7 @@ public class HomeFragment extends BaseFragment {
|
||||
@Override
|
||||
public void displayImage(Context context, Object path, ImageView imageView) {
|
||||
if (HomeFragment.this != null && getActivity() != null && !getActivity().isDestroyed()) {
|
||||
Glide.with(con).load(path).into(imageView);
|
||||
com.dahe.mylibrary.utils.ImageLoader.getInstance().loadImage(con,path,imageView);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1274,9 +1297,24 @@ public class HomeFragment extends BaseFragment {
|
||||
initView(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
refreshWaybills();
|
||||
}
|
||||
|
||||
private void refreshWaybills() {
|
||||
// if (UiAuxiliary.isLogin(con)) {
|
||||
// int curWaybillId = (int) SPUtils.get(con, "curWaybillId", -1);
|
||||
// hyr.startOrder(curWaybillId == -1 ? 0 : curWaybillId);
|
||||
// }
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void processResult(HomeWaybillEvent home) {
|
||||
if (home.getMessage() == 1) {
|
||||
int curWaybillId = (int) SPUtils.get(con, "curWaybillId", -1);
|
||||
hyr.startOrder(curWaybillId == -1 ? 0 : curWaybillId);
|
||||
hyr.getHuoYuan(1, 100);
|
||||
} else {
|
||||
int curWaybillId = (int) SPUtils.get(con, "curWaybillId", -1);
|
||||
|
@ -133,6 +133,8 @@ public class HuoYunDelActivity extends BaseAppCompatActivity {
|
||||
}
|
||||
//finish();
|
||||
} else {
|
||||
EventBus.getDefault().post(new HomeWaybillEvent(1));
|
||||
finish();
|
||||
Toast.makeText(con, bb.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
customDialog.dismiss();
|
||||
}
|
||||
@ -313,7 +315,11 @@ public class HuoYunDelActivity extends BaseAppCompatActivity {
|
||||
});
|
||||
//
|
||||
ImageButton xuanze = v.findViewById(R.id.xuanze);
|
||||
if (clb != null && clb.getData().size() == 1) {
|
||||
|
||||
if (hyd!=null&&hyd.getData()!=null&& !TextUtils.isEmpty(hyd.getData().getCarNumber())){
|
||||
cid = hyd.getData().getCarId();
|
||||
car.setText("选择车辆:" + hyd.getData().getCarNumber());
|
||||
}else if (clb != null && clb.getData().size() == 1) {
|
||||
cid = clb.getData().get(0).getCarId();
|
||||
car.setText("选择车辆:" + clb.getData().get(0).getCarNumber());
|
||||
}
|
||||
@ -406,6 +412,7 @@ public class HuoYunDelActivity extends BaseAppCompatActivity {
|
||||
|
||||
UiAuxiliary.homeRequest("接单");
|
||||
Intent in = new Intent(con, StartYunDanActivity.class);
|
||||
in.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
in.putExtra("id", "0");
|
||||
startActivity(in);
|
||||
finish();
|
||||
@ -532,4 +539,9 @@ public class HuoYunDelActivity extends BaseAppCompatActivity {
|
||||
// ALProcess.verification(con, hd);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ import com.amap.api.services.route.WalkRouteResult;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.alert.CustomDialog;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.dahe.mylibrary.utils.ImageLoader;
|
||||
import com.dahe.mylibrary.utils.TimeUtil;
|
||||
import com.dahe.mylibrary.utils.ToastUtils;
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
@ -234,7 +235,7 @@ public class StartYunDanActivity extends BaseActivity {
|
||||
}
|
||||
ImageView head_img = v.findViewById(R.id.head_img);
|
||||
if (ub != null && ub.getData() != null && !ub.getData().getHeadportraitUrl().equals("")) {
|
||||
Glide.with(con).load(ub.getData().getHeadportraitUrl()).into(head_img);
|
||||
ImageLoader.getInstance().loadImage(con,ub.getData().getHeadportraitUrl(),head_img);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -21,6 +21,7 @@ import com.bumptech.glide.Glide;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseActivity;
|
||||
import com.dahe.mylibrary.utils.ImageLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@ -58,7 +59,7 @@ public class VideoReleaseActivity extends BaseActivity {
|
||||
public void initView(Object obj) {
|
||||
super.initView(obj);
|
||||
getFirstframe(videoPath);
|
||||
Glide.with(con).load(new File(coverPath)).into(video_cover);
|
||||
ImageLoader.getInstance().loadImage(con,new File(coverPath),video_cover);
|
||||
}
|
||||
|
||||
public void submit(View v){
|
||||
|
@ -8,6 +8,7 @@ import android.widget.TextView;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.dahe.mylibrary.utils.ImageLoader;
|
||||
import com.google.gson.Gson;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
@ -72,7 +73,7 @@ public class GetShangChuanActivity extends BaseActivity {
|
||||
//coordinate.setText(StringUtil.isNull(sdw.getLongitude(),"")+","+StringUtil.isNull(sdw.getLatitude(),""));
|
||||
//coordinate2.setText(StringUtil.isNull(sdw.getReceiptLongitude(),"")+","+StringUtil.isNull(sdw.getReceiptLatitude(),""));
|
||||
if(sdw.getSendPutImagesUrl()!=null && sdw.getSendPutImagesUrl().size()>=1){
|
||||
Glide.with(con).load(sdw.getSendPutImagesUrl().get(0)).into(img1);
|
||||
ImageLoader.getInstance().loadImage(con,sdw.getSendPutImagesUrl().get(0),img1);
|
||||
img1.setOnClickListener(v -> {
|
||||
new XPopup.Builder(con)
|
||||
.asImageViewer(img1,sdw.getSendPutImagesUrl().get(0), new SmartGlideImageLoader(R.mipmap.ic_launcher))
|
||||
@ -83,7 +84,7 @@ public class GetShangChuanActivity extends BaseActivity {
|
||||
});
|
||||
}
|
||||
if(sdw.getReceiptUrl()!=null && sdw.getReceiptUrl().size()>=1){
|
||||
Glide.with(con).load(sdw.getReceiptUrl().get(0)).into(img2);
|
||||
ImageLoader.getInstance().loadImage(con,sdw.getReceiptUrl().get(0),img2);
|
||||
img2.setOnClickListener(v -> {
|
||||
new XPopup.Builder(con)
|
||||
.asImageViewer(img2,sdw.getReceiptUrl().get(0), new SmartGlideImageLoader(R.mipmap.ic_launcher))
|
||||
|
@ -31,6 +31,7 @@ import com.arpa.hndahesudintocctmsdriver.bean.WaybillStatusBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.event.HomeWaybillEvent;
|
||||
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.OCRRequest;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.bean.TrackInputBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.MainActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.BitmapUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
|
||||
@ -43,6 +44,7 @@ import com.baidu.mapapi.model.LatLng;
|
||||
import com.baidu.mapapi.utils.CoordinateConverter;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.dahe.mylibrary.utils.ActivityUtils;
|
||||
import com.dahe.mylibrary.utils.ImageLoader;
|
||||
import com.dahe.mylibrary.utils.ToastUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.luck.picture.lib.PictureSelector;
|
||||
@ -107,6 +109,11 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
public void msgMethod(Message m) {
|
||||
super.msgMethod(m);
|
||||
switch (m.what) {
|
||||
case RequsetCodeConstants.ERROR:
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
customDialog.dismiss();
|
||||
}
|
||||
break;
|
||||
case RequsetCodeConstants.SUCCESS:
|
||||
if (CacheGroup.cacheList.get("upload") != null) {
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
@ -117,7 +124,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
if (ub.getCode() == 200) {
|
||||
imgIds.add(ub.getData().getId());
|
||||
// Glide.with(con).load(ub.getData().getUrl()).into(res_img);
|
||||
Glide.with(con).load(path).into(res_img);
|
||||
ImageLoader.getInstance().loadImage(con,path,res_img);
|
||||
res_img.setVisibility(View.VISIBLE);
|
||||
img_delete.setVisibility(View.VISIBLE);
|
||||
img_icon.setVisibility(View.GONE);
|
||||
@ -127,6 +134,15 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
}
|
||||
CacheGroup.cacheList.remove("upload");
|
||||
}
|
||||
if (CacheGroup.cacheList.get("genzong") != null) {
|
||||
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get("genzong"), BaseBean.class);
|
||||
if (bb.getCode() == 200) {
|
||||
Log.e("--轨迹上传--", "成功");
|
||||
} else {
|
||||
Log.e("--轨迹上传失败:--", bb.getMsg());
|
||||
}
|
||||
CacheGroup.cacheList.remove("genzong");
|
||||
}
|
||||
if (CacheGroup.cacheList.get("waybillStatus") != null) {
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
customDialog.dismiss();
|
||||
@ -174,6 +190,8 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
|
||||
customDialog.dismiss();
|
||||
}
|
||||
EventBus.getDefault().post(new HomeWaybillEvent());
|
||||
finish();
|
||||
Toast.makeText(con, bb.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove(TYPE_NAME[i]);
|
||||
@ -469,6 +487,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
nfc();
|
||||
loadInfo();
|
||||
}
|
||||
upLocation(lgdu.getLatitude()+"",lgdu.getLongitude()+"",sob.getData().getShippingNoteNumber());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -522,6 +541,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
nfc();
|
||||
uploadInfo();
|
||||
}
|
||||
upLocation(lgdu.getLatitude()+"",lgdu.getLongitude()+"",sob.getData().getShippingNoteNumber());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -900,4 +920,12 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
|
||||
}
|
||||
|
||||
private void upLocation(String lat,String lon,String shippingNoteNumber){
|
||||
TrackInputBean tib = new TrackInputBean();
|
||||
tib.setLatitude(lat);
|
||||
tib.setLongitude(lon);
|
||||
tib.setShippingNoteNumber(shippingNoteNumber);
|
||||
hyr.trackTracking(tib);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class WebPDFActivity extends BaseActivity {
|
||||
protected void onPostExecute(Void aVoid) {
|
||||
super.onPostExecute(aVoid);
|
||||
pdf_view.fromStream(input[0])
|
||||
.pages(0,1) // all pages are displayed by default
|
||||
// .pages(0,1,2,3,4,5,6,7) // all pages are displayed by default
|
||||
.enableAnnotationRendering(true)
|
||||
.load();
|
||||
}
|
||||
|
@ -31,6 +31,9 @@ import com.arpa.hndahesudintocctmsdriver.parts.ConfigParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.net.BaseObserver;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.net.DataManager;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.net.RxHttpCallBack;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.web.WebOnlyOneActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.alert.CustomDialog;
|
||||
import com.arpa.hndahesudintocctmsdriver.weight.OnLimitClickHelper;
|
||||
import com.dahe.mylibrary.net.CommonResponseBean;
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
@ -76,6 +79,7 @@ public class LoginActivity extends BaseActivity {
|
||||
private int timer_sum = 60;
|
||||
private CheckBox cb;
|
||||
private UserRequset ur;
|
||||
private CustomDialog customDialog;
|
||||
|
||||
@Override
|
||||
public void msgMethod(Message m) {
|
||||
@ -94,6 +98,11 @@ public class LoginActivity extends BaseActivity {
|
||||
Log.e("--短信发送res--", "短信发送成功");
|
||||
}
|
||||
if (CacheGroup.cacheList.get(LOGIN_RESULT) != null) {
|
||||
if (customDialog != null && customDialog.isShowing())
|
||||
customDialog.dismiss();
|
||||
|
||||
btn_login.setEnabled(true);
|
||||
btn_login.setBackgroundResource(R.drawable.bg_btn);
|
||||
//存储登录记录
|
||||
loginBean = new Gson().fromJson(CacheGroup.cacheList.get(LOGIN_RESULT), LoginBean.class);
|
||||
Log.e("--登录信息--", new Gson().toJson(loginBean));
|
||||
@ -106,18 +115,25 @@ public class LoginActivity extends BaseActivity {
|
||||
// JPushInterface.setAlias(con, 0, loginBean.getData().getUname());
|
||||
appInfoBean.setStatus("0");
|
||||
appInfoBean.setUserPhone(String.valueOf(input_phone.getText()));
|
||||
ur.postAppInfo(appInfoBean,"post");
|
||||
ur.postAppInfo(appInfoBean, "post");
|
||||
UiAuxiliary.homeRequest("登录成功");
|
||||
finish();
|
||||
} else {
|
||||
appInfoBean.setStatus("1");
|
||||
appInfoBean.setUserPhone(String.valueOf(input_phone.getText()));
|
||||
ur.postAppInfo(appInfoBean,"post");
|
||||
ur.postAppInfo(appInfoBean, "post");
|
||||
Toast.makeText(con, loginBean.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove(LOGIN_RESULT);
|
||||
}
|
||||
break;
|
||||
|
||||
case RequsetCodeConstants.ERROR:
|
||||
if (customDialog != null && customDialog.isShowing())
|
||||
customDialog.dismiss();
|
||||
btn_login.setEnabled(true);
|
||||
btn_login.setBackgroundResource(R.drawable.bg_btn);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -157,7 +173,7 @@ public class LoginActivity extends BaseActivity {
|
||||
|
||||
ConfigBean cb = ConfigParts.getConfigParts(con);
|
||||
if (cb != null) {
|
||||
url1 = cb.getData().getUserUrl();
|
||||
url1 = "https://agreement.dahehuoyun.com/#/user";
|
||||
url2 = "https://agreement.dahehuoyun.com/currency/#/";
|
||||
}
|
||||
TextView tv_content = findViewById(R.id.tv_content);
|
||||
@ -171,7 +187,7 @@ public class LoginActivity extends BaseActivity {
|
||||
public void onClick(View widget) {
|
||||
Log.e("-用户服务协议-", url1);
|
||||
//用户服务协议点击事件
|
||||
Intent in = new Intent(con, WebActivity.class);
|
||||
Intent in = new Intent(con, WebOnlyOneActivity.class);
|
||||
in.putExtra("title", "用户服务协议");
|
||||
in.putExtra("url", url1);
|
||||
startActivity(in);
|
||||
@ -191,7 +207,7 @@ public class LoginActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onClick(View widget) {
|
||||
//隐私协议点击事件
|
||||
Intent in = new Intent(con, WebActivity.class);
|
||||
Intent in = new Intent(con, WebOnlyOneActivity.class);
|
||||
in.putExtra("title", "隐私政策");
|
||||
in.putExtra("url", url2);
|
||||
startActivity(in);
|
||||
@ -226,12 +242,16 @@ public class LoginActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
});
|
||||
btn_login.setOnClickListener(v -> {
|
||||
btn_login.setOnClickListener(new OnLimitClickHelper(v -> {
|
||||
String phone = String.valueOf(input_phone.getText());
|
||||
String code = String.valueOf(input_code.getText());
|
||||
Log.e("--code--", code);
|
||||
if (judgeFormat(phone, code)) {
|
||||
if (key) {
|
||||
btn_login.setEnabled(false);
|
||||
btn_login.setBackgroundResource(R.drawable.bg_btn_gray);
|
||||
customDialog = new CustomDialog(con, "登陆中...");
|
||||
customDialog.show();
|
||||
LoginRegInputBean lb = new LoginRegInputBean();
|
||||
lb.setRoleId(4);
|
||||
lb.setUname(phone);
|
||||
@ -243,7 +263,7 @@ public class LoginActivity extends BaseActivity {
|
||||
Toast.makeText(con, "请先同意用户协议和隐私政策", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
auto_login.setOnClickListener(v -> {
|
||||
JVerificationInterface.getToken(con, 20000, (i, s, s1) -> {
|
||||
JVerifyUIConfig uiConfig = new JVerifyUIConfig.Builder()
|
||||
|
@ -140,16 +140,17 @@ public class WelcomeActivity extends BaseAppCompatActivity {
|
||||
new XPopup.Builder(con)
|
||||
.dismissOnBackPressed(false)
|
||||
.dismissOnTouchOutside(false)
|
||||
.asCustom(new AgreementAlert(con, "http://agreement.dahehuoyun.com/currency/#/",
|
||||
"http://agreement.dahehuoyun.com/rule/serviceAgreement/dist/index.html#/", hd))
|
||||
.asCustom(new AgreementAlert(con, "https://agreement.dahehuoyun.com/currency/#/",
|
||||
"https://agreement.dahehuoyun.com/#/user", hd))
|
||||
.show();
|
||||
}
|
||||
Glide.with(con)
|
||||
.load(SPUtils.getPreWelPic(this))
|
||||
.placeholder(startImageUrl.getDrawable())
|
||||
.error(R.drawable.welcome_bg_default)
|
||||
.into(startImageUrl);
|
||||
|
||||
if (WelcomeActivity.this!=null&&!WelcomeActivity.this.isFinishing()){
|
||||
Glide.with(con)
|
||||
.load(SPUtils.getPreWelPic(this))
|
||||
.placeholder(startImageUrl.getDrawable())
|
||||
.error(R.drawable.welcome_bg_default)
|
||||
.into(startImageUrl);
|
||||
}
|
||||
//SystemUtil.get
|
||||
}
|
||||
|
||||
@ -292,10 +293,12 @@ public class WelcomeActivity extends BaseAppCompatActivity {
|
||||
|
||||
public void cdWelcome(String url) {
|
||||
if (!"".equals(url)) {
|
||||
Glide.with(con).load(url)
|
||||
.placeholder(startImageUrl.getDrawable())
|
||||
.error(R.drawable.welcome_bg_default)
|
||||
.into(startImageUrl);
|
||||
if (WelcomeActivity.this!=null&&!WelcomeActivity.this.isFinishing()){
|
||||
Glide.with(con).load(url)
|
||||
.placeholder(startImageUrl.getDrawable())
|
||||
.error(R.drawable.welcome_bg_default)
|
||||
.into(startImageUrl);
|
||||
}
|
||||
}
|
||||
SPUtils.setPreWelPic(this, url);
|
||||
cd_view.setVisibility(View.VISIBLE);
|
||||
|
@ -17,15 +17,19 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.UpAppBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.event.PersonEvent;
|
||||
import com.arpa.hndahesudintocctmsdriver.event.RefreshCarListEvent;
|
||||
import com.arpa.hndahesudintocctmsdriver.event.VehicleEvent;
|
||||
import com.arpa.hndahesudintocctmsdriver.parts.ConfigParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.parts.StartOrderParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.parts.UserParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.alert.UpAppAlert;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.business.BusinessActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.PicturlUtil;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.dahe.mylibrary.utils.ImageLoader;
|
||||
import com.dahe.mylibrary.utils.ToastUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
|
||||
@ -48,6 +52,7 @@ import com.permissionx.guolindev.PermissionX;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -93,6 +98,25 @@ public class MyFragment extends BaseFragment {
|
||||
}
|
||||
CacheGroup.cacheList.remove("userdata");
|
||||
}
|
||||
|
||||
if (CacheGroup.cacheList.get("up_app") != null) {
|
||||
Log.e("up_app", CacheGroup.cacheList.get("up_app"));
|
||||
UpAppBean uab = new Gson().fromJson(CacheGroup.cacheList.get("up_app"), UpAppBean.class);
|
||||
if (uab.getCode() == 200) {
|
||||
if (uab.getData() != null) {
|
||||
new XPopup.Builder(con)
|
||||
.dismissOnBackPressed(false)
|
||||
.dismissOnTouchOutside(false)
|
||||
.asCustom(new UpAppAlert(con, uab.getData().getDownloadUrl(), uab.getData().getContent(), uab.getData().getVersion(), uab.getData().getForce()))
|
||||
.show();
|
||||
}else{
|
||||
Toast.makeText(con, "当前已经是最新版本", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}else{
|
||||
Toast.makeText(con, uab.getMsg(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove("up_app");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -262,7 +286,10 @@ public class MyFragment extends BaseFragment {
|
||||
startActivity(in);
|
||||
});
|
||||
//检查更新
|
||||
onUpdate.setOnClickListener(v -> Toast.makeText(con, "当前已经是最新版本", Toast.LENGTH_LONG).show());
|
||||
onUpdate.setOnClickListener(v -> {
|
||||
ur.upApp();
|
||||
}
|
||||
);
|
||||
//系统设置
|
||||
onSetUp.setOnClickListener(v -> startActivity(new Intent(con, SetupActivity.class)));
|
||||
}
|
||||
@ -280,15 +307,28 @@ public class MyFragment extends BaseFragment {
|
||||
|
||||
}
|
||||
if (!"".equals(userBean.getData().getHeadportraitUrl())) {
|
||||
Glide.with(con).load(userBean.getData().getHeadportraitUrl()).into(img_head);
|
||||
ImageLoader.getInstance().loadImage(con,userBean.getData().getHeadportraitUrl(),img_head);
|
||||
}
|
||||
if (userBean != null && 100003 == userBean.getData().getAuditStatus()) {
|
||||
auth_box.setVisibility(View.GONE);
|
||||
no_auth.setVisibility(View.GONE);
|
||||
} else {
|
||||
auth_box.setVisibility(View.GONE);
|
||||
no_auth.setVisibility(View.VISIBLE);
|
||||
|
||||
if (userBean != null) {
|
||||
if ("0".equals(userBean.getData().getRealAuthentication())) {
|
||||
no_auth.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (100003 == userBean.getData().getAuditStatus()) {
|
||||
no_auth.setVisibility(View.GONE);
|
||||
} else {
|
||||
no_auth.setBackgroundResource(R.mipmap.icon_auth_wsh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (userBean != null && 100003 == userBean.getData().getAuditStatus()) {
|
||||
// auth_box.setVisibility(View.GONE);
|
||||
// no_auth.setVisibility(View.GONE);
|
||||
// } else {
|
||||
// auth_box.setVisibility(View.GONE);
|
||||
// no_auth.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,11 +346,19 @@ public class MyFragment extends BaseFragment {
|
||||
ur.vehicleList("1");
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void personResult(PersonEvent home) {
|
||||
Log.e("-res-", home.getMessage());
|
||||
if (ur != null) {
|
||||
ur.User();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (ur != null) {
|
||||
ur.User();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import android.widget.Toast;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.parts.ConfigParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.web.WebOnlyOneActivity;
|
||||
import com.google.gson.Gson;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
@ -73,9 +74,9 @@ public class SetupActivity extends BaseActivity {
|
||||
ConfigBean cb= ConfigParts.getConfigParts(con);
|
||||
if(cb!=null){
|
||||
// url1=cb.getData().getUserUrl();
|
||||
url1="http://agreement.dahehuoyun.com/rule/serviceAgreement/dist/index.html#/";
|
||||
url1="https://agreement.dahehuoyun.com/rule/serviceAgreement/dist/index.html#/";
|
||||
// url2=cb.getData().getPrivateUrl();
|
||||
url2="http://agreement.dahehuoyun.com/currency/#/";
|
||||
url2="https://agreement.dahehuoyun.com/currency/#/";
|
||||
kefu=cb.getData().getServiceMobile();
|
||||
url3=cb.getData().getSecurityUrl();
|
||||
}
|
||||
@ -94,19 +95,19 @@ public class SetupActivity extends BaseActivity {
|
||||
public void initView(Object obj) {
|
||||
super.initView(obj);
|
||||
r1.setOnClickListener(v12 -> {
|
||||
Intent in=new Intent(con,WebActivity.class);
|
||||
Intent in=new Intent(con, WebOnlyOneActivity.class);
|
||||
in.putExtra("title","隐私政策");
|
||||
in.putExtra("url",url2);
|
||||
startActivity(in);
|
||||
});
|
||||
r2.setOnClickListener(v12 -> {
|
||||
Intent in=new Intent(con,WebActivity.class);
|
||||
Intent in=new Intent(con,WebOnlyOneActivity.class);
|
||||
in.putExtra("title","用户协议");
|
||||
in.putExtra("url",url1);
|
||||
startActivity(in);
|
||||
});
|
||||
r3.setOnClickListener(v12 -> {
|
||||
Intent in=new Intent(con,WebActivity.class);
|
||||
Intent in=new Intent(con,WebOnlyOneActivity.class);
|
||||
in.putExtra("title","运输安全责任书");
|
||||
in.putExtra("url",url3);
|
||||
startActivity(in);
|
||||
@ -121,7 +122,7 @@ public class SetupActivity extends BaseActivity {
|
||||
startActivity(in);
|
||||
});
|
||||
r8.setOnClickListener(v12 -> {
|
||||
Intent in=new Intent(con,WebActivity.class);
|
||||
Intent in=new Intent(con,WebOnlyOneActivity.class);
|
||||
in.putExtra("title","交易规则");
|
||||
in.putExtra("url","http://agreement.dahehuoyun.com/rule/transactionRules/dist/index.html#/");
|
||||
startActivity(in);
|
||||
|
@ -24,6 +24,7 @@ import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.weight.OnLimitClickHelper;
|
||||
import com.arpa.hndahesudintocctmsdriver.weight.OnLimitClickListener;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.dahe.mylibrary.utils.ImageLoader;
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.BaseBean;
|
||||
@ -95,7 +96,7 @@ public class UpBankActivity extends BaseAppCompatActivity implements OnLimitClic
|
||||
submit.setBackgroundResource(R.drawable.bg_btn_grey);
|
||||
bank_name.setText(dad.getData().getBankName());
|
||||
bank_number.setText(dad.getData().getCardNo());
|
||||
Glide.with(con).load(dad.getData().getBankImgUrl()).into(up_bank_img);
|
||||
ImageLoader.getInstance().loadImage(con,dad.getData().getBankImgUrl(),up_bank_img);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -202,7 +203,7 @@ public class UpBankActivity extends BaseAppCompatActivity implements OnLimitClic
|
||||
super.initView(obj);
|
||||
bank_name.setText(ib.getData().getBankName());
|
||||
bank_number.setText(ib.getData().getCardNumber());
|
||||
Glide.with(con).load(path).into(up_bank_img);
|
||||
ImageLoader.getInstance().loadImage(con,path,up_bank_img);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,227 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.ui.web;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
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;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.UserBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.parts.UserParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.PaxWebChromeClient;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.string.StringUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseActivity;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/8/6 16:48
|
||||
* @description:访问webview的activity
|
||||
*/
|
||||
public class WebOnlyOneActivity extends BaseActivity {
|
||||
|
||||
private String url = "";
|
||||
private String title = "";
|
||||
private WebView wv;
|
||||
private TextView title_tv;
|
||||
private PaxWebChromeClient chromeClient;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
StateStyleUtil.stateTextColor(this);
|
||||
setContentView(R.layout.activity_web);
|
||||
con = this;
|
||||
initHardwareAccelerate();
|
||||
wv = findViewById(R.id.wv);
|
||||
title_tv = findViewById(R.id.title);
|
||||
Intent in = getIntent();
|
||||
url = in.getExtras().getString("url");
|
||||
title = in.getExtras().getString("title");
|
||||
chromeClient = new PaxWebChromeClient(this, null, null);
|
||||
if ("咨询建议".equals(title)) {
|
||||
initOpinion();
|
||||
} else {
|
||||
initView(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void initHardwareAccelerate() {
|
||||
try {
|
||||
if (Integer.parseInt(Build.VERSION.SDK) >= 11) {
|
||||
getWindow()
|
||||
.setFlags(
|
||||
android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
|
||||
android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint({"JavascriptInterface", "SetJavaScriptEnabled"})
|
||||
@Override
|
||||
public void initView(Object obj) {
|
||||
super.initView(obj);
|
||||
WebSettings webSettings = wv.getSettings();
|
||||
//设置网页有缓存的时候也继续读取新的地址
|
||||
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
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资源
|
||||
//覆盖WebView默认使用第三方或系统默认浏览器打开网页的行为,使网页用WebView打开
|
||||
wv.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
||||
return super.shouldOverrideUrlLoading(view, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url1) {
|
||||
//返回值是true的时候控制去WebView打开,为false调用系统浏览器或第三方浏览器
|
||||
Log.d("test", "webactivity..url:" + url);
|
||||
// if(!url.startsWith("http"))
|
||||
// {
|
||||
// Log.d("test","非http开头..url:"+url);
|
||||
// Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(url));
|
||||
// boolean isInstall = getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY).size()>0;
|
||||
// Log.d("test","是否安装要跳转的app:"+isInstall);
|
||||
// if(isInstall)
|
||||
// {
|
||||
// startActivity(intent);
|
||||
// finish();
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
if (!url1.equals(url))
|
||||
return true;
|
||||
wv.loadUrl(url1);
|
||||
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);
|
||||
title_tv.setText(title);
|
||||
}
|
||||
|
||||
public void initOpinion() {
|
||||
if (findViewById(R.id.return_btn) != null) {
|
||||
findViewById(R.id.return_btn).setOnClickListener(v -> {
|
||||
finish();
|
||||
});
|
||||
}
|
||||
title_tv.setText(title);
|
||||
UserBean ub = UserParts.getUser(con);
|
||||
wv.getSettings().setJavaScriptEnabled(true);
|
||||
wv.getSettings().setDomStorageEnabled(true); // 这个要加上
|
||||
String openid = ub.getData().getUname(); // 用户的openid
|
||||
String nickname = StringUtil.isNull(ub.getData().getRname(), "游客"); // 用户的nickname
|
||||
String headimgurl = StringUtil.isNull(ub.getData().getHeadportraitUrl(), ""); // 用户的头像url
|
||||
|
||||
/* 获得 webview url,请注意url单词是product而不是products,products是旧版本的参数,用错地址将不能成功提交 */
|
||||
String url = "https://support.qq.com/products/335639"; // 把1221数字换成你的产品ID,否则会不成功
|
||||
/* 准备post参数 */
|
||||
String postData = "nickname=" + nickname + "&avatar=" + headimgurl + "&openid=" + openid;
|
||||
wv.postUrl(url, postData.getBytes());
|
||||
wv.setWebChromeClient(chromeClient);
|
||||
wv.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
||||
return super.shouldOverrideUrlLoading(view, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
//返回值是true的时候控制去WebView打开,为false调用系统浏览器或第三方浏览器
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
||||
super.onReceivedSslError(view, handler, error);
|
||||
handler.proceed();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
|
||||
chromeClient.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
public class JavaScriptObject {
|
||||
|
||||
Context mContxt;
|
||||
|
||||
public JavaScriptObject(Context mContxt) {
|
||||
this.mContxt = mContxt;
|
||||
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void getName() {
|
||||
Log.e("eeee-", "name");
|
||||
Toast.makeText(con, "hello", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public String getUserToken() {
|
||||
// Log.e("-token-",UserParts.getUser(con).getData().getToken());
|
||||
// return "woshitoken-androidfasdf";
|
||||
return UserParts.getUser(con).getData().getToken();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void isSuccess() {
|
||||
finish();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void isPdfSuccess() {
|
||||
Toast.makeText(con, "签署成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,6 +28,8 @@ public abstract class BaseActivity extends Activity {
|
||||
private String title_text="空白标题";
|
||||
|
||||
public Handler hd=new Handler(msg -> {
|
||||
if (this==null||this.isFinishing())
|
||||
return true;
|
||||
msgMethod(msg);
|
||||
return false;
|
||||
});
|
||||
|
@ -25,6 +25,8 @@ public class BaseAppCompatActivity extends AppCompatActivity {
|
||||
public static String dataName,dataName2,dataName3="";
|
||||
public View root;
|
||||
public Handler hd=new Handler(msg -> {
|
||||
if (this==null||this.isFinishing())
|
||||
return true;
|
||||
msgMethod(msg);
|
||||
return false;
|
||||
});
|
||||
|
@ -105,6 +105,8 @@ public class BaseRecyclerView extends RecyclerView {
|
||||
ra.addItem(mb);
|
||||
}
|
||||
public void adds(List<ManyBean> list){
|
||||
if (ra==null)
|
||||
return;
|
||||
ra.add(list);
|
||||
}
|
||||
public AdapterAlls createsH(Context con, List<ManyBean> list){
|
||||
|
BIN
app/src/main/res/drawable-xxhdpi/face_success.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/face_success.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
13
app/src/main/res/drawable/bg_btn_deepgreen16.xml
Normal file
13
app/src/main/res/drawable/bg_btn_deepgreen16.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<gradient android:angle="0" android:useLevel="true"
|
||||
android:startColor="#0b64f6 " android:endColor="#5cb3fd"
|
||||
android:centerX="0" android:centerY="0"
|
||||
android:gradientRadius="@dimen/dp_63" />
|
||||
<corners android:radius="@dimen/dp_19" />
|
||||
</shape>
|
||||
|
||||
</item>
|
||||
</selector>
|
10
app/src/main/res/drawable/bg_btn_gray.xml
Normal file
10
app/src/main/res/drawable/bg_btn_gray.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#AAAAAA" />
|
||||
<corners android:topLeftRadius="@dimen/dp_29" android:topRightRadius="@dimen/dp_29"
|
||||
android:bottomLeftRadius="@dimen/dp_29" android:bottomRightRadius="@dimen/dp_29" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
9
app/src/main/res/drawable/bg_btn_green16.xml
Normal file
9
app/src/main/res/drawable/bg_btn_green16.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#E1ECFF" />
|
||||
<corners android:radius="@dimen/dp_19" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
73
app/src/main/res/layout/activity_face_succ_result.xml
Normal file
73
app/src/main/res/layout/activity_face_succ_result.xml
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
tools:context=".ui.auth.CertificatesActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/return_btn"
|
||||
android:layout_width="@dimen/dp_40"
|
||||
android:layout_height="@dimen/dp_31"
|
||||
android:layout_marginLeft="@dimen/dp_28"
|
||||
android:layout_marginTop="@dimen/dp_58"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@mipmap/return_lefts" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_marginTop="@dimen/dp_210"
|
||||
android:id="@+id/img"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/face_success"></ImageView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/img"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="恭喜您! 实名认证成功"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_16" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_46"
|
||||
android:layout_below="@+id/tvTitle"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnHome"
|
||||
android:layout_width="@dimen/dp_110"
|
||||
android:layout_height="@dimen/dp_38"
|
||||
android:background="@drawable/bg_btn_green16"
|
||||
android:text="返回首页"
|
||||
android:textColor="#0966FF" />
|
||||
|
||||
<Button
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:id="@+id/btnAddCar"
|
||||
android:textColor="@color/white"
|
||||
android:layout_width="@dimen/dp_110"
|
||||
android:layout_height="@dimen/dp_38"
|
||||
android:background="@drawable/bg_btn_deepgreen16"
|
||||
android:text="添加车辆" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
@ -80,7 +80,7 @@
|
||||
android:layout_marginLeft="@dimen/dp_14"
|
||||
android:layout_width="@dimen/dp_143"
|
||||
android:layout_height="@dimen/dp_36"
|
||||
android:src="@mipmap/icon_auth_new"/>
|
||||
android:background="@mipmap/icon_auth_new"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
BIN
app/src/main/res/mipmap-hdpi/icon_auth_wsh.png
Normal file
BIN
app/src/main/res/mipmap-hdpi/icon_auth_wsh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
@ -4,6 +4,9 @@ buildscript {
|
||||
// ext.kotlin_version = "1.5.0"
|
||||
ext.kotlin_version = "1.6.10"
|
||||
repositories {
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
maven { url 'https://maven.aliyun.com/repository/jcenter' }
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
|
||||
google()
|
||||
jcenter() // 这个
|
||||
mavenCentral()
|
||||
@ -22,6 +25,9 @@ buildscript {
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
maven { url 'https://maven.aliyun.com/repository/google' }
|
||||
maven { url 'https://maven.aliyun.com/repository/jcenter' }
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
|
||||
google()
|
||||
jcenter() // Warning: this repository is going to shut down soon
|
||||
mavenCentral()
|
||||
|
33
mylibrary/src/main/java/com/dahe/mylibrary/utils/Gps.java
Normal file
33
mylibrary/src/main/java/com/dahe/mylibrary/utils/Gps.java
Normal file
@ -0,0 +1,33 @@
|
||||
package com.dahe.mylibrary.utils;
|
||||
|
||||
/**
|
||||
* @ClassName Gps
|
||||
* @Author john
|
||||
* @Date 2024/12/13 17:25
|
||||
* @Description TODO
|
||||
*/
|
||||
public class Gps {
|
||||
private double wgLon;
|
||||
private double wgLat;
|
||||
|
||||
public Gps(double wgLat,double wgLon) {
|
||||
this.wgLat = wgLat;
|
||||
this.wgLon = wgLon;
|
||||
}
|
||||
|
||||
public double getWgLon() {
|
||||
return wgLon;
|
||||
}
|
||||
|
||||
public void setWgLon(double wgLon) {
|
||||
this.wgLon = wgLon;
|
||||
}
|
||||
|
||||
public double getWgLat() {
|
||||
return wgLat;
|
||||
}
|
||||
|
||||
public void setWgLat(double wgLat) {
|
||||
this.wgLat = wgLat;
|
||||
}
|
||||
}
|
@ -1,9 +1,12 @@
|
||||
package com.dahe.mylibrary.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.MultiTransformation;
|
||||
@ -70,9 +73,19 @@ public class ImageLoader {
|
||||
*/
|
||||
public void loadImage(Context context, final Object url, final ImageView imageView, RequestOptions requestOptions, int placeholder) {
|
||||
if (null != context) {
|
||||
if (placeholder != -1)
|
||||
requestOptions = requestOptions.placeholder(placeholder).error(placeholder);
|
||||
Glide.with(context).load(url).centerCrop().apply(requestOptions).into(imageView);
|
||||
if (context instanceof Activity) {
|
||||
Activity activity = (Activity) context;
|
||||
if (activity != null && !activity.isFinishing()) {
|
||||
if (placeholder != -1)
|
||||
requestOptions = requestOptions.placeholder(placeholder).error(placeholder);
|
||||
Glide.with(context).load(url).centerCrop().apply(requestOptions).into(imageView);
|
||||
}
|
||||
}else {
|
||||
if (placeholder != -1)
|
||||
requestOptions = requestOptions.placeholder(placeholder).error(placeholder);
|
||||
Glide.with(context).load(url).centerCrop().apply(requestOptions).into(imageView);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,7 +193,7 @@ public class ImageLoader {
|
||||
* @param url
|
||||
* @param imageView
|
||||
*/
|
||||
public void loadCircleWithBorderImage(Context context, Object url,RequestOptions requestOptions, int borderWidth, int borderColor, ImageView imageView, int placeholder) {
|
||||
public void loadCircleWithBorderImage(Context context, Object url, RequestOptions requestOptions, int borderWidth, int borderColor, ImageView imageView, int placeholder) {
|
||||
if (null != context) {
|
||||
requestOptions.transform(new GlideCircleWithBorder(context, borderWidth, ContextCompat.getColor(context, borderColor)));
|
||||
loadImage(context, url, imageView, requestOptions, placeholder);
|
||||
|
@ -0,0 +1,112 @@
|
||||
package com.dahe.mylibrary.utils;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
|
||||
/**
|
||||
* @ClassName PermissionUtils
|
||||
* @Author john
|
||||
* @Date 2024/12/19 14:59
|
||||
* @Description TODO
|
||||
*/
|
||||
public class PermissionUtils {
|
||||
|
||||
// 私有静态实例,防止被外部实例化
|
||||
private static PermissionUtils instance;
|
||||
|
||||
// 私有构造方法,防止通过 new 关键字创建实例
|
||||
private PermissionUtils() {
|
||||
}
|
||||
|
||||
// 获取单例实例
|
||||
public static PermissionUtils getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (PermissionUtils.class) {
|
||||
if (instance == null) {
|
||||
instance = new PermissionUtils();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据不同手机机型跳转到权限设置页面
|
||||
*
|
||||
* @param context 上下文
|
||||
*/
|
||||
public void goToAppPermissionSettings(Context context) {
|
||||
Intent intent = new Intent();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (Build.FINGERPRINT.startsWith("Huawei") || Build.BRAND.startsWith("Huawei")) {
|
||||
// 华为手机
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
Uri uri = Uri.fromParts("package", context.getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
} else if (Build.FINGERPRINT.startsWith("Xiaomi") || Build.BRAND.startsWith("Xiaomi")) {
|
||||
// 小米手机
|
||||
intent.setAction(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
|
||||
Uri uri = Uri.parse("package:" + context.getPackageName());
|
||||
intent.setData(uri);
|
||||
} else if (Build.BRAND.equals("Meizu")) {
|
||||
// 魅族手机
|
||||
intent.setAction("com.meizu.safe.security.SHOW_APPSEC");
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
intent.putExtra("packageName", context.getPackageName());
|
||||
} else if (Build.FINGERPRINT.startsWith("OPPO") || Build.BRAND.startsWith("OPPO")) {
|
||||
// OPPO手机
|
||||
try {
|
||||
String pkgName = context.getPackageName();
|
||||
String className = "com.coloros.safecenter.permission.PermissionManagerActivity";
|
||||
intent.setClassName("com.coloros.safecenter", className);
|
||||
intent.putExtra("packageName", pkgName);
|
||||
intent.putExtra("appName", context.getResources().getString(context.getApplicationInfo().labelRes));
|
||||
intent.putExtra("opType", "4"); // 4 表示权限管理页面
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
} catch (Exception e) {
|
||||
// 如果找不到OPPO的特定页面,则使用通用页面
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
Uri uri = Uri.fromParts("package", context.getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
}
|
||||
} else if (Build.FINGERPRINT.startsWith("vivo") || Build.BRAND.startsWith("vivo")) {
|
||||
// vivo手机
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
Uri uri = Uri.fromParts("package", context.getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName());
|
||||
} else if (Build.BRAND.equals("samsung")) {
|
||||
// 三星手机
|
||||
try {
|
||||
String pkgName = context.getPackageName();
|
||||
Intent intent2 = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
|
||||
intent2.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
intent2.setData(Uri.parse("package:" + pkgName));
|
||||
intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent2.putExtra("com.android.providers.media.EXTRA_APP_PACKAGE", pkgName);
|
||||
context.startActivity(intent2);
|
||||
return; // 使用三星特定的页面,不需要继续执行通用代码
|
||||
} catch (Exception e) {
|
||||
// 如果三星特定页面失败,则使用通用页面
|
||||
}
|
||||
} else {
|
||||
// 其他手机使用通用页面
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
Uri uri = Uri.fromParts("package", context.getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.putExtra(Settings.EXTRA_APP_PACKAGE, context.getPackageName());
|
||||
}
|
||||
} else {
|
||||
// 低于Android 6.0(M)的版本,使用通用页面
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
Uri uri = Uri.fromParts("package", context.getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
}
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
@ -0,0 +1,539 @@
|
||||
package com.dahe.mylibrary.utils;
|
||||
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
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.location.LocationProvider;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* @author ondear
|
||||
* time : 16/11/13
|
||||
* desc : 定位相关工具类
|
||||
*/
|
||||
public class RxLocationUtils {
|
||||
|
||||
public static double pi = 3.1415926535897932384626;
|
||||
public static double a = 6378245.0;
|
||||
public static double ee = 0.00669342162296594323;
|
||||
private static OnLocationChangeListener mListener;
|
||||
private static MyLocationListener myLocationListener;
|
||||
private static LocationManager mLocationManager;
|
||||
|
||||
/**
|
||||
* 判断Gps是否可用
|
||||
*
|
||||
* @return {@code true}: 是<br>{@code false}: 否
|
||||
*/
|
||||
public static boolean isGpsEnabled(Context context) {
|
||||
LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
return lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断定位是否可用
|
||||
*
|
||||
* @return {@code true}: 是<br>{@code false}: 否
|
||||
*/
|
||||
public static boolean isLocationEnabled(Context context) {
|
||||
LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
return lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER) || lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开Gps设置界面
|
||||
*/
|
||||
public static void openGpsSettings(Context context) {
|
||||
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
* <p>使用完记得调用{@link #unregister()}</p>
|
||||
* <p>需添加权限 {@code <uses-permission android:name="android.permission.INTERNET"/>}</p>
|
||||
* <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>}</p>
|
||||
* <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>}</p>
|
||||
* <p>如果{@code minDistance}为0,则通过{@code minTime}来定时更新;</p>
|
||||
* <p>{@code minDistance}不为0,则以{@code minDistance}为准;</p>
|
||||
* <p>两者都为0,则随时刷新。</p>
|
||||
*
|
||||
* @param minTime 位置信息更新周期(单位:毫秒)
|
||||
* @param minDistance 位置变化最小距离:当位置距离变化超过此值时,将更新位置信息(单位:米)
|
||||
* @param listener 位置刷新的回调接口
|
||||
* @return {@code true}: 初始化成功<br>{@code false}: 初始化失败
|
||||
*/
|
||||
public static boolean register(Context context, long minTime, long minDistance, OnLocationChangeListener listener) {
|
||||
if (listener == null) return false;
|
||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions((Activity) context, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);
|
||||
ActivityCompat.requestPermissions((Activity) context, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 1);
|
||||
return false;
|
||||
}
|
||||
mLocationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
mListener = listener;
|
||||
if (!isLocationEnabled(context)) {
|
||||
ToastUtils.showToast(context, "无法定位,请打开定位服务");
|
||||
return false;
|
||||
}
|
||||
String provider = mLocationManager.getBestProvider(getCriteria(), true);
|
||||
|
||||
Location location = mLocationManager.getLastKnownLocation(provider);
|
||||
if (location != null) listener.getLastKnownLocation(location);
|
||||
if (myLocationListener == null) myLocationListener = new MyLocationListener();
|
||||
mLocationManager.requestLocationUpdates(provider, minTime, minDistance, myLocationListener);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销
|
||||
*/
|
||||
public static void unregister() {
|
||||
if (mLocationManager != null) {
|
||||
if (myLocationListener != null) {
|
||||
mLocationManager.removeUpdates(myLocationListener);
|
||||
myLocationListener = null;
|
||||
}
|
||||
mLocationManager = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置定位参数
|
||||
*
|
||||
* @return {@link Criteria}
|
||||
*/
|
||||
private static Criteria getCriteria() {
|
||||
Criteria criteria = new Criteria();
|
||||
//设置定位精确度 Criteria.ACCURACY_COARSE比较粗略,Criteria.ACCURACY_FINE则比较精细
|
||||
criteria.setAccuracy(Criteria.ACCURACY_FINE);
|
||||
//设置是否要求速度
|
||||
criteria.setSpeedRequired(false);
|
||||
// 设置是否允许运营商收费
|
||||
criteria.setCostAllowed(false);
|
||||
//设置是否需要方位信息
|
||||
criteria.setBearingRequired(false);
|
||||
//设置是否需要海拔信息
|
||||
criteria.setAltitudeRequired(false);
|
||||
// 设置对电源的需求
|
||||
criteria.setPowerRequirement(Criteria.POWER_LOW);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据经纬度获取地理位置
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param latitude 纬度
|
||||
* @param longitude 经度
|
||||
* @return {@link Address}
|
||||
*/
|
||||
public static Address getAddress(Context context, double latitude, double longitude) {
|
||||
Geocoder geocoder = new Geocoder(context, Locale.getDefault());
|
||||
try {
|
||||
List<Address> addresses = geocoder.getFromLocation(latitude, longitude, 1);
|
||||
if (addresses.size() > 0) return addresses.get(0);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据经纬度获取所在国家
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param latitude 纬度
|
||||
* @param longitude 经度
|
||||
* @return 所在国家
|
||||
*/
|
||||
public static String getCountryName(Context context, double latitude, double longitude) {
|
||||
Address address = getAddress(context, latitude, longitude);
|
||||
return address == null ? "unknown" : address.getCountryName();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据经纬度获取所在地
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param latitude 纬度
|
||||
* @param longitude 经度
|
||||
* @return 所在地
|
||||
*/
|
||||
public static String getLocality(Context context, double latitude, double longitude) {
|
||||
Address address = getAddress(context, latitude, longitude);
|
||||
return address == null ? "unknown" : address.getLocality();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据经纬度获取所在街道
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param latitude 纬度
|
||||
* @param longitude 经度
|
||||
* @return 所在街道
|
||||
*/
|
||||
public static String getStreet(Context context, double latitude, double longitude) {
|
||||
Address address = getAddress(context, latitude, longitude);
|
||||
return address == null ? "unknown" : address.getAddressLine(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据经纬度获取详细地址
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param latitude 纬度
|
||||
* @param longitude 经度
|
||||
* @return 所在街道
|
||||
*/
|
||||
public static String getFeature(Context context, double latitude, double longitude) {
|
||||
Address address = getAddress(context, latitude, longitude);
|
||||
return address == null ? "未知地点" : address.getFeatureName();
|
||||
}
|
||||
|
||||
//------------------------------------------坐标转换工具start--------------------------------------
|
||||
|
||||
/**
|
||||
* GPS坐标 转换成 角度
|
||||
* 例如 113.202222 转换成 113°12′8″
|
||||
*
|
||||
* @param location
|
||||
* @return
|
||||
*/
|
||||
public static String gpsToDegree(double location) {
|
||||
double degree = Math.floor(location);
|
||||
double minute_temp = (location - degree) * 60;
|
||||
double minute = Math.floor(minute_temp);
|
||||
// double second = Math.floor((minute_temp - minute)*60);
|
||||
String second = new DecimalFormat("#.##").format((minute_temp - minute) * 60);
|
||||
return (int) degree + "°" + (int) minute + "′" + second + "″";
|
||||
}
|
||||
|
||||
/**
|
||||
* 国际 GPS84 坐标系
|
||||
* 转换成
|
||||
* [国测局坐标系] 火星坐标系 (GCJ-02)
|
||||
* <p>
|
||||
* World Geodetic System ==> Mars Geodetic System
|
||||
*
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @return GPS实体类
|
||||
*/
|
||||
public static Gps GPS84ToGCJ02(double lat, double lon) {
|
||||
if (outOfChina(lat, lon)) {
|
||||
return null;
|
||||
}
|
||||
double dLat = transformLat(lon - 105.0, lat - 35.0);
|
||||
double dLon = transformLon(lon - 105.0, lat - 35.0);
|
||||
double radLat = lat / 180.0 * pi;
|
||||
double magic = Math.sin(radLat);
|
||||
magic = 1 - ee * magic * magic;
|
||||
double sqrtMagic = Math.sqrt(magic);
|
||||
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
|
||||
dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
|
||||
double mgLat = lat + dLat;
|
||||
double mgLon = lon + dLon;
|
||||
return new Gps(mgLat, mgLon);
|
||||
}
|
||||
|
||||
/**
|
||||
* [国测局坐标系] 火星坐标系 (GCJ-02)
|
||||
* 转换成
|
||||
* 国际 GPS84 坐标系
|
||||
*
|
||||
* @param lon 火星经度
|
||||
* @param lat 火星纬度
|
||||
*/
|
||||
public static Gps GCJ02ToGPS84(double lat, double lon) {
|
||||
Gps gps = transform(lat, lon);
|
||||
double lontitude = lon * 2 - gps.getWgLon();
|
||||
double latitude = lat * 2 - gps.getWgLat();
|
||||
return new Gps(latitude, lontitude);
|
||||
}
|
||||
|
||||
/**
|
||||
* 火星坐标系 (GCJ-02)
|
||||
* 转换成
|
||||
* 百度坐标系 (BD-09)
|
||||
*
|
||||
* @param gg_lon 经度
|
||||
* @param gg_lat 纬度
|
||||
*/
|
||||
public static Gps GCJ02ToBD09(double gg_lat, double gg_lon) {
|
||||
double x = gg_lon, y = gg_lat;
|
||||
double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * pi);
|
||||
double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * pi);
|
||||
double bd_lon = z * Math.cos(theta) + 0.0065;
|
||||
double bd_lat = z * Math.sin(theta) + 0.006;
|
||||
return new Gps(bd_lat, bd_lon);
|
||||
}
|
||||
|
||||
/**
|
||||
* 国际 GPS84 坐标系
|
||||
* 转换成
|
||||
* 百度坐标系 (BD-09)
|
||||
*
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
*/
|
||||
public static Gps GPS84ToBD09(double lat, double lon) {
|
||||
Gps gps = GPS84ToGCJ02(lat,lon);
|
||||
if (gps == null) {
|
||||
return new Gps(lat,lon);
|
||||
}
|
||||
//GCJ-02 转 BD-09
|
||||
return GCJ02ToBD09(gps.getWgLat(), gps.getWgLon());
|
||||
}
|
||||
|
||||
/**
|
||||
* 百度坐标系 (BD-09)
|
||||
* 转换成
|
||||
* 火星坐标系 (GCJ-02)
|
||||
*
|
||||
* @param bd_lon 百度*经度
|
||||
* @param bd_lat 百度*纬度
|
||||
* @return GPS实体类
|
||||
*/
|
||||
public static Gps BD09ToGCJ02(double bd_lat, double bd_lon) {
|
||||
double x = bd_lon - 0.0065, y = bd_lat - 0.006;
|
||||
double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * pi);
|
||||
double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * pi);
|
||||
double gg_lon = z * Math.cos(theta);
|
||||
double gg_lat = z * Math.sin(theta);
|
||||
return new Gps(gg_lat, gg_lon);
|
||||
}
|
||||
|
||||
/**
|
||||
* 百度坐标系 (BD-09)
|
||||
* 转换成
|
||||
* 国际 GPS84 坐标系
|
||||
*
|
||||
* @param bd_lon 百度*经度
|
||||
* @param bd_lat 百度*纬度
|
||||
* @return GPS实体类
|
||||
*/
|
||||
public static Gps BD09ToGPS84(double bd_lat, double bd_lon) {
|
||||
Gps gcj02 = BD09ToGCJ02(bd_lat, bd_lon);
|
||||
Gps map84 = GCJ02ToGPS84(gcj02.getWgLat(),
|
||||
gcj02.getWgLon());
|
||||
return map84;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 不在中国范围内
|
||||
*
|
||||
* @param lon 经度
|
||||
* @param lat 纬度
|
||||
* @return boolean值
|
||||
*/
|
||||
public static boolean outOfChina(double lat, double lon) {
|
||||
if (lon < 72.004 || lon > 137.8347)
|
||||
return true;
|
||||
return lat < 0.8293 || lat > 55.8271;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化算法
|
||||
*
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @return
|
||||
*/
|
||||
public static Gps transform(double lat, double lon) {
|
||||
if (outOfChina(lat, lon)) {
|
||||
return new Gps(lat, lon);
|
||||
}
|
||||
double dLat = transformLat(lon - 105.0, lat - 35.0);
|
||||
double dLon = transformLon(lon - 105.0, lat - 35.0);
|
||||
double radLat = lat / 180.0 * pi;
|
||||
double magic = Math.sin(radLat);
|
||||
magic = 1 - ee * magic * magic;
|
||||
double sqrtMagic = Math.sqrt(magic);
|
||||
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
|
||||
dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
|
||||
double mgLat = lat + dLat;
|
||||
double mgLon = lon + dLon;
|
||||
return new Gps(mgLat, mgLon);
|
||||
}
|
||||
|
||||
/**
|
||||
* 纬度转化算法
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @return
|
||||
*/
|
||||
public static double transformLat(double x, double y) {
|
||||
double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y
|
||||
+ 0.2 * Math.sqrt(Math.abs(x));
|
||||
ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
|
||||
ret += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0;
|
||||
ret += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 经度转化算法
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @return
|
||||
*/
|
||||
public static double transformLon(double x, double y) {
|
||||
double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1
|
||||
* Math.sqrt(Math.abs(x));
|
||||
ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
|
||||
ret += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0;
|
||||
ret += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0
|
||||
* pi)) * 2.0 / 3.0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public interface OnLocationChangeListener {
|
||||
|
||||
/**
|
||||
* 获取最后一次保留的坐标
|
||||
*
|
||||
* @param location 坐标
|
||||
*/
|
||||
void getLastKnownLocation(Location location);
|
||||
|
||||
/**
|
||||
* 当坐标改变时触发此函数,如果Provider传进相同的坐标,它就不会被触发
|
||||
*
|
||||
* @param location 坐标
|
||||
*/
|
||||
void onLocationChanged(Location location);
|
||||
|
||||
/**
|
||||
* provider的在可用、暂时不可用和无服务三个状态直接切换时触发此函数
|
||||
*
|
||||
* @param provider 提供者
|
||||
* @param status 状态
|
||||
* @param extras provider可选包
|
||||
*/
|
||||
void onStatusChanged(String provider, int status, Bundle extras);//位置状态发生改变
|
||||
|
||||
void onProviderEnabled(String provider);
|
||||
|
||||
void onProviderDisabled(String provider);
|
||||
}
|
||||
|
||||
private static class MyLocationListener
|
||||
implements LocationListener {
|
||||
/**
|
||||
* 当坐标改变时触发此函数,如果Provider传进相同的坐标,它就不会被触发
|
||||
*
|
||||
* @param location 坐标
|
||||
*/
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
if (mListener != null) {
|
||||
mListener.onLocationChanged(location);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* provider的在可用、暂时不可用和无服务三个状态直接切换时触发此函数
|
||||
*
|
||||
* @param provider 提供者
|
||||
* @param status 状态
|
||||
* @param extras provider可选包
|
||||
*/
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
if (mListener != null) {
|
||||
mListener.onStatusChanged(provider, status, extras);
|
||||
}
|
||||
switch (status) {
|
||||
case LocationProvider.AVAILABLE:
|
||||
Log.d("onStatusChanged", "当前GPS状态为可见状态");
|
||||
break;
|
||||
case LocationProvider.OUT_OF_SERVICE:
|
||||
Log.d("onStatusChanged", "当前GPS状态为服务区外状态");
|
||||
break;
|
||||
case LocationProvider.TEMPORARILY_UNAVAILABLE:
|
||||
Log.d("onStatusChanged", "当前GPS状态为暂停服务状态");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* provider被enable时触发此函数,比如GPS被打开
|
||||
*/
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {
|
||||
if (mListener != null) {
|
||||
mListener.onProviderEnabled(provider);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* provider被disable时触发此函数,比如GPS被关闭
|
||||
*/
|
||||
@Override
|
||||
public void onProviderDisabled(String provider) {
|
||||
if (mListener != null) {
|
||||
mListener.onProviderDisabled(provider);
|
||||
}
|
||||
}
|
||||
}
|
||||
//===========================================坐标转换工具end====================================
|
||||
|
||||
|
||||
|
||||
private static final double EARTH_RADIUS = 6378137.0; //地球半径
|
||||
|
||||
|
||||
/**
|
||||
* 计算两个经纬度之间的距离
|
||||
*
|
||||
* @param longitude
|
||||
* @param latitude
|
||||
* @param longitude2
|
||||
* @param latitude2
|
||||
* @return 单位米
|
||||
*/
|
||||
public static double getDistance(double longitude, double latitude, double longitude2, double latitude2) {
|
||||
double lat1 = rad(latitude);
|
||||
double lat2 = rad(latitude2);
|
||||
double a = lat1 - lat2;
|
||||
double b = rad(longitude) - rad(longitude2);
|
||||
double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(b / 2), 2)));
|
||||
s = s * EARTH_RADIUS;
|
||||
s = Math.round(s * 10000) / 10000; //四舍五入
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* 弧度换为角度
|
||||
* @param d
|
||||
* @return
|
||||
*/
|
||||
private static double rad(double d) {
|
||||
return d * Math.PI / 180.0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user