# DLTool **Repository Path**: toune/DLTool ## Basic Information - **Project Name**: DLTool - **Description**: 🔥🔥🔥🔥🔥基础项目框架:OkHttp封装、仿微信位置选择、车牌号选择、设置自定义字体,异常捕获、物联网开发整合等 - **Primary Language**: Java - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: http://dltool.dong11.fun - **GVP Project**: No ## Statistics - **Stars**: 6 - **Forks**: 4 - **Created**: 2021-03-19 - **Last Updated**: 2025-09-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # DLTool [![](https://www.jitpack.io/v/com.gitee.toune/DLTool.svg)](https://www.jitpack.io/#com.gitee.toune/DLTool) ## 演示图 | 功能 | 仿微信选择位置 | 车牌选择器 | | :----: |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| | 演示图 | 仿微信位置选择 | 车牌号输入 | | 代码 | DLGDLocationDialogFragment.show(childFragmentManager,center,object :DLGDLocationDialogFragment.OnSelectPoiItemListener{
override fun onSelected(poiItem: MyPoiItem) {}})
| DLPlateNumDialog.with(requireContext())
.setOnPlateNumDialogClickListener(object:DLPlateNumDialog.OnPlateNumberButtonListener{
override fun cancel() {}
override fun done(str: StringBuilder?) {}}).build().show()
| ## Step1 ``` allprojects { repositories { ... maven { url 'https://jitpack.io' } } } ``` ## Step2 #### 在app的build.gradle文件中添加如下代码 ``` implementation 'com.gitee.toune.DLTool:DLTools:v2.0.6' //基础框架ActivityMVP之类的 implementation 'com.gitee.toune.DLTool:DLHttp:v2.0.6'//网络请求框架 implementation 'com.gitee.toune.DLTool:DLCrash:v2.0.6'//异常捕获,防止软件崩溃 implementation 'com.gitee.toune.DLTool:DLFont:v2.0.6'//自定义字体 implementation 'com.gitee.toune.DLTool:DLIOT:v2.0.6'//物联网需要 SOCKET MQTT 串口 implementation 'com.gitee.toune.DLTool:DLGDLocation:v2.0.6'//仿微信自定义选择地址组件包含高德地图 implementation 'com.gitee.toune.DLTool:DLSimpleLocation:v2.0.6'//简单的定位不含地图组件 implementation 'com.gitee.toune.DLTool:zbarlibary:v2.0.6'//扫码 ``` ## Step3 #### 自定义APP的onCreate中添加如下代码进行初始 ``` // DLHttp配置 DLHttpConfig .setHeader(mutableMapOf("自定义字段" to ""))//设置http的请求头 .setDataStr("code", "error", "")//设置http的字段名称 .setSuccessCode(200)//设置正确码 .setErrorCode(100)//设置错误码 .setTokenErrorCode(403) //设置token失效码 // 异常捕获 传入token值 DLCrash.openCrash(this, !BuildConfig.DEBUG,IBaseCallBack.loginVoStr) //设置自定义字体 将字体放入assets文件夹下fonts/ DLFont.setCustomFont(this, "fonts/zihunbiantaoti.ttf") //DLTool初始化 DLTool.init(this) //设置DLBaseActivity的自定义内容 .setActivityConfig( DLActivityConfig.Builder() // .setCustomTitleView(CustomTitleView()) //设置自定义的标题栏 .setDefaultTextGravity(Gravity.CENTER_VERTICAL) //设置默认标题栏的标题位置 .setDefaultTitleBgColor(Color.parseColor("#87CEFA"))//设置默认标题栏的背景颜色 .setDefaultTextColor(Color.WHITE)//设置默认标题栏的字体颜色 .setDefaultBackIvImgColor(Color.WHITE) //设置默认标题栏的返回按钮颜色 .setDefaultTextGravity(Gravity.CENTER) //设置默认标题栏的标题位置 .setDefaultBackText("关闭") //设置默认标题栏的返回按钮文字 .setIsWhiteStatus(true) //设置默认标题栏的状态栏是否为白色 ) .setServiceOpenActivity(DLWebActivity::class.java) //启动后台守护程序之后,点击通知栏的时候打开的页面 ``` ## 注意 ``` 如果报:Cannot fit requested classes in a single dex file (# methods: 71623 > 65536)异常 解决办法: 1、在app model中的build.gradledependencies里面添加: implementation 'androidx.multidex:multidex:2.0.0' 2、app model中的build.gradle文件的defaultConfig默认配置里面增加: multiDexEnabled true android { compileSdkVersion 29 defaultConfig { applicationId "com.toune.dltool" minSdkVersion 19 targetSdkVersion 29 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" multiDexEnabled true } 3.最后在自定义了Application子类,需要在这个子类中重写一个方法 // 主要是添加下面这句代码 MultiDex.install(this); override fun attachBaseContext(base: Context?) { super.attachBaseContext(base) MultiDex.install(base) } ``` # 文档 + [DLTool文档](https://gitee.com/toune/DLTool/blob/master/DLTools/README.md) + [DLTool 软件更新文档](https://gitee.com/toune/DLTool/blob/master/DLTools/README-UPDATE.md) + [DLHttp文档](https://gitee.com/toune/DLTool/blob/master/DLHttp/README.md) + [DLGDLocation 文档](https://gitee.com/toune/DLTool/blob/master/DLGDLocation/README.md)] + [DLSimpleLocation 文档](https://gitee.com/toune/DLTool/blob/master/DLSimpleLocation/README.md)] + [DLIOT mqtt文档](https://gitee.com/toune/DLTool/blob/master/DLIOT/README-MQTT.md) + [DLIOT 串口文档](https://gitee.com/toune/DLTool/blob/master/DLIOT/README-SERIALPORT.md) + [DLIOT socket文档](https://gitee.com/toune/DLTool/blob/master/DLIOT/README-SOCKET.md) + [DLFont 文档](https://gitee.com/toune/DLTool/blob/master/DLFont/README.md) + [DLCrash 文档](https://gitee.com/toune/DLTool/blob/master/DLCrash/README.md) # 致谢第三方库 + [EasySocket](https://github.com/jiusetian/EasySocket) + [EasyMqttAndroidClient](https://github.com/ZS-ZhangsShun/EasyMqttAndroidClient) + [AndroidSerialPort](https://github.com/Acccord/AndroidSerialPort) + [zbarlibary](https://github.com/bertsir/zBarLibary) + [今日头条适配方案](https://github.com/JessYanCoding/AndroidAutoSize) + [工具类](https://github.com/Blankj/AndroidUtilCode) + [RxBus](https://github.com/AndroidKnife/RxBus) + [AgentWeb](https://github.com/Justson/AgentWeb) + [xxpermissions](https://github.com/getActivity/XXPermissions.git) + [EasyPhotos](https://github.com/HuanTanSheng/EasyPhotos) + [BaseRecyclerViewAdapterHelper](https://github.com/CymChad/BaseRecyclerViewAdapterHelper) + [XPopup](https://github.com/li-xiaojun/XPopup)