mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 13:49:53 +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);
|
false);
|
||||||
scrollView = v.findViewById(R.id.scrollView);
|
scrollView = v.findViewById(R.id.scrollView);
|
||||||
View button = v.findViewById(R.id.continueButton);
|
View button = v.findViewById(R.id.continueButton);
|
||||||
button.setOnClickListener(view -> viewModel.onContinueClicked(() ->
|
button.setOnClickListener(view -> {
|
||||||
permissionManager.checkPermissions()
|
viewModel.onContinueClicked();
|
||||||
));
|
if (permissionManager.checkPermissions()) {
|
||||||
|
viewModel.showQrCodeFragmentIfAllowed();
|
||||||
|
}
|
||||||
|
});
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ import javax.inject.Provider;
|
|||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.UiThread;
|
import androidx.annotation.UiThread;
|
||||||
import androidx.core.util.Supplier;
|
|
||||||
import androidx.lifecycle.AndroidViewModel;
|
import androidx.lifecycle.AndroidViewModel;
|
||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
@@ -211,12 +210,11 @@ class AddNearbyContactViewModel extends AndroidViewModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
void onContinueClicked(Supplier<Boolean> checkPermissions) {
|
void onContinueClicked() {
|
||||||
if (bluetoothDecision == REFUSED) {
|
if (bluetoothDecision == REFUSED) {
|
||||||
bluetoothDecision = UNKNOWN; // Ask again
|
bluetoothDecision = UNKNOWN; // Ask again
|
||||||
}
|
}
|
||||||
wasContinueClicked = true;
|
wasContinueClicked = true;
|
||||||
if (checkPermissions.get()) showQrCodeFragmentIfAllowed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
|
|||||||
Reference in New Issue
Block a user