mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-29 13:24:52 +02:00
Insert contact group: permission warning
This commit is contained in:
@@ -62,6 +62,7 @@ public class FragmentDialogContactGroup extends FragmentDialogBase {
|
||||
final Spinner spGroup = dview.findViewById(R.id.spGroup);
|
||||
final Spinner spTarget = dview.findViewById(R.id.spTarget);
|
||||
final Spinner spType = dview.findViewById(R.id.spType);
|
||||
final TextView tvNoPermission = dview.findViewById(R.id.tvNoPermission);
|
||||
|
||||
ibInfo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -70,6 +71,9 @@ public class FragmentDialogContactGroup extends FragmentDialogBase {
|
||||
}
|
||||
});
|
||||
|
||||
spTarget.setSelection(focussed);
|
||||
tvNoPermission.setVisibility(View.GONE);
|
||||
|
||||
new SimpleTask<Cursor>() {
|
||||
@Override
|
||||
protected Cursor onExecute(Context context, Bundle args) {
|
||||
@@ -81,8 +85,11 @@ public class FragmentDialogContactGroup extends FragmentDialogBase {
|
||||
ContactsContract.Groups.ACCOUNT_TYPE,
|
||||
};
|
||||
|
||||
boolean permission = Helper.hasPermission(context, Manifest.permission.READ_CONTACTS);
|
||||
args.putBoolean("permission", permission);
|
||||
|
||||
Cursor contacts = new MatrixCursor(projection);
|
||||
if (Helper.hasPermission(context, Manifest.permission.READ_CONTACTS))
|
||||
if (permission)
|
||||
try {
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
contacts = resolver.query(
|
||||
@@ -140,6 +147,9 @@ public class FragmentDialogContactGroup extends FragmentDialogBase {
|
||||
});
|
||||
|
||||
spGroup.setAdapter(adapter);
|
||||
|
||||
boolean permission = args.getBoolean("permission");
|
||||
tvNoPermission.setVisibility(permission ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,8 +158,6 @@ public class FragmentDialogContactGroup extends FragmentDialogBase {
|
||||
}
|
||||
}.execute(this, new Bundle(), "compose:groups");
|
||||
|
||||
spTarget.setSelection(focussed);
|
||||
|
||||
return new AlertDialog.Builder(context)
|
||||
.setView(dview)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
|
||||
Reference in New Issue
Block a user