Media: clean up code
This commit is contained in:
parent
730f50a433
commit
e3457fb594
5 changed files with 8 additions and 9 deletions
|
|
@ -26,6 +26,4 @@ import kotlinx.parcelize.Parcelize
|
||||||
data class LocalMedia(
|
data class LocalMedia(
|
||||||
val uri: Uri,
|
val uri: Uri,
|
||||||
val info: MediaInfo,
|
val info: MediaInfo,
|
||||||
) : Parcelable {
|
) : Parcelable
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import io.element.android.libraries.matrix.api.media.MediaFile
|
||||||
interface LocalMediaFactory {
|
interface LocalMediaFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will create a [LocalMedia] with the given [MediaFile] and [MediaInfo]
|
* This method will create a [LocalMedia] with the given [MediaFile] and [MediaInfo].
|
||||||
*/
|
*/
|
||||||
fun createFromMediaFile(
|
fun createFromMediaFile(
|
||||||
mediaFile: MediaFile,
|
mediaFile: MediaFile,
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@ import io.element.android.libraries.designsystem.theme.components.TopAppBar
|
||||||
import io.element.android.libraries.designsystem.utils.rememberSnackbarHostState
|
import io.element.android.libraries.designsystem.utils.rememberSnackbarHostState
|
||||||
import io.element.android.libraries.matrix.api.media.MediaSource
|
import io.element.android.libraries.matrix.api.media.MediaSource
|
||||||
import io.element.android.libraries.matrix.ui.media.MediaRequestData
|
import io.element.android.libraries.matrix.ui.media.MediaRequestData
|
||||||
import io.element.android.libraries.ui.strings.R.*
|
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import io.element.android.libraries.ui.strings.R as StringR
|
import io.element.android.libraries.ui.strings.R as StringR
|
||||||
|
|
||||||
|
|
@ -181,7 +180,7 @@ private fun MediaViewerTopBar(
|
||||||
eventSink(MediaViewerEvents.OpenWith)
|
eventSink(MediaViewerEvents.OpenWith)
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
Icon(imageVector = Icons.Default.OpenInNew, contentDescription = stringResource(id = string.action_share))
|
Icon(imageVector = Icons.Default.OpenInNew, contentDescription = stringResource(id = StringR.string.action_open_with))
|
||||||
}
|
}
|
||||||
IconButton(
|
IconButton(
|
||||||
enabled = actionsEnabled,
|
enabled = actionsEnabled,
|
||||||
|
|
@ -189,7 +188,7 @@ private fun MediaViewerTopBar(
|
||||||
eventSink(MediaViewerEvents.SaveOnDisk)
|
eventSink(MediaViewerEvents.SaveOnDisk)
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
Icon(imageVector = Icons.Default.Download, contentDescription = stringResource(id = string.action_save))
|
Icon(imageVector = Icons.Default.Download, contentDescription = stringResource(id = StringR.string.action_save))
|
||||||
}
|
}
|
||||||
IconButton(
|
IconButton(
|
||||||
enabled = actionsEnabled,
|
enabled = actionsEnabled,
|
||||||
|
|
@ -197,7 +196,7 @@ private fun MediaViewerTopBar(
|
||||||
eventSink(MediaViewerEvents.Share)
|
eventSink(MediaViewerEvents.Share)
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
Icon(imageVector = Icons.Default.Share, contentDescription = stringResource(id = string.action_share))
|
Icon(imageVector = Icons.Default.Share, contentDescription = stringResource(id = StringR.string.action_share))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ interface MatrixMediaLoader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param source to fetch the data for.
|
* @param source to fetch the data for.
|
||||||
* @param mimeType: optional mime type
|
* @param mimeType: optional mime type.
|
||||||
|
* @param body: optional body which will be used to name the file.
|
||||||
* @return a [Result] of [MediaFile]
|
* @return a [Result] of [MediaFile]
|
||||||
*/
|
*/
|
||||||
suspend fun downloadMediaFile(source: MediaSource, mimeType: String?, body: String?): Result<MediaFile>
|
suspend fun downloadMediaFile(source: MediaSource, mimeType: String?, body: String?): Result<MediaFile>
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
<string name="action_no">"No"</string>
|
<string name="action_no">"No"</string>
|
||||||
<string name="action_not_now">"Not now"</string>
|
<string name="action_not_now">"Not now"</string>
|
||||||
<string name="action_ok">"OK"</string>
|
<string name="action_ok">"OK"</string>
|
||||||
|
<string name="action_open_with">"Open with"</string>
|
||||||
<string name="action_quick_reply">"Quick reply"</string>
|
<string name="action_quick_reply">"Quick reply"</string>
|
||||||
<string name="action_quote">"Quote"</string>
|
<string name="action_quote">"Quote"</string>
|
||||||
<string name="action_remove">"Remove"</string>
|
<string name="action_remove">"Remove"</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue