删除无用代码
This commit is contained in:
parent
a2a5fdb3b4
commit
e7cdff8188
@ -23,25 +23,7 @@ class ChatActivity : BaseActivity() {
|
|||||||
private val chatPageViewModel: ChatPageViewModel by lazy {
|
private val chatPageViewModel: ChatPageViewModel by lazy {
|
||||||
ViewModelProvider(this)[ChatPageViewModel::class.java]
|
ViewModelProvider(this)[ChatPageViewModel::class.java]
|
||||||
}
|
}
|
||||||
private val launcher =
|
|
||||||
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
|
||||||
if (it.resultCode == Activity.RESULT_OK) {
|
|
||||||
// Use the uri to load the image
|
|
||||||
// val uri = it.data?.data!!
|
|
||||||
// Use the file path to set image or upload
|
|
||||||
// val filePath= it.data?.getStringExtra(Const.BundleExtras.FILE_PATH)
|
|
||||||
//...
|
|
||||||
|
|
||||||
// for Multiple picks
|
|
||||||
// first item
|
|
||||||
// val first = it.data?.data!!
|
|
||||||
// other items
|
|
||||||
// val clipData = it.data?.clipData
|
|
||||||
// Multiple file paths list
|
|
||||||
// val filePaths = result.data?.getStringArrayListExtra(Const.BundleExtras.FILE_PATH_LIST)
|
|
||||||
//...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private val filePicker = FilePicker.getInstance(this)
|
private val filePicker = FilePicker.getInstance(this)
|
||||||
override fun bindView() {
|
override fun bindView() {
|
||||||
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_chat);
|
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_chat);
|
||||||
@ -175,11 +157,3 @@ class ChatActivity : BaseActivity() {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//})
|
//})
|
||||||
|
|
||||||
//FilePicker.Builder(this)
|
|
||||||
// .setPopUpConfig()
|
|
||||||
// .addPickDocumentFile()
|
|
||||||
// .addImageCapture()
|
|
||||||
// .addVideoCapture()
|
|
||||||
// .addPickMedia()
|
|
||||||
// .build()
|
|
@ -1,5 +1,6 @@
|
|||||||
package com.tenlionsoft.aimz_k.page.activity
|
package com.tenlionsoft.aimz_k.page.activity
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
@ -136,6 +137,7 @@ class MainActivity : BaseActivity() {
|
|||||||
unregisterReceiver(mLocalReceiver)
|
unregisterReceiver(mLocalReceiver)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
||||||
private fun registerLocalReceiver() {
|
private fun registerLocalReceiver() {
|
||||||
mLocalReceiver = MainBroadcastReceiver()
|
mLocalReceiver = MainBroadcastReceiver()
|
||||||
val filter = IntentFilter()
|
val filter = IntentFilter()
|
||||||
|
@ -13,16 +13,14 @@ import com.tenlionsoft.aimz_k.R
|
|||||||
|
|
||||||
object BindingUtils {
|
object BindingUtils {
|
||||||
|
|
||||||
@BindingAdapter("app:setAdapter")
|
@BindingAdapter("setAdapter")
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun bindAdapterToRecyclerView(recyclerView: RecyclerView, adapter: Adapter<*>) {
|
fun bindAdapterToRecyclerView(recyclerView: RecyclerView, adapter: Adapter<*>) {
|
||||||
// adapter.setHasStableIds(true)
|
|
||||||
// recyclerView.setHasFixedSize(true)
|
|
||||||
recyclerView.layoutManager = LinearLayoutManager(recyclerView.context)
|
recyclerView.layoutManager = LinearLayoutManager(recyclerView.context)
|
||||||
recyclerView.adapter = adapter
|
recyclerView.adapter = adapter
|
||||||
}
|
}
|
||||||
|
|
||||||
@BindingAdapter("app:imageUrl")
|
@BindingAdapter("imageUrl")
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun bindImgUrl(imageView: ImageView, url: String?) {
|
fun bindImgUrl(imageView: ImageView, url: String?) {
|
||||||
if (url.isNullOrEmpty()) {
|
if (url.isNullOrEmpty()) {
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/rlv_msgs"
|
android:id="@+id/rlv_msgs"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
app:setAdapter="@{msgViewModel.adapter}"
|
setAdapter="@{msgViewModel.adapter}"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:listitem="@layout/item_category" />
|
tools:listitem="@layout/item_category" />
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
@ -28,11 +27,11 @@
|
|||||||
android:layout_margin="10dp">
|
android:layout_margin="10dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
imageUrl="@{item.avatar}"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
app:imageUrl="@{item.avatar}"
|
|
||||||
tools:src="@drawable/app_logo_small" />
|
tools:src="@drawable/app_logo_small" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -65,5 +65,5 @@ dependencies {
|
|||||||
api(libs.jjwt)
|
api(libs.jjwt)
|
||||||
api(libs.emojipicker)
|
api(libs.emojipicker)
|
||||||
api(libs.xxpermissions)
|
api(libs.xxpermissions)
|
||||||
api(libs.filepicker2)
|
api(libs.filepicker)
|
||||||
}
|
}
|
@ -2,6 +2,7 @@ package com.tenlionsoft.baselib.utils
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.DisplayMetrics
|
import android.util.DisplayMetrics
|
||||||
|
import android.util.TypedValue
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
|
|
||||||
|
|
||||||
@ -26,8 +27,11 @@ class DensityUtils {
|
|||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun sp2px(context: Context, spValue: Float): Int {
|
fun sp2px(context: Context, spValue: Float): Int {
|
||||||
val fontScale: Float =context.resources.displayMetrics.scaledDensity
|
return TypedValue.applyDimension(
|
||||||
return (spValue * fontScale + 0.5f).toInt()
|
TypedValue.COMPLEX_UNIT_SP,
|
||||||
|
spValue,
|
||||||
|
context.resources.displayMetrics
|
||||||
|
).toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -39,8 +43,8 @@ class DensityUtils {
|
|||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun px2sp(context: Context, pxValue: Float): Int {
|
fun px2sp(context: Context, pxValue: Float): Int {
|
||||||
val fontScale: Float = context.resources.displayMetrics.scaledDensity
|
val scaledDensity = context.resources.displayMetrics.scaledDensity
|
||||||
return (pxValue / fontScale + 0.5f).toInt()
|
return (pxValue / scaledDensity).toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@ -35,7 +35,7 @@ smartRefreshLayout = "2.1.0"
|
|||||||
jjwt = "3.10.3"
|
jjwt = "3.10.3"
|
||||||
emoji2Emojipicker = "1.0.0-alpha03"
|
emoji2Emojipicker = "1.0.0-alpha03"
|
||||||
xxpermissions = "20.0"
|
xxpermissions = "20.0"
|
||||||
filepicker2="2.0.0"
|
filepicker="2.0.0"
|
||||||
|
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
@ -84,7 +84,8 @@ refreshMaterial = { group = "io.github.scwang90", name = "refresh-header-materia
|
|||||||
jjwt = { group = "com.auth0", name = "java-jwt", version.ref = "jjwt" }
|
jjwt = { group = "com.auth0", name = "java-jwt", version.ref = "jjwt" }
|
||||||
emojipicker = { group = "androidx.emoji2", name = "emoji2-emojipicker", version.ref = "emoji2Emojipicker" }
|
emojipicker = { group = "androidx.emoji2", name = "emoji2-emojipicker", version.ref = "emoji2Emojipicker" }
|
||||||
xxpermissions = { group = "com.github.getActivity", name = "XXPermissions", version.ref = "xxpermissions" }
|
xxpermissions = { group = "com.github.getActivity", name = "XXPermissions", version.ref = "xxpermissions" }
|
||||||
filepicker2={group="com.github.atwa",name="filepicker",version.ref="filepicker2"}
|
filepicker={group="com.github.atwa",name="filepicker",version.ref="filepicker"}
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
|
Loading…
Reference in New Issue
Block a user