aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/AndroidManifest.xml3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java78
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java2
7 files changed, 46 insertions, 45 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index fb659b23..e790b06a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -18,7 +18,8 @@
android:maxSdkVersion="22" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
- <uses-permission-sdk-23 android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission-sdk-23 android:name="android.permission.WRITE_EXTERNAL_STORAGE"
+ android:maxSdkVersion="28" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java
index 3988d3c8..f0227961 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java
@@ -290,7 +290,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa
isDownloading = true;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
index 849a3853..a09d0954 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
@@ -539,7 +539,7 @@ public class ViewVideoActivity extends AppCompatActivity {
}
isDownloading = true;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java
index 0dcf1f01..973b0cee 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java
@@ -167,7 +167,7 @@ public class ViewImgurImageFragment extends Fragment {
isDownloading = true;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ 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) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
index 01961e17..1d3e2f51 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
@@ -149,7 +149,7 @@ public class ViewImgurVideoFragment extends Fragment {
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.action_download_view_imgur_video_fragment) {
isDownloading = true;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ 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) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java
index 75e3b2c6..89a99a39 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java
@@ -225,50 +225,50 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
- switch (item.getItemId()) {
- case R.id.action_download_view_reddit_gallery_image_or_gif_fragment:
- if (isDownloading) {
- return false;
- }
+ int itemId = item.getItemId();
+ if (itemId == R.id.action_download_view_reddit_gallery_image_or_gif_fragment) {
+ if (isDownloading) {
+ return false;
+ }
+
+ isDownloading = true;
- isDownloading = true;
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- 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();
- }
+ 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();
+ }
- return true;
- case R.id.action_share_view_reddit_gallery_image_or_gif_fragment:
- if (media.mediaType == Post.Gallery.TYPE_GIF) {
- shareGif();
- } else {
- shareImage();
- }
- return true;
- case R.id.action_set_wallpaper_view_reddit_gallery_image_or_gif_fragment:
- 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());
- }
- return true;
+ 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) {
+ 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());
+ }
+ return true;
}
return false;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java
index a1258ce2..386601fa 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java
@@ -152,7 +152,7 @@ public class ViewRedditGalleryVideoFragment extends Fragment {
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.action_download_view_reddit_gallery_video_fragment) {
isDownloading = true;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ 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) {