M66B 4 years ago
parent f35fca5a1a
commit aae2808f5c

@ -67,10 +67,6 @@
<action android:name="android.intent.action.INSERT" />
</intent>
<intent>
<action android:name="android.intent.action.PICK" />
</intent>
<intent>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.OPENABLE" />

@ -3305,15 +3305,16 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private void onPickContact(String name, String email) {
Intent pick = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R && // should be system whitelisted
pick.resolveActivity(context.getPackageManager()) == null)
Snackbar.make(view, R.string.title_no_contacts, Snackbar.LENGTH_LONG)
.setGestureInsetBottomIgnored(true).show();
else {
properties.setValue("name", name);
properties.setValue("email", email);
properties.setValue("name", name);
properties.setValue("email", email);
try {
parentFragment.startActivityForResult(
Helper.getChooser(context, pick), FragmentMessages.REQUEST_PICK_CONTACT);
} catch (ActivityNotFoundException ex) {
Log.w(ex);
ToastEx.makeText(context, context.getString(R.string.title_no_viewer, pick), Toast.LENGTH_LONG).show();
} catch (Throwable ex) {
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex, false);
}
}
@ -3325,19 +3326,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
insert.putExtra(ContactsContract.Intents.Insert.NAME, name);
insert.setAction(Intent.ACTION_INSERT);
insert.setType(ContactsContract.Contacts.CONTENT_TYPE);
PackageManager pm = context.getPackageManager();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R && // should be system whitelisted
insert.resolveActivity(pm) == null)
Snackbar.make(parentFragment.getView(), R.string.title_no_contacts, Snackbar.LENGTH_LONG)
.setGestureInsetBottomIgnored(true).show();
else
try {
context.startActivity(insert);
} catch (ActivityNotFoundException ex) {
Log.w(ex);
ToastEx.makeText(context, context.getString(R.string.title_no_viewer, insert), Toast.LENGTH_LONG).show();
}
context.startActivity(insert);
}
private void onEditContact(String name, String email, Uri lookupUri) {
@ -3348,18 +3337,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
edit.putExtra(ContactsContract.Intents.Insert.NAME, name);
edit.setAction(Intent.ACTION_EDIT);
edit.setDataAndTypeAndNormalize(lookupUri, ContactsContract.Contacts.CONTENT_ITEM_TYPE);
PackageManager pm = context.getPackageManager();
if (edit.resolveActivity(pm) == null) // system whitelisted
Snackbar.make(parentFragment.getView(), R.string.title_no_contacts, Snackbar.LENGTH_LONG)
.setGestureInsetBottomIgnored(true).show();
else
try {
context.startActivity(edit);
} catch (ActivityNotFoundException ex) {
Log.w(ex);
ToastEx.makeText(context, context.getString(R.string.title_no_viewer, edit), Toast.LENGTH_LONG).show();
}
context.startActivity(edit);
}
private void onToggleMessage(TupleMessageEx message) {

@ -441,13 +441,7 @@ public class FragmentCompose extends FragmentBase {
}
Intent pick = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI);
PackageManager pm = getContext().getPackageManager();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R && // should be system whitelisted
pick.resolveActivity(pm) == null)
Snackbar.make(view, R.string.title_no_contacts, Snackbar.LENGTH_LONG)
.setGestureInsetBottomIgnored(true).show();
else
startActivityForResult(Helper.getChooser(getContext(), pick), request);
startActivityForResult(Helper.getChooser(getContext(), pick), request);
}
};

@ -23,11 +23,9 @@ 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;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.provider.ContactsContract;
@ -277,13 +275,7 @@ public class FragmentRule extends FragmentBase {
@Override
public void onClick(View v) {
Intent pick = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI);
PackageManager pm = getContext().getPackageManager();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R && // should be system whitelisted
pick.resolveActivity(pm) == null)
Snackbar.make(view, R.string.title_no_contacts, Snackbar.LENGTH_LONG)
.setGestureInsetBottomIgnored(true).show();
else
startActivityForResult(Helper.getChooser(getContext(), pick), REQUEST_SENDER);
startActivityForResult(Helper.getChooser(getContext(), pick), REQUEST_SENDER);
}
});
@ -300,13 +292,7 @@ public class FragmentRule extends FragmentBase {
@Override
public void onClick(View v) {
Intent pick = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Email.CONTENT_URI);
PackageManager pm = getContext().getPackageManager();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R && // should be system whitelisted
pick.resolveActivity(pm) == null)
Snackbar.make(view, R.string.title_no_contacts, Snackbar.LENGTH_LONG)
.setGestureInsetBottomIgnored(true).show();
else
startActivityForResult(Helper.getChooser(getContext(), pick), REQUEST_RECIPIENT);
startActivityForResult(Helper.getChooser(getContext(), pick), REQUEST_RECIPIENT);
}
});

@ -812,7 +812,6 @@
<string name="title_no_camera">No suitable camera app available</string>
<string name="title_no_saf">Storage access framework not available</string>
<string name="title_no_stream">An outdated app sent a file path instead of a file stream</string>
<string name="title_no_contacts">Contact picker not available</string>
<string name="title_no_internet">No or no suitable internet connection</string>
<string name="title_no_connection">Connecting to one or more accounts &#8230;</string>
<string name="title_no_folder">Folder does not exist</string>

Loading…
Cancel
Save