Browse Source

Address book requires contacts permissions

main
M66B 6 years ago
parent
commit
94421c1e9a
2 changed files with 7 additions and 5 deletions
  1. +6
    -4
      app/src/main/java/eu/faircode/email/AdapterMessage.java
  2. +1
    -1
      app/src/main/res/layout/item_message.xml

+ 6
- 4
app/src/main/java/eu/faircode/email/AdapterMessage.java View File

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


+ 1
- 1
app/src/main/res/layout/item_message.xml View File

@ -494,6 +494,6 @@
android:layout_width="0dp"
android:layout_height="0dp"
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>
</FrameLayout>

Loading…
Cancel
Save