平台规则初始化

This commit is contained in:
lijia 2024-11-11 09:57:54 +08:00
parent 039fd4ac37
commit 2ac6bab914
36 changed files with 2753 additions and 22 deletions

View File

@ -172,6 +172,17 @@
android:configChanges="keyboardHidden|orientation|locale"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
<activity
android:name=".ui.mine.activity.AuthPartyActivity"
android:configChanges="keyboardHidden|orientation|locale"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
<activity
android:name=".ui.mine.activity.RulesActivity"
android:configChanges="keyboardHidden|orientation|locale"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan|stateHidden" />
<activity
android:name=".ui.mine.activity.ChoiceFleetActivity"
android:configChanges="keyboardHidden|orientation|locale"

View File

@ -0,0 +1,31 @@
package com.dhsd.glowner.adapter
import android.content.Context
import android.view.ViewGroup
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.dahe.gldriver.bean.ProBean
import com.dhsd.glowner.R
/**
* @ClassName ComProAdatper
* @Author john
* @Date 2024/3/25 17:04
* @Description TODO
*/
class ComProAdatper : BaseQuickAdapter<ProBean, QuickViewHolder>() {
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: ProBean?) {
holder.run {
setText(R.id.tvProTitle, item?.problemName)
setText(R.id.tvContent, item?.problemDesc)
setText(R.id.tvNum, """${position + 1}""")
}
}
override fun onCreateViewHolder(
context: Context,
parent: ViewGroup,
viewType: Int
) = QuickViewHolder(R.layout.item_com_pro, parent)
}

View File

@ -0,0 +1,134 @@
package com.dhsd.glowner.bean
/**
* @ClassName OcrBean
* @Author john
* @Date 2024/2/27 09:58
* @Description TODO
*/
data class OcrPersonBean(
val algo_version: String,
val `data`: Data,
val height: Int,
val orgHeight: Int,
val orgWidth: Int,
val width: Int
)
data class Data(
val face: Face,
val back: Back,
val info: List<CarInfo>,
//银行卡
val bankName: String,
val cardNumber: String,
//营业执照
val creditCode: String,//信用代码
val companyName: String,//名称
val companyType: String,//类型
val businessAddress: String,
val legalPerson: String,
val businessScope: String,
val registeredCapital: String,//注册资本
val RegistrationDate: String,//成立日期2014年01月07日
val validFromDate: String,//20140107
val validToDate: String,
val issueDate: String
)
data class Back(
val `data`: DataX
)
data class Face(
val algo_version: String,
val angle: Int,
val `data`: DataX,
val ftype: Int,
val height: Int,
val orgHeight: Int,
val orgWidth: Int,
val prism_keyValueInfo: List<PrismKeyValueInfo>,
val sliceRect: SliceRect,
val width: Int,
)
data class CarInfo(
val key: String,
val key_loc: String,
val key_prob: String,
val value: String,
val value_loc: String,
val value_prob: String
)
data class DataX(
var address: String = "",
val birthDate: String = "",
val ethnicity: String = "",
val idNumber: String = "",
val engineNumber: String = "",
val name: String = "",
val sex: String = "",
val issueAuthority: String = "",//哈尔滨市公安局呼兰分局
val validPeriod: String = "",//2012.07.17-2032.07.17
//驾驶证
val licenseNumber: String = "",
val nationality: String = "",
val initialIssueDate: String = "",
val approvedType: String = "",
val validFromDate: String = "",
//行驶证
val model: String = "",
val owner: String = "",
val licensePlateNumber: String = "",
val registrationDate: String = "",
val useNature: String = "",//使用性质
val vehicleType: String = "",
val vinCode: String = "",
val recordNumber: String = "",//档案编号
val passengerCapacity: String = "",
val curbWeight: String = "",//整备质量
val totalWeight: String = "",//总质量
val permittedWeight: String = "",//核定载质量
val tractionWeight: String = "",//准牵引总质量
var overallDimension: String = "",//6915×2550×3960mm
val plateColorCode: String = "",//车牌颜色
val inspectionRecord: String = "",//检验有效期至2023年06月吉J 有效期
val issueDate: String = "",//发证日期
val energySign: String = "",//能源类型
val barcodeNumber: String = "",//条码编号
)
data class PrismKeyValueInfo(
val key: String,
val keyProb: Int,
val value: String,
val valuePos: List<ValuePo>,
val valueProb: Int
)
data class SliceRect(
val x0: Int,
val x1: Int,
val x2: Int,
val x3: Int,
val y0: Int,
val y1: Int,
val y2: Int,
val y3: Int
)
data class ValuePo(
val x: Int,
val y: Int
)

View File

@ -24,3 +24,62 @@ data class TabBean(var title:String,
return unSelectedIcon
}
}
/**
* 常见问题bean
* @property isRecommend String
* @property isTop String
* @property problemDesc String
* @property problemId Int
* @property problemName String
* @property problemUrl String
* @property sortValue String
* @property status String
* @constructor
*/
data class ProBean(
val isRecommend: String,
val isTop: String,
val problemDesc: String,
val problemId: String,
val problemName: String,
val problemUrl: String,
val sortValue: String,
val status: String,
val contentData: String
)
/**
* 提交党员认证资料
* @property address String
* @property area String
* @property areaCode String
* @property city String
* @property cityCode String
* @property materialList List<Material>
* @property partyMembershipTime String
* @property province String
* @property provinceCityArea String
* @property provinceCode String
* @constructor
*/
data class UpPart(
var address: String = "",
var area: String = "",
var areaCode: String = "",
var city: String = "",
var cityCode: String = "",
var materialList: MutableList<Material> = mutableListOf(),
var partyMembershipTime: String = "",
var province: String = "",
var provinceCityArea: String = "",
var provinceCode: String = ""
)
data class Material(
var isDel: String="",
var materialId: String="",
var materialUrl: String="",
var sortValue: String=""
)

View File

@ -31,4 +31,19 @@ data class CodeBean(
val uuid:String
)
data class AppVersion(
val content: String,
val createTime: String,
val delete: String,
val downloadUrl: String,
val examine: String,
val force: String,
val qrocdeUrl: String,
val source: String,
val type: String,
val versionCode: Int,
val versionName: String,
val versionId: String
)

View File

@ -0,0 +1,23 @@
package com.dhsd.glowner.callback
import com.dhsd.glowner.bean.OcrPersonBean
/**
* @ClassName OnOcrPicResultListener
* @Author john
* @Date 2024/2/28 17:18
* @Description TODO
*/
fun interface OnOcrPicResultListener {
fun onSuccResult(picPath: PicPath, result: OcrPersonBean?)
}
fun interface OnOcrCarNumListener {
fun onSuccResult(carNum: String)
}
data class PicPath(
var locPic: String, var picPath: String
)

View File

@ -1,3 +1,5 @@
import com.dahe.gldriver.bean.ProBean
import com.dahe.gldriver.bean.UpPart
import com.dahe.glex.bean.*
import com.dahe.mylibrary.net.CommonResponseBean
import com.dhsd.glowner.BuildConfig
@ -175,4 +177,44 @@ interface Api {
*/
@GET(BASE_URL + "devApi/business/ft/common/dict/goodsCategor")
fun getGoodsCategor(): Observable<CommonResponseBean<MutableList<GoodTypeBean>>>
/**
* 常见问题详情
* @param problemId String
* @return Observable<CommonResponseBean<MutableList<ProBean>>>
*/
@GET(BASE_URL + "driver/app/info/commonProblemDetail")
fun commonProblemDetail(@Query("problemId") problemId: String): Observable<CommonResponseBean<ProBean>>
/**
* 常见问题列表
* @return Observable<CommonResponseBean<MutableList<ProBean>>>
*/
@GET(BASE_URL + "driver/app/info/commonProblemList")
fun commonProblemList(): Observable<CommonResponseBean<MutableList<ProBean>>>
/**
* 查询党员认证资料
* @param upPart UpPart
* @return Observable<CommonResponseBean<String>>
*/
@GET(BASE_URL + "driver/driver/getCpcAuthenticationInfo")
fun getCpcAuthenticationInfo(): Observable<CommonResponseBean<UpPart>>
/**
* 提交党员认证资料
* @param upPart UpPart
* @return Observable<CommonResponseBean<String>>
*/
@POST(BASE_URL + "driver/driver/submitToCpcAuthentication")
fun submitToCpcAuthentication(@Body upPart: UpPart): Observable<CommonResponseBean<Any>>
/**
* 获取APP最新版本信息
* @return Observable<CommonResponseBean<ProBean>>
*/
@GET(BASE_URL + "driver/app/info/getLastAppVersion")
fun getLastAppVersion(): Observable<CommonResponseBean<AppVersion>>
}

View File

