fix: 设置查看音频按钮不可用

This commit is contained in:
xiaoyan 2023-01-11 12:38:50 +08:00
parent 980f4bf415
commit c550853c0c
5 changed files with 46 additions and 62 deletions

View File

@ -21,7 +21,7 @@ android {
minSdk 24
targetSdk 32
versionCode 1
versionName "1.0"
versionName "1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Binary file not shown.

View File

@ -1,20 +0,0 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.navinfo.volvo",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}

View File

@ -186,6 +186,10 @@ class ObtainMessageFragment : Fragment() {
binding.edtSendTo.isEnabled=false
binding.btnSendTime.isEnabled=false
binding.btnObtainMessageConfirm.isEnabled=false
binding.tvPhotoName.isEnabled = false
binding.tvAudioName.isEnabled = false
binding.imgPhotoDelete.isEnabled = false
binding.imgAudioDelete.isEnabled = false
}
}
@ -493,30 +497,30 @@ class ObtainMessageFragment : Fragment() {
ToastUtils.showToast(it.message)
}
binding.tvAudioName.setOnClickListener {
binding.llAudioPlay.visibility =
if (binding.llAudioPlay.visibility == VISIBLE) GONE else VISIBLE
// 判断当前播放的文件是否在缓存文件夹内,如果不在首先下载该文件
val fileUrl = obtainMessageViewModel.getMessageLiveData().value!!.mediaUrl!!
val localFile =
obtainMessageViewModel.getLocalFileFromNetUrl(fileUrl, AttachmentType.AUDIO)
if (!localFile.exists()) {
obtainMessageViewModel.downLoadFile(fileUrl, localFile, object : DownloadCallback {
override fun progress(progress: Int) {
}
override fun error(throwable: Throwable) {
}
override fun success(file: File) {
binding.voicePlayerView.setAudio(localFile.absolutePath)
}
})
} else {
binding.voicePlayerView.setAudio(localFile.absolutePath)
}
}
// binding.tvAudioName.setOnClickListener {
// binding.llAudioPlay.visibility =
// if (binding.llAudioPlay.visibility == VISIBLE) GONE else VISIBLE
// // 判断当前播放的文件是否在缓存文件夹内,如果不在首先下载该文件
// val fileUrl = obtainMessageViewModel.getMessageLiveData().value!!.mediaUrl!!
// val localFile =
// obtainMessageViewModel.getLocalFileFromNetUrl(fileUrl, AttachmentType.AUDIO)
// if (!localFile.exists()) {
// obtainMessageViewModel.downLoadFile(fileUrl, localFile, object : DownloadCallback {
// override fun progress(progress: Int) {
// }
//
// override fun error(throwable: Throwable) {
// }
//
// override fun success(file: File) {
// binding.voicePlayerView.setAudio(localFile.absolutePath)
// }
//
// })
// } else {
// binding.voicePlayerView.setAudio(localFile.absolutePath)
// }
// }
binding.btnObtainMessageBack.setOnClickListener {
findNavController().popBackStack()
@ -660,22 +664,22 @@ class ObtainMessageFragment : Fragment() {
}
}
}
// 点击照片名称
binding.tvPhotoName.setOnClickListener {
val viewData = ViewData()
viewData.imageSrc = obtainMessageViewModel.getMessageLiveData().value!!.imageUrl
viewData.targetX = Utils.dp2px(context, 10F).toFloat()
viewData.targetWidth =
DisplayUtils.getScreenWidthPixels(activity) - Utils.dp2px(context, 20F)
viewData.targetHeight = Utils.dp2px(context, 200F)
val viewDataList = listOf(viewData)
binding.imageViewer.overlayStatusBar(true) // ImageViewer 是否会占据 StatusBar 的空间
.viewData(viewDataList) // 图片数据
.imageLoader(PhotoLoader()) // 设置图片加载方式
.showIndex(true) // 是否显示图片索引默认为true
.watch(0) // 开启浏览
}
// // 点击照片名称
// binding.tvPhotoName.setOnClickListener {
// val viewData = ViewData()
// viewData.imageSrc = obtainMessageViewModel.getMessageLiveData().value!!.imageUrl
// viewData.targetX = Utils.dp2px(context, 10F).toFloat()
// viewData.targetWidth =
// DisplayUtils.getScreenWidthPixels(activity) - Utils.dp2px(context, 20F)
// viewData.targetHeight = Utils.dp2px(context, 200F)
// val viewDataList = listOf(viewData)
// binding.imageViewer.overlayStatusBar(true) // ImageViewer 是否会占据 StatusBar 的空间
// .viewData(viewDataList) // 图片数据
// .imageLoader(PhotoLoader()) // 设置图片加载方式
// .showIndex(true) // 是否显示图片索引默认为true
// .watch(0) // 开启浏览
//
// }
binding.edtSendFrom.setText(obtainMessageViewModel.username)
}

View File

@ -409,7 +409,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="确认提交"></com.google.android.material.button.MaterialButton>
android:text="修改保存"></com.google.android.material.button.MaterialButton>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>