File tree Expand file tree Collapse file tree 3 files changed +20
-29
lines changed
src/main/java/com/pengxh/kt/lib
lite/src/main/java/com/pengxh/kt/lite/extensions Expand file tree Collapse file tree 3 files changed +20
-29
lines changed Original file line number Diff line number Diff line change @@ -35,19 +35,4 @@ dependencies {
35
35
implementation ' androidx.recyclerview:recyclerview:1.3.0'
36
36
// Google官方授权框架
37
37
implementation ' pub.devrel:easypermissions:3.0.0'
38
- def vm_version = ' 2.5.1'
39
- implementation " androidx.lifecycle:lifecycle-runtime-ktx:${ vm_version} "
40
- // MVVM+LiveData
41
- implementation " androidx.lifecycle:lifecycle-livedata-ktx:${ vm_version} "
42
- implementation " androidx.lifecycle:lifecycle-viewmodel-ktx:${ vm_version} "
43
- implementation " androidx.lifecycle:lifecycle-extensions:2.2.0"
44
- // 返回值转换器
45
- implementation ' com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
46
- implementation ' com.squareup.retrofit2:converter-scalars:2.3.0'
47
- implementation ' com.squareup.retrofit2:converter-gson:2.8.1'
48
- // okhttp3日志拦截器
49
- implementation ' com.squareup.okhttp3:logging-interceptor:4.6.0'
50
- // 网络请求和接口封装
51
- implementation ' com.squareup.retrofit2:retrofit:2.9.0'
52
- implementation ' com.squareup.okhttp3:okhttp:4.9.0'
53
38
}
Original file line number Diff line number Diff line change @@ -2,15 +2,9 @@ package com.pengxh.kt.lib
2
2
3
3
import android.Manifest
4
4
import android.os.Bundle
5
- import androidx.lifecycle.lifecycleScope
6
5
import com.pengxh.kt.lib.databinding.ActivityMainBinding
7
6
import com.pengxh.kt.lite.base.KotlinBaseActivity
8
- import com.pengxh.kt.lite.utils.LoadingDialogHub
9
7
import com.pengxh.kt.lite.widget.SteeringWheelView
10
- import kotlinx.coroutines.Dispatchers
11
- import kotlinx.coroutines.delay
12
- import kotlinx.coroutines.launch
13
- import kotlinx.coroutines.withContext
14
8
import pub.devrel.easypermissions.EasyPermissions
15
9
16
10
class MainActivity : KotlinBaseActivity <ActivityMainBinding >(),
@@ -37,13 +31,7 @@ class MainActivity : KotlinBaseActivity<ActivityMainBinding>(),
37
31
binding.steeringWheelView.setOnWheelTouchListener(object :
38
32
SteeringWheelView .OnWheelTouchListener {
39
33
override fun onCenterClicked () {
40
- lifecycleScope.launch(Dispatchers .Main ) {
41
- LoadingDialogHub .show(this @MainActivity, " 数据加载中..." )
42
- withContext(Dispatchers .IO ) {
43
- delay(10000 )
44
- }
45
- LoadingDialogHub .dismiss()
46
- }
34
+
47
35
}
48
36
49
37
override fun onLeftTurn () {
Original file line number Diff line number Diff line change 1
1
package com.pengxh.kt.lite.extensions
2
2
3
- import android.graphics.*
3
+ import android.graphics.Bitmap
4
+ import android.graphics.BitmapFactory
5
+ import android.graphics.ImageFormat
6
+ import android.graphics.Rect
7
+ import android.graphics.YuvImage
4
8
import java.io.ByteArrayOutputStream
5
9
import java.io.IOException
6
10
@@ -20,4 +24,18 @@ fun ByteArray.nv21ToBitmap(width: Int, height: Int): Bitmap? {
20
24
e.printStackTrace()
21
25
}
22
26
return bitmap
27
+ }
28
+
29
+ /* *
30
+ * ByteArray转Hex
31
+ * */
32
+ fun ByteArray.toHex (): String {
33
+ val hexArray = " 0123456789ABCDEF" .toCharArray()
34
+ val hexChars = CharArray (this .size * 2 )
35
+ for (j in this .indices) {
36
+ val v: Int = this [j].toInt() and 0xFF
37
+ hexChars[j * 2 ] = hexArray[v ushr 4 ]
38
+ hexChars[j * 2 + 1 ] = hexArray[v and 0x0F ]
39
+ }
40
+ return String (hexChars)
23
41
}
You can’t perform that action at this time.
0 commit comments