mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Display audio files as well as media & images
This commit is contained in:
parent
faf20eb369
commit
fde0ca60a1
9 changed files with 27 additions and 7 deletions
|
|
@ -49,7 +49,7 @@ class ConversationsFilesAdapter : ListAdapter<FileModel, RecyclerView.ViewHolder
|
|||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
val data = getItem(position)
|
||||
if (data.isMedia) return MEDIA_FILE
|
||||
if (data.isMedia || data.isAudio) return MEDIA_FILE
|
||||
return DOCUMENT_FILE
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -884,7 +884,7 @@ class ConversationFragment : SlidingPaneChildFragment() {
|
|||
putString("path", path)
|
||||
}
|
||||
when (FileUtils.getMimeType(mime)) {
|
||||
FileUtils.MimeType.Image, FileUtils.MimeType.Video -> {
|
||||
FileUtils.MimeType.Image, FileUtils.MimeType.Video, FileUtils.MimeType.Audio -> {
|
||||
bundle.putBoolean("isMedia", true)
|
||||
sharedViewModel.displayFileEvent.value = Event(bundle)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ class ConversationMediaListFragment : SlidingPaneChildFragment() {
|
|||
putString("path", path)
|
||||
}
|
||||
when (FileUtils.getMimeType(mime)) {
|
||||
FileUtils.MimeType.Image, FileUtils.MimeType.Video -> {
|
||||
FileUtils.MimeType.Image, FileUtils.MimeType.Video, FileUtils.MimeType.Audio -> {
|
||||
bundle.putBoolean("isMedia", true)
|
||||
sharedViewModel.displayFileEvent.value = Event(bundle)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ class MediaListViewerFragment : GenericFragment() {
|
|||
|
||||
val position = if (index == -1) {
|
||||
Log.e("$TAG File [$path] not found, using latest one available instead!")
|
||||
// TODO: show error toast
|
||||
count - 1
|
||||
} else {
|
||||
index
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ class MediaViewModel @UiThread constructor() : ViewModel() {
|
|||
FileUtils.MimeType.Audio -> {
|
||||
Log.i("$TAG File [$file] seems to be an audio file")
|
||||
isAudio.value = true
|
||||
// TODO FIXME: handle audio files
|
||||
}
|
||||
else -> { }
|
||||
}
|
||||
|
|
|
|||
5
app/src/main/res/drawable/shape_squircle_main2_200.xml
Normal file
5
app/src/main/res/drawable/shape_squircle_main2_200.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<corners android:radius="10dp" />
|
||||
<solid android:color="?attr/color_main2_200" />
|
||||
</shape>
|
||||
|
|
@ -9,7 +9,6 @@
|
|||
type="org.linphone.ui.main.chat.model.FileModel" />
|
||||
</data>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
|
@ -56,6 +55,22 @@
|
|||
app:layout_constraintEnd_toEndOf="@id/image"
|
||||
app:tint="@color/white" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/audio_file"
|
||||
android:layout_width="@dimen/chat_bubble_grid_image_size"
|
||||
android:layout_height="@dimen/chat_bubble_grid_image_size"
|
||||
android:adjustViewBounds="true"
|
||||
android:padding="18dp"
|
||||
android:background="@drawable/shape_squircle_main2_200"
|
||||
android:src="@drawable/file_audio"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="@{model.isAudio ? View.VISIBLE : View.GONE, default=gone}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:tint="?attr/color_main2_600" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -626,7 +626,7 @@
|
|||
|
||||
<!-- Misc -->
|
||||
<string name="multiple_participants_selection_placeholder">Les participants selectionnés apparaîtront ici</string>
|
||||
<string name="connection_error_for_non_default_account">Erreur de connexion au compte</string>
|
||||
<string name="connection_error_for_non_default_account">Compte(s) non connecté(s)</string>
|
||||
<string name="network_not_reachable">Vous n\'êtes pas connecté à internet</string>
|
||||
<string name="operation_in_progress_overlay">Opération en cours, merci de patienter…</string>
|
||||
|
||||
|
|
|
|||
|
|
@ -662,7 +662,7 @@
|
|||
|
||||
<!-- Misc -->
|
||||
<string name="multiple_participants_selection_placeholder">Selected participants will appear here</string>
|
||||
<string name="connection_error_for_non_default_account">Account connection error</string>
|
||||
<string name="connection_error_for_non_default_account">Account(s) connection error</string>
|
||||
<string name="network_not_reachable">You aren\'t connected to internet</string>
|
||||
<string name="operation_in_progress_overlay">Operation in progress, please wait</string>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue