fix audio attachments not opening in some cases (#1473)

This commit is contained in:
Konrad Pozniak 2019-09-08 19:35:43 +02:00 committed by GitHub
parent 60383e112a
commit 871e720ae5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View file

@ -74,7 +74,7 @@ class ReportStatusesFragment : Fragment(), Injectable, AdapterHandler {
override fun showMedia(v: View?, status: Status?, idx: Int) { override fun showMedia(v: View?, status: Status?, idx: Int) {
status?.actionableStatus?.let { actionable -> status?.actionableStatus?.let { actionable ->
when (actionable.attachments[idx].type) { when (actionable.attachments[idx].type) {
Attachment.Type.GIFV, Attachment.Type.VIDEO, Attachment.Type.IMAGE -> { Attachment.Type.GIFV, Attachment.Type.VIDEO, Attachment.Type.IMAGE, Attachment.Type.AUDIO -> {
val attachments = AttachmentViewData.list(actionable) val attachments = AttachmentViewData.list(actionable)
val intent = ViewMediaActivity.newIntent(context, attachments, val intent = ViewMediaActivity.newIntent(context, attachments,
idx) idx)

View file

@ -103,7 +103,7 @@ class SearchStatusesFragment : SearchFragment<Pair<Status, StatusViewData.Concre
override fun onViewMedia(position: Int, attachmentIndex: Int, view: View?) { override fun onViewMedia(position: Int, attachmentIndex: Int, view: View?) {
(adapter as? SearchStatusesAdapter)?.getItem(position)?.first?.actionableStatus?.let { actionable -> (adapter as? SearchStatusesAdapter)?.getItem(position)?.first?.actionableStatus?.let { actionable ->
when (actionable.attachments[attachmentIndex].type) { when (actionable.attachments[attachmentIndex].type) {
Attachment.Type.GIFV, Attachment.Type.VIDEO, Attachment.Type.IMAGE -> { Attachment.Type.GIFV, Attachment.Type.VIDEO, Attachment.Type.IMAGE, Attachment.Type.AUDIO -> {
val attachments = AttachmentViewData.list(actionable) val attachments = AttachmentViewData.list(actionable)
val intent = ViewMediaActivity.newIntent(context, attachments, val intent = ViewMediaActivity.newIntent(context, attachments,
attachmentIndex) attachmentIndex)

View file

@ -262,7 +262,8 @@ class AccountMediaFragment : BaseFragment(), RefreshableFragment, Injectable {
when (items[currentIndex].attachment.type) { when (items[currentIndex].attachment.type) {
Attachment.Type.IMAGE, Attachment.Type.IMAGE,
Attachment.Type.GIFV, Attachment.Type.GIFV,
Attachment.Type.VIDEO -> { Attachment.Type.VIDEO,
Attachment.Type.AUDIO -> {
val intent = ViewMediaActivity.newIntent(context, items, currentIndex) val intent = ViewMediaActivity.newIntent(context, items, currentIndex)
if (view != null && activity != null) { if (view != null && activity != null) {
val url = items[currentIndex].attachment.url val url = items[currentIndex].attachment.url