mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
merge and update
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
package org.briarproject.android.controller.handler;
|
||||
|
||||
public interface ResultExceptionHandler<R, E extends Exception> {
|
||||
void onResult(R result);
|
||||
void onException(E exception);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.briarproject.android.controller.handler;
|
||||
|
||||
public interface ResultHandler<R> {
|
||||
void onResult(R result);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.briarproject.android.controller.handler;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
public abstract class UiResultExceptionHandler<R, E extends Exception>
|
||||
implements ResultExceptionHandler<R, E> {
|
||||
|
||||
private final Activity activity;
|
||||
|
||||
public UiResultExceptionHandler(Activity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
public void onResult(final R result) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
onResultUi(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onException(final E exception) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
onExceptionUi(exception);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public abstract void onResultUi(R result);
|
||||
|
||||
public abstract void onExceptionUi(E exception);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.briarproject.android.controller.handler;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
public abstract class UiResultHandler<R> implements ResultHandler<R> {
|
||||
|
||||
private final Activity activity;
|
||||
|
||||
public UiResultHandler(Activity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
public void onResult(final R result) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
onResultUi(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public abstract void onResultUi(R result);
|
||||
}
|
||||
Reference in New Issue
Block a user