diff --git a/src/org/thoughtcrime/securesms/ConversationAdapter.java b/src/org/thoughtcrime/securesms/ConversationAdapter.java index ef67b21c82..8cc0b01c01 100644 --- a/src/org/thoughtcrime/securesms/ConversationAdapter.java +++ b/src/org/thoughtcrime/securesms/ConversationAdapter.java @@ -317,9 +317,9 @@ public class ConversationAdapter if (lastSeen <= 0) return -1; if (!isActiveCursor()) return -1; - int count = getItemCount() - (hasHeaderView() ? 1 : 0) - (hasFooterView() ? 1 : 0); + int count = getItemCount() - (hasFooterView() ? 1 : 0); - for (int i=0;i UPGRADE_VERSIONS = new TreeSet() {{ add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION); @@ -233,6 +234,12 @@ public class DatabaseUpgradeActivity extends BaseActivity { .add(new DirectoryRefreshJob(getApplicationContext())); } + if (params[0] < PROFILES) { + ApplicationContext.getInstance(getApplicationContext()) + .getJobManager() + .add(new DirectoryRefreshJob(getApplicationContext())); + } + return null; } diff --git a/src/org/thoughtcrime/securesms/profiles/UnknownSenderView.java b/src/org/thoughtcrime/securesms/profiles/UnknownSenderView.java index cde43b5b84..fd3be5248c 100644 --- a/src/org/thoughtcrime/securesms/profiles/UnknownSenderView.java +++ b/src/org/thoughtcrime/securesms/profiles/UnknownSenderView.java @@ -9,6 +9,7 @@ import android.support.annotation.NonNull; import android.support.v7.app.AlertDialog; import android.text.TextUtils; import android.view.View; +import android.view.ViewGroup; import android.widget.FrameLayout; import org.thoughtcrime.securesms.R; @@ -27,6 +28,7 @@ public class UnknownSenderView extends FrameLayout { this.threadId = threadId; inflate(context, R.layout.unknown_sender_view, this); + setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); View block = ViewUtil.findById(this, R.id.block); View add = ViewUtil.findById(this, R.id.add_to_contacts); diff --git a/src/org/thoughtcrime/securesms/recipients/RecipientProvider.java b/src/org/thoughtcrime/securesms/recipients/RecipientProvider.java index 3522737825..c2cfe19373 100644 --- a/src/org/thoughtcrime/securesms/recipients/RecipientProvider.java +++ b/src/org/thoughtcrime/securesms/recipients/RecipientProvider.java @@ -67,7 +67,7 @@ class RecipientProvider { private static final Map STATIC_DETAILS = new HashMap() {{ put("262966", new RecipientDetails("Amazon", null, null, ContactPhotoFactory.getResourceContactPhoto(R.drawable.ic_amazon), - null, null)); + false, null, null)); }}; @NonNull Recipient getRecipient(Context context, Address address, Optional settings, Optional groupRecord, boolean asynchronous) { @@ -100,7 +100,7 @@ class RecipientProvider { if (address.isGroup() && settings.isPresent() && groupRecord.isPresent()) { return Optional.of(getGroupRecipientDetails(context, address, groupRecord, settings, true)); } else if (!address.isGroup() && settings.isPresent()) { - return Optional.of(new RecipientDetails(null, null, null, ContactPhotoFactory.getLoadingPhoto(), settings.get(), null)); + return Optional.of(new RecipientDetails(null, null, null, ContactPhotoFactory.getLoadingPhoto(), !TextUtils.isEmpty(settings.get().getSystemDisplayName()), settings.get(), null)); } return Optional.absent(); @@ -145,7 +145,7 @@ class RecipientProvider { address, name); - return new RecipientDetails(cursor.getString(0), cursor.getString(4), contactUri, contactPhoto, settings.orNull(), null); + return new RecipientDetails(cursor.getString(0), cursor.getString(4), contactUri, contactPhoto, true, settings.orNull(), null); } else { Log.w(TAG, "resultNumber is null"); } @@ -157,7 +157,7 @@ class RecipientProvider { } if (STATIC_DETAILS.containsKey(address.serialize())) return STATIC_DETAILS.get(address.serialize()); - else return new RecipientDetails(null, null, null, ContactPhotoFactory.getSignalAvatarContactPhoto(context, address, null, context.getResources().getDimensionPixelSize(R.dimen.contact_photo_target_size)), settings.orNull(), null); + else return new RecipientDetails(null, null, null, ContactPhotoFactory.getSignalAvatarContactPhoto(context, address, null, context.getResources().getDimensionPixelSize(R.dimen.contact_photo_target_size)), false, settings.orNull(), null); } private @NonNull RecipientDetails getGroupRecipientDetails(Context context, Address groupId, Optional groupRecord, Optional settings, boolean asynchronous) { @@ -183,10 +183,10 @@ class RecipientProvider { title = context.getString(R.string.RecipientProvider_unnamed_group);; } - return new RecipientDetails(title, null, null, contactPhoto, settings.orNull(), members); + return new RecipientDetails(title, null, null, contactPhoto, false, settings.orNull(), members); } - return new RecipientDetails(context.getString(R.string.RecipientProvider_unnamed_group), null, null, ContactPhotoFactory.getDefaultGroupPhoto(), settings.orNull(), null); + return new RecipientDetails(context.getString(R.string.RecipientProvider_unnamed_group), null, null, ContactPhotoFactory.getDefaultGroupPhoto(), false, settings.orNull(), null); } static class RecipientDetails { @@ -212,7 +212,7 @@ class RecipientProvider { public RecipientDetails(@Nullable String name, @Nullable String customLabel, @Nullable Uri contactUri, @NonNull ContactPhoto avatar, - @Nullable RecipientSettings settings, + boolean systemContact, @Nullable RecipientSettings settings, @Nullable List participants) { this.customLabel = customLabel; @@ -232,7 +232,7 @@ class RecipientProvider { this.profileKey = settings != null ? settings.getProfileKey() : null; this.profileAvatar = settings != null ? settings.getProfileAvatar() : null; this.profileSharing = settings != null && settings.isProfileSharing(); - this.systemContact = settings != null && !TextUtils.isEmpty(settings.getSystemDisplayName()); + this.systemContact = systemContact; if (name == null && settings != null) this.name = settings.getSystemDisplayName(); else this.name = name;