Java Code Examples for org.telegram.tgnet.ConnectionsManager#ConnectionStateUpdating

The following examples show how to use org.telegram.tgnet.ConnectionsManager#ConnectionStateUpdating . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialogsActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void updateProxyButton(boolean animated)
{
    if (proxyDrawable == null)
        return;

    if (MessagesController.getInstance(currentAccount).blockedCountry)
    {
        if (!actionBar.isSearchFieldVisible())
            proxyItem.setVisibility(View.VISIBLE);

        boolean value = currentConnectionState == ConnectionsManager.ConnectionStateConnected ||
                currentConnectionState == ConnectionsManager.ConnectionStateUpdating;
        proxyDrawable.setConnected(true, value, animated);
        proxyItemVisisble = true;
    }
    else
    {
        proxyItem.setVisibility(View.GONE);
        proxyItemVisisble = false;
    }
}
 
Example 2
Source File: ChatAvatarContainer.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void updateCurrentConnectionState() {
    String title = null;
    if (currentConnectionState == ConnectionsManager.ConnectionStateWaitingForNetwork) {
        title = LocaleController.getString("WaitingForNetwork", R.string.WaitingForNetwork);
    } else if (currentConnectionState == ConnectionsManager.ConnectionStateConnecting) {
        title = LocaleController.getString("Connecting", R.string.Connecting);
    } else if (currentConnectionState == ConnectionsManager.ConnectionStateUpdating) {
        title = LocaleController.getString("Updating", R.string.Updating);
    } else if (currentConnectionState == ConnectionsManager.ConnectionStateConnectingToProxy) {
        title = LocaleController.getString("ConnectingToProxy", R.string.ConnectingToProxy);
    }
    if (title == null) {
        if (lastSubtitle != null) {
            subtitleTextView.setText(lastSubtitle);
            lastSubtitle = null;
        }
    } else {
        lastSubtitle = subtitleTextView.getText();
        subtitleTextView.setText(title);
    }
}
 
Example 3
Source File: DialogsActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void updateProxyButton(boolean animated)
{
    if (proxyDrawable == null)
        return;

    if (MessagesController.getInstance(currentAccount).blockedCountry)
    {
        if (!actionBar.isSearchFieldVisible())
            proxyItem.setVisibility(View.VISIBLE);

        boolean value = currentConnectionState == ConnectionsManager.ConnectionStateConnected ||
                currentConnectionState == ConnectionsManager.ConnectionStateUpdating;
        proxyDrawable.setConnected(true, value, animated);
        proxyItemVisisble = true;
    }
    else
    {
        proxyItem.setVisibility(View.GONE);
        proxyItemVisisble = false;
    }
}
 
Example 4
Source File: ChatAvatarContainer.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void updateCurrentConnectionState() {
    String title = null;
    if (currentConnectionState == ConnectionsManager.ConnectionStateWaitingForNetwork) {
        title = LocaleController.getString("WaitingForNetwork", R.string.WaitingForNetwork);
    } else if (currentConnectionState == ConnectionsManager.ConnectionStateConnecting) {
        title = LocaleController.getString("Connecting", R.string.Connecting);
    } else if (currentConnectionState == ConnectionsManager.ConnectionStateUpdating) {
        title = LocaleController.getString("Updating", R.string.Updating);
    } else if (currentConnectionState == ConnectionsManager.ConnectionStateConnectingToProxy) {
        title = LocaleController.getString("ConnectingToProxy", R.string.ConnectingToProxy);
    }
    if (title == null) {
        if (lastSubtitle != null) {
            subtitleTextView.setText(lastSubtitle);
            lastSubtitle = null;
        }
    } else {
        lastSubtitle = subtitleTextView.getText();
        subtitleTextView.setText(title);
    }
}
 
Example 5
Source File: ProxyListActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public void updateStatus() {
    String colorKey;
    if (SharedConfig.currentProxy == currentInfo && useProxySettings) {
        if (currentConnectionState == ConnectionsManager.ConnectionStateConnected || currentConnectionState == ConnectionsManager.ConnectionStateUpdating) {
            colorKey = Theme.key_windowBackgroundWhiteBlueText6;
            if (currentInfo.ping != 0) {
                valueTextView.setText(LocaleController.getString("Connected", R.string.Connected) + ", " + LocaleController.formatString("Ping", R.string.Ping, currentInfo.ping));
            } else {
                valueTextView.setText(LocaleController.getString("Connected", R.string.Connected));
            }
            if (!currentInfo.checking && !currentInfo.available) {
                currentInfo.availableCheckTime = 0;
            }
        } else {
            colorKey = Theme.key_windowBackgroundWhiteGrayText2;
            valueTextView.setText(LocaleController.getString("Connecting", R.string.Connecting));
        }
    } else {
        if (currentInfo.checking) {
            valueTextView.setText(LocaleController.getString("Checking", R.string.Checking));
            colorKey = Theme.key_windowBackgroundWhiteGrayText2;
        } else if (currentInfo.available) {
            if (currentInfo.ping != 0) {
                valueTextView.setText(LocaleController.getString("Available", R.string.Available) + ", " + LocaleController.formatString("Ping", R.string.Ping, currentInfo.ping));
            } else {
                valueTextView.setText(LocaleController.getString("Available", R.string.Available));
            }
            colorKey = Theme.key_windowBackgroundWhiteGreenText;
        } else {
            valueTextView.setText(LocaleController.getString("Unavailable", R.string.Unavailable));
            colorKey = Theme.key_windowBackgroundWhiteRedText4;
        }
    }
    color = Theme.getColor(colorKey);
    valueTextView.setTag(colorKey);
    valueTextView.setTextColor(color);
    if (checkDrawable != null) {
        checkDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
    }
}
 
