Java Code Examples for org.telegram.messenger.MessagesController#isSupportUser()

The following examples show how to use org.telegram.messenger.MessagesController#isSupportUser() . 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: ShareDialogCell.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
    boolean result = super.drawChild(canvas, child, drawingTime);
    if (child == imageView) {
        if (user != null && !MessagesController.isSupportUser(user)) {
            long newTime = SystemClock.elapsedRealtime();
            long dt = newTime - lastUpdateTime;
            if (dt > 17) {
                dt = 17;
            }
            lastUpdateTime = newTime;

            boolean isOnline = !user.self && !user.bot && (user.status != null && user.status.expires > ConnectionsManager.getInstance(currentAccount).getCurrentTime() || MessagesController.getInstance(currentAccount).onlinePrivacy.containsKey(user.id));
            if (isOnline || onlineProgress != 0) {
                int top = imageView.getBottom() - AndroidUtilities.dp(6);
                int left = imageView.getRight() - AndroidUtilities.dp(10);
                Theme.dialogs_onlineCirclePaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhite));
                canvas.drawCircle(left, top, AndroidUtilities.dp(7) * onlineProgress, Theme.dialogs_onlineCirclePaint);
                Theme.dialogs_onlineCirclePaint.setColor(Theme.getColor(Theme.key_chats_onlineCircle));
                canvas.drawCircle(left, top, AndroidUtilities.dp(5) * onlineProgress, Theme.dialogs_onlineCirclePaint);
                if (isOnline) {
                    if (onlineProgress < 1.0f) {
                        onlineProgress += dt / 150.0f;
                        if (onlineProgress > 1.0f) {
                            onlineProgress = 1.0f;
                        }
                        imageView.invalidate();
                        invalidate();
                    }
                } else {
                    if (onlineProgress > 0.0f) {
                        onlineProgress -= dt / 150.0f;
                        if (onlineProgress < 0.0f) {
                            onlineProgress = 0.0f;
                        }
                        imageView.invalidate();
                        invalidate();
                    }
                }
            }
        }
    }
    return result;
}
 
Example 2
Source File: ShareDialogCell.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
    boolean result = super.drawChild(canvas, child, drawingTime);
    if (child == imageView) {
        if (user != null && !MessagesController.isSupportUser(user)) {
            long newTime = SystemClock.elapsedRealtime();
            long dt = newTime - lastUpdateTime;
            if (dt > 17) {
                dt = 17;
            }
            lastUpdateTime = newTime;

            boolean isOnline = !user.self && !user.bot && (user.status != null && user.status.expires > ConnectionsManager.getInstance(currentAccount).getCurrentTime() || MessagesController.getInstance(currentAccount).onlinePrivacy.containsKey(user.id));
            if (isOnline || onlineProgress != 0) {
                int top = imageView.getBottom() - AndroidUtilities.dp(6);
                int left = imageView.getRight() - AndroidUtilities.dp(10);
                Theme.dialogs_onlineCirclePaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhite));
                canvas.drawCircle(left, top, AndroidUtilities.dp(7) * onlineProgress, Theme.dialogs_onlineCirclePaint);
                Theme.dialogs_onlineCirclePaint.setColor(Theme.getColor(Theme.key_chats_onlineCircle));
                canvas.drawCircle(left, top, AndroidUtilities.dp(5) * onlineProgress, Theme.dialogs_onlineCirclePaint);
                if (isOnline) {
                    if (onlineProgress < 1.0f) {
                        onlineProgress += dt / 150.0f;
                        if (onlineProgress > 1.0f) {
                            onlineProgress = 1.0f;
                        }
                        imageView.invalidate();
                        invalidate();
                    }
                } else {
                    if (onlineProgress > 0.0f) {
                        onlineProgress -= dt / 150.0f;
                        if (onlineProgress < 0.0f) {
                            onlineProgress = 0.0f;
                        }
                        imageView.invalidate();
                        invalidate();
                    }
                }
            }
        }
    }
    return result;
}