当前位置: 首页>>代码示例>>Java>>正文


Java LocaleController.formatUserStatus方法代码示例

本文整理汇总了Java中org.telegram.messenger.LocaleController.formatUserStatus方法的典型用法代码示例。如果您正苦于以下问题:Java LocaleController.formatUserStatus方法的具体用法?Java LocaleController.formatUserStatus怎么用?Java LocaleController.formatUserStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.telegram.messenger.LocaleController的用法示例。


在下文中一共展示了LocaleController.formatUserStatus方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setStatusColor

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
private void setStatusColor() {
    String s = LocaleController.formatUserStatus(user);
    if (s.equals(LocaleController.getString("ALongTimeAgo", R.string.ALongTimeAgo))) {
        statusBG.setColor(Color.BLACK);
    } else if (s.equals(LocaleController.getString("Online", R.string.Online))) {
        statusBG.setColor(0xff00e676);
    } else if (s.equals(LocaleController.getString("Lately", R.string.Lately))) {
        statusBG.setColor(Color.LTGRAY);
    } else {
        statusBG.setColor(Color.GRAY);
    }
    int l = user.status != null ? ConnectionsManager.getInstance().getCurrentTime() - user.status.expires : -2;
    if (l > 0 && l < 86400) {
        statusBG.setColor(Color.LTGRAY);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:17,代码来源:CustomDialogCell.java

示例2: setStatusColor

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
private void setStatusColor() {
    String s = LocaleController.formatUserStatus(user);
    if (s.equals(LocaleController.getString("ALongTimeAgo", R.string.ALongTimeAgo))) {
        statusBG.setColor(Color.BLACK);
    } else if (s.equals(LocaleController.getString("Online", R.string.Online))) {
        //Telegram
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
        boolean mode = sharedPreferences.getBoolean("ghost_mode", false);

        if (currentDialogId != 0 && UserConfig.isClientActivated() && currentDialogId == UserConfig.getCurrentUser().id && mode) {
            statusBG.setColor(Color.LTGRAY);
        } else {
            statusBG.setColor(0xff00e676);
        }
    } else if (s.equals(LocaleController.getString("Lately", R.string.Lately))) {
        statusBG.setColor(Color.LTGRAY);
    } else {
        statusBG.setColor(Color.GRAY);
    }
    int l = user.status != null ? ConnectionsManager.getInstance().getCurrentTime() - user.status.expires : -2;
    if (l > 0 && l < 86400) {
        statusBG.setColor(Color.LTGRAY);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:25,代码来源:DialogCell.java

示例3: setStatusColor

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
private void setStatusColor(TLRPC.User user){
    String s = user != null ? LocaleController.formatUserStatus(user): "";
    if (s.equals(LocaleController.getString("ALongTimeAgo", R.string.ALongTimeAgo))){
        statusBG.setColor(Color.BLACK);
    } else if(s.equals(LocaleController.getString("Online", R.string.Online))){
        statusBG.setColor(0xff00e676);
    } else if(s.equals(LocaleController.getString("Lately", R.string.Lately))){
        statusBG.setColor(Color.LTGRAY);
    } else {
        statusBG.setColor(Color.GRAY);
    }
    int l = user != null && user.status != null ? ConnectionsManager.getInstance().getCurrentTime() - user.status.expires : -2;
    if(l > 0 && l < 86400){
        statusBG.setColor(Color.LTGRAY);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:17,代码来源:ChatBaseCell.java

示例4: updateSubtitle

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
public void updateSubtitle() {
    TLRPC.User user = parentFragment.getCurrentUser();
    TLRPC.Chat chat = parentFragment.getCurrentChat();
    CharSequence printString = MessagesController.getInstance().printingStrings.get(parentFragment.getDialogId());
    if (printString != null) {
        printString = TextUtils.replace(printString, new String[]{"..."}, new String[]{""});
    }
    if (printString == null || printString.length() == 0 || ChatObject.isChannel(chat) && !chat.megagroup) {
        setTypingAnimation(false);
        if (chat != null) {
            TLRPC.ChatFull info = parentFragment.getCurrentChatInfo();
            if (ChatObject.isChannel(chat)) {
                if (info != null && info.participants_count != 0) {
                    if (chat.megagroup && info.participants_count <= 200) {
                        if (onlineCount > 1 && info.participants_count != 0) {
                            subtitleTextView.setText(String.format("%s, %s", LocaleController.formatPluralString("Members", info.participants_count), LocaleController.formatPluralString("Online", onlineCount)));
                        } else {
                            subtitleTextView.setText(LocaleController.formatPluralString("Members", info.participants_count));
                        }
                    } else {
                        int result[] = new int[1];
                        String shortNumber = LocaleController.formatShortNumber(info.participants_count, result);
                        String text = LocaleController.formatPluralString("Members", result[0]).replace(String.format("%d", result[0]), shortNumber);
                        subtitleTextView.setText(text);
                    }
                } else {
                    if (chat.megagroup) {
                        subtitleTextView.setText(LocaleController.getString("Loading", R.string.Loading).toLowerCase());
                    } else {
                        if ((chat.flags & TLRPC.CHAT_FLAG_IS_PUBLIC) != 0) {
                            subtitleTextView.setText(LocaleController.getString("ChannelPublic", R.string.ChannelPublic).toLowerCase());
                        } else {
                            subtitleTextView.setText(LocaleController.getString("ChannelPrivate", R.string.ChannelPrivate).toLowerCase());
                        }
                    }
                }
            } else {
                if (ChatObject.isKickedFromChat(chat)) {
                    subtitleTextView.setText(LocaleController.getString("YouWereKicked", R.string.YouWereKicked));
                } else if (ChatObject.isLeftFromChat(chat)) {
                    subtitleTextView.setText(LocaleController.getString("YouLeft", R.string.YouLeft));
                } else {
                    int count = chat.participants_count;
                    if (info != null && info.participants != null) {
                        count = info.participants.participants.size();
                    }
                    if (onlineCount > 1 && count != 0) {
                        subtitleTextView.setText(String.format("%s, %s", LocaleController.formatPluralString("Members", count), LocaleController.formatPluralString("Online", onlineCount)));
                    } else {
                        subtitleTextView.setText(LocaleController.formatPluralString("Members", count));
                    }
                }
            }
        } else if (user != null) {
            user = MessagesController.getInstance().getUser(user.id);
            String newStatus;
            if (user.id == 333000 || user.id == 777000) {
                newStatus = LocaleController.getString("ServiceNotifications", R.string.ServiceNotifications);
            } else if (user.bot) {
                newStatus = LocaleController.getString("Bot", R.string.Bot);
            } else {
                newStatus = LocaleController.formatUserStatus(user);
            }
            subtitleTextView.setText(newStatus);
        }
    } else {
        subtitleTextView.setText(printString);
        setTypingAnimation(true);
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:71,代码来源:ChatAvatarContainer.java

示例5: updateSubtitle

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
public void updateSubtitle() {
    TLRPC.User user = parentFragment.getCurrentUser();
    TLRPC.Chat chat = parentFragment.getCurrentChat();
    CharSequence printString = MessagesController.getInstance().printingStrings.get(parentFragment.getDialogId());
    if (printString != null) {
        printString = TextUtils.replace(printString, new String[]{"..."}, new String[]{""});
    }
    if (printString == null || printString.length() == 0 || ChatObject.isChannel(chat) && !chat.megagroup) {
        setTypingAnimation(false);
        if (chat != null) {
            TLRPC.ChatFull info = parentFragment.getCurrentChatInfo();
            if (ChatObject.isChannel(chat)) {
                if (!chat.broadcast && !chat.megagroup && !(chat instanceof TLRPC.TL_channelForbidden)) {
                    subtitleTextView.setText(LocaleController.getString("ShowDiscussion", R.string.ShowDiscussion));
                    if (radioButton != null && radioButton.getVisibility() != VISIBLE) {
                        radioButton.setVisibility(View.VISIBLE);
                    }
                } else {
                    if (info != null && info.participants_count != 0) {
                        if (chat.megagroup && info.participants_count <= 200) {
                            if (onlineCount > 1 && info.participants_count != 0) {
                                subtitleTextView.setText(String.format("%s, %s", LocaleController.formatPluralString("Members", info.participants_count), LocaleController.formatPluralString("Online", onlineCount)));
                            } else {
                                subtitleTextView.setText(LocaleController.formatPluralString("Members", info.participants_count));
                            }
                        } else {
                            int result[] = new int[1];
                            String shortNumber = LocaleController.formatShortNumber(info.participants_count, result);
                            String text = LocaleController.formatPluralString("Members", result[0]).replace(String.format("%d", result[0]), shortNumber);
                            subtitleTextView.setText(text);
                        }
                    } else {
                        if (chat.megagroup) {
                            subtitleTextView.setText(LocaleController.getString("Loading", R.string.Loading).toLowerCase());
                        } else {
                            if ((chat.flags & TLRPC.CHAT_FLAG_IS_PUBLIC) != 0) {
                                subtitleTextView.setText(LocaleController.getString("ChannelPublic", R.string.ChannelPublic).toLowerCase());
                            } else {
                                subtitleTextView.setText(LocaleController.getString("ChannelPrivate", R.string.ChannelPrivate).toLowerCase());
                            }
                        }
                    }
                    if (radioButton != null && radioButton.getVisibility() != GONE) {
                        radioButton.setVisibility(View.GONE);
                    }
                }
            } else {
                if (ChatObject.isKickedFromChat(chat)) {
                    subtitleTextView.setText(LocaleController.getString("YouWereKicked", R.string.YouWereKicked));
                } else if (ChatObject.isLeftFromChat(chat)) {
                    subtitleTextView.setText(LocaleController.getString("YouLeft", R.string.YouLeft));
                } else {
                    int count = chat.participants_count;
                    if (info != null) {
                        count = info.participants.participants.size();
                    }
                    if (onlineCount > 1 && count != 0) {
                        subtitleTextView.setText(String.format("%s, %s", LocaleController.formatPluralString("Members", count), LocaleController.formatPluralString("Online", onlineCount)));
                    } else {
                        subtitleTextView.setText(LocaleController.formatPluralString("Members", count));
                    }
                }
            }
        } else if (user != null) {
            user = MessagesController.getInstance().getUser(user.id);
            String newStatus;
            if (user.id == 333000 || user.id == 777000) {
                newStatus = LocaleController.getString("ServiceNotifications", R.string.ServiceNotifications);
            } else if (user.bot) {
                newStatus = LocaleController.getString("Bot", R.string.Bot);
            } else {
                newStatus = LocaleController.formatUserStatus(user);
            }
            subtitleTextView.setText(newStatus);
        }
    } else {
        subtitleTextView.setText(printString);
        setTypingAnimation(true);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:81,代码来源:ChatAvatarContainer.java


注:本文中的org.telegram.messenger.LocaleController.formatUserStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。