Search in sources :

Example 1 with XabberAccountInfoActivity

use of com.xabber.android.ui.activity.XabberAccountInfoActivity in project xabber-android by redsolution.

the class XabberAccountInfoFragment method showLogoutDialog.

private void showLogoutDialog() {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.dialog_logout_xabber_account, null);
    final CheckBox chbDeleteAccounts = (CheckBox) view.findViewById(R.id.chbDeleteAccounts);
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.progress_title_quit).setMessage(R.string.logout_summary).setView(view).setPositiveButton(R.string.button_quit, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            ((XabberAccountInfoActivity) getActivity()).onLogoutClick(chbDeleteAccounts.isChecked());
        }
    }).setNegativeButton(R.string.cancel, null);
    Dialog dialog = builder.create();
    dialog.show();
    dialogShowed = false;
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) CheckBox(android.widget.CheckBox) Dialog(android.app.Dialog) AlertDialog(android.app.AlertDialog) LayoutInflater(android.view.LayoutInflater) XabberAccountInfoActivity(com.xabber.android.ui.activity.XabberAccountInfoActivity) View(android.view.View) TextView(android.widget.TextView)

Example 2 with XabberAccountInfoActivity

use of com.xabber.android.ui.activity.XabberAccountInfoActivity in project xabber-android by redsolution.

the class AccountSyncDialogFragment method onPositiveClick.

private void onPositiveClick(boolean needGoToMainActivity) {
    // set accounts to sync map
    if (!switchSyncAll.isChecked()) {
        Map<String, Boolean> syncState = new HashMap<>();
        for (XMPPAccountSettings account : xmppAccounts) {
            if (account.getStatus() != XMPPAccountSettings.SyncStatus.local) {
                syncState.put(account.getJid(), account.isSynchronization());
            } else if (account.isSynchronization() || XabberAccountManager.getInstance().getAccountSyncState(account.getJid()) != null) {
                syncState.put(account.getJid(), account.isSynchronization());
            }
        }
        XabberAccountManager.getInstance().setAccountSyncState(syncState);
    }
    // update timestamp in accounts if timestamp was changed in dialog
    for (XMPPAccountSettings account : xmppAccounts) {
        AccountJid accountJid = XabberAccountManager.getInstance().getExistingAccount(account.getJid());
        if (accountJid != null)
            AccountManager.getInstance().setTimestamp(accountJid, account.getTimestamp());
    }
    // set sync all
    SettingsManager.setSyncAllAccounts(switchSyncAll.isChecked());
    // callback to sync-request
    ((XabberAccountInfoActivity) getActivity()).onSyncClick(needGoToMainActivity);
}
Also used : HashMap(java.util.HashMap) XMPPAccountSettings(com.xabber.android.data.xaccount.XMPPAccountSettings) AccountJid(com.xabber.android.data.entity.AccountJid) XabberAccountInfoActivity(com.xabber.android.ui.activity.XabberAccountInfoActivity)

Aggregations

XabberAccountInfoActivity (com.xabber.android.ui.activity.XabberAccountInfoActivity)2 AlertDialog (android.app.AlertDialog)1 Dialog (android.app.Dialog)1 DialogInterface (android.content.DialogInterface)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 CheckBox (android.widget.CheckBox)1 TextView (android.widget.TextView)1 AccountJid (com.xabber.android.data.entity.AccountJid)1 XMPPAccountSettings (com.xabber.android.data.xaccount.XMPPAccountSettings)1 HashMap (java.util.HashMap)1