Address book requires contacts permissions

pull/146/head
M66B 6 years ago
parent 52be6a33ae
commit 94421c1e9a

@ -104,6 +104,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
private ViewType viewType; private ViewType viewType;
private IProperties properties; private IProperties properties;
private boolean contacts;
private boolean avatars; private boolean avatars;
private boolean debug; private boolean debug;
@ -349,6 +350,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
tvTime.setTextColor(colorUnseen); tvTime.setTextColor(colorUnseen);
grpExpanded.setVisibility(viewType == ViewType.THREAD && show_expanded ? View.VISIBLE : View.GONE); grpExpanded.setVisibility(viewType == ViewType.THREAD && show_expanded ? View.VISIBLE : View.GONE);
ivAddContact.setVisibility(viewType == ViewType.THREAD && show_expanded && contacts ? View.VISIBLE : View.GONE);
pbHeaders.setVisibility(View.GONE); pbHeaders.setVisibility(View.GONE);
grpHeaders.setVisibility(show_headers && show_expanded ? View.VISIBLE : View.GONE); grpHeaders.setVisibility(show_headers && show_expanded ? View.VISIBLE : View.GONE);
bnvActions.setVisibility(View.GONE); bnvActions.setVisibility(View.GONE);
@ -373,7 +375,6 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
tvTimeEx.setText(df.format(new Date(message.received))); tvTimeEx.setText(df.format(new Date(message.received)));
} }
ivAddContact.setVisibility(viewType == ViewType.THREAD ? View.VISIBLE : View.GONE);
tvTo.setText(MessageHelper.getFormattedAddresses(message.to, true)); tvTo.setText(MessageHelper.getFormattedAddresses(message.to, true));
tvReplyTo.setText(MessageHelper.getFormattedAddresses(message.reply, true)); tvReplyTo.setText(MessageHelper.getFormattedAddresses(message.reply, true));
tvCc.setText(MessageHelper.getFormattedAddresses(message.cc, true)); tvCc.setText(MessageHelper.getFormattedAddresses(message.cc, true));
@ -1328,9 +1329,10 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
this.avatars = (prefs.getBoolean("avatars", true) &&
ContextCompat.checkSelfPermission(context, Manifest.permission.READ_CONTACTS) this.contacts = (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_CONTACTS)
== PackageManager.PERMISSION_GRANTED); == PackageManager.PERMISSION_GRANTED);
this.avatars = (prefs.getBoolean("avatars", true) && this.contacts);
this.debug = prefs.getBoolean("debug", false); this.debug = prefs.getBoolean("debug", false);
} }

@ -494,6 +494,6 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:visibility="visible" android:visibility="visible"
app:constraint_referenced_ids="ivAddContact,vSeparatorAddress,tvFromExTitle,tvFromEx,tvToTitle,tvTo,tvReplyToTitle,tvReplyTo,tvCcTitle,tvCc,tvBccTitle,tvBcc,tvTimeEx,tvSubjectEx,tvBody" /> app:constraint_referenced_ids="vSeparatorAddress,tvFromExTitle,tvFromEx,tvToTitle,tvTo,tvReplyToTitle,tvReplyTo,tvCcTitle,tvCc,tvBccTitle,tvBcc,tvTimeEx,tvSubjectEx,tvBody" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout> </FrameLayout>
Loading…
Cancel
Save