mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-28 10:47:46 +00:00
parent
71276161fc
commit
791cc4b4f8
@ -1143,7 +1143,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
case AttachmentTypeSelectorAdapter.TAKE_PHOTO:
|
||||
attachmentManager.capturePhoto(this, TAKE_PHOTO); break;
|
||||
case AttachmentTypeSelector.ADD_GIF:
|
||||
AttachmentManager.selectGif(this, PICK_GIF); break;
|
||||
AttachmentManager.selectGif(this, PICK_GIF, !isSecureText); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,10 @@ public class GiphyImage {
|
||||
return images.downsized.url;
|
||||
}
|
||||
|
||||
public String getGifMmsUrl() {
|
||||
return images.fixed_height_downsampled.url;
|
||||
}
|
||||
|
||||
public float getGifAspectRatio() {
|
||||
return (float)images.downsized.width / (float)images.downsized.height;
|
||||
}
|
||||
|
@ -35,11 +35,14 @@ public class GiphyActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
private static final String TAG = GiphyActivity.class.getSimpleName();
|
||||
|
||||
public static final String EXTRA_IS_MMS = "extra_is_mms";
|
||||
|
||||
private final DynamicTheme dynamicTheme = new DynamicNoActionBarTheme();
|
||||
private final DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
||||
|
||||
private GiphyGifFragment gifFragment;
|
||||
private GiphyStickerFragment stickerFragment;
|
||||
private boolean forMms;
|
||||
|
||||
private GiphyAdapter.GiphyViewHolder finishingImage;
|
||||
|
||||
@ -74,6 +77,7 @@ public class GiphyActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
this.gifFragment = new GiphyGifFragment();
|
||||
this.stickerFragment = new GiphyStickerFragment();
|
||||
this.forMms = getIntent().getBooleanExtra(EXTRA_IS_MMS, false);
|
||||
|
||||
gifFragment.setClickListener(this);
|
||||
stickerFragment.setClickListener(this);
|
||||
@ -105,7 +109,7 @@ public class GiphyActivity extends PassphraseRequiredActionBarActivity
|
||||
@Override
|
||||
protected Uri doInBackground(Void... params) {
|
||||
try {
|
||||
return Uri.fromFile(viewHolder.getFile());
|
||||
return Uri.fromFile(viewHolder.getFile(forMms));
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
Log.w(TAG, e);
|
||||
return null;
|
||||
|
@ -83,7 +83,7 @@ public class GiphyAdapter extends RecyclerView.Adapter<GiphyAdapter.GiphyViewHol
|
||||
return false;
|
||||
}
|
||||
|
||||
public File getFile() throws ExecutionException, InterruptedException {
|
||||
public File getFile(boolean forMms) throws ExecutionException, InterruptedException {
|
||||
synchronized (this) {
|
||||
while (!modelReady) {
|
||||
Util.wait(this, 0);
|
||||
@ -91,7 +91,7 @@ public class GiphyAdapter extends RecyclerView.Adapter<GiphyAdapter.GiphyViewHol
|
||||
}
|
||||
|
||||
return Glide.with(context)
|
||||
.load(image.getGifUrl())
|
||||
.load(forMms ? image.getGifMmsUrl() : image.getGifUrl())
|
||||
.downloadOnly(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
|
||||
.get();
|
||||
}
|
||||
|
@ -264,8 +264,9 @@ public class AttachmentManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static void selectGif(Activity activity, int requestCode) {
|
||||
public static void selectGif(Activity activity, int requestCode, boolean isForMms) {
|
||||
Intent intent = new Intent(activity, GiphyActivity.class);
|
||||
intent.putExtra(GiphyActivity.EXTRA_IS_MMS, isForMms);
|
||||
activity.startActivityForResult(intent, requestCode);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user