removed audio state maintenance from audiobinder on the compose screen into messagesadapter class. fixed other ui issues also related to state loss in audiobinder and re-use of viewholders

This commit is contained in:
gavine99
2025-01-27 19:31:45 +11:00
parent 33347fa157
commit b7a8389bf6
7 changed files with 211 additions and 113 deletions
@@ -9,6 +9,7 @@ object QkMediaPlayer : MediaPlayer() {
private var onCompletionListener: OnCompletionListener? = null
enum class PlayingState {
None,
Stopped,
Playing,
Paused
@@ -53,20 +53,29 @@ fun EditText.hideKeyboard() {
imm.hideSoftInputFromWindow(windowToken, 0)
}
fun ImageView.setTint(color: Int) {
imageTintList = ColorStateList.valueOf(color)
fun ImageView.setTint(color: Int?) {
imageTintList =
if (color == null) null
else ColorStateList.valueOf(color)
}
fun ProgressBar.setTint(color: Int) {
indeterminateTintList = ColorStateList.valueOf(color)
progressTintList = ColorStateList.valueOf(color)
fun ProgressBar.setTint(color: Int?) {
indeterminateTintList =
if (color == null) null
else ColorStateList.valueOf(color)
progressTintList =
if (color == null) null
else ColorStateList.valueOf(color)
}
fun View.setBackgroundTint(color: Int) {
fun View.setBackgroundTint(color: Int?) {
// API 21 doesn't support this
backgroundTintList = ColorStateList.valueOf(color)
backgroundTintList =
if (color == null) null
else ColorStateList.valueOf(color)
}
fun View.setPadding(left: Int? = null, top: Int? = null, right: Int? = null, bottom: Int? = null) {