@ -0,0 +1,25 @@
package com.dhsd.glowner.oss;
/**
* @ClassName OssConfigBean
* @Author 用户
* @Date 2021/9/30 9:11
* @Description TODO
*/
public class OssConfigBean {
// public static final String endpoint = "oss-cn-beijing.aliyuncs.com";
public static final String endpoint = "https://oss-cn-beijing.aliyuncs.com";
public static final String region = "oss-cn-beijing";
public static final String accessKeyId = "LTAI5tSR2Ketbc32wuokWZgF";
public static final String accessKeySecret = "TuumKEyXiZ3Rdfudcir7qJZenK2wCE";
public static final String bucket = "dh-tms";
public static final String BUCKET_OBJECT = "tms/user-cert/";
public static final String BUCKET_OBJECT_TEXT = "tms/tms-test/user-cert/";
public static final String BUCKET_BASE_URL = "https://dh-tms.oss-cn-beijing.aliyuncs.com/";
public static final String BUCKET_BASE_URL_UP = "https://dahehuodongbao.com/";
public static final String ARN = "acs:ram::1864711654174879:role/aliyunactiontraildefaultrole";
//callback 测试地址
public static final String OSS_CALLBACK_URL = "http://oss-demo.aliyuncs.com:23450";
// public static final String OSS_CALLBACK_URL = "http://tms.api.test.dahehuodongbao.com:8081/sts/getsts";
}

View File

@ -0,0 +1,417 @@
package com.dhsd.glowner.oss;
import android.content.ContentResolver;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.provider.MediaStore;
import android.util.Log;
import android.widget.ImageView;
import android.widget.ProgressBar;
import androidx.appcompat.app.AppCompatActivity;
import com.alibaba.sdk.android.oss.ClientConfiguration;
import com.alibaba.sdk.android.oss.ClientException;
import com.alibaba.sdk.android.oss.OSS;
import com.alibaba.sdk.android.oss.OSSClient;
import com.alibaba.sdk.android.oss.ServiceException;
import com.alibaba.sdk.android.oss.callback.OSSCompletedCallback;
import com.alibaba.sdk.android.oss.callback.OSSProgressCallback;
import com.alibaba.sdk.android.oss.common.auth.OSSAuthCredentialsProvider;
import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
import com.alibaba.sdk.android.oss.internal.OSSAsyncTask;
import com.alibaba.sdk.android.oss.model.OSSRequest;
import com.alibaba.sdk.android.oss.model.PutObjectRequest;
import com.alibaba.sdk.android.oss.model.PutObjectResult;
import com.dahe.mylibrary.utils.LoadingUtils;
import com.dhsd.glowner.base.App;
import com.lxj.xpopup.impl.LoadingPopupView;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.functions.Consumer;
/**
* @ClassName OssServiceUtil
* @Author 用户
* @Date 2021/9/29 17:53
* @Description TODO
*/
public class OssServiceUtil {
private static OSS oss;
private static OSSCredentialProvider credentialProvider;
private static ClientConfiguration conf;
private String bucket;
private picResultCallback callback;//回调接口
private String path = "tms/user-cert/";
private LoadingPopupView dialog;
private OssServiceUtil() {
}
private static volatile OssServiceUtil ossUtils;
public static OssServiceUtil getInstance() {
if (ossUtils == null) {
synchronized (OssServiceUtil.class) {
if (ossUtils == null) {
ossUtils = new OssServiceUtil();
}
}
}
return ossUtils;
}
private void initDialog(AppCompatActivity activity) {
dialog = LoadingUtils.Companion.getInstance().init(activity, "网络请求中......");
}
//初始化使用参数
public void init() {
bucket = OssConfigBean.bucket;
String stsServer = "http://platform.test.v2.dahehuoyun.com/devApi/file/aliyun/oss/getToken";
credentialProvider = new OSSAuthCredentialsProvider(stsServer);
conf = new ClientConfiguration();
conf.setConnectionTimeout(15 * 1000); // 连接超时默认15秒
conf.setSocketTimeout(15 * 1000); // socket超时默认15秒
conf.setMaxConcurrentRequest(5); // 最大并发请求书默认5个
conf.setMaxErrorRetry(2); // 失败后最大重试次数默认2次
oss = new OSSClient(App.Companion.getApp(), OssConfigBean.endpoint, credentialProvider, conf);
}
public void setResultCallBack(picResultCallback callback) {
this.callback = callback;
}
/**
* 图片以路径的方式上传
* <p>
* // * @param 图片的上传地址更后台要
* // * @param 图片本地地址
* // * @param 进度条
*/
public void asyncPutImage(final String localFile, final AppCompatActivity activity) {
// if (object.equals("")) {
// return;
// }
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
initDialog(activity);
}
});
}
File file = new File(localFile);
if (!file.exists()) {
return;
}
Calendar instance = Calendar.getInstance();
String year = String.valueOf(instance.get(Calendar.YEAR));
String month = String.valueOf(instance.get(Calendar.MONTH) + 1);
String day = String.valueOf(instance.get(Calendar.DAY_OF_MONTH));
String name = file.getName();
// 构造上传请求
// PutObjectRequest put = new PutObjectRequest(OssConfigBean.bucket, year + "/" + month + "/" + day + name, localFile);
PutObjectRequest put = new PutObjectRequest(OssConfigBean.bucket, OssConfigBean.BUCKET_OBJECT + name, localFile);
put.setCRC64(OSSRequest.CRC64Config.YES);
String mCallbackAddress = OssConfigBean.OSS_CALLBACK_URL;
// if (mCallbackAddress != null) {
// // 传入对应的上传回调参数这里默认使用OSS提供的公共测试回调服务器地址
// put.setCallbackParam(new HashMap<String, String>() {
// {
// put("callbackUrl", mCallbackAddress);
// //callbackBody可以自定义传入的信息
// put("callbackBody", "filename=${object}");
// }
// });
// }
//上传后回调通知
// 异步上传时可以设置进度回调
put.setProgressCallback(new OSSProgressCallback<PutObjectRequest>() {
@Override
public void onProgress(PutObjectRequest request, long currentSize, long totalSize) {
// int progress = (int) (100 * currentSize / totalSize);
// if (mProgress != null) {
// mProgress.setProgress(progress);
// }
if (activity != null) {
activity.runOnUiThread(() -> {
if (dialog != null && !dialog.isShow()) {
dialog.show();
}
});
}
}
});
OSSAsyncTask task = oss.asyncPutObject(put, new OSSCompletedCallback<PutObjectRequest, PutObjectResult>() {
@Override
public void onSuccess(PutObjectRequest request, final PutObjectResult result) {
if (activity != null) {
activity.runOnUiThread(() -> {
if (dialog != null) {
dialog.dismiss();
}
});
}
String serverCallbackReturnBody = result.getServerCallbackReturnBody();
callback.getPicData(result, OssConfigBean.BUCKET_BASE_URL + OssConfigBean.BUCKET_OBJECT + name);
}
@Override
public void onFailure(PutObjectRequest request, ClientException clientExcepion, ServiceException serviceException) {
if (activity != null) {
activity.runOnUiThread(() -> {
if (dialog != null) {
dialog.dismiss();
}
});
}
String info = "";
// 请求异常
if (clientExcepion != null) {
// 本地异常如网络异常等
clientExcepion.printStackTrace();
info = clientExcepion.toString();
}
if (serviceException != null) {
// 服务异常
Log.e("ErrorCode", serviceException.getErrorCode());
Log.e("RequestId", serviceException.getRequestId());
Log.e("HostId", serviceException.getHostId());
Log.e("RawMessage", serviceException.getRawMessage());
info = serviceException.toString();
}
// task.cancel();
}
});
}
/**
* 上传次数
*/
int number;
/**
* 成功上传(本地文件名作为key,阿里云地址为value)
*/
List<String> success = new ArrayList<>();
/**
* 失败上传(返回失败文件的本地地址)
*/
List<String> failure = new ArrayList<>();
/**
* 批量上传图片
*
* @param localFiles
*/
public void asyncPutImages(final List<String> localFiles, final AppCompatActivity activity, PicsResultCallback callback) {
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
initDialog(activity);
if (dialog != null) {
dialog.show();
}
}
});
}
//初始化
number = 0;
success.clear();
failure.clear();
for (int i = 0; i < localFiles.size(); i++) {
File file = new File(localFiles.get(i));
if (!file.exists()) {
return;
}
String name = file.getName();
// 构造上传请求
PutObjectRequest put = new PutObjectRequest(OssConfigBean.bucket, OssConfigBean.BUCKET_OBJECT + name, localFiles.get(i));
put.setCRC64(OSSRequest.CRC64Config.YES);
oss.asyncPutObject(put, new OSSCompletedCallback<PutObjectRequest, PutObjectResult>() {
@Override
public void onSuccess(PutObjectRequest request, final PutObjectResult result) {
number++;
String aliPath = OssConfigBean.BUCKET_BASE_URL + OssConfigBean.BUCKET_OBJECT + name;
success.add(aliPath);
if (number == localFiles.size()) {
if (activity != null) {
activity.runOnUiThread(() -> {
if (dialog != null) {
dialog.dismiss();
}
});
}
//返回 上传路径,以及失败的路径
callback.onOssSuccess(success, failure);
}
}
@Override
public void onFailure(PutObjectRequest request, ClientException clientExcepion, ServiceException serviceException) {
number++;
String aliPath = OssConfigBean.BUCKET_BASE_URL + OssConfigBean.BUCKET_OBJECT + name;
failure.add(aliPath);
if (number == localFiles.size()) {
if (activity != null) {
activity.runOnUiThread(() -> {
if (dialog != null) {
dialog.dismiss();
}
});
}
callback.onOssSuccess(success, failure);
}
}
});
}
}
/**
* 图片以bitmap的形式上传
*
* @param object
* @param localFile
* @param mProgress
* @param img
* @param type
*/
public void asyncPutImage(String object, final Bitmap localFile, final ProgressBar mProgress, final ImageView img, String type) {
if (object.equals("")) {
Log.w("AsyncPutImage", "ObjectNull");
return;
}
if (localFile == null) {
Log.w("AsyncPutImage", "bitmapNull");
return;
}
// 构造上传请求
PutObjectRequest put = new PutObjectRequest(bucket, object, getBitmapByte(localFile));
//上传后回调通知
// 客户端在上传Object时可以指定OSS服务端在处理完上传请求后通知您的业务服务器在该服务器确认接收了该回调后将回调的结果返回给客户端
put.setCallbackParam(new HashMap<String, String>() {
{
put("callbackUrl", path);
put("callbackBody",
//参数跟后台商议
"filename=${object}&size=${size}&action=${x:action}}");
}
});
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("x:action", type);
put.setCallbackVars(hashMap);
OSSAsyncTask task = oss.asyncPutObject(put, new OSSCompletedCallback<PutObjectRequest, PutObjectResult>() {
@Override
public void onSuccess(PutObjectRequest request, final PutObjectResult result) {
Observable.just(result).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<PutObjectResult>() {
@Override
public void accept(PutObjectResult putObjectResult) throws Throwable {
callback.getPicData(result, "");
}
});
// Observable.just(result).observeOn(AndroidSchedulers.mainThread()).subscribe(putObjectResult -> callback.getPicData(result, ""));
}
@Override
public void onFailure(PutObjectRequest request, ClientException clientExcepion, ServiceException serviceException) {
String info = "";
// 请求异常
if (clientExcepion != null) {
// 本地异常如网络异常等
clientExcepion.printStackTrace();
info = clientExcepion.toString();
}
if (serviceException != null) {
// 服务异常
Log.e("ErrorCode", serviceException.getErrorCode());
Log.e("RequestId", serviceException.getRequestId());
Log.e("HostId", serviceException.getHostId());
Log.e("RawMessage", serviceException.getRawMessage());
info = serviceException.toString();
}
}
});
}
public byte[] getBitmapByte(Bitmap bitmap) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
try {
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
return out.toByteArray();
}
public interface picResultCallback {
void getPicData(PutObjectResult data, String netPath);
}
public interface PicsResultCallback {
void onOssSuccess(List<String> success, List<String> failure);
}
/**
* Gets the corresponding path to a file from the given content:// URI
* @param selectedVideoUri The content:// URI to find the file path from
* @param contentResolver The content resolver to use to perform the query.
* @return the file path as a string
*/
public String getFilePathFromContentUri(Uri selectedVideoUri,
ContentResolver contentResolver) {
String filePath;
String[] filePathColumn = {MediaStore.MediaColumns.DATA};
Cursor cursor = contentResolver.query(selectedVideoUri, filePathColumn, null, null, null);
// 也可用下面的方法拿到cursor
// Cursor cursor = this.context.managedQuery(selectedVideoUri, filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
filePath = cursor.getString(columnIndex);
cursor.close();
return filePath;
}
}

