Introduce Exception handler for when no result needs to be returned

Also add NotNull annotation to classes that were touched
This commit is contained in:
Torsten Grote
2016-11-11 10:01:20 -02:00
parent ade7e50f65
commit 563d897651
26 changed files with 135 additions and 106 deletions

View File

@@ -0,0 +1,34 @@
package org.briarproject.android.controller.handler;
import android.support.annotation.UiThread;
import org.briarproject.android.DestroyableContext;
import org.briarproject.api.nullsafety.NotNullByDefault;
import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
public abstract class UiExceptionHandler<E extends Exception>
implements ExceptionHandler<E> {
protected final DestroyableContext listener;
protected UiExceptionHandler(DestroyableContext listener) {
this.listener = listener;
}
@Override
public void onException(final E exception) {
listener.runOnUiThreadUnlessDestroyed(new Runnable() {
@Override
public void run() {
onExceptionUi(exception);
}
});
}
@UiThread
public abstract void onExceptionUi(E exception);
}