mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Refresh shared media screens.
This commit is contained in:
committed by
Cody Henthorne
parent
e584a90f81
commit
416e62112f
@@ -26,6 +26,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
@@ -421,16 +422,21 @@ final class MediaGalleryAllAdapter extends StickyHeaderGridAdapter {
|
||||
line1.setText(describe(fromToPair.first(), fromToPair.second()));
|
||||
}
|
||||
|
||||
private String describe(@NonNull Recipient from, @NonNull Recipient thread) {
|
||||
protected @Nullable String getMediaTitle() {
|
||||
return fileName.orNull();
|
||||
}
|
||||
|
||||
private @NonNull String describe(@NonNull Recipient from, @NonNull Recipient thread) {
|
||||
if (from == Recipient.UNKNOWN && thread == Recipient.UNKNOWN) {
|
||||
return fileName.or(fileTypeDescription);
|
||||
}
|
||||
|
||||
String sentFromToString = getSentFromToString(from, thread);
|
||||
String mediaTitle = getMediaTitle();
|
||||
|
||||
if (fileName.isPresent()) {
|
||||
if (mediaTitle != null) {
|
||||
return context.getString(R.string.MediaOverviewActivity_detail_line_2_part,
|
||||
fileName.get(),
|
||||
mediaTitle,
|
||||
sentFromToString);
|
||||
} else {
|
||||
return sentFromToString;
|
||||
@@ -479,6 +485,8 @@ final class MediaGalleryAllAdapter extends StickyHeaderGridAdapter {
|
||||
|
||||
private final AudioView audioView;
|
||||
|
||||
private boolean isVoiceNote;
|
||||
|
||||
AudioDetailViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
this.audioView = itemView.findViewById(R.id.audio);
|
||||
@@ -486,12 +494,14 @@ final class MediaGalleryAllAdapter extends StickyHeaderGridAdapter {
|
||||
|
||||
@Override
|
||||
public void bind(@NonNull Context context, @NonNull MediaDatabase.MediaRecord mediaRecord, @NonNull Slide slide) {
|
||||
super.bind(context, mediaRecord, slide);
|
||||
|
||||
if (!slide.hasAudio()) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
isVoiceNote = slide.asAttachment().isVoiceNote();
|
||||
|
||||
super.bind(context, mediaRecord, slide);
|
||||
|
||||
long mmsId = Objects.requireNonNull(mediaRecord.getAttachment()).getMmsId();
|
||||
|
||||
audioItemListener.unregisterPlaybackStateObserver(audioView.getPlaybackStateObserver());
|
||||
@@ -502,6 +512,11 @@ final class MediaGalleryAllAdapter extends StickyHeaderGridAdapter {
|
||||
itemView.setOnClickListener(view -> itemClickListener.onMediaClicked(mediaRecord));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NonNull String getMediaTitle() {
|
||||
return context.getString(R.string.ThreadRecord_voice_message);
|
||||
}
|
||||
|
||||
@Override
|
||||
void unbind() {
|
||||
super.unbind();
|
||||
|
||||
Reference in New Issue
Block a user