Implement new media send flow.

Update our media send flow to allow users to send multiple images/videos
at once. This change includes:

- New in-app media picker flow.
- Ability to caption images and videos.
- Image editing tools are made more prominent in the flow.
- Some fixes to the image editing tools.
This commit is contained in:
Greyson Parrelli
2018-11-20 09:59:23 -08:00
parent bae55f4b2f
commit 6fa7eca60b
83 changed files with 3270 additions and 247 deletions

View File

@@ -239,6 +239,8 @@ public class MediaUtil {
if ("com.android.providers.media.documents".equals(uri.getAuthority())) {
return uri.getLastPathSegment().contains("video");
} else if (uri.toString().startsWith(MediaStore.Video.Media.EXTERNAL_CONTENT_URI.toString())) {
return true;
}
return false;
@@ -248,6 +250,13 @@ public class MediaUtil {
if ("com.android.providers.media.documents".equals(uri.getAuthority())) {
long videoId = Long.parseLong(uri.getLastPathSegment().split(":")[1]);
return MediaStore.Video.Thumbnails.getThumbnail(context.getContentResolver(),
videoId,
MediaStore.Images.Thumbnails.MINI_KIND,
null);
} else if (uri.toString().startsWith(MediaStore.Video.Media.EXTERNAL_CONTENT_URI.toString())) {
long videoId = Long.parseLong(uri.getLastPathSegment());
return MediaStore.Video.Thumbnails.getThumbnail(context.getContentResolver(),
videoId,
MediaStore.Images.Thumbnails.MINI_KIND,

View File

@@ -5,7 +5,11 @@ import android.content.res.Resources;
import android.graphics.Color;
import android.support.annotation.AttrRes;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.support.v7.view.ContextThemeWrapper;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import org.thoughtcrime.securesms.R;
@@ -25,6 +29,11 @@ public class ThemeUtil {
return Color.RED;
}
public static LayoutInflater getThemedInflater(@NonNull Context context, @NonNull LayoutInflater inflater, @StyleRes int theme) {
Context contextThemeWrapper = new ContextThemeWrapper(context, theme);
return inflater.cloneInContext(contextThemeWrapper);
}
private static String getAttribute(Context context, int attribute, String defaultValue) {
TypedValue outValue = new TypedValue();

View File

@@ -133,6 +133,10 @@ public class Util {
return value == null || value.getText() == null || TextUtils.isEmpty(value.getTextTrimmed());
}
public static boolean isEmpty(Collection collection) {
return collection == null || collection.isEmpty();
}
public static <K, V> V getOrDefault(@NonNull Map<K, V> map, K key, V defaultValue) {
return map.containsKey(key) ? map.get(key) : defaultValue;
}