Example 6
Source File: ChatAvatarContainer.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void updateCurrentConnectionState() {
    String title = null;
    if (currentConnectionState == ConnectionsManager.ConnectionStateWaitingForNetwork) {
        title = LocaleController.getString("WaitingForNetwork", R.string.WaitingForNetwork);
    } else if (currentConnectionState == ConnectionsManager.ConnectionStateConnecting) {
        title = LocaleController.getString("Connecting", R.string.Connecting);
    } else if (currentConnectionState == ConnectionsManager.ConnectionStateUpdating) {
        title = LocaleController.getString("Updating", R.string.Updating);
    } else if (currentConnectionState == ConnectionsManager.ConnectionStateConnectingToProxy) {
        title = LocaleController.getString("ConnectingToProxy", R.string.ConnectingToProxy);
    }
    if (title == null) {
        if (lastSubtitle != null) {
            subtitleTextView.setText(lastSubtitle);
            lastSubtitle = null;
            if (lastSubtitleColorKey != null) {
                subtitleTextView.setTextColor(Theme.getColor(lastSubtitleColorKey));
                subtitleTextView.setTag(lastSubtitleColorKey);
            }
        }
    } else {
        if (lastSubtitle == null) {
            lastSubtitle = subtitleTextView.getText();
        }
        subtitleTextView.setText(title);
        subtitleTextView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubtitle));
        subtitleTextView.setTag(Theme.key_actionBarDefaultSubtitle);
    }
}
 
Example 7
Source File: ProxyListActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public void updateStatus() {
    String colorKey;
    if (SharedConfig.currentProxy == currentInfo && useProxySettings) {
        if (currentConnectionState == ConnectionsManager.ConnectionStateConnected || currentConnectionState == ConnectionsManager.ConnectionStateUpdating) {
            colorKey = Theme.key_windowBackgroundWhiteBlueText6;
            if (currentInfo.ping != 0) {
                valueTextView.setText(LocaleController.getString("Connected", R.string.Connected) + ", " + LocaleController.formatString("Ping", R.string.Ping, currentInfo.ping));
            } else {
                valueTextView.setText(LocaleController.getString("Connected", R.string.Connected));
            }
            if (!currentInfo.checking && !currentInfo.available) {
                currentInfo.availableCheckTime = 0;
            }
        } else {
            colorKey = Theme.key_windowBackgroundWhiteGrayText2;
            valueTextView.setText(LocaleController.getString("Connecting", R.string.Connecting));
        }
    } else {
        if (currentInfo.checking) {
            valueTextView.setText(LocaleController.getString("Checking", R.string.Checking));
            colorKey = Theme.key_windowBackgroundWhiteGrayText2;
        } else if (currentInfo.available) {
            if (currentInfo.ping != 0) {
                valueTextView.setText(LocaleController.getString("Available", R.string.Available) + ", " + LocaleController.formatString("Ping", R.string.Ping, currentInfo.ping));
            } else {
                valueTextView.setText(LocaleController.getString("Available", R.string.Available));
            }
            colorKey = Theme.key_windowBackgroundWhiteGreenText;
        } else {
            valueTextView.setText(LocaleController.getString("Unavailable", R.string.Unavailable));
            colorKey = Theme.key_windowBackgroundWhiteRedText4;
        }
    }
    color = Theme.getColor(colorKey);
    valueTextView.setTag(colorKey);
    valueTextView.setTextColor(color);
    if (checkDrawable != null) {
        checkDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
    }
}
 
