1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
|
package ml.docilealligator.infinityforreddit.fragments;
import android.Manifest;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.PersistableBundle;
import android.text.TextUtils;
import android.text.util.Linkify;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.fragment.app.Fragment;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.target.Target;
import com.bumptech.glide.request.transition.Transition;
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import com.github.piasy.biv.BigImageViewer;
import com.github.piasy.biv.loader.ImageLoader;
import com.github.piasy.biv.loader.glide.GlideImageLoader;
import com.github.piasy.biv.view.GlideImageViewFactory;
import java.io.File;
import java.util.concurrent.Executor;
import javax.inject.Inject;
import me.saket.bettermovementmethod.BetterLinkMovementMethod;
import ml.docilealligator.infinityforreddit.BuildConfig;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback;
import ml.docilealligator.infinityforreddit.activities.ViewRedditGalleryActivity;
import ml.docilealligator.infinityforreddit.asynctasks.SaveBitmapImageToFile;
import ml.docilealligator.infinityforreddit.asynctasks.SaveGIFToFile;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.CopyTextBottomSheetFragment;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.SetAsWallpaperBottomSheetFragment;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.UrlMenuBottomSheetFragment;
import ml.docilealligator.infinityforreddit.databinding.FragmentViewRedditGalleryImageOrGifBinding;
import ml.docilealligator.infinityforreddit.post.Post;
import ml.docilealligator.infinityforreddit.services.DownloadMediaService;
import ml.docilealligator.infinityforreddit.utils.Utils;
public class ViewRedditGalleryImageOrGifFragment extends Fragment {
public static final String EXTRA_REDDIT_GALLERY_MEDIA = "ERGM";
public static final String EXTRA_SUBREDDIT_NAME = "ESN";
public static final String EXTRA_INDEX = "EI";
public static final String EXTRA_MEDIA_COUNT = "EMC";
public static final String EXTRA_IS_NSFW = "EIN";
private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0;
@Inject
Executor mExecutor;
private ViewRedditGalleryActivity activity;
private RequestManager glide;
private Post.Gallery media;
private String subredditName;
private boolean isNsfw;
private boolean isDownloading = false;
private boolean isUseBottomCaption = false;
private boolean isFallback = false;
private FragmentViewRedditGalleryImageOrGifBinding binding;
public ViewRedditGalleryImageOrGifFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
BigImageViewer.initialize(GlideImageLoader.with(activity.getApplicationContext()));
binding = FragmentViewRedditGalleryImageOrGifBinding.inflate(inflater, container, false);
((Infinity) activity.getApplication()).getAppComponent().inject(this);
setHasOptionsMenu(true);
media = getArguments().getParcelable(EXTRA_REDDIT_GALLERY_MEDIA);
subredditName = getArguments().getString(EXTRA_SUBREDDIT_NAME);
isNsfw = getArguments().getBoolean(EXTRA_IS_NSFW, false);
glide = Glide.with(activity);
if (activity.typeface != null) {
binding.titleTextViewViewRedditGalleryImageOrGifFragment.setTypeface(activity.typeface);
binding.captionTextViewViewRedditGalleryImageOrGifFragment.setTypeface(activity.typeface);
binding.captionUrlTextViewViewRedditGalleryImageOrGifFragment.setTypeface(activity.typeface);
}
binding.imageViewViewRedditGalleryImageOrGifFragment.setImageViewFactory(new GlideImageViewFactory());
binding.imageViewViewRedditGalleryImageOrGifFragment.setImageLoaderCallback(new ImageLoader.Callback() {
@Override
public void onCacheHit(int imageType, File image) {
}
@Override
public void onCacheMiss(int imageType, File image) {
}
@Override
public void onStart() {
}
@Override
public void onProgress(int progress) {
}
@Override
public void onFinish() {
}
@Override
public void onSuccess(File image) {
binding.progressBarViewRedditGalleryImageOrGifFragment.setVisibility(View.GONE);
final SubsamplingScaleImageView view = binding.imageViewViewRedditGalleryImageOrGifFragment.getSSIV();
if (view != null) {
view.setOnImageEventListener(new SubsamplingScaleImageView.DefaultOnImageEventListener() {
@Override
public void onImageLoaded() {
view.setMinimumDpi(80);
view.setDoubleTapZoomDpi(240);
view.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED);
view.setQuickScaleEnabled(true);
view.resetScaleAndCenter();
}
@Override
public void onImageLoadError(Exception e) {
e.printStackTrace();
// For issue #558
// Make sure it's not stuck in a loop if it comes to that
// Fallback url should be empty if it's not an album item
if (!isFallback && media.hasFallback()) {
binding.imageViewViewRedditGalleryImageOrGifFragment.cancel();
isFallback = true;
loadImage();
} else {
isFallback = false;
}
}
});
}
}
@Override
public void onFail(Exception error) {
binding.progressBarViewRedditGalleryImageOrGifFragment.setVisibility(View.GONE);
binding.loadImageErrorLinearLayoutViewRedditGalleryImageOrGifFragment.setVisibility(View.VISIBLE);
}
});
loadImage();
String caption = media.caption;
String captionUrl = media.captionUrl;
boolean captionIsEmpty = TextUtils.isEmpty(caption);
boolean captionUrlIsEmpty = TextUtils.isEmpty(captionUrl);
boolean captionTextOrUrlIsNotEmpty = !captionIsEmpty || !captionUrlIsEmpty;
binding.imageViewViewRedditGalleryImageOrGifFragment.setOnClickListener(view -> {
if (activity.isActionBarHidden()) {
activity.getWindow().getDecorView().setSystemUiVisibility(0);
activity.setActionBarHidden(false);
if (activity.isUseBottomAppBar()) {
binding.bottomAppBarMenuViewRedditGalleryImageOrGifFragment.setVisibility(View.VISIBLE);
}
if (captionTextOrUrlIsNotEmpty) {
binding.captionLayoutViewRedditGalleryImageOrGifFragment.setVisibility(View.VISIBLE);
}
} else {
hideAppBar();
}
});
binding.captionLayoutViewRedditGalleryImageOrGifFragment.setOnClickListener(view -> hideAppBar());
binding.loadImageErrorLinearLayoutViewRedditGalleryImageOrGifFragment.setOnClickListener(view -> {
binding.progressBarViewRedditGalleryImageOrGifFragment.setVisibility(View.VISIBLE);
binding.loadImageErrorLinearLayoutViewRedditGalleryImageOrGifFragment.setVisibility(View.GONE);
loadImage();
});
if (activity.isUseBottomAppBar()) {
binding.bottomAppBarMenuViewRedditGalleryImageOrGifFragment.setVisibility(View.VISIBLE);
if (media.mediaType == Post.Gallery.TYPE_GIF) {
binding.titleTextViewViewRedditGalleryImageOrGifFragment.setText(getString(R.string.view_reddit_gallery_activity_gif_label,
getArguments().getInt(EXTRA_INDEX) + 1, getArguments().getInt(EXTRA_MEDIA_COUNT)));
} else {
binding.titleTextViewViewRedditGalleryImageOrGifFragment.setText(getString(R.string.view_reddit_gallery_activity_image_label,
getArguments().getInt(EXTRA_INDEX) + 1, getArguments().getInt(EXTRA_MEDIA_COUNT)));
}
binding.downloadImageViewViewRedditGalleryImageOrGifFragment.setOnClickListener(view -> {
if (isDownloading) {
return;
}
isDownloading = true;
requestPermissionAndDownload();
});
binding.shareImageViewViewRedditGalleryImageOrGifFragment.setOnClickListener(view -> {
if (media.mediaType == Post.Gallery.TYPE_GIF) {
shareGif();
} else {
shareImage();
}
});
binding.wallpaperImageViewViewRedditGalleryImageOrGifFragment.setOnClickListener(view -> {
setWallpaper();
});
}
if (captionTextOrUrlIsNotEmpty) {
isUseBottomCaption = true;
if (!activity.isUseBottomAppBar()) {
binding.bottomAppBarMenuViewRedditGalleryImageOrGifFragment.setVisibility(View.GONE);
}
binding.captionLayoutViewRedditGalleryImageOrGifFragment.setVisibility(View.VISIBLE);
if (!captionIsEmpty) {
binding.captionTextViewViewRedditGalleryImageOrGifFragment.setVisibility(View.VISIBLE);
binding.captionTextViewViewRedditGalleryImageOrGifFragment.setText(caption);
binding.captionTextViewViewRedditGalleryImageOrGifFragment.setOnClickListener(view -> hideAppBar());
binding.captionTextViewViewRedditGalleryImageOrGifFragment.setOnLongClickListener(view -> {
if (activity != null
&& !activity.isDestroyed()
&& !activity.isFinishing()
&& binding.captionTextViewViewRedditGalleryImageOrGifFragment.getSelectionStart() == -1
&& binding.captionTextViewViewRedditGalleryImageOrGifFragment.getSelectionEnd() == -1) {
CopyTextBottomSheetFragment.show(
activity.getSupportFragmentManager(), caption, null);
}
return true;
});
}
if (!captionUrlIsEmpty) {
String scheme = Uri.parse(captionUrl).getScheme();
String urlWithoutScheme = "";
if (!TextUtils.isEmpty(scheme)) {
urlWithoutScheme = captionUrl.substring(scheme.length() + 3);
}
binding.captionUrlTextViewViewRedditGalleryImageOrGifFragment.setText(TextUtils.isEmpty(urlWithoutScheme) ? captionUrl : urlWithoutScheme);
BetterLinkMovementMethod.linkify(Linkify.WEB_URLS, binding.captionUrlTextViewViewRedditGalleryImageOrGifFragment).setOnLinkLongClickListener((textView, url) -> {
if (activity != null && !activity.isDestroyed() && !activity.isFinishing()) {
UrlMenuBottomSheetFragment urlMenuBottomSheetFragment = UrlMenuBottomSheetFragment.newInstance(captionUrl);
urlMenuBottomSheetFragment.show(activity.getSupportFragmentManager(), null);
}
return true;
});
binding.captionUrlTextViewViewRedditGalleryImageOrGifFragment.setVisibility(View.VISIBLE);
binding.captionUrlTextViewViewRedditGalleryImageOrGifFragment.setHighlightColor(Color.TRANSPARENT);
}
} else {
binding.captionLayoutViewRedditGalleryImageOrGifFragment.setVisibility(View.GONE);
}
return binding.getRoot();
}
private void hideAppBar() {
activity.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE);
activity.setActionBarHidden(true);
if (activity.isUseBottomAppBar()) {
binding.bottomAppBarMenuViewRedditGalleryImageOrGifFragment.setVisibility(View.GONE);
}
binding.captionLayoutViewRedditGalleryImageOrGifFragment.setVisibility(View.GONE);
}
private void loadImage() {
if (isFallback) {
binding.imageViewViewRedditGalleryImageOrGifFragment.showImage(Uri.parse(media.fallbackUrl));
}
else{
binding.imageViewViewRedditGalleryImageOrGifFragment.showImage(Uri.parse(media.url));
}
}
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
inflater.inflate(R.menu.view_reddit_gallery_image_or_gif_fragment, menu);
for (int i = 0; i < menu.size(); i++) {
MenuItem item = menu.getItem(i);
Utils.setTitleWithCustomFontToMenuItem(activity.typeface, item, null);
}
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int itemId = item.getItemId();
if (itemId == R.id.action_download_view_reddit_gallery_image_or_gif_fragment) {
if (isDownloading) {
return false;
}
isDownloading = true;
requestPermissionAndDownload();
return true;
} else if (itemId == R.id.action_share_view_reddit_gallery_image_or_gif_fragment) {
if (media.mediaType == Post.Gallery.TYPE_GIF) {
shareGif();
} else {
shareImage();
}
return true;
} else if (itemId == R.id.action_set_wallpaper_view_reddit_gallery_image_or_gif_fragment) {
//setWallpaper();
Toast.makeText(activity, Integer.toString(activity.getWindow().getDecorView().getSystemUiVisibility()), Toast.LENGTH_SHORT).show();
return true;
}
return false;
}
private void requestPermissionAndDownload() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
if (ContextCompat.checkSelfPermission(activity,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
// Permission is not granted
// No explanation needed; request the permission
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE);
} else {
// Permission has already been granted
download();
}
} else {
download();
}
}
private void download() {
isDownloading = false;
PersistableBundle extras = new PersistableBundle();
extras.putString(DownloadMediaService.EXTRA_URL, media.hasFallback() ? media.fallbackUrl : media.url); // Retrieve original instead of the one additionally compressed by reddit
extras.putInt(DownloadMediaService.EXTRA_MEDIA_TYPE, media.mediaType == Post.Gallery.TYPE_GIF ? DownloadMediaService.EXTRA_MEDIA_TYPE_GIF: DownloadMediaService.EXTRA_MEDIA_TYPE_IMAGE);
extras.putString(DownloadMediaService.EXTRA_FILE_NAME, media.fileName);
extras.putString(DownloadMediaService.EXTRA_SUBREDDIT_NAME, subredditName);
extras.putInt(DownloadMediaService.EXTRA_IS_NSFW, isNsfw ? 1 : 0);
//TODO: contentEstimatedBytes
JobInfo jobInfo = DownloadMediaService.constructJobInfo(activity, 5000000, extras);
((JobScheduler) activity.getSystemService(Context.JOB_SCHEDULER_SERVICE)).schedule(jobInfo);
Toast.makeText(activity, R.string.download_started, Toast.LENGTH_SHORT).show();
}
//TODO: Find a way to share original image, Glide messes with the size and quality,
// compression should be up to the app being shared with (WhatsApp for example)
private void shareImage() {
glide.asBitmap().load(media.hasFallback() ? media.fallbackUrl : media.url).into(new CustomTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
if (activity.getExternalCacheDir() != null) {
Toast.makeText(activity, R.string.save_image_first, Toast.LENGTH_SHORT).show();
SaveBitmapImageToFile.SaveBitmapImageToFile(mExecutor, new Handler(), resource, activity.getExternalCacheDir().getPath(),
media.fileName,
new SaveBitmapImageToFile.SaveBitmapImageToFileListener() {
@Override
public void saveSuccess(File imageFile) {
Uri uri = FileProvider.getUriForFile(activity,
BuildConfig.APPLICATION_ID + ".provider", imageFile);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.setType("image/*");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
}
@Override
public void saveFailed() {
Toast.makeText(activity,
R.string.cannot_save_image, Toast.LENGTH_SHORT).show();
}
});
} else {
Toast.makeText(activity,
R.string.cannot_get_storage, Toast.LENGTH_SHORT).show();
}
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
private void shareGif() {
Toast.makeText(activity, R.string.save_gif_first, Toast.LENGTH_SHORT).show();
glide.asGif().load(media.url).listener(new RequestListener<GifDrawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) {
if (activity.getExternalCacheDir() != null) {
SaveGIFToFile.saveGifToFile(mExecutor, new Handler(), resource, activity.getExternalCacheDir().getPath(), media.fileName,
new SaveGIFToFile.SaveGIFToFileListener() {
@Override
public void saveSuccess(File imageFile) {
Uri uri = FileProvider.getUriForFile(activity,
BuildConfig.APPLICATION_ID + ".provider", imageFile);
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.setType("image/*");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
}
@Override
public void saveFailed() {
Toast.makeText(activity,
R.string.cannot_save_gif, Toast.LENGTH_SHORT).show();
}
});
} else {
Toast.makeText(activity,
R.string.cannot_get_storage, Toast.LENGTH_SHORT).show();
}
return false;
}
}).submit();
}
private void setWallpaper() {
if (media.mediaType != Post.Gallery.TYPE_GIF) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
SetAsWallpaperBottomSheetFragment setAsWallpaperBottomSheetFragment = new SetAsWallpaperBottomSheetFragment();
Bundle bundle = new Bundle();
bundle.putInt(SetAsWallpaperBottomSheetFragment.EXTRA_VIEW_PAGER_POSITION, activity.getCurrentPagePosition());
setAsWallpaperBottomSheetFragment.setArguments(bundle);
setAsWallpaperBottomSheetFragment.show(activity.getSupportFragmentManager(), setAsWallpaperBottomSheetFragment.getTag());
} else {
((SetAsWallpaperCallback) activity).setToBoth(activity.getCurrentPagePosition());
}
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE && grantResults.length > 0) {
if (grantResults[0] == PackageManager.PERMISSION_DENIED) {
Toast.makeText(activity, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
isDownloading = false;
} else if (grantResults[0] == PackageManager.PERMISSION_GRANTED && isDownloading) {
download();
}
}
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
activity = (ViewRedditGalleryActivity) context;
}
@Override
public void onResume() {
super.onResume();
SubsamplingScaleImageView ssiv = binding.imageViewViewRedditGalleryImageOrGifFragment.getSSIV();
if (ssiv == null || !ssiv.hasImage()) {
loadImage();
}
if (activity.isActionBarHidden()) {
activity.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE);
} else {
activity.getWindow().getDecorView().setSystemUiVisibility(0);
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding.imageViewViewRedditGalleryImageOrGifFragment.cancel();
isFallback = false;
SubsamplingScaleImageView subsamplingScaleImageView = binding.imageViewViewRedditGalleryImageOrGifFragment.getSSIV();
if (subsamplingScaleImageView != null) {
subsamplingScaleImageView.recycle();
}
}
}
|