Asynchronously load contacts to improve responsiveness

This commit is contained in:
2017-06-29 23:29:56 +02:00
parent a67560c28b
commit bf52d2f3de
17 changed files with 261 additions and 182 deletions

View File

@ -34,12 +34,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import ch.dissem.apps.abit.Identicon;
import ch.dissem.apps.abit.R;
import ch.dissem.bitmessage.entity.BitmessageAddress;
import ch.dissem.bitmessage.exception.ApplicationException;
import static android.graphics.Color.BLACK;
import static android.graphics.Color.WHITE;
@ -83,11 +81,7 @@ public class Drawables {
if (address.getPubkey() != null) {
link.append(address.getAlias() == null ? '?' : '&');
ByteArrayOutputStream pubkey = new ByteArrayOutputStream();
try {
address.getPubkey().writeUnencrypted(pubkey);
} catch (IOException e) {
throw new ApplicationException(e);
}
address.getPubkey().writeUnencrypted(pubkey);
link.append("pubkey=").append(Base64.encodeToString(pubkey.toByteArray(), URL_SAFE | NO_WRAP));
}
BitMatrix result;

View File

@ -15,9 +15,13 @@ import java.util.UUID;
* </p>
*/
public class UuidUtils {
/**
* @param bytes that represent a UUID, or null for a random UUID
* @return the UUID from the given bytes, or a random UUID if bytes is null.
*/
public static UUID asUuid(byte[] bytes) {
if (bytes == null) {
return null;
return UUID.randomUUID();
}
ByteBuffer bb = ByteBuffer.wrap(bytes);
long firstLong = bb.getLong();