Example 8
Source File: ChatAvatarContainer.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void updateCurrentConnectionState() {
    String title = null;
    if (currentConnectionState == ConnectionsManager.ConnectionStateWaitingForNetwork) {
        title = LocaleController.getString("WaitingForNetwork", R.string.WaitingForNetwork);
    } else if (currentConnectionState == ConnectionsManager.ConnectionStateConnecting) {
        title = LocaleController.getString("Connecting", R.string.Connecting);
    } else if (currentConnectionState == ConnectionsManager.ConnectionStateUpdating) {
        title = LocaleController.getString("Updating", R.string.Updating);
    } else if (currentConnectionState == ConnectionsManager.ConnectionStateConnectingToProxy) {
        title = LocaleController.getString("ConnectingToProxy", R.string.ConnectingToProxy);
    }
    if (title == null) {
        if (lastSubtitle != null) {
            subtitleTextView.setText(lastSubtitle);
            lastSubtitle = null;
            if (lastSubtitleColorKey != null) {
                subtitleTextView.setTextColor(Theme.getColor(lastSubtitleColorKey));
                subtitleTextView.setTag(lastSubtitleColorKey);
            }
        }
    } else {
        if (lastSubtitle == null) {
            lastSubtitle = subtitleTextView.getText();
        }
        subtitleTextView.setText(title);
        subtitleTextView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubtitle));
        subtitleTextView.setTag(Theme.key_actionBarDefaultSubtitle);
    }
}
 
Example 9
Source File: ProxyListActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public void updateStatus()
{
    String colorKey;
    if (SharedConfig.currentProxy == currentInfo && useProxySettings)
    {
        if (currentConnectionState == ConnectionsManager.ConnectionStateConnected || currentConnectionState == ConnectionsManager.ConnectionStateUpdating)
        {
            colorKey = Theme.key_windowBackgroundWhiteBlueText6;
            if (currentInfo.ping != 0)
            {
                valueTextView.setText(LocaleController.getString("Connected", R.string.Connected) + ", " + LocaleController.formatString("Ping", R.string.Ping, currentInfo.ping));
            }
            else
            {
                valueTextView.setText(LocaleController.getString("Connected", R.string.Connected));
            }
            if (!currentInfo.checking && !currentInfo.available)
            {
                currentInfo.availableCheckTime = 0;
            }
        }
        else
        {
            colorKey = Theme.key_windowBackgroundWhiteGrayText2;
            valueTextView.setText(LocaleController.getString("Connecting", R.string.Connecting));
        }
    }
    else
    {
        if (currentInfo.checking)
        {
            valueTextView.setText(LocaleController.getString("Checking", R.string.Checking));
            colorKey = Theme.key_windowBackgroundWhiteGrayText2;
        }
        else if (currentInfo.available)
        {
            if (currentInfo.ping != 0)
            {
                valueTextView.setText(LocaleController.getString("Available", R.string.Available) + ", " + LocaleController.formatString("Ping", R.string.Ping, currentInfo.ping));
            }
            else
            {
                valueTextView.setText(LocaleController.getString("Available", R.string.Available));
            }
            colorKey = Theme.key_windowBackgroundWhiteGreenText;
        }
        else
        {
            valueTextView.setText(LocaleController.getString("Unavailable", R.string.Unavailable));
            colorKey = Theme.key_windowBackgroundWhiteRedText4;
        }
    }
    color = Theme.getColor(colorKey);
    valueTextView.setTag(colorKey);
    valueTextView.setTextColor(color);
    if (checkDrawable != null)
    {
        checkDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
    }
}
 
Example 10
Source File: ProxyListActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public void updateStatus()
{
    String colorKey;
    if (SharedConfig.currentProxy == currentInfo && useProxySettings)
    {
        if (currentConnectionState == ConnectionsManager.ConnectionStateConnected || currentConnectionState == ConnectionsManager.ConnectionStateUpdating)
        {
            colorKey = Theme.key_windowBackgroundWhiteBlueText6;
            if (currentInfo.ping != 0)
            {
                valueTextView.setText(LocaleController.getString("Connected", R.string.Connected) + ", " + LocaleController.formatString("Ping", R.string.Ping, currentInfo.ping));
            }
            else
            {
                valueTextView.setText(LocaleController.getString("Connected", R.string.Connected));
            }
            if (!currentInfo.checking && !currentInfo.available)
            {
                currentInfo.availableCheckTime = 0;
            }
        }
        else
        {
            colorKey = Theme.key_windowBackgroundWhiteGrayText2;
            valueTextView.setText(LocaleController.getString("Connecting", R.string.Connecting));
        }
    }
    else
    {
        if (currentInfo.checking)
        {
            valueTextView.setText(LocaleController.getString("Checking", R.string.Checking));
            colorKey = Theme.key_windowBackgroundWhiteGrayText2;
        }
        else if (currentInfo.available)
        {
            if (currentInfo.ping != 0)
            {
                valueTextView.setText(LocaleController.getString("Available", R.string.Available) + ", " + LocaleController.formatString("Ping", R.string.Ping, currentInfo.ping));
            }
            else
            {
                valueTextView.setText(LocaleController.getString("Available", R.string.Available));
            }
            colorKey = Theme.key_windowBackgroundWhiteGreenText;
        }
        else
        {
            valueTextView.setText(LocaleController.getString("Unavailable", R.string.Unavailable));
            colorKey = Theme.key_windowBackgroundWhiteRedText4;
        }
    }
    color = Theme.getColor(colorKey);
    valueTextView.setTag(colorKey);
    valueTextView.setTextColor(color);
    if (checkDrawable != null)
    {
        checkDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
    }
}