Refactored finishOnUiThread() into superclass.

This commit is contained in:
akwizgran
2014-02-09 12:11:39 +00:00
parent e92b6fce4c
commit 1f169dd160
9 changed files with 14 additions and 39 deletions

View File

@@ -95,4 +95,12 @@ public class BriarActivity extends RoboFragmentActivity {
}
}.start();
}
protected void finishOnUiThread() {
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
}
}

View File

@@ -220,14 +220,6 @@ implements EventListener, OnClickListener, OnItemClickListener {
});
}
private void finishOnUiThread() {
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
}
@Override
protected void onActivityResult(int request, int result, Intent data) {
super.onActivityResult(request, result, data);

View File

@@ -235,11 +235,7 @@ implements OnClickListener {
});
} catch(NoSuchMessageException e) {
if(LOG.isLoggable(INFO)) LOG.info("Message removed");
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
finishOnUiThread();
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);

View File

@@ -166,9 +166,9 @@ implements OnClickListener {
LOG.info("Load took " + duration + " ms");
displayLocalAuthor();
} catch(NoSuchContactException e) {
finish();
finishOnUiThread();
} catch(NoSuchSubscriptionException e) {
finish();
finishOnUiThread();
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);

View File

@@ -225,11 +225,7 @@ SelectContactsDialog.Listener {
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
finishOnUiThread();
}
});
}

View File

@@ -195,11 +195,7 @@ SelectContactsDialog.Listener {
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
finishOnUiThread();
}
});
}

View File

@@ -226,14 +226,6 @@ OnClickListener, OnItemClickListener {
});
}
private void finishOnUiThread() {
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
}
@Override
protected void onActivityResult(int request, int result, Intent data) {
super.onActivityResult(request, result, data);

View File

@@ -58,7 +58,6 @@ class GroupAdapter extends ArrayAdapter<GroupItem> {
else authorView.init(author.getName(), header.getAuthorStatus());
headerLayout.addView(authorView);
// FIXME: Factor this out into a TimestampView
TextView date = new TextView(ctx);
date.setTextSize(14);
date.setPadding(0, pad, pad, pad);

View File

@@ -231,11 +231,7 @@ implements OnClickListener {
});
} catch(NoSuchMessageException e) {
if(LOG.isLoggable(INFO)) LOG.info("Message removed");
runOnUiThread(new Runnable() {
public void run() {
finish();
}
});
finishOnUiThread();
} catch(DbException e) {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);