feat: app 签名
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.yuanxuan.rokid
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.KeyEvent
|
||||
import androidx.activity.addCallback
|
||||
@@ -14,6 +15,7 @@ import com.yuanxuan.rokid.device.DeviceServiceManager
|
||||
import com.yuanxuan.rokid.extension.fadeIn
|
||||
import com.yuanxuan.rokid.extension.fadeOut
|
||||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
@@ -37,18 +39,11 @@ class MainActivity : AppCompatActivity() {
|
||||
/**
|
||||
* 拦截返回键事件,防止返回到桌面
|
||||
*/
|
||||
onBackPressedDispatcher.addCallback {
|
||||
|
||||
}
|
||||
onBackPressedDispatcher.addCallback {}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 触摸板事件
|
||||
* [KeyEvent.KEYCODE_DPAD_DOWN] 和 [KeyEvent.KEYCODE_DPAD_RIGHT] 同时响应
|
||||
* 所以直接消费掉一个
|
||||
*/
|
||||
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
|
||||
return if (AppDependencies.deviceServiceManager.instructState.value ==
|
||||
DeviceServiceManager.InstructState.WaitingInstructState
|
||||
@@ -68,7 +63,7 @@ class MainActivity : AppCompatActivity() {
|
||||
* 监听电量
|
||||
*/
|
||||
AppDependencies.deviceServiceManager.batteryPercentage.collect {
|
||||
binding.batteryLevel.text = "${it}%"
|
||||
binding.batteryLevel.text = resources.getString(R.string.status_bar_battery, it)
|
||||
binding.batteryLevelIv.setImageLevel(it)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.yuanxuan.rokid
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import com.yuanxuan.rokid.dependencies.AppDependencies
|
||||
import com.yuanxuan.rokid.dependencies.ApplicationDependencyProvider
|
||||
import com.yuanxuan.rokid.keeplive.KeepLiveService
|
||||
@@ -17,7 +18,8 @@ class RokidApplication : Application() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
Timber.plant(Timber.DebugTree())
|
||||
if (BuildConfig.DEBUG)
|
||||
Timber.plant(tree = Timber.DebugTree())
|
||||
AppDependencies.init(this, ApplicationDependencyProvider(this, applicationScope))
|
||||
/**
|
||||
* 启动APP必须先获取到SN 后面网络依赖
|
||||
|
||||
@@ -5,9 +5,10 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.yuanxuan.rokid.BuildConfig
|
||||
import com.yuanxuan.rokid.R
|
||||
import com.yuanxuan.rokid.databinding.FragmentSnBinding
|
||||
import com.yuanxuan.rokid.dependencies.AppDependencies
|
||||
import timber.log.Timber
|
||||
|
||||
class SnFragment : Fragment() {
|
||||
|
||||
@@ -24,16 +25,9 @@ class SnFragment : Fragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
try {
|
||||
binding.sn.text = "SN:${AppDependencies.deviceServiceManager.sn}"
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
binding.sn.text =
|
||||
resources.getString(R.string.device_info_sn, AppDependencies.deviceServiceManager.sn)
|
||||
binding.appVersion.text =
|
||||
resources.getString(R.string.device_info_app_version, BuildConfig.VERSION_NAME)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
Timber.d("onDestroy")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user