平台规则初始化

This commit is contained in:
2024-11-11 09:57:54 +08:00
parent 039fd4ac37
commit 2ac6bab914
36 changed files with 2753 additions and 22 deletions
+5
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'
@@ -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>)
}
@@ -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)
}
}
@@ -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
}
@@ -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>