mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
Various minor UI changes, added logging for DB load times.
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
<string name="contact_connected">Connected</string>
|
<string name="contact_connected">Connected</string>
|
||||||
<string name="format_contact_last_connected">Last connected <br /> %1$s</string>
|
<string name="format_contact_last_connected">Last connected <br /> %1$s</string>
|
||||||
<string name="add_contact_title">Add a Contact</string>
|
<string name="add_contact_title">Add a Contact</string>
|
||||||
<string name="your_identity">Your identity: </string>
|
<string name="your_nickname">Your nickname: </string>
|
||||||
<string name="wifi_not_available">Wi-Fi is NOT AVAILABLE</string>
|
<string name="wifi_not_available">Wi-Fi is NOT AVAILABLE</string>
|
||||||
<string name="wifi_disabled">Wi-Fi is OFF</string>
|
<string name="wifi_disabled">Wi-Fi is OFF</string>
|
||||||
<string name="wifi_disconnected">Wi-Fi is DISCONNECTED</string>
|
<string name="wifi_disconnected">Wi-Fi is DISCONNECTED</string>
|
||||||
@@ -37,7 +37,6 @@
|
|||||||
<string name="codes_do_not_match">Codes do not match</string>
|
<string name="codes_do_not_match">Codes do not match</string>
|
||||||
<string name="interfering">This could mean that someone is trying to interfere with your connection.</string>
|
<string name="interfering">This could mean that someone is trying to interfere with your connection.</string>
|
||||||
<string name="contact_added">Contact added</string>
|
<string name="contact_added">Contact added</string>
|
||||||
<string name="enter_nickname">Please enter a nickname for this contact:</string>
|
|
||||||
<string name="done_button">Done</string>
|
<string name="done_button">Done</string>
|
||||||
<string name="messages_title">Messages</string>
|
<string name="messages_title">Messages</string>
|
||||||
<string name="format_from">From: %1$s</string>
|
<string name="format_from">From: %1$s</string>
|
||||||
@@ -49,13 +48,13 @@
|
|||||||
<string name="groups_title">Groups</string>
|
<string name="groups_title">Groups</string>
|
||||||
<string name="compose_group_title">New Post</string>
|
<string name="compose_group_title">New Post</string>
|
||||||
<string name="blogs_title">Blogs</string>
|
<string name="blogs_title">Blogs</string>
|
||||||
<string name="create_identity_item">New identity\u2026</string>
|
<string name="create_nickname_item">New nickname\u2026</string>
|
||||||
<string name="create_identity_title">Create an Identity</string>
|
<string name="create_identity_title">Create an Identity</string>
|
||||||
<string name="choose_nickname">Choose your nickname:</string>
|
<string name="choose_nickname">Choose your nickname: </string>
|
||||||
<string name="create_button">Create</string>
|
<string name="create_button">Create</string>
|
||||||
<string name="no_contacts">You don\'t have any contacts. Add a contact now?</string>
|
<string name="no_contacts">You don\'t have any contacts. Add a contact now?</string>
|
||||||
<string name="add_contact_button">Add a contact</string>
|
<string name="add_button">Add</string>
|
||||||
<string name="cancel_button">Cancel</string>
|
<string name="cancel_button">Cancel</string>
|
||||||
<string name="no_groups">You aren\'t subscribed to any groups. Create a group now?</string>
|
<string name="no_groups">You aren\'t subscribed to any groups. Create a group now?</string>
|
||||||
<string name="create_group_button">Create a group</string>
|
<string name="no_blogs">You don\'t have any blogs. Create a blog now?</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ public class AndroidModule extends AbstractModule {
|
|||||||
Singleton.class);
|
Singleton.class);
|
||||||
bind(ReferenceManager.class).to(ReferenceManagerImpl.class).in(
|
bind(ReferenceManager.class).to(ReferenceManagerImpl.class).in(
|
||||||
Singleton.class);
|
Singleton.class);
|
||||||
// Use a single thread so DB accesses from the UI don't overlap
|
// Use a single thread so DB accesses from the UI don't overlap, with
|
||||||
|
// an unbounded queue so submissions don't block
|
||||||
bind(Executor.class).annotatedWith(DatabaseUiExecutor.class).toInstance(
|
bind(Executor.class).annotatedWith(DatabaseUiExecutor.class).toInstance(
|
||||||
Executors.newSingleThreadExecutor());
|
Executors.newSingleThreadExecutor());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import static java.util.logging.Level.INFO;
|
|||||||
import static java.util.logging.Level.WARNING;
|
import static java.util.logging.Level.WARNING;
|
||||||
import static net.sf.briar.android.widgets.CommonLayoutParams.MATCH_MATCH;
|
import static net.sf.briar.android.widgets.CommonLayoutParams.MATCH_MATCH;
|
||||||
|
|
||||||
|
import java.lang.Thread.UncaughtExceptionHandler;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
@@ -70,6 +71,17 @@ public class HomeScreenActivity extends BriarActivity {
|
|||||||
// The activity was launched from the splash screen
|
// The activity was launched from the splash screen
|
||||||
showButtons();
|
showButtons();
|
||||||
}
|
}
|
||||||
|
// Ensure uncaught exceptions thrown on worker threads kill the JVM
|
||||||
|
final UncaughtExceptionHandler handler =
|
||||||
|
Thread.getDefaultUncaughtExceptionHandler();
|
||||||
|
UncaughtExceptionHandler die = new UncaughtExceptionHandler() {
|
||||||
|
public void uncaughtException(Thread thread, Throwable throwable) {
|
||||||
|
handler.uncaughtException(thread, throwable);
|
||||||
|
if(LOG.isLoggable(INFO)) LOG.info("Exiting");
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Thread.setDefaultUncaughtExceptionHandler(die);
|
||||||
// Start the service and bind to it
|
// Start the service and bind to it
|
||||||
startService(new Intent(BriarService.class.getName()));
|
startService(new Intent(BriarService.class.getName()));
|
||||||
bindService(new Intent(BriarService.class.getName()),
|
bindService(new Intent(BriarService.class.getName()),
|
||||||
@@ -120,7 +132,11 @@ public class HomeScreenActivity extends BriarActivity {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
db.addLocalAuthor(a);
|
db.addLocalAuthor(a);
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Storing author took " + duration + " ms");
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
showButtons();
|
showButtons();
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package net.sf.briar.android;
|
package net.sf.briar.android;
|
||||||
|
|
||||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||||
|
import static android.text.InputType.TYPE_CLASS_TEXT;
|
||||||
|
import static android.text.InputType.TYPE_TEXT_FLAG_CAP_WORDS;
|
||||||
import static android.view.Gravity.CENTER;
|
import static android.view.Gravity.CENTER;
|
||||||
import static android.view.Gravity.CENTER_HORIZONTAL;
|
import static android.view.Gravity.CENTER_HORIZONTAL;
|
||||||
import static android.view.View.GONE;
|
import static android.view.View.GONE;
|
||||||
@@ -67,6 +69,8 @@ implements OnEditorActionListener, OnClickListener {
|
|||||||
nicknameEntry.setTextSize(18);
|
nicknameEntry.setTextSize(18);
|
||||||
nicknameEntry.setMaxLines(1);
|
nicknameEntry.setMaxLines(1);
|
||||||
nicknameEntry.setPadding(10, 10, 10, 10);
|
nicknameEntry.setPadding(10, 10, 10, 10);
|
||||||
|
int inputType = TYPE_CLASS_TEXT | TYPE_TEXT_FLAG_CAP_WORDS;
|
||||||
|
nicknameEntry.setInputType(inputType);
|
||||||
nicknameEntry.setOnEditorActionListener(this);
|
nicknameEntry.setOnEditorActionListener(this);
|
||||||
layout.addView(nicknameEntry);
|
layout.addView(nicknameEntry);
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
|
|||||||
|
|
||||||
@Inject private ConnectionRegistry connectionRegistry;
|
@Inject private ConnectionRegistry connectionRegistry;
|
||||||
private ContactListAdapter adapter = null;
|
private ContactListAdapter adapter = null;
|
||||||
|
private ListView list = null;
|
||||||
|
|
||||||
// Fields that are accessed from background threads must be volatile
|
// Fields that are accessed from background threads must be volatile
|
||||||
@Inject private volatile DatabaseComponent db;
|
@Inject private volatile DatabaseComponent db;
|
||||||
@@ -68,7 +69,7 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
|
|||||||
layout.setGravity(CENTER_HORIZONTAL);
|
layout.setGravity(CENTER_HORIZONTAL);
|
||||||
|
|
||||||
adapter = new ContactListAdapter(this);
|
adapter = new ContactListAdapter(this);
|
||||||
ListView list = new ListView(this);
|
list = new ListView(this);
|
||||||
// Give me all the width and all the unused height
|
// Give me all the width and all the unused height
|
||||||
list.setLayoutParams(MATCH_WRAP_1);
|
list.setLayoutParams(MATCH_WRAP_1);
|
||||||
list.setAdapter(adapter);
|
list.setAdapter(adapter);
|
||||||
@@ -110,13 +111,12 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
|
|||||||
dbUiExecutor.execute(new Runnable() {
|
dbUiExecutor.execute(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
// Wait for the service to be bound and started
|
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
// Load the contacts from the database
|
long now = System.currentTimeMillis();
|
||||||
Collection<Contact> contacts = db.getContacts();
|
Collection<Contact> contacts = db.getContacts();
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
if(LOG.isLoggable(INFO))
|
if(LOG.isLoggable(INFO))
|
||||||
LOG.info("Loaded " + contacts.size() + " contacts");
|
LOG.info("Load took " + duration + " ms");
|
||||||
// Display the contacts in the UI
|
|
||||||
displayContacts(contacts);
|
displayContacts(contacts);
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
@@ -181,6 +181,8 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
|
|||||||
ContactListItem item = adapter.getItem(i);
|
ContactListItem item = adapter.getItem(i);
|
||||||
if(item.getContactId().equals(c)) {
|
if(item.getContactId().equals(c)) {
|
||||||
item.setConnected(connected);
|
item.setConnected(connected);
|
||||||
|
// FIXME: Item is not redrawn
|
||||||
|
list.invalidate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,16 +113,13 @@ OnClickListener, OnItemClickListener {
|
|||||||
dbUiExecutor.execute(new Runnable() {
|
dbUiExecutor.execute(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
// Wait for the service to be bound and started
|
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
// Load the headers from the database
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
Collection<GroupMessageHeader> headers =
|
Collection<GroupMessageHeader> headers =
|
||||||
db.getMessageHeaders(groupId);
|
db.getMessageHeaders(groupId);
|
||||||
long duration = System.currentTimeMillis() - now;
|
long duration = System.currentTimeMillis() - now;
|
||||||
if(LOG.isLoggable(INFO))
|
if(LOG.isLoggable(INFO))
|
||||||
LOG.info("Load took " + duration + " ms");
|
LOG.info("Load took " + duration + " ms");
|
||||||
// Display the headers in the UI
|
|
||||||
displayHeaders(headers);
|
displayHeaders(headers);
|
||||||
} catch(NoSuchSubscriptionException e) {
|
} catch(NoSuchSubscriptionException e) {
|
||||||
if(LOG.isLoggable(INFO)) LOG.info("Subscription removed");
|
if(LOG.isLoggable(INFO)) LOG.info("Subscription removed");
|
||||||
|
|||||||
@@ -129,19 +129,16 @@ implements OnClickListener, DatabaseListener, NoGroupsDialog.Listener {
|
|||||||
dbUiExecutor.execute(new Runnable() {
|
dbUiExecutor.execute(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
// Wait for the service to be bound and started
|
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
// Load the subscribed groups from the DB
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
if(restricted) noGroups = db.getLocalGroups().isEmpty();
|
||||||
for(Group g : db.getSubscriptions()) {
|
for(Group g : db.getSubscriptions()) {
|
||||||
// Filter out restricted/unrestricted groups
|
// Filter out restricted/unrestricted groups
|
||||||
if(g.isRestricted() != restricted) continue;
|
if(g.isRestricted() != restricted) continue;
|
||||||
noGroups = false;
|
if(!restricted) noGroups = false;
|
||||||
try {
|
try {
|
||||||
// Load the headers from the database
|
|
||||||
Collection<GroupMessageHeader> headers =
|
Collection<GroupMessageHeader> headers =
|
||||||
db.getMessageHeaders(g.getId());
|
db.getMessageHeaders(g.getId());
|
||||||
// Display the headers in the UI
|
|
||||||
displayHeaders(g, headers);
|
displayHeaders(g, headers);
|
||||||
} catch(NoSuchSubscriptionException e) {
|
} catch(NoSuchSubscriptionException e) {
|
||||||
if(LOG.isLoggable(INFO))
|
if(LOG.isLoggable(INFO))
|
||||||
@@ -222,6 +219,7 @@ implements OnClickListener, DatabaseListener, NoGroupsDialog.Listener {
|
|||||||
if(noGroups) {
|
if(noGroups) {
|
||||||
NoGroupsDialog dialog = new NoGroupsDialog();
|
NoGroupsDialog dialog = new NoGroupsDialog();
|
||||||
dialog.setListener(this);
|
dialog.setListener(this);
|
||||||
|
dialog.setRestricted(restricted);
|
||||||
dialog.show(getSupportFragmentManager(), "NoGroupsDialog");
|
dialog.show(getSupportFragmentManager(), "NoGroupsDialog");
|
||||||
} else {
|
} else {
|
||||||
Intent i = new Intent(this, WriteGroupMessageActivity.class);
|
Intent i = new Intent(this, WriteGroupMessageActivity.class);
|
||||||
@@ -242,9 +240,9 @@ implements OnClickListener, DatabaseListener, NoGroupsDialog.Listener {
|
|||||||
if(LOG.isLoggable(INFO)) LOG.info("Message expired, reloading");
|
if(LOG.isLoggable(INFO)) LOG.info("Message expired, reloading");
|
||||||
loadHeaders();
|
loadHeaders();
|
||||||
} else if(e instanceof SubscriptionRemovedEvent) {
|
} else if(e instanceof SubscriptionRemovedEvent) {
|
||||||
// Reload the group, expecting NoSuchSubscriptionException
|
|
||||||
Group g = ((SubscriptionRemovedEvent) e).getGroup();
|
Group g = ((SubscriptionRemovedEvent) e).getGroup();
|
||||||
if(g.isRestricted() == restricted) {
|
if(g.isRestricted() == restricted) {
|
||||||
|
// Reload the group, expecting NoSuchSubscriptionException
|
||||||
if(LOG.isLoggable(INFO)) LOG.info("Group removed, reloading");
|
if(LOG.isLoggable(INFO)) LOG.info("Group removed, reloading");
|
||||||
loadHeaders(g);
|
loadHeaders(g);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,16 +10,21 @@ import android.support.v4.app.DialogFragment;
|
|||||||
public class NoGroupsDialog extends DialogFragment {
|
public class NoGroupsDialog extends DialogFragment {
|
||||||
|
|
||||||
private Listener listener = null;
|
private Listener listener = null;
|
||||||
|
private boolean restricted = false;
|
||||||
|
|
||||||
void setListener(Listener listener) {
|
void setListener(Listener listener) {
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setRestricted(boolean restricted) {
|
||||||
|
this.restricted = restricted;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle state) {
|
public Dialog onCreateDialog(Bundle state) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setMessage(R.string.no_groups);
|
builder.setMessage(restricted ? R.string.no_blogs : R.string.no_groups);
|
||||||
builder.setPositiveButton(R.string.create_group_button,
|
builder.setPositiveButton(R.string.create_button,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
listener.createGroupButtonClicked();
|
listener.createGroupButtonClicked();
|
||||||
|
|||||||
@@ -236,7 +236,11 @@ implements OnClickListener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
db.setReadFlag(messageId, read);
|
db.setReadFlag(messageId, read);
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Setting flag took " + duration + " ms");
|
||||||
setReadInUi(read);
|
setReadInUi(read);
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
@@ -265,7 +269,11 @@ implements OnClickListener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
byte[] body = db.getMessageBody(messageId);
|
byte[] body = db.getMessageBody(messageId);
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Loading message took " + duration + " ms");
|
||||||
final String text = new String(body, "UTF-8");
|
final String text = new String(body, "UTF-8");
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -331,7 +339,11 @@ implements OnClickListener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
db.setRating(authorId, r);
|
db.setRating(authorId, r);
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Setting rating took " + duration + " ms");
|
||||||
setRatingInUi(r);
|
setRatingInUi(r);
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package net.sf.briar.android.groups;
|
package net.sf.briar.android.groups;
|
||||||
|
|
||||||
|
import static android.text.InputType.TYPE_CLASS_TEXT;
|
||||||
|
import static android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
|
||||||
import static android.view.Gravity.CENTER_VERTICAL;
|
import static android.view.Gravity.CENTER_VERTICAL;
|
||||||
import static android.widget.LinearLayout.HORIZONTAL;
|
import static android.widget.LinearLayout.HORIZONTAL;
|
||||||
import static android.widget.LinearLayout.VERTICAL;
|
import static android.widget.LinearLayout.VERTICAL;
|
||||||
@@ -137,6 +139,8 @@ implements OnItemSelectedListener, OnClickListener {
|
|||||||
|
|
||||||
content = new EditText(this);
|
content = new EditText(this);
|
||||||
content.setPadding(10, 10, 10, 10);
|
content.setPadding(10, 10, 10, 10);
|
||||||
|
int inputType = TYPE_CLASS_TEXT | TYPE_TEXT_FLAG_CAP_SENTENCES;
|
||||||
|
content.setInputType(inputType);
|
||||||
if(state != null && bundleEncrypter.decrypt(state)) {
|
if(state != null && bundleEncrypter.decrypt(state)) {
|
||||||
Parcelable p = state.getParcelable("net.sf.briar.CONTENT");
|
Parcelable p = state.getParcelable("net.sf.briar.CONTENT");
|
||||||
if(p != null) content.onRestoreInstanceState(p);
|
if(p != null) content.onRestoreInstanceState(p);
|
||||||
@@ -162,7 +166,12 @@ implements OnItemSelectedListener, OnClickListener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
displayLocalAuthors(db.getLocalAuthors());
|
long now = System.currentTimeMillis();
|
||||||
|
Collection<LocalAuthor> localAuthors = db.getLocalAuthors();
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Loading authors took " + duration + " ms");
|
||||||
|
displayLocalAuthors(localAuthors);
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
LOG.log(WARNING, e.toString(), e);
|
LOG.log(WARNING, e.toString(), e);
|
||||||
@@ -191,12 +200,16 @@ implements OnItemSelectedListener, OnClickListener {
|
|||||||
try {
|
try {
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
List<Group> groups = new ArrayList<Group>();
|
List<Group> groups = new ArrayList<Group>();
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
if(restricted) {
|
if(restricted) {
|
||||||
groups.addAll(db.getLocalGroups());
|
groups.addAll(db.getLocalGroups());
|
||||||
} else {
|
} else {
|
||||||
for(Group g : db.getSubscriptions())
|
for(Group g : db.getSubscriptions())
|
||||||
if(!g.isRestricted()) groups.add(g);
|
if(!g.isRestricted()) groups.add(g);
|
||||||
}
|
}
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Loading groups took " + duration + " ms");
|
||||||
groups = Collections.unmodifiableList(groups);
|
groups = Collections.unmodifiableList(groups);
|
||||||
displayGroups(groups);
|
displayGroups(groups);
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
@@ -281,7 +294,11 @@ implements OnItemSelectedListener, OnClickListener {
|
|||||||
// FIXME: Anonymous/pseudonymous, restricted/unrestricted
|
// FIXME: Anonymous/pseudonymous, restricted/unrestricted
|
||||||
Message m = messageFactory.createAnonymousMessage(parentId,
|
Message m = messageFactory.createAnonymousMessage(parentId,
|
||||||
group, "text/plain", body);
|
group, "text/plain", body);
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
db.addLocalGroupMessage(m);
|
db.addLocalGroupMessage(m);
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Storing message took " + duration + " ms");
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
LOG.log(WARNING, e.toString(), e);
|
LOG.log(WARNING, e.toString(), e);
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package net.sf.briar.android.identity;
|
package net.sf.briar.android.identity;
|
||||||
|
|
||||||
|
import static android.text.InputType.TYPE_CLASS_TEXT;
|
||||||
|
import static android.text.InputType.TYPE_TEXT_FLAG_CAP_WORDS;
|
||||||
import static android.view.Gravity.CENTER;
|
import static android.view.Gravity.CENTER;
|
||||||
import static android.view.Gravity.CENTER_HORIZONTAL;
|
import static android.view.Gravity.CENTER_HORIZONTAL;
|
||||||
import static android.view.View.GONE;
|
import static android.view.View.GONE;
|
||||||
import static android.view.View.VISIBLE;
|
import static android.view.View.VISIBLE;
|
||||||
import static android.view.inputmethod.InputMethodManager.HIDE_IMPLICIT_ONLY;
|
import static android.view.inputmethod.InputMethodManager.HIDE_IMPLICIT_ONLY;
|
||||||
import static android.widget.LinearLayout.VERTICAL;
|
import static android.widget.LinearLayout.VERTICAL;
|
||||||
|
import static java.util.logging.Level.INFO;
|
||||||
import static java.util.logging.Level.WARNING;
|
import static java.util.logging.Level.WARNING;
|
||||||
import static net.sf.briar.android.widgets.CommonLayoutParams.MATCH_MATCH;
|
import static net.sf.briar.android.widgets.CommonLayoutParams.MATCH_MATCH;
|
||||||
import static net.sf.briar.android.widgets.CommonLayoutParams.WRAP_WRAP;
|
import static net.sf.briar.android.widgets.CommonLayoutParams.WRAP_WRAP;
|
||||||
@@ -80,6 +83,8 @@ implements OnEditorActionListener, OnClickListener {
|
|||||||
nicknameEntry.setTextSize(18);
|
nicknameEntry.setTextSize(18);
|
||||||
nicknameEntry.setMaxLines(1);
|
nicknameEntry.setMaxLines(1);
|
||||||
nicknameEntry.setPadding(10, 10, 10, 10);
|
nicknameEntry.setPadding(10, 10, 10, 10);
|
||||||
|
int inputType = TYPE_CLASS_TEXT | TYPE_TEXT_FLAG_CAP_WORDS;
|
||||||
|
nicknameEntry.setInputType(inputType);
|
||||||
nicknameEntry.setOnEditorActionListener(this);
|
nicknameEntry.setOnEditorActionListener(this);
|
||||||
layout.addView(nicknameEntry);
|
layout.addView(nicknameEntry);
|
||||||
|
|
||||||
@@ -141,7 +146,11 @@ implements OnEditorActionListener, OnClickListener {
|
|||||||
dbUiExecutor.execute(new Runnable() {
|
dbUiExecutor.execute(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
db.addLocalAuthor(a);
|
db.addLocalAuthor(a);
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Storing author took " + duration + " ms");
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
LOG.log(WARNING, e.toString(), e);
|
LOG.log(WARNING, e.toString(), e);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.sf.briar.android.invitation;
|
package net.sf.briar.android.invitation;
|
||||||
|
|
||||||
|
import static java.util.logging.Level.INFO;
|
||||||
import static java.util.logging.Level.WARNING;
|
import static java.util.logging.Level.WARNING;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -186,12 +187,17 @@ implements InvitationListener {
|
|||||||
setView(view);
|
setView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadLocalAuthorList(final LocalAuthorSpinnerAdapter adapter) {
|
void loadLocalAuthors(final LocalAuthorSpinnerAdapter adapter) {
|
||||||
dbUiExecutor.execute(new Runnable() {
|
dbUiExecutor.execute(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
displayLocalAuthorList(adapter, db.getLocalAuthors());
|
long now = System.currentTimeMillis();
|
||||||
|
Collection<LocalAuthor> localAuthors = db.getLocalAuthors();
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Loading authors took " + duration + " ms");
|
||||||
|
displayLocalAuthors(adapter, localAuthors);
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
LOG.log(WARNING, e.toString(), e);
|
LOG.log(WARNING, e.toString(), e);
|
||||||
@@ -203,7 +209,7 @@ implements InvitationListener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayLocalAuthorList(final LocalAuthorSpinnerAdapter adapter,
|
private void displayLocalAuthors(final LocalAuthorSpinnerAdapter adapter,
|
||||||
final Collection<LocalAuthor> localAuthors) {
|
final Collection<LocalAuthor> localAuthors) {
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -218,6 +224,10 @@ implements InvitationListener {
|
|||||||
this.localAuthorId = localAuthorId;
|
this.localAuthorId = localAuthorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AuthorId getLocalAuthorId() {
|
||||||
|
return localAuthorId;
|
||||||
|
}
|
||||||
|
|
||||||
void setNetworkName(String networkName) {
|
void setNetworkName(String networkName) {
|
||||||
this.networkName = networkName;
|
this.networkName = networkName;
|
||||||
}
|
}
|
||||||
@@ -347,6 +357,7 @@ implements InvitationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void connectionFailed() {
|
public void connectionFailed() {
|
||||||
|
// FIXME: Do this on the UI thread
|
||||||
referenceManager.removeReference(handle, InvitationTask.class);
|
referenceManager.removeReference(handle, InvitationTask.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,14 +366,17 @@ implements InvitationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void remoteConfirmationFailed() {
|
public void remoteConfirmationFailed() {
|
||||||
|
// FIXME: Do this on the UI thread
|
||||||
referenceManager.removeReference(handle, InvitationTask.class);
|
referenceManager.removeReference(handle, InvitationTask.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pseudonymExchangeSucceeded(String remoteName) {
|
public void pseudonymExchangeSucceeded(String remoteName) {
|
||||||
|
// FIXME: Do this on the UI thread
|
||||||
referenceManager.removeReference(handle, InvitationTask.class);
|
referenceManager.removeReference(handle, InvitationTask.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pseudonymExchangeFailed() {
|
public void pseudonymExchangeFailed() {
|
||||||
|
// FIXME: Do this on the UI thread
|
||||||
referenceManager.removeReference(handle, InvitationTask.class);
|
referenceManager.removeReference(handle, InvitationTask.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,26 +57,33 @@ implements WifiStateListener, BluetoothStateListener, OnClickListener {
|
|||||||
tryAgainButton.setLayoutParams(WRAP_WRAP);
|
tryAgainButton.setLayoutParams(WRAP_WRAP);
|
||||||
tryAgainButton.setText(R.string.try_again_button);
|
tryAgainButton.setText(R.string.try_again_button);
|
||||||
tryAgainButton.setOnClickListener(this);
|
tryAgainButton.setOnClickListener(this);
|
||||||
enabledOrDisableTryAgainButton();
|
enableOrDisableTryAgainButton();
|
||||||
addView(tryAgainButton);
|
addView(tryAgainButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void wifiStateChanged(String networkName) {
|
public void wifiStateChanged(final String networkName) {
|
||||||
container.setNetworkName(networkName);
|
container.runOnUiThread(new Runnable() {
|
||||||
enabledOrDisableTryAgainButton();
|
public void run() {
|
||||||
|
container.setNetworkName(networkName);
|
||||||
|
enableOrDisableTryAgainButton();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bluetoothStateChanged(boolean enabled) {
|
public void bluetoothStateChanged(final boolean enabled) {
|
||||||
container.setUseBluetooth(enabled);
|
container.runOnUiThread(new Runnable() {
|
||||||
enabledOrDisableTryAgainButton();
|
public void run() {
|
||||||
|
container.setUseBluetooth(enabled);
|
||||||
|
enableOrDisableTryAgainButton();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enabledOrDisableTryAgainButton() {
|
private void enableOrDisableTryAgainButton() {
|
||||||
if(tryAgainButton == null) return; // Activity not created yet
|
if(tryAgainButton == null) return; // Activity not created yet
|
||||||
boolean useBluetooth = container.getUseBluetooth();
|
boolean useBluetooth = container.getUseBluetooth();
|
||||||
String networkName = container.getNetworkName();
|
String networkName = container.getNetworkName();
|
||||||
if(useBluetooth || networkName != null) tryAgainButton.setEnabled(true);
|
tryAgainButton.setEnabled(useBluetooth || networkName != null);
|
||||||
else tryAgainButton.setEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public class ConnectionView extends AddContactView {
|
|||||||
code.setText(String.format("%06d", localCode));
|
code.setText(String.format("%06d", localCode));
|
||||||
addView(code);
|
addView(code);
|
||||||
|
|
||||||
|
// FIXME: These spinners don't appear when trying again after a failure
|
||||||
String networkName = container.getNetworkName();
|
String networkName = container.getNetworkName();
|
||||||
if(networkName != null) {
|
if(networkName != null) {
|
||||||
LinearLayout innerLayout = new LinearLayout(ctx);
|
LinearLayout innerLayout = new LinearLayout(ctx);
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ import static net.sf.briar.android.widgets.CommonLayoutParams.MATCH_WRAP;
|
|||||||
import static net.sf.briar.android.widgets.CommonLayoutParams.WRAP_WRAP;
|
import static net.sf.briar.android.widgets.CommonLayoutParams.WRAP_WRAP;
|
||||||
import net.sf.briar.R;
|
import net.sf.briar.R;
|
||||||
import net.sf.briar.android.LocalAuthorSpinnerAdapter;
|
import net.sf.briar.android.LocalAuthorSpinnerAdapter;
|
||||||
import net.sf.briar.android.identity.CreateIdentityActivity;
|
import net.sf.briar.api.AuthorId;
|
||||||
import net.sf.briar.api.LocalAuthor;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
@@ -39,17 +37,17 @@ OnClickListener {
|
|||||||
innerLayout.setOrientation(HORIZONTAL);
|
innerLayout.setOrientation(HORIZONTAL);
|
||||||
innerLayout.setGravity(CENTER);
|
innerLayout.setGravity(CENTER);
|
||||||
|
|
||||||
TextView yourIdentity = new TextView(ctx);
|
TextView yourNickname = new TextView(ctx);
|
||||||
yourIdentity.setTextSize(18);
|
yourNickname.setTextSize(18);
|
||||||
yourIdentity.setPadding(10, 10, 10, 10);
|
yourNickname.setPadding(10, 10, 10, 10);
|
||||||
yourIdentity.setText(R.string.your_identity);
|
yourNickname.setText(R.string.your_nickname);
|
||||||
innerLayout.addView(yourIdentity);
|
innerLayout.addView(yourNickname);
|
||||||
|
|
||||||
adapter = new LocalAuthorSpinnerAdapter(ctx);
|
adapter = new LocalAuthorSpinnerAdapter(ctx);
|
||||||
spinner = new Spinner(ctx);
|
spinner = new Spinner(ctx);
|
||||||
spinner.setAdapter(adapter);
|
spinner.setAdapter(adapter);
|
||||||
spinner.setOnItemSelectedListener(this);
|
spinner.setOnItemSelectedListener(this);
|
||||||
container.loadLocalAuthorList(adapter);
|
container.loadLocalAuthors(adapter);
|
||||||
innerLayout.addView(spinner);
|
innerLayout.addView(spinner);
|
||||||
addView(innerLayout);
|
addView(innerLayout);
|
||||||
|
|
||||||
@@ -89,21 +87,17 @@ OnClickListener {
|
|||||||
|
|
||||||
private void enableOrDisableContinueButton() {
|
private void enableOrDisableContinueButton() {
|
||||||
if(continueButton == null) return; // Activity not created yet
|
if(continueButton == null) return; // Activity not created yet
|
||||||
|
AuthorId localAuthorId = container.getLocalAuthorId();
|
||||||
boolean useBluetooth = container.getUseBluetooth();
|
boolean useBluetooth = container.getUseBluetooth();
|
||||||
String networkName = container.getNetworkName();
|
String networkName = container.getNetworkName();
|
||||||
if(useBluetooth || networkName != null) continueButton.setEnabled(true);
|
continueButton.setEnabled(localAuthorId != null &&
|
||||||
else continueButton.setEnabled(false);
|
(useBluetooth || networkName != null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position,
|
public void onItemSelected(AdapterView<?> parent, View view, int position,
|
||||||
long id) {
|
long id) {
|
||||||
LocalAuthor item = adapter.getItem(position);
|
container.setLocalAuthorId(adapter.getItem(position).getId());
|
||||||
if(item == null) {
|
enableOrDisableContinueButton();
|
||||||
Intent i = new Intent(container, CreateIdentityActivity.class);
|
|
||||||
container.startActivity(i);
|
|
||||||
} else {
|
|
||||||
container.setLocalAuthorId(item.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class NoContactsDialog extends DialogFragment {
|
|||||||
public Dialog onCreateDialog(Bundle state) {
|
public Dialog onCreateDialog(Bundle state) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setMessage(R.string.no_contacts);
|
builder.setMessage(R.string.no_contacts);
|
||||||
builder.setPositiveButton(R.string.add_contact_button,
|
builder.setPositiveButton(R.string.add_button,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
listener.addContactButtonClicked();
|
listener.addContactButtonClicked();
|
||||||
|
|||||||
@@ -189,7 +189,11 @@ implements OnClickListener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
db.setReadFlag(messageId, read);
|
db.setReadFlag(messageId, read);
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Setting flag took " + duration + " ms");
|
||||||
setReadInUi(read);
|
setReadInUi(read);
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
@@ -218,7 +222,11 @@ implements OnClickListener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
byte[] body = db.getMessageBody(messageId);
|
byte[] body = db.getMessageBody(messageId);
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Loading message took " + duration + " ms");
|
||||||
final String text = new String(body, "UTF-8");
|
final String text = new String(body, "UTF-8");
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package net.sf.briar.android.messages;
|
package net.sf.briar.android.messages;
|
||||||
|
|
||||||
|
import static android.text.InputType.TYPE_CLASS_TEXT;
|
||||||
|
import static android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
|
||||||
import static android.view.Gravity.CENTER_VERTICAL;
|
import static android.view.Gravity.CENTER_VERTICAL;
|
||||||
import static android.widget.LinearLayout.HORIZONTAL;
|
import static android.widget.LinearLayout.HORIZONTAL;
|
||||||
import static android.widget.LinearLayout.VERTICAL;
|
import static android.widget.LinearLayout.VERTICAL;
|
||||||
@@ -125,6 +127,8 @@ implements OnItemSelectedListener, OnClickListener {
|
|||||||
|
|
||||||
content = new EditText(this);
|
content = new EditText(this);
|
||||||
content.setPadding(10, 10, 10, 10);
|
content.setPadding(10, 10, 10, 10);
|
||||||
|
int inputType = TYPE_CLASS_TEXT | TYPE_TEXT_FLAG_CAP_SENTENCES;
|
||||||
|
content.setInputType(inputType);
|
||||||
if(state != null && bundleEncrypter.decrypt(state)) {
|
if(state != null && bundleEncrypter.decrypt(state)) {
|
||||||
Parcelable p = state.getParcelable("net.sf.briar.CONTENT");
|
Parcelable p = state.getParcelable("net.sf.briar.CONTENT");
|
||||||
if(p != null) content.onRestoreInstanceState(p);
|
if(p != null) content.onRestoreInstanceState(p);
|
||||||
@@ -149,7 +153,12 @@ implements OnItemSelectedListener, OnClickListener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
displayContacts(db.getContacts());
|
long now = System.currentTimeMillis();
|
||||||
|
Collection<Contact> contacts = db.getContacts();
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Loading contacts took " + duration + " ms");
|
||||||
|
displayContacts(contacts);
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
LOG.log(WARNING, e.toString(), e);
|
LOG.log(WARNING, e.toString(), e);
|
||||||
@@ -200,12 +209,12 @@ implements OnItemSelectedListener, OnClickListener {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
localAuthor = db.getLocalAuthor(a);
|
localAuthor = db.getLocalAuthor(a);
|
||||||
runOnUiThread(new Runnable() {
|
long duration = System.currentTimeMillis() - now;
|
||||||
public void run() {
|
if(LOG.isLoggable(INFO))
|
||||||
sendButton.setEnabled(true);
|
LOG.info("Loading author took " + duration + " ms");
|
||||||
}
|
displayLocalAuthor();
|
||||||
});
|
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
LOG.log(WARNING, e.toString(), e);
|
LOG.log(WARNING, e.toString(), e);
|
||||||
@@ -217,6 +226,16 @@ implements OnItemSelectedListener, OnClickListener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void displayLocalAuthor() {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
String format = getResources().getString(R.string.format_from);
|
||||||
|
from.setText(String.format(format, localAuthor.getName()));
|
||||||
|
sendButton.setEnabled(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
contactId = null;
|
contactId = null;
|
||||||
sendButton.setEnabled(false);
|
sendButton.setEnabled(false);
|
||||||
@@ -242,7 +261,11 @@ implements OnItemSelectedListener, OnClickListener {
|
|||||||
serviceConnection.waitForStartup();
|
serviceConnection.waitForStartup();
|
||||||
Message m = messageFactory.createPrivateMessage(parentId,
|
Message m = messageFactory.createPrivateMessage(parentId,
|
||||||
"text/plain", body);
|
"text/plain", body);
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
db.addLocalPrivateMessage(m, contactId);
|
db.addLocalPrivateMessage(m, contactId);
|
||||||
|
long duration = System.currentTimeMillis() - now;
|
||||||
|
if(LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Storing message took " + duration + " ms");
|
||||||
} catch(DbException e) {
|
} catch(DbException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
LOG.log(WARNING, e.toString(), e);
|
LOG.log(WARNING, e.toString(), e);
|
||||||
|
|||||||
Reference in New Issue
Block a user