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