feat: app 签名
This commit is contained in:
parent
ae8209e025
commit
4712855f6c
|
|
@ -6,8 +6,7 @@ plugins {
|
|||
alias(libs.plugins.kotlin.android)
|
||||
}
|
||||
|
||||
val keystores: Map<String, Properties?> =
|
||||
mapOf("release" to loadKeystoreProperties("keystore.properties"))
|
||||
val keystores: Properties? = loadKeystoreProperties("keystore.properties")
|
||||
|
||||
android {
|
||||
namespace = "com.yuanxuan.rokid"
|
||||
|
|
@ -25,13 +24,13 @@ android {
|
|||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
keystores["release"]?.let { proerties ->
|
||||
keystores?.let {
|
||||
signingConfigs {
|
||||
create("release") {
|
||||
storeFile = rootProject.file(proerties["storeFile"] as String)
|
||||
storePassword = proerties["storePassword"] as String
|
||||
keyAlias = proerties["keyAlias"] as String
|
||||
keyPassword = proerties["keyPassword"] as String
|
||||
storeFile = rootProject.file(it["storeFile"] as String)
|
||||
storePassword = it["storePassword"] as String
|
||||
keyAlias = it["keyAlias"] as String
|
||||
keyPassword = it["keyPassword"] as String
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -58,6 +57,7 @@ android {
|
|||
}
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
buildConfig = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,5 +16,16 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="askjdhkjashdkjhsad" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/sn"
|
||||
tools:text="APP版本号" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -8,4 +8,7 @@
|
|||
<string name="home_item_volume">音量</string>
|
||||
<string name="home_item_brightness">亮度</string>
|
||||
<string name="home_item_sn">SN</string>
|
||||
<string name="status_bar_battery">%d%%</string>
|
||||
<string name="device_info_sn">设备SN:%s</string>
|
||||
<string name="device_info_app_version">APP版本:%s</string>
|
||||
</resources>
|
||||
Loading…
Reference in New Issue