mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-21 15:19:53 +01:00
Popup dialog on wipe signal sent successfully
This commit is contained in:
@@ -56,7 +56,7 @@ public class ActivateRemoteWipeActivity extends BriarActivity implements
|
|||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
break;
|
break;
|
||||||
case SUCCESS:
|
case SUCCESS:
|
||||||
showNextFragment(new ActivateRemoteWipeSuccessFragment());
|
// Handled by the popup dialog on the explainer
|
||||||
break;
|
break;
|
||||||
default: // FINISHED or CANCELLED
|
default: // FINISHED or CANCELLED
|
||||||
finish();
|
finish();
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
public class ActivateRemoteWipeExplainerFragment extends
|
public class ActivateRemoteWipeExplainerFragment extends BaseFragment {
|
||||||
BaseFragment {
|
|
||||||
|
|
||||||
public static final String TAG =
|
public static final String TAG =
|
||||||
ActivateRemoteWipeExplainerFragment.class.getName();
|
ActivateRemoteWipeExplainerFragment.class.getName();
|
||||||
@@ -54,11 +54,30 @@ public class ActivateRemoteWipeExplainerFragment extends
|
|||||||
|
|
||||||
Button confirmButton = view.findViewById(R.id.button_confirm);
|
Button confirmButton = view.findViewById(R.id.button_confirm);
|
||||||
confirmButton.setOnClickListener(e -> viewModel.onConfirmClicked());
|
confirmButton.setOnClickListener(e -> viewModel.onConfirmClicked());
|
||||||
|
|
||||||
|
viewModel.getState().observe(getViewLifecycleOwner(), this::onStateChanged);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onStateChanged(ActivateRemoteWipeState state) {
|
||||||
|
if (state == ActivateRemoteWipeState.SUCCESS) {
|
||||||
|
showSuccessDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUniqueTag() {
|
public String getUniqueTag() {
|
||||||
return TAG;
|
return TAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showSuccessDialog() {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext(),
|
||||||
|
R.style.BriarDialogTheme);
|
||||||
|
builder.setTitle(R.string.remote_wipe_activate_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