diff --git a/app/src/main/java/dummydomain/yetanothercallblocker/MainActivity.java b/app/src/main/java/dummydomain/yetanothercallblocker/MainActivity.java
index b7b9316..dadab73 100644
--- a/app/src/main/java/dummydomain/yetanothercallblocker/MainActivity.java
+++ b/app/src/main/java/dummydomain/yetanothercallblocker/MainActivity.java
@@ -75,7 +75,7 @@ public class MainActivity extends AppCompatActivity {
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
- // TODO: handle
+ PermissionHelper.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
loadCallLog();
}
diff --git a/app/src/main/java/dummydomain/yetanothercallblocker/PermissionHelper.java b/app/src/main/java/dummydomain/yetanothercallblocker/PermissionHelper.java
index 7da223d..64c06c0 100644
--- a/app/src/main/java/dummydomain/yetanothercallblocker/PermissionHelper.java
+++ b/app/src/main/java/dummydomain/yetanothercallblocker/PermissionHelper.java
@@ -4,7 +4,9 @@ import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
+import android.widget.Toast;
+import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
@@ -41,6 +43,27 @@ public class PermissionHelper {
}
}
+ public static void onRequestPermissionsResult(@NonNull Context context, int requestCode,
+ @NonNull String[] permissions,
+ @NonNull int[] grantResults) {
+ boolean denied = false;
+
+ if (permissions.length == 0) {
+ denied = true;
+ } else {
+ for (int grantResult : grantResults) {
+ if (grantResult != PackageManager.PERMISSION_GRANTED) {
+ denied = true;
+ break;
+ }
+ }
+ }
+
+ if (denied) {
+ Toast.makeText(context, R.string.denied_permissions_message, Toast.LENGTH_SHORT).show();
+ }
+ }
+
public static boolean havePermission(Context context, String permission) {
return ContextCompat.checkSelfPermission(context, permission)
== PackageManager.PERMISSION_GRANTED;
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0eca0b0..0c67ea4 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -50,6 +50,8 @@
Reviews
Loading reviews…
+ Some functionality may not work due to denied permissions
+
General settings
Download main database