From f909ce7477a23c474e8bfe3df89a17897c65df6f Mon Sep 17 00:00:00 2001 From: tatanka987 Date: Thu, 27 Oct 2016 12:07:04 +0300 Subject: [PATCH] - prepare for release; --- build.gradle | 2 +- .../sample/chat/managers/DialogsManager.java | 39 ++++++------------- .../chat/ui/adapter/DialogsAdapter.java | 8 ++-- .../sample/chat/utils/chat/ChatHelper.java | 12 +----- 4 files changed, 17 insertions(+), 44 deletions(-) diff --git a/build.gradle b/build.gradle index 1ce7ac317..ac14fbebe 100644 --- a/build.gradle +++ b/build.gradle @@ -32,7 +32,7 @@ ext { lintAbortOnError = false // QuickBlox SDK version - qbSdkVersion = '3.0' + qbSdkVersion = '3.1.0' versionName = "3.0" diff --git a/sample-chat/src/main/java/com/quickblox/sample/chat/managers/DialogsManager.java b/sample-chat/src/main/java/com/quickblox/sample/chat/managers/DialogsManager.java index 819cf0f63..b9dcf7621 100644 --- a/sample-chat/src/main/java/com/quickblox/sample/chat/managers/DialogsManager.java +++ b/sample-chat/src/main/java/com/quickblox/sample/chat/managers/DialogsManager.java @@ -105,37 +105,22 @@ public void onSystemMessageReceived(QBChatMessage systemMessage){ } } - private void notifyListenersDialogCreated(final QBChatDialog chatDialog){ - new Handler(Looper.getMainLooper()).post(new Runnable() { - @Override - public void run() { - for (ManagingDialogsCallbacks listener : getManagingDialogsCallbackListeners()){ - listener.onDialogCreated(chatDialog); - } - } - }); + private void notifyListenersDialogCreated(final QBChatDialog chatDialog) { + for (ManagingDialogsCallbacks listener : getManagingDialogsCallbackListeners()) { + listener.onDialogCreated(chatDialog); + } } - private void notifyListenersDialogUpdated(final String dialogId){ - new Handler(Looper.getMainLooper()).post(new Runnable() { - @Override - public void run() { - for (ManagingDialogsCallbacks listener : getManagingDialogsCallbackListeners()){ - listener.onDialogUpdated(dialogId); - } - } - }); + private void notifyListenersDialogUpdated(final String dialogId) { + for (ManagingDialogsCallbacks listener : getManagingDialogsCallbackListeners()) { + listener.onDialogUpdated(dialogId); + } } - private void notifyListenersNewDialogLoaded(final QBChatDialog chatDialog){ - new Handler(Looper.getMainLooper()).post(new Runnable() { - @Override - public void run() { - for (ManagingDialogsCallbacks listener : getManagingDialogsCallbackListeners()){ - listener.onNewDialogLoaded(chatDialog); - } - } - }); + private void notifyListenersNewDialogLoaded(final QBChatDialog chatDialog) { + for (ManagingDialogsCallbacks listener : getManagingDialogsCallbackListeners()) { + listener.onNewDialogLoaded(chatDialog); + } } public void addManagingDialogsCallbackListener(ManagingDialogsCallbacks listener){ diff --git a/sample-chat/src/main/java/com/quickblox/sample/chat/ui/adapter/DialogsAdapter.java b/sample-chat/src/main/java/com/quickblox/sample/chat/ui/adapter/DialogsAdapter.java index 96082c5a1..d479df3ea 100644 --- a/sample-chat/src/main/java/com/quickblox/sample/chat/ui/adapter/DialogsAdapter.java +++ b/sample-chat/src/main/java/com/quickblox/sample/chat/ui/adapter/DialogsAdapter.java @@ -73,17 +73,15 @@ public View getView(int position, View convertView, ViewGroup parent) { private boolean isLastMessageAttachment(QBChatDialog dialog) { String lastMessage = dialog.getLastMessage(); Integer lastMessageSenderId = dialog.getLastMessageUserId(); - return (StringUtils.textIsNull(lastMessage) || TextUtils.isEmpty(lastMessage)) && lastMessageSenderId != null; + return TextUtils.isEmpty(lastMessage) && lastMessageSenderId != null; } private String prepareTextLastMessage(QBChatDialog chatDialog){ if (isLastMessageAttachment(chatDialog)){ return context.getString(R.string.chat_attachment); - } else if (!TextUtils.isEmpty(chatDialog.getLastMessage())){ - return StringUtils.textIsNull(chatDialog.getLastMessage()) ? EMPTY_STRING : chatDialog.getLastMessage(); + } else { + return chatDialog.getLastMessage(); } - - return EMPTY_STRING; } private static class ViewHolder { diff --git a/sample-chat/src/main/java/com/quickblox/sample/chat/utils/chat/ChatHelper.java b/sample-chat/src/main/java/com/quickblox/sample/chat/utils/chat/ChatHelper.java index 3f9812076..daac3c4dd 100644 --- a/sample-chat/src/main/java/com/quickblox/sample/chat/utils/chat/ChatHelper.java +++ b/sample-chat/src/main/java/com/quickblox/sample/chat/utils/chat/ChatHelper.java @@ -130,17 +130,7 @@ public void join(QBChatDialog chatDialog, final QBEntityCallback callback) DiscussionHistory history = new DiscussionHistory(); history.setMaxStanzas(0); - chatDialog.join(history, new QbEntityCallbackWrapper(callback) { - @Override - public void onSuccess(final Void result, final Bundle b) { - onSuccessInMainThread(result, b); - } - - @Override - public void onError(final QBResponseException e) { - onErrorInMainThread(e); - } - }); + chatDialog.join(history, callback); } public void leaveChatDialog(QBChatDialog chatDialog) throws XMPPException, SmackException.NotConnectedException {