View File

@ -5,6 +5,7 @@ import DataManager
import RxHttpCallBack
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.dahe.gldriver.bean.GridBean
import com.dahe.glex.bean.UserBean
import com.dahe.glex.bean.UserParent
@ -12,20 +13,26 @@ import com.dahe.mylibrary.base.BaseFragment
import com.dahe.mylibrary.callback.RefreshCallBack
import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.utils.ActivityUtils
import com.dahe.mylibrary.utils.BaseUtils
import com.dahe.mylibrary.utils.ImageLoader
import com.dahe.mylibrary.utils.ToastUtils
import com.dhsd.glowner.R
import com.dhsd.glowner.adapter.GridItemAdapter
import com.dhsd.glowner.databinding.FragmentMineBinding
import com.dhsd.glowner.ui.WebActivity
import com.dhsd.glowner.ui.mine.activity.AuthPartyActivity
import com.dhsd.glowner.ui.mine.activity.ComProActivity
import com.dhsd.glowner.ui.mine.activity.RulesActivity
import com.dhsd.glowner.ui.mine.activity.SettingActivity
import com.dhsd.glowner.utils.AppVersionUtils
import com.tencent.bugly.crashreport.CrashReport
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
class MineFragment : BaseFragment<FragmentMineBinding>(), View.OnClickListener, RefreshCallBack {
private val tools = mutableListOf(
GridBean("车队管理", R.drawable.car_team),
GridBean("管理", R.drawable.car_manage),
GridBean("常用地址", R.drawable.car_team),
GridBean("车管理", R.drawable.car_manage),
GridBean("司机课堂", R.drawable.mine_class),
GridBean("评价管理", R.drawable.rate)
)
@ -130,31 +137,38 @@ class MineFragment : BaseFragment<FragmentMineBinding>(), View.OnClickListener,
private fun goPlats(pos: Int) {
when (pos) {
0 -> {
// ActivityUtils.startActivity(mContext, RulesActivity::class.java)
ActivityUtils.startActivity(mContext, RulesActivity::class.java)
}
1 -> {
// ActivityUtils.startActivity(mContext, CarsManActivity::class.java)
ActivityUtils.startActivity(mContext, ComProActivity::class.java)
}
2 -> {
ToastUtils.showToast(mContext, tools[pos].title)
BaseUtils.callPhone(activity as AppCompatActivity?, "13783631930")
// ToastUtils.showToast(mContext, plats[pos].title)
}
3 -> {
ToastUtils.showToast(mContext, tools[pos].title)
ActivityUtils.startActivity(mContext, WebActivity::class.java, Bundle().apply {
putString("title", "意见反馈")
putString("url", "https://support.qq.com/products/335639")
})
}
4 -> {
// ActivityUtils.startActivity(mContext, AuthPartyActivity::class.java)
ActivityUtils.startActivity(mContext, AuthPartyActivity::class.java)
}
5 -> {
AppVersionUtils.getInstance().checkVersion(mContext)
}
6 -> {
ActivityUtils.startActivity(mContext, WebActivity::class.java, Bundle().apply {
putString("title", "关于我们")
putString("url", "http://www.dahehuoyun.com/index.html")
})
}
7 -> {

View File

@ -0,0 +1,108 @@
package com.dhsd.glowner.ui.mine.activity
import BaseObserver
import RxHttpCallBack
import android.os.Bundle
import com.dahe.gldriver.bean.Material
import com.dahe.gldriver.bean.UpPart
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.utils.ImageLoader
import com.dahe.mylibrary.utils.PickerUtils
import com.dhsd.glowner.R
import com.dhsd.glowner.databinding.ActivityAuthPartyBinding
import com.dhsd.glowner.utils.OcrUtils
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
/**
* @ClassName AuthPartyActivity
* @Author john
* @Date 2024/2/1 11:20
* @Description 党员认证
*/
class AuthPartyActivity : BaseActivity<ActivityAuthPartyBinding>() {
var upPart = UpPart()
override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white)
setTitleBar("党员认证", true)
binding.run {
tvData.setOnClickListener {
PickerUtils.getInstance().showDate(this@AuthPartyActivity) {
upPart.partyMembershipTime = it
tvData.text = it
}
}
tvAddress.setOnClickListener {
PickerUtils.getInstance()
.showAddress(this@AuthPartyActivity) { province, city, county ->
upPart.run {
this.province = province.name
this.city = city.name
this.area = county.name
this.provinceCode = county.code
this.cityCode = city.code
this.areaCode = county.code
this.provinceCityArea =
"""${province.name}-${city.name}-${county.name}"""
}
tvAddress.text = """${province.name}-${city.name}-${county.name}"""
}
}
ivUp.setOnClickListener {
OcrUtils.getInstance().noOcrUpPic(mContext, this@AuthPartyActivity) { picPath, _ ->
upPart.materialList.add(0, Material(materialUrl = picPath.picPath))
ImageLoader.getInstance()
.loadRoundImage(mContext, picPath.locPic, 12, ivUp)
}
}
btnOk.setOnClickListener {
subMit()
}
}
}
override fun initDate() {
DataManager.getInstance().getCpcAuthenticationInfo()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext,object :RxHttpCallBack<UpPart>(){
override fun onSuccess(t: CommonResponseBean<UpPart>) {
super.onSuccess(t)
t.data?.let {
upPart = it
binding.run {
tvData.text = it.partyMembershipTime
tvAddress.text = it.provinceCityArea
etAddress.setText(it.address)
ImageLoader.getInstance().loadRoundImage(mContext,it.materialList[0].materialUrl,12,ivUp)
}
}
}
}))
}
private fun subMit() {
if (binding.tvData.text.isNullOrEmpty() ||
binding.tvAddress.text.isNullOrEmpty() ||
binding.etAddress.text.isNullOrEmpty()||
upPart.materialList.size==0
) {
showToast("请完善信息")
return
}
upPart.address = binding.etAddress.text.toString()
DataManager.getInstance().submitToCpcAuthentication(upPart)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<Any>() {
override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t)
finish()
}
}))
}
}

