Remove storage permission for Android Q and up.

This commit is contained in:
Alex Ning 2021-07-15 08:33:44 +08:00
parent 054a24fcfc
commit c30dcf415d
7 changed files with 44 additions and 43 deletions

View File

@ -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" />

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -225,15 +225,15 @@ 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:
int itemId = item.getItemId();
if (itemId == R.id.action_download_view_reddit_gallery_image_or_gif_fragment) {
if (isDownloading) {
return false;
}
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) {
@ -251,14 +251,14 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
}
return true;
case R.id.action_share_view_reddit_gallery_image_or_gif_fragment:
} 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;
case R.id.action_set_wallpaper_view_reddit_gallery_image_or_gif_fragment:
} 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();

View File

@ -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) {