|
@@ -7,10 +7,9 @@ import android.view.KeyEvent
|
|
|
import android.view.View
|
|
|
import android.widget.Button
|
|
|
import android.widget.LinearLayout
|
|
|
+import android.widget.TextView
|
|
|
+import com.suyghur.dolin.common.util.DeviceInfoUtils
|
|
|
import com.suyghur.dolin.zap.Zap
|
|
|
-import com.suyghur.dolin.zap.entity.Level
|
|
|
-import com.suyghur.dolin.zap.util.FileUtils
|
|
|
-import com.suyghur.dolin.zap.util.LevelUtils
|
|
|
import kotlin.system.exitProcess
|
|
|
|
|
|
/**
|
|
@@ -19,6 +18,8 @@ import kotlin.system.exitProcess
|
|
|
*/
|
|
|
class DemoActivity : Activity(), View.OnClickListener {
|
|
|
|
|
|
+ private lateinit var textView: TextView
|
|
|
+
|
|
|
private val events: MutableList<Item> = mutableListOf(
|
|
|
Item(0, "Zap日志测试"),
|
|
|
Item(1, "申请多个危险权限")
|
|
@@ -27,8 +28,15 @@ class DemoActivity : Activity(), View.OnClickListener {
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
+ initView()
|
|
|
+ initDeviceInfo()
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun initView() {
|
|
|
val layout = LinearLayout(this)
|
|
|
layout.orientation = LinearLayout.VERTICAL
|
|
|
+ textView = TextView(this)
|
|
|
+ layout.addView(textView)
|
|
|
for (event in events) {
|
|
|
with(Button(this)) {
|
|
|
tag = event.id
|
|
@@ -40,6 +48,19 @@ class DemoActivity : Activity(), View.OnClickListener {
|
|
|
setContentView(layout)
|
|
|
}
|
|
|
|
|
|
+ private fun initDeviceInfo() {
|
|
|
+ val sb = StringBuilder()
|
|
|
+ sb.append("Android ID:").append(DeviceInfoUtils.getAndroidDeviceId(this)).append("\n")
|
|
|
+ sb.append("厂商:").append(DeviceInfoUtils.getDeviceBrand()).append("\n")
|
|
|
+ sb.append("型号:").append(DeviceInfoUtils.getModel()).append("\n")
|
|
|
+ sb.append("系统版本:").append(DeviceInfoUtils.getDeviceSoftWareVersion()).append("\n")
|
|
|
+ sb.append("cpu核数:").append(DeviceInfoUtils.getCpuCount()).append("\n")
|
|
|
+ sb.append("cpu架构:").append(DeviceInfoUtils.getCpuABI()).append("\n")
|
|
|
+ sb.append("本机内存:").append(DeviceInfoUtils.getRAM()).append("\n")
|
|
|
+ sb.append("本机剩余内存:").append(DeviceInfoUtils.getAvailMem(this)).append("M")
|
|
|
+ textView.text = sb.toString()
|
|
|
+ }
|
|
|
+
|
|
|
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
|
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
|
AlertDialog.Builder(this)
|