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


Java LocaleController.formatString方法代码示例

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


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

示例1: getRootSubtitle

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
private String getRootSubtitle(String path) {
    try {
        StatFs stat = new StatFs(path);
        long total = (long)stat.getBlockCount() * (long)stat.getBlockSize();
        long free = (long)stat.getAvailableBlocks() * (long)stat.getBlockSize();
        if (total == 0) {
            return "";
        }
        return LocaleController.formatString("FreeOfTotal", R.string.FreeOfTotal, AndroidUtilities.formatFileSize(free), AndroidUtilities.formatFileSize(total));
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }
    return path;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:15,代码来源:DocumentSelectActivity.java

示例2: getRootSubtitle

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
private String getRootSubtitle(String path) {
    try {
    StatFs stat = new StatFs(path);
    long total = (long)stat.getBlockCount() * (long)stat.getBlockSize();
    long free = (long)stat.getAvailableBlocks() * (long)stat.getBlockSize();
    if (total == 0) {
        return "";
    }
    return LocaleController.formatString("FreeOfTotal", R.string.FreeOfTotal, AndroidUtilities.formatFileSize(free), AndroidUtilities.formatFileSize(total));
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }
    return path;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:15,代码来源:DocumentSelectActivity.java

示例3: formatRulesString

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
private String formatRulesString(boolean isGroup) {
    ArrayList<TLRPC.PrivacyRule> privacyRules = ContactsController.getInstance().getPrivacyRules(isGroup);
    if (privacyRules.size() == 0) {
        return LocaleController.getString("LastSeenNobody", R.string.LastSeenNobody);
    }
    int type = -1;
    int plus = 0;
    int minus = 0;
    for (int a = 0; a < privacyRules.size(); a++) {
        TLRPC.PrivacyRule rule = privacyRules.get(a);
        if (rule instanceof TLRPC.TL_privacyValueAllowUsers) {
            plus += rule.users.size();
        } else if (rule instanceof TLRPC.TL_privacyValueDisallowUsers) {
            minus += rule.users.size();
        } else if (rule instanceof TLRPC.TL_privacyValueAllowAll) {
            type = 0;
        } else if (rule instanceof TLRPC.TL_privacyValueDisallowAll) {
            type = 1;
        } else {
            type = 2;
        }
    }
    if (type == 0 || type == -1 && minus > 0) {
        if (minus == 0) {
            return LocaleController.getString("LastSeenEverybody", R.string.LastSeenEverybody);
        } else {
            return LocaleController.formatString("LastSeenEverybodyMinus", R.string.LastSeenEverybodyMinus, minus);
        }
    } else if (type == 2 || type == -1 && minus > 0 && plus > 0) {
        if (plus == 0 && minus == 0) {
            return LocaleController.getString("LastSeenContacts", R.string.LastSeenContacts);
        } else {
            if (plus != 0 && minus != 0) {
                return LocaleController.formatString("LastSeenContactsMinusPlus", R.string.LastSeenContactsMinusPlus, minus, plus);
            } else if (minus != 0) {
                return LocaleController.formatString("LastSeenContactsMinus", R.string.LastSeenContactsMinus, minus);
            } else {
                return LocaleController.formatString("LastSeenContactsPlus", R.string.LastSeenContactsPlus, plus);
            }
        }
    } else if (type == 1 || plus > 0) {
        if (plus == 0) {
            return LocaleController.getString("LastSeenNobody", R.string.LastSeenNobody);
        } else {
            return LocaleController.formatString("LastSeenNobodyPlus", R.string.LastSeenNobodyPlus, plus);
        }
    }
    return "unknown";
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:50,代码来源:PrivacySettingsActivity.java

示例4: createMuteAlert

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
public static Dialog createMuteAlert(Context context, final long dialog_id) {
    if (context == null) {
        return null;
    }

    BottomSheet.Builder builder = new BottomSheet.Builder(context);
    builder.setTitle(LocaleController.getString("Notifications", R.string.Notifications));
    CharSequence[] items = new CharSequence[]{
            LocaleController.formatString("MuteFor", R.string.MuteFor, LocaleController.formatPluralString("Hours", 1)),
            LocaleController.formatString("MuteFor", R.string.MuteFor, LocaleController.formatPluralString("Hours", 8)),
            LocaleController.formatString("MuteFor", R.string.MuteFor, LocaleController.formatPluralString("Days", 2)),
            LocaleController.getString("MuteDisable", R.string.MuteDisable)
    };
    builder.setItems(items, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    int untilTime = ConnectionsManager.getInstance().getCurrentTime();
                    if (i == 0) {
                        untilTime += 60 * 60;
                    } else if (i == 1) {
                        untilTime += 60 * 60 * 8;
                    } else if (i == 2) {
                        untilTime += 60 * 60 * 48;
                    } else if (i == 3) {
                        untilTime = Integer.MAX_VALUE;
                    }

                    SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
                    SharedPreferences.Editor editor = preferences.edit();
                    long flags;
                    if (i == 3) {
                        editor.putInt("notify2_" + dialog_id, 2);
                        flags = 1;
                    } else {
                        editor.putInt("notify2_" + dialog_id, 3);
                        editor.putInt("notifyuntil_" + dialog_id, untilTime);
                        flags = ((long) untilTime << 32) | 1;
                    }
                    NotificationsController.getInstance().removeNotificationsForDialog(dialog_id);
                    MessagesStorage.getInstance().setDialogFlags(dialog_id, flags);
                    editor.commit();
                    TLRPC.TL_dialog dialog = MessagesController.getInstance().dialogs_dict.get(dialog_id);
                    if (dialog != null) {
                        dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
                        dialog.notify_settings.mute_until = untilTime;
                    }
                    NotificationsController.updateServerNotificationsSettings(dialog_id);
                }
            }
    );
    return builder.create();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:53,代码来源:AlertsCreator.java

示例5: createMuteAlert

import org.telegram.messenger.LocaleController; //导入方法依赖的package包/类
public static Dialog createMuteAlert(Context context, final long dialog_id) {
    if (context == null) {
        return null;
    }

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(LocaleController.getString("Notifications", R.string.Notifications));
    CharSequence[] items = new CharSequence[]{
            LocaleController.formatString("MuteFor", R.string.MuteFor, LocaleController.formatPluralString("Hours", 1)),
            LocaleController.formatString("MuteFor", R.string.MuteFor, LocaleController.formatPluralString("Hours", 8)),
            LocaleController.formatString("MuteFor", R.string.MuteFor, LocaleController.formatPluralString("Days", 2)),
            LocaleController.getString("MuteDisable", R.string.MuteDisable)
    };
    builder.setItems(items, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    int untilTime = ConnectionsManager.getInstance().getCurrentTime();
                    if (i == 0) {
                        untilTime += 60 * 60;
                    } else if (i == 1) {
                        untilTime += 60 * 60 * 8;
                    } else if (i == 2) {
                        untilTime += 60 * 60 * 48;
                    } else if (i == 3) {
                        untilTime = Integer.MAX_VALUE;
                    }

                    SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
                    SharedPreferences.Editor editor = preferences.edit();
                    long flags;
                    if (i == 3) {
                        editor.putInt("notify2_" + dialog_id, 2);
                        flags = 1;
                    } else {
                        editor.putInt("notify2_" + dialog_id, 3);
                        editor.putInt("notifyuntil_" + dialog_id, untilTime);
                        flags = ((long) untilTime << 32) | 1;
                    }
                    NotificationsController.getInstance().removeNotificationsForDialog(dialog_id);
                    MessagesStorage.getInstance().setDialogFlags(dialog_id, flags);
                    editor.commit();
                    TLRPC.TL_dialog dialog = MessagesController.getInstance().dialogs_dict.get(dialog_id);
                    if (dialog != null) {
                        dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
                        dialog.notify_settings.mute_until = untilTime;
                    }
                    NotificationsController.updateServerNotificationsSettings(dialog_id);
                }
            }
    );
    return builder.create();
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:53,代码来源:AlertsCreator.java


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