将 viewBinding 元素添加到其 build.gradle 文件中
android {
buildFeatures {
viewBinding true
}
}
plugins {
id 'com.google.dagger.hilt.android' version '2.52' apply false
}
plugins {
id 'com.google.devtools.ksp'
id 'com.google.dagger.hilt.android'
}
android {
}
dependencies {
implementation "com.google.dagger:hilt-android:2.52"
ksp "com.google.dagger:hilt-compiler:2.52"
}
@HiltAndroidApp
class Application : BaseApplication() {}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven { url 'https://jitpack.io' } // JitPack
}
}
dependencies {
implementation 'com.github.wxw-9527:MvpArms:3.0.4.00'
}
/**
* 获取版本更新信息
* @param clientType 客户端标志
* @param clientName 项目名称
* @param channel 渠道名
*/
fun getUpdateInfo(clientType: String = "android", clientName: String, channel: String)
override fun onDestroy() {
super.onDestroy()
DownloadUtil.getInstance().onDestroy()
}
1、在需要解析条码的Activity类或Fragment的父Activity类增加@BarcodeScanningReceiverEnabled
标记,在解析条码的Activity或Fragment类增加@EventBusEnabled
标记
默认全量查询,但是由于涉及到数据库的多张表,全量查询的速度可能会比较慢。如果需要按需查询,可在需要条码扫描功能的页面的Presenter
类上添加@BillType()
注解,该注解有一个可变参数,可传入需要查询的类型枚举。
- 覆写Activity或Fragment中
的onBarcodeEvent(event: BarcodeEvent)
方法可自行处理条码内容 - 覆写Presenter中的
getBarcodeInfo(barcode: String)
方法可自行处理条码解析方法 - 覆写Presenter中的
handleBarcodeInfo(barcodeInfo: BarcodeInfoVO)
方法可自行处理条码上下文数据 - 覆写Activity中的
onParseNfcIntent(intent: Intent?)
方法可自行处理NFC意图
pluginManagement {
repositories {
maven { url 'https://developer.huawei.com/repo/' } // 华为
}
}
dependencyResolutionManagement {
repositories {
maven { url 'https://developer.huawei.com/repo/' } // 华为
}
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.4.1' // 华为
classpath 'com.huawei.agconnect:agcp:1.9.1.301' // 华为
}
}
plugins {
id 'com.huawei.agconnect' // 华为
}
// 启用华为分析服务
agcp {
enableAPMS true
}
<!-- 华为分析服务 -->
<meta-data
android:name="install_channel"
android:value="${channel}" />
// 记录userId
HuaweiUtil.setUserId(userId)
<activity
android:name="包名.SplashActivity"
android:configChanges="keyboardHidden|screenSize|orientation"
android:exported="true"
android:theme="@style/ThemeSplash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".main.DomainConfigActivity"
android:configChanges="keyboardHidden|screenSize|orientation"
android:theme="@style/FullScreenTheme.White" />
@Module
@InstallIn(SingletonComponent::class)
object UrlModule : IUrlModule {
@Provides
@Singleton
@GetDomainConfigurationUrl
override fun provideDomainConfigurationUrl(): String {
return "http://test.zk-work.com/stage-api/system/customer/validCode/"
}
@Provides
@Singleton
@GetUpgradeUrl
override fun provideUpgradeUrl(): String {
return "http://test.zk-work.com/stage-api/system/client/info"
}
}
<!-- WebSocket服务 -->
<service
android:name="包名.YourWebSocketService"
android:directBootAware="true"
android:exported="false" />
class YourSocketService: BaseWebSocketService() {
/**
* 实现该方法注册通知需要启动的页面,多个Activity按顺序启动,被启动的页面启动模式需要设置为singleTask
*/
override fun createIntents(context: Context): Array<Intent> {
return arrayOf(
Intent(context, AActivity::class.java),
Intent(context, BActivity::class.java),
Intent(context, CActivity::class.java),
)
}
}
// 启动服务
MessageUtil.startService(context)
// 销毁服务
MessageUtil.stopService(context)
// 发送消息
MessageUtil.sendMessageToService(message)
品牌 | SDK | so |
---|---|---|
华辰联创 | HCCTG_printersdkv5.7.0.jar | |
汉印 | HPRT_CPCL_SDK_V1.22.01.jar、HPRT_lzo_V1.0.jar | libLZO.so |
鹏研科技 | IBOWLDER_fat-generic-cpcl-bluetooth-classic-0.1.16-GA.jar、IBOWLDER_fat-psdk-patch-0.1.16-GA.jar | libpsdkextj.so |
在需要双击退出程序的页面增加@DoubleBackToExitEnabled
注解
-
如果项目是基于 AndroidX 包,请在项目
gradle.properties
文件中加入# 表示将第三方库迁移到 AndroidX android.enableJetifier = true