mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Another small refactoring to make control flow easier to understand.
This commit is contained in:
@@ -72,9 +72,12 @@ public class AddNearbyContactIntroFragment extends BaseFragment {
|
||||
false);
|
||||
scrollView = v.findViewById(R.id.scrollView);
|
||||
View button = v.findViewById(R.id.continueButton);
|
||||
button.setOnClickListener(view -> viewModel.onContinueClicked(() ->
|
||||
permissionManager.checkPermissions()
|
||||
));
|
||||
button.setOnClickListener(view -> {
|
||||
viewModel.onContinueClicked();
|
||||
if (permissionManager.checkPermissions()) {
|
||||
viewModel.showQrCodeFragmentIfAllowed();
|
||||
}
|
||||
});
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ import javax.inject.Provider;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.UiThread;
|
||||
import androidx.core.util.Supplier;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
@@ -211,12 +210,11 @@ class AddNearbyContactViewModel extends AndroidViewModel
|
||||
}
|
||||
|
||||
@UiThread
|
||||
void onContinueClicked(Supplier<Boolean> checkPermissions) {
|
||||
void onContinueClicked() {
|
||||
if (bluetoothDecision == REFUSED) {
|
||||
bluetoothDecision = UNKNOWN; // Ask again
|
||||
}
|
||||
wasContinueClicked = true;
|
||||
if (checkPermissions.get()) showQrCodeFragmentIfAllowed();
|
||||
}
|
||||
|
||||
@UiThread
|
||||
|
||||
Reference in New Issue
Block a user