本文整理汇总了Java中org.telegram.tgnet.TLRPC.PeerNotifySettings方法的典型用法代码示例。如果您正苦于以下问题:Java TLRPC.PeerNotifySettings方法的具体用法?Java TLRPC.PeerNotifySettings怎么用?Java TLRPC.PeerNotifySettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.tgnet.TLRPC
的用法示例。
在下文中一共展示了TLRPC.PeerNotifySettings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyDialogNotificationsSettings
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private void applyDialogNotificationsSettings(long dialog_id, TLRPC.PeerNotifySettings notify_settings) {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
int currentValue = preferences.getInt("notify2_" + dialog_id, 0);
int currentValue2 = preferences.getInt("notifyuntil_" + dialog_id, 0);
SharedPreferences.Editor editor = preferences.edit();
boolean updated = false;
TLRPC.TL_dialog dialog = dialogs_dict.get(dialog_id);
if (dialog != null) {
dialog.notify_settings = notify_settings;
}
editor.putBoolean("silent_" + dialog_id, notify_settings.silent);
if (notify_settings.mute_until > ConnectionsManager.getInstance().getCurrentTime()) {
int until = 0;
if (notify_settings.mute_until > ConnectionsManager.getInstance().getCurrentTime() + 60 * 60 * 24 * 365) {
if (currentValue != 2) {
updated = true;
editor.putInt("notify2_" + dialog_id, 2);
if (dialog != null) {
dialog.notify_settings.mute_until = Integer.MAX_VALUE;
}
}
} else {
if (currentValue != 3 || currentValue2 != notify_settings.mute_until) {
updated = true;
until = notify_settings.mute_until;
editor.putInt("notify2_" + dialog_id, 3);
editor.putInt("notifyuntil_" + dialog_id, notify_settings.mute_until);
if (dialog != null) {
dialog.notify_settings.mute_until = until;
}
}
}
MessagesStorage.getInstance().setDialogFlags(dialog_id, ((long) until << 32) | 1);
NotificationsController.getInstance().removeNotificationsForDialog(dialog_id);
} else {
if (currentValue != 0 && currentValue != 1) {
updated = true;
if (dialog != null) {
dialog.notify_settings.mute_until = 0;
}
editor.remove("notify2_" + dialog_id);
}
MessagesStorage.getInstance().setDialogFlags(dialog_id, 0);
}
editor.commit();
if (updated) {
NotificationCenter.getInstance().postNotificationName(NotificationCenter.notificationsSettingsUpdated);
}
}
示例2: isNotifySettingsMuted
import org.telegram.tgnet.TLRPC; //导入方法依赖的package包/类
private boolean isNotifySettingsMuted(TLRPC.PeerNotifySettings settings) {
return settings instanceof TLRPC.TL_peerNotifySettings && settings.mute_until > ConnectionsManager.getInstance().getCurrentTime();
}