Initial commit
This commit is contained in:
BIN
unpackage/dist/dev/app-android/index/classes.dex
vendored
Normal file
BIN
unpackage/dist/dev/app-android/index/classes.dex
vendored
Normal file
Binary file not shown.
28
unpackage/dist/dev/app-android/manifest.json
vendored
Normal file
28
unpackage/dist/dev/app-android/manifest.json
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"id": "__UNI__95B2570",
|
||||
"name": "akbleserver",
|
||||
"description": "",
|
||||
"version": {
|
||||
"name": "1.0.1",
|
||||
"code": "101"
|
||||
},
|
||||
"uni-app-x": {
|
||||
"compilerVersion": "4.76"
|
||||
},
|
||||
"app-android": {
|
||||
"distribute": {
|
||||
"modules": {
|
||||
"FileSystem": {}
|
||||
},
|
||||
"icons": {
|
||||
"hdpi": "unpackage/res/icons/72x72.png",
|
||||
"xhdpi": "unpackage/res/icons/96x96.png",
|
||||
"xxhdpi": "unpackage/res/icons/144x144.png",
|
||||
"xxxhdpi": "unpackage/res/icons/192x192.png"
|
||||
},
|
||||
"splashScreens": {
|
||||
"default": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
unpackage/dist/dev/app-android/pages/akbletest/classes.dex
vendored
Normal file
BIN
unpackage/dist/dev/app-android/pages/akbletest/classes.dex
vendored
Normal file
Binary file not shown.
BIN
unpackage/dist/dev/app-android/static/OmFw2509140009.zip
vendored
Normal file
BIN
unpackage/dist/dev/app-android/static/OmFw2509140009.zip
vendored
Normal file
Binary file not shown.
BIN
unpackage/dist/dev/app-android/static/OmFw2510150943.zip
vendored
Normal file
BIN
unpackage/dist/dev/app-android/static/OmFw2510150943.zip
vendored
Normal file
Binary file not shown.
BIN
unpackage/dist/dev/app-android/static/logo.png
vendored
Normal file
BIN
unpackage/dist/dev/app-android/static/logo.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
BIN
unpackage/dist/dev/app-android/uni_modules/uni-getbatteryinfo/utssdk/app-android/classes.dex
vendored
Normal file
BIN
unpackage/dist/dev/app-android/uni_modules/uni-getbatteryinfo/utssdk/app-android/classes.dex
vendored
Normal file
Binary file not shown.
3
unpackage/dist/dev/app-android/uni_modules/uni-getbatteryinfo/utssdk/app-android/config.json
vendored
Normal file
3
unpackage/dist/dev/app-android/uni_modules/uni-getbatteryinfo/utssdk/app-android/config.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"minSdkVersion": "21"
|
||||
}
|
||||
109
unpackage/dist/dev/app-android/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.kt
vendored
Normal file
109
unpackage/dist/dev/app-android/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.kt
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
@file:Suppress("UNCHECKED_CAST", "USELESS_CAST", "INAPPLICABLE_JVM_NAME", "UNUSED_ANONYMOUS_PARAMETER", "NAME_SHADOWING", "UNNECESSARY_NOT_NULL_ASSERTION")
|
||||
package uts.sdk.modules.uniGetbatteryinfo
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.BatteryManager
|
||||
import io.dcloud.uniapp.*
|
||||
import io.dcloud.uniapp.extapi.*
|
||||
import io.dcloud.uniapp.framework.*
|
||||
import io.dcloud.uniapp.runtime.*
|
||||
import io.dcloud.uniapp.vue.*
|
||||
import io.dcloud.uniapp.vue.shared.*
|
||||
import io.dcloud.unicloud.*
|
||||
import io.dcloud.uts.*
|
||||
import io.dcloud.uts.Map
|
||||
import io.dcloud.uts.Set
|
||||
import io.dcloud.uts.UTSAndroid
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Deferred
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
open class GetBatteryInfoSuccess (
|
||||
@JsonNotNull
|
||||
open var errMsg: String,
|
||||
@JsonNotNull
|
||||
open var level: Number,
|
||||
@JsonNotNull
|
||||
open var isCharging: Boolean = false,
|
||||
) : UTSObject(), IUTSSourceMap {
|
||||
override fun `__$getOriginalPosition`(): UTSSourceMapPosition? {
|
||||
return UTSSourceMapPosition("GetBatteryInfoSuccess", "uni_modules/uni-getbatteryinfo/utssdk/interface.uts", 1, 13)
|
||||
}
|
||||
}
|
||||
open class GetBatteryInfoOptions (
|
||||
open var success: ((res: GetBatteryInfoSuccess) -> Unit)? = null,
|
||||
open var fail: ((res: UniError) -> Unit)? = null,
|
||||
open var complete: ((res: Any) -> Unit)? = null,
|
||||
) : UTSObject(), IUTSSourceMap {
|
||||
override fun `__$getOriginalPosition`(): UTSSourceMapPosition? {
|
||||
return UTSSourceMapPosition("GetBatteryInfoOptions", "uni_modules/uni-getbatteryinfo/utssdk/interface.uts", 12, 13)
|
||||
}
|
||||
}
|
||||
open class GetBatteryInfoResult (
|
||||
@JsonNotNull
|
||||
open var level: Number,
|
||||
@JsonNotNull
|
||||
open var isCharging: Boolean = false,
|
||||
) : UTSObject(), IUTSSourceMap {
|
||||
override fun `__$getOriginalPosition`(): UTSSourceMapPosition? {
|
||||
return UTSSourceMapPosition("GetBatteryInfoResult", "uni_modules/uni-getbatteryinfo/utssdk/interface.uts", 26, 13)
|
||||
}
|
||||
}
|
||||
typealias GetBatteryInfoErrorCode = Number
|
||||
interface GetBatteryInfoFail : IUniError {
|
||||
override var errCode: GetBatteryInfoErrorCode
|
||||
}
|
||||
typealias GetBatteryInfo = (options: GetBatteryInfoOptions) -> Unit
|
||||
typealias GetBatteryInfoSync = () -> GetBatteryInfoResult
|
||||
val UniErrorSubject = "uni-getBatteryInfo"
|
||||
val UniErrors: Map<GetBatteryInfoErrorCode, String> = Map(_uA(
|
||||
_uA(
|
||||
1001,
|
||||
"getBatteryInfo:fail getAppContext is null"
|
||||
)
|
||||
))
|
||||
open class GetBatteryInfoFailImpl : UniError, GetBatteryInfoFail, IUTSSourceMap {
|
||||
override fun `__$getOriginalPosition`(): UTSSourceMapPosition? {
|
||||
return UTSSourceMapPosition("GetBatteryInfoFailImpl", "uni_modules/uni-getbatteryinfo/utssdk/unierror.uts", 19, 14)
|
||||
}
|
||||
constructor(errCode: GetBatteryInfoErrorCode) : super() {
|
||||
this.errSubject = UniErrorSubject
|
||||
this.errCode = errCode
|
||||
this.errMsg = UniErrors[errCode] ?: ""
|
||||
}
|
||||
}
|
||||
val getBatteryInfo: GetBatteryInfo = fun(options: GetBatteryInfoOptions) {
|
||||
val context = UTSAndroid.getAppContext()
|
||||
if (context != null) {
|
||||
val manager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
||||
val level = manager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
||||
var ifilter = IntentFilter(Intent.ACTION_BATTERY_CHANGED)
|
||||
var batteryStatus = context.registerReceiver(null, ifilter)
|
||||
var status = batteryStatus?.getIntExtra(BatteryManager.EXTRA_STATUS, -1)
|
||||
var isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL
|
||||
val res = GetBatteryInfoSuccess(errMsg = "getBatteryInfo:ok", level = level, isCharging = isCharging)
|
||||
options.success?.invoke(res)
|
||||
options.complete?.invoke(res)
|
||||
} else {
|
||||
var res = GetBatteryInfoFailImpl(1001)
|
||||
options.fail?.invoke(res)
|
||||
options.complete?.invoke(res)
|
||||
}
|
||||
}
|
||||
val getBatteryInfoSync: GetBatteryInfoSync = fun(): GetBatteryInfoResult {
|
||||
val context = UTSAndroid.getAppContext()
|
||||
if (context != null) {
|
||||
val manager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
|
||||
val level = manager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
|
||||
var ifilter = IntentFilter(Intent.ACTION_BATTERY_CHANGED)
|
||||
var batteryStatus = context.registerReceiver(null, ifilter)
|
||||
var status = batteryStatus?.getIntExtra(BatteryManager.EXTRA_STATUS, -1)
|
||||
var isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL
|
||||
val res = GetBatteryInfoResult(level = level, isCharging = isCharging)
|
||||
return res
|
||||
} else {
|
||||
val res = GetBatteryInfoResult(level = -1, isCharging = false)
|
||||
return res
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user