View File

@ -0,0 +1,73 @@
package com.dhsd.glowner.ui.mine.activity
import BaseObserver
import RxHttpCallBack
import android.graphics.Color
import android.os.Bundle
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.bean.ProBean
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.recycleviewswipe.RecycleViewDivider
import com.dahe.mylibrary.utils.ActivityUtils
import com.dahe.mylibrary.utils.ConvertUtils
import com.dhsd.glowner.R
import com.dhsd.glowner.adapter.ComProAdatper
import com.dhsd.glowner.databinding.ActivityComProBinding
import com.google.gson.Gson
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
/**
* @ClassName ComProActivity
* @Author john
* @Date 2024/3/25 16:42
* @Description 常见问题
*/
class ComProActivity : BaseActivity<ActivityComProBinding>() {
lateinit var adapter: ComProAdatper
override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white)
setTitleBar("常见问题", true)
binding.run {
adapter = recycler.run {
layoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
addItemDecoration(
RecycleViewDivider(
LinearLayout.VERTICAL,
ConvertUtils.dp2px(10.0f),
Color.TRANSPARENT
)
)
adapter = ComProAdatper()
adapter as ComProAdatper
}.apply {
setOnItemClickListener { _, _, position ->
ActivityUtils.startActivity(
mContext,
ComProDetailActivity::class.java,
Bundle().apply {
putString(AppConfig.BEAN, Gson().toJson(items[position]))
})
}
}
}
}
override fun initDate() {
DataManager.getInstance().commonProblemList()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<MutableList<ProBean>>() {
override fun onSuccess(t: CommonResponseBean<MutableList<ProBean>>) {
super.onSuccess(t)
adapter.submitList(t.data)
}
}))
}
}

View File

@ -0,0 +1,85 @@
package com.dhsd.glowner.ui.mine.activity
import BaseObserver
import RxHttpCallBack
import android.graphics.Bitmap
import android.os.Bundle
import android.text.Html
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
import android.widget.FrameLayout
import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.bean.ProBean
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.net.CommonResponseBean
import com.dhsd.glowner.R
import com.dhsd.glowner.databinding.ActivityComProDetailBinding
import com.google.gson.Gson
import com.just.agentweb.AgentWeb
import com.just.agentweb.AgentWebUIControllerImplBase
import com.just.agentweb.WebChromeClient
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
/**
* @ClassName ComProActivity
* @Author john
* @Date 2024/3/25 16:42
* @Description 问题详情
*/
class ComProDetailActivity : BaseActivity<ActivityComProDetailBinding>() {
private var mAgentWeb: AgentWeb? = null
override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white)
setTitleBar("常见问题", true)
mAgentWeb = AgentWeb.with(this)
.setAgentWebParent(binding.WebViewLayout, FrameLayout.LayoutParams(-1, -1))
.useDefaultIndicator()
.setWebChromeClient(mWebChromeClient)
.setSecurityType(AgentWeb.SecurityType.DEFAULT_CHECK)
.setAgentWebUIController(AgentWebUIControllerImplBase())
.createAgentWeb()
.ready()
.go("")
}
override fun initDate() {
var proBean = Gson().fromJson<ProBean>(intent.extras?.getString(AppConfig.BEAN), ProBean::class.java)
binding.run {
tvTitle.text = proBean.problemName
}
DataManager.getInstance().commonProblemDetail(proBean.problemId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<ProBean>() {
override fun onSuccess(t: CommonResponseBean<ProBean>) {
super.onSuccess(t)
binding.run {
mAgentWeb?.webCreator?.webView?.loadDataWithBaseURL(null,t.data.contentData,"text/html" , "utf-8", null)
// mAgentWeb?.webCreator?.webView?.postUrl(mUrl, postData.toByteArray())
}
}
}))
}
private val mWebChromeClient: WebChromeClient = object : WebChromeClient() {
override fun onProgressChanged(view: WebView, newProgress: Int) {
super.onProgressChanged(view, newProgress)
}
override fun onReceivedTitle(view: WebView, title: String) {
super.onReceivedTitle(view, title)
// setTitleBar(
// if (TextUtils.isEmpty(mTitle)) title else mTitle
// ) { if (!mAgentWeb!!.back()) finish() }
}
}
}

View File

@ -0,0 +1,45 @@
package com.dhsd.glowner.ui.mine.activity
import android.content.Intent
import android.os.Bundle
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.utils.ActivityUtils
import com.dhsd.glowner.R
import com.dhsd.glowner.databinding.ActivityRulesBinding
import com.dhsd.glowner.ui.WebActivity
/**
* @ClassName RulesActivity
* @Author john
* @Date 2024/2/1 11:06
* @Description 平台规则
*/
class RulesActivity : BaseActivity<ActivityRulesBinding>() {
override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white)
setTitleBar("平台规则",true)
binding.run {
rlOne.setOnClickListener {
ActivityUtils.startActivity(mContext, WebActivity::class.java,Bundle().apply {
putString("url","http://agreement.dahehuoyun.com/#/user")
putString("title","用户服务协议")
})
}
rlTwo.setOnClickListener {
ActivityUtils.startActivity(mContext,WebActivity::class.java,Bundle().apply {
putString("title","隐私协议")
putString("url","http://agreement.dahehuoyun.com/huawei/#/private")
})
}
rlThree.setOnClickListener {
ActivityUtils.startActivity(mContext,WebActivity::class.java,Bundle().apply {
putString("url","www.baidu.com")
})
}
}
}
override fun initDate() {
}
}

View File

@ -3,8 +3,11 @@ package com.dhsd.glowner.utils
import BaseObserver
import RxHttpCallBack
import android.content.Context
import com.dahe.glex.bean.AppVersion
import com.dahe.mylibrary.base.SingletonNoPHolder
import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.utils.AppUtils
import com.dahe.mylibrary.utils.ToastUtils
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
@ -18,18 +21,18 @@ class AppVersionUtils private constructor() {
companion object : SingletonNoPHolder<AppVersionUtils>(::AppVersionUtils)
fun checkVersion(context: Context) {
// DataManager.getInstance().getLastAppVersion()
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(BaseObserver(context, object : RxHttpCallBack<AppVersion>() {
// override fun onSuccess(t: CommonResponseBean<AppVersion>) {
// super.onSuccess(t)
// if (t.data.versionCode> AppUtils.getAppVersionCode()) {
// CommonPopUtils.getInstance().showUpApp(context,t.data)
// } else {
// ToastUtils.showToast(context, "已是最新版本")
// }
// }
// }))
DataManager.getInstance().getLastAppVersion()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseObserver(context, object : RxHttpCallBack<AppVersion>() {
override fun onSuccess(t: CommonResponseBean<AppVersion>) {
super.onSuccess(t)
if (t.data.versionCode> AppUtils.getAppVersionCode()) {
CommonPopUtils.getInstance().showUpApp(context,t.data)
} else {
ToastUtils.showToast(context, "已是最新版本")
}
}
}))
}
}

View File

@ -4,7 +4,11 @@ import android.content.Context
import android.graphics.Color
import android.widget.ImageView
import androidx.recyclerview.widget.RecyclerView
import com.arpa.hndahesudintocctmsdriver.weight.pop.UpAppPop
import com.dahe.glex.bean.AppVersion
import com.dahe.mylibrary.base.SingletonNoPHolder
import com.dahe.mylibrary.callback.OnPicResultListener
import com.dahe.mylibrary.pop.PopNorBottomPic
import com.dhsd.glowner.bean.PopBean
import com.dhsd.glowner.cuspop.OnCarSelectListener
import com.dhsd.glowner.cuspop.PopBottomCar
@ -62,4 +66,38 @@ class CommonPopUtils private constructor() {
.show()
}
/**
* 选择照片 拍照或者相机
*
* @param ctx
* @param listenter
*/
fun showSimSelPic(ctx: Context, listenter: OnPicResultListener){
XPopup.Builder(ctx)
.dismissOnTouchOutside(true)
.asCustom(PopNorBottomPic(ctx, "", listenter))
.show()
}
/**
* app版本检查
* @param context Context
* @param appVersion AppVersion
*/
fun showUpApp(context: Context, appVersion: AppVersion) {
XPopup.Builder(context)
.dismissOnBackPressed(false)
.dismissOnTouchOutside(false)
.asCustom(
UpAppPop(
context,
appVersion
)
)
.show()
}
}

View File

@ -0,0 +1,482 @@
package com.dhsd.glowner.utils
import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import com.dahe.mylibrary.base.SingletonNoPHolder
import com.dhsd.glowner.callback.OnOcrPicResultListener
import com.dhsd.glowner.callback.PicPath
import com.dhsd.glowner.oss.OssServiceUtil
import com.luck.picture.lib.config.PictureMimeType
import com.luck.picture.lib.utils.DateUtils
import com.lxj.xpopup.XPopup
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers
import top.zibin.luban.Luban
import top.zibin.luban.OnNewCompressListener
import java.io.File
/**
* @ClassName OcrUtils
* @Author john
* @Date 2024/2/28 17:11
* @Description TODO
*/
class OcrUtils private constructor() {
companion object : SingletonNoPHolder<OcrUtils>(::OcrUtils)
// /**
// * 身份证识别
// * */
// fun ocrPerson(context: Context,picUrl: String = "", activity: AppCompatActivity, listener: OnOcrPicResultListener) {
// PopsUtils.getInstance().showSimSelPic2(context,picUrl) { result ->
// LoadingUtils.instance.showLoading(activity)
// //上传oss得到图片地址
// OssServiceUtil.getInstance().run {
// asyncPutImage(result[0].realPath, null)
// setResultCallBack { data, oldPath ->
// DataManager.getInstance().recognizeIdcard(oldPath)
// .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
// .subscribe(BaseObserver(context, object : RxHttpCallBack<OcrPersonBean>() {
// override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
// super.onSuccess(t)
// LoadingUtils.instance.dissLoading()
// t.data?.let {
// listener.onSuccResult(
// PicPath(result[0].realPath, oldPath), it
// )
// }
// }
//
// override fun onCodeError(
// mContext: Context?,
// t: CommonResponseBean<OcrPersonBean>
// ) {
//// super.onCodeError(mContext, t)
// LoadingUtils.instance.dissLoading()
// if (t.code == 500) {
//// if (t.msg.contains("code: 400, The image type does not match the API operation")) {
// ToastUtils.showToast(mContext, "图片识别失败,请重新上传")
//// } else {
//// ToastUtils.showToast(mContext, t.msg)
//// }
// }
// }
// }))
// }
// }
// }
// }
//
//
//
// /**
// * 身份证识别
// * */
// fun ocrPerson(context: Context, activity: AppCompatActivity, listener: OnOcrPicResultListener) {
// PopsUtils.getInstance().showSimSelPic(context) { result ->
// LoadingUtils.instance.showLoading(activity)
// //上传oss得到图片地址
// OssServiceUtil.getInstance().run {
// asyncPutImage(result[0].availablePath, null)
// setResultCallBack { data, oldPath ->
// DataManager.getInstance().recognizeIdcard(oldPath)
// .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
// .subscribe(BaseObserver(context, object : RxHttpCallBack<OcrPersonBean>() {
// override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
// super.onSuccess(t)
// LoadingUtils.instance.dissLoading()
// t.data?.let {
// listener.onSuccResult(
// PicPath(result[0].realPath, oldPath), it
// )
// }
// }
//
// override fun onCodeError(
// mContext: Context?,
// t: CommonResponseBean<OcrPersonBean>
// ) {
//// super.onCodeError(mContext, t)
// LoadingUtils.instance.dissLoading()
// if (t.code == 500) {
//// if (t.msg.contains("code: 400, The image type does not match the API operation")) {
// ToastUtils.showToast(mContext, "图片识别失败,请重新上传")
//// } else {
//// ToastUtils.showToast(mContext, t.msg)
//// }
// }
// }
// }))
// }
// }
// }
// }
//
//
// /**
// * 上传oss并ocr识别
// * @param context Context
// * @param picPath String
// * @param activity AppCompatActivity
// * @param listener OnOcrPicResultListener
// */
// fun onlyOcrPerson(context: Context,picPath: String, activity: AppCompatActivity, listener: OnOcrPicResultListener){
// //上传oss得到图片地址
// LoadingUtils.instance.showLoading(activity)
//
// //压缩
// Luban.with(context).load(picPath).ignoreBy(30).setRenameListener { filePath ->
// val indexOf = filePath.lastIndexOf(".")
// val postfix = if (indexOf != -1) filePath.substring(indexOf) else ".jpg"
// DateUtils.getCreateFileName("CMP_") + postfix
// }.filter { path ->
// if (PictureMimeType.isUrlHasImage(path) && !PictureMimeType.isHasHttp(path)) {
// true
// } else !PictureMimeType.isUrlHasGif(path)
// }.setCompressListener(object : OnNewCompressListener {
// override fun onStart() {}
// override fun onSuccess(source: String, compressFile: File) {
// OssServiceUtil.getInstance().run {
// asyncPutImage(compressFile.absolutePath, null)
// setResultCallBack { data, oldPath ->
// DataManager.getInstance().recognizeIdcard(oldPath)
// .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
// .subscribe(BaseObserver(context, object : RxHttpCallBack<OcrPersonBean>() {
// override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
// super.onSuccess(t)
// LoadingUtils.instance.dissLoading()
// t.data?.let {
// listener.onSuccResult(
// PicPath(picPath, oldPath), it
// )
// }
// }
//
// override fun onCodeError(
// mContext: Context?,
// t: CommonResponseBean<OcrPersonBean>
// ) {
//// super.onCodeError(mContext, t)
// LoadingUtils.instance.dissLoading()
// if (t.code == 500) {
//// if (t.msg.contains("code: 400, The image type does not match the API operation")) {
// ToastUtils.showToast(mContext, "图片识别失败,请重新上传")
//// } else {
//// ToastUtils.showToast(mContext, t.msg)
//// }
// }
// }
// }))
// }
// }
//
// }
//
// override fun onError(source: String, e: Throwable) {
// LoadingUtils.instance.dissLoading()
//// call?.onCallback(source, null)
// }
// }).launch()
//
//
//
//
// }
//
//
// /**
// * 驾驶证ocr识别
// * */
// fun ocrDriver(context: Context, activity: AppCompatActivity, listener: OnOcrPicResultListener) {
// PopsUtils.getInstance().showSimSelPic(context) { result ->
// LoadingUtils.instance.showLoading(activity)
// //上传oss得到图片地址
// OssServiceUtil.getInstance().run {
// asyncPutImage(result[0].availablePath, null)
// setResultCallBack { data, oldPath ->
// DataManager.getInstance().recognizeDrivingLicense(oldPath)
// .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// BaseObserver(
// context,
// object : RxHttpCallBack<OcrPersonBean>() {
// override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
// super.onSuccess(t)
// LoadingUtils.instance.dissLoading()
// t.data?.let {
// listener.onSuccResult(
// PicPath(
// result[0].realPath,
// oldPath
// ), it
// )
// }
// }
//
// override fun onCodeError(
// mContext: Context?,
// t: CommonResponseBean<OcrPersonBean>
// ) {
//// super.onCodeError(mContext, t)
// LoadingUtils.instance.dissLoading()
// if (t.code == 500) {
//// if (t.msg.contains("code: 400, The image type does not match the API operation")) {
// ToastUtils.showToast(
// mContext,
// "图片识别失败,请重新上传"
// )
//// } else {
//// ToastUtils.showToast(mContext, t.msg)
//// }
// }
// }
// })
// )
// }
// }
// }
// }
//
//
// /**
// * 行驶证ocr识别
// * */
// fun ocrDriveing(
// context: Context,
// activity: AppCompatActivity,
// listener: OnOcrPicResultListener
// ) {
// PopsUtils.getInstance().showSimSelPic(context) { result ->
// LoadingUtils.instance.showLoading(activity)
// //上传oss得到图片地址
// OssServiceUtil.getInstance().run {
// asyncPutImage(result[0].availablePath, null)
// setResultCallBack { data, oldPath ->
// DataManager.getInstance().recognizeVehicleLicense(oldPath)//行驶证识别
// .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// BaseObserver(
// context,
// object : RxHttpCallBack<OcrPersonBean>() {
// override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
// super.onSuccess(t)
// LoadingUtils.instance.dissLoading()
// t.data?.let {
// listener.onSuccResult(
// PicPath(
// result[0].realPath,
// oldPath
// ), it
// )
// }
// }
//
// override fun onCodeError(
// mContext: Context?,
// t: CommonResponseBean<OcrPersonBean>
// ) {
//// super.onCodeError(mContext, t)
// LoadingUtils.instance.dissLoading()
// if (t.code == 500) {
//// if (t.msg.contains("code: 400, The image type does not match the API operation")) {
// ToastUtils.showToast(
// mContext,
// "图片识别失败,请重新上传"
// )
//// } else {
//// ToastUtils.showToast(mContext, t.msg)
//// }
// }
// }
// })
// )
// }
// }
// }
// }
//
//
// /**
// * 银行卡ocr识别
// * */
// fun ocrBankCard(
// context: Context,
// activity: AppCompatActivity,
// listener: OnOcrPicResultListener
// ) {
// PopsUtils.getInstance().showSimSelPic(context) { result ->
// //上传oss得到图片地址
// OssServiceUtil.getInstance().run {
// asyncPutImage(result[0].availablePath, activity)
// setResultCallBack { data, oldPath ->
// DataManager.getInstance().recognizeBankCard(oldPath)
// .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// BaseObserver(
// context,
// object : RxHttpCallBack<OcrPersonBean>(activity) {
// override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
// super.onSuccess(t)
// t.data?.let {
// listener.onSuccResult(
// PicPath(
// result[0].realPath,
// oldPath
// ), it
// )
// }
// }
//
// override fun onCodeError(
// mContext: Context?,
// t: CommonResponseBean<OcrPersonBean>
// ) {
//// super.onCodeError(mContext, t)
// LoadingUtils.instance.dissLoading()
// if (t.code == 500) {
//// if (t.msg.contains("code: 400, The image type does not match the API operation")) {
// ToastUtils.showToast(
// mContext,
// "图片识别失败,请重新上传"
// )
//// } else {
//// ToastUtils.showToast(mContext, t.msg)
//// }
// }
// }
// })
// )
// }
// }
// }
// }
//
//
// /**
// * 营业执照ocr识别
// * */
// fun ocrBusinessCard(
// context: Context,
// activity: AppCompatActivity,
// listener: OnOcrPicResultListener
// ) {
// PopsUtils.getInstance().showSimSelPic(context) { result ->
// //上传oss得到图片地址
// OssServiceUtil.getInstance().run {
// asyncPutImage(result[0].availablePath, activity)
// setResultCallBack { data, oldPath ->
// DataManager.getInstance().recognizeBusinessLicense(oldPath)
// .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// BaseObserver(
// context,
// object : RxHttpCallBack<OcrPersonBean>(activity) {
// override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
// super.onSuccess(t)
// t.data?.let {
// listener.onSuccResult(
// PicPath(
// result[0].realPath,
// oldPath
// ), it
// )
// }
// }
//
// override fun onCodeError(
// mContext: Context?,
// t: CommonResponseBean<OcrPersonBean>
// ) {
//// super.onCodeError(mContext, t)
// LoadingUtils.instance.dissLoading()
// if (t.code == 500) {
//// if (t.msg.contains("code: 400, The image type does not match the API operation")) {
// ToastUtils.showToast(
// mContext,
// "图片识别失败,请重新上传"
// )
//// } else {
//// ToastUtils.showToast(mContext, t.msg)
//// }
// }
// }
// })
// )
// }
// }
// }
// }
//
// /**
// * 车牌号码ocr识别
// * */
// fun ocrCarNumber(
// context: Context,
// picPath: String,
// activity: AppCompatActivity,
// listener: OnOcrCarNumListener
// ) {
// DataManager.getInstance().recognizeCarNumber(picPath)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// BaseObserver(activity,
// object : RxHttpCallBack<OcrPersonBean>() {
// override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
// super.onSuccess(t)
// if (t.data.data.info != null && t.data.data.info.isNotEmpty() && RegexpUtils.isPlateNumber(
// t.data.data.info[0].value
// )
// ) {
// listener.onSuccResult(t.data.data.info[0].value)
// } else {
// ToastUtils.showToast(
// activity,
// "未识别出车牌号码,请重新拍摄"
// )
// }
//
// }
//
// override fun onCodeError(
// mContext: Context?,
// t: CommonResponseBean<OcrPersonBean>
// ) {
//// super.onCodeError(mContext, t)
// LoadingUtils.instance.dissLoading()
// if (t.code == 500) {
// ToastUtils.showToast(
// mContext,
// "未识别出车牌号码,请重新拍摄"
// )
// }
// }
// })
// )
// }
fun noOcrUpPic(
context: Context,
activity: AppCompatActivity,
listener: OnOcrPicResultListener
) {
CommonPopUtils.getInstance().showSimSelPic(context) {
var data = it[0]
OssServiceUtil.getInstance().run {
asyncPutImage(data.availablePath, activity)
setResultCallBack { data, oldPath ->
activity.runOnUiThread {
listener.onSuccResult(
PicPath(it[0].realPath, oldPath), null
)
}
}
}
}
}
}

View File

@ -0,0 +1,118 @@
package com.arpa.hndahesudintocctmsdriver.weight.pop
import android.content.Context
import android.util.Log
import android.view.View
import android.view.View.OnClickListener
import android.widget.Button
import android.widget.ImageButton
import android.widget.LinearLayout
import android.widget.ProgressBar
import android.widget.TextView
import com.dahe.glex.bean.AppVersion
import com.dhsd.glowner.R
import com.king.app.updater.AppUpdater
import com.king.app.updater.callback.AppUpdateCallback
import com.king.app.updater.constant.Constants
import com.lxj.xpopup.core.CenterPopupView
import java.io.File
/**
* @author hlh
* @version 1.0.0
* @date 2021/9/6 17:23
* @description:
*/
class UpAppPop : CenterPopupView {
private var content: TextView? = null
private var vs: TextView? = null
private var tvContent: TextView? = null
private var tv_cancel: Button? = null
private var tv_confirm: Button? = null
private var tvOk: Button? = null
private var up_div: LinearLayout? = null
private var con: Context? = null
private var progress_view: ProgressBar? = null
private var force_box: LinearLayout? = null
private var force_btn: ImageButton? = null
private var appVersion : AppVersion? = null
constructor(
context: Context,
appVersion: AppVersion
) : super(context) {
con = context
this.appVersion = appVersion
}
override fun getImplLayoutId(): Int {
return R.layout.alert_up_app
}
constructor(context: Context) : super(context)
override fun onCreate() {
super.onCreate()
content = findViewById(R.id.tv_content)
tv_cancel = findViewById(R.id.tv_cancel)
tv_confirm = findViewById(R.id.tv_confirm)
tvContent = findViewById(R.id.tvContent)
tvOk = findViewById<Button>(R.id.tvOk)
up_div = findViewById<LinearLayout>(R.id.up_div)
progress_view = findViewById<ProgressBar>(R.id.progress)
content = findViewById(R.id.tv_content)
force_box = findViewById<LinearLayout>(R.id.force_box)
force_btn = findViewById<ImageButton>(R.id.force_btn)
if (appVersion?.force == "1") {
force_box?.setVisibility(GONE)
}
force_btn?.setOnClickListener(OnClickListener { v: View? ->
visibility = GONE
dismiss()
})
vs = findViewById<TextView>(R.id.vs)
content?.setText(appVersion?.content)
vs?.setText(appVersion?.versionName)
tv_cancel?.setOnClickListener(OnClickListener { v: View? -> System.exit(1) })
tv_confirm?.setOnClickListener(OnClickListener { v: View? ->
AppUpdater.Builder(con!!)
.setUrl(appVersion!!.downloadUrl)
.build()
.setUpdateCallback(object : AppUpdateCallback() {
override fun onStart(url: String) {
super.onStart(url)
tv_confirm!!.visibility = GONE
up_div?.setVisibility(VISIBLE)
}
override fun onProgress(progress: Long, total: Long, isChange: Boolean) {
// Log.e("progress",progress+"");
// Log.e("total",total+"");
// Log.e("isChange",isChange+"");
val sum = progress.toFloat()
val max = total.toFloat()
if (progress > 0) {
val b = sum / max
Log.e("百分比", (100 * b).toString() + "")
progress_view?.setProgress((100 * b).toInt())
}
}
override fun onFinish(file: File) {
tvContent?.setText("下载完成,请及时安装!")
tvOk?.setVisibility(VISIBLE)
tvOk?.setOnClickListener(OnClickListener { v1: View? ->
com.king.app.updater.util.AppUtils.installApk(
context,
file,
context.packageName + Constants.DEFAULT_FILE_PROVIDER
)
})
}
})
.start()
})
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View 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="#ffededf2" />
<corners android:topLeftRadius="@dimen/dp_29" android:topRightRadius="@dimen/dp_29"
android:bottomLeftRadius="@dimen/dp_29" android:bottomRightRadius="@dimen/dp_29" />
</shape>
</item>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 进度条的背景色-->
<item android:id="@android:id/background">
<shape>
<corners android:radius="@dimen/dp_14" />
<solid android:color="#F2F2F7" />
</shape>
</item>
<!-- 缓冲进度条的背景色-->
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="@dimen/dp_12" />
<solid android:color="@color/theme_color" />
</shape>
</clip>
</item>
<!-- 进度条的背景色-->
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="@dimen/dp_14" />
<solid android:color="@color/theme_color"/>
</shape>
</clip>
</item>
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View File

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/common_toolbar"></include>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFEFE8"
android:padding="@dimen/sp_18"
android:text="请详细认真填写党员认证信息,方便系统进行审核。审 核将在一般在1-3个工作日内完成。请耐心等待。"
android:textColor="#FF5F20"
android:textSize="@dimen/sp_14" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_28"
android:layout_marginTop="@dimen/dp_14"
android:text="党员信息"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_15"
android:background="@color/white"
app:cardCornerRadius="@dimen/dp_8">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_58"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_13"
android:paddingRight="@dimen/dp_13">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="入党时间"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
<TextView
android:id="@+id/tvData"
android:layout_weight="1"
android:gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableRight="@drawable/right_gray"
android:drawablePadding="@dimen/dp_6"
android:hint="请选择入党时间"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_58"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_13"
android:paddingRight="@dimen/dp_13">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="党组织关系所在省市"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
<TextView
android:id="@+id/tvAddress"
android:layout_weight="1"
android:gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableRight="@drawable/right_gray"
android:drawablePadding="@dimen/dp_6"
android:hint="请选择有效期至"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="@dimen/dp_58"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_13"
android:paddingRight="@dimen/dp_13">
<TextView
android:layout_width="@dimen/dp_170"
android:layout_height="wrap_content"
android:text="党组织关系所在地区 (县)街道(乡)"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
<EditText
android:id="@+id/etAddress"
android:layout_weight="1"
android:gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:paddingRight="@dimen/dp_8"
android:hint="请输入详细地址"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_28"
android:layout_marginTop="@dimen/dp_14"
android:text="证明材料"
android:textColor="@color/black"
android:textSize="@dimen/sp_15" />
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_165"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_15"
android:background="@color/white"
app:cardCornerRadius="@dimen/dp_8">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/ivUp"
android:layout_width="@dimen/dp_100"
android:layout_height="@dimen/dp_100"
android:background="@drawable/icon_add_pic" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:text="点击上传"
android:textColor="@color/black"
android:textSize="@dimen/sp_12" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/white"></View>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_70"
android:background="@color/white"
android:gravity="center"
android:paddingLeft="@dimen/dp_15"
android:paddingRight="@dimen/dp_15">
<Button
android:id="@+id/btnOk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_btn"
android:text="立即提交"
android:textColor="@color/white"
android:textSize="@dimen/sp_17">
</Button>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_F5"
android:orientation="vertical">
<include layout="@layout/common_toolbar"></include>
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_170"
android:background="@drawable/bg_com_pro" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginRight="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_15"
android:layout_weight="1" />
<LinearLayout
android:visibility="gone"
android:id="@+id/llBtn"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_70"
android:background="@color/white"
android:gravity="center"
android:paddingLeft="@dimen/dp_15"
android:paddingRight="@dimen/dp_15">
<Button
android:id="@+id/btnOk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_btn"
android:text="联系人工客服"
android:textColor="@color/white"
android:textSize="@dimen/sp_17">
</Button>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_F5"
android:orientation="vertical">
<include layout="@layout/common_toolbar"></include>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:background="@color/white"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="@dimen/dp_21"
android:layout_height="@dimen/dp_21"
android:layout_marginLeft="@dimen/dp_12"
android:background="@drawable/icon_pro" />
<TextView
android:id="@+id/tvTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_8"
android:maxLines="1"
android:singleLine="true"
android:text="怎么进行实名认证?"
android:textColor="@color/black"
android:textSize="@dimen/sp_16"
/>
</LinearLayout>
<!-- <WebView-->
<!-- android:id="@+id/webview"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- />-->
<FrameLayout
android:id="@+id/WebViewLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_12">
</FrameLayout>
</LinearLayout>

View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/common_toolbar"></include>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_15"
android:background="@color/white"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rlOne"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_80"
android:paddingLeft="@dimen/dp_15"
android:paddingTop="@dimen/dp_16"
android:paddingRight="@dimen/dp_15">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="大河好运用户服务协议"
android:textColor="@color/black"
android:textSize="@dimen/sp_16" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_30"
android:text="更新时间2023-12-22"
android:textColor="@color/color_9"
android:textSize="@dimen/sp_12" />
<ImageView
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:background="@drawable/right_gray"
/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_alignParentBottom="true"
android:layout_marginTop="@dimen/dp_20"
android:background="@color/color_c" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlTwo"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_80"
android:paddingLeft="@dimen/dp_15"
android:paddingTop="@dimen/dp_16"
android:paddingRight="@dimen/dp_15">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="隐私协议"
android:textColor="@color/black"
android:textSize="@dimen/sp_16" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_30"
android:text="更新时间2023-12-22"
android:textColor="@color/color_9"
android:textSize="@dimen/sp_12" />
<ImageView
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:background="@drawable/right_gray"
/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_alignParentBottom="true"
android:layout_marginTop="@dimen/dp_20"
android:background="@color/color_c" />
</RelativeLayout>
<RelativeLayout
android:visibility="gone"
android:id="@+id/rlThree"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_80"
android:paddingLeft="@dimen/dp_15"
android:paddingTop="@dimen/dp_16"
android:paddingRight="@dimen/dp_15">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="货物运输协议(代开发票)"
android:textColor="@color/black"
android:textSize="@dimen/sp_16" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_30"
android:text="更新时间2023-12-22"
android:textColor="@color/color_9"
android:textSize="@dimen/sp_12" />
<ImageView
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_width="@dimen/dp_15"
android:layout_height="@dimen/dp_15"
android:background="@drawable/right_gray"
/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_alignParentBottom="true"
android:layout_marginTop="@dimen/dp_20"
android:background="@color/color_c" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_bai"
android:orientation="vertical"
android:paddingBottom="@dimen/dp_1">
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/dp_163"
android:src="@drawable/up_img_1"/>
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="#333333"
android:text="最新版本"
android:textSize="@dimen/sp_17"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:layout_marginLeft="@dimen/dp_65"
android:layout_marginRight="@dimen/dp_65"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:background="#999999"
android:alpha="0.5"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
<TextView
android:id="@+id/vs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1.0.0新版本"
android:textColor="#ff999999"
android:textSize="@dimen/sp_10"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#fff"
android:paddingLeft="@dimen/dp_4"
android:paddingRight="@dimen/dp_4"
/>
</RelativeLayout>
<TextView
android:layout_marginLeft="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_9"
android:id="@+id/tv_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="更新内容"
android:textColor="#666666"
android:textSize="@dimen/sp_12"
android:gravity="left"
/>
<View
android:layout_marginLeft="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_14"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:background="#000000"
android:alpha="0.1"/>
<LinearLayout
android:layout_marginTop="@dimen/dp_8"
android:layout_marginBottom="@dimen/dp_12"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_marginLeft="@dimen/dp_18"
android:id="@+id/tv_cancel"
android:layout_width="0dp"
android:layout_height="@dimen/dp_36"
android:layout_weight="1"
android:text="取消"
android:textSize="@dimen/sp_14"
android:textColor="#ffa2a2b3"
android:background="@drawable/bg_btn_blue"
android:layout_marginBottom="@dimen/dp_3"
android:visibility="gone"/>
<Button
android:layout_marginLeft="@dimen/dp_18"
android:layout_marginRight="@dimen/dp_18"
android:id="@+id/tv_confirm"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="立即更新"
android:textColor="@color/theme_color"
android:textSize="@dimen/sp_17"
android:background="@null"
android:layout_marginBottom="@dimen/dp_3"/>
</LinearLayout>
<LinearLayout
android:layout_marginTop="@dimen/dp_8"
android:layout_marginBottom="@dimen/dp_12"
android:id="@+id/up_div"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<ProgressBar
android:layout_marginLeft="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_30"
android:id="@+id/progress"
android:layout_width="match_parent"
android:progress="0"
android:minHeight="@dimen/dp_12"
android:minWidth="@dimen/dp_12"
style="?android:attr/progressBarStyleHorizontal"
android:layout_height="@dimen/dp_12"
android:layout_gravity="center"
android:progressDrawable="@drawable/par_bg"
/>
<TextView
android:id="@+id/tvContent"
android:layout_marginTop="@dimen/dp_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="飞速下载中"
android:textColor="#ff999999"
android:textSize="@dimen/sp_8"
android:layout_gravity="center"
/>
</LinearLayout>
<Button
android:visibility="gone"
android:layout_marginLeft="@dimen/dp_18"
android:layout_marginRight="@dimen/dp_18"
android:id="@+id/tvOk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="立即安装"
android:textColor="@color/theme_color"
android:textSize="@dimen/sp_17"
android:background="@null"
android:layout_marginBottom="@dimen/dp_13"/>
</LinearLayout>
<LinearLayout
android:id="@+id/force_box"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_gravity="center"
android:layout_width="@dimen/dp_1"
android:layout_height="@dimen/dp_50"
android:background="#EFEFEF"/>
<ImageButton
android:id="@+id/force_btn"
android:layout_width="@dimen/dp_30"
android:layout_height="@dimen/dp_30"
android:src="@drawable/icon_close"
android:scaleType="fitXY"
android:layout_gravity="center"
android:background="@null"/>
</LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_bg8"
android:gravity="center_vertical"
android:orientation="vertical"
android:padding="@dimen/dp_12">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tvNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_12"
android:text="01"
android:textColor="@color/main_red"
android:textSize="@dimen/sp_20" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="/"
android:textColor="@color/main_red"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/tvProTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_6"
android:maxLines="1"
android:paddingLeft="@dimen/dp_8"
android:paddingTop="@dimen/dp_2"
android:paddingRight="@dimen/dp_8"
android:paddingBottom="@dimen/dp_2"
android:singleLine="true"
android:text="证件识别不上,怎么处理?"
android:textColor="@color/black"
android:textSize="@dimen/sp_16" />
</LinearLayout>
<TextView
android:id="@+id/tvContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_12"
android:layout_marginTop="@dimen/dp_10"
android:lineSpacingExtra="@dimen/dp_6"
android:text="证件无法识别一般有几种情况。证件反光模糊, 不发识别出有效字段,请重新拍摄照片"
android:textColor="@color/color_9"
android:textSize="@dimen/sp_14" />
</LinearLayout>

View File

@ -95,6 +95,11 @@ dependencies {
api rootProject.ext.dependencies["WheelPicker"]
api rootProject.ext.dependencies["AddressPicker"]
//
api 'com.github.jenly1314.AppUpdater:app-updater:1.2.0'
api 'com.github.jenly1314.AppUpdater:app-dialog:1.2.0'
// api 'com.gyf.cactus:cactus:1.1.3-beta13'

View File

@ -0,0 +1,13 @@
package com.dahe.mylibrary.callback
import com.luck.picture.lib.entity.LocalMedia
/**
* @ClassName OnPicResultListener
* @Author john
* @Date 2024/2/6 14:48
* @Description TODO
*/
fun interface OnPicResultListener {
fun onResult(result: MutableList<LocalMedia>)
}

View File

@ -0,0 +1,126 @@
package com.dahe.mylibrary.pop
import android.content.Context
import android.widget.Button
import com.dahe.mylibrary.R
import com.dahe.mylibrary.callback.OnPicResultListener
import com.dahe.mylibrary.weight.GlideEngine
import com.dahe.mylibrary.weight.ImageFileCompressEngine
import com.luck.picture.lib.basic.PictureSelectionCameraModel
import com.luck.picture.lib.basic.PictureSelectionModel
import com.luck.picture.lib.basic.PictureSelector
import com.luck.picture.lib.config.SelectMimeType
import com.luck.picture.lib.entity.LocalMedia
import com.luck.picture.lib.interfaces.OnResultCallbackListener
import com.lxj.xpopup.core.BottomPopupView
/**
* @ClassName PopBottomPic
* @Author john
* @Date 2024/1/31 11:11
* @Description TODO
*/
class PopNorBottomPic(
context: Context,
private var picUrl: String,
onPicResultListener: OnPicResultListener
) : BottomPopupView(context) {
private var listener: OnPicResultListener
init {
this.listener = onPicResultListener
}
override fun getImplLayoutId() = R.layout.choice_norcar_img
override fun onCreate() {
super.onCreate()
var paizhao = findViewById<Button>(R.id.btn_paizhao)
var xiangce = findViewById<Button>(R.id.btnXiangce)
var btnQuxiao = findViewById<Button>(R.id.btn_quxiao)
// var btnSeeBig = findViewById<Button>(R.id.btnSeeBig)
// var llSeeBig = findViewById<LinearLayout>(R.id.llSeeBig)
// llSeeBig.visibility = if (picUrl.isNullOrEmpty()) View.GONE else View.VISIBLE
// btnSeeBig.setOnClickListener {
// }
paizhao.setOnClickListener {
// 单独拍照
val cameraModel: PictureSelectionCameraModel = PictureSelector.create(context)
.openCamera(SelectMimeType.TYPE_IMAGE)
.setCompressEngine(ImageFileCompressEngine())
// .setCameraInterceptListener(getCustomCameraEvent())//自定义相机
// .setRecordAudioInterceptListener(MainActivity.MeOnRecordAudioInterceptListener())//录音回调事件
// .setCropEngine(ImageFileCropEngine())//裁剪
// .setCompressEngine(ImageFileCompressEngine())//压缩
// .setSelectLimitTipsListener(MainActivity.MeOnSelectLimitTipsListener())//拦截自定义提示
// .setAddBitmapWatermarkListener(getAddBitmapWatermarkListener())//给图片添加水印
// .setVideoThumbnailListener(getVideoThumbnailEventListener())//处理视频缩略图
// .setCustomLoadingListener(getCustomLoadingListener())//自定义loading
// .setSandboxFileEngine(MainActivity.MeSandboxFileEngine())//自定义沙盒文件处理
// .isOriginalControl(cb_original.isChecked())//是否开启原图功能
// .setPermissionDescriptionListener(getPermissionDescriptionListener())//权限说明
// .setOutputAudioDir(getSandboxAudioOutputPath())//创建音频自定义输出目录
// .setSelectedData(myAdapter.data)
cameraModel.forResult(object : OnResultCallbackListener<LocalMedia> {
override fun onResult(result: ArrayList<LocalMedia>?) {
if (listener != null) {
result?.let { it1 -> listener.onResult(it1) }
}
dismiss()
}
override fun onCancel() {
dismiss()
}
})
}
xiangce.setOnClickListener {
// 进入相册
val selectionModel: PictureSelectionModel = PictureSelector.create(context)
.openGallery(SelectMimeType.TYPE_IMAGE)
.isDisplayCamera(false)//关闭拍照
.setImageEngine(GlideEngine.createGlideEngine())
.setCompressEngine(ImageFileCompressEngine())
.isPreviewImage(true)
.isMaxSelectEnabledMask(true)
.setMaxSelectNum(1)
// .setSelectionMode(SelectModeConfig.SINGLE)
// .isDirectReturnSingle(true)
.isGif(false)
// .isDirectReturnSingle(true)
// .setSelectedData(myAdapter.data)
selectionModel.forResult(object : OnResultCallbackListener<LocalMedia> {
override fun onResult(result: ArrayList<LocalMedia>) {
if (listener != null) {
result?.let { it1 -> listener.onResult(it1) }
}
dismiss()
}
override fun onCancel() {
dismiss()
}
})
}
btnQuxiao.setOnClickListener {
dismiss()
}
}
private fun openCam() {
PictureSelector.create(context)
.openCamera(SelectMimeType.TYPE_IMAGE)
}
}

View File

@ -0,0 +1,54 @@
package com.dahe.mylibrary.utils
import androidx.appcompat.app.AppCompatActivity
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.impl.LoadingPopupView
/**
* @ClassName LoadingUtils
* @Author john
* @Date 2024/2/29 11:10
* @Description TODO
*/
class LoadingUtils private constructor() {
var loadingPopup: LoadingPopupView? = null
lateinit var activity: AppCompatActivity
companion object {
val instance = Holder.holder
}
object Holder {
val holder = LoadingUtils()
}
fun init(activity: AppCompatActivity, message: String = "网络请求中......"): LoadingPopupView? {
loadingPopup = XPopup.Builder(activity)
.dismissOnBackPressed(false)
.isLightNavigationBar(true)
.asLoading(message, LoadingPopupView.Style.Spinner)
return loadingPopup
}
fun showLoading(activity: AppCompatActivity, message: String = "网络请求中......") {
if (!activity.isDestroyed)
loadingPopup = XPopup.Builder(activity)
.dismissOnBackPressed(true)
.isLightNavigationBar(true)
// .asLoading(message, R.layout.custom_loading_popup,LoadingPopupView.Style.Spinner)
.asLoading(message, LoadingPopupView.Style.Spinner)
.show() as LoadingPopupView
}
fun dissLoading() {
if (loadingPopup != null && loadingPopup!!.isShow) {
loadingPopup!!.dismiss()
}
}
fun isShow() = loadingPopup?.isShow
}

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/pop_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_12"
android:layout_marginRight="@dimen/dp_12"
android:layout_marginBottom="@dimen/dp_20"
android:background="@drawable/bg_bai"
android:orientation="vertical"
android:paddingTop="@dimen/dp_10">
<LinearLayout
android:id="@+id/llXc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/btnXiangce"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:text="相册"
android:textColor="#000"
android:textSize="@dimen/sp_15"
/>
<View
android:id="@+id/v_1"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_marginLeft="@dimen/dp_18"
android:layout_marginRight="@dimen/dp_18"
android:background="#EEEEEE" />
<Button
android:id="@+id/btn_paizhao"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:text="拍照"
android:textColor="#000"
android:textSize="@dimen/sp_15" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_marginLeft="@dimen/dp_18"
android:layout_marginRight="@dimen/dp_18"
android:background="#EEEEEE" />
<LinearLayout
android:visibility="gone"
android:id="@+id/llSeeBig"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<Button
android:id="@+id/btnSeeBig"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:text="查看大图"
android:textColor="#000"
android:textSize="@dimen/sp_15" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_marginLeft="@dimen/dp_18"
android:layout_marginRight="@dimen/dp_18"
android:background="#EEEEEE" />
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/btn_quxiao"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:text="取消"
android:textColor="#ff999999"
android:textSize="@dimen/sp_15"
android:textStyle="normal" />
</LinearLayout>
</RelativeLayout>