Package visibility changes

This commit is contained in:
M66B
2020-06-14 18:34:13 +02:00
parent 3dac4d407e
commit f30a175836
20 changed files with 159 additions and 113 deletions

View File

@@ -23,6 +23,7 @@ import android.app.Dialog;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Color;
import android.net.Uri;
@@ -261,7 +262,8 @@ public class FragmentRule extends FragmentBase {
@Override
public void onClick(View v) {
Intent pick = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI);
if (pick.resolveActivity(getContext().getPackageManager()) == null)
PackageManager pm = getContext().getPackageManager();
if (pick.resolveActivity(pm) == null) // system whitelisted
Snackbar.make(view, R.string.title_no_contacts, Snackbar.LENGTH_LONG).show();
else
startActivityForResult(Helper.getChooser(getContext(), pick), REQUEST_SENDER);
@@ -281,7 +283,8 @@ public class FragmentRule extends FragmentBase {
@Override
public void onClick(View v) {
Intent pick = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI);
if (pick.resolveActivity(getContext().getPackageManager()) == null)
PackageManager pm = getContext().getPackageManager();
if (pick.resolveActivity(pm) == null) // system whitelisted
Snackbar.make(view, R.string.title_no_contacts, Snackbar.LENGTH_LONG).show();
else
startActivityForResult(Helper.getChooser(getContext(), pick), REQUEST_RECIPIENT);