mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 11:22:21 +00:00
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:
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user