kopia lustrzana https://github.com/ryukoposting/Signal-Android
Add edit button for media preview.
rodzic
2f0f4f94a2
commit
7c4c146189
|
@ -36,6 +36,7 @@ import org.thoughtcrime.securesms.conversation.mutiselect.forward.MultiselectFor
|
|||
import org.thoughtcrime.securesms.database.MediaDatabase
|
||||
import org.thoughtcrime.securesms.databinding.FragmentMediaPreviewV2Binding
|
||||
import org.thoughtcrime.securesms.mediasend.Media
|
||||
import org.thoughtcrime.securesms.mediasend.v2.MediaSelectionActivity
|
||||
import org.thoughtcrime.securesms.mms.GlideApp
|
||||
import org.thoughtcrime.securesms.mms.PartAuthority
|
||||
import org.thoughtcrime.securesms.permissions.Permissions
|
||||
|
@ -202,6 +203,7 @@ class MediaPreviewV2Fragment : Fragment(R.layout.fragment_media_preview_v2), Med
|
|||
|
||||
binding.toolbar.setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
R.id.edit -> editMediaItem(currentItem)
|
||||
R.id.save -> saveToDisk(currentItem)
|
||||
R.id.delete -> deleteMedia(currentItem)
|
||||
android.R.id.home -> requireActivity().finish()
|
||||
|
@ -410,6 +412,20 @@ class MediaPreviewV2Fragment : Fragment(R.layout.fragment_media_preview_v2), Med
|
|||
.show()
|
||||
}
|
||||
|
||||
private fun editMediaItem(currentItem: MediaDatabase.MediaRecord) {
|
||||
val media = currentItem.toMedia()
|
||||
if (media == null) {
|
||||
val rootView = view
|
||||
if (rootView != null) {
|
||||
Snackbar.make(rootView, R.string.MediaPreviewFragment_edit_media_error, Snackbar.LENGTH_INDEFINITE).show()
|
||||
} else {
|
||||
Toast.makeText(requireContext(), R.string.MediaPreviewFragment_edit_media_error, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
return
|
||||
}
|
||||
startActivity(MediaSelectionActivity.editor(context = requireContext(), media = listOf(media)))
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
getMediaPreviewFragmentFromChildFragmentManager(binding.mediaPager.currentItem)?.pause()
|
||||
|
|
|
@ -415,6 +415,17 @@ class MediaSelectionActivity :
|
|||
)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun editor(
|
||||
context: Context,
|
||||
media: List<Media>,
|
||||
): Intent {
|
||||
return buildIntent(
|
||||
context = context,
|
||||
media = media
|
||||
)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun share(
|
||||
context: Context,
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M15.622,8.813C16.688,8.813 17.59,8.126 17.939,7.183H21.487C21.907,7.183 22.276,6.813 22.276,6.352C22.276,5.891 21.907,5.532 21.487,5.532H17.939C17.601,4.578 16.688,3.881 15.622,3.881C14.555,3.881 13.632,4.578 13.294,5.532H2.435C1.974,5.532 1.615,5.891 1.615,6.352C1.615,6.813 1.974,7.183 2.435,7.183H13.304C13.643,8.126 14.555,8.813 15.622,8.813ZM15.622,7.552C14.945,7.552 14.422,7.019 14.422,6.342C14.422,5.665 14.945,5.142 15.622,5.142C16.298,5.142 16.821,5.665 16.821,6.342C16.821,7.019 16.298,7.552 15.622,7.552ZM2.394,11.787C1.974,11.787 1.615,12.156 1.615,12.617C1.615,13.079 1.974,13.438 2.394,13.438H6.065C6.403,14.401 7.316,15.088 8.382,15.088C9.449,15.088 10.361,14.401 10.71,13.438H21.446C21.907,13.438 22.276,13.079 22.276,12.617C22.276,12.156 21.907,11.787 21.446,11.787H10.7C10.361,10.843 9.449,10.156 8.382,10.156C7.316,10.156 6.403,10.843 6.065,11.787H2.394ZM8.382,13.817C7.716,13.817 7.183,13.284 7.183,12.617C7.183,11.94 7.716,11.417 8.382,11.417C9.059,11.417 9.582,11.94 9.582,12.617C9.582,13.284 9.059,13.817 8.382,13.817ZM15.622,21.343C16.688,21.343 17.601,20.656 17.939,19.703H21.487C21.907,19.703 22.276,19.344 22.276,18.882C22.276,18.421 21.907,18.052 21.487,18.052H17.939C17.601,17.098 16.688,16.421 15.622,16.421C14.555,16.421 13.643,17.098 13.304,18.052H2.435C1.974,18.052 1.615,18.421 1.615,18.882C1.615,19.344 1.974,19.703 2.435,19.703H13.294C13.643,20.656 14.555,21.343 15.622,21.343ZM15.622,20.082C14.945,20.082 14.422,19.549 14.422,18.882C14.422,18.195 14.945,17.683 15.622,17.683C16.298,17.683 16.821,18.195 16.821,18.882C16.821,19.549 16.298,20.082 15.622,20.082Z"
|
||||
android:fillColor="#000000"/>
|
||||
android:fillColor="@color/signal_colorOnSurface"/>
|
||||
</vector>
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item android:id="@+id/edit"
|
||||
android:title="@string/media_preview__edit_title"
|
||||
android:icon="@drawable/ic_editmedia_outline_24"
|
||||
app:showAsAction="never"/>
|
||||
<item android:id="@+id/save"
|
||||
android:title="@string/media_preview__save_title"
|
||||
android:icon="@drawable/ic_download_filled_white_24"
|
||||
|
|
|
@ -2019,6 +2019,7 @@
|
|||
<string name="MediaPreviewActivity_media_no_longer_available">Media no longer available.</string>
|
||||
<string name="MediaPreviewActivity_cant_find_an_app_able_to_share_this_media">Can\'t find an app able to share this media.</string>
|
||||
<string name="MediaPreviewActivity_dismiss_due_to_error">Close</string>
|
||||
<string name="MediaPreviewFragment_edit_media_error">Media Error</string>
|
||||
|
||||
<!-- MessageNotifier -->
|
||||
<string name="MessageNotifier_d_new_messages_in_d_conversations">%1$d new messages in %2$d conversations</string>
|
||||
|
|
Ładowanie…
Reference in New Issue