|
|
@ -154,8 +154,6 @@ public final class ComposeActivity |
|
|
|
private static final int MEDIA_PICK_RESULT = 1; |
|
|
|
private static final int MEDIA_PICK_RESULT = 1; |
|
|
|
private static final int MEDIA_TAKE_PHOTO_RESULT = 2; |
|
|
|
private static final int MEDIA_TAKE_PHOTO_RESULT = 2; |
|
|
|
private static final int PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 1; |
|
|
|
private static final int PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 1; |
|
|
|
@Px |
|
|
|
|
|
|
|
private static final int THUMBNAIL_SIZE = 128; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final String SAVED_TOOT_UID_EXTRA = "saved_toot_uid"; |
|
|
|
private static final String SAVED_TOOT_UID_EXTRA = "saved_toot_uid"; |
|
|
|
private static final String SAVED_TOOT_TEXT_EXTRA = "saved_toot_text"; |
|
|
|
private static final String SAVED_TOOT_TEXT_EXTRA = "saved_toot_text"; |
|
|
@ -210,6 +208,7 @@ public final class ComposeActivity |
|
|
|
private int savedTootUid = 0; |
|
|
|
private int savedTootUid = 0; |
|
|
|
private List<Emoji> emojiList; |
|
|
|
private List<Emoji> emojiList; |
|
|
|
private int maximumTootCharacters = STATUS_CHARACTER_LIMIT; |
|
|
|
private int maximumTootCharacters = STATUS_CHARACTER_LIMIT; |
|
|
|
|
|
|
|
private @Px int thumbnailViewSize; |
|
|
|
|
|
|
|
|
|
|
|
private SaveTootHelper saveTootHelper; |
|
|
|
private SaveTootHelper saveTootHelper; |
|
|
|
|
|
|
|
|
|
|
@ -341,6 +340,8 @@ public final class ComposeActivity |
|
|
|
actionPhotoTake.setOnClickListener(v -> initiateCameraApp()); |
|
|
|
actionPhotoTake.setOnClickListener(v -> initiateCameraApp()); |
|
|
|
actionPhotoPick.setOnClickListener(v -> onMediaPick()); |
|
|
|
actionPhotoPick.setOnClickListener(v -> onMediaPick()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
thumbnailViewSize = getResources().getDimensionPixelSize(R.dimen.compose_media_preview_size); |
|
|
|
|
|
|
|
|
|
|
|
/* Initialise all the state, or restore it from a previous run, to determine a "starting" |
|
|
|
/* Initialise all the state, or restore it from a previous run, to determine a "starting" |
|
|
|
* state. */ |
|
|
|
* state. */ |
|
|
|
Status.Visibility startingVisibility = Status.Visibility.UNKNOWN; |
|
|
|
Status.Visibility startingVisibility = Status.Visibility.UNKNOWN; |
|
|
@ -527,7 +528,7 @@ public final class ComposeActivity |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (savedMediaQueued != null) { |
|
|
|
} else if (savedMediaQueued != null) { |
|
|
|
for (SavedQueuedMedia item : savedMediaQueued) { |
|
|
|
for (SavedQueuedMedia item : savedMediaQueued) { |
|
|
|
Bitmap preview = MediaUtils.getImageThumbnail(getContentResolver(), item.uri, THUMBNAIL_SIZE); |
|
|
|
Bitmap preview = MediaUtils.getImageThumbnail(getContentResolver(), item.uri, thumbnailViewSize); |
|
|
|
addMediaToQueue(item.id, item.type, preview, item.uri, item.mediaSize, item.readyStage, item.description); |
|
|
|
addMediaToQueue(item.id, item.type, preview, item.uri, item.mediaSize, item.readyStage, item.description); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (intent != null && savedInstanceState == null) { |
|
|
|
} else if (intent != null && savedInstanceState == null) { |
|
|
@ -1033,11 +1034,10 @@ public final class ComposeActivity |
|
|
|
item.readyStage = readyStage; |
|
|
|
item.readyStage = readyStage; |
|
|
|
ImageView view = item.preview; |
|
|
|
ImageView view = item.preview; |
|
|
|
Resources resources = getResources(); |
|
|
|
Resources resources = getResources(); |
|
|
|
int side = resources.getDimensionPixelSize(R.dimen.compose_media_preview_side); |
|
|
|
|
|
|
|
int margin = resources.getDimensionPixelSize(R.dimen.compose_media_preview_margin); |
|
|
|
int margin = resources.getDimensionPixelSize(R.dimen.compose_media_preview_margin); |
|
|
|
int marginBottom = resources.getDimensionPixelSize( |
|
|
|
int marginBottom = resources.getDimensionPixelSize( |
|
|
|
R.dimen.compose_media_preview_margin_bottom); |
|
|
|
R.dimen.compose_media_preview_margin_bottom); |
|
|
|
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(side, side); |
|
|
|
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(thumbnailViewSize, thumbnailViewSize); |
|
|
|
layoutParams.setMargins(margin, 0, margin, marginBottom); |
|
|
|
layoutParams.setMargins(margin, 0, margin, marginBottom); |
|
|
|
view.setLayoutParams(layoutParams); |
|
|
|
view.setLayoutParams(layoutParams); |
|
|
|
view.setScaleType(ImageView.ScaleType.CENTER_CROP); |
|
|
|
view.setScaleType(ImageView.ScaleType.CENTER_CROP); |
|
|
@ -1343,7 +1343,7 @@ public final class ComposeActivity |
|
|
|
displayTransientError(R.string.error_media_upload_image_or_video); |
|
|
|
displayTransientError(R.string.error_media_upload_image_or_video); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
Bitmap bitmap = MediaUtils.getVideoThumbnail(this, uri, THUMBNAIL_SIZE); |
|
|
|
Bitmap bitmap = MediaUtils.getVideoThumbnail(this, uri, thumbnailViewSize); |
|
|
|
if (bitmap != null) { |
|
|
|
if (bitmap != null) { |
|
|
|
addMediaToQueue(QueuedMedia.Type.VIDEO, bitmap, uri, mediaSize); |
|
|
|
addMediaToQueue(QueuedMedia.Type.VIDEO, bitmap, uri, mediaSize); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -1352,7 +1352,7 @@ public final class ComposeActivity |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
case "image": { |
|
|
|
case "image": { |
|
|
|
Bitmap bitmap = MediaUtils.getImageThumbnail(contentResolver, uri, THUMBNAIL_SIZE); |
|
|
|
Bitmap bitmap = MediaUtils.getImageThumbnail(contentResolver, uri, thumbnailViewSize); |
|
|
|
if (bitmap != null) { |
|
|
|
if (bitmap != null) { |
|
|
|
addMediaToQueue(QueuedMedia.Type.IMAGE, bitmap, uri, mediaSize); |
|
|
|
addMediaToQueue(QueuedMedia.Type.IMAGE, bitmap, uri, mediaSize); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|