Whitespace-only code formatting changes.

This commit is contained in:
akwizgran
2015-11-30 09:38:25 +00:00
parent 1950c13ffb
commit 027ae8340f
202 changed files with 2993 additions and 2993 deletions

View File

@@ -138,22 +138,22 @@ EventListener {
public void run() {
try {
long now = System.currentTimeMillis();
for(Contact c : db.getContacts()) {
for (Contact c : db.getContacts()) {
try {
GroupId inbox = db.getInboxGroupId(c.getId());
Collection<MessageHeader> headers =
db.getInboxMessageHeaders(c.getId());
displayContact(c, inbox, headers);
} catch(NoSuchContactException e) {
} catch (NoSuchContactException e) {
// Continue
}
}
long duration = System.currentTimeMillis() - now;
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Full load took " + duration + " ms");
hideProgressBar();
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
}
}
@@ -181,7 +181,7 @@ EventListener {
boolean connected = connectionRegistry.isConnected(c.getId());
// Remove the old item, if any
ContactListItem item = findItem(c.getId());
if(item != null) adapter.remove(item);
if (item != null) adapter.remove(item);
// Add a new item
adapter.add(new ContactListItem(c, connected, inbox, headers));
adapter.sort(ContactListItemComparator.INSTANCE);
@@ -193,7 +193,7 @@ EventListener {
private void hideProgressBar() {
runOnUiThread(new Runnable() {
public void run() {
if(adapter.isEmpty()) empty.setVisibility(VISIBLE);
if (adapter.isEmpty()) empty.setVisibility(VISIBLE);
else list.setVisibility(VISIBLE);
loading.setVisibility(GONE);
}
@@ -202,9 +202,9 @@ EventListener {
private ContactListItem findItem(ContactId c) {
int count = adapter.getCount();
for(int i = 0; i < count; i++) {
for (int i = 0; i < count; i++) {
ContactListItem item = adapter.getItem(i);
if(item.getContact().getId().equals(c)) return item;
if (item.getContact().getId().equals(c)) return item;
}
return null; // Not found
}
@@ -243,7 +243,7 @@ EventListener {
@Override
public boolean onContextItemSelected(MenuItem menuItem) {
if(menuItem.getItemId() == MENU_ITEM_DELETE) {
if (menuItem.getItemId() == MENU_ITEM_DELETE) {
ContextMenuInfo info = menuItem.getMenuInfo();
int position = ((AdapterContextMenuInfo) info).position;
ContactListItem item = adapter.getItem(position);
@@ -259,8 +259,8 @@ EventListener {
public void run() {
try {
db.removeContact(c);
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
}
}
@@ -268,21 +268,21 @@ EventListener {
}
public void eventOccurred(Event e) {
if(e instanceof ContactAddedEvent) {
if (e instanceof ContactAddedEvent) {
loadContacts();
} else if(e instanceof ContactConnectedEvent) {
} else if (e instanceof ContactConnectedEvent) {
setConnected(((ContactConnectedEvent) e).getContactId(), true);
} else if(e instanceof ContactDisconnectedEvent) {
} else if (e instanceof ContactDisconnectedEvent) {
setConnected(((ContactDisconnectedEvent) e).getContactId(), false);
} else if(e instanceof ContactRemovedEvent) {
} else if (e instanceof ContactRemovedEvent) {
LOG.info("Contact removed");
removeItem(((ContactRemovedEvent) e).getContactId());
} else if(e instanceof MessageAddedEvent) {
} else if (e instanceof MessageAddedEvent) {
LOG.info("Message added, reloading");
ContactId source = ((MessageAddedEvent) e).getContactId();
if(source == null) loadContacts();
if (source == null) loadContacts();
else reloadContact(source);
} else if(e instanceof MessageExpiredEvent) {
} else if (e instanceof MessageExpiredEvent) {
LOG.info("Message expired, reloading");
loadContacts();
}
@@ -296,13 +296,13 @@ EventListener {
Collection<MessageHeader> headers =
db.getInboxMessageHeaders(c);
long duration = System.currentTimeMillis() - now;
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Partial load took " + duration + " ms");
updateItem(c, headers);
} catch(NoSuchContactException e) {
} catch (NoSuchContactException e) {
removeItem(c);
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
}
}
@@ -314,7 +314,7 @@ EventListener {
runOnUiThread(new Runnable() {
public void run() {
ContactListItem item = findItem(c);
if(item != null) {
if (item != null) {
item.setHeaders(headers);
adapter.notifyDataSetChanged();
}
@@ -326,10 +326,10 @@ EventListener {
runOnUiThread(new Runnable() {
public void run() {
ContactListItem item = findItem(c);
if(item != null) {
if (item != null) {
adapter.remove(item);
adapter.notifyDataSetChanged();
if(adapter.isEmpty()) {
if (adapter.isEmpty()) {
empty.setVisibility(VISIBLE);
list.setVisibility(GONE);
}
@@ -342,7 +342,7 @@ EventListener {
runOnUiThread(new Runnable() {
public void run() {
ContactListItem item = findItem(c);
if(item != null) {
if (item != null) {
item.setConnected(connected);
adapter.notifyDataSetChanged();
}

View File

@@ -40,12 +40,12 @@ class ContactListAdapter extends ArrayAdapter<ContactListItem> {
layout.setOrientation(HORIZONTAL);
layout.setGravity(CENTER_VERTICAL);
int unread = item.getUnreadCount();
if(unread > 0)
if (unread > 0)
layout.setBackgroundColor(res.getColor(R.color.unread_background));
ImageView bulb = new ImageView(ctx);
bulb.setPadding(pad, pad, pad, pad);
if(item.isConnected())
if (item.isConnected())
bulb.setImageResource(R.drawable.contact_connected);
else bulb.setImageResource(R.drawable.contact_disconnected);
layout.addView(bulb);
@@ -57,11 +57,11 @@ class ContactListAdapter extends ArrayAdapter<ContactListItem> {
name.setEllipsize(END);
name.setPadding(0, pad, pad, pad);
String contactName = item.getContact().getAuthor().getName();
if(unread > 0) name.setText(contactName + " (" + unread + ")");
if (unread > 0) name.setText(contactName + " (" + unread + ")");
else name.setText(contactName);
layout.addView(name);
if(item.isEmpty()) {
if (item.isEmpty()) {
TextView noMessages = new TextView(ctx);
noMessages.setPadding(pad, pad, pad, pad);
noMessages.setTextColor(res.getColor(R.color.no_private_messages));

View File

@@ -27,10 +27,10 @@ class ContactListItem {
empty = headers.isEmpty();
timestamp = 0;
unread = 0;
if(!empty) {
for(MessageHeader h : headers) {
if(h.getTimestamp() > timestamp) timestamp = h.getTimestamp();
if(!h.isRead()) unread++;
if (!empty) {
for (MessageHeader h : headers) {
if (h.getTimestamp() > timestamp) timestamp = h.getTimestamp();
if (!h.isRead()) unread++;
}
}
}

View File

@@ -111,7 +111,7 @@ implements EventListener, OnClickListener, OnItemClickListener {
Intent i = getIntent();
int id = i.getIntExtra("briar.CONTACT_ID", -1);
if(id == -1) throw new IllegalStateException();
if (id == -1) throw new IllegalStateException();
contactId = new ContactId(id);
Intent data = new Intent();
@@ -206,17 +206,17 @@ implements EventListener, OnClickListener, OnItemClickListener {
groupId = db.getInboxGroupId(contactId);
group = db.getGroup(groupId);
long duration = System.currentTimeMillis() - now;
if(LOG.isLoggable(INFO)) {
if (LOG.isLoggable(INFO)) {
LOG.info("Loading contact and group took "
+ duration + " ms");
}
displayContactName();
} catch(NoSuchContactException e) {
} catch (NoSuchContactException e) {
finishOnUiThread();
} catch(NoSuchSubscriptionException e) {
} catch (NoSuchSubscriptionException e) {
finishOnUiThread();
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
}
}
@@ -239,13 +239,13 @@ implements EventListener, OnClickListener, OnItemClickListener {
Collection<MessageHeader> headers =
db.getInboxMessageHeaders(contactId);
long duration = System.currentTimeMillis() - now;
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Loading headers took " + duration + " ms");
displayHeaders(headers);
} catch(NoSuchContactException e) {
} catch (NoSuchContactException e) {
finishOnUiThread();
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
}
}
@@ -259,16 +259,16 @@ implements EventListener, OnClickListener, OnItemClickListener {
setTitle(contactName);
sendButton.setEnabled(true);
adapter.clear();
if(headers.isEmpty()) {
if (headers.isEmpty()) {
empty.setVisibility(VISIBLE);
list.setVisibility(GONE);
} else {
empty.setVisibility(GONE);
list.setVisibility(VISIBLE);
for(MessageHeader h : headers) {
for (MessageHeader h : headers) {
ConversationItem item = new ConversationItem(h);
byte[] body = bodyCache.get(h.getId());
if(body == null) loadMessageBody(h);
if (body == null) loadMessageBody(h);
else item.setBody(body);
adapter.add(item);
}
@@ -288,13 +288,13 @@ implements EventListener, OnClickListener, OnItemClickListener {
long now = System.currentTimeMillis();
byte[] body = db.getMessageBody(h.getId());
long duration = System.currentTimeMillis() - now;
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Loading message took " + duration + " ms");
displayMessageBody(h.getId(), body);
} catch(NoSuchMessageException e) {
} catch (NoSuchMessageException e) {
// The item will be removed when we get the event
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
}
}
@@ -306,9 +306,9 @@ implements EventListener, OnClickListener, OnItemClickListener {
public void run() {
bodyCache.put(m, body);
int count = adapter.getCount();
for(int i = 0; i < count; i++) {
for (int i = 0; i < count; i++) {
ConversationItem item = adapter.getItem(i);
if(item.getHeader().getId().equals(m)) {
if (item.getHeader().getId().equals(m)) {
item.setBody(body);
adapter.notifyDataSetChanged();
// Scroll to the bottom
@@ -323,9 +323,9 @@ implements EventListener, OnClickListener, OnItemClickListener {
@Override
protected void onActivityResult(int request, int result, Intent data) {
super.onActivityResult(request, result, data);
if(request == REQUEST_READ && result == RESULT_PREV_NEXT) {
if (request == REQUEST_READ && result == RESULT_PREV_NEXT) {
int position = data.getIntExtra("briar.POSITION", -1);
if(position >= 0 && position < adapter.getCount())
if (position >= 0 && position < adapter.getCount())
displayMessage(position);
}
}
@@ -334,19 +334,19 @@ implements EventListener, OnClickListener, OnItemClickListener {
public void onPause() {
super.onPause();
eventBus.removeListener(this);
if(isFinishing()) markMessagesRead();
if (isFinishing()) markMessagesRead();
}
private void markMessagesRead() {
notificationManager.clearPrivateMessageNotification(contactId);
List<MessageId> unread = new ArrayList<MessageId>();
int count = adapter.getCount();
for(int i = 0; i < count; i++) {
for (int i = 0; i < count; i++) {
MessageHeader h = adapter.getItem(i).getHeader();
if(!h.isRead()) unread.add(h.getId());
if (!h.isRead()) unread.add(h.getId());
}
if(unread.isEmpty()) return;
if(LOG.isLoggable(INFO))
if (unread.isEmpty()) return;
if (LOG.isLoggable(INFO))
LOG.info("Marking " + unread.size() + " messages read");
markMessagesRead(Collections.unmodifiableList(unread));
}
@@ -356,12 +356,12 @@ implements EventListener, OnClickListener, OnItemClickListener {
public void run() {
try {
long now = System.currentTimeMillis();
for(MessageId m : unread) db.setReadFlag(m, true);
for (MessageId m : unread) db.setReadFlag(m, true);
long duration = System.currentTimeMillis() - now;
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Marking read took " + duration + " ms");
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
}
}
@@ -369,24 +369,24 @@ implements EventListener, OnClickListener, OnItemClickListener {
}
public void eventOccurred(Event e) {
if(e instanceof ContactRemovedEvent) {
if (e instanceof ContactRemovedEvent) {
ContactRemovedEvent c = (ContactRemovedEvent) e;
if(c.getContactId().equals(contactId)) {
if (c.getContactId().equals(contactId)) {
LOG.info("Contact removed");
finishOnUiThread();
}
} else if(e instanceof MessageAddedEvent) {
} else if (e instanceof MessageAddedEvent) {
GroupId g = ((MessageAddedEvent) e).getGroup().getId();
if(g.equals(groupId)) {
if (g.equals(groupId)) {
LOG.info("Message added, reloading");
loadHeaders();
}
} else if(e instanceof MessageExpiredEvent) {
} else if (e instanceof MessageExpiredEvent) {
LOG.info("Message expired, reloading");
loadHeaders();
} else if(e instanceof MessagesAckedEvent) {
} else if (e instanceof MessagesAckedEvent) {
MessagesAckedEvent m = (MessagesAckedEvent) e;
if(m.getContactId().equals(contactId)) {
if (m.getContactId().equals(contactId)) {
LOG.info("Messages acked");
markMessagesDelivered(m.getMessageIds());
}
@@ -399,21 +399,21 @@ implements EventListener, OnClickListener, OnItemClickListener {
Set<MessageId> ackedSet = new HashSet<MessageId>(acked);
boolean changed = false;
int count = adapter.getCount();
for(int i = 0; i < count; i++) {
for (int i = 0; i < count; i++) {
ConversationItem item = adapter.getItem(i);
if(ackedSet.contains(item.getHeader().getId())) {
if (ackedSet.contains(item.getHeader().getId())) {
item.setDelivered(true);
changed = true;
}
}
if(changed) adapter.notifyDataSetChanged();
if (changed) adapter.notifyDataSetChanged();
}
});
}
public void onClick(View view) {
String message = content.getText().toString();
if(message.equals("")) return;
if (message.equals("")) return;
long timestamp = System.currentTimeMillis();
timestamp = Math.max(timestamp, getMinTimestampForNewMessage());
createMessage(StringUtils.toUtf8(message), timestamp);
@@ -426,9 +426,9 @@ implements EventListener, OnClickListener, OnItemClickListener {
// Don't use an earlier timestamp than the newest message
long timestamp = 0;
int count = adapter.getCount();
for(int i = 0; i < count; i++) {
for (int i = 0; i < count; i++) {
long t = adapter.getItem(i).getHeader().getTimestamp();
if(t > timestamp) timestamp = t;
if (t > timestamp) timestamp = t;
}
return timestamp + 1;
}
@@ -440,9 +440,9 @@ implements EventListener, OnClickListener, OnItemClickListener {
Message m = messageFactory.createAnonymousMessage(null,
group, "text/plain", timestamp, body);
storeMessage(m);
} catch(GeneralSecurityException e) {
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
} catch(IOException e) {
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@@ -456,10 +456,10 @@ implements EventListener, OnClickListener, OnItemClickListener {
long now = System.currentTimeMillis();
db.addLocalMessage(m);
long duration = System.currentTimeMillis() - now;
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Storing message took " + duration + " ms");
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
}
}

View File

@@ -45,17 +45,17 @@ class ConversationAdapter extends ArrayAdapter<ConversationItem> {
LinearLayout layout = new LinearLayout(ctx);
layout.setOrientation(VERTICAL);
if(header.isLocal()) layout.setPadding(3 * pad, 0, 0, 0);
if (header.isLocal()) layout.setPadding(3 * pad, 0, 0, 0);
else layout.setPadding(0, 0, 3 * pad, 0);
int background = res.getColor(R.color.private_message_background);
View content;
if(item.getBody() == null) {
if (item.getBody() == null) {
TextView ellipsis = new TextView(ctx);
ellipsis.setText("\u2026");
content = ellipsis;
} else if(header.getContentType().equals("text/plain")) {
} else if (header.getContentType().equals("text/plain")) {
TextView text = new TextView(ctx);
text.setText(StringUtils.fromUtf8(item.getBody()));
content = text;
@@ -69,7 +69,7 @@ class ConversationAdapter extends ArrayAdapter<ConversationItem> {
content.setPadding(pad, pad, pad, 0);
layout.addView(content);
if(header.isLocal()) {
if (header.isLocal()) {
LinearLayout footer = new LinearLayout(ctx);
footer.setLayoutParams(MATCH_WRAP);
footer.setOrientation(HORIZONTAL);
@@ -82,7 +82,7 @@ class ConversationAdapter extends ArrayAdapter<ConversationItem> {
ImageView delivered = new ImageView(ctx);
delivered.setPadding(0, 0, pad, 0);
delivered.setImageResource(R.drawable.message_delivered);
if(!item.isDelivered()) delivered.setVisibility(INVISIBLE);
if (!item.isDelivered()) delivered.setVisibility(INVISIBLE);
footer.addView(delivered);
TextView date = new TextView(ctx);

View File

@@ -11,8 +11,8 @@ class ConversationItemComparator implements Comparator<ConversationItem> {
// The oldest message comes first
long aTime = a.getHeader().getTimestamp();
long bTime = b.getHeader().getTimestamp();
if(aTime < bTime) return -1;
if(aTime > bTime) return 1;
if (aTime < bTime) return -1;
if (aTime > bTime) return 1;
return 0;
}
}

View File

@@ -68,27 +68,27 @@ implements OnClickListener {
Intent i = getIntent();
contactName = i.getStringExtra("briar.CONTACT_NAME");
if(contactName == null) throw new IllegalStateException();
if (contactName == null) throw new IllegalStateException();
setTitle(contactName);
byte[] b = i.getByteArrayExtra("briar.LOCAL_AUTHOR_ID");
if(b == null) throw new IllegalStateException();
if (b == null) throw new IllegalStateException();
localAuthorId = new AuthorId(b);
String authorName = i.getStringExtra("briar.AUTHOR_NAME");
if(authorName == null) throw new IllegalStateException();
if (authorName == null) throw new IllegalStateException();
b = i.getByteArrayExtra("briar.MESSAGE_ID");
if(b == null) throw new IllegalStateException();
if (b == null) throw new IllegalStateException();
messageId = new MessageId(b);
b = i.getByteArrayExtra("briar.GROUP_ID");
if(b == null) throw new IllegalStateException();
if (b == null) throw new IllegalStateException();
groupId = new GroupId(b);
String contentType = i.getStringExtra("briar.CONTENT_TYPE");
if(contentType == null) throw new IllegalStateException();
if (contentType == null) throw new IllegalStateException();
timestamp = i.getLongExtra("briar.TIMESTAMP", -1);
if(timestamp == -1) throw new IllegalStateException();
if (timestamp == -1) throw new IllegalStateException();
minTimestamp = i.getLongExtra("briar.MIN_TIMESTAMP", -1);
if(minTimestamp == -1) throw new IllegalStateException();
if (minTimestamp == -1) throw new IllegalStateException();
position = i.getIntExtra("briar.POSITION", -1);
if(position == -1) throw new IllegalStateException();
if (position == -1) throw new IllegalStateException();
LinearLayout layout = new LinearLayout(this);
layout.setLayoutParams(MATCH_WRAP);
@@ -118,7 +118,7 @@ implements OnClickListener {
header.addView(date);
message.addView(header);
if(contentType.equals("text/plain")) {
if (contentType.equals("text/plain")) {
// Load and display the message body
content = new TextView(this);
content.setPadding(pad, 0, pad, pad);
@@ -164,7 +164,7 @@ implements OnClickListener {
@Override
public void onPause() {
super.onPause();
if(isFinishing()) markMessageRead();
if (isFinishing()) markMessageRead();
}
private void markMessageRead() {
@@ -174,10 +174,10 @@ implements OnClickListener {
long now = System.currentTimeMillis();
db.setReadFlag(messageId, true);
long duration = System.currentTimeMillis() - now;
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Marking read took " + duration + " ms");
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
}
}
@@ -191,13 +191,13 @@ implements OnClickListener {
long now = System.currentTimeMillis();
byte[] body = db.getMessageBody(messageId);
long duration = System.currentTimeMillis() - now;
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Loading message took " + duration + " ms");
displayMessageBody(StringUtils.fromUtf8(body));
} catch(NoSuchMessageException e) {
} catch (NoSuchMessageException e) {
finishOnUiThread();
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
}
}
@@ -213,17 +213,17 @@ implements OnClickListener {
}
public void onClick(View view) {
if(view == prevButton) {
if (view == prevButton) {
Intent i = new Intent();
i.putExtra("briar.POSITION", position - 1);
setResult(RESULT_PREV_NEXT, i);
finish();
} else if(view == nextButton) {
} else if (view == nextButton) {
Intent i = new Intent();
i.putExtra("briar.POSITION", position + 1);
setResult(RESULT_PREV_NEXT, i);
finish();
} else if(view == replyButton) {
} else if (view == replyButton) {
Intent i = new Intent(this, WritePrivateMessageActivity.class);
i.putExtra("briar.CONTACT_NAME", contactName);
i.putExtra("briar.GROUP_ID", groupId.getBytes());

View File

@@ -35,13 +35,13 @@ public class SelectContactsDialog implements OnMultiChoiceClickListener {
}
public Dialog build(Context ctx) {
if(listener == null || contacts == null || selected == null)
if (listener == null || contacts == null || selected == null)
throw new IllegalStateException();
AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
int size = contacts.size();
String[] names = new String[size];
boolean[] checked = new boolean[size];
for(int i = 0; i < size; i++) {
for (int i = 0; i < size; i++) {
Contact c = contacts.get(i);
names[i] = c.getAuthor().getName();
checked[i] = selected.contains(c.getId());
@@ -63,7 +63,7 @@ public class SelectContactsDialog implements OnMultiChoiceClickListener {
}
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
if(isChecked) selected.add(contacts.get(which).getId());
if (isChecked) selected.add(contacts.get(which).getId());
else selected.remove(contacts.get(which).getId());
}

View File

@@ -78,18 +78,18 @@ implements OnClickListener {
Intent i = getIntent();
contactName = i.getStringExtra("briar.CONTACT_NAME");
if(contactName == null) throw new IllegalStateException();
if (contactName == null) throw new IllegalStateException();
setTitle(contactName);
byte[] b = i.getByteArrayExtra("briar.GROUP_ID");
if(b == null) throw new IllegalStateException();
if (b == null) throw new IllegalStateException();
groupId = new GroupId(b);
b = i.getByteArrayExtra("briar.LOCAL_AUTHOR_ID");
if(b == null) throw new IllegalStateException();
if (b == null) throw new IllegalStateException();
minTimestamp = i.getLongExtra("briar.MIN_TIMESTAMP", -1);
if(minTimestamp == -1) throw new IllegalStateException();
if (minTimestamp == -1) throw new IllegalStateException();
localAuthorId = new AuthorId(b);
b = i.getByteArrayExtra("briar.PARENT_ID");
if(b != null) parentId = new MessageId(b);
if (b != null) parentId = new MessageId(b);
LinearLayout layout = new LinearLayout(this);
layout.setLayoutParams(MATCH_WRAP);
@@ -138,7 +138,7 @@ implements OnClickListener {
@Override
public void onResume() {
super.onResume();
if(localAuthor == null || group == null) loadAuthorAndGroup();
if (localAuthor == null || group == null) loadAuthorAndGroup();
}
private void loadAuthorAndGroup() {
@@ -149,15 +149,15 @@ implements OnClickListener {
localAuthor = db.getLocalAuthor(localAuthorId);
group = db.getGroup(groupId);
long duration = System.currentTimeMillis() - now;
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Load took " + duration + " ms");
displayLocalAuthor();
} catch(NoSuchContactException e) {
} catch (NoSuchContactException e) {
finishOnUiThread();
} catch(NoSuchSubscriptionException e) {
} catch (NoSuchSubscriptionException e) {
finishOnUiThread();
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
}
}
@@ -177,7 +177,7 @@ implements OnClickListener {
public void onClick(View view) {
String message = content.getText().toString();
if(message.equals("")) return;
if (message.equals("")) return;
createMessage(StringUtils.toUtf8(message));
Toast.makeText(this, R.string.message_sent_toast, LENGTH_LONG).show();
finish();
@@ -193,9 +193,9 @@ implements OnClickListener {
Message m = messageFactory.createAnonymousMessage(parentId,
group, "text/plain", timestamp, body);
storeMessage(m);
} catch(GeneralSecurityException e) {
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
} catch(IOException e) {
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@@ -209,10 +209,10 @@ implements OnClickListener {
long now = System.currentTimeMillis();
db.addLocalMessage(m);
long duration = System.currentTimeMillis() - now;
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Storing message took " + duration + " ms");
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
} catch (DbException e) {
if (LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
}
}