mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 06:22:19 +00:00
Update to latest version of libtextsecure for simplified interface.
1) Switch to new TextSecureAddress addressing, rather than mixing long-based recipient IDs into libtextsecure. 2) Get rid of RecipientFormattingException throws in calls to RecipientFactory. Closes #2570
This commit is contained in:
@@ -18,19 +18,15 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.makeramen.RoundedDrawable;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFormattingException;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
@@ -59,28 +55,24 @@ public class BitmapWorkerRunnable implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
final Recipient recipient = RecipientFactory.getRecipientsFromString(context, number, false).getPrimaryRecipient();
|
||||
final Bitmap contactPhoto = recipient.getContactPhoto();
|
||||
if (defaultPhoto == contactPhoto) {
|
||||
return;
|
||||
}
|
||||
if (recipient.getContactPhoto() != null) {
|
||||
final ImageView imageView = imageViewReference.get();
|
||||
final TaggedFutureTask<?> bitmapWorkerTask = AsyncDrawable.getBitmapWorkerTask(imageView);
|
||||
final Recipient recipient = RecipientFactory.getRecipientsFromString(context, number, false).getPrimaryRecipient();
|
||||
final Bitmap contactPhoto = recipient.getContactPhoto();
|
||||
if (defaultPhoto == contactPhoto) {
|
||||
return;
|
||||
}
|
||||
if (recipient.getContactPhoto() != null) {
|
||||
final ImageView imageView = imageViewReference.get();
|
||||
final TaggedFutureTask<?> bitmapWorkerTask = AsyncDrawable.getBitmapWorkerTask(imageView);
|
||||
|
||||
if (bitmapWorkerTask.getTag().equals(number) && imageView != null) {
|
||||
final BitmapDrawable drawable = new BitmapDrawable(context.getResources(), recipient.getContactPhoto());
|
||||
imageView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
imageView.setImageDrawable(drawable);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (bitmapWorkerTask.getTag().equals(number) && imageView != null) {
|
||||
final BitmapDrawable drawable = new BitmapDrawable(context.getResources(), recipient.getContactPhoto());
|
||||
imageView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
imageView.setImageDrawable(drawable);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (RecipientFormattingException rfe) {
|
||||
Log.w(TAG, "Couldn't get recipient from string", rfe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user