From f4ac1f68feac3e3b19ab5932ede9d79dd14bff27 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Wed, 26 Sep 2018 21:48:57 +0200 Subject: do not show media overview in contact/conference details when missing storage permission --- src/main/java/de/pixart/messenger/utils/Compatibility.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/main/java/de/pixart/messenger/utils/Compatibility.java') diff --git a/src/main/java/de/pixart/messenger/utils/Compatibility.java b/src/main/java/de/pixart/messenger/utils/Compatibility.java index 640a74083..3ebc7c4f6 100644 --- a/src/main/java/de/pixart/messenger/utils/Compatibility.java +++ b/src/main/java/de/pixart/messenger/utils/Compatibility.java @@ -2,12 +2,14 @@ package de.pixart.messenger.utils; import android.content.Context; import android.content.SharedPreferences; +import android.content.pm.PackageManager; import android.os.Build; import android.preference.Preference; import android.preference.PreferenceCategory; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; import android.support.annotation.BoolRes; +import android.support.v4.content.ContextCompat; import java.util.Arrays; import java.util.Collections; @@ -26,6 +28,10 @@ public class Compatibility { "vibrate_on_notification"); private static final List UNUESD_SETTINGS_PRE_TWENTYSIX = Collections.singletonList("more_notification_settings"); + public static boolean hasStoragePermission(Context context) { + return Build.VERSION.SDK_INT < Build.VERSION_CODES.M || ContextCompat.checkSelfPermission(context, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; + } + public static boolean twentySix() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O; } -- cgit v1.2.3