Skip to content
Snippets Groups Projects
Commit 1f169dd1 authored by akwizgran's avatar akwizgran
Browse files

Refactored finishOnUiThread() into superclass.

parent e92b6fce
No related branches found
No related tags found
No related merge requests found
Showing
with 14 additions and 39 deletions
...@@ -95,4 +95,12 @@ public class BriarActivity extends RoboFragmentActivity { ...@@ -95,4 +95,12 @@ public class BriarActivity extends RoboFragmentActivity {
} }
}.start(); }.start();
} }
protected void finishOnUiThread() {
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
}
} }
...@@ -220,14 +220,6 @@ implements EventListener, OnClickListener, OnItemClickListener { ...@@ -220,14 +220,6 @@ implements EventListener, OnClickListener, OnItemClickListener {
}); });
} }
private void finishOnUiThread() {
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
}
@Override @Override
protected void onActivityResult(int request, int result, Intent data) { protected void onActivityResult(int request, int result, Intent data) {
super.onActivityResult(request, result, data); super.onActivityResult(request, result, data);
......
...@@ -235,11 +235,7 @@ implements OnClickListener { ...@@ -235,11 +235,7 @@ implements OnClickListener {
}); });
} catch(NoSuchMessageException e) { } catch(NoSuchMessageException e) {
if(LOG.isLoggable(INFO)) LOG.info("Message removed"); if(LOG.isLoggable(INFO)) LOG.info("Message removed");
runOnUiThread(new Runnable() { finishOnUiThread();
public void run() {
finish();
}
});
} 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);
......
...@@ -166,9 +166,9 @@ implements OnClickListener { ...@@ -166,9 +166,9 @@ implements OnClickListener {
LOG.info("Load took " + duration + " ms"); LOG.info("Load took " + duration + " ms");
displayLocalAuthor(); displayLocalAuthor();
} catch(NoSuchContactException e) { } catch(NoSuchContactException e) {
finish(); finishOnUiThread();
} catch(NoSuchSubscriptionException e) { } catch(NoSuchSubscriptionException e) {
finish(); finishOnUiThread();
} 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);
......
...@@ -225,11 +225,7 @@ SelectContactsDialog.Listener { ...@@ -225,11 +225,7 @@ SelectContactsDialog.Listener {
LOG.info("Interrupted while waiting for database"); LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
runOnUiThread(new Runnable() { finishOnUiThread();
public void run() {
finish();
}
});
} }
}); });
} }
......
...@@ -195,11 +195,7 @@ SelectContactsDialog.Listener { ...@@ -195,11 +195,7 @@ SelectContactsDialog.Listener {
LOG.info("Interrupted while waiting for database"); LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
runOnUiThread(new Runnable() { finishOnUiThread();
public void run() {
finish();
}
});
} }
}); });
} }
......
...@@ -226,14 +226,6 @@ OnClickListener, OnItemClickListener { ...@@ -226,14 +226,6 @@ OnClickListener, OnItemClickListener {
}); });
} }
private void finishOnUiThread() {
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
}
@Override @Override
protected void onActivityResult(int request, int result, Intent data) { protected void onActivityResult(int request, int result, Intent data) {
super.onActivityResult(request, result, data); super.onActivityResult(request, result, data);
......
...@@ -58,7 +58,6 @@ class GroupAdapter extends ArrayAdapter<GroupItem> { ...@@ -58,7 +58,6 @@ class GroupAdapter extends ArrayAdapter<GroupItem> {
else authorView.init(author.getName(), header.getAuthorStatus()); else authorView.init(author.getName(), header.getAuthorStatus());
headerLayout.addView(authorView); headerLayout.addView(authorView);
// FIXME: Factor this out into a TimestampView
TextView date = new TextView(ctx); TextView date = new TextView(ctx);
date.setTextSize(14); date.setTextSize(14);
date.setPadding(0, pad, pad, pad); date.setPadding(0, pad, pad, pad);
......
...@@ -231,11 +231,7 @@ implements OnClickListener { ...@@ -231,11 +231,7 @@ implements OnClickListener {
}); });
} catch(NoSuchMessageException e) { } catch(NoSuchMessageException e) {
if(LOG.isLoggable(INFO)) LOG.info("Message removed"); if(LOG.isLoggable(INFO)) LOG.info("Message removed");
runOnUiThread(new Runnable() { finishOnUiThread();
public void run() {
finish();
}
});
} 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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment