fix: keep text state when off screen (commentItem)
This commit is contained in:
parent
57833be7df
commit
78da98bd1d
2 changed files with 6 additions and 12 deletions
|
@ -326,21 +326,12 @@ class MainActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//TODO: Remove this
|
lifecycleScope.launch(Dispatchers.IO) { //simple cleanup
|
||||||
GlobalScope.launch(Dispatchers.IO) {
|
|
||||||
val index = Helper.downloadManager(this@MainActivity).downloadIndex
|
val index = Helper.downloadManager(this@MainActivity).downloadIndex
|
||||||
val downloadCursor = index.getDownloads()
|
val downloadCursor = index.getDownloads()
|
||||||
while (downloadCursor.moveToNext()) {
|
while (downloadCursor.moveToNext()) {
|
||||||
val download = downloadCursor.download
|
val download = downloadCursor.download
|
||||||
Log.e("Downloader", download.request.uri.toString())
|
if (download.state == Download.STATE_FAILED) {
|
||||||
Log.e("Downloader", download.request.id)
|
|
||||||
Log.e("Downloader", download.request.mimeType.toString())
|
|
||||||
Log.e("Downloader", download.request.data.size.toString())
|
|
||||||
Log.e("Downloader", download.bytesDownloaded.toString())
|
|
||||||
Log.e("Downloader", download.state.toString())
|
|
||||||
Log.e("Downloader", download.failureReason.toString())
|
|
||||||
|
|
||||||
if (download.state == Download.STATE_FAILED) { //simple cleanup
|
|
||||||
Helper.downloadManager(this@MainActivity).removeDownload(download.request.id)
|
Helper.downloadManager(this@MainActivity).removeDownload(download.request.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,10 +54,13 @@ class CommentItem(val comment: Comment,
|
||||||
viewBinding.commentDelete.visibility = if (isUserComment || CommentsAPI.isAdmin || CommentsAPI.isMod) View.VISIBLE else View.GONE
|
viewBinding.commentDelete.visibility = if (isUserComment || CommentsAPI.isAdmin || CommentsAPI.isMod) View.VISIBLE else View.GONE
|
||||||
viewBinding.commentBanUser.visibility = if ((CommentsAPI.isAdmin || CommentsAPI.isMod) && !isUserComment) View.VISIBLE else View.GONE
|
viewBinding.commentBanUser.visibility = if ((CommentsAPI.isAdmin || CommentsAPI.isMod) && !isUserComment) View.VISIBLE else View.GONE
|
||||||
viewBinding.commentEdit.visibility = if (isUserComment) View.VISIBLE else View.GONE
|
viewBinding.commentEdit.visibility = if (isUserComment) View.VISIBLE else View.GONE
|
||||||
|
replying(isReplying) //sets default text
|
||||||
|
editing(isEditing)
|
||||||
if ((comment.replyCount ?: 0) > 0) {
|
if ((comment.replyCount ?: 0) > 0) {
|
||||||
viewBinding.commentTotalReplies.visibility = View.VISIBLE
|
viewBinding.commentTotalReplies.visibility = View.VISIBLE
|
||||||
viewBinding.commentRepliesDivider.visibility = View.VISIBLE
|
viewBinding.commentRepliesDivider.visibility = View.VISIBLE
|
||||||
viewBinding.commentTotalReplies.text = "View ${comment.replyCount} repl${if (comment.replyCount == 1) "y" else "ies"}"
|
viewBinding.commentTotalReplies.text = if(repliesVisible) "Hide Replies" else
|
||||||
|
"View ${comment.replyCount} repl${if (comment.replyCount == 1) "y" else "ies"}"
|
||||||
} else {
|
} else {
|
||||||
viewBinding.commentTotalReplies.visibility = View.GONE
|
viewBinding.commentTotalReplies.visibility = View.GONE
|
||||||
viewBinding.commentRepliesDivider.visibility = View.GONE
|
viewBinding.commentRepliesDivider.visibility = View.GONE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue