hide the Runnable interface as an implementation detail of MessagingController

This commit is contained in:
Vincent Breitmoser 2016-08-05 16:47:31 +02:00
parent 6596c85a9f
commit 0dfcdbdfc4

View file

@ -112,7 +112,7 @@ import com.fsck.k9.search.SqlQueryBuilder;
* removed from the queue once the activity is no longer active.
*/
@SuppressWarnings("unchecked") // TODO change architecture to actually work with generics
public class MessagingController implements Runnable {
public class MessagingController {
public static final long INVALID_MESSAGE_ID = -1;
private static final String[] EMPTY_STRING_ARRAY = new String[0];
@ -167,7 +167,12 @@ public class MessagingController implements Runnable {
this.notificationController = notificationController;
this.contacts = contacts;
controllerThread = new Thread(this);
controllerThread = new Thread(new Runnable() {
@Override
public void run() {
runInBackground();
}
});
controllerThread.setName("MessagingController");
controllerThread.start();
addListener(memorizingMessagingListener);
@ -180,8 +185,7 @@ public class MessagingController implements Runnable {
controllerThread.join(1000L);
}
@Override
public void run() {
private void runInBackground() {
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
while (!stopped) {
String commandDescription = null;