use of com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback in project wire-android by wireapp.
the class ShareActivity method showUserNotLoggedInDialog.
public void showUserNotLoggedInDialog() {
confirmationMenu.setHeader(getString(R.string.sharing__user_not_logged_in__dialog__title));
confirmationMenu.setText(getString(R.string.sharing__user_not_logged_in__dialog__message));
confirmationMenu.setPositiveButton(getString(R.string.sharing__user_not_logged_in__dialog__confirm));
confirmationMenu.setNegativeButton("");
confirmationMenu.setCallback(new TwoButtonConfirmationCallback() {
@Override
public void positiveButtonClicked(boolean checkboxIsSelected) {
finish();
}
@Override
public void negativeButtonClicked() {
}
@Override
public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
}
});
confirmationMenu.animateToShow(true);
}
use of com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback in project wire-android by wireapp.
the class ConversationListManagerFragment method showBlockConfirmation.
private void showBlockConfirmation(final User user) {
ConfirmationCallback callback = new TwoButtonConfirmationCallback() {
@Override
public void positiveButtonClicked(boolean checkboxIsSelected) {
if (getStoreFactory() == null || getControllerFactory() == null || getStoreFactory().isTornDown() || getControllerFactory().isTornDown()) {
return;
}
boolean blockingCurrentConversation = user.getConversation().getId().equals(getStoreFactory().getConversationStore().getCurrentConversation().getId());
getStoreFactory().getConnectStore().blockUser(user);
if (blockingCurrentConversation) {
getStoreFactory().getConversationStore().setCurrentConversationToNext(ConversationChangeRequester.BLOCK_USER);
}
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new BlockingEvent(BlockingEvent.ConformationResponse.BLOCK));
}
@Override
public void negativeButtonClicked() {
if (getControllerFactory() == null || getControllerFactory().isTornDown()) {
return;
}
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new BlockingEvent(BlockingEvent.ConformationResponse.CANCEL));
}
@Override
public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
}
};
String header = getString(R.string.confirmation_menu__block_header);
String text = getString(R.string.confirmation_menu__block_text_with_name, user.getDisplayName());
String confirm = getString(R.string.confirmation_menu__confirm_block);
String cancel = getString(R.string.confirmation_menu__cancel);
ConfirmationRequest request = new ConfirmationRequest.Builder().withHeader(header).withMessage(text).withPositiveButton(confirm).withNegativeButton(cancel).withConfirmationCallback(callback).withWireTheme(getControllerFactory().getThemeController().getOptionsDarkTheme()).build();
getControllerFactory().getConfirmationController().requestConfirmation(request, IConfirmationController.CONVERSATION_LIST);
SoundController ctrl = inject(SoundController.class);
if (ctrl != null) {
ctrl.playAlert();
}
}
use of com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback in project wire-android by wireapp.
the class ParticipantFragment method showRemoveConfirmation.
//////////////////////////////////////////////////////////////////////////////////////////
//
// UserProfileContainer
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
public void showRemoveConfirmation(final User user) {
// Show confirmation dialog before removing user
ConfirmationCallback callback = new TwoButtonConfirmationCallback() {
@Override
public void positiveButtonClicked(boolean checkboxIsSelected) {
dismissUserProfile();
new Handler().post(new Runnable() {
@Override
public void run() {
getStoreFactory().getConversationStore().getCurrentConversation().removeMember(user);
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new RemoveContactEvent(true, getParticipantsCount()));
}
});
}
@Override
public void negativeButtonClicked() {
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new RemoveContactEvent(false, getParticipantsCount()));
}
@Override
public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
}
};
String header = getString(R.string.confirmation_menu__header);
String text = getString(R.string.confirmation_menu_text_with_name, user.getDisplayName());
String confirm = getString(R.string.confirmation_menu__confirm_remove);
String cancel = getString(R.string.confirmation_menu__cancel);
ConfirmationRequest request = new ConfirmationRequest.Builder().withHeader(header).withMessage(text).withPositiveButton(confirm).withNegativeButton(cancel).withConfirmationCallback(callback).withWireTheme(getControllerFactory().getThemeController().getThemeDependentOptionsTheme()).build();
getControllerFactory().getConfirmationController().requestConfirmation(request, IConfirmationController.PARTICIPANTS);
SoundController ctrl = inject(SoundController.class);
if (ctrl != null) {
ctrl.playAlert();
}
}
use of com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback in project wire-android by wireapp.
the class ParticipantFragment method deleteConversation.
public void deleteConversation(final IConversation conversation) {
ConfirmationCallback callback = new TwoButtonConfirmationCallback() {
@Override
public void positiveButtonClicked(boolean checkboxIsSelected) {
}
@Override
public void negativeButtonClicked() {
}
@Override
public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
if (getStoreFactory() == null || getStoreFactory().isTornDown() || getControllerFactory() == null || getControllerFactory().isTornDown()) {
return;
}
if (!confirmed) {
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new DeleteConversationEvent(ConversationType.getValue(conversation), DeleteConversationEvent.Context.LIST, DeleteConversationEvent.Response.CANCEL));
return;
}
IConversation currentConversation = getStoreFactory().getConversationStore().getCurrentConversation();
boolean deleteCurrentConversation = conversation != null && currentConversation != null && conversation.getId().equals(currentConversation.getId());
getStoreFactory().getConversationStore().deleteConversation(conversation, checkboxIsSelected);
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new DeleteConversationEvent(ConversationType.getValue(conversation), DeleteConversationEvent.Context.PARTICIPANTS, DeleteConversationEvent.Response.DELETE));
if (deleteCurrentConversation) {
getStoreFactory().getConversationStore().setCurrentConversationToNext(ConversationChangeRequester.DELETE_CONVERSATION);
}
if (LayoutSpec.isTablet(getActivity())) {
getControllerFactory().getConversationScreenController().hideParticipants(false, true);
}
}
};
String header = getString(R.string.confirmation_menu__meta_delete);
String text = getString(R.string.confirmation_menu__meta_delete_text);
String confirm = getString(R.string.confirmation_menu__confirm_delete);
String cancel = getString(R.string.confirmation_menu__cancel);
ConfirmationRequest.Builder builder = new ConfirmationRequest.Builder().withHeader(header).withMessage(text).withPositiveButton(confirm).withNegativeButton(cancel).withConfirmationCallback(callback).withWireTheme(getControllerFactory().getThemeController().getThemeDependentOptionsTheme());
if (conversation.getType() == IConversation.Type.GROUP) {
builder = builder.withCheckboxLabel(getString(R.string.confirmation_menu__delete_conversation__checkbox__label)).withCheckboxSelectedByDefault();
}
getControllerFactory().getConfirmationController().requestConfirmation(builder.build(), IConfirmationController.PARTICIPANTS);
SoundController ctrl = inject(SoundController.class);
if (ctrl != null) {
ctrl.playAlert();
}
}
use of com.waz.zclient.controllers.confirmation.TwoButtonConfirmationCallback in project wire-android by wireapp.
the class SingleParticipantFragment method showBlockConfirmation.
private void showBlockConfirmation(final User user) {
ConfirmationCallback callback = new TwoButtonConfirmationCallback() {
@Override
public void positiveButtonClicked(boolean checkboxIsSelected) {
getStoreFactory().getConnectStore().blockUser(user);
// Dismiss common user profile
getContainer().dismissUserProfile();
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new BlockingEvent(BlockingEvent.ConformationResponse.BLOCK));
}
@Override
public void negativeButtonClicked() {
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new BlockingEvent(BlockingEvent.ConformationResponse.CANCEL));
}
@Override
public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
}
};
String header = getString(R.string.confirmation_menu__block_header);
String text = getString(R.string.confirmation_menu__block_text_with_name, user.getDisplayName());
String confirm = getString(R.string.confirmation_menu__confirm_block);
String cancel = getString(R.string.confirmation_menu__cancel);
OptionsTheme optionsTheme = getControllerFactory().getThemeController().getThemeDependentOptionsTheme();
ConfirmationRequest request = new ConfirmationRequest.Builder().withHeader(header).withMessage(text).withPositiveButton(confirm).withNegativeButton(cancel).withConfirmationCallback(callback).withWireTheme(optionsTheme).build();
getControllerFactory().getConfirmationController().requestConfirmation(request, IConfirmationController.USER_PROFILE);
SoundController ctrl = inject(SoundController.class);
if (ctrl != null) {
ctrl.playAlert();
}
}
Aggregations