Search in sources :

Example 6 with AccountManager

use of com.xabber.android.data.account.AccountManager in project xabber-android by redsolution.

the class ConnectionManager method connectAll.

public void connectAll() {
    LogManager.i(LOG_TAG, "connectAll");
    AccountManager accountManager = AccountManager.getInstance();
    for (AccountJid account : accountManager.getEnabledAccounts()) {
        ReconnectionManager.getInstance().requestReconnect(account);
    }
}
Also used : AccountJid(com.xabber.android.data.entity.AccountJid) AccountManager(com.xabber.android.data.account.AccountManager)

Example 7 with AccountManager

use of com.xabber.android.data.account.AccountManager in project xabber-android by redsolution.

the class ConnectionManager method updateConnections.

/**
     * Update connection state.
     * <p/>
     * Start connections in waiting states and stop invalidated connections.
     *
     * @param userRequest
     */
public void updateConnections(boolean userRequest) {
    LogManager.i(this, "updateConnections");
    AccountManager accountManager = AccountManager.getInstance();
    for (String account : accountManager.getAccounts()) {
        final ConnectionItem connectionItem = accountManager.getAccount(account);
        if (connectionItem.updateConnection(userRequest)) {
            AccountManager.getInstance().onAccountChanged(account);
        }
    }
}
Also used : AccountManager(com.xabber.android.data.account.AccountManager)

Example 8 with AccountManager

use of com.xabber.android.data.account.AccountManager in project xabber-android by redsolution.

the class ConnectionManager method forceReconnect.

/**
     * Disconnect and connect using new network.
     */
public void forceReconnect() {
    LogManager.i(this, "forceReconnect");
    AccountManager accountManager = AccountManager.getInstance();
    for (String account : accountManager.getAccounts()) {
        accountManager.getAccount(account).forceReconnect();
        AccountManager.getInstance().onAccountChanged(account);
    }
}
Also used : AccountManager(com.xabber.android.data.account.AccountManager)

Aggregations

AccountManager (com.xabber.android.data.account.AccountManager)8 AccountItem (com.xabber.android.data.account.AccountItem)4 AccountJid (com.xabber.android.data.entity.AccountJid)4 View (android.view.View)3 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 ColorDrawable (android.graphics.drawable.ColorDrawable)2 ConnectionState (com.xabber.android.data.connection.ConnectionState)2 AbstractXMPPConnection (org.jivesoftware.smack.AbstractXMPPConnection)2 SwitchCompat (android.support.v7.widget.SwitchCompat)1 CompoundButton (android.widget.CompoundButton)1 ConnectionThread (com.xabber.android.data.connection.ConnectionThread)1 UserJid (com.xabber.android.data.entity.UserJid)1 XabberAccountManager (com.xabber.android.data.xaccount.XabberAccountManager)1 SmackException (org.jivesoftware.smack.SmackException)1