mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Add pop-up dialog on remote wipe setup success
This commit is contained in:
@@ -15,6 +15,7 @@ import java.util.Collection;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
public class RemoteWipeSetupActivity extends BriarActivity implements
|
||||
@@ -59,9 +60,9 @@ public class RemoteWipeSetupActivity extends BriarActivity implements
|
||||
}
|
||||
|
||||
private void onStateChanged(RemoteWipeSetupState state) {
|
||||
if (state.equals(RemoteWipeSetupState.SUCCESS)) {
|
||||
showNextFragment(new RemoteWipeSuccessFragment());
|
||||
} else if (state.equals(RemoteWipeSetupState.FAILED)) {
|
||||
// if (state.equals(RemoteWipeSetupState.SUCCESS)) {
|
||||
// showNextFragment(new RemoteWipeSuccessFragment());
|
||||
if (state.equals(RemoteWipeSetupState.FAILED)) {
|
||||
Toast.makeText(this,
|
||||
R.string.remote_wipe_setup_failed,
|
||||
Toast.LENGTH_LONG).show();
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@@ -59,6 +60,14 @@ public class WiperSelectorFragment extends ContactSelectorFragment {
|
||||
super.onCreate(savedInstanceState);
|
||||
selectedContacts.addAll(viewModel.getWiperContactIds());
|
||||
requireActivity().setTitle(R.string.title_select_wipers);
|
||||
|
||||
viewModel.getState().observe(this, this::onStateChanged);
|
||||
}
|
||||
|
||||
private void onStateChanged(RemoteWipeSetupState state) {
|
||||
if (state.equals(RemoteWipeSetupState.SUCCESS)) {
|
||||
showSuccessDialog();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,4 +104,15 @@ public class WiperSelectorFragment extends ContactSelectorFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private void showSuccessDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext(),
|
||||
R.style.BriarDialogTheme);
|
||||
builder.setTitle(R.string.remote_wipe_setup_success);
|
||||
builder.setPositiveButton(R.string.ok,
|
||||
(dialog, which) -> viewModel.onSuccessDismissed());
|
||||
builder.setIcon(R.drawable.ic_baseline_done_outline_24);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user