mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-05 20:45:39 +00:00
Default to 'All media' bucket for items from the rail.
This should give people a better multi-send experience when they want to add more media.
This commit is contained in:
parent
557e6a800f
commit
f70bf9c5bd
@ -2193,7 +2193,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onQuickAttachment(Uri uri, String mimeType, String bucketId, long dateTaken, int width, int height) {
|
public void onQuickAttachment(Uri uri, String mimeType, String bucketId, long dateTaken, int width, int height) {
|
||||||
Media media = new Media(uri, mimeType, dateTaken, width, height, Optional.fromNullable(bucketId), Optional.absent());
|
Media media = new Media(uri, mimeType, dateTaken, width, height, Optional.of(Media.ALL_MEDIA_BUCKET_ID), Optional.absent());
|
||||||
startActivityForResult(MediaSendActivity.getIntent(ConversationActivity.this, Collections.singletonList(media), recipient, composeText.getTextTrimmed(), sendButton.getSelectedTransport()), MEDIA_SENDER);
|
startActivityForResult(MediaSendActivity.getIntent(ConversationActivity.this, Collections.singletonList(media), recipient, composeText.getTextTrimmed(), sendButton.getSelectedTransport()), MEDIA_SENDER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,8 @@ import org.whispersystems.libsignal.util.guava.Optional;
|
|||||||
*/
|
*/
|
||||||
public class Media implements Parcelable {
|
public class Media implements Parcelable {
|
||||||
|
|
||||||
|
public static final String ALL_MEDIA_BUCKET_ID = "org.thoughtcrime.securesms.ALL_MEDIA";
|
||||||
|
|
||||||
private final Uri uri;
|
private final Uri uri;
|
||||||
private final String mimeType;
|
private final String mimeType;
|
||||||
private final long date;
|
private final long date;
|
||||||
|
@ -31,8 +31,6 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
class MediaRepository {
|
class MediaRepository {
|
||||||
|
|
||||||
private static final String ALL_MEDIA_BUCKET_ID = "org.thoughtcrime.securesms.ALL_MEDIA";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a list of folders that contain media.
|
* Retrieves a list of folders that contain media.
|
||||||
*/
|
*/
|
||||||
@ -80,7 +78,7 @@ class MediaRepository {
|
|||||||
allMediaCount += cameraFolder.getCount();
|
allMediaCount += cameraFolder.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
mediaFolders.add(0, new MediaFolder(allMediaThumbnail, context.getString(R.string.MediaRepository_all_media), allMediaCount, ALL_MEDIA_BUCKET_ID, MediaFolder.FolderType.NORMAL));
|
mediaFolders.add(0, new MediaFolder(allMediaThumbnail, context.getString(R.string.MediaRepository_all_media), allMediaCount, Media.ALL_MEDIA_BUCKET_ID, MediaFolder.FolderType.NORMAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cameraFolder != null) {
|
if (cameraFolder != null) {
|
||||||
@ -150,7 +148,7 @@ class MediaRepository {
|
|||||||
String[] projection = Build.VERSION.SDK_INT >= 16 ? new String[] { Images.Media._ID, Images.Media.MIME_TYPE, Images.Media.DATE_TAKEN, Images.Media.WIDTH, Images.Media.HEIGHT }
|
String[] projection = Build.VERSION.SDK_INT >= 16 ? new String[] { Images.Media._ID, Images.Media.MIME_TYPE, Images.Media.DATE_TAKEN, Images.Media.WIDTH, Images.Media.HEIGHT }
|
||||||
: new String[] { Images.Media._ID, Images.Media.MIME_TYPE, Images.Media.DATE_TAKEN };
|
: new String[] { Images.Media._ID, Images.Media.MIME_TYPE, Images.Media.DATE_TAKEN };
|
||||||
|
|
||||||
if (ALL_MEDIA_BUCKET_ID.equals(bucketId)) {
|
if (Media.ALL_MEDIA_BUCKET_ID.equals(bucketId)) {
|
||||||
selection = Images.Media.DATA + " NOT NULL";
|
selection = Images.Media.DATA + " NOT NULL";
|
||||||
selectionArgs = null;
|
selectionArgs = null;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ class MediaSendViewModel extends ViewModel {
|
|||||||
String candidate = media.get(0).getBucketId().get();
|
String candidate = media.get(0).getBucketId().get();
|
||||||
for (int i = 1; i < media.size(); i++) {
|
for (int i = 1; i < media.size(); i++) {
|
||||||
if (!Util.equals(candidate, media.get(i).getBucketId().orNull())) {
|
if (!Util.equals(candidate, media.get(i).getBucketId().orNull())) {
|
||||||
return Optional.absent();
|
return Optional.of(Media.ALL_MEDIA_BUCKET_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user