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