mirror of
https://github.com/oxen-io/session-android.git
synced 2025-05-03 12:40:47 +00:00
Cannot save generic files (#1391)
* Fixes #429 * Further experimentation regarding potential race condition - still not resolved * Changed spinner mechanism away from RotateAnimation which fixes race-condition * Removed leftover commented code * Cleanup of unused imports * Addressed PR feedback * Adjusted 'visible' to use ktx
This commit is contained in:
parent
c366574521
commit
2fff9eceb7
@ -1948,6 +1948,14 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
|
|
||||||
override fun saveAttachment(messages: Set<MessageRecord>) {
|
override fun saveAttachment(messages: Set<MessageRecord>) {
|
||||||
val message = messages.first() as MmsMessageRecord
|
val message = messages.first() as MmsMessageRecord
|
||||||
|
|
||||||
|
// Do not allow the user to download a file attachment before it has finished downloading
|
||||||
|
// TODO: Localise the msg in this toast!
|
||||||
|
if (message.isMediaPending) {
|
||||||
|
Toast.makeText(this, resources.getString(R.string.conversation_activity__wait_until_attachment_has_finished_downloading), Toast.LENGTH_LONG).show()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
SaveAttachmentTask.showWarningDialog(this) {
|
SaveAttachmentTask.showWarningDialog(this) {
|
||||||
Permissions.with(this)
|
Permissions.with(this)
|
||||||
.request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
.request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||||
|
@ -5,11 +5,13 @@ import android.content.res.ColorStateList
|
|||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import network.loki.messenger.databinding.ViewDocumentBinding
|
import network.loki.messenger.databinding.ViewDocumentBinding
|
||||||
import org.thoughtcrime.securesms.database.model.MmsMessageRecord
|
import org.thoughtcrime.securesms.database.model.MmsMessageRecord
|
||||||
|
|
||||||
class DocumentView : LinearLayout {
|
class DocumentView : LinearLayout {
|
||||||
private val binding: ViewDocumentBinding by lazy { ViewDocumentBinding.bind(this) }
|
private val binding: ViewDocumentBinding by lazy { ViewDocumentBinding.bind(this) }
|
||||||
|
|
||||||
// region Lifecycle
|
// region Lifecycle
|
||||||
constructor(context: Context) : super(context)
|
constructor(context: Context) : super(context)
|
||||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
|
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
|
||||||
@ -22,6 +24,12 @@ class DocumentView : LinearLayout {
|
|||||||
binding.documentTitleTextView.text = document.fileName.or("Untitled File")
|
binding.documentTitleTextView.text = document.fileName.or("Untitled File")
|
||||||
binding.documentTitleTextView.setTextColor(textColor)
|
binding.documentTitleTextView.setTextColor(textColor)
|
||||||
binding.documentViewIconImageView.imageTintList = ColorStateList.valueOf(textColor)
|
binding.documentViewIconImageView.imageTintList = ColorStateList.valueOf(textColor)
|
||||||
|
|
||||||
|
// Show the progress spinner if the attachment is downloading, otherwise show
|
||||||
|
// the document icon (and always remove the other, whichever one that is)
|
||||||
|
binding.documentViewProgress.isVisible = message.isMediaPending
|
||||||
|
binding.documentViewIconImageView.isVisible = !message.isMediaPending
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
}
|
}
|
@ -318,4 +318,5 @@ class VisibleMessageContentView : ConstraintLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,6 @@ import kotlin.math.sqrt
|
|||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class VisibleMessageView : LinearLayout {
|
class VisibleMessageView : LinearLayout {
|
||||||
|
|
||||||
@Inject lateinit var threadDb: ThreadDatabase
|
@Inject lateinit var threadDb: ThreadDatabase
|
||||||
@Inject lateinit var lokiThreadDb: LokiThreadDatabase
|
@Inject lateinit var lokiThreadDb: LokiThreadDatabase
|
||||||
@Inject lateinit var lokiApiDb: LokiAPIDatabase
|
@Inject lateinit var lokiApiDb: LokiAPIDatabase
|
||||||
@ -138,8 +137,7 @@ class VisibleMessageView : LinearLayout {
|
|||||||
val isGroupThread = thread.isGroupRecipient
|
val isGroupThread = thread.isGroupRecipient
|
||||||
val isStartOfMessageCluster = isStartOfMessageCluster(message, previous, isGroupThread)
|
val isStartOfMessageCluster = isStartOfMessageCluster(message, previous, isGroupThread)
|
||||||
val isEndOfMessageCluster = isEndOfMessageCluster(message, next, isGroupThread)
|
val isEndOfMessageCluster = isEndOfMessageCluster(message, next, isGroupThread)
|
||||||
// Show profile picture and sender name if this is a group thread AND
|
// Show profile picture and sender name if this is a group thread AND the message is incoming
|
||||||
// the message is incoming
|
|
||||||
binding.moderatorIconImageView.isVisible = false
|
binding.moderatorIconImageView.isVisible = false
|
||||||
binding.profilePictureView.visibility = when {
|
binding.profilePictureView.visibility = when {
|
||||||
thread.isGroupRecipient && !message.isOutgoing && isEndOfMessageCluster -> View.VISIBLE
|
thread.isGroupRecipient && !message.isOutgoing && isEndOfMessageCluster -> View.VISIBLE
|
||||||
|
@ -10,10 +10,17 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:contentDescription="@string/AccessibilityId_document">
|
android:contentDescription="@string/AccessibilityId_document">
|
||||||
|
|
||||||
|
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||||
|
android:id="@+id/documentViewProgress"
|
||||||
|
style="@style/Widget.Material3.CircularProgressIndicator.Small"
|
||||||
|
android:indeterminate="true"
|
||||||
|
android:layout_width="36dp"
|
||||||
|
android:layout_height="36dp"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/documentViewIconImageView"
|
android:id="@+id/documentViewIconImageView"
|
||||||
android:layout_width="24dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="36dp"
|
||||||
android:src="@drawable/ic_document_large_light"
|
android:src="@drawable/ic_document_large_light"
|
||||||
app:tint="?android:textColorPrimary" />
|
app:tint="?android:textColorPrimary" />
|
||||||
|
|
||||||
|
@ -470,6 +470,7 @@
|
|||||||
<string name="conversation_activity__quick_attachment_drawer_record_and_send_audio_description">Record and send audio attachment</string>
|
<string name="conversation_activity__quick_attachment_drawer_record_and_send_audio_description">Record and send audio attachment</string>
|
||||||
<string name="conversation_activity__quick_attachment_drawer_lock_record_description">Lock recording of audio attachment</string>
|
<string name="conversation_activity__quick_attachment_drawer_lock_record_description">Lock recording of audio attachment</string>
|
||||||
<string name="conversation_activity__enable_signal_for_sms">Enable Session for SMS</string>
|
<string name="conversation_activity__enable_signal_for_sms">Enable Session for SMS</string>
|
||||||
|
<string name="conversation_activity__wait_until_attachment_has_finished_downloading">Please wait until attachment has finished downloading</string>
|
||||||
<!-- conversation_input_panel -->
|
<!-- conversation_input_panel -->
|
||||||
<string name="conversation_input_panel__slide_to_cancel">Slide to cancel</string>
|
<string name="conversation_input_panel__slide_to_cancel">Slide to cancel</string>
|
||||||
<string name="conversation_input_panel__cancel">Cancel</string>
|
<string name="conversation_input_panel__cancel">Cancel</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user