本文整理汇总了Java中org.telegram.messenger.NotificationCenter类的典型用法代码示例。如果您正苦于以下问题:Java NotificationCenter类的具体用法?Java NotificationCenter怎么用?Java NotificationCenter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NotificationCenter类属于org.telegram.messenger包,在下文中一共展示了NotificationCenter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeInline
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
public static void removeInline(final int uid) {
TLRPC.TL_topPeerCategoryPeers category = null;
for (int a = 0; a < inlineBots.size(); a++) {
if (inlineBots.get(a).peer.user_id == uid) {
inlineBots.remove(a);
TLRPC.TL_contacts_resetTopPeerRating req = new TLRPC.TL_contacts_resetTopPeerRating();
req.category = new TLRPC.TL_topPeerCategoryBotsInline();
req.peer = MessagesController.getInputPeer(uid);
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
}
});
deletePeer(uid, 1);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.reloadInlineHints);
return;
}
}
}
示例2: removePeer
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
public static void removePeer(final int uid) {
TLRPC.TL_topPeerCategoryPeers category = null;
for (int a = 0; a < hints.size(); a++) {
if (hints.get(a).peer.user_id == uid) {
hints.remove(a);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.reloadHints);
TLRPC.TL_contacts_resetTopPeerRating req = new TLRPC.TL_contacts_resetTopPeerRating();
req.category = new TLRPC.TL_topPeerCategoryCorrespondents();
req.peer = MessagesController.getInputPeer(uid);
deletePeer(uid, 0);
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
}
});
return;
}
}
}
示例3: cleanDraft
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
public static void cleanDraft(long did, boolean replyOnly) {
TLRPC.DraftMessage draftMessage = drafts.get(did);
if (draftMessage == null) {
return;
}
if (!replyOnly) {
drafts.remove(did);
draftMessages.remove(did);
preferences.edit().remove("" + did).remove("r_" + did).commit();
MessagesController.getInstance().sortDialogs(null);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
} else if (draftMessage.reply_to_msg_id != 0) {
draftMessage.reply_to_msg_id = 0;
draftMessage.flags &= ~1;
saveDraft(did, draftMessage.message, draftMessage.entities, null, draftMessage.no_webpage, true);
}
}
示例4: onFragmentCreate
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
@Override
public boolean onFragmentCreate() {
super.onFragmentCreate();
NotificationCenter.getInstance().addObserver(this, NotificationCenter.chatInfoDidLoaded);
MessagesController.getInstance().loadFullChat(chat_id, classGuid, true);
loading = true;
rowCount = 0;
linkRow = rowCount++;
linkInfoRow = rowCount++;
copyLinkRow = rowCount++;
revokeLinkRow = rowCount++;
shareLinkRow = rowCount++;
shadowRow = rowCount++;
return true;
}
示例5: saveDraftReplyMessage
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
private static void saveDraftReplyMessage(final long did, final TLRPC.Message message) {
if (message == null) {
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
TLRPC.DraftMessage draftMessage = drafts.get(did);
if (draftMessage != null && draftMessage.reply_to_msg_id == message.id) {
draftMessages.put(did, message);
SerializedData serializedData = new SerializedData(message.getObjectSize());
message.serializeToStream(serializedData);
preferences.edit().putString("r_" + did, Utilities.bytesToHex(serializedData.toByteArray())).commit();
NotificationCenter.getInstance().postNotificationName(NotificationCenter.newDraftReceived, did);
}
}
});
}
示例6: didReceivedNotification
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
@Override
public void didReceivedNotification(int id, Object... args) {
if (id == NotificationCenter.updateInterfaces) {
int mask = (Integer)args[0];
if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0) {
updateVisibleRows(mask);
}
} else if (id == NotificationCenter.blockedUsersDidLoaded) {
if (progressView != null) {
progressView.setVisibility(View.GONE);
}
if (listView != null && listView.getEmptyView() == null) {
listView.setEmptyView(emptyTextView);
}
if (listViewAdapter != null) {
listViewAdapter.notifyDataSetChanged();
}
}
}
示例7: onFinish
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
private void onFinish() {
if (finished) {
return;
}
finished = true;
if (lockRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(lockRunnable);
lockRunnable = null;
}
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.appDidLogout);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.mainUserInfoChanged);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.closeOtherAppActivities);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.didUpdatedConnectionState);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.needShowAlert);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.wasUnableToFindCurrentLocation);
}
示例8: processBitmap
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
private void processBitmap(Bitmap bitmap) {
if (bitmap == null) {
return;
}
smallPhoto = ImageLoader.scaleAndSaveImage(bitmap, 100, 100, 80, false);
bigPhoto = ImageLoader.scaleAndSaveImage(bitmap, 800, 800, 80, false, 320, 320);
bitmap.recycle();
if (bigPhoto != null && smallPhoto != null) {
if (returnOnly) {
if (delegate != null) {
delegate.didUploadedPhoto(null, smallPhoto, bigPhoto);
}
} else {
UserConfig.saveConfig(false);
uploadingAvatar = FileLoader.getInstance().getDirectory(FileLoader.MEDIA_DIR_CACHE) + "/" + bigPhoto.location.volume_id + "_" + bigPhoto.location.local_id + ".jpg";
NotificationCenter.getInstance().addObserver(AvatarUpdater.this, NotificationCenter.FileDidUpload);
NotificationCenter.getInstance().addObserver(AvatarUpdater.this, NotificationCenter.FileDidFailUpload);
FileLoader.getInstance().uploadFile(uploadingAvatar, false, true);
}
}
}
示例9: processLoadedMediaCount
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
private static void processLoadedMediaCount(final int count, final long uid, final int type, final int classGuid, final boolean fromCache) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
int lower_part = (int) uid;
if (fromCache && count == -1 && lower_part != 0) {
getMediaCount(uid, type, classGuid, false);
} else {
if (!fromCache) {
putMediaCountDatabase(uid, type, count);
}
NotificationCenter.getInstance().postNotificationName(NotificationCenter.mediaCountDidLoaded, uid, (fromCache && count == -1 ? 0 : count), fromCache, type);
}
}
});
}
示例10: markFaturedStickersByIdAsRead
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
public static void markFaturedStickersByIdAsRead(final long id) {
if (!unreadStickerSets.contains(id) || readingStickerSets.contains(id)) { //TODO
return;
}
readingStickerSets.add(id);
TLRPC.TL_messages_readFeaturedStickers req = new TLRPC.TL_messages_readFeaturedStickers();
req.id.add(id);
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override
public void run(TLObject response, TLRPC.TL_error error) {
}
});
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
unreadStickerSets.remove(id);
readingStickerSets.remove(id);
loadFeaturedHash = calcFeaturedStickersHash(featuredStickerSets);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.featuredStickersDidLoaded);
putFeaturedStickersToCache(featuredStickerSets, unreadStickerSets, loadFeaturedDate, loadFeaturedHash);
}
}, 1000);
}
示例11: onFragmentDestroy
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
@Override
public void onFragmentDestroy() {
super.onFragmentDestroy();
//Telegram to paint drawerAction icons (refresh drawerLayoutAdapter)
NotificationCenter.getInstance().postNotificationName(NotificationCenter.mainUserInfoChanged);
//
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.mediaCountDidLoaded);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.updateInterfaces);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.closeChats);
if (user_id != 0) {
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.contactsDidLoaded);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.encryptedChatCreated);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.encryptedChatUpdated);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.blockedUsersDidLoaded);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.botInfoDidLoaded);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.userInfoDidLoaded);
MessagesController.getInstance().cancelLoadFullUser(user_id);
if (currentEncryptedChat != null) {
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.didReceivedNewMessages);
}
} else if (chat_id != 0) {
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.chatInfoDidLoaded);
avatarUpdater.clear();
}
}
示例12: didReceivedNotification
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
@Override
public void didReceivedNotification(int id, Object... args) {
if (id == NotificationCenter.contactsDidLoaded) {
if (listViewAdapter != null) {
listViewAdapter.notifyDataSetChanged();
}
} else if (id == NotificationCenter.updateInterfaces) {
int mask = (Integer)args[0];
if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
updateVisibleRows(mask);
}
} else if (id == NotificationCenter.encryptedChatCreated) {
if (createSecretChat && creatingChat) {
TLRPC.EncryptedChat encryptedChat = (TLRPC.EncryptedChat)args[0];
Bundle args2 = new Bundle();
args2.putInt("enc_id", encryptedChat.id);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats);
presentFragment(new ChatActivity(args2), true);
}
} else if (id == NotificationCenter.closeChats) {
if (!creatingChat) {
removeSelfFromStack();
}
}
}
示例13: didReceivedNotification
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void didReceivedNotification(int id, Object... args) {
if (id == NotificationCenter.stickersDidLoaded) {
if ((Integer) args[0] == currentType) {
updateStickerTabs();
reloadStickersAdapter();
checkPanels();
}
} else if (id == NotificationCenter.recentDocumentsDidLoaded) {
boolean isGif = (Boolean) args[0];
if (!isGif && (Integer) args[1] == currentType) {
checkDocuments();
}
}
}
示例14: onFragmentDestroy
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
@Override
public void onFragmentDestroy() {
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioDidReset);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioPlayStateChanged);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioDidStarted);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioProgressDidChanged);
MediaController.getInstance().removeLoadingFileObserver(this);
super.onFragmentDestroy();
}
示例15: onFragmentDestroy
import org.telegram.messenger.NotificationCenter; //导入依赖的package包/类
@Override
public void onFragmentDestroy() {
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.albumsDidLoaded);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.recentImagesDidLoaded);
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.closeChats);
super.onFragmentDestroy();
}