mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
A few more Java 8 changes in merged code.
This commit is contained in:
@@ -40,12 +40,7 @@ public class DozeFragment extends SetupFragment {
|
||||
dozeButton = (Button) v.findViewById(R.id.dozeButton);
|
||||
progressBar = (ProgressBar) v.findViewById(R.id.progress);
|
||||
|
||||
dozeButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
askForDozeWhitelisting();
|
||||
}
|
||||
});
|
||||
dozeButton.setOnClickListener(view -> askForDozeWhitelisting());
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ public interface SetupController {
|
||||
|
||||
void createAccount();
|
||||
|
||||
void createAccount(final ResultHandler<Void> resultHandler);
|
||||
void createAccount(ResultHandler<Void> resultHandler);
|
||||
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class SetupControllerImpl extends PasswordControllerImpl
|
||||
|
||||
@Override
|
||||
public void createAccount() {
|
||||
final UiResultHandler<Void> resultHandler =
|
||||
UiResultHandler<Void> resultHandler =
|
||||
new UiResultHandler<Void>(setupActivity) {
|
||||
@Override
|
||||
public void onResultUi(Void result) {
|
||||
@@ -83,7 +83,7 @@ public class SetupControllerImpl extends PasswordControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAccount(final ResultHandler<Void> resultHandler) {
|
||||
public void createAccount(ResultHandler<Void> resultHandler) {
|
||||
if (authorName == null || password == null)
|
||||
throw new IllegalStateException();
|
||||
cryptoExecutor.execute(() -> {
|
||||
|
||||
@@ -230,8 +230,8 @@ class GroupControllerImpl extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isDissolved(final
|
||||
ResultExceptionHandler<Boolean, DbException> handler) {
|
||||
public void isDissolved(
|
||||
ResultExceptionHandler<Boolean, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
boolean isDissolved =
|
||||
|
||||
@@ -7,7 +7,6 @@ import org.briarproject.bramble.api.crypto.PasswordStrengthEstimator;
|
||||
import org.briarproject.bramble.api.db.DatabaseConfig;
|
||||
import org.briarproject.bramble.test.BrambleMockTestCase;
|
||||
import org.briarproject.bramble.test.ImmediateExecutor;
|
||||
import org.briarproject.briar.android.controller.handler.ResultHandler;
|
||||
import org.jmock.Expectations;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -61,14 +60,8 @@ public class PasswordControllerImplTest extends BrambleMockTestCase {
|
||||
PasswordControllerImpl p = new PasswordControllerImpl(briarPrefs,
|
||||
databaseConfig, cryptoExecutor, crypto, estimator);
|
||||
|
||||
final AtomicBoolean capturedResult = new AtomicBoolean(false);
|
||||
p.changePassword(oldPassword, newPassword,
|
||||
new ResultHandler<Boolean>() {
|
||||
@Override
|
||||
public void onResult(Boolean result) {
|
||||
capturedResult.set(result);
|
||||
}
|
||||
});
|
||||
AtomicBoolean capturedResult = new AtomicBoolean(false);
|
||||
p.changePassword(oldPassword, newPassword, capturedResult::set);
|
||||
assertTrue(capturedResult.get());
|
||||
}
|
||||
|
||||
@@ -86,14 +79,8 @@ public class PasswordControllerImplTest extends BrambleMockTestCase {
|
||||
PasswordControllerImpl p = new PasswordControllerImpl(briarPrefs,
|
||||
databaseConfig, cryptoExecutor, crypto, estimator);
|
||||
|
||||
final AtomicBoolean capturedResult = new AtomicBoolean(true);
|
||||
p.changePassword(oldPassword, newPassword,
|
||||
new ResultHandler<Boolean>() {
|
||||
@Override
|
||||
public void onResult(Boolean result) {
|
||||
capturedResult.set(result);
|
||||
}
|
||||
});
|
||||
AtomicBoolean capturedResult = new AtomicBoolean(true);
|
||||
p.changePassword(oldPassword, newPassword, capturedResult::set);
|
||||
assertFalse(capturedResult.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import org.briarproject.bramble.api.crypto.SecretKey;
|
||||
import org.briarproject.bramble.api.db.DatabaseConfig;
|
||||
import org.briarproject.bramble.test.BrambleMockTestCase;
|
||||
import org.briarproject.bramble.test.ImmediateExecutor;
|
||||
import org.briarproject.briar.android.controller.handler.ResultHandler;
|
||||
import org.jmock.Expectations;
|
||||
import org.jmock.lib.legacy.ClassImposteriser;
|
||||
import org.junit.Test;
|
||||
@@ -72,15 +71,10 @@ public class SetupControllerImplTest extends BrambleMockTestCase {
|
||||
databaseConfig, cryptoExecutor, crypto, estimator);
|
||||
s.setSetupActivity(setupActivity);
|
||||
|
||||
final AtomicBoolean called = new AtomicBoolean(false);
|
||||
AtomicBoolean called = new AtomicBoolean(false);
|
||||
s.setAuthorName(authorName);
|
||||
s.setPassword(password);
|
||||
s.createAccount(new ResultHandler<Void>() {
|
||||
@Override
|
||||
public void onResult(Void result) {
|
||||
called.set(true);
|
||||
}
|
||||
});
|
||||
s.createAccount(result -> called.set(true));
|
||||
assertTrue(called.get());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user