From 87a0eea9ff2b503e3f38e28293d6387e14cc2f20 Mon Sep 17 00:00:00 2001
From: Matias Radzinski
Date: Tue, 2 May 2017 19:56:36 -0300
Subject: [PATCH 01/85] Allow the user to get the current position of a DIALOG
This should close issue #29. I believe that providing the user with the whole list of DIALOG objects is a bit "dangerous", users can modify that collection and feed it back to the adapter and given the current implementation that's not something we might want. So having a ```getDialogPosition()``` method should solve the case when the user needs to have the current adapter position of a certain dialog.
---
.../com/stfalcon/chatkit/dialogs/DialogsListAdapter.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index 87a10784..59421fbb 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -349,6 +349,13 @@ public void setDatesFormatter(DateFormatter.Formatter datesFormatter) {
void setStyle(DialogListStyle dialogStyle) {
this.dialogStyle = dialogStyle;
}
+
+ /**
+ * @return the position of a dialog in the dialogs list.
+ */
+ public int getDialogPosition(DIALOG dialog) {
+ return this.items.indexOf(dialog);
+ }
/*
* LISTENERS
From c2a471de81ca06ef8faf76fff4e2efb656465bd8 Mon Sep 17 00:00:00 2001
From: Alexander Krol
Date: Wed, 3 May 2017 18:13:48 +0300
Subject: [PATCH 02/85] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 8260eae7..4cd90e41 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ To implement all of the features above you can use the following components:
Download via Gradle:
```gradle
-compile 'com.github.stfalcon:chatkit:0.2.0'
+compile 'com.github.stfalcon:chatkit:0.2.1'
```
or Maven:
@@ -51,7 +51,7 @@ or Maven:
com.github.stfalcon
chatkit
- 0.2.0
+ 0.2.1
pom
```
From b75ae624d53457d3fa88fb1b46fef4600735a38f Mon Sep 17 00:00:00 2001
From: Nagarjuna Yelisetty
Date: Tue, 9 May 2017 12:05:00 +0530
Subject: [PATCH 03/85] Update COMPONENT_DIALOGS_LIST.MD
Just small change here
`* adapter.addItem(DIALOG dialog) - adds one dialog to the end of the list
* adapter.addItem(int position, DIALOG dialog) - adds a new dialog to the specified position.`
---
docs/COMPONENT_DIALOGS_LIST.MD | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/COMPONENT_DIALOGS_LIST.MD b/docs/COMPONENT_DIALOGS_LIST.MD
index 9b4f72ce..673457b2 100644
--- a/docs/COMPONENT_DIALOGS_LIST.MD
+++ b/docs/COMPONENT_DIALOGS_LIST.MD
@@ -113,8 +113,8 @@ When your models are ready to be used by adapter, you can simply add them to the
* adapter.setItems(List items) - replaces existing list with a new dialog list;
* adapter.addItems(List items) - adds a new dialog list to the end of the list;
-* adapter.addItem(DIALOG dialog) - adds a new dialog to the specified position;
-* adapter.addItem(int position, DIALOG dialog) - adds one dialog to the end of the list.
+* adapter.addItem(DIALOG dialog) - adds one dialog to the end of the list
+* adapter.addItem(int position, DIALOG dialog) - adds a new dialog to the specified position.
#### Updating dialogs
If dialog has changed, you can update it by position in list by calling `adapter.updateItem(int position, DIALOG item)` or update it by dialog id by calling `adapter.updateItemById(DIALOG item)`
From 43d816d9c96d57a5b4e4cc0a9dbcc2f4078333ca Mon Sep 17 00:00:00 2001
From: Toan Pv
Date: Fri, 19 May 2017 22:35:08 +0700
Subject: [PATCH 04/85] Add TypingListener to MessageInput Add sample
---
.../chatkit/messages/MessageInput.java | 56 ++++++++++++++++++-
.../demo/def/DefaultMessagesActivity.java | 15 ++++-
sample/src/main/res/values/strings.xml | 3 +
3 files changed, 72 insertions(+), 2 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
index 1d7d58b4..269cded7 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
@@ -37,7 +37,7 @@
* Component for input outcoming messages
*/
public class MessageInput extends RelativeLayout
- implements View.OnClickListener, TextWatcher {
+ implements View.OnClickListener, TextWatcher, View.OnFocusChangeListener {
protected EditText messageInput;
protected ImageButton messageSendButton;
@@ -47,6 +47,18 @@ public class MessageInput extends RelativeLayout
private CharSequence input;
private InputListener inputListener;
private AttachmentsListener attachmentsListener;
+ private boolean isTyping;
+ private TypingListener typingListener;
+ private Runnable typingTimerRunnable = new Runnable() {
+ @Override
+ public void run() {
+ if (isTyping) {
+ isTyping = false;
+ if (typingListener != null) typingListener.onStopTyping();
+ }
+ }
+ };
+ private boolean lastFocus;
public MessageInput(Context context) {
super(context);
@@ -107,6 +119,8 @@ public void onClick(View view) {
if (isSubmitted) {
messageInput.setText("");
}
+ removeCallbacks(typingTimerRunnable);
+ post(typingTimerRunnable);
} else if (id == R.id.attachmentButton) {
onAddAttachments();
}
@@ -120,6 +134,16 @@ public void onClick(View view) {
public void onTextChanged(CharSequence s, int start, int count, int after) {
input = s;
messageSendButton.setEnabled(input.length() > 0);
+ if (s.length() > 0) {
+
+ if (!isTyping) {
+ isTyping = true;
+ if (typingListener != null) typingListener.onStartTyping();
+ }
+
+ removeCallbacks(typingTimerRunnable);
+ postDelayed(typingTimerRunnable, 1500);
+ }
}
/**
@@ -139,6 +163,14 @@ public void afterTextChanged(Editable editable) {
}
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (lastFocus && !hasFocus && typingListener != null) {
+ typingListener.onStopTyping();
+ }
+ lastFocus = hasFocus;
+ }
+
private boolean onSubmit() {
return inputListener != null && inputListener.onSubmit(input);
}
@@ -201,6 +233,7 @@ private void init(Context context) {
attachmentButton.setOnClickListener(this);
messageInput.addTextChangedListener(this);
messageInput.setText("");
+ messageInput.setOnFocusChangeListener(this);
}
private void setCursor(Drawable drawable) {
@@ -212,6 +245,10 @@ private void setCursor(Drawable drawable) {
}
}
+ public void setTypingListener(TypingListener typingListener) {
+ this.typingListener = typingListener;
+ }
+
/**
* Interface definition for a callback to be invoked when user pressed 'submit' button
*/
@@ -236,4 +273,21 @@ public interface AttachmentsListener {
*/
void onAddAttachments();
}
+
+ /**
+ * Interface definition for a callback to be invoked when user typing
+ */
+ public interface TypingListener {
+
+ /**
+ * Fires when user presses start typing
+ */
+ void onStartTyping();
+
+ /**
+ * Fires when user presses stop typing
+ */
+ void onStopTyping();
+
+ }
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
index 0dcb32f7..6ab641b8 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
@@ -3,6 +3,7 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.widget.Toast;
import com.stfalcon.chatkit.messages.MessageInput;
import com.stfalcon.chatkit.messages.MessagesList;
@@ -13,7 +14,8 @@
public class DefaultMessagesActivity extends DemoMessagesActivity
implements MessageInput.InputListener,
- MessageInput.AttachmentsListener {
+ MessageInput.AttachmentsListener,
+ MessageInput.TypingListener {
public static void open(Context context) {
context.startActivity(new Intent(context, DefaultMessagesActivity.class));
@@ -31,6 +33,7 @@ protected void onCreate(Bundle savedInstanceState) {
MessageInput input = (MessageInput) findViewById(R.id.input);
input.setInputListener(this);
+ input.setTypingListener(this);
}
@Override
@@ -52,4 +55,14 @@ private void initAdapter() {
super.messagesAdapter.setLoadMoreListener(this);
this.messagesList.setAdapter(super.messagesAdapter);
}
+
+ @Override
+ public void onStartTyping() {
+ Toast.makeText(this, R.string.start_typing_status, Toast.LENGTH_SHORT).show();
+ }
+
+ @Override
+ public void onStopTyping() {
+ Toast.makeText(this, R.string.stop_typing_status, Toast.LENGTH_SHORT).show();
+ }
}
diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml
index 060953e4..f731bbcb 100644
--- a/sample/src/main/res/values/strings.xml
+++ b/sample/src/main/res/values/strings.xml
@@ -29,4 +29,7 @@
- Voice message (custom)
+ Start typing
+ Stop typing
+
From f1f9e6d56e40e7188389bf67031ddb8232ecbe20 Mon Sep 17 00:00:00 2001
From: Toan Pv
Date: Fri, 19 May 2017 22:37:21 +0700
Subject: [PATCH 05/85] Remove spaces
---
.../main/java/com/stfalcon/chatkit/messages/MessageInput.java | 2 --
1 file changed, 2 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
index 269cded7..5bd3d5a0 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
@@ -135,12 +135,10 @@ public void onTextChanged(CharSequence s, int start, int count, int after) {
input = s;
messageSendButton.setEnabled(input.length() > 0);
if (s.length() > 0) {
-
if (!isTyping) {
isTyping = true;
if (typingListener != null) typingListener.onStartTyping();
}
-
removeCallbacks(typingTimerRunnable);
postDelayed(typingTimerRunnable, 1500);
}
From 9be17d7a23ce13d418d87940e963e4b2f65f0a12 Mon Sep 17 00:00:00 2001
From: Toan Pv
Date: Fri, 19 May 2017 23:27:33 +0700
Subject: [PATCH 06/85] Add delay typing to attr Add TypingListener to docs
---
.../chatkit/messages/MessageInput.java | 4 +++-
.../chatkit/messages/MessageInputStyle.java | 9 +++++++++
chatkit/src/main/res/values/attrs.xml | 2 ++
docs/COMPONENT_MESSAGE_INPUT.MD | 18 ++++++++++++++++++
docs/STYLES_ATTR.md | 3 ++-
5 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
index 5bd3d5a0..db15a715 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
@@ -49,6 +49,7 @@ public class MessageInput extends RelativeLayout
private AttachmentsListener attachmentsListener;
private boolean isTyping;
private TypingListener typingListener;
+ private int delayTypingStatusMillis;
private Runnable typingTimerRunnable = new Runnable() {
@Override
public void run() {
@@ -140,7 +141,7 @@ public void onTextChanged(CharSequence s, int start, int count, int after) {
if (typingListener != null) typingListener.onStartTyping();
}
removeCallbacks(typingTimerRunnable);
- postDelayed(typingTimerRunnable, 1500);
+ postDelayed(typingTimerRunnable, delayTypingStatusMillis);
}
}
@@ -216,6 +217,7 @@ && getPaddingBottom() == 0) {
style.getInputDefaultPaddingBottom()
);
}
+ this.delayTypingStatusMillis = style.getDelayTypingStatus();
}
private void init(Context context) {
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInputStyle.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInputStyle.java
index 0c6d3248..1453a2f9 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInputStyle.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInputStyle.java
@@ -34,6 +34,7 @@
class MessageInputStyle extends Style {
private static final int DEFAULT_MAX_LINES = 5;
+ private static final int DEFAULT_DELAY_TYPING_STATUS = 1500;
private boolean showAttachmentButton;
@@ -81,6 +82,8 @@ class MessageInputStyle extends Style {
private int inputDefaultPaddingTop;
private int inputDefaultPaddingBottom;
+ private int delayTypingStatus;
+
static MessageInputStyle parse(Context context, AttributeSet attrs) {
MessageInputStyle style = new MessageInputStyle(context, attrs);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MessageInput);
@@ -138,6 +141,8 @@ static MessageInputStyle parse(Context context, AttributeSet attrs) {
style.inputBackground = typedArray.getDrawable(R.styleable.MessageInput_inputBackground);
style.inputCursorDrawable = typedArray.getDrawable(R.styleable.MessageInput_inputCursorDrawable);
+ style.delayTypingStatus = typedArray.getInt(R.styleable.MessageInput_delayTypingStatus, DEFAULT_DELAY_TYPING_STATUS);
+
typedArray.recycle();
style.inputDefaultPaddingLeft = style.getDimension(R.dimen.input_padding_left);
@@ -281,4 +286,8 @@ int getInputDefaultPaddingBottom() {
return inputDefaultPaddingBottom;
}
+ int getDelayTypingStatus() {
+ return delayTypingStatus;
+ }
+
}
diff --git a/chatkit/src/main/res/values/attrs.xml b/chatkit/src/main/res/values/attrs.xml
index dca85be2..1cd0a317 100644
--- a/chatkit/src/main/res/values/attrs.xml
+++ b/chatkit/src/main/res/values/attrs.xml
@@ -42,6 +42,8 @@
+
+
diff --git a/docs/COMPONENT_MESSAGE_INPUT.MD b/docs/COMPONENT_MESSAGE_INPUT.MD
index 6c49542e..72165205 100644
--- a/docs/COMPONENT_MESSAGE_INPUT.MD
+++ b/docs/COMPONENT_MESSAGE_INPUT.MD
@@ -47,6 +47,24 @@ messageInput.setAttachmentsListener(new MessageInput.AttachmentsListener() {
});
```
+#### Typing Listener
+
+If you want to track typing event:
+```java
+messageInput.setTypingListener(new MessageInput.TypingListener() {
+ @Override
+ public void onStartTyping() {
+
+ }
+
+ @Override
+ public void onStopTyping() {
+
+ }
+ });
+```
+Default delay typing is 1500, you can change it with only one line `delayTypingStatus="delayInMilis"`
+
#### Make it look the way you want
By using available widget attribute you can change color and size of text and input hint, maximum number of permitted lines, size and indents “submit” button, and its icon and background.
diff --git a/docs/STYLES_ATTR.md b/docs/STYLES_ATTR.md
index df2075e4..8d2f5856 100644
--- a/docs/STYLES_ATTR.md
+++ b/docs/STYLES_ATTR.md
@@ -126,4 +126,5 @@
| `inputTextColor` | Sets input message text color|
| `inputHintColor` | Sets text color of hint in message input field|
| `inputBackground` | Sets background for input message view |
-| `inputCursorDrawable` | Sets cursor drawable for input message EditText |
\ No newline at end of file
+| `inputCursorDrawable` | Sets cursor drawable for input message EditText |
+| `delayTypingStatus` | Sets delay typing for TypingListener|
\ No newline at end of file
From 423f15c4ab223116915dc6d8f378c39f8a504ef6 Mon Sep 17 00:00:00 2001
From: Anton
Date: Thu, 29 Jun 2017 15:55:49 +0300
Subject: [PATCH 07/85] DialogList: fixed changing text style to normal
---
.../chatkit/dialogs/DialogsListAdapter.java | 13 +++++++------
.../chatkit/sample/common/data/model/Dialog.java | 4 ++++
.../features/demo/styled/StyledDialogsActivity.java | 8 +++++++-
.../src/main/res/layout/activity_styled_dialogs.xml | 1 -
4 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index 444ef76a..ad895480 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -16,6 +16,7 @@
package com.stfalcon.chatkit.dialogs;
+import android.graphics.Typeface;
import android.graphics.drawable.GradientDrawable;
import android.support.annotation.LayoutRes;
import android.support.v7.widget.RecyclerView;
@@ -530,17 +531,17 @@ private void applyDefaultStyle() {
if (tvName != null) {
tvName.setTextColor(dialogStyle.getDialogTitleTextColor());
- tvName.setTypeface(tvName.getTypeface(), dialogStyle.getDialogTitleTextStyle());
+ tvName.setTypeface(Typeface.DEFAULT, dialogStyle.getDialogTitleTextStyle());
}
if (tvDate != null) {
tvDate.setTextColor(dialogStyle.getDialogDateColor());
- tvDate.setTypeface(tvDate.getTypeface(), dialogStyle.getDialogDateStyle());
+ tvDate.setTypeface(Typeface.DEFAULT, dialogStyle.getDialogDateStyle());
}
if (tvLastMessage != null) {
tvLastMessage.setTextColor(dialogStyle.getDialogMessageTextColor());
- tvLastMessage.setTypeface(tvLastMessage.getTypeface(), dialogStyle.getDialogMessageTextStyle());
+ tvLastMessage.setTypeface(Typeface.DEFAULT, dialogStyle.getDialogMessageTextStyle());
}
}
}
@@ -553,17 +554,17 @@ private void applyUnreadStyle() {
if (tvName != null) {
tvName.setTextColor(dialogStyle.getDialogUnreadTitleTextColor());
- tvName.setTypeface(tvName.getTypeface(), dialogStyle.getDialogUnreadTitleTextStyle());
+ tvName.setTypeface(Typeface.DEFAULT, dialogStyle.getDialogUnreadTitleTextStyle());
}
if (tvDate != null) {
tvDate.setTextColor(dialogStyle.getDialogUnreadDateColor());
- tvDate.setTypeface(tvDate.getTypeface(), dialogStyle.getDialogUnreadDateStyle());
+ tvDate.setTypeface(Typeface.DEFAULT, dialogStyle.getDialogUnreadDateStyle());
}
if (tvLastMessage != null) {
tvLastMessage.setTextColor(dialogStyle.getDialogUnreadMessageTextColor());
- tvLastMessage.setTypeface(tvLastMessage.getTypeface(), dialogStyle.getDialogUnreadMessageTextStyle());
+ tvLastMessage.setTypeface(Typeface.DEFAULT, dialogStyle.getDialogUnreadMessageTextStyle());
}
}
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/common/data/model/Dialog.java b/sample/src/main/java/com/stfalcon/chatkit/sample/common/data/model/Dialog.java
index 36584756..7f239df6 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/common/data/model/Dialog.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/common/data/model/Dialog.java
@@ -62,4 +62,8 @@ public void setLastMessage(Message lastMessage) {
public int getUnreadCount() {
return unreadCount;
}
+
+ public void setUnreadCount(int unreadCount) {
+ this.unreadCount = unreadCount;
+ }
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledDialogsActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledDialogsActivity.java
index 1d8d2865..9c9e1bf6 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledDialogsActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledDialogsActivity.java
@@ -54,7 +54,13 @@ private void initAdapter() {
super.dialogsAdapter = new DialogsListAdapter<>(super.imageLoader);
super.dialogsAdapter.setItems(DialogsFixtures.getDialogs());
- super.dialogsAdapter.setOnDialogClickListener(this);
+ super.dialogsAdapter.setOnDialogClickListener(new DialogsListAdapter.OnDialogClickListener() {
+ @Override
+ public void onDialogClick(Dialog dialog) {
+ dialog.setUnreadCount(0);
+ dialogsAdapter.updateItemById(dialog);
+ }
+ });
super.dialogsAdapter.setOnDialogLongClickListener(this);
super.dialogsAdapter.setDatesFormatter(this);
diff --git a/sample/src/main/res/layout/activity_styled_dialogs.xml b/sample/src/main/res/layout/activity_styled_dialogs.xml
index 81eb8ecd..50ce217a 100644
--- a/sample/src/main/res/layout/activity_styled_dialogs.xml
+++ b/sample/src/main/res/layout/activity_styled_dialogs.xml
@@ -11,7 +11,6 @@
android:layout_height="match_parent"
app:dialogDividerLeftPadding="0dp"
app:dialogMessageTextSize="17sp"
- app:dialogTitleTextStyle="bold"
app:dialogUnreadBubbleBackgroundColor="@color/red"
app:dialogUnreadItemBackground="@color/gray_transparent"
app:dialogUnreadTitleTextStyle="bold"/>
From 1da8fe6e54e8b0f6c002c37d1c6d5d888aeb1e21 Mon Sep 17 00:00:00 2001
From: Anton
Date: Thu, 29 Jun 2017 17:10:19 +0300
Subject: [PATCH 08/85] MessageList new feature: registering click listener for
view by id
---
chatkit/build.gradle | 4 ++--
.../chatkit/messages/MessageHolders.java | 24 +++++++++++++++----
.../chatkit/messages/MessagesListAdapter.java | 14 ++++++++++-
.../demo/def/DefaultMessagesActivity.java | 12 ++++++++++
4 files changed, 47 insertions(+), 7 deletions(-)
diff --git a/chatkit/build.gradle b/chatkit/build.gradle
index a7b3e3f7..54b43859 100644
--- a/chatkit/build.gradle
+++ b/chatkit/build.gradle
@@ -9,7 +9,7 @@ android {
minSdkVersion 14
targetSdkVersion 25
versionCode 1
- versionName "0.2.1"
+ versionName "0.2.2"
consumerProguardFiles 'proguard.txt'
}
@@ -23,7 +23,7 @@ android {
publish {
groupId = 'com.github.stfalcon'
artifactId = 'chatkit'
- publishVersion = '0.2.1'
+ publishVersion = '0.2.2'
desc = 'ChatKit - is a library designed to simplify the development of UI for such a trivial task as chat. It have flexible possibilities for styling, customizing and data management'
licences = ['Apache-2.0']
uploadName = 'ChatKit'
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
index bfe459ac..f24fb444 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
@@ -5,6 +5,7 @@
import android.support.v4.view.ViewCompat;
import android.text.Spannable;
import android.text.method.LinkMovementMethod;
+import android.util.SparseArray;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -346,16 +347,31 @@ ViewHolder getHolder(ViewGroup parent, int viewType, MessagesListStyle messagesL
}
@SuppressWarnings("unchecked")
- void bind(ViewHolder holder, Object item, boolean isSelected, ImageLoader imageLoader,
- View.OnClickListener onMessageClickListener,
- View.OnLongClickListener onMessageLongClickListener,
- DateFormatter.Formatter dateHeadersFormatter) {
+ void bind(final ViewHolder holder, final Object item, boolean isSelected,
+ final ImageLoader imageLoader,
+ final View.OnClickListener onMessageClickListener,
+ final View.OnLongClickListener onMessageLongClickListener,
+ final DateFormatter.Formatter dateHeadersFormatter,
+ final SparseArray clickListenersArray) {
if (item instanceof IMessage) {
((MessageHolders.BaseMessageViewHolder) holder).isSelected = isSelected;
((MessageHolders.BaseMessageViewHolder) holder).imageLoader = imageLoader;
holder.itemView.setOnLongClickListener(onMessageLongClickListener);
holder.itemView.setOnClickListener(onMessageClickListener);
+
+ for (int i = 0; i < clickListenersArray.size(); i++) {
+ final int key = clickListenersArray.keyAt(i);
+ final View view = holder.itemView.findViewById(key);
+ if (view != null) {
+ view.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ clickListenersArray.get(key).onMessageViewClick(view, (IMessage) item);
+ }
+ });
+ }
+ }
} else if (item instanceof Date) {
((MessageHolders.DefaultDateHeaderViewHolder) holder).dateHeadersFormatter = dateHeadersFormatter;
}
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
index aedcf4eb..4e1ec338 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
@@ -23,6 +23,7 @@
import android.support.v7.widget.RecyclerView;
import android.text.Spannable;
import android.text.method.LinkMovementMethod;
+import android.util.SparseArray;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
@@ -65,6 +66,7 @@ public class MessagesListAdapter
private RecyclerView.LayoutManager layoutManager;
private MessagesListStyle messagesListStyle;
private DateFormatter.Formatter dateHeadersFormatter;
+ private SparseArray viewClickListenersArray = new SparseArray<>();
/**
* For default list item layout and view holder.
@@ -103,7 +105,8 @@ public void onBindViewHolder(ViewHolder holder, int position) {
holders.bind(holder, wrapper.item, wrapper.isSelected, imageLoader,
getMessageClickListener(wrapper),
getMessageLongClickListener(wrapper),
- dateHeadersFormatter);
+ dateHeadersFormatter,
+ viewClickListenersArray);
}
@Override
@@ -369,6 +372,15 @@ public void setOnMessageViewClickListener(OnMessageViewClickListener on
this.onMessageViewClickListener = onMessageViewClickListener;
}
+ /**
+ * Registers click listener for view by id
+ * @param viewId view
+ * @param onMessageViewClickListener click listener.
+ */
+ public void registerViewClickListener(int viewId, OnMessageViewClickListener onMessageViewClickListener) {
+ this.viewClickListenersArray.append(viewId, onMessageViewClickListener);
+ }
+
/**
* Sets long click listener for item. Fires only if selection mode is disabled.
*
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
index 0dcb32f7..f4fd9b36 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
@@ -3,13 +3,16 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.view.View;
import com.stfalcon.chatkit.messages.MessageInput;
import com.stfalcon.chatkit.messages.MessagesList;
import com.stfalcon.chatkit.messages.MessagesListAdapter;
import com.stfalcon.chatkit.sample.R;
import com.stfalcon.chatkit.sample.common.data.fixtures.MessagesFixtures;
+import com.stfalcon.chatkit.sample.common.data.model.Message;
import com.stfalcon.chatkit.sample.features.demo.DemoMessagesActivity;
+import com.stfalcon.chatkit.sample.utils.AppUtils;
public class DefaultMessagesActivity extends DemoMessagesActivity
implements MessageInput.InputListener,
@@ -50,6 +53,15 @@ private void initAdapter() {
super.messagesAdapter = new MessagesListAdapter<>(super.senderId, super.imageLoader);
super.messagesAdapter.enableSelectionMode(this);
super.messagesAdapter.setLoadMoreListener(this);
+ super.messagesAdapter.registerViewClickListener(R.id.messageUserAvatar,
+ new MessagesListAdapter.OnMessageViewClickListener() {
+ @Override
+ public void onMessageViewClick(View view, Message message) {
+ AppUtils.showToast(DefaultMessagesActivity.this,
+ message.getUser().getName() + " avatar click",
+ false);
+ }
+ });
this.messagesList.setAdapter(super.messagesAdapter);
}
}
From 0da3d74f2500853bd7b46c2ed87018444a04a4e2 Mon Sep 17 00:00:00 2001
From: Anton
Date: Thu, 29 Jun 2017 17:15:38 +0300
Subject: [PATCH 09/85] removed some unnecessary sample code
---
.../features/demo/styled/StyledDialogsActivity.java | 8 +-------
sample/src/main/res/layout/activity_styled_dialogs.xml | 1 +
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledDialogsActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledDialogsActivity.java
index 9c9e1bf6..1d8d2865 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledDialogsActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledDialogsActivity.java
@@ -54,13 +54,7 @@ private void initAdapter() {
super.dialogsAdapter = new DialogsListAdapter<>(super.imageLoader);
super.dialogsAdapter.setItems(DialogsFixtures.getDialogs());
- super.dialogsAdapter.setOnDialogClickListener(new DialogsListAdapter.OnDialogClickListener() {
- @Override
- public void onDialogClick(Dialog dialog) {
- dialog.setUnreadCount(0);
- dialogsAdapter.updateItemById(dialog);
- }
- });
+ super.dialogsAdapter.setOnDialogClickListener(this);
super.dialogsAdapter.setOnDialogLongClickListener(this);
super.dialogsAdapter.setDatesFormatter(this);
diff --git a/sample/src/main/res/layout/activity_styled_dialogs.xml b/sample/src/main/res/layout/activity_styled_dialogs.xml
index 50ce217a..81eb8ecd 100644
--- a/sample/src/main/res/layout/activity_styled_dialogs.xml
+++ b/sample/src/main/res/layout/activity_styled_dialogs.xml
@@ -11,6 +11,7 @@
android:layout_height="match_parent"
app:dialogDividerLeftPadding="0dp"
app:dialogMessageTextSize="17sp"
+ app:dialogTitleTextStyle="bold"
app:dialogUnreadBubbleBackgroundColor="@color/red"
app:dialogUnreadItemBackground="@color/gray_transparent"
app:dialogUnreadTitleTextStyle="bold"/>
From e1f6ef83db9d1640fa60a7609fe44aa9020c9c1e Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Thu, 29 Jun 2017 17:23:07 +0300
Subject: [PATCH 10/85] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 4cd90e41..66fc6909 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ To implement all of the features above you can use the following components:
Download via Gradle:
```gradle
-compile 'com.github.stfalcon:chatkit:0.2.1'
+compile 'com.github.stfalcon:chatkit:0.2.2'
```
or Maven:
@@ -51,7 +51,7 @@ or Maven:
com.github.stfalcon
chatkit
- 0.2.1
+ 0.2.2
pom
```
From 0987b4d676a0f7ea6742abe67ec4439eef36a2e2 Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Thu, 29 Jun 2017 17:43:12 +0300
Subject: [PATCH 11/85] Update COMPONENT_MESSAGES_LIST.md
---
docs/COMPONENT_MESSAGES_LIST.md | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/docs/COMPONENT_MESSAGES_LIST.md b/docs/COMPONENT_MESSAGES_LIST.md
index 707a9d5e..38a4453e 100644
--- a/docs/COMPONENT_MESSAGES_LIST.md
+++ b/docs/COMPONENT_MESSAGES_LIST.md
@@ -147,7 +147,7 @@ If message has changed, you can update it by calling `adapter.update(IMessage me
#### Click listeners
-Of course, the adapter have listeners for such important actions as short and long clicks. They just returns a message object that has been pressed, with a type that is specified as the generic type of adapter:
+Of course, the adapter has listeners for such important actions as short and long clicks. They just returns a message object that has been pressed, with a type that is specified as the generic type of adapter:
```java
public interface OnMessageClickListener {
@@ -157,6 +157,12 @@ public interface OnMessageLongClickListener {
void onMessageLongClick(MESSAGE message);
}
```
+
+Also here is an ability to set listeners on separate Views in message item:
+```
+public void registerViewClickListener(int viewId, OnMessageViewClickListener onMessageViewClickListener)
+```
+
#### Links highlighting
In 99% of cases the user is confused, when he can not follow the link or call the phone, indicated in the message. If you think the same way, just include `textAutoLink="all"`, like in the ordinary `TextView`. Similarly, you can specify highlighting for certain types, for example, `email|phone|web`:
@@ -369,4 +375,4 @@ If the `hasContentFor` method returns `true` for the selected type, the correspo
As the result, well get the following:
-
\ No newline at end of file
+
From 4bdd9842aebaf87c16dfbee759108ccc70b33700 Mon Sep 17 00:00:00 2001
From: Alexander Krol
Date: Wed, 19 Jul 2017 11:38:00 +0300
Subject: [PATCH 12/85] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 66fc6909..bb59cb6d 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
-[ ![Download](https://api.bintray.com/packages/troy379/maven/ChatKit/images/download.svg) ](https://bintray.com/troy379/maven/ChatKit/_latestVersion)
-
# ChatKit for Android
+[ ![Download](https://api.bintray.com/packages/troy379/maven/ChatKit/images/download.svg) ](https://bintray.com/troy379/maven/ChatKit/_latestVersion)
+
ChatKit is a library designed to simplify the development of UI for such a trivial task as chat. It has flexible possibilities for styling, customizing and data management
From 14c84e74a9999e310b915e270d05e0618f090ea2 Mon Sep 17 00:00:00 2001
From: troy379
Date: Thu, 20 Jul 2017 17:45:55 +0300
Subject: [PATCH 13/85] tiny refactoring
---
.../commons/models/MessageContentType.java | 16 +
.../chatkit/dialogs/DialogListStyle.java | 294 ++++++------------
.../chatkit/dialogs/DialogsListAdapter.java | 9 +-
.../chatkit/messages/MessageHolders.java | 25 +-
.../chatkit/messages/MessageInput.java | 5 +-
.../chatkit/messages/MessageInputStyle.java | 47 +--
.../chatkit/messages/MessagesListAdapter.java | 10 +-
.../chatkit/messages/MessagesListStyle.java | 81 ++---
.../chatkit/utils/RoundedImageView.java | 13 +-
9 files changed, 202 insertions(+), 298 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/MessageContentType.java b/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/MessageContentType.java
index 943623c1..f5b63995 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/MessageContentType.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/MessageContentType.java
@@ -1,3 +1,19 @@
+/*******************************************************************************
+ * Copyright 2016 stfalcon.com
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *******************************************************************************/
+
package com.stfalcon.chatkit.commons.models;
import com.stfalcon.chatkit.messages.MessageHolders;
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogListStyle.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogListStyle.java
index 539d3227..b8ea3eca 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogListStyle.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogListStyle.java
@@ -27,7 +27,7 @@
/**
* Style for DialogList customization by xml attributes
*/
-
+@SuppressWarnings("WeakerAccess")
class DialogListStyle extends Style {
private int dialogTitleTextColor;
@@ -75,75 +75,79 @@ static DialogListStyle parse(Context context, AttributeSet attrs) {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.DialogsList);
//Item background
- style.setDialogItemBackground(typedArray.getColor(R.styleable.DialogsList_dialogItemBackground,
- style.getColor(R.color.transparent)));
- style.setDialogUnreadItemBackground(typedArray.getColor(R.styleable.DialogsList_dialogUnreadItemBackground,
- style.getColor(R.color.transparent)));
+ style.dialogItemBackground = typedArray.getColor(R.styleable.DialogsList_dialogItemBackground,
+ style.getColor(R.color.transparent));
+ style.dialogUnreadItemBackground = typedArray.getColor(R.styleable.DialogsList_dialogUnreadItemBackground,
+ style.getColor(R.color.transparent));
+
//Title text
- style.setDialogTitleTextColor(typedArray.getColor(R.styleable.DialogsList_dialogTitleTextColor,
- style.getColor(R.color.dialog_title_text)));
- style.setDialogTitleTextSize(typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogTitleTextSize,
- context.getResources().getDimensionPixelSize(R.dimen.dialog_title_text_size)));
- style.setDialogTitleTextStyle(typedArray.getInt(R.styleable.DialogsList_dialogTitleTextStyle, Typeface.NORMAL));
+ style.dialogTitleTextColor = typedArray.getColor(R.styleable.DialogsList_dialogTitleTextColor,
+ style.getColor(R.color.dialog_title_text));
+ style.dialogTitleTextSize = typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogTitleTextSize,
+ context.getResources().getDimensionPixelSize(R.dimen.dialog_title_text_size));
+ style.dialogTitleTextStyle = typedArray.getInt(R.styleable.DialogsList_dialogTitleTextStyle, Typeface.NORMAL);
+
//Title unread text
- style.setDialogUnreadTitleTextColor(typedArray.getColor(R.styleable.DialogsList_dialogUnreadTitleTextColor,
- style.getColor(R.color.dialog_title_text)));
- style.setDialogUnreadTitleTextStyle(typedArray.getInt(R.styleable.DialogsList_dialogUnreadTitleTextStyle, Typeface.NORMAL));
+ style.dialogUnreadTitleTextColor = typedArray.getColor(R.styleable.DialogsList_dialogUnreadTitleTextColor,
+ style.getColor(R.color.dialog_title_text));
+ style.dialogUnreadTitleTextStyle = typedArray.getInt(R.styleable.DialogsList_dialogUnreadTitleTextStyle, Typeface.NORMAL);
//Message text
- style.setDialogMessageTextColor(typedArray.getColor(R.styleable.DialogsList_dialogMessageTextColor,
- style.getColor(R.color.dialog_message_text)));
- style.setDialogMessageTextSize(typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogMessageTextSize,
- context.getResources().getDimensionPixelSize(R.dimen.dialog_message_text_size)));
- style.setDialogMessageTextStyle(typedArray.getInt(R.styleable.DialogsList_dialogMessageTextStyle, Typeface.NORMAL));
+ style.dialogMessageTextColor = typedArray.getColor(R.styleable.DialogsList_dialogMessageTextColor,
+ style.getColor(R.color.dialog_message_text));
+ style.dialogMessageTextSize = typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogMessageTextSize,
+ context.getResources().getDimensionPixelSize(R.dimen.dialog_message_text_size));
+ style.dialogMessageTextStyle = typedArray.getInt(R.styleable.DialogsList_dialogMessageTextStyle, Typeface.NORMAL);
+
//Message unread text
- style.setDialogUnreadMessageTextColor(typedArray.getColor(R.styleable.DialogsList_dialogUnreadMessageTextColor,
- style.getColor(R.color.dialog_message_text)));
- style.setDialogUnreadMessageTextStyle(typedArray.getInt(R.styleable.DialogsList_dialogUnreadMessageTextStyle, Typeface.NORMAL));
+ style.dialogUnreadMessageTextColor = typedArray.getColor(R.styleable.DialogsList_dialogUnreadMessageTextColor,
+ style.getColor(R.color.dialog_message_text));
+ style.dialogUnreadMessageTextStyle = typedArray.getInt(R.styleable.DialogsList_dialogUnreadMessageTextStyle, Typeface.NORMAL);
//Date text
- style.setDialogDateColor(typedArray.getColor(R.styleable.DialogsList_dialogDateColor,
- style.getColor(R.color.dialog_date_text)));
- style.setDialogDateSize(typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogDateSize,
- context.getResources().getDimensionPixelSize(R.dimen.dialog_date_text_size)));
- style.setDialogDateStyle(typedArray.getInt(R.styleable.DialogsList_dialogDateStyle, Typeface.NORMAL));
+ style.dialogDateColor = typedArray.getColor(R.styleable.DialogsList_dialogDateColor,
+ style.getColor(R.color.dialog_date_text));
+ style.dialogDateSize = typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogDateSize,
+ context.getResources().getDimensionPixelSize(R.dimen.dialog_date_text_size));
+ style.dialogDateStyle = typedArray.getInt(R.styleable.DialogsList_dialogDateStyle, Typeface.NORMAL);
+
//Date unread text
- style.setDialogUnreadDateColor(typedArray.getColor(R.styleable.DialogsList_dialogUnreadDateColor,
- style.getColor(R.color.dialog_date_text)));
- style.setDialogUnreadDateStyle(typedArray.getInt(R.styleable.DialogsList_dialogUnreadDateStyle, Typeface.NORMAL));
+ style.dialogUnreadDateColor = typedArray.getColor(R.styleable.DialogsList_dialogUnreadDateColor,
+ style.getColor(R.color.dialog_date_text));
+ style.dialogUnreadDateStyle = typedArray.getInt(R.styleable.DialogsList_dialogUnreadDateStyle, Typeface.NORMAL);
//Unread bubble
- style.setDialogUnreadBubbleEnabled(typedArray.getBoolean(R.styleable.DialogsList_dialogUnreadBubbleEnabled, true));
- style.setDialogUnreadBubbleBackgroundColor(typedArray.getColor(R.styleable.DialogsList_dialogUnreadBubbleBackgroundColor,
- style.getColor(R.color.dialog_unread_bubble)));
+ style.dialogUnreadBubbleEnabled = typedArray.getBoolean(R.styleable.DialogsList_dialogUnreadBubbleEnabled, true);
+ style.dialogUnreadBubbleBackgroundColor = typedArray.getColor(R.styleable.DialogsList_dialogUnreadBubbleBackgroundColor,
+ style.getColor(R.color.dialog_unread_bubble));
//Unread bubble text
- style.setDialogUnreadBubbleTextColor(typedArray.getColor(R.styleable.DialogsList_dialogUnreadBubbleTextColor,
- style.getColor(R.color.dialog_unread_text)));
- style.setDialogUnreadBubbleTextSize(typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogUnreadBubbleTextSize,
- context.getResources().getDimensionPixelSize(R.dimen.dialog_unread_bubble_text_size)));
- style.setDialogUnreadBubbleTextStyle(typedArray.getInt(R.styleable.DialogsList_dialogUnreadBubbleTextStyle, Typeface.NORMAL));
+ style.dialogUnreadBubbleTextColor = typedArray.getColor(R.styleable.DialogsList_dialogUnreadBubbleTextColor,
+ style.getColor(R.color.dialog_unread_text));
+ style.dialogUnreadBubbleTextSize = typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogUnreadBubbleTextSize,
+ context.getResources().getDimensionPixelSize(R.dimen.dialog_unread_bubble_text_size));
+ style.dialogUnreadBubbleTextStyle = typedArray.getInt(R.styleable.DialogsList_dialogUnreadBubbleTextStyle, Typeface.NORMAL);
//Avatar
- style.setDialogAvatarWidth(typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogAvatarWidth,
- context.getResources().getDimensionPixelSize(R.dimen.dialog_avatar_width)));
- style.setDialogAvatarHeight(typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogAvatarHeight,
- context.getResources().getDimensionPixelSize(R.dimen.dialog_avatar_height)));
+ style.dialogAvatarWidth = typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogAvatarWidth,
+ context.getResources().getDimensionPixelSize(R.dimen.dialog_avatar_width));
+ style.dialogAvatarHeight = typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogAvatarHeight,
+ context.getResources().getDimensionPixelSize(R.dimen.dialog_avatar_height));
//Last message avatar
- style.setDialogMessageAvatarEnabled(typedArray.getBoolean(R.styleable.DialogsList_dialogMessageAvatarEnabled, true));
- style.setDialogMessageAvatarWidth(typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogMessageAvatarWidth,
- context.getResources().getDimensionPixelSize(R.dimen.dialog_last_message_avatar_width)));
- style.setDialogMessageAvatarHeight(typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogMessageAvatarHeight,
- context.getResources().getDimensionPixelSize(R.dimen.dialog_last_message_avatar_height)));
+ style.dialogMessageAvatarEnabled = typedArray.getBoolean(R.styleable.DialogsList_dialogMessageAvatarEnabled, true);
+ style.dialogMessageAvatarWidth = typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogMessageAvatarWidth,
+ context.getResources().getDimensionPixelSize(R.dimen.dialog_last_message_avatar_width));
+ style.dialogMessageAvatarHeight = typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogMessageAvatarHeight,
+ context.getResources().getDimensionPixelSize(R.dimen.dialog_last_message_avatar_height));
//Divider
- style.setDialogDividerEnabled(typedArray.getBoolean(R.styleable.DialogsList_dialogDividerEnabled, true));
- style.setDialogDividerColor(typedArray.getColor(R.styleable.DialogsList_dialogDividerColor, style.getColor(R.color.dialog_divider)));
- style.setDialogDividerLeftPadding(typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogDividerLeftPadding,
- context.getResources().getDimensionPixelSize(R.dimen.dialog_divider_margin_left)));
- style.setDialogDividerRightPadding(typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogDividerRightPadding,
- context.getResources().getDimensionPixelSize(R.dimen.dialog_divider_margin_right)));
+ style.dialogDividerEnabled = typedArray.getBoolean(R.styleable.DialogsList_dialogDividerEnabled, true);
+ style.dialogDividerColor = typedArray.getColor(R.styleable.DialogsList_dialogDividerColor, style.getColor(R.color.dialog_divider));
+ style.dialogDividerLeftPadding = typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogDividerLeftPadding,
+ context.getResources().getDimensionPixelSize(R.dimen.dialog_divider_margin_left));
+ style.dialogDividerRightPadding = typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogDividerRightPadding,
+ context.getResources().getDimensionPixelSize(R.dimen.dialog_divider_margin_right));
typedArray.recycle();
@@ -154,251 +158,127 @@ private DialogListStyle(Context context, AttributeSet attrs) {
super(context, attrs);
}
- int getDialogTitleTextColor() {
+ protected int getDialogTitleTextColor() {
return dialogTitleTextColor;
}
- void setDialogTitleTextColor(int dialogTitleTextColor) {
- this.dialogTitleTextColor = dialogTitleTextColor;
- }
-
- int getDialogTitleTextSize() {
+ protected int getDialogTitleTextSize() {
return dialogTitleTextSize;
}
- void setDialogTitleTextSize(int dialogTitleTextSize) {
- this.dialogTitleTextSize = dialogTitleTextSize;
- }
-
- int getDialogTitleTextStyle() {
+ protected int getDialogTitleTextStyle() {
return dialogTitleTextStyle;
}
- void setDialogTitleTextStyle(int dialogTitleTextStyle) {
- this.dialogTitleTextStyle = dialogTitleTextStyle;
- }
-
- int getDialogUnreadTitleTextColor() {
+ protected int getDialogUnreadTitleTextColor() {
return dialogUnreadTitleTextColor;
}
- void setDialogUnreadTitleTextColor(int dialogUnreadTitleTextColor) {
- this.dialogUnreadTitleTextColor = dialogUnreadTitleTextColor;
- }
-
- int getDialogUnreadTitleTextStyle() {
+ protected int getDialogUnreadTitleTextStyle() {
return dialogUnreadTitleTextStyle;
}
- void setDialogUnreadTitleTextStyle(int dialogUnreadTitleTextStyle) {
- this.dialogUnreadTitleTextStyle = dialogUnreadTitleTextStyle;
- }
-
- int getDialogMessageTextColor() {
+ protected int getDialogMessageTextColor() {
return dialogMessageTextColor;
}
- void setDialogMessageTextColor(int dialogMessageTextColor) {
- this.dialogMessageTextColor = dialogMessageTextColor;
- }
-
- int getDialogMessageTextSize() {
+ protected int getDialogMessageTextSize() {
return dialogMessageTextSize;
}
- void setDialogMessageTextSize(int dialogMessageTextSize) {
- this.dialogMessageTextSize = dialogMessageTextSize;
- }
-
- int getDialogMessageTextStyle() {
+ protected int getDialogMessageTextStyle() {
return dialogMessageTextStyle;
}
- void setDialogMessageTextStyle(int dialogMessageTextStyle) {
- this.dialogMessageTextStyle = dialogMessageTextStyle;
- }
-
- int getDialogUnreadMessageTextColor() {
+ protected int getDialogUnreadMessageTextColor() {
return dialogUnreadMessageTextColor;
}
- void setDialogUnreadMessageTextColor(int dialogUnreadMessageTextColor) {
- this.dialogUnreadMessageTextColor = dialogUnreadMessageTextColor;
- }
-
- int getDialogUnreadMessageTextStyle() {
+ protected int getDialogUnreadMessageTextStyle() {
return dialogUnreadMessageTextStyle;
}
- void setDialogUnreadMessageTextStyle(int dialogUnreadMessageTextStyle) {
- this.dialogUnreadMessageTextStyle = dialogUnreadMessageTextStyle;
- }
-
- int getDialogDateColor() {
+ protected int getDialogDateColor() {
return dialogDateColor;
}
- void setDialogDateColor(int dialogDateColor) {
- this.dialogDateColor = dialogDateColor;
- }
-
- int getDialogDateSize() {
+ protected int getDialogDateSize() {
return dialogDateSize;
}
- void setDialogDateSize(int dialogDateSize) {
- this.dialogDateSize = dialogDateSize;
- }
-
- int getDialogDateStyle() {
+ protected int getDialogDateStyle() {
return dialogDateStyle;
}
- void setDialogDateStyle(int dialogDateStyle) {
- this.dialogDateStyle = dialogDateStyle;
- }
-
- int getDialogUnreadDateColor() {
+ protected int getDialogUnreadDateColor() {
return dialogUnreadDateColor;
}
- void setDialogUnreadDateColor(int dialogUnreadDateColor) {
- this.dialogUnreadDateColor = dialogUnreadDateColor;
- }
-
- int getDialogUnreadDateStyle() {
+ protected int getDialogUnreadDateStyle() {
return dialogUnreadDateStyle;
}
- void setDialogUnreadDateStyle(int dialogUnreadDateStyle) {
- this.dialogUnreadDateStyle = dialogUnreadDateStyle;
- }
-
- boolean isDialogUnreadBubbleEnabled() {
+ protected boolean isDialogUnreadBubbleEnabled() {
return dialogUnreadBubbleEnabled;
}
- void setDialogUnreadBubbleEnabled(boolean dialogUnreadBubbleEnabled) {
- this.dialogUnreadBubbleEnabled = dialogUnreadBubbleEnabled;
- }
-
- int getDialogUnreadBubbleTextColor() {
+ protected int getDialogUnreadBubbleTextColor() {
return dialogUnreadBubbleTextColor;
}
- void setDialogUnreadBubbleTextColor(int dialogUnreadBubbleTextColor) {
- this.dialogUnreadBubbleTextColor = dialogUnreadBubbleTextColor;
- }
-
- int getDialogUnreadBubbleTextSize() {
+ protected int getDialogUnreadBubbleTextSize() {
return dialogUnreadBubbleTextSize;
}
- void setDialogUnreadBubbleTextSize(int dialogUnreadBubbleTextSize) {
- this.dialogUnreadBubbleTextSize = dialogUnreadBubbleTextSize;
- }
-
- int getDialogUnreadBubbleTextStyle() {
+ protected int getDialogUnreadBubbleTextStyle() {
return dialogUnreadBubbleTextStyle;
}
- void setDialogUnreadBubbleTextStyle(int dialogUnreadBubbleTextStyle) {
- this.dialogUnreadBubbleTextStyle = dialogUnreadBubbleTextStyle;
- }
-
- int getDialogUnreadBubbleBackgroundColor() {
+ protected int getDialogUnreadBubbleBackgroundColor() {
return dialogUnreadBubbleBackgroundColor;
}
- void setDialogUnreadBubbleBackgroundColor(int dialogUnreadBubbleBackgroundColor) {
- this.dialogUnreadBubbleBackgroundColor = dialogUnreadBubbleBackgroundColor;
- }
-
- int getDialogAvatarWidth() {
+ protected int getDialogAvatarWidth() {
return dialogAvatarWidth;
}
- void setDialogAvatarWidth(int dialogAvatarWidth) {
- this.dialogAvatarWidth = dialogAvatarWidth;
- }
-
- int getDialogAvatarHeight() {
+ protected int getDialogAvatarHeight() {
return dialogAvatarHeight;
}
- void setDialogAvatarHeight(int dialogAvatarHeight) {
- this.dialogAvatarHeight = dialogAvatarHeight;
- }
-
- boolean isDialogDividerEnabled() {
+ protected boolean isDialogDividerEnabled() {
return dialogDividerEnabled;
}
- void setDialogDividerEnabled(boolean dialogDividerEnabled) {
- this.dialogDividerEnabled = dialogDividerEnabled;
- }
-
- int getDialogDividerColor() {
+ protected int getDialogDividerColor() {
return dialogDividerColor;
}
- void setDialogDividerColor(int dialogDividerColor) {
- this.dialogDividerColor = dialogDividerColor;
- }
-
- int getDialogDividerLeftPadding() {
+ protected int getDialogDividerLeftPadding() {
return dialogDividerLeftPadding;
}
- void setDialogDividerLeftPadding(int dialogDividerLeftMargin) {
- this.dialogDividerLeftPadding = dialogDividerLeftMargin;
- }
-
- int getDialogDividerRightPadding() {
+ protected int getDialogDividerRightPadding() {
return dialogDividerRightPadding;
}
- void setDialogDividerRightPadding(int dialogDividerRightMargin) {
- this.dialogDividerRightPadding = dialogDividerRightMargin;
- }
-
- int getDialogItemBackground() {
+ protected int getDialogItemBackground() {
return dialogItemBackground;
}
- void setDialogItemBackground(int dialogItemBackground) {
- this.dialogItemBackground = dialogItemBackground;
- }
-
- int getDialogUnreadItemBackground() {
+ protected int getDialogUnreadItemBackground() {
return dialogUnreadItemBackground;
}
- void setDialogUnreadItemBackground(int dialogUnreadItemBackground) {
- this.dialogUnreadItemBackground = dialogUnreadItemBackground;
- }
-
- void setDialogMessageAvatarEnabled(boolean dialogMessageAvatarEnabled) {
- this.dialogMessageAvatarEnabled = dialogMessageAvatarEnabled;
- }
-
- boolean isDialogMessageAvatarEnabled() {
+ protected boolean isDialogMessageAvatarEnabled() {
return dialogMessageAvatarEnabled;
}
- int getDialogMessageAvatarWidth() {
+ protected int getDialogMessageAvatarWidth() {
return dialogMessageAvatarWidth;
}
- void setDialogMessageAvatarWidth(int dialogMessageAvatarWidth) {
- this.dialogMessageAvatarWidth = dialogMessageAvatarWidth;
- }
-
- int getDialogMessageAvatarHeight() {
+ protected int getDialogMessageAvatarHeight() {
return dialogMessageAvatarHeight;
}
-
- void setDialogMessageAvatarHeight(int dialogMessageAvatarHeight) {
- this.dialogMessageAvatarHeight = dialogMessageAvatarHeight;
- }
}
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index ad895480..9638ff7e 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -47,6 +47,7 @@
/**
* Adapter for {@link DialogsList}
*/
+@SuppressWarnings("WeakerAccess")
public class DialogsListAdapter
extends RecyclerView.Adapter {
@@ -428,19 +429,19 @@ void setImageLoader(ImageLoader imageLoader) {
this.imageLoader = imageLoader;
}
- void setOnDialogClickListener(OnDialogClickListener onDialogClickListener) {
+ protected void setOnDialogClickListener(OnDialogClickListener onDialogClickListener) {
this.onDialogClickListener = onDialogClickListener;
}
- void setOnDialogViewClickListener(OnDialogViewClickListener onDialogViewClickListener) {
+ protected void setOnDialogViewClickListener(OnDialogViewClickListener onDialogViewClickListener) {
this.onDialogViewClickListener = onDialogViewClickListener;
}
- void setOnLongItemClickListener(OnDialogLongClickListener onLongItemClickListener) {
+ protected void setOnLongItemClickListener(OnDialogLongClickListener onLongItemClickListener) {
this.onLongItemClickListener = onLongItemClickListener;
}
- void setOnDialogViewLongClickListener(OnDialogViewLongClickListener onDialogViewLongClickListener) {
+ protected void setOnDialogViewLongClickListener(OnDialogViewLongClickListener onDialogViewLongClickListener) {
this.onDialogViewLongClickListener = onDialogViewLongClickListener;
}
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
index f24fb444..8f126cd3 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
@@ -30,6 +30,7 @@
/*
* Created by troy379 on 31.03.17.
*/
+@SuppressWarnings("WeakerAccess")
public class MessageHolders {
private static final short VIEW_TYPE_DATE_HEADER = 130;
@@ -321,7 +322,7 @@ public interface ContentChecker {
* PRIVATE METHODS
* */
- ViewHolder getHolder(ViewGroup parent, int viewType, MessagesListStyle messagesListStyle) {
+ protected ViewHolder getHolder(ViewGroup parent, int viewType, MessagesListStyle messagesListStyle) {
switch (viewType) {
case VIEW_TYPE_DATE_HEADER:
return getHolder(parent, dateHeaderLayout, dateHeaderHolder, messagesListStyle);
@@ -347,12 +348,12 @@ ViewHolder getHolder(ViewGroup parent, int viewType, MessagesListStyle messagesL
}
@SuppressWarnings("unchecked")
- void bind(final ViewHolder holder, final Object item, boolean isSelected,
- final ImageLoader imageLoader,
- final View.OnClickListener onMessageClickListener,
- final View.OnLongClickListener onMessageLongClickListener,
- final DateFormatter.Formatter dateHeadersFormatter,
- final SparseArray clickListenersArray) {
+ protected void bind(final ViewHolder holder, final Object item, boolean isSelected,
+ final ImageLoader imageLoader,
+ final View.OnClickListener onMessageClickListener,
+ final View.OnLongClickListener onMessageLongClickListener,
+ final DateFormatter.Formatter dateHeadersFormatter,
+ final SparseArray clickListenersArray) {
if (item instanceof IMessage) {
((MessageHolders.BaseMessageViewHolder) holder).isSelected = isSelected;
@@ -380,7 +381,7 @@ public void onClick(View v) {
}
- int getViewType(Object item, String senderId) {
+ protected int getViewType(Object item, String senderId) {
boolean isOutcoming = false;
int viewType;
@@ -411,7 +412,7 @@ ViewHolder getHolder(ViewGroup parent, @LayoutRes int layout, Class hold
}
return holder;
} catch (Exception e) {
- throw new RuntimeException("Somehow we couldn't create the ViewHolder for message. Please, report this issue on GitHub with full stacktrace in description.", e);
+ throw new UnsupportedOperationException("Somehow we couldn't create the ViewHolder for message. Please, report this issue on GitHub with full stacktrace in description.", e);
}
}
@@ -453,7 +454,7 @@ public static abstract class BaseMessageViewHolder ext
/**
* Callback for implementing images loading in message list
*/
- ImageLoader imageLoader;
+ protected ImageLoader imageLoader;
public BaseMessageViewHolder(View itemView) {
super(itemView);
@@ -877,8 +878,8 @@ private ContentTypeConfig(
private class HolderConfig {
- Class extends BaseMessageViewHolder extends T>> holder;
- int layout;
+ protected Class extends BaseMessageViewHolder extends T>> holder;
+ protected int layout;
HolderConfig(Class extends BaseMessageViewHolder extends T>> holder, int layout) {
this.holder = holder;
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
index 310fafad..92fe2d5a 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
@@ -38,6 +38,7 @@
/**
* Component for input outcoming messages
*/
+@SuppressWarnings({"WeakerAccess", "unused"})
public class MessageInput extends RelativeLayout
implements View.OnClickListener, TextWatcher {
@@ -130,7 +131,7 @@ public void onTextChanged(CharSequence s, int start, int count, int after) {
*/
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
-
+ //do nothing
}
/**
@@ -138,7 +139,7 @@ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2)
*/
@Override
public void afterTextChanged(Editable editable) {
-
+ //do nothing
}
private boolean onSubmit() {
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInputStyle.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInputStyle.java
index 0c6d3248..99b4e7c9 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInputStyle.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInputStyle.java
@@ -31,6 +31,7 @@
/**
* Style for MessageInputStyle customization by xml attributes
*/
+@SuppressWarnings("WeakerAccess")
class MessageInputStyle extends Style {
private static final int DEFAULT_MAX_LINES = 5;
@@ -169,11 +170,11 @@ private Drawable getSelector(@ColorInt int normalColor, @ColorInt int pressedCol
return drawable;
}
- boolean showAttachmentButton() {
+ protected boolean showAttachmentButton() {
return showAttachmentButton;
}
- Drawable getAttachmentButtonBackground() {
+ protected Drawable getAttachmentButtonBackground() {
if (attachmentButtonBackground == -1) {
return getSelector(attachmentButtonDefaultBgColor, attachmentButtonDefaultBgPressedColor,
attachmentButtonDefaultBgDisabledColor, R.drawable.mask);
@@ -182,7 +183,7 @@ Drawable getAttachmentButtonBackground() {
}
}
- Drawable getAttachmentButtonIcon() {
+ protected Drawable getAttachmentButtonIcon() {
if (attachmentButtonIcon == -1) {
return getSelector(attachmentButtonDefaultIconColor, attachmentButtonDefaultIconPressedColor,
attachmentButtonDefaultIconDisabledColor, R.drawable.ic_add_attachment);
@@ -191,19 +192,19 @@ Drawable getAttachmentButtonIcon() {
}
}
- int getAttachmentButtonWidth() {
+ protected int getAttachmentButtonWidth() {
return attachmentButtonWidth;
}
- int getAttachmentButtonHeight() {
+ protected int getAttachmentButtonHeight() {
return attachmentButtonHeight;
}
- int getAttachmentButtonMargin() {
+ protected int getAttachmentButtonMargin() {
return attachmentButtonMargin;
}
- Drawable getInputButtonBackground() {
+ protected Drawable getInputButtonBackground() {
if (inputButtonBackground == -1) {
return getSelector(inputButtonDefaultBgColor, inputButtonDefaultBgPressedColor,
inputButtonDefaultBgDisabledColor, R.drawable.mask);
@@ -212,7 +213,7 @@ Drawable getInputButtonBackground() {
}
}
- Drawable getInputButtonIcon() {
+ protected Drawable getInputButtonIcon() {
if (inputButtonIcon == -1) {
return getSelector(inputButtonDefaultIconColor, inputButtonDefaultIconPressedColor,
inputButtonDefaultIconDisabledColor, R.drawable.ic_send);
@@ -221,63 +222,63 @@ Drawable getInputButtonIcon() {
}
}
- int getInputButtonMargin() {
+ protected int getInputButtonMargin() {
return inputButtonMargin;
}
- int getInputButtonWidth() {
+ protected int getInputButtonWidth() {
return inputButtonWidth;
}
- int getInputButtonHeight() {
+ protected int getInputButtonHeight() {
return inputButtonHeight;
}
- int getInputMaxLines() {
+ protected int getInputMaxLines() {
return inputMaxLines;
}
- String getInputHint() {
+ protected String getInputHint() {
return inputHint;
}
- String getInputText() {
+ protected String getInputText() {
return inputText;
}
- int getInputTextSize() {
+ protected int getInputTextSize() {
return inputTextSize;
}
- int getInputTextColor() {
+ protected int getInputTextColor() {
return inputTextColor;
}
- int getInputHintColor() {
+ protected int getInputHintColor() {
return inputHintColor;
}
- Drawable getInputBackground() {
+ protected Drawable getInputBackground() {
return inputBackground;
}
- Drawable getInputCursorDrawable() {
+ protected Drawable getInputCursorDrawable() {
return inputCursorDrawable;
}
- int getInputDefaultPaddingLeft() {
+ protected int getInputDefaultPaddingLeft() {
return inputDefaultPaddingLeft;
}
- int getInputDefaultPaddingRight() {
+ protected int getInputDefaultPaddingRight() {
return inputDefaultPaddingRight;
}
- int getInputDefaultPaddingTop() {
+ protected int getInputDefaultPaddingTop() {
return inputDefaultPaddingTop;
}
- int getInputDefaultPaddingBottom() {
+ protected int getInputDefaultPaddingBottom() {
return inputDefaultPaddingBottom;
}
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
index 4e1ec338..0533f221 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
@@ -44,6 +44,7 @@
/**
* Adapter for {@link MessagesList}.
*/
+@SuppressWarnings("WeakerAccess")
public class MessagesListAdapter
extends RecyclerView.Adapter
implements RecyclerScrollMoreListener.OnLoadMoreListener {
@@ -55,7 +56,7 @@ public class MessagesListAdapter
private int selectedItemsCount;
private SelectionListener selectionListener;
- static boolean isSelectionModeEnabled;
+ protected static boolean isSelectionModeEnabled;
private OnLoadMoreListener loadMoreListener;
private OnMessageClickListener onMessageClickListener;
@@ -374,7 +375,8 @@ public void setOnMessageViewClickListener(OnMessageViewClickListener on
/**
* Registers click listener for view by id
- * @param viewId view
+ *
+ * @param viewId view
* @param onMessageViewClickListener click listener.
*/
public void registerViewClickListener(int viewId, OnMessageViewClickListener onMessageViewClickListener) {
@@ -601,8 +603,8 @@ void setStyle(MessagesListStyle style) {
* WRAPPER
* */
private class Wrapper {
- DATA item;
- boolean isSelected;
+ protected DATA item;
+ protected boolean isSelected;
Wrapper(DATA item) {
this.item = item;
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListStyle.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListStyle.java
index a1c06a59..88c6fe15 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListStyle.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListStyle.java
@@ -33,6 +33,7 @@
/**
* Style for MessagesListStyle customization by xml attributes
*/
+@SuppressWarnings("WeakerAccess")
class MessagesListStyle extends Style {
private int textAutoLinkMask;
@@ -230,55 +231,55 @@ private Drawable getMessageSelector(@ColorInt int normalColor, @ColorInt int sel
return drawable;
}
- int getTextAutoLinkMask() {
+ protected int getTextAutoLinkMask() {
return textAutoLinkMask;
}
- int getIncomingTextLinkColor() {
+ protected int getIncomingTextLinkColor() {
return incomingTextLinkColor;
}
- int getOutcomingTextLinkColor() {
+ protected int getOutcomingTextLinkColor() {
return outcomingTextLinkColor;
}
- int getIncomingAvatarWidth() {
+ protected int getIncomingAvatarWidth() {
return incomingAvatarWidth;
}
- int getIncomingAvatarHeight() {
+ protected int getIncomingAvatarHeight() {
return incomingAvatarHeight;
}
- int getIncomingDefaultBubblePaddingLeft() {
+ protected int getIncomingDefaultBubblePaddingLeft() {
return incomingDefaultBubblePaddingLeft;
}
- int getIncomingDefaultBubblePaddingRight() {
+ protected int getIncomingDefaultBubblePaddingRight() {
return incomingDefaultBubblePaddingRight;
}
- int getIncomingDefaultBubblePaddingTop() {
+ protected int getIncomingDefaultBubblePaddingTop() {
return incomingDefaultBubblePaddingTop;
}
- int getIncomingDefaultBubblePaddingBottom() {
+ protected int getIncomingDefaultBubblePaddingBottom() {
return incomingDefaultBubblePaddingBottom;
}
- int getIncomingTextColor() {
+ protected int getIncomingTextColor() {
return incomingTextColor;
}
- int getIncomingTextSize() {
+ protected int getIncomingTextSize() {
return incomingTextSize;
}
- int getIncomingTextStyle() {
+ protected int getIncomingTextStyle() {
return incomingTextStyle;
}
- Drawable getOutcomingBubbleDrawable() {
+ protected Drawable getOutcomingBubbleDrawable() {
if (outcomingBubbleDrawable == -1) {
return getMessageSelector(outcomingDefaultBubbleColor, outcomingDefaultBubbleSelectedColor,
outcomingDefaultBubblePressedColor, R.drawable.shape_outcoming_message);
@@ -287,7 +288,7 @@ Drawable getOutcomingBubbleDrawable() {
}
}
- Drawable getOutcomingImageOverlayDrawable() {
+ protected Drawable getOutcomingImageOverlayDrawable() {
if (outcomingImageOverlayDrawable == -1) {
return getMessageSelector(Color.TRANSPARENT, outcomingDefaultImageOverlaySelectedColor,
outcomingDefaultImageOverlayPressedColor, R.drawable.shape_outcoming_message);
@@ -296,103 +297,103 @@ Drawable getOutcomingImageOverlayDrawable() {
}
}
- int getOutcomingDefaultBubblePaddingLeft() {
+ protected int getOutcomingDefaultBubblePaddingLeft() {
return outcomingDefaultBubblePaddingLeft;
}
- int getOutcomingDefaultBubblePaddingRight() {
+ protected int getOutcomingDefaultBubblePaddingRight() {
return outcomingDefaultBubblePaddingRight;
}
- int getOutcomingDefaultBubblePaddingTop() {
+ protected int getOutcomingDefaultBubblePaddingTop() {
return outcomingDefaultBubblePaddingTop;
}
- int getOutcomingDefaultBubblePaddingBottom() {
+ protected int getOutcomingDefaultBubblePaddingBottom() {
return outcomingDefaultBubblePaddingBottom;
}
- int getOutcomingTextColor() {
+ protected int getOutcomingTextColor() {
return outcomingTextColor;
}
- int getOutcomingTextSize() {
+ protected int getOutcomingTextSize() {
return outcomingTextSize;
}
- int getOutcomingTextStyle() {
+ protected int getOutcomingTextStyle() {
return outcomingTextStyle;
}
- int getOutcomingTimeTextColor() {
+ protected int getOutcomingTimeTextColor() {
return outcomingTimeTextColor;
}
- int getOutcomingTimeTextSize() {
+ protected int getOutcomingTimeTextSize() {
return outcomingTimeTextSize;
}
- int getOutcomingTimeTextStyle() {
+ protected int getOutcomingTimeTextStyle() {
return outcomingTimeTextStyle;
}
- int getOutcomingImageTimeTextColor() {
+ protected int getOutcomingImageTimeTextColor() {
return outcomingImageTimeTextColor;
}
- int getOutcomingImageTimeTextSize() {
+ protected int getOutcomingImageTimeTextSize() {
return outcomingImageTimeTextSize;
}
- int getOutcomingImageTimeTextStyle() {
+ protected int getOutcomingImageTimeTextStyle() {
return outcomingImageTimeTextStyle;
}
- int getDateHeaderTextColor() {
+ protected int getDateHeaderTextColor() {
return dateHeaderTextColor;
}
- int getDateHeaderTextSize() {
+ protected int getDateHeaderTextSize() {
return dateHeaderTextSize;
}
- int getDateHeaderTextStyle() {
+ protected int getDateHeaderTextStyle() {
return dateHeaderTextStyle;
}
- int getDateHeaderPadding() {
+ protected int getDateHeaderPadding() {
return dateHeaderPadding;
}
- String getDateHeaderFormat() {
+ protected String getDateHeaderFormat() {
return dateHeaderFormat;
}
- int getIncomingTimeTextSize() {
+ protected int getIncomingTimeTextSize() {
return incomingTimeTextSize;
}
- int getIncomingTimeTextStyle() {
+ protected int getIncomingTimeTextStyle() {
return incomingTimeTextStyle;
}
- int getIncomingTimeTextColor() {
+ protected int getIncomingTimeTextColor() {
return incomingTimeTextColor;
}
- int getIncomingImageTimeTextColor() {
+ protected int getIncomingImageTimeTextColor() {
return incomingImageTimeTextColor;
}
- int getIncomingImageTimeTextSize() {
+ protected int getIncomingImageTimeTextSize() {
return incomingImageTimeTextSize;
}
- int getIncomingImageTimeTextStyle() {
+ protected int getIncomingImageTimeTextStyle() {
return incomingImageTimeTextStyle;
}
- Drawable getIncomingBubbleDrawable() {
+ protected Drawable getIncomingBubbleDrawable() {
if (incomingBubbleDrawable == -1) {
return getMessageSelector(incomingDefaultBubbleColor, incomingDefaultBubbleSelectedColor,
incomingDefaultBubblePressedColor, R.drawable.shape_incoming_message);
@@ -401,7 +402,7 @@ Drawable getIncomingBubbleDrawable() {
}
}
- Drawable getIncomingImageOverlayDrawable() {
+ protected Drawable getIncomingImageOverlayDrawable() {
if (incomingImageOverlayDrawable == -1) {
return getMessageSelector(Color.TRANSPARENT, incomingDefaultImageOverlaySelectedColor,
incomingDefaultImageOverlayPressedColor, R.drawable.shape_incoming_message);
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/utils/RoundedImageView.java b/chatkit/src/main/java/com/stfalcon/chatkit/utils/RoundedImageView.java
index 91e85142..7770fb13 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/utils/RoundedImageView.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/utils/RoundedImageView.java
@@ -21,6 +21,7 @@
import android.support.annotation.DimenRes;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
+import android.support.v7.widget.AppCompatImageView;
import android.util.AttributeSet;
import android.widget.ImageView;
@@ -28,7 +29,7 @@
* Thanks to Joonho Kim (https://github.com/pungrue26) for his lightweight SelectableRoundedImageView,
* that was used as default image message representation
*/
-public class RoundedImageView extends ImageView {
+public class RoundedImageView extends AppCompatImageView {
private int mResource = 0;
private Drawable mDrawable;
@@ -124,7 +125,7 @@ private void updateDrawable() {
((RoundedCornerDrawable) mDrawable).setCornerRadii(mRadii);
}
- static class RoundedCornerDrawable extends Drawable {
+ private static class RoundedCornerDrawable extends Drawable {
private RectF mBounds = new RectF();
private final RectF mBitmapRect = new RectF();
@@ -141,7 +142,7 @@ static class RoundedCornerDrawable extends Drawable {
private Bitmap mBitmap;
private boolean mBoundsConfigured = false;
- RoundedCornerDrawable(Bitmap bitmap, Resources r) {
+ private RoundedCornerDrawable(Bitmap bitmap, Resources r) {
mBitmap = bitmap;
mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
@@ -155,12 +156,12 @@ static class RoundedCornerDrawable extends Drawable {
mBitmapPaint.setShader(mBitmapShader);
}
- static RoundedCornerDrawable fromBitmap(Bitmap bitmap, Resources r) {
+ private static RoundedCornerDrawable fromBitmap(Bitmap bitmap, Resources r) {
if (bitmap != null) return new RoundedCornerDrawable(bitmap, r);
else return null;
}
- static Drawable fromDrawable(Drawable drawable, Resources r) {
+ private static Drawable fromDrawable(Drawable drawable, Resources r) {
if (drawable != null) {
if (drawable instanceof RoundedCornerDrawable) {
return drawable;
@@ -180,7 +181,7 @@ static Drawable fromDrawable(Drawable drawable, Resources r) {
return drawable;
}
- static Bitmap drawableToBitmap(Drawable drawable) {
+ private static Bitmap drawableToBitmap(Drawable drawable) {
if (drawable == null) return null;
if (drawable instanceof BitmapDrawable) {
From 7e3148c2744594138d6e6e473373786e37be06fe Mon Sep 17 00:00:00 2001
From: Harold Martin
Date: Thu, 20 Jul 2017 17:31:02 -0700
Subject: [PATCH 14/85] Added upsert(Message) method to add or update message
to adapter as appropriate Useful when connecting adapter directly to
streaming data source Changed update methods to return boolean
---
.../chatkit/messages/MessagesListAdapter.java | 20 ++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
index 0533f221..d5d957ad 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
@@ -178,8 +178,8 @@ public void addToEnd(List messages, boolean reverse) {
*
* @param message updated message object.
*/
- public void update(MESSAGE message) {
- update(message.getId(), message);
+ public boolean update(MESSAGE message) {
+ return update(message.getId(), message);
}
/**
@@ -188,12 +188,26 @@ public void update(MESSAGE message) {
* @param oldId an identifier of message to update.
* @param newMessage new message object.
*/
- public void update(String oldId, MESSAGE newMessage) {
+ public boolean update(String oldId, MESSAGE newMessage) {
int position = getMessagePositionById(oldId);
if (position >= 0) {
Wrapper element = new Wrapper<>(newMessage);
items.set(position, element);
notifyItemChanged(position);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Updates message by its id if it exists, add to start if not
+ *
+ * @param message message object to insert or update.
+ */
+ public void upsert(MESSAGE message) {
+ if (!update(message)) {
+ addToStart(message, false);
}
}
From 86b2a86102f57d460166504bdaa9dcaab0e94a0c Mon Sep 17 00:00:00 2001
From: Harold Martin
Date: Fri, 21 Jul 2017 14:57:19 -0700
Subject: [PATCH 15/85] remove application tag from manifest
---
chatkit/src/main/AndroidManifest.xml | 4 ----
1 file changed, 4 deletions(-)
diff --git a/chatkit/src/main/AndroidManifest.xml b/chatkit/src/main/AndroidManifest.xml
index 9f22fb31..1b8f973d 100644
--- a/chatkit/src/main/AndroidManifest.xml
+++ b/chatkit/src/main/AndroidManifest.xml
@@ -1,8 +1,4 @@
-
-
From a0d3cec62a5333b9cfe55ebe5cc66386e99412cf Mon Sep 17 00:00:00 2001
From: Mindaugas
Date: Fri, 4 Aug 2017 13:58:46 +0300
Subject: [PATCH 16/85] npe check in DialofsListAdapter.java for last message
when exists none
---
.../chatkit/dialogs/DialogsListAdapter.java | 21 ++++++++++++-------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index 9638ff7e..1a1c8851 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -584,26 +584,31 @@ public void onBind(final DIALOG dialog) {
//Set Date
String formattedDate = null;
- Date lastMessageDate = dialog.getLastMessage().getCreatedAt();
- if (datesFormatter != null) formattedDate = datesFormatter.format(lastMessageDate);
- tvDate.setText(formattedDate == null
- ? getDateString(lastMessageDate)
- : formattedDate);
+
+ if (dialog.getLastMessage() != null) {
+ Date lastMessageDate = dialog.getLastMessage().getCreatedAt();
+ if (datesFormatter != null) formattedDate = datesFormatter.format(lastMessageDate);
+ tvDate.setText(formattedDate == null
+ ? getDateString(lastMessageDate)
+ : formattedDate);
+ }
//Set Dialog avatar
if (imageLoader != null) {
imageLoader.loadImage(ivAvatar, dialog.getDialogPhoto());
}
- //Set Last message user avatar
- if (imageLoader != null) {
+ //Set Last message user avatar with check if there is last message
+ if (imageLoader != null && dialog.getLastMessage() != null) {
imageLoader.loadImage(ivLastMessageUser, dialog.getLastMessage().getUser().getAvatar());
}
ivLastMessageUser.setVisibility(dialogStyle.isDialogMessageAvatarEnabled()
&& dialog.getUsers().size() > 1 ? VISIBLE : GONE);
//Set Last message text
- tvLastMessage.setText(dialog.getLastMessage().getText());
+ if (dialog.getLastMessage() != null) {
+ tvLastMessage.setText(dialog.getLastMessage().getText());
+ }
//Set Unread message count bubble
tvBubble.setText(String.valueOf(dialog.getUnreadCount()));
From 25ec6be9ce373e941ebad9ff254d7cb9fc5962aa Mon Sep 17 00:00:00 2001
From: Philippe Auriach
Date: Wed, 9 Aug 2017 10:13:18 +0200
Subject: [PATCH 17/85] added get item by id method
---
.../chatkit/dialogs/DialogsListAdapter.java | 38 +++++++++++++++----
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index 9638ff7e..697ad343 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -19,6 +19,7 @@
import android.graphics.Typeface;
import android.graphics.drawable.GradientDrawable;
import android.support.annotation.LayoutRes;
+import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
import android.view.LayoutInflater;
@@ -245,6 +246,29 @@ public void updateItemById(DIALOG item) {
}
}
+ /**
+ * Find an item by its id
+ *
+ * @param id the wanted item's id
+ * @return the found item, or null
+ */
+ @Nullable
+ public DIALOG getItemById(String id) {
+ if (items == null) {
+ items = new ArrayList<>();
+ }
+ for (DIALOG item : items) {
+ if (item.getId() == null) {
+ if (id == null) {
+ return item;
+ }
+ } else if (item.getId().equals(id)) {
+ return item;
+ }
+ }
+ return null;
+ }
+
/**
* Update last message in dialog and swap item to top of list.
*
@@ -297,6 +321,13 @@ public void sort(Comparator comparator) {
notifyDataSetChanged();
}
+ /**
+ * @return registered image loader
+ */
+ public ImageLoader getImageLoader() {
+ return imageLoader;
+ }
+
/**
* Register a callback to be invoked when image need to load.
*
@@ -306,13 +337,6 @@ public void setImageLoader(ImageLoader imageLoader) {
this.imageLoader = imageLoader;
}
- /**
- * @return registered image loader
- */
- public ImageLoader getImageLoader() {
- return imageLoader;
- }
-
/**
* @return the item click callback.
*/
From b80f3a336a2702eb56191f206592e613b28420d0 Mon Sep 17 00:00:00 2001
From: Philippe Auriach
Date: Wed, 9 Aug 2017 10:38:49 +0200
Subject: [PATCH 18/85] allow moving an item from position x to position y
---
.../stfalcon/chatkit/dialogs/DialogsListAdapter.java | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index 697ad343..4fcad21e 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -214,6 +214,17 @@ public void addItem(int position, DIALOG dialog) {
notifyItemInserted(position);
}
+ /**
+ * Move an item
+ * @param fromPosition the actual position of the item
+ * @param toPosition the new position of the item
+ */
+ public void moveItem(int fromPosition, int toPosition) {
+ DIALOG dialog = items.remove(fromPosition);
+ items.add(toPosition, dialog);
+ notifyItemMoved(fromPosition, toPosition);
+ }
+
/**
* Update dialog by position in dialogs list
*
From f2e5cc7ce237130799b365ddd705448fe07b877e Mon Sep 17 00:00:00 2001
From: Philippe Auriach
Date: Wed, 9 Aug 2017 11:24:42 +0200
Subject: [PATCH 19/85] test jitpack compile
---
settings.gradle | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/settings.gradle b/settings.gradle
index f0f8043a..111c8fe5 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':sample', ':chatkit'
+include 'chatkit'
From f906bb2db76ce8bfe0ac6b6c06342eda937e7cc2 Mon Sep 17 00:00:00 2001
From: Philippe Auriach
Date: Wed, 9 Aug 2017 11:26:55 +0200
Subject: [PATCH 20/85] Revert "test jitpack compile"
This reverts commit f2e5cc7ce237130799b365ddd705448fe07b877e.
---
settings.gradle | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/settings.gradle b/settings.gradle
index 111c8fe5..f0f8043a 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include 'chatkit'
+include ':sample', ':chatkit'
From f268da6959a9081165a763bc9735cb73066755e2 Mon Sep 17 00:00:00 2001
From: Philippe Auriach
Date: Wed, 9 Aug 2017 14:49:42 +0200
Subject: [PATCH 21/85] please codebeat
---
.../com/stfalcon/chatkit/dialogs/DialogsListAdapter.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index 4fcad21e..78636868 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -269,11 +269,9 @@ public DIALOG getItemById(String id) {
items = new ArrayList<>();
}
for (DIALOG item : items) {
- if (item.getId() == null) {
- if (id == null) {
- return item;
- }
- } else if (item.getId().equals(id)) {
+ if (item.getId() == null && id == null) {
+ return item;
+ } else if (item.getId() != null && item.getId().equals(id)) {
return item;
}
}
From a0c43a728a8a0a4f478e73c6bf899ac58d231ee6 Mon Sep 17 00:00:00 2001
From: Iyanu Adelekan
Date: Tue, 21 Nov 2017 16:19:01 +0100
Subject: [PATCH 22/85] Made correction to DialogList documentation
A typographic error was made in the documentation for the DialogList component under the 'Prepare your model' section.
"IDialog" was written as "IDealog".
This pull request corrects that error.
---
docs/COMPONENT_DIALOGS_LIST.MD | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/COMPONENT_DIALOGS_LIST.MD b/docs/COMPONENT_DIALOGS_LIST.MD
index 673457b2..61bea52d 100644
--- a/docs/COMPONENT_DIALOGS_LIST.MD
+++ b/docs/COMPONENT_DIALOGS_LIST.MD
@@ -36,7 +36,7 @@ dialogsListView.setAdapter(dialogsListAdapter);
#### Prepare your model
-To be able to add dialog, you must implement the `IDealog` interface to your existing model and override its methods:
+To be able to add dialog, you must implement the `IDialog` interface to your existing model and override its methods:
```java
public class DefaultDialog implements IDialog {
From ca015bb774ccfca33ba1591c534f4327f60456bc Mon Sep 17 00:00:00 2001
From: Daniel Mathews
Date: Wed, 20 Dec 2017 18:22:21 -0800
Subject: [PATCH 23/85] Add nullable for getImageUrl()
Add the option for nullable to distinguish between a message and image. Useful for when using Kotlin.
---
.../com/stfalcon/chatkit/commons/models/MessageContentType.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/MessageContentType.java b/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/MessageContentType.java
index f5b63995..b8f2675a 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/MessageContentType.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/MessageContentType.java
@@ -16,6 +16,7 @@
package com.stfalcon.chatkit.commons.models;
+import android.support.annotation.Nullable;
import com.stfalcon.chatkit.messages.MessageHolders;
/*
@@ -32,6 +33,7 @@ public interface MessageContentType extends IMessage {
* Default media type for image message.
*/
interface Image extends IMessage {
+ @Nullable
String getImageUrl();
}
From 1044829af2dbb49546c6c19ec362ed85dc06734d Mon Sep 17 00:00:00 2001
From: Mohamed Alouane
Date: Sat, 17 Feb 2018 00:24:05 +0000
Subject: [PATCH 24/85] fix link in docs
---
docs/STYLES_ATTR.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/STYLES_ATTR.md b/docs/STYLES_ATTR.md
index df2075e4..790de29b 100644
--- a/docs/STYLES_ATTR.md
+++ b/docs/STYLES_ATTR.md
@@ -37,7 +37,7 @@
| `dialogItemBackground` | Sets background of dialogs items|
| `dialogItemBackground` | Sets background of dialogs items when has unread messages |
-## [MessagesList]](COMPONENT_MESSAGES_LIST.md) xml attributes:
+## [MessagesList](COMPONENT_MESSAGES_LIST.md) xml attributes:
| Attribute | Description|
| ------------- |-------------|
@@ -126,4 +126,4 @@
| `inputTextColor` | Sets input message text color|
| `inputHintColor` | Sets text color of hint in message input field|
| `inputBackground` | Sets background for input message view |
-| `inputCursorDrawable` | Sets cursor drawable for input message EditText |
\ No newline at end of file
+| `inputCursorDrawable` | Sets cursor drawable for input message EditText |
From 2fbf4dce2e19f3e40731c147aa1c1ebde3637047 Mon Sep 17 00:00:00 2001
From: Thibault Guegan
Date: Mon, 26 Feb 2018 11:21:25 +0000
Subject: [PATCH 25/85] wording
---
.../java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index 9638ff7e..8234133b 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -206,7 +206,7 @@ public void addItem(DIALOG dialog) {
* Add dialog to dialogs list
*
* @param dialog dialog item
- * @param position position in dialogs lost
+ * @param position position in dialogs list
*/
public void addItem(int position, DIALOG dialog) {
items.add(position, dialog);
From d93d0de20ed305eea71db9e0ea10dece98f5aef8 Mon Sep 17 00:00:00 2001
From: Christian Olcina <17082246+Sulfkain@users.noreply.github.com>
Date: Tue, 13 Mar 2018 17:39:57 +0100
Subject: [PATCH 26/85] Avoid Crash on empty list
If some empty list passed to insert at the end, will crash with a indexOutOfBounds.
To avoid this, it's recomended to add a check to see if the list is empty or not. And adding a @NotNull anotation to the param will be useful to use it with Kotlin.
If you don't like a "fast" return, do it with a tipical if.
---
.../java/com/stfalcon/chatkit/messages/MessagesListAdapter.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
index 0533f221..2cac43c2 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
@@ -157,6 +157,8 @@ public void addToStart(MESSAGE message, boolean scroll) {
* @param reverse {@code true} if need to reverse messages before adding.
*/
public void addToEnd(List messages, boolean reverse) {
+ if (messages.isEmpty()) return
+
if (reverse) Collections.reverse(messages);
if (!items.isEmpty()) {
From 2b806f3d95d5e5938ef27ee6a572e13667b7b026 Mon Sep 17 00:00:00 2001
From: "andrii.zhumela"
Date: Tue, 3 Jul 2018 14:41:53 +0300
Subject: [PATCH 27/85] update support library version
---
build.gradle | 8 ++++++++
chatkit/build.gradle | 10 +++++-----
sample/build.gradle | 17 ++++++++++++-----
3 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/build.gradle b/build.gradle
index 3c9f496e..0accc142 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,6 +3,10 @@
buildscript {
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com/'
+ name 'Google'
+ }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
@@ -16,6 +20,10 @@ buildscript {
allprojects {
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com/'
+ name 'Google'
+ }
}
}
diff --git a/chatkit/build.gradle b/chatkit/build.gradle
index 54b43859..6a94c06f 100644
--- a/chatkit/build.gradle
+++ b/chatkit/build.gradle
@@ -2,12 +2,12 @@ apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'
android {
- compileSdkVersion 25
- buildToolsVersion "25.0.2"
+ compileSdkVersion 27
+ buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 14
- targetSdkVersion 25
+ targetSdkVersion 27
versionCode 1
versionName "0.2.2"
@@ -31,8 +31,8 @@ publish {
}
ext {
- supportVersion = '25.3.1'
- flexboxVersion = '0.2.5'
+ supportVersion = '27.1.1'
+ flexboxVersion = '1.0.0'
}
dependencies {
diff --git a/sample/build.gradle b/sample/build.gradle
index 13d52cae..aea17b5c 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 25
- buildToolsVersion "25.0.2"
+ compileSdkVersion 27
+ buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.stfalcon.chatkit.sample"
minSdkVersion 14
- targetSdkVersion 25
+ targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -25,9 +25,9 @@ android {
}
ext {
- supportVersion = '25.3.1'
+ supportVersion = '27.1.1'
picassoVersion = '2.5.2'
- circleImageViewVersion = '2.1.0'
+ circleImageViewVersion = '2.2.0'
shapeImageViewVersion = '0.9.3'
circleindicatorVersion = '1.2.2@aar'
}
@@ -54,4 +54,11 @@ dependencies {
//Utils
compile "me.relex:circleindicator:$circleindicatorVersion"
+
+ compile "com.android.support:support-v4:$supportVersion"
+ compile "com.android.support:design:$supportVersion"
+ compile "com.android.support:support-vector-drawable:$supportVersion"
+ compile 'com.android.support.constraint:constraint-layout:1.1.2'
+ compile "com.android.support:gridlayout-v7:$supportVersion"
+ compile "com.android.support:recyclerview-v7:$supportVersion"
}
From 0a7287fcdf9114eb49db8c56938be0ec0c2a6c87 Mon Sep 17 00:00:00 2001
From: "andrii.zhumela"
Date: Tue, 3 Jul 2018 14:53:04 +0300
Subject: [PATCH 28/85] update gradle version version
---
build.gradle | 5 +++--
gradle/wrapper/gradle-wrapper.properties | 4 ++--
sample/build.gradle | 12 ++++++------
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/build.gradle b/build.gradle
index 0accc142..80103afe 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,10 +7,11 @@ buildscript {
url 'https://maven.google.com/'
name 'Google'
}
+ google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
- classpath 'com.novoda:bintray-release:0.4.0'
+ classpath 'com.android.tools.build:gradle:3.1.3'
+ classpath 'com.novoda:bintray-release:0.8.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index fb4882dc..d0edd216 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Thu Apr 06 11:02:19 EEST 2017
+#Tue Jul 03 14:43:10 EEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
diff --git a/sample/build.gradle b/sample/build.gradle
index aea17b5c..a3c9774d 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -55,10 +55,10 @@ dependencies {
//Utils
compile "me.relex:circleindicator:$circleindicatorVersion"
- compile "com.android.support:support-v4:$supportVersion"
- compile "com.android.support:design:$supportVersion"
- compile "com.android.support:support-vector-drawable:$supportVersion"
- compile 'com.android.support.constraint:constraint-layout:1.1.2'
- compile "com.android.support:gridlayout-v7:$supportVersion"
- compile "com.android.support:recyclerview-v7:$supportVersion"
+ implementation "com.android.support:support-v4:$supportVersion"
+ implementation "com.android.support:design:$supportVersion"
+ implementation "com.android.support:support-vector-drawable:$supportVersion"
+ implementation 'com.android.support.constraint:constraint-layout:1.1.2'
+ implementation "com.android.support:gridlayout-v7:$supportVersion"
+ implementation "com.android.support:recyclerview-v7:$supportVersion"
}
From c31034838543d370cfa41d8d0e4673efe14122f5 Mon Sep 17 00:00:00 2001
From: "andrii.zhumela"
Date: Tue, 3 Jul 2018 15:06:59 +0300
Subject: [PATCH 29/85] remove old command from gradle
---
chatkit/build.gradle | 6 +++---
sample/build.gradle | 24 +++++++++---------------
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/chatkit/build.gradle b/chatkit/build.gradle
index 6a94c06f..09ca8a04 100644
--- a/chatkit/build.gradle
+++ b/chatkit/build.gradle
@@ -38,7 +38,7 @@ ext {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- compile "com.android.support:appcompat-v7:$supportVersion"
- compile "com.android.support:design:$supportVersion"
- compile "com.google.android:flexbox:$flexboxVersion"
+ implementation "com.android.support:appcompat-v7:$supportVersion"
+ implementation "com.android.support:design:$supportVersion"
+ implementation "com.google.android:flexbox:$flexboxVersion"
}
diff --git a/sample/build.gradle b/sample/build.gradle
index a3c9774d..2799ea4d 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -36,29 +36,23 @@ dependencies {
compile project(':chatkit')
compile fileTree(dir: 'libs', include: ['*.jar'])
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
- testCompile 'junit:junit:4.12'
+ testImplementation 'junit:junit:4.12'
- compile "com.android.support:appcompat-v7:$supportVersion"
- compile "com.android.support:cardview-v7:$supportVersion"
- compile "com.android.support:design:$supportVersion"
+ implementation "com.android.support:appcompat-v7:$supportVersion"
+ implementation "com.android.support:cardview-v7:$supportVersion"
+ implementation "com.android.support:design:$supportVersion"
//Picasso
- compile "com.squareup.picasso:picasso:$picassoVersion"
+ implementation "com.squareup.picasso:picasso:$picassoVersion"
//ImageViews
- compile "de.hdodenhof:circleimageview:$circleImageViewVersion"
- compile "com.github.siyamed:android-shape-imageview:$shapeImageViewVersion"
+ implementation "de.hdodenhof:circleimageview:$circleImageViewVersion"
+ implementation "com.github.siyamed:android-shape-imageview:$shapeImageViewVersion"
//Utils
- compile "me.relex:circleindicator:$circleindicatorVersion"
+ implementation "me.relex:circleindicator:$circleindicatorVersion"
- implementation "com.android.support:support-v4:$supportVersion"
- implementation "com.android.support:design:$supportVersion"
- implementation "com.android.support:support-vector-drawable:$supportVersion"
- implementation 'com.android.support.constraint:constraint-layout:1.1.2'
- implementation "com.android.support:gridlayout-v7:$supportVersion"
- implementation "com.android.support:recyclerview-v7:$supportVersion"
}
From 8511efd0cd8ac233e828c6d99eb1fa2e2a035da4 Mon Sep 17 00:00:00 2001
From: "andrii.zhumela"
Date: Tue, 3 Jul 2018 15:09:45 +0300
Subject: [PATCH 30/85] remove old tags from gradle
---
chatkit/build.gradle | 3 +--
sample/build.gradle | 5 ++---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/chatkit/build.gradle b/chatkit/build.gradle
index 09ca8a04..2d058c2f 100644
--- a/chatkit/build.gradle
+++ b/chatkit/build.gradle
@@ -7,7 +7,6 @@ android {
defaultConfig {
minSdkVersion 14
- targetSdkVersion 27
versionCode 1
versionName "0.2.2"
@@ -36,7 +35,7 @@ ext {
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:design:$supportVersion"
diff --git a/sample/build.gradle b/sample/build.gradle
index 2799ea4d..dbed4d4e 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -6,7 +6,6 @@ android {
defaultConfig {
applicationId "com.stfalcon.chatkit.sample"
minSdkVersion 14
- targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -33,9 +32,9 @@ ext {
}
dependencies {
- compile project(':chatkit')
+ implementation project(':chatkit')
- compile fileTree(dir: 'libs', include: ['*.jar'])
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
From bafd2e19069a3f0ce7efd410c593ff287a6caade Mon Sep 17 00:00:00 2001
From: Anton
Date: Tue, 10 Jul 2018 11:14:29 +0300
Subject: [PATCH 31/85] Fixed artifacts on some devices in ShapeImageView.
Changed fixture message image.
---
.../stfalcon/chatkit/utils/ShapeImageView.java | 15 +++++++++++----
.../sample/common/data/fixtures/FixturesData.java | 2 +-
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/utils/ShapeImageView.java b/chatkit/src/main/java/com/stfalcon/chatkit/utils/ShapeImageView.java
index d9717f64..b9f054c5 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/utils/ShapeImageView.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/utils/ShapeImageView.java
@@ -20,21 +20,23 @@
import android.graphics.Canvas;
import android.graphics.Path;
import android.util.AttributeSet;
-import android.widget.ImageView;
+import android.view.View;
/**
* ImageView with mask what described with Bézier Curves
*/
-public class ShapeImageView extends ImageView {
+public class ShapeImageView extends android.support.v7.widget.AppCompatImageView {
private Path path;
public ShapeImageView(Context context) {
super(context);
+ setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
public ShapeImageView(Context context, AttributeSet attrs) {
super(context, attrs);
+ setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
@Override
@@ -56,9 +58,14 @@ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
@Override
protected void onDraw(Canvas canvas) {
- if (canvas != null) {
- canvas.clipPath(path);
+ if (path.isEmpty()) {
super.onDraw(canvas);
+ return;
}
+
+ int saveCount = canvas.save();
+ canvas.clipPath(path);
+ super.onDraw(canvas);
+ canvas.restoreToCount(saveCount);
}
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/common/data/fixtures/FixturesData.java b/sample/src/main/java/com/stfalcon/chatkit/sample/common/data/fixtures/FixturesData.java
index 6f7d35bc..ead984e3 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/common/data/fixtures/FixturesData.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/common/data/fixtures/FixturesData.java
@@ -71,7 +71,7 @@ abstract class FixturesData {
static final ArrayList images = new ArrayList() {
{
add("https://habrastorage.org/getpro/habr/post_images/e4b/067/b17/e4b067b17a3e414083f7420351db272b.jpg");
- add("http://www.designboom.com/wp-content/uploads/2015/11/stefano-boeri-architetti-vertical-forest-residential-tower-lausanne-switzerland-designboom-01.jpg");
+ add("https://cdn.pixabay.com/photo/2017/12/25/17/48/waters-3038803_1280.jpg");
}
};
From bad7494fc78777f4640880c4915279063162ef2f Mon Sep 17 00:00:00 2001
From: Anton
Date: Tue, 10 Jul 2018 12:34:46 +0300
Subject: [PATCH 32/85] Version 0.2.3
---
chatkit/build.gradle | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/chatkit/build.gradle b/chatkit/build.gradle
index 2d058c2f..9b5ab0ed 100644
--- a/chatkit/build.gradle
+++ b/chatkit/build.gradle
@@ -8,7 +8,7 @@ android {
defaultConfig {
minSdkVersion 14
versionCode 1
- versionName "0.2.2"
+ versionName "0.2.3"
consumerProguardFiles 'proguard.txt'
}
@@ -22,7 +22,7 @@ android {
publish {
groupId = 'com.github.stfalcon'
artifactId = 'chatkit'
- publishVersion = '0.2.2'
+ publishVersion = '0.2.3'
desc = 'ChatKit - is a library designed to simplify the development of UI for such a trivial task as chat. It have flexible possibilities for styling, customizing and data management'
licences = ['Apache-2.0']
uploadName = 'ChatKit'
From 91fd6997c2cb51e7a91628a0096e7c4a79e6e63d Mon Sep 17 00:00:00 2001
From: Anton
Date: Tue, 10 Jul 2018 12:38:22 +0300
Subject: [PATCH 33/85] hot fix
---
.../java/com/stfalcon/chatkit/messages/MessagesListAdapter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
index 2cac43c2..4f0ee777 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
@@ -157,7 +157,7 @@ public void addToStart(MESSAGE message, boolean scroll) {
* @param reverse {@code true} if need to reverse messages before adding.
*/
public void addToEnd(List messages, boolean reverse) {
- if (messages.isEmpty()) return
+ if (messages.isEmpty()) return;
if (reverse) Collections.reverse(messages);
From 784766caf3789875a0332bb9d71bb5d97d88f3fe Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Tue, 10 Jul 2018 12:42:06 +0300
Subject: [PATCH 34/85] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index bb59cb6d..b40aaf8d 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ To implement all of the features above you can use the following components:
Download via Gradle:
```gradle
-compile 'com.github.stfalcon:chatkit:0.2.2'
+compile 'com.github.stfalcon:chatkit:0.2.3'
```
or Maven:
@@ -51,7 +51,7 @@ or Maven:
com.github.stfalcon
chatkit
- 0.2.2
+ 0.2.3
pom
```
From 9f3ebe2d745dd7c85c9e06135d54cc31ff3396a5 Mon Sep 17 00:00:00 2001
From: Anton
Date: Tue, 10 Jul 2018 14:32:14 +0300
Subject: [PATCH 35/85] Fixed Add attachments button in default view demo
---
.../sample/features/demo/def/DefaultMessagesActivity.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
index f4fd9b36..86b8ee8f 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
@@ -34,6 +34,7 @@ protected void onCreate(Bundle savedInstanceState) {
MessageInput input = (MessageInput) findViewById(R.id.input);
input.setInputListener(this);
+ input.setAttachmentsListener(this);
}
@Override
From 5a22499e55e281b3abf643fe3b8e9e43f72dd23a Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Tue, 10 Jul 2018 14:39:59 +0300
Subject: [PATCH 36/85] Create LICENSE
---
LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 201 insertions(+)
create mode 100644 LICENSE
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..261eeb9e
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
From 9b0abf37aed276420b23fb5eeb1ae4ef3b88a9c8 Mon Sep 17 00:00:00 2001
From: Anton
Date: Wed, 11 Jul 2018 11:01:18 +0300
Subject: [PATCH 37/85] Merge branch 'add_typing_listener' of
https://github.com/toanpv/ChatKit into toanpv-add_typing_listener
# Conflicts:
# docs/STYLES_ATTR.md
# sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
---
.../sample/features/demo/def/DefaultMessagesActivity.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
index 847fc76c..f13b839f 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
@@ -3,8 +3,8 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.util.Log;
import android.view.View;
-import android.widget.Toast;
import com.stfalcon.chatkit.messages.MessageInput;
import com.stfalcon.chatkit.messages.MessagesList;
@@ -71,11 +71,11 @@ public void onMessageViewClick(View view, Message message) {
@Override
public void onStartTyping() {
- Toast.makeText(this, R.string.start_typing_status, Toast.LENGTH_SHORT).show();
+ Log.v("Typing listener", getString(R.string.start_typing_status));
}
@Override
public void onStopTyping() {
- Toast.makeText(this, R.string.stop_typing_status, Toast.LENGTH_SHORT).show();
+ Log.v("Typing listener", getString(R.string.stop_typing_status));
}
}
From da51c5f15f707c64e8fd1acca0b9cc3fed61c06e Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Wed, 11 Jul 2018 11:51:23 +0300
Subject: [PATCH 38/85] Update LICENSE
---
LICENSE | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LICENSE b/LICENSE
index 261eeb9e..de57238b 100644
--- a/LICENSE
+++ b/LICENSE
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright [yyyy] [name of copyright owner]
+ Copyright 2018 stfalcon.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
From 6848a6e09930fe96d2e9370b3c311399e197776f Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Wed, 11 Jul 2018 11:54:15 +0300
Subject: [PATCH 39/85] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index b40aaf8d..d4a56118 100644
--- a/README.md
+++ b/README.md
@@ -79,7 +79,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-http://www.apache.org/licenses/LICENSE-2.0
+https://github.com/stfalcon-studio/ChatKit/blob/master/LICENSE
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
From 95fc88e83c3119bc1466098d3069cb6c4059c65c Mon Sep 17 00:00:00 2001
From: Anton
Date: Wed, 11 Jul 2018 11:56:08 +0300
Subject: [PATCH 40/85] Fixed artifacts with bubble background in message list.
DialogList: reverseLayout=false for default
---
.../main/java/com/stfalcon/chatkit/dialogs/DialogsList.java | 2 +-
.../main/java/com/stfalcon/chatkit/messages/MessagesList.java | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsList.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsList.java
index 55f531af..6336203d 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsList.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsList.java
@@ -75,7 +75,7 @@ public void setAdapter(Adapter adapter) {
*/
public
void setAdapter(DialogsListAdapter adapter) {
- setAdapter(adapter, true);
+ setAdapter(adapter, false);
}
/**
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesList.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesList.java
index 17b3f8ed..e68f0906 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesList.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesList.java
@@ -23,6 +23,7 @@
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SimpleItemAnimator;
import android.util.AttributeSet;
+import android.view.View;
import com.stfalcon.chatkit.commons.models.IMessage;
@@ -34,16 +35,19 @@ public class MessagesList extends RecyclerView {
public MessagesList(Context context) {
super(context);
+ setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
public MessagesList(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
parseStyle(context, attrs);
+ setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
public MessagesList(Context context, @Nullable AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
parseStyle(context, attrs);
+ setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
/**
From 208e3e8b2bb9520a02448adb4e13c4fbbcb7402a Mon Sep 17 00:00:00 2001
From: Anton
Date: Wed, 11 Jul 2018 12:04:38 +0300
Subject: [PATCH 41/85] MessageListAdapter: added notifyDataSetChanged to
method "clear"
---
.../chatkit/messages/MessagesListAdapter.java | 25 +++++++++++--------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
index e45a50e4..ff8aa0b8 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
@@ -128,8 +128,8 @@ public void onLoadMore(int page, int total) {
}
/*
- * PUBLIC METHODS
- * */
+ * PUBLIC METHODS
+ * */
/**
* Adds message to bottom of list and scroll if needed.
@@ -158,7 +158,7 @@ public void addToStart(MESSAGE message, boolean scroll) {
*/
public void addToEnd(List messages, boolean reverse) {
if (messages.isEmpty()) return;
-
+
if (reverse) Collections.reverse(messages);
if (!items.isEmpty()) {
@@ -205,7 +205,7 @@ public boolean update(String oldId, MESSAGE newMessage) {
/**
* Updates message by its id if it exists, add to start if not
*
- * @param message message object to insert or update.
+ * @param message message object to insert or update.
*/
public void upsert(MESSAGE message) {
if (!update(message)) {
@@ -277,7 +277,10 @@ public boolean isEmpty() {
* Clears the messages list.
*/
public void clear() {
- items.clear();
+ if (items != null) {
+ items.clear();
+ notifyDataSetChanged();
+ }
}
/**
@@ -434,8 +437,8 @@ public void setDateHeadersFormatter(DateFormatter.Formatter dateHeadersFormatter
}
/*
- * PRIVATE METHODS
- * */
+ * PRIVATE METHODS
+ * */
private void recountDateHeaders() {
List indicesToDelete = new ArrayList<>();
@@ -616,8 +619,8 @@ void setStyle(MessagesListStyle style) {
}
/*
- * WRAPPER
- * */
+ * WRAPPER
+ * */
private class Wrapper {
protected DATA item;
protected boolean isSelected;
@@ -628,8 +631,8 @@ private class Wrapper {
}
/*
- * LISTENERS
- * */
+ * LISTENERS
+ * */
/**
* Interface definition for a callback to be invoked when next part of messages need to be loaded.
From 3461ab348867d6db7e165330a6779f2aa7592b1c Mon Sep 17 00:00:00 2001
From: Anton
Date: Wed, 11 Jul 2018 14:35:32 +0300
Subject: [PATCH 42/85] Fixed bug "The totalItemsCount parameter in OnLoadMore
callback contains date header." Issue #86 Added separate method
MessagesListAdapter.clear(notifyDataSetChanged). Method
MessagesListAdapter.clear() does notifyDataSetChanged by default. Issue #89
---
.../chatkit/messages/MessagesListAdapter.java | 28 ++++++++++++++++---
.../messages/RecyclerScrollMoreListener.java | 4 ++-
.../features/demo/DemoMessagesActivity.java | 2 ++
3 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
index ff8aa0b8..cbc403d2 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
@@ -49,6 +49,8 @@ public class MessagesListAdapter
extends RecyclerView.Adapter
implements RecyclerScrollMoreListener.OnLoadMoreListener {
+ protected static boolean isSelectionModeEnabled;
+
private MessageHolders holders;
private String senderId;
private List items;
@@ -56,8 +58,6 @@ public class MessagesListAdapter
private int selectedItemsCount;
private SelectionListener selectionListener;
- protected static boolean isSelectionModeEnabled;
-
private OnLoadMoreListener loadMoreListener;
private OnMessageClickListener onMessageClickListener;
private OnMessageViewClickListener onMessageViewClickListener;
@@ -127,6 +127,17 @@ public void onLoadMore(int page, int total) {
}
}
+ @Override
+ public int getMessagesCount() {
+ int count = 0;
+ for (Wrapper item : items) {
+ if (item.item instanceof IMessage) {
+ count++;
+ }
+ }
+ return count;
+ }
+
/*
* PUBLIC METHODS
* */
@@ -274,12 +285,21 @@ public boolean isEmpty() {
}
/**
- * Clears the messages list.
+ * Clears the messages list. With notifyDataSetChanged
*/
public void clear() {
+ clear(true);
+ }
+
+ /**
+ * Clears the messages list.
+ */
+ public void clear(boolean notifyDataSetChanged) {
if (items != null) {
items.clear();
- notifyDataSetChanged();
+ if (notifyDataSetChanged) {
+ notifyDataSetChanged();
+ }
}
}
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/RecyclerScrollMoreListener.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/RecyclerScrollMoreListener.java
index 92cffc38..00012084 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/RecyclerScrollMoreListener.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/RecyclerScrollMoreListener.java
@@ -79,7 +79,7 @@ public void onScrolled(RecyclerView view, int dx, int dy) {
int visibleThreshold = 5;
if (!loading && (lastVisibleItemPosition + visibleThreshold) > totalItemCount) {
currentPage++;
- loadMoreListener.onLoadMore(currentPage, totalItemCount);
+ loadMoreListener.onLoadMore(loadMoreListener.getMessagesCount(), totalItemCount);
loading = true;
}
}
@@ -87,5 +87,7 @@ public void onScrolled(RecyclerView view, int dx, int dy) {
interface OnLoadMoreListener {
void onLoadMore(int page, int total);
+
+ int getMessagesCount();
}
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java
index 0fedc8cf..310f9444 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java
@@ -4,6 +4,7 @@
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ImageView;
@@ -89,6 +90,7 @@ public void onBackPressed() {
@Override
public void onLoadMore(int page, int totalItemsCount) {
+ Log.i("TAG", "onLoadMore: " + page + " " + totalItemsCount);
if (totalItemsCount < TOTAL_MESSAGES_COUNT) {
loadMessages();
}
From 351e23cee8819943f636206af54d9f4d12bd54eb Mon Sep 17 00:00:00 2001
From: Anton
Date: Wed, 11 Jul 2018 14:52:45 +0300
Subject: [PATCH 43/85] v0.3.0
---
chatkit/build.gradle | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/chatkit/build.gradle b/chatkit/build.gradle
index 9b5ab0ed..0e785c17 100644
--- a/chatkit/build.gradle
+++ b/chatkit/build.gradle
@@ -8,7 +8,7 @@ android {
defaultConfig {
minSdkVersion 14
versionCode 1
- versionName "0.2.3"
+ versionName "0.3.0"
consumerProguardFiles 'proguard.txt'
}
@@ -22,7 +22,7 @@ android {
publish {
groupId = 'com.github.stfalcon'
artifactId = 'chatkit'
- publishVersion = '0.2.3'
+ publishVersion = '0.3.0'
desc = 'ChatKit - is a library designed to simplify the development of UI for such a trivial task as chat. It have flexible possibilities for styling, customizing and data management'
licences = ['Apache-2.0']
uploadName = 'ChatKit'
From 160dff9bba1077a0492a59d2e2285037ecb11eb7 Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Wed, 11 Jul 2018 15:01:48 +0300
Subject: [PATCH 44/85] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index d4a56118..d4d31d5c 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ To implement all of the features above you can use the following components:
Download via Gradle:
```gradle
-compile 'com.github.stfalcon:chatkit:0.2.3'
+compile 'com.github.stfalcon:chatkit:0.3.0'
```
or Maven:
@@ -51,7 +51,7 @@ or Maven:
com.github.stfalcon
chatkit
- 0.2.3
+ 0.3.0
pom
```
From 0c3083a8cb5e18aa8175c98bc2f35a5dd690b4d2 Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Fri, 13 Jul 2018 10:21:09 +0300
Subject: [PATCH 45/85] Update CHANGELOG.md
---
docs/CHANGELOG.md | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 0c0bb994..78ae166c 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -1,3 +1,20 @@
+## Version 0.3.0 (2018/07/12)
+* [Added Typing Listener to MessageInput](https://github.com/stfalcon-studio/ChatKit/blob/master/docs/COMPONENT_MESSAGE_INPUT.MD#typing-listener). Thanks to [toanpv](https://github.com/toanpv);
+* Fixed artifacts with bubble background in message list;
+* Added separate method MessagesListAdapter.clear(notifyDataSetChanged). Method MessagesListAdapter.clear() does notifyDataSetChanged by default. [#89](https://github.com/stfalcon-studio/ChatKit/issues/86);
+* Fixed "The totalItemsCount parameter in OnLoadMore callback contains date header." [#86](https://github.com/stfalcon-studio/ChatKit/issues/86);
+* Merged pull requests:
+ * Avoid Crash on empty list in addToEnd [#146](https://github.com/stfalcon-studio/ChatKit/pull/146);
+ * Fix link typo in docs [#134](https://github.com/stfalcon-studio/ChatKit/pull/134);
+ * Add nullable for getImageUrl() [#119](https://github.com/stfalcon-studio/ChatKit/pull/119);
+ * Made correction to DialogList documentation [#112](https://github.com/stfalcon-studio/ChatKit/pull/112);
+ * Allow moving Dialog item and get Dialog by id [#70](https://github.com/stfalcon-studio/ChatKit/pull/70);
+ * Allow the user to get the current position of a DIALOG [#32](https://github.com/stfalcon-studio/ChatKit/pull/32);
+ * Added upsert(Message) method to add or update message to adapter as appropriate [#61](https://github.com/stfalcon-studio/ChatKit/pull/61);
+ * Create LICENSE [#167](https://github.com/stfalcon-studio/ChatKit/pull/167);
+ * NPE check in DialofsListAdapter.java when there is no last message (is null) [#75](https://github.com/stfalcon-studio/ChatKit/pull/75);
+* Sample: Fixed artifacts on some devices in ShapeImageView. Changed fixture message image.
+
## Version 0.2.0 (2017/04/07)
* [Default image type](COMPONENT_MESSAGES_LIST.md#adding-image-message);
From 1c17fcc2e9ccf6ed7a3cd4c03f79d0c226b8adb9 Mon Sep 17 00:00:00 2001
From: Joost Funke Kupper
Date: Fri, 3 Aug 2018 10:26:41 +1000
Subject: [PATCH 46/85] Removal of forced software layer rendering
---
.../main/java/com/stfalcon/chatkit/messages/MessagesList.java | 4 ----
1 file changed, 4 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesList.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesList.java
index e68f0906..17b3f8ed 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesList.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesList.java
@@ -23,7 +23,6 @@
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SimpleItemAnimator;
import android.util.AttributeSet;
-import android.view.View;
import com.stfalcon.chatkit.commons.models.IMessage;
@@ -35,19 +34,16 @@ public class MessagesList extends RecyclerView {
public MessagesList(Context context) {
super(context);
- setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
public MessagesList(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
parseStyle(context, attrs);
- setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
public MessagesList(Context context, @Nullable AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
parseStyle(context, attrs);
- setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
/**
From 123f9ac2aef8176f56cb74328cb8c3a2b5c467a0 Mon Sep 17 00:00:00 2001
From: Anton
Date: Thu, 16 Aug 2018 09:52:08 +0300
Subject: [PATCH 47/85] add ability to passing custom data to ViewHolder.
Version 0.3.1
---
chatkit/build.gradle | 4 +-
.../chatkit/messages/MessageHolders.java | 349 +++++++++++++++---
.../holder/CustomHolderMessagesActivity.java | 16 +-
.../CustomIncomingTextMessageViewHolder.java | 23 +-
4 files changed, 345 insertions(+), 47 deletions(-)
diff --git a/chatkit/build.gradle b/chatkit/build.gradle
index 0e785c17..f970a58f 100644
--- a/chatkit/build.gradle
+++ b/chatkit/build.gradle
@@ -8,7 +8,7 @@ android {
defaultConfig {
minSdkVersion 14
versionCode 1
- versionName "0.3.0"
+ versionName "0.3.1"
consumerProguardFiles 'proguard.txt'
}
@@ -22,7 +22,7 @@ android {
publish {
groupId = 'com.github.stfalcon'
artifactId = 'chatkit'
- publishVersion = '0.3.0'
+ publishVersion = '0.3.1'
desc = 'ChatKit - is a library designed to simplify the development of UI for such a trivial task as chat. It have flexible possibilities for styling, customizing and data management'
licences = ['Apache-2.0']
uploadName = 'ChatKit'
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
index 8f126cd3..0437b54b 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
@@ -73,6 +73,24 @@ public MessageHolders setIncomingTextConfig(
return this;
}
+ /**
+ * Sets both of custom view holder class and layout resource for incoming text message.
+ *
+ * @param holder holder class.
+ * @param layout layout resource.
+ * @param payload custom data.
+ * @return {@link MessageHolders} for subsequent configuration.
+ */
+ public MessageHolders setIncomingTextConfig(
+ @NonNull Class extends BaseMessageViewHolder extends IMessage>> holder,
+ @LayoutRes int layout,
+ Object payload) {
+ this.incomingTextConfig.holder = holder;
+ this.incomingTextConfig.layout = layout;
+ this.incomingTextConfig.payload = payload;
+ return this;
+ }
+
/**
* Sets custom view holder class for incoming text message.
*
@@ -85,6 +103,21 @@ public MessageHolders setIncomingTextHolder(
return this;
}
+ /**
+ * Sets custom view holder class for incoming text message.
+ *
+ * @param holder holder class.
+ * @param payload custom data.
+ * @return {@link MessageHolders} for subsequent configuration.
+ */
+ public MessageHolders setIncomingTextHolder(
+ @NonNull Class extends BaseMessageViewHolder extends IMessage>> holder,
+ Object payload) {
+ this.incomingTextConfig.holder = holder;
+ this.incomingTextConfig.payload = payload;
+ return this;
+ }
+
/**
* Sets custom layout resource for incoming text message.
*
@@ -96,6 +129,19 @@ public MessageHolders setIncomingTextLayout(@LayoutRes int layout) {
return this;
}
+ /**
+ * Sets custom layout resource for incoming text message.
+ *
+ * @param layout layout resource.
+ * @param payload custom data.
+ * @return {@link MessageHolders} for subsequent configuration.
+ */
+ public MessageHolders setIncomingTextLayout(@LayoutRes int layout, Object payload) {
+ this.incomingTextConfig.layout = layout;
+ this.incomingTextConfig.payload = payload;
+ return this;
+ }
+
/**
* Sets both of custom view holder class and layout resource for outcoming text message.
*
@@ -111,6 +157,24 @@ public MessageHolders setOutcomingTextConfig(
return this;
}
+ /**
+ * Sets both of custom view holder class and layout resource for outcoming text message.
+ *
+ * @param holder holder class.
+ * @param layout layout resource.
+ * @param payload custom data.
+ * @return {@link MessageHolders} for subsequent configuration.
+ */
+ public MessageHolders setOutcomingTextConfig(
+ @NonNull Class extends BaseMessageViewHolder extends IMessage>> holder,
+ @LayoutRes int layout,
+ Object payload) {
+ this.outcomingTextConfig.holder = holder;
+ this.outcomingTextConfig.layout = layout;
+ this.outcomingTextConfig.payload = payload;
+ return this;
+ }
+
/**
* Sets custom view holder class for outcoming text message.
*
@@ -123,6 +187,21 @@ public MessageHolders setOutcomingTextHolder(
return this;
}
+ /**
+ * Sets custom view holder class for outcoming text message.
+ *
+ * @param holder holder class.
+ * @param payload custom data.
+ * @return {@link MessageHolders} for subsequent configuration.
+ */
+ public MessageHolders setOutcomingTextHolder(
+ @NonNull Class extends BaseMessageViewHolder extends IMessage>> holder,
+ Object payload) {
+ this.outcomingTextConfig.holder = holder;
+ this.outcomingTextConfig.payload = payload;
+ return this;
+ }
+
/**
* Sets custom layout resource for outcoming text message.
*
@@ -134,6 +213,19 @@ public MessageHolders setOutcomingTextLayout(@LayoutRes int layout) {
return this;
}
+ /**
+ * Sets custom layout resource for outcoming text message.
+ *
+ * @param layout layout resource.
+ * @param payload custom data.
+ * @return {@link MessageHolders} for subsequent configuration.
+ */
+ public MessageHolders setOutcomingTextLayout(@LayoutRes int layout, Object payload) {
+ this.outcomingTextConfig.layout = layout;
+ this.outcomingTextConfig.payload = payload;
+ return this;
+ }
+
/**
* Sets both of custom view holder class and layout resource for incoming image message.
*
@@ -149,6 +241,24 @@ public MessageHolders setIncomingImageConfig(
return this;
}
+ /**
+ * Sets both of custom view holder class and layout resource for incoming image message.
+ *
+ * @param holder holder class.
+ * @param layout layout resource.
+ * @param payload custom data.
+ * @return {@link MessageHolders} for subsequent configuration.
+ */
+ public MessageHolders setIncomingImageConfig(
+ @NonNull Class extends BaseMessageViewHolder extends MessageContentType.Image>> holder,
+ @LayoutRes int layout,
+ Object payload) {
+ this.incomingImageConfig.holder = holder;
+ this.incomingImageConfig.layout = layout;
+ this.incomingImageConfig.payload = payload;
+ return this;
+ }
+
/**
* Sets custom view holder class for incoming image message.
*
@@ -161,6 +271,21 @@ public MessageHolders setIncomingImageHolder(
return this;
}
+ /**
+ * Sets custom view holder class for incoming image message.
+ *
+ * @param holder holder class.
+ * @param payload custom data.
+ * @return {@link MessageHolders} for subsequent configuration.
+ */
+ public MessageHolders setIncomingImageHolder(
+ @NonNull Class extends BaseMessageViewHolder extends MessageContentType.Image>> holder,
+ Object payload) {
+ this.incomingImageConfig.holder = holder;
+ this.incomingImageConfig.payload = payload;
+ return this;
+ }
+
/**
* Sets custom layout resource for incoming image message.
*
@@ -172,6 +297,19 @@ public MessageHolders setIncomingImageLayout(@LayoutRes int layout) {
return this;
}
+ /**
+ * Sets custom layout resource for incoming image message.
+ *
+ * @param layout layout resource.
+ * @param payload custom data.
+ * @return {@link MessageHolders} for subsequent configuration.
+ */
+ public MessageHolders setIncomingImageLayout(@LayoutRes int layout, Object payload) {
+ this.incomingImageConfig.layout = layout;
+ this.incomingImageConfig.payload = payload;
+ return this;
+ }
+
/**
* Sets both of custom view holder class and layout resource for outcoming image message.
*
@@ -187,6 +325,24 @@ public MessageHolders setOutcomingImageConfig(
return this;
}
+ /**
+ * Sets both of custom view holder class and layout resource for outcoming image message.
+ *
+ * @param holder holder class.
+ * @param layout layout resource.
+ * @param payload custom data.
+ * @return {@link MessageHolders} for subsequent configuration.
+ */
+ public MessageHolders setOutcomingImageConfig(
+ @NonNull Class extends BaseMessageViewHolder extends MessageContentType.Image>> holder,
+ @LayoutRes int layout,
+ Object payload) {
+ this.outcomingImageConfig.holder = holder;
+ this.outcomingImageConfig.layout = layout;
+ this.outcomingImageConfig.payload = payload;
+ return this;
+ }
+
/**
* Sets custom view holder class for outcoming image message.
*
@@ -199,6 +355,21 @@ public MessageHolders setOutcomingImageHolder(
return this;
}
+ /**
+ * Sets custom view holder class for outcoming image message.
+ *
+ * @param holder holder class.
+ * @param payload custom data.
+ * @return {@link MessageHolders} for subsequent configuration.
+ */
+ public MessageHolders setOutcomingImageHolder(
+ @NonNull Class extends BaseMessageViewHolder extends MessageContentType.Image>> holder,
+ Object payload) {
+ this.outcomingImageConfig.holder = holder;
+ this.outcomingImageConfig.payload = payload;
+ return this;
+ }
+
/**
* Sets custom layout resource for outcoming image message.
*
@@ -210,6 +381,19 @@ public MessageHolders setOutcomingImageLayout(@LayoutRes int layout) {
return this;
}
+ /**
+ * Sets custom layout resource for outcoming image message.
+ *
+ * @param layout layout resource.
+ * @param payload custom data.
+ * @return {@link MessageHolders} for subsequent configuration.
+ */
+ public MessageHolders setOutcomingImageLayout(@LayoutRes int layout, Object payload) {
+ this.outcomingImageConfig.layout = layout;
+ this.outcomingImageConfig.payload = payload;
+ return this;
+ }
+
/**
* Sets both of custom view holder class and layout resource for date header.
*
@@ -300,8 +484,8 @@ MessageHolders registerContentType(
}
/*
- * INTERFACES
- * */
+ * INTERFACES
+ * */
/**
* The interface, which contains logic for checking the availability of content.
@@ -319,13 +503,13 @@ public interface ContentChecker {
}
/*
- * PRIVATE METHODS
- * */
+ * PRIVATE METHODS
+ * */
protected ViewHolder getHolder(ViewGroup parent, int viewType, MessagesListStyle messagesListStyle) {
switch (viewType) {
case VIEW_TYPE_DATE_HEADER:
- return getHolder(parent, dateHeaderLayout, dateHeaderHolder, messagesListStyle);
+ return getHolder(parent, dateHeaderLayout, dateHeaderHolder, messagesListStyle, null);
case VIEW_TYPE_TEXT_MESSAGE:
return getHolder(parent, incomingTextConfig, messagesListStyle);
case -VIEW_TYPE_TEXT_MESSAGE:
@@ -395,18 +579,28 @@ protected int getViewType(Object item, String senderId) {
return isOutcoming ? viewType * -1 : viewType;
}
- private ViewHolder getHolder(ViewGroup parent, HolderConfig holderConfig, MessagesListStyle style) {
- return getHolder(parent, holderConfig.layout, holderConfig.holder, style);
+ private ViewHolder getHolder(ViewGroup parent, HolderConfig holderConfig,
+ MessagesListStyle style) {
+ return getHolder(parent, holderConfig.layout, holderConfig.holder, style, holderConfig.payload);
}
private
- ViewHolder getHolder(ViewGroup parent, @LayoutRes int layout, Class holderClass, MessagesListStyle style) {
+ ViewHolder getHolder(ViewGroup parent, @LayoutRes int layout, Class holderClass,
+ MessagesListStyle style, Object payload) {
View v = LayoutInflater.from(parent.getContext()).inflate(layout, parent, false);
try {
- Constructor constructor = holderClass.getDeclaredConstructor(View.class);
- constructor.setAccessible(true);
- HOLDER holder = constructor.newInstance(v);
+ Constructor constructor = null;
+ HOLDER holder;
+ try {
+ constructor = holderClass.getDeclaredConstructor(View.class, Object.class);
+ constructor.setAccessible(true);
+ holder = constructor.newInstance(v, payload);
+ } catch (NoSuchMethodException e) {
+ constructor = holderClass.getDeclaredConstructor(View.class);
+ constructor.setAccessible(true);
+ holder = constructor.newInstance(v);
+ }
if (holder instanceof DefaultMessageViewHolder && style != null) {
((DefaultMessageViewHolder) holder).applyStyle(style);
}
@@ -440,8 +634,8 @@ private short getContentViewType(IMessage message) {
}
/*
- * HOLDERS
- * */
+ * HOLDERS
+ * */
/**
* The base class for view holders for incoming and outcoming message.
@@ -451,6 +645,11 @@ public static abstract class BaseMessageViewHolder ext
boolean isSelected;
+ /**
+ * For setting custom data to ViewHolder
+ */
+ protected Object payload;
+
/**
* Callback for implementing images loading in message list
*/
@@ -460,6 +659,11 @@ public BaseMessageViewHolder(View itemView) {
super(itemView);
}
+ public BaseMessageViewHolder(View itemView, Object payload) {
+ this(itemView);
+ this.payload = payload;
+ }
+
/**
* Returns whether is item selected
*
@@ -515,8 +719,12 @@ public static class IncomingTextMessageViewHolder
public IncomingTextMessageViewHolder(View itemView) {
super(itemView);
- bubble = (ViewGroup) itemView.findViewById(R.id.bubble);
- text = (TextView) itemView.findViewById(R.id.messageText);
+ init(itemView);
+ }
+
+ public IncomingTextMessageViewHolder(View itemView, Object payload) {
+ super(itemView, payload);
+ init(itemView);
}
@Override
@@ -551,6 +759,11 @@ public void applyStyle(MessagesListStyle style) {
configureLinksBehavior(text);
}
}
+
+ private void init(View itemView) {
+ bubble = (ViewGroup) itemView.findViewById(R.id.bubble);
+ text = (TextView) itemView.findViewById(R.id.messageText);
+ }
}
/**
@@ -564,8 +777,12 @@ public static class OutcomingTextMessageViewHolder
public OutcomingTextMessageViewHolder(View itemView) {
super(itemView);
- bubble = (ViewGroup) itemView.findViewById(R.id.bubble);
- text = (TextView) itemView.findViewById(R.id.messageText);
+ init(itemView);
+ }
+
+ public OutcomingTextMessageViewHolder(View itemView, Object payload) {
+ super(itemView, payload);
+ init(itemView);
}
@Override
@@ -600,6 +817,11 @@ public final void applyStyle(MessagesListStyle style) {
configureLinksBehavior(text);
}
}
+
+ private void init(View itemView) {
+ bubble = (ViewGroup) itemView.findViewById(R.id.bubble);
+ text = (TextView) itemView.findViewById(R.id.messageText);
+ }
}
/**
@@ -613,17 +835,12 @@ public static class IncomingImageMessageViewHolder {
protected Class extends BaseMessageViewHolder extends T>> holder;
protected int layout;
+ protected Object payload;
HolderConfig(Class extends BaseMessageViewHolder extends T>> holder, int layout) {
this.holder = holder;
this.layout = layout;
}
+
+ HolderConfig(Class extends BaseMessageViewHolder extends T>> holder, int layout, Object payload) {
+ this.holder = holder;
+ this.layout = layout;
+ this.payload = payload;
+ }
}
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/CustomHolderMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/CustomHolderMessagesActivity.java
index 6ec42903..835dcf21 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/CustomHolderMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/CustomHolderMessagesActivity.java
@@ -3,6 +3,7 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.widget.Toast;
import com.stfalcon.chatkit.messages.MessageHolders;
import com.stfalcon.chatkit.messages.MessageInput;
@@ -60,10 +61,23 @@ public void onMessageLongClick(Message message) {
}
private void initAdapter() {
+
+ //We can pass any data to ViewHolder with payload
+ CustomIncomingTextMessageViewHolder.Payload payload = new CustomIncomingTextMessageViewHolder.Payload();
+ //For example click listener
+ payload.avatarClickListener = new CustomIncomingTextMessageViewHolder.OnAvatarClickListener() {
+ @Override
+ public void onAvatarClick() {
+ Toast.makeText(CustomHolderMessagesActivity.this,
+ "Text message avatar clicked", Toast.LENGTH_SHORT).show();
+ }
+ };
+
MessageHolders holdersConfig = new MessageHolders()
.setIncomingTextConfig(
CustomIncomingTextMessageViewHolder.class,
- R.layout.item_custom_incoming_text_message)
+ R.layout.item_custom_incoming_text_message,
+ payload)
.setOutcomingTextConfig(
CustomOutcomingTextMessageViewHolder.class,
R.layout.item_custom_outcoming_text_message)
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomIncomingTextMessageViewHolder.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomIncomingTextMessageViewHolder.java
index c4df3e95..a846a840 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomIncomingTextMessageViewHolder.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomIncomingTextMessageViewHolder.java
@@ -11,8 +11,8 @@ public class CustomIncomingTextMessageViewHolder
private View onlineIndicator;
- public CustomIncomingTextMessageViewHolder(View itemView) {
- super(itemView);
+ public CustomIncomingTextMessageViewHolder(View itemView, Object payload) {
+ super(itemView, payload);
onlineIndicator = itemView.findViewById(R.id.onlineIndicator);
}
@@ -26,5 +26,24 @@ public void onBind(Message message) {
} else {
onlineIndicator.setBackgroundResource(R.drawable.shape_bubble_offline);
}
+
+ //We can set click listener on view from payload
+ final Payload payload = (Payload) this.payload;
+ userAvatar.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (payload != null && payload.avatarClickListener != null) {
+ payload.avatarClickListener.onAvatarClick();
+ }
+ }
+ });
+ }
+
+ public static class Payload {
+ public OnAvatarClickListener avatarClickListener;
+ }
+
+ public interface OnAvatarClickListener {
+ void onAvatarClick();
}
}
From 36e4cc97f43ee561799a05c0f2d42e2bc49acc92 Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Thu, 16 Aug 2018 10:38:30 +0300
Subject: [PATCH 48/85] Update documentation
---
docs/COMPONENT_MESSAGES_LIST.md | 56 +++++++++++++++++++++++++++++++--
1 file changed, 54 insertions(+), 2 deletions(-)
diff --git a/docs/COMPONENT_MESSAGES_LIST.md b/docs/COMPONENT_MESSAGES_LIST.md
index 38a4453e..d424767f 100644
--- a/docs/COMPONENT_MESSAGES_LIST.md
+++ b/docs/COMPONENT_MESSAGES_LIST.md
@@ -321,8 +321,8 @@ For example, you can add status for outgoing messages with only few lines:
public class CustomOutcomingMessageViewHolder
extends MessagesListAdapter.OutcomingMessageViewHolder {
- public CustomOutcomingMessageViewHolder(View itemView) {
- super(itemView);
+ public CustomOutcomingMessageViewHolder(View itemView, Object payload) {
+ super(itemView, payload);
}
@Override
@@ -338,6 +338,58 @@ public class CustomOutcomingMessageViewHolder
Pay attention to outgoing message’ status and online indicator.
+#### Passing custom data to your ViewHolder
+You can pass any data to your custom ViewHolder. To do this, firstly you need override the constructor `super(View itemView, Object payload)` (the constructor `super(View itemView)` is deprecated and will be deleted in one of the new version of library). After that you can pass data as third parameter in method `MessageHolders().setXXXConfig`.
+For example, let's add click listener in incoming text message on avatar click.
+Create interface for click callback and payload class to store it:
+```java
+public interface OnAvatarClickListener {
+ void onAvatarClick();
+}
+
+public class Payload {
+ public OnAvatarClickListener avatarClickListener;
+}
+```
+Then in our custom ViewHolder in method `onBind`:
+```java
+@Override
+ public void onBind(Message message) {
+ super.onBind(message);
+ ...
+ //We can set click listener on view from payload
+ final Payload payload = (Payload) this.payload;
+ userAvatar.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ if (payload != null && payload.avatarClickListener != null) {
+ payload.avatarClickListener.onAvatarClick();
+ }
+ }
+ });
+ }
+```
+Then create Payload and set it and our ViewHolder class to MessageHolders config.
+```
+//We can pass any data to ViewHolder with payload
+CustomIncomingTextMessageViewHolder.Payload payload = new CustomIncomingTextMessageViewHolder.Payload();
+//For example click listener
+payload.avatarClickListener = new CustomIncomingTextMessageViewHolder.OnAvatarClickListener() {
+ @Override
+ public void onAvatarClick() {
+ Toast.makeText(CustomHolderMessagesActivity.this,
+ "Text message avatar clicked", Toast.LENGTH_SHORT).show();
+ }
+};
+
+MessageHolders holdersConfig = new MessageHolders()
+ .setIncomingTextConfig(
+ CustomIncomingTextMessageViewHolder.class,
+ R.layout.item_custom_incoming_text_message,
+ payload)
+ ...
+```
+
#### Custom content types
We understand that ony images as media messages are often not enough. Therefore, we implemented the ability to add custom content types for displaying different types of content (geopoints, video, voice messages etc.).
From 5d213ca8746a5041712be9694712d18b094ab480 Mon Sep 17 00:00:00 2001
From: Anton
Date: Thu, 16 Aug 2018 11:01:10 +0300
Subject: [PATCH 49/85] set deprecated ViewHolder constructor. Update sample.
---
.../chatkit/messages/MessageHolders.java | 17 ++++++++++++-----
.../CustomIncomingImageMessageViewHolder.java | 4 ++--
.../CustomOutcomingImageMessageViewHolder.java | 4 ++--
.../CustomOutcomingTextMessageViewHolder.java | 4 ++--
.../holders/IncomingVoiceMessageViewHolder.java | 4 ++--
.../OutcomingVoiceMessageViewHolder.java | 4 ++--
6 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
index 0437b54b..4fce59d3 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
@@ -655,12 +655,13 @@ public static abstract class BaseMessageViewHolder ext
*/
protected ImageLoader imageLoader;
+ @Deprecated
public BaseMessageViewHolder(View itemView) {
super(itemView);
}
public BaseMessageViewHolder(View itemView, Object payload) {
- this(itemView);
+ super(itemView);
this.payload = payload;
}
@@ -717,6 +718,7 @@ public static class IncomingTextMessageViewHolder
protected ViewGroup bubble;
protected TextView text;
+ @Deprecated
public IncomingTextMessageViewHolder(View itemView) {
super(itemView);
init(itemView);
@@ -775,6 +777,7 @@ public static class OutcomingTextMessageViewHolder
protected ViewGroup bubble;
protected TextView text;
+ @Deprecated
public OutcomingTextMessageViewHolder(View itemView) {
super(itemView);
init(itemView);
@@ -833,6 +836,7 @@ public static class IncomingImageMessageViewHolder {
public DefaultIncomingTextMessageViewHolder(View itemView) {
- super(itemView);
+ super(itemView, null);
}
}
@@ -1099,7 +1106,7 @@ private static class DefaultOutcomingTextMessageViewHolder
extends OutcomingTextMessageViewHolder {
public DefaultOutcomingTextMessageViewHolder(View itemView) {
- super(itemView);
+ super(itemView, null);
}
}
@@ -1107,7 +1114,7 @@ private static class DefaultIncomingImageMessageViewHolder
extends IncomingImageMessageViewHolder {
public DefaultIncomingImageMessageViewHolder(View itemView) {
- super(itemView);
+ super(itemView, null);
}
}
@@ -1115,7 +1122,7 @@ private static class DefaultOutcomingImageMessageViewHolder
extends OutcomingImageMessageViewHolder {
public DefaultOutcomingImageMessageViewHolder(View itemView) {
- super(itemView);
+ super(itemView, null);
}
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomIncomingImageMessageViewHolder.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomIncomingImageMessageViewHolder.java
index 47e9282a..124b4cc4 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomIncomingImageMessageViewHolder.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomIncomingImageMessageViewHolder.java
@@ -14,8 +14,8 @@ public class CustomIncomingImageMessageViewHolder
private View onlineIndicator;
- public CustomIncomingImageMessageViewHolder(View itemView) {
- super(itemView);
+ public CustomIncomingImageMessageViewHolder(View itemView, Object payload) {
+ super(itemView, payload);
onlineIndicator = itemView.findViewById(R.id.onlineIndicator);
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingImageMessageViewHolder.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingImageMessageViewHolder.java
index 36a22359..9b520b85 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingImageMessageViewHolder.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingImageMessageViewHolder.java
@@ -11,8 +11,8 @@
public class CustomOutcomingImageMessageViewHolder
extends MessageHolders.OutcomingImageMessageViewHolder {
- public CustomOutcomingImageMessageViewHolder(View itemView) {
- super(itemView);
+ public CustomOutcomingImageMessageViewHolder(View itemView, Object payload) {
+ super(itemView, payload);
}
@Override
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingTextMessageViewHolder.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingTextMessageViewHolder.java
index 81c319d2..aa3a445b 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingTextMessageViewHolder.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingTextMessageViewHolder.java
@@ -8,8 +8,8 @@
public class CustomOutcomingTextMessageViewHolder
extends MessageHolders.OutcomingTextMessageViewHolder {
- public CustomOutcomingTextMessageViewHolder(View itemView) {
- super(itemView);
+ public CustomOutcomingTextMessageViewHolder(View itemView, Object payload) {
+ super(itemView, payload);
}
@Override
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/IncomingVoiceMessageViewHolder.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/IncomingVoiceMessageViewHolder.java
index c87e395f..80c64b5b 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/IncomingVoiceMessageViewHolder.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/IncomingVoiceMessageViewHolder.java
@@ -18,8 +18,8 @@ public class IncomingVoiceMessageViewHolder
private TextView tvDuration;
private TextView tvTime;
- public IncomingVoiceMessageViewHolder(View itemView) {
- super(itemView);
+ public IncomingVoiceMessageViewHolder(View itemView, Object payload) {
+ super(itemView, payload);
tvDuration = (TextView) itemView.findViewById(R.id.duration);
tvTime = (TextView) itemView.findViewById(R.id.time);
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/OutcomingVoiceMessageViewHolder.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/OutcomingVoiceMessageViewHolder.java
index 556e1fcf..6d3dcbf8 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/OutcomingVoiceMessageViewHolder.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/OutcomingVoiceMessageViewHolder.java
@@ -18,8 +18,8 @@ public class OutcomingVoiceMessageViewHolder
private TextView tvDuration;
private TextView tvTime;
- public OutcomingVoiceMessageViewHolder(View itemView) {
- super(itemView);
+ public OutcomingVoiceMessageViewHolder(View itemView, Object payload) {
+ super(itemView, payload);
tvDuration = (TextView) itemView.findViewById(R.id.duration);
tvTime = (TextView) itemView.findViewById(R.id.time);
}
From 4a810bbd6d3d5834c3e19f8b3147ff6da364e390 Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Thu, 16 Aug 2018 15:18:10 +0300
Subject: [PATCH 50/85] Update README.md
---
README.md | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/README.md b/README.md
index d4d31d5c..48f10f47 100644
--- a/README.md
+++ b/README.md
@@ -56,6 +56,27 @@ or Maven:
```
+### Proguard
+If you are using ProGuard you might need to add rules:
+```
+-keep class * extends com.stfalcon.chatkit.messages.MessageHolders$OutcomingTextMessageViewHolder {
+ public (android.view.View, java.lang.Object);
+ public (android.view.View);
+ }
+-keep class * extends com.stfalcon.chatkit.messages.MessageHolders$IncomingTextMessageViewHolder {
+ public (android.view.View, java.lang.Object);
+ public (android.view.View);
+ }
+-keep class * extends com.stfalcon.chatkit.messages.MessageHolders$IncomingImageMessageViewHolder {
+ public (android.view.View, java.lang.Object);
+ public (android.view.View);
+ }
+-keep class * extends com.stfalcon.chatkit.messages.MessageHolders$OutcomingImageMessageViewHolder {
+ public (android.view.View, java.lang.Object);
+ public (android.view.View);
+ }
+```
+
### Try it
Check out the [sample project](/sample/src/main) to try it yourself! :wink:
From 769eb0d8e9fd190cb633dac8540d1a35d3ba5190 Mon Sep 17 00:00:00 2001
From: Anton
Date: Thu, 16 Aug 2018 15:23:28 +0300
Subject: [PATCH 51/85] add proguard rules
---
sample/build.gradle | 2 +-
sample/proguard-rules.pro | 101 ++++++++++++++++++++++++++++++++++++++
2 files changed, 102 insertions(+), 1 deletion(-)
diff --git a/sample/build.gradle b/sample/build.gradle
index dbed4d4e..fa1fced7 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -12,7 +12,7 @@ android {
}
buildTypes {
release {
- minifyEnabled false
+ minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
diff --git a/sample/proguard-rules.pro b/sample/proguard-rules.pro
index 7e694d20..50d21ef8 100644
--- a/sample/proguard-rules.pro
+++ b/sample/proguard-rules.pro
@@ -15,3 +15,104 @@
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
+# JSR 305 annotations are for embedding nullability information.
+-dontwarn javax.annotation.**
+
+# A resource is loaded with a relative path so the package of this class must be preserved.
+-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
+
+# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
+-dontwarn org.codehaus.mojo.animal_sniffer.*
+
+# OkHttp platform used only on JVM and when Conscrypt dependency is available.
+-dontwarn okhttp3.internal.platform.ConscryptPlatform
+
+
+-dontwarn okio.**
+-dontwarn com.squareup.okhttp.**
+-dontwarn okhttp3.**
+-dontwarn javax.annotation.**
+-dontwarn com.android.volley.toolbox.**
+-dontwarn com.facebook.infer.**
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgent
+-keep public class * extends android.preference.Preference
+-keep public class * extends android.support.v4.app.Fragment
+-keep public class * extends android.support.v4.app.DialogFragment
+-keep public class * extends com.actionbarsherlock.app.SherlockListFragment
+-keep public class * extends com.actionbarsherlock.app.SherlockFragment
+-keep public class * extends com.actionbarsherlock.app.SherlockFragmentActivity
+-keep public class * extends android.app.Fragment
+-keep public class com.android.vending.licensing.ILicensingService
+
+# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
+-keepclasseswithmembernames class * {
+ native ;
+}
+
+-keep public class * extends android.view.View {
+ public (android.content.Context);
+ public (android.content.Context, android.util.AttributeSet);
+ public (android.content.Context, android.util.AttributeSet, int);
+ public void set*(...);
+}
+
+-keepclasseswithmembers class * {
+ public (android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+ public (android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers class * extends android.app.Activity {
+ public void *(android.view.View);
+}
+
+# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
+-keepclassmembers enum * {
+ public static **[] values();
+ public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+ public static final android.os.Parcelable$Creator *;
+}
+
+-keepclassmembers class **.R$* {
+ public static ;
+}
+-keep class android.support.v7.internal.** { *; }
+-keep interface android.support.v7.internal.** { *; }
+-keep class android.support.v7.** { *; }
+-keep interface android.support.v7.** { *; }
+# The support library contains references to newer platform versions.
+# Don't warn about those in case this app is linking against an older
+# platform version. We know about them, and they are safe.
+-dontwarn android.support.**
+
+
+
+#FOR CHATKIT
+
+-keep class * extends com.stfalcon.chatkit.messages.MessageHolders$OutcomingTextMessageViewHolder {
+ public (android.view.View, java.lang.Object);
+ public (android.view.View);
+ }
+-keep class * extends com.stfalcon.chatkit.messages.MessageHolders$IncomingTextMessageViewHolder {
+ public (android.view.View, java.lang.Object);
+ public (android.view.View);
+ }
+-keep class * extends com.stfalcon.chatkit.messages.MessageHolders$IncomingImageMessageViewHolder {
+ public (android.view.View, java.lang.Object);
+ public (android.view.View);
+ }
+-keep class * extends com.stfalcon.chatkit.messages.MessageHolders$OutcomingImageMessageViewHolder {
+ public (android.view.View, java.lang.Object);
+ public (android.view.View);
+ }
From 37b1695788b18ccee08a12b629b4927afb97581d Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Thu, 16 Aug 2018 16:04:09 +0300
Subject: [PATCH 52/85] Update CHANGELOG.md
---
docs/CHANGELOG.md | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 78ae166c..15c85c0c 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -1,3 +1,8 @@
+## Version 0.3.1 (2018/08/16)
+* [Passing custom data to your ViewHolder](https://github.com/stfalcon-studio/ChatKit/blob/master/docs/COMPONENT_MESSAGES_LIST.md#passing-custom-data-to-your-viewholder) [#180](https://github.com/stfalcon-studio/ChatKit/issues/180)
+* Added Proguard rules to [Readme](https://github.com/stfalcon-studio/ChatKit#proguard) and [sample project](https://github.com/stfalcon-studio/ChatKit/blob/master/sample/proguard-rules.pro). [#122](https://github.com/stfalcon-studio/ChatKit/issues/122)
+* Fixed [#174](https://github.com/stfalcon-studio/ChatKit/issues/174)
+
## Version 0.3.0 (2018/07/12)
* [Added Typing Listener to MessageInput](https://github.com/stfalcon-studio/ChatKit/blob/master/docs/COMPONENT_MESSAGE_INPUT.MD#typing-listener). Thanks to [toanpv](https://github.com/toanpv);
* Fixed artifacts with bubble background in message list;
From 067b6a05ceb626122f211685f52e9f9aa414688b Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Thu, 16 Aug 2018 17:16:23 +0300
Subject: [PATCH 53/85] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 48f10f47..a0736751 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ To implement all of the features above you can use the following components:
Download via Gradle:
```gradle
-compile 'com.github.stfalcon:chatkit:0.3.0'
+compile 'com.github.stfalcon:chatkit:0.3.1'
```
or Maven:
@@ -51,7 +51,7 @@ or Maven:
com.github.stfalcon
chatkit
- 0.3.0
+ 0.3.1
pom
```
From e0ee1eb126857e772ad6df27ee84a17f57df099c Mon Sep 17 00:00:00 2001
From: Anton
Date: Thu, 16 Aug 2018 17:34:05 +0300
Subject: [PATCH 54/85] fix in proguard rules
---
sample/build.gradle | 2 +-
sample/proguard-rules.pro | 5 -----
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/sample/build.gradle b/sample/build.gradle
index fa1fced7..dbed4d4e 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -12,7 +12,7 @@ android {
}
buildTypes {
release {
- minifyEnabled true
+ minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
diff --git a/sample/proguard-rules.pro b/sample/proguard-rules.pro
index 50d21ef8..2995e8d9 100644
--- a/sample/proguard-rules.pro
+++ b/sample/proguard-rules.pro
@@ -32,8 +32,6 @@
-dontwarn com.squareup.okhttp.**
-dontwarn okhttp3.**
-dontwarn javax.annotation.**
--dontwarn com.android.volley.toolbox.**
--dontwarn com.facebook.infer.**
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
@@ -44,9 +42,6 @@
-keep public class * extends android.preference.Preference
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.support.v4.app.DialogFragment
--keep public class * extends com.actionbarsherlock.app.SherlockListFragment
--keep public class * extends com.actionbarsherlock.app.SherlockFragment
--keep public class * extends com.actionbarsherlock.app.SherlockFragmentActivity
-keep public class * extends android.app.Fragment
-keep public class com.android.vending.licensing.ILicensingService
From 5b58ff4671a5e32bb24ec5259df2659934cee542 Mon Sep 17 00:00:00 2001
From: Matthew Weathers
Date: Mon, 20 Aug 2018 10:39:36 -0500
Subject: [PATCH 55/85] Enable payloads for custom content types
---
.../chatkit/messages/MessageHolders.java | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
index 4fce59d3..71b99839 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
@@ -483,6 +483,37 @@ MessageHolders registerContentType(
return this;
}
+ /**
+ * Registers custom content type (e.g. multimedia, events etc.)
+ *
+ * @param type unique id for content type
+ * @param incomingHolder holder class for incoming message
+ * @param outcomingHolder holder class for outcoming message
+ * @param incomingPayload payload for incoming message
+ * @param outcomingPayload payload for outcoming message
+ * @param incomingLayout layout resource for incoming message
+ * @param outcomingLayout layout resource for outcoming message
+ * @param contentChecker {@link MessageHolders.ContentChecker} for registered type
+ * @return {@link MessageHolders} for subsequent configuration.
+ */
+ public
+ MessageHolders registerContentType(
+ byte type,
+ @NonNull Class extends MessageHolders.BaseMessageViewHolder> incomingHolder, Object incomingPayload, @LayoutRes int incomingLayout,
+ @NonNull Class extends MessageHolders.BaseMessageViewHolder> outcomingHolder, Object outcomingPayload, @LayoutRes int outcomingLayout,
+ @NonNull MessageHolders.ContentChecker contentChecker) {
+
+ if (type == 0)
+ throw new IllegalArgumentException("content type must be greater or less than '0'!");
+
+ customContentTypes.add(
+ new MessageHolders.ContentTypeConfig<>(type,
+ new MessageHolders.HolderConfig<>(incomingHolder, incomingLayout, incomingPayload),
+ new MessageHolders.HolderConfig<>(outcomingHolder, outcomingLayout, outcomingPayload)));
+ this.contentChecker = contentChecker;
+ return this;
+ }
+
/*
* INTERFACES
* */
From b22214a045a10bbe651b14eafa7c35e3aa991e6b Mon Sep 17 00:00:00 2001
From: Mathieu Rul
Date: Tue, 28 Aug 2018 10:12:54 +0200
Subject: [PATCH 56/85] Clear last message if null in dialog list (Fix issue
#189)
---
.../com/stfalcon/chatkit/dialogs/DialogsListAdapter.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index eaa8b47f..721813e5 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -631,6 +631,8 @@ public void onBind(final DIALOG dialog) {
tvDate.setText(formattedDate == null
? getDateString(lastMessageDate)
: formattedDate);
+ } else {
+ tvDate.setText(null);
}
//Set Dialog avatar
@@ -643,11 +645,14 @@ public void onBind(final DIALOG dialog) {
imageLoader.loadImage(ivLastMessageUser, dialog.getLastMessage().getUser().getAvatar());
}
ivLastMessageUser.setVisibility(dialogStyle.isDialogMessageAvatarEnabled()
- && dialog.getUsers().size() > 1 ? VISIBLE : GONE);
+ && dialog.getUsers().size() > 1
+ && dialog.getLastMessage() != null ? VISIBLE : GONE);
//Set Last message text
if (dialog.getLastMessage() != null) {
tvLastMessage.setText(dialog.getLastMessage().getText());
+ } else {
+ tvLastMessage.setText(null);
}
//Set Unread message count bubble
From 22545932c710e06e089e01fe8a9d526c4abbfd36 Mon Sep 17 00:00:00 2001
From: Mathieu Rul
Date: Tue, 28 Aug 2018 10:18:40 +0200
Subject: [PATCH 57/85] Add upsert method to dialogs list
---
.../chatkit/dialogs/DialogsListAdapter.java | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index eaa8b47f..2ebdbfa7 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -257,6 +257,26 @@ public void updateItemById(DIALOG item) {
}
}
+ /**
+ * Upsert dialog in dialogs list or add it to then end of dialogs list
+ *
+ * @param item dialog item
+ */
+ public void upsertItem(DIALOG item) {
+ boolean updated = false;
+ for (int i = 0; i < items.size(); i++) {
+ if (items.get(i).getId().equals(item.getId())) {
+ items.set(i, item);
+ notifyItemChanged(i);
+ updated = true;
+ break;
+ }
+ }
+ if (!updated) {
+ addItem(item);
+ }
+ }
+
/**
* Find an item by its id
*
From b4a84be7228a09780ae9f8ec8dd1ddff8f8b31c9 Mon Sep 17 00:00:00 2001
From: Anton
Date: Tue, 25 Sep 2018 14:28:05 +0300
Subject: [PATCH 58/85] ver 0.3.2
---
chatkit/build.gradle | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/chatkit/build.gradle b/chatkit/build.gradle
index f970a58f..9889ae13 100644
--- a/chatkit/build.gradle
+++ b/chatkit/build.gradle
@@ -8,7 +8,7 @@ android {
defaultConfig {
minSdkVersion 14
versionCode 1
- versionName "0.3.1"
+ versionName "0.3.2"
consumerProguardFiles 'proguard.txt'
}
@@ -22,7 +22,7 @@ android {
publish {
groupId = 'com.github.stfalcon'
artifactId = 'chatkit'
- publishVersion = '0.3.1'
+ publishVersion = '0.3.2'
desc = 'ChatKit - is a library designed to simplify the development of UI for such a trivial task as chat. It have flexible possibilities for styling, customizing and data management'
licences = ['Apache-2.0']
uploadName = 'ChatKit'
From dcd0eb091bbc5d407f4c3f48e33dadcd7f2b082d Mon Sep 17 00:00:00 2001
From: Anton
Date: Tue, 25 Sep 2018 14:29:20 +0300
Subject: [PATCH 59/85] fix addItem method in DialogListAdapter
---
.../java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index eaa8b47f..dc6eac52 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -200,7 +200,7 @@ public void addItems(List newItems) {
*/
public void addItem(DIALOG dialog) {
items.add(dialog);
- notifyItemInserted(0);
+ notifyItemInserted(items.size() - 1);
}
/**
@@ -421,7 +421,7 @@ public void setDatesFormatter(DateFormatter.Formatter datesFormatter) {
void setStyle(DialogListStyle dialogStyle) {
this.dialogStyle = dialogStyle;
}
-
+
/**
* @return the position of a dialog in the dialogs list.
*/
From 719b67a97b641ef48058791e66bf5355e52f0a74 Mon Sep 17 00:00:00 2001
From: Anton
Date: Tue, 25 Sep 2018 14:42:16 +0300
Subject: [PATCH 60/85] make protected items field in MessagesListAdapter and
DialogsListAdapter
---
.../java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java | 2 +-
.../java/com/stfalcon/chatkit/messages/MessagesListAdapter.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index 31dcea53..871156cc 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -52,7 +52,7 @@
public class DialogsListAdapter
extends RecyclerView.Adapter {
- private List items = new ArrayList<>();
+ protected List items = new ArrayList<>();
private int itemLayoutId;
private Class extends BaseDialogViewHolder> holderClass;
private ImageLoader imageLoader;
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
index cbc403d2..caef45b8 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
@@ -51,9 +51,9 @@ public class MessagesListAdapter
protected static boolean isSelectionModeEnabled;
+ protected List items;
private MessageHolders holders;
private String senderId;
- private List items;
private int selectedItemsCount;
private SelectionListener selectionListener;
From 3a754d7c3d16976e2c43d806538356f49109cf6e Mon Sep 17 00:00:00 2001
From: Anton
Date: Wed, 26 Sep 2018 11:50:10 +0300
Subject: [PATCH 61/85] fix delete and deleteByIds methods in
MessagesListAdapter
---
.../chatkit/messages/MessagesListAdapter.java | 24 ++++++++++++++-----
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
index caef45b8..acc105f9 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
@@ -239,12 +239,18 @@ public void delete(MESSAGE message) {
* @param messages messages list to delete.
*/
public void delete(List messages) {
+ boolean result = false;
for (MESSAGE message : messages) {
int index = getMessagePositionById(message.getId());
- items.remove(index);
- notifyItemRemoved(index);
+ if (index >= 0) {
+ items.remove(index);
+ notifyItemRemoved(index);
+ result = true;
+ }
+ }
+ if (result) {
+ recountDateHeaders();
}
- recountDateHeaders();
}
/**
@@ -267,12 +273,18 @@ public void deleteById(String id) {
* @param ids array of identifiers of messages to delete.
*/
public void deleteByIds(String[] ids) {
+ boolean result = false;
for (String id : ids) {
int index = getMessagePositionById(id);
- items.remove(index);
- notifyItemRemoved(index);
+ if (index >= 0) {
+ items.remove(index);
+ notifyItemRemoved(index);
+ result = true;
+ }
+ }
+ if (result) {
+ recountDateHeaders();
}
- recountDateHeaders();
}
/**
From 3a10017c089ae5ebe14c7225ac98f0eb9dfcc599 Mon Sep 17 00:00:00 2001
From: Anton
Date: Fri, 28 Sep 2018 16:56:00 +0300
Subject: [PATCH 62/85] ability to pass custom data in ImageLoader
---
.../stfalcon/chatkit/commons/ImageLoader.java | 3 ++-
.../chatkit/dialogs/DialogsListAdapter.java | 4 ++--
.../chatkit/messages/MessageHolders.java | 24 ++++++++++++++-----
.../features/demo/DemoDialogsActivity.java | 2 +-
.../features/demo/DemoMessagesActivity.java | 2 +-
...CustomOutcomingImageMessageViewHolder.java | 6 +++++
.../demo/def/DefaultDialogsActivity.java | 4 ----
7 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/commons/ImageLoader.java b/chatkit/src/main/java/com/stfalcon/chatkit/commons/ImageLoader.java
index 4d795854..a0f7f44f 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/commons/ImageLoader.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/commons/ImageLoader.java
@@ -16,6 +16,7 @@
package com.stfalcon.chatkit.commons;
+import android.support.annotation.Nullable;
import android.widget.ImageView;
/**
@@ -23,6 +24,6 @@
*/
public interface ImageLoader {
- void loadImage(ImageView imageView, String url);
+ void loadImage(ImageView imageView, @Nullable String url, @Nullable Object payload);
}
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index 871156cc..dc48e7f0 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -657,12 +657,12 @@ public void onBind(final DIALOG dialog) {
//Set Dialog avatar
if (imageLoader != null) {
- imageLoader.loadImage(ivAvatar, dialog.getDialogPhoto());
+ imageLoader.loadImage(ivAvatar, dialog.getDialogPhoto(), null);
}
//Set Last message user avatar with check if there is last message
if (imageLoader != null && dialog.getLastMessage() != null) {
- imageLoader.loadImage(ivLastMessageUser, dialog.getLastMessage().getUser().getAvatar());
+ imageLoader.loadImage(ivLastMessageUser, dialog.getLastMessage().getUser().getAvatar(), null);
}
ivLastMessageUser.setVisibility(dialogStyle.isDialogMessageAvatarEnabled()
&& dialog.getUsers().size() > 1
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
index 4fce59d3..cce15838 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
@@ -706,7 +706,6 @@ public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event
}
});
}
-
}
/**
@@ -851,7 +850,7 @@ public IncomingImageMessageViewHolder(View itemView, Object payload) {
public void onBind(MESSAGE message) {
super.onBind(message);
if (image != null && imageLoader != null) {
- imageLoader.loadImage(image, message.getImageUrl());
+ loadImage(message);
}
if (imageOverlay != null) {
@@ -873,11 +872,15 @@ public final void applyStyle(MessagesListStyle style) {
}
}
+ protected void loadImage(MESSAGE message) {
+ imageLoader.loadImage(image, message.getImageUrl(), null);
+ }
+
private void init(View itemView) {
image = (ImageView) itemView.findViewById(R.id.image);
imageOverlay = itemView.findViewById(R.id.imageOverlay);
- if (image != null && image instanceof RoundedImageView) {
+ if (image instanceof RoundedImageView) {
((RoundedImageView) image).setCorners(
R.dimen.message_bubble_corners_radius,
R.dimen.message_bubble_corners_radius,
@@ -912,7 +915,7 @@ public OutcomingImageMessageViewHolder(View itemView, Object payload) {
public void onBind(MESSAGE message) {
super.onBind(message);
if (image != null && imageLoader != null) {
- imageLoader.loadImage(image, message.getImageUrl());
+ loadImage(message);
}
if (imageOverlay != null) {
@@ -934,11 +937,20 @@ public final void applyStyle(MessagesListStyle style) {
}
}
+ /**
+ * Calls Imageloader for loading image.
+ * Override this method to have ability to pass custom data in ImageLoader.
+ * @param message Message with image
+ */
+ protected void loadImage(MESSAGE message) {
+ imageLoader.loadImage(image, message.getImageUrl(), null);
+ }
+
private void init(View itemView) {
image = (ImageView) itemView.findViewById(R.id.image);
imageOverlay = itemView.findViewById(R.id.imageOverlay);
- if (image != null && image instanceof RoundedImageView) {
+ if (image instanceof RoundedImageView) {
((RoundedImageView) image).setCorners(
R.dimen.message_bubble_corners_radius,
R.dimen.message_bubble_corners_radius,
@@ -1020,7 +1032,7 @@ public void onBind(MESSAGE message) {
userAvatar.setVisibility(isAvatarExists ? View.VISIBLE : View.GONE);
if (isAvatarExists) {
- imageLoader.loadImage(userAvatar, message.getUser().getAvatar());
+ imageLoader.loadImage(userAvatar, message.getUser().getAvatar(), null);
}
}
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoDialogsActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoDialogsActivity.java
index f2848ba8..770db5e5 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoDialogsActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoDialogsActivity.java
@@ -27,7 +27,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
imageLoader = new ImageLoader() {
@Override
- public void loadImage(ImageView imageView, String url) {
+ public void loadImage(ImageView imageView, String url, Object payload) {
Picasso.with(DemoDialogsActivity.this).load(url).into(imageView);
}
};
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java
index 310f9444..b58867cb 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java
@@ -45,7 +45,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
imageLoader = new ImageLoader() {
@Override
- public void loadImage(ImageView imageView, String url) {
+ public void loadImage(ImageView imageView, String url, Object payload) {
Picasso.with(DemoMessagesActivity.this).load(url).into(imageView);
}
};
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingImageMessageViewHolder.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingImageMessageViewHolder.java
index 9b520b85..b8f00b16 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingImageMessageViewHolder.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingImageMessageViewHolder.java
@@ -21,4 +21,10 @@ public void onBind(Message message) {
time.setText(message.getStatus() + " " + time.getText());
}
+
+ //Override this method to pass custom data in ImageLoader.
+ @Override
+ protected void loadImage(Message message) {
+ imageLoader.loadImage(image, message.getImageUrl(), null);
+ }
}
\ No newline at end of file
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultDialogsActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultDialogsActivity.java
index b9cf7444..59c9cb4c 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultDialogsActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultDialogsActivity.java
@@ -12,12 +12,8 @@
import com.stfalcon.chatkit.sample.common.data.model.Message;
import com.stfalcon.chatkit.sample.features.demo.DemoDialogsActivity;
-import java.util.ArrayList;
-
public class DefaultDialogsActivity extends DemoDialogsActivity {
- private ArrayList dialogs;
-
public static void open(Context context) {
context.startActivity(new Intent(context, DefaultDialogsActivity.class));
}
From 6b3ad7667bad0f94de64f6d3fc826c36fe53595f Mon Sep 17 00:00:00 2001
From: Mathieu Rul
Date: Sun, 30 Sep 2018 22:11:15 +0200
Subject: [PATCH 63/85] Update documentation to add upsertItem method
---
docs/COMPONENT_DIALOGS_LIST.MD | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/COMPONENT_DIALOGS_LIST.MD b/docs/COMPONENT_DIALOGS_LIST.MD
index 61bea52d..e219fc1a 100644
--- a/docs/COMPONENT_DIALOGS_LIST.MD
+++ b/docs/COMPONENT_DIALOGS_LIST.MD
@@ -115,6 +115,7 @@ When your models are ready to be used by adapter, you can simply add them to the
* adapter.addItems(List items) - adds a new dialog list to the end of the list;
* adapter.addItem(DIALOG dialog) - adds one dialog to the end of the list
* adapter.addItem(int position, DIALOG dialog) - adds a new dialog to the specified position.
+* adapter.upsertItem(DIALOG dialog) - adds one dialog to the end of the list if not exists, otherwise updates the existing dialog.
#### Updating dialogs
If dialog has changed, you can update it by position in list by calling `adapter.updateItem(int position, DIALOG item)` or update it by dialog id by calling `adapter.updateItemById(DIALOG item)`
From 356104252989ae967da6c4d8e96c0daf40dac550 Mon Sep 17 00:00:00 2001
From: Anton
Date: Mon, 1 Oct 2018 16:22:47 +0300
Subject: [PATCH 64/85] ability to pass custom data in ImageLoader
---
.../chatkit/messages/MessageHolders.java | 35 +++++++++++--------
...CustomOutcomingImageMessageViewHolder.java | 8 +++--
2 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
index 09f644c5..c089cbdf 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
@@ -486,14 +486,14 @@ MessageHolders registerContentType(
/**
* Registers custom content type (e.g. multimedia, events etc.)
*
- * @param type unique id for content type
- * @param incomingHolder holder class for incoming message
- * @param outcomingHolder holder class for outcoming message
- * @param incomingPayload payload for incoming message
+ * @param type unique id for content type
+ * @param incomingHolder holder class for incoming message
+ * @param outcomingHolder holder class for outcoming message
+ * @param incomingPayload payload for incoming message
* @param outcomingPayload payload for outcoming message
- * @param incomingLayout layout resource for incoming message
- * @param outcomingLayout layout resource for outcoming message
- * @param contentChecker {@link MessageHolders.ContentChecker} for registered type
+ * @param incomingLayout layout resource for incoming message
+ * @param outcomingLayout layout resource for outcoming message
+ * @param contentChecker {@link MessageHolders.ContentChecker} for registered type
* @return {@link MessageHolders} for subsequent configuration.
*/
public
@@ -881,7 +881,7 @@ public IncomingImageMessageViewHolder(View itemView, Object payload) {
public void onBind(MESSAGE message) {
super.onBind(message);
if (image != null && imageLoader != null) {
- loadImage(message);
+ imageLoader.loadImage(image, message.getImageUrl(), getPayloadForImageLoader(message));
}
if (imageOverlay != null) {
@@ -903,8 +903,13 @@ public final void applyStyle(MessagesListStyle style) {
}
}
- protected void loadImage(MESSAGE message) {
- imageLoader.loadImage(image, message.getImageUrl(), null);
+ /**
+ * Override this method to have ability to pass custom data in ImageLoader for loading image(not avatar).
+ *
+ * @param message Message with image
+ */
+ protected Object getPayloadForImageLoader(MESSAGE message) {
+ return null;
}
private void init(View itemView) {
@@ -946,7 +951,7 @@ public OutcomingImageMessageViewHolder(View itemView, Object payload) {
public void onBind(MESSAGE message) {
super.onBind(message);
if (image != null && imageLoader != null) {
- loadImage(message);
+ imageLoader.loadImage(image, message.getImageUrl(), getPayloadForImageLoader(message));
}
if (imageOverlay != null) {
@@ -969,12 +974,12 @@ public final void applyStyle(MessagesListStyle style) {
}
/**
- * Calls Imageloader for loading image.
- * Override this method to have ability to pass custom data in ImageLoader.
+ * Override this method to have ability to pass custom data in ImageLoader for loading image(not avatar).
+ *
* @param message Message with image
*/
- protected void loadImage(MESSAGE message) {
- imageLoader.loadImage(image, message.getImageUrl(), null);
+ protected Object getPayloadForImageLoader(MESSAGE message) {
+ return null;
}
private void init(View itemView) {
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingImageMessageViewHolder.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingImageMessageViewHolder.java
index b8f00b16..484ce026 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingImageMessageViewHolder.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomOutcomingImageMessageViewHolder.java
@@ -1,5 +1,6 @@
package com.stfalcon.chatkit.sample.features.demo.custom.holder.holders.messages;
+import android.util.Pair;
import android.view.View;
import com.stfalcon.chatkit.messages.MessageHolders;
@@ -22,9 +23,10 @@ public void onBind(Message message) {
time.setText(message.getStatus() + " " + time.getText());
}
- //Override this method to pass custom data in ImageLoader.
+ //Override this method to have ability to pass custom data in ImageLoader for loading image(not avatar).
@Override
- protected void loadImage(Message message) {
- imageLoader.loadImage(image, message.getImageUrl(), null);
+ protected Object getPayloadForImageLoader(Message message) {
+ //For example you can pass size of placeholder before loading
+ return new Pair<>(100, 100);
}
}
\ No newline at end of file
From bc4a21879607e468500e6b448b7c88792a7fb072 Mon Sep 17 00:00:00 2001
From: Primoz
Date: Thu, 4 Oct 2018 11:29:23 +1000
Subject: [PATCH 65/85] Added upsert method to move a specific item to the
start.
---
.../chatkit/messages/MessagesListAdapter.java | 44 ++++++++++++++++---
1 file changed, 39 insertions(+), 5 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
index acc105f9..80f0a304 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
@@ -51,7 +51,7 @@ public class MessagesListAdapter
protected static boolean isSelectionModeEnabled;
- protected List items;
+ public List items;
private MessageHolders holders;
private String senderId;
@@ -213,6 +213,22 @@ public boolean update(String oldId, MESSAGE newMessage) {
}
}
+ /**
+ * Moves the elements position from current to start
+ *
+ * @param newMessage new message object.
+ */
+ public void updateAndMoveToStart(MESSAGE newMessage) {
+ int position = getMessagePositionById(newMessage.getId());
+ if (position >= 0) {
+ Wrapper element = new Wrapper<>(newMessage);
+ items.remove(position);
+ items.add(0, element);
+ notifyItemMoved(position, 0);
+ notifyItemChanged(0);
+ }
+ }
+
/**
* Updates message by its id if it exists, add to start if not
*
@@ -224,6 +240,24 @@ public void upsert(MESSAGE message) {
}
}
+ /**
+ * Updates and moves to start if message by its id exists and if specified move to start, if not
+ * specified the item stays at current position and updated
+ *
+ * @param message message object to insert or update.
+ */
+ public void upsert(MESSAGE message, boolean moveToStartIfUpdate) {
+ if (moveToStartIfUpdate) {
+ if (getMessagePositionById(message.getId()) > 0) {
+ updateAndMoveToStart(message);
+ } else {
+ upsert(message);
+ }
+ } else {
+ upsert(message);
+ }
+ }
+
/**
* Deletes message.
*
@@ -494,7 +528,7 @@ private void recountDateHeaders() {
}
}
- private void generateDateHeaders(List messages) {
+ public void generateDateHeaders(List messages) {
for (int i = 0; i < messages.size(); i++) {
MESSAGE message = messages.get(i);
this.items.add(new Wrapper<>(message));
@@ -653,9 +687,9 @@ void setStyle(MessagesListStyle style) {
/*
* WRAPPER
* */
- private class Wrapper {
- protected DATA item;
- protected boolean isSelected;
+ public class Wrapper {
+ public DATA item;
+ public boolean isSelected;
Wrapper(DATA item) {
this.item = item;
From e1b9332f2b46d328ed7130db38a61ff22df926f2 Mon Sep 17 00:00:00 2001
From: Primoz
Date: Fri, 12 Oct 2018 08:35:57 +1100
Subject: [PATCH 66/85] Changed access modifier from public to protected for: -
List items - method `generateDateHeaders`
---
.../com/stfalcon/chatkit/messages/MessagesListAdapter.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
index 80f0a304..e0fcb8a2 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
@@ -51,7 +51,7 @@ public class MessagesListAdapter
protected static boolean isSelectionModeEnabled;
- public List items;
+ protected List items;
private MessageHolders holders;
private String senderId;
@@ -528,7 +528,7 @@ private void recountDateHeaders() {
}
}
- public void generateDateHeaders(List messages) {
+ protected void generateDateHeaders(List messages) {
for (int i = 0; i < messages.size(); i++) {
MESSAGE message = messages.get(i);
this.items.add(new Wrapper<>(message));
From 947adeda2ffb5aa3f59a7fb13600c986138d7928 Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Fri, 12 Oct 2018 09:45:24 +0300
Subject: [PATCH 67/85] Update CHANGELOG.md
---
docs/CHANGELOG.md | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 15c85c0c..6dc81352 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -1,3 +1,12 @@
+## Version 0.3.2 (2018/09/28)
+* [Passing custom data to ImageLoader](https://github.com/stfalcon-studio/ChatKit/issues/183)
+* Fixed [#198](https://github.com/stfalcon-studio/ChatKit/issues/198)
+* Protected `items` field in `MessagesListAdapter` and `DialogsListAdapte` [#188](https://github.com/stfalcon-studio/ChatKit/issues/188)
+* Fixed `delete` and `deleteByIds` methods in MessagesListAdapter
+* Merged: Clear last message if null in dialog list (Fix issue #189) [#190](https://github.com/stfalcon-studio/ChatKit/pull/190)
+* Merged: Add upsert method to dialogs list [#191](https://github.com/stfalcon-studio/ChatKit/pull/191)
+* Merged: Update documentation to add upsertItem method [#208](https://github.com/stfalcon-studio/ChatKit/pull/208)
+
## Version 0.3.1 (2018/08/16)
* [Passing custom data to your ViewHolder](https://github.com/stfalcon-studio/ChatKit/blob/master/docs/COMPONENT_MESSAGES_LIST.md#passing-custom-data-to-your-viewholder) [#180](https://github.com/stfalcon-studio/ChatKit/issues/180)
* Added Proguard rules to [Readme](https://github.com/stfalcon-studio/ChatKit#proguard) and [sample project](https://github.com/stfalcon-studio/ChatKit/blob/master/sample/proguard-rules.pro). [#122](https://github.com/stfalcon-studio/ChatKit/issues/122)
From 5edd8044ff407373cfcf7cbd7898dbee4ee3b65c Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Fri, 12 Oct 2018 09:48:09 +0300
Subject: [PATCH 68/85] Update CHANGELOG.md
---
docs/CHANGELOG.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 6dc81352..82c7cd8d 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -1,3 +1,6 @@
+## Version 0.3.3-SNAPSHOT (2018/10/12)
+* Merged: Added upsert method to move a specific item to the start. [#209](https://github.com/stfalcon-studio/ChatKit/pull/209)
+
## Version 0.3.2 (2018/09/28)
* [Passing custom data to ImageLoader](https://github.com/stfalcon-studio/ChatKit/issues/183)
* Fixed [#198](https://github.com/stfalcon-studio/ChatKit/issues/198)
From c48ace09d79c9825724062987880eee8b9ca9b3e Mon Sep 17 00:00:00 2001
From: Anton
Date: Fri, 12 Oct 2018 10:00:59 +0300
Subject: [PATCH 69/85] version 0.3.3-SNAPSHOT
---
chatkit/build.gradle | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/chatkit/build.gradle b/chatkit/build.gradle
index 9889ae13..32c8c3da 100644
--- a/chatkit/build.gradle
+++ b/chatkit/build.gradle
@@ -8,8 +8,7 @@ android {
defaultConfig {
minSdkVersion 14
versionCode 1
- versionName "0.3.2"
-
+ versionName "0.3.3-SNAPSHOT"
consumerProguardFiles 'proguard.txt'
}
android {
@@ -22,7 +21,7 @@ android {
publish {
groupId = 'com.github.stfalcon'
artifactId = 'chatkit'
- publishVersion = '0.3.2'
+ publishVersion = '0.3.3-SNAPSHOT'
desc = 'ChatKit - is a library designed to simplify the development of UI for such a trivial task as chat. It have flexible possibilities for styling, customizing and data management'
licences = ['Apache-2.0']
uploadName = 'ChatKit'
From a660b7ac9ecbb094467c226f9255a32bdc05316f Mon Sep 17 00:00:00 2001
From: Anton
Date: Fri, 12 Oct 2018 10:13:19 +0300
Subject: [PATCH 70/85] version 0.3.3
---
chatkit/build.gradle | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/chatkit/build.gradle b/chatkit/build.gradle
index 32c8c3da..f9b50b7f 100644
--- a/chatkit/build.gradle
+++ b/chatkit/build.gradle
@@ -8,7 +8,7 @@ android {
defaultConfig {
minSdkVersion 14
versionCode 1
- versionName "0.3.3-SNAPSHOT"
+ versionName "0.3.3"
consumerProguardFiles 'proguard.txt'
}
android {
@@ -21,7 +21,7 @@ android {
publish {
groupId = 'com.github.stfalcon'
artifactId = 'chatkit'
- publishVersion = '0.3.3-SNAPSHOT'
+ publishVersion = '0.3.3'
desc = 'ChatKit - is a library designed to simplify the development of UI for such a trivial task as chat. It have flexible possibilities for styling, customizing and data management'
licences = ['Apache-2.0']
uploadName = 'ChatKit'
From 6b9072b2db6c2674609cb97981522dfc1e5f8951 Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Fri, 12 Oct 2018 10:19:01 +0300
Subject: [PATCH 71/85] Update CHANGELOG.md
---
docs/CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 82c7cd8d..32e427f5 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -1,4 +1,4 @@
-## Version 0.3.3-SNAPSHOT (2018/10/12)
+## Version 0.3.3 (2018/10/12)
* Merged: Added upsert method to move a specific item to the start. [#209](https://github.com/stfalcon-studio/ChatKit/pull/209)
## Version 0.3.2 (2018/09/28)
From 2cfc13868be581aae82a9980dd7dff185a20a5dc Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Fri, 12 Oct 2018 10:20:52 +0300
Subject: [PATCH 72/85] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index a0736751..f98dad80 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ To implement all of the features above you can use the following components:
Download via Gradle:
```gradle
-compile 'com.github.stfalcon:chatkit:0.3.1'
+compile 'com.github.stfalcon:chatkit:0.3.3'
```
or Maven:
@@ -51,7 +51,7 @@ or Maven:
com.github.stfalcon
chatkit
- 0.3.1
+ 0.3.3
pom
```
From 0c77ce94379d325d21773b75747b169efa0c25ce Mon Sep 17 00:00:00 2001
From: Anton Bevza
Date: Wed, 29 May 2019 10:06:34 +0300
Subject: [PATCH 73/85] Update COMPONENT_MESSAGES_LIST.md
---
docs/COMPONENT_MESSAGES_LIST.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/COMPONENT_MESSAGES_LIST.md b/docs/COMPONENT_MESSAGES_LIST.md
index d424767f..1273fda8 100644
--- a/docs/COMPONENT_MESSAGES_LIST.md
+++ b/docs/COMPONENT_MESSAGES_LIST.md
@@ -370,7 +370,7 @@ Then in our custom ViewHolder in method `onBind`:
}
```
Then create Payload and set it and our ViewHolder class to MessageHolders config.
-```
+```java
//We can pass any data to ViewHolder with payload
CustomIncomingTextMessageViewHolder.Payload payload = new CustomIncomingTextMessageViewHolder.Payload();
//For example click listener
From 47c2ca3c8e60a089f3fa600a89905f0805000e08 Mon Sep 17 00:00:00 2001
From: Andrii Zhumela
Date: Mon, 8 Jul 2019 11:47:18 +0300
Subject: [PATCH 74/85] Update README.md
---
README.md | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/README.md b/README.md
index f98dad80..5b64f95a 100644
--- a/README.md
+++ b/README.md
@@ -56,6 +56,13 @@ or Maven:
```
+### AndroidX
+To use with AndroidX you have to set targetSdkVersion for your project to 28 and add following 2 lines in ```gradle.properties``` file.
+```
+android.useAndroidX=true
+android.enableJetifier=true
+```
+
### Proguard
If you are using ProGuard you might need to add rules:
```
From 243e8908de999a9111b2c4192808488f2c946fd0 Mon Sep 17 00:00:00 2001
From: Andrii Zhumela
Date: Tue, 9 Jul 2019 09:59:54 +0300
Subject: [PATCH 75/85] Update COMPONENT_MESSAGES_LIST.md
---
docs/COMPONENT_MESSAGES_LIST.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/COMPONENT_MESSAGES_LIST.md b/docs/COMPONENT_MESSAGES_LIST.md
index 1273fda8..cff2a03e 100644
--- a/docs/COMPONENT_MESSAGES_LIST.md
+++ b/docs/COMPONENT_MESSAGES_LIST.md
@@ -282,7 +282,7 @@ But what if you need not only to change the appearance of the elements, but also
* `@id/messageTime` (TextView)
* `@id/messageUserAvatar` (ImageView)
-For better understanding see how [custom layout looks like](https://github.com/stfalcon-studio/ChatKit/blob/master/sample/src/main/res/layout/item_custom_incoming_message.xml)
+For better understanding see how [custom layout looks like](https://github.com/stfalcon-studio/ChatKit/blob/master/sample/src/main/res/layout/item_custom_incoming_text_message.xml)
After a layout was created, you need to put it into `HoldersConfig` object, which has appropriate methods for each layout files: `setIncomingLayout(int layoutRes)`, `setOutcomingLayout(int layoutRes)` `setDateHeaderLayout(int layoutRes)`. To hook up a config object, you need to transfer it to adapter through a constructor:
From b3be2b0f840c23683ece92c084a60df78737da73 Mon Sep 17 00:00:00 2001
From: Ilya Gazman
Date: Wed, 7 Oct 2020 19:54:44 -0400
Subject: [PATCH 76/85] Migrated to AndroidX and Java 8
---
chatkit/build.gradle | 21 +-
chatkit/src/main/AndroidManifest.xml | 3 +-
.../stfalcon/chatkit/commons/ImageLoader.java | 3 +-
.../com/stfalcon/chatkit/commons/Style.java | 11 +-
.../stfalcon/chatkit/commons/ViewHolder.java | 3 +-
.../chatkit/commons/models/IUser.java | 6 +-
.../commons/models/MessageContentType.java | 3 +-
.../stfalcon/chatkit/dialogs/DialogsList.java | 15 +-
.../chatkit/dialogs/DialogsListAdapter.java | 87 +++--
.../chatkit/messages/MessageHolders.java | 40 +--
.../chatkit/messages/MessageInput.java | 15 +-
.../chatkit/messages/MessageInputStyle.java | 7 +-
.../chatkit/messages/MessagesList.java | 11 +-
.../chatkit/messages/MessagesListAdapter.java | 52 ++-
.../chatkit/messages/MessagesListStyle.java | 7 +-
.../messages/RecyclerScrollMoreListener.java | 8 +-
.../chatkit/utils/RoundedImageView.java | 14 +-
.../chatkit/utils/ShapeImageView.java | 2 +-
.../src/main/res/layout/item_date_header.xml | 10 +-
chatkit/src/main/res/layout/item_dialog.xml | 20 +-
.../layout/item_incoming_image_message.xml | 11 +-
.../res/layout/item_incoming_text_message.xml | 9 +-
.../layout/item_outcoming_image_message.xml | 9 +-
.../layout/item_outcoming_text_message.xml | 7 +-
.../main/res/layout/view_message_input.xml | 17 +-
chatkit/src/main/res/values/attrs.xml | 316 +++++++++---------
chatkit/src/main/res/values/strings.xml | 2 +-
gradle.properties | 4 -
gradlew | 198 +++++------
sample/build.gradle | 35 +-
.../sample/ExampleInstrumentedTest.java | 7 +-
sample/src/main/AndroidManifest.xml | 32 +-
.../features/demo/DemoDialogsActivity.java | 13 +-
.../features/demo/DemoMessagesActivity.java | 46 +--
.../holder/CustomHolderDialogsActivity.java | 2 +-
.../holder/CustomHolderMessagesActivity.java | 13 +-
.../CustomIncomingTextMessageViewHolder.java | 9 +-
.../layout/CustomLayoutDialogsActivity.java | 2 +-
.../layout/CustomLayoutMessagesActivity.java | 4 +-
.../media/CustomMediaMessagesActivity.java | 13 +-
.../IncomingVoiceMessageViewHolder.java | 4 +-
.../OutcomingVoiceMessageViewHolder.java | 4 +-
.../demo/def/DefaultDialogsActivity.java | 2 +-
.../demo/def/DefaultMessagesActivity.java | 17 +-
.../demo/styled/StyledDialogsActivity.java | 2 +-
.../demo/styled/StyledMessagesActivity.java | 4 +-
.../sample/features/main/MainActivity.java | 9 +-
.../main/adapter/DemoCardFragment.java | 15 +-
.../adapter/MainActivityPagerAdapter.java | 7 +-
.../chatkit/sample/utils/AppUtils.java | 3 +-
.../res/drawable/dark_blue_top_gradient.xml | 4 +-
.../src/main/res/drawable/ic_play_black.xml | 5 +-
.../src/main/res/drawable/ic_play_white.xml | 5 +-
.../res/drawable/shape_bubble_offline.xml | 8 +-
.../main/res/drawable/shape_bubble_online.xml | 8 +-
.../main/res/drawable/shape_custom_cursor.xml | 6 +-
.../layout/activity_custom_holder_dialogs.xml | 5 +-
.../activity_custom_holder_messages.xml | 9 +-
.../layout/activity_custom_layout_dialogs.xml | 5 +-
.../activity_custom_layout_messages.xml | 9 +-
.../layout/activity_custom_media_messages.xml | 9 +-
.../res/layout/activity_default_dialogs.xml | 5 +-
.../res/layout/activity_default_messages.xml | 9 +-
sample/src/main/res/layout/activity_main.xml | 17 +-
.../res/layout/activity_styled_dialogs.xml | 5 +-
.../res/layout/activity_styled_messages.xml | 9 +-
.../main/res/layout/fragment_demo_card.xml | 11 +-
.../main/res/layout/item_custom_dialog.xml | 17 +-
.../layout/item_custom_dialog_view_holder.xml | 20 +-
.../item_custom_incoming_image_message.xml | 11 +-
.../item_custom_incoming_text_message.xml | 11 +-
.../item_custom_incoming_voice_message.xml | 11 +-
.../item_custom_outcoming_image_message.xml | 7 +-
.../item_custom_outcoming_text_message.xml | 7 +-
.../item_custom_outcoming_voice_message.xml | 9 +-
sample/src/main/res/layout/item_sample.xml | 11 +-
.../src/main/res/menu/chat_actions_menu.xml | 6 +-
.../chatkit/sample/ExampleUnitTest.java | 2 +-
78 files changed, 658 insertions(+), 737 deletions(-)
diff --git a/chatkit/build.gradle b/chatkit/build.gradle
index f9b50b7f..14d6746d 100644
--- a/chatkit/build.gradle
+++ b/chatkit/build.gradle
@@ -2,8 +2,8 @@ apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'
android {
- compileSdkVersion 27
- buildToolsVersion "27.0.3"
+ compileSdkVersion 29
+ buildToolsVersion '29.0.2'
defaultConfig {
minSdkVersion 14
@@ -16,6 +16,11 @@ android {
abortOnError false
}
}
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
}
publish {
@@ -28,15 +33,11 @@ publish {
website = 'https://github.com/stfalcon-studio/ChatKit.git'
}
-ext {
- supportVersion = '27.1.1'
- flexboxVersion = '1.0.0'
-}
-
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation "com.android.support:appcompat-v7:$supportVersion"
- implementation "com.android.support:design:$supportVersion"
- implementation "com.google.android:flexbox:$flexboxVersion"
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'com.google.android.material:material:1.2.1'
+ implementation "com.google.android:flexbox:1.0.0"
+ implementation 'androidx.recyclerview:recyclerview:1.1.0'
}
diff --git a/chatkit/src/main/AndroidManifest.xml b/chatkit/src/main/AndroidManifest.xml
index 1b8f973d..e3238ed8 100644
--- a/chatkit/src/main/AndroidManifest.xml
+++ b/chatkit/src/main/AndroidManifest.xml
@@ -1,4 +1,3 @@
-
+
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/commons/ImageLoader.java b/chatkit/src/main/java/com/stfalcon/chatkit/commons/ImageLoader.java
index a0f7f44f..bfcfeb78 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/commons/ImageLoader.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/commons/ImageLoader.java
@@ -16,9 +16,10 @@
package com.stfalcon.chatkit.commons;
-import android.support.annotation.Nullable;
import android.widget.ImageView;
+import androidx.annotation.Nullable;
+
/**
* Callback for implementing images loading in message list
*/
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/commons/Style.java b/chatkit/src/main/java/com/stfalcon/chatkit/commons/Style.java
index fcbd8a77..c69511a3 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/commons/Style.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/commons/Style.java
@@ -20,14 +20,15 @@
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
-import android.support.annotation.AttrRes;
-import android.support.annotation.ColorRes;
-import android.support.annotation.DimenRes;
-import android.support.annotation.DrawableRes;
-import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.util.TypedValue;
+import androidx.annotation.AttrRes;
+import androidx.annotation.ColorRes;
+import androidx.annotation.DimenRes;
+import androidx.annotation.DrawableRes;
+import androidx.core.content.ContextCompat;
+
import com.stfalcon.chatkit.R;
/**
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/commons/ViewHolder.java b/chatkit/src/main/java/com/stfalcon/chatkit/commons/ViewHolder.java
index dff3193c..c92d5213 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/commons/ViewHolder.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/commons/ViewHolder.java
@@ -16,9 +16,10 @@
package com.stfalcon.chatkit.commons;
-import android.support.v7.widget.RecyclerView;
import android.view.View;
+import androidx.recyclerview.widget.RecyclerView;
+
/**
* Base ViewHolder
*/
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/IUser.java b/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/IUser.java
index d51c2081..d4c621a0 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/IUser.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/IUser.java
@@ -25,20 +25,20 @@ public interface IUser {
* Returns the user's id
*
* @return the user's id
- * */
+ */
String getId();
/**
* Returns the user's name
*
* @return the user's name
- * */
+ */
String getName();
/**
* Returns the user's avatar image url
*
* @return the user's avatar image url
- * */
+ */
String getAvatar();
}
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/MessageContentType.java b/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/MessageContentType.java
index b8f2675a..cb33dd6c 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/MessageContentType.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/commons/models/MessageContentType.java
@@ -16,7 +16,8 @@
package com.stfalcon.chatkit.commons.models;
-import android.support.annotation.Nullable;
+import androidx.annotation.Nullable;
+
import com.stfalcon.chatkit.messages.MessageHolders;
/*
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsList.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsList.java
index 6336203d..cf2448cb 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsList.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsList.java
@@ -17,13 +17,14 @@
package com.stfalcon.chatkit.dialogs;
import android.content.Context;
-import android.support.annotation.Nullable;
-import android.support.v7.widget.DefaultItemAnimator;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.SimpleItemAnimator;
import android.util.AttributeSet;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.DefaultItemAnimator;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.recyclerview.widget.SimpleItemAnimator;
+
import com.stfalcon.chatkit.commons.models.IDialog;
/**
@@ -73,7 +74,7 @@ public void setAdapter(Adapter adapter) {
* @param adapter Adapter. Must extend DialogsListAdapter
* @param Dialog model class
*/
- public
+ public >
void setAdapter(DialogsListAdapter adapter) {
setAdapter(adapter, false);
}
@@ -85,7 +86,7 @@ void setAdapter(DialogsListAdapter adapter) {
* @param reverseLayout weather to use reverse layout for layout manager.
* @param Dialog model class
*/
- public
+ public >
void setAdapter(DialogsListAdapter adapter, boolean reverseLayout) {
SimpleItemAnimator itemAnimator = new DefaultItemAnimator();
itemAnimator.setSupportsChangeAnimations(false);
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
index dc48e7f0..147fda0e 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/dialogs/DialogsListAdapter.java
@@ -18,9 +18,6 @@
import android.graphics.Typeface;
import android.graphics.drawable.GradientDrawable;
-import android.support.annotation.LayoutRes;
-import android.support.annotation.Nullable;
-import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
@@ -28,6 +25,10 @@
import android.widget.ImageView;
import android.widget.TextView;
+import androidx.annotation.LayoutRes;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.RecyclerView;
+
import com.stfalcon.chatkit.R;
import com.stfalcon.chatkit.commons.ImageLoader;
import com.stfalcon.chatkit.commons.ViewHolder;
@@ -216,8 +217,9 @@ public void addItem(int position, DIALOG dialog) {
/**
* Move an item
+ *
* @param fromPosition the actual position of the item
- * @param toPosition the new position of the item
+ * @param toPosition the new position of the item
*/
public void moveItem(int fromPosition, int toPosition) {
DIALOG dialog = items.remove(fromPosition);
@@ -327,15 +329,12 @@ public boolean updateDialogWithMessage(String dialogId, IMessage message) {
* Sort dialog by last message date
*/
public void sortByLastMessageDate() {
- Collections.sort(items, new Comparator() {
- @Override
- public int compare(DIALOG o1, DIALOG o2) {
- if (o1.getLastMessage().getCreatedAt().after(o2.getLastMessage().getCreatedAt())) {
- return -1;
- } else if (o1.getLastMessage().getCreatedAt().before(o2.getLastMessage().getCreatedAt())) {
- return 1;
- } else return 0;
- }
+ Collections.sort(items, (o1, o2) -> {
+ if (o1.getLastMessage().getCreatedAt().after(o2.getLastMessage().getCreatedAt())) {
+ return -1;
+ } else if (o1.getLastMessage().getCreatedAt().before(o2.getLastMessage().getCreatedAt())) {
+ return 1;
+ } else return 0;
});
notifyDataSetChanged();
}
@@ -443,15 +442,15 @@ void setStyle(DialogListStyle dialogStyle) {
}
/**
- * @return the position of a dialog in the dialogs list.
- */
+ * @return the position of a dialog in the dialogs list.
+ */
public int getDialogPosition(DIALOG dialog) {
return this.items.indexOf(dialog);
}
/*
- * LISTENERS
- * */
+ * LISTENERS
+ * */
public interface OnDialogClickListener {
void onDialogClick(DIALOG dialog);
}
@@ -469,8 +468,8 @@ public interface OnDialogViewLongClickListener {
}
/*
- * HOLDERS
- * */
+ * HOLDERS
+ * */
public abstract static class BaseDialogViewHolder
extends ViewHolder {
@@ -525,15 +524,15 @@ public static class DialogViewHolder extends BaseDialogV
public DialogViewHolder(View itemView) {
super(itemView);
- root = (ViewGroup) itemView.findViewById(R.id.dialogRootLayout);
- container = (ViewGroup) itemView.findViewById(R.id.dialogContainer);
- tvName = (TextView) itemView.findViewById(R.id.dialogName);
- tvDate = (TextView) itemView.findViewById(R.id.dialogDate);
- tvLastMessage = (TextView) itemView.findViewById(R.id.dialogLastMessage);
- tvBubble = (TextView) itemView.findViewById(R.id.dialogUnreadBubble);
- ivLastMessageUser = (ImageView) itemView.findViewById(R.id.dialogLastMessageUserAvatar);
- ivAvatar = (ImageView) itemView.findViewById(R.id.dialogAvatar);
- dividerContainer = (ViewGroup) itemView.findViewById(R.id.dialogDividerContainer);
+ root = itemView.findViewById(R.id.dialogRootLayout);
+ container = itemView.findViewById(R.id.dialogContainer);
+ tvName = itemView.findViewById(R.id.dialogName);
+ tvDate = itemView.findViewById(R.id.dialogDate);
+ tvLastMessage = itemView.findViewById(R.id.dialogLastMessage);
+ tvBubble = itemView.findViewById(R.id.dialogUnreadBubble);
+ ivLastMessageUser = itemView.findViewById(R.id.dialogLastMessageUserAvatar);
+ ivAvatar = itemView.findViewById(R.id.dialogAvatar);
+ dividerContainer = itemView.findViewById(R.id.dialogDividerContainer);
divider = itemView.findViewById(R.id.dialogDivider);
}
@@ -680,30 +679,24 @@ public void onBind(final DIALOG dialog) {
tvBubble.setVisibility(dialogStyle.isDialogUnreadBubbleEnabled() &&
dialog.getUnreadCount() > 0 ? VISIBLE : GONE);
- container.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- if (onDialogClickListener != null) {
- onDialogClickListener.onDialogClick(dialog);
- }
- if (onDialogViewClickListener != null) {
- onDialogViewClickListener.onDialogViewClick(view, dialog);
- }
+ container.setOnClickListener(view -> {
+ if (onDialogClickListener != null) {
+ onDialogClickListener.onDialogClick(dialog);
+ }
+ if (onDialogViewClickListener != null) {
+ onDialogViewClickListener.onDialogViewClick(view, dialog);
}
});
- container.setOnLongClickListener(new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View view) {
- if (onLongItemClickListener != null) {
- onLongItemClickListener.onDialogLongClick(dialog);
- }
- if (onDialogViewLongClickListener != null) {
- onDialogViewLongClickListener.onDialogViewLongClick(view, dialog);
- }
- return onLongItemClickListener != null || onDialogViewLongClickListener != null;
+ container.setOnLongClickListener(view -> {
+ if (onLongItemClickListener != null) {
+ onLongItemClickListener.onDialogLongClick(dialog);
+ }
+ if (onDialogViewLongClickListener != null) {
+ onDialogViewLongClickListener.onDialogViewLongClick(view, dialog);
}
+ return onLongItemClickListener != null || onDialogViewLongClickListener != null;
});
}
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
index c089cbdf..2c09b016 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageHolders.java
@@ -1,8 +1,5 @@
package com.stfalcon.chatkit.messages;
-import android.support.annotation.LayoutRes;
-import android.support.annotation.NonNull;
-import android.support.v4.view.ViewCompat;
import android.text.Spannable;
import android.text.method.LinkMovementMethod;
import android.util.SparseArray;
@@ -14,6 +11,10 @@
import android.widget.ImageView;
import android.widget.TextView;
+import androidx.annotation.LayoutRes;
+import androidx.annotation.NonNull;
+import androidx.core.view.ViewCompat;
+
import com.stfalcon.chatkit.R;
import com.stfalcon.chatkit.commons.ImageLoader;
import com.stfalcon.chatkit.commons.ViewHolder;
@@ -508,8 +509,8 @@ MessageHolders registerContentType(
customContentTypes.add(
new MessageHolders.ContentTypeConfig<>(type,
- new MessageHolders.HolderConfig<>(incomingHolder, incomingLayout, incomingPayload),
- new MessageHolders.HolderConfig<>(outcomingHolder, outcomingLayout, outcomingPayload)));
+ new HolderConfig<>(incomingHolder, incomingLayout, incomingPayload),
+ new HolderConfig<>(outcomingHolder, outcomingLayout, outcomingPayload)));
this.contentChecker = contentChecker;
return this;
}
@@ -580,12 +581,7 @@ protected void bind(final ViewHolder holder, final Object item, boolean isSelect
final int key = clickListenersArray.keyAt(i);
final View view = holder.itemView.findViewById(key);
if (view != null) {
- view.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- clickListenersArray.get(key).onMessageViewClick(view, (IMessage) item);
- }
- });
+ view.setOnClickListener(v -> clickListenersArray.get(key).onMessageViewClick(view, (IMessage) item));
}
}
} else if (item instanceof Date) {
@@ -793,8 +789,8 @@ public void applyStyle(MessagesListStyle style) {
}
private void init(View itemView) {
- bubble = (ViewGroup) itemView.findViewById(R.id.bubble);
- text = (TextView) itemView.findViewById(R.id.messageText);
+ bubble = itemView.findViewById(R.id.bubble);
+ text = itemView.findViewById(R.id.messageText);
}
}
@@ -852,8 +848,8 @@ public final void applyStyle(MessagesListStyle style) {
}
private void init(View itemView) {
- bubble = (ViewGroup) itemView.findViewById(R.id.bubble);
- text = (TextView) itemView.findViewById(R.id.messageText);
+ bubble = itemView.findViewById(R.id.bubble);
+ text = itemView.findViewById(R.id.messageText);
}
}
@@ -913,7 +909,7 @@ protected Object getPayloadForImageLoader(MESSAGE message) {
}
private void init(View itemView) {
- image = (ImageView) itemView.findViewById(R.id.image);
+ image = itemView.findViewById(R.id.image);
imageOverlay = itemView.findViewById(R.id.imageOverlay);
if (image instanceof RoundedImageView) {
@@ -983,7 +979,7 @@ protected Object getPayloadForImageLoader(MESSAGE message) {
}
private void init(View itemView) {
- image = (ImageView) itemView.findViewById(R.id.image);
+ image = itemView.findViewById(R.id.image);
imageOverlay = itemView.findViewById(R.id.imageOverlay);
if (image instanceof RoundedImageView) {
@@ -1009,7 +1005,7 @@ public static class DefaultDateHeaderViewHolder extends ViewHolder
public DefaultDateHeaderViewHolder(View itemView) {
super(itemView);
- text = (TextView) itemView.findViewById(R.id.messageText);
+ text = itemView.findViewById(R.id.messageText);
}
@Override
@@ -1089,8 +1085,8 @@ public void applyStyle(MessagesListStyle style) {
}
private void init(View itemView) {
- time = (TextView) itemView.findViewById(R.id.messageTime);
- userAvatar = (ImageView) itemView.findViewById(R.id.messageUserAvatar);
+ time = itemView.findViewById(R.id.messageTime);
+ userAvatar = itemView.findViewById(R.id.messageUserAvatar);
}
}
@@ -1130,7 +1126,7 @@ public void applyStyle(MessagesListStyle style) {
}
private void init(View itemView) {
- time = (TextView) itemView.findViewById(R.id.messageTime);
+ time = itemView.findViewById(R.id.messageTime);
}
}
@@ -1189,7 +1185,7 @@ private ContentTypeConfig(
}
}
- private class HolderConfig {
+ private static class HolderConfig {
protected Class extends BaseMessageViewHolder extends T>> holder;
protected int layout;
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
index 16e42a35..665f0503 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInput.java
@@ -19,8 +19,6 @@
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
-import android.support.v4.view.ViewCompat;
-import android.support.v4.widget.Space;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
@@ -29,8 +27,11 @@
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
+import android.widget.Space;
import android.widget.TextView;
+import androidx.core.view.ViewCompat;
+
import com.stfalcon.chatkit.R;
import java.lang.reflect.Field;
@@ -226,11 +227,11 @@ && getPaddingBottom() == 0) {
private void init(Context context) {
inflate(context, R.layout.view_message_input, this);
- messageInput = (EditText) findViewById(R.id.messageInput);
- messageSendButton = (ImageButton) findViewById(R.id.messageSendButton);
- attachmentButton = (ImageButton) findViewById(R.id.attachmentButton);
- sendButtonSpace = (Space) findViewById(R.id.sendButtonSpace);
- attachmentButtonSpace = (Space) findViewById(R.id.attachmentButtonSpace);
+ messageInput = findViewById(R.id.messageInput);
+ messageSendButton = findViewById(R.id.messageSendButton);
+ attachmentButton = findViewById(R.id.attachmentButton);
+ sendButtonSpace = findViewById(R.id.sendButtonSpace);
+ attachmentButtonSpace = findViewById(R.id.attachmentButtonSpace);
messageSendButton.setOnClickListener(this);
attachmentButton.setOnClickListener(this);
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInputStyle.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInputStyle.java
index 1cea99c8..ddac1859 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInputStyle.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessageInputStyle.java
@@ -20,11 +20,12 @@
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
-import android.support.annotation.ColorInt;
-import android.support.annotation.DrawableRes;
-import android.support.v4.graphics.drawable.DrawableCompat;
import android.util.AttributeSet;
+import androidx.annotation.ColorInt;
+import androidx.annotation.DrawableRes;
+import androidx.core.graphics.drawable.DrawableCompat;
+
import com.stfalcon.chatkit.R;
import com.stfalcon.chatkit.commons.Style;
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesList.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesList.java
index 17b3f8ed..901b6eeb 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesList.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesList.java
@@ -17,13 +17,14 @@
package com.stfalcon.chatkit.messages;
import android.content.Context;
-import android.support.annotation.Nullable;
-import android.support.v7.widget.DefaultItemAnimator;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.SimpleItemAnimator;
import android.util.AttributeSet;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.DefaultItemAnimator;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.recyclerview.widget.SimpleItemAnimator;
+
import com.stfalcon.chatkit.commons.models.IMessage;
/**
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
index e0fcb8a2..74ed2760 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListAdapter.java
@@ -19,8 +19,6 @@
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
-import android.support.annotation.LayoutRes;
-import android.support.v7.widget.RecyclerView;
import android.text.Spannable;
import android.text.method.LinkMovementMethod;
import android.util.SparseArray;
@@ -30,6 +28,9 @@
import android.view.ViewGroup;
import android.widget.TextView;
+import androidx.annotation.LayoutRes;
+import androidx.recyclerview.widget.RecyclerView;
+
import com.stfalcon.chatkit.R;
import com.stfalcon.chatkit.commons.ImageLoader;
import com.stfalcon.chatkit.commons.ViewHolder;
@@ -617,39 +618,32 @@ private void notifyMessageViewLongClicked(View view, MESSAGE message) {
}
private View.OnClickListener getMessageClickListener(final Wrapper wrapper) {
- return new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- if (selectionListener != null && isSelectionModeEnabled) {
- wrapper.isSelected = !wrapper.isSelected;
+ return view -> {
+ if (selectionListener != null && isSelectionModeEnabled) {
+ wrapper.isSelected = !wrapper.isSelected;
- if (wrapper.isSelected) incrementSelectedItemsCount();
- else decrementSelectedItemsCount();
+ if (wrapper.isSelected) incrementSelectedItemsCount();
+ else decrementSelectedItemsCount();
- MESSAGE message = (wrapper.item);
- notifyItemChanged(getMessagePositionById(message.getId()));
- } else {
- notifyMessageClicked(wrapper.item);
- notifyMessageViewClicked(view, wrapper.item);
- }
+ MESSAGE message = (wrapper.item);
+ notifyItemChanged(getMessagePositionById(message.getId()));
+ } else {
+ notifyMessageClicked(wrapper.item);
+ notifyMessageViewClicked(view, wrapper.item);
}
};
}
private View.OnLongClickListener getMessageLongClickListener(final Wrapper wrapper) {
- return new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View view) {
- if (selectionListener == null) {
- notifyMessageLongClicked(wrapper.item);
- notifyMessageViewLongClicked(view, wrapper.item);
- return true;
- } else {
- isSelectionModeEnabled = true;
- view.performClick();
- return true;
- }
+ return view -> {
+ if (selectionListener == null) {
+ notifyMessageLongClicked(wrapper.item);
+ notifyMessageViewLongClicked(view, wrapper.item);
+ } else {
+ isSelectionModeEnabled = true;
+ view.performClick();
}
+ return true;
};
}
@@ -687,7 +681,7 @@ void setStyle(MessagesListStyle style) {
/*
* WRAPPER
* */
- public class Wrapper {
+ public static class Wrapper {
public DATA item;
public boolean isSelected;
@@ -948,7 +942,7 @@ public static class DefaultDateHeaderViewHolder extends ViewHolder
public DefaultDateHeaderViewHolder(View itemView) {
super(itemView);
- text = (TextView) itemView.findViewById(R.id.messageText);
+ text = itemView.findViewById(R.id.messageText);
}
@Override
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListStyle.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListStyle.java
index 88c6fe15..4ea6ed10 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListStyle.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/MessagesListStyle.java
@@ -22,11 +22,12 @@
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
-import android.support.annotation.ColorInt;
-import android.support.annotation.DrawableRes;
-import android.support.v4.graphics.drawable.DrawableCompat;
import android.util.AttributeSet;
+import androidx.annotation.ColorInt;
+import androidx.annotation.DrawableRes;
+import androidx.core.graphics.drawable.DrawableCompat;
+
import com.stfalcon.chatkit.R;
import com.stfalcon.chatkit.commons.Style;
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/messages/RecyclerScrollMoreListener.java b/chatkit/src/main/java/com/stfalcon/chatkit/messages/RecyclerScrollMoreListener.java
index 00012084..f6e61998 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/messages/RecyclerScrollMoreListener.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/messages/RecyclerScrollMoreListener.java
@@ -16,10 +16,10 @@
package com.stfalcon.chatkit.messages;
-import android.support.v7.widget.GridLayoutManager;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.StaggeredGridLayoutManager;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.recyclerview.widget.StaggeredGridLayoutManager;
class RecyclerScrollMoreListener
extends RecyclerView.OnScrollListener {
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/utils/RoundedImageView.java b/chatkit/src/main/java/com/stfalcon/chatkit/utils/RoundedImageView.java
index 7770fb13..d53c6f0d 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/utils/RoundedImageView.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/utils/RoundedImageView.java
@@ -18,12 +18,12 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.net.Uri;
-import android.support.annotation.DimenRes;
-import android.support.annotation.NonNull;
-import android.support.v4.content.ContextCompat;
-import android.support.v7.widget.AppCompatImageView;
import android.util.AttributeSet;
-import android.widget.ImageView;
+
+import androidx.annotation.DimenRes;
+import androidx.annotation.NonNull;
+import androidx.appcompat.widget.AppCompatImageView;
+import androidx.core.content.ContextCompat;
/**
* Thanks to Joonho Kim (https://github.com/pungrue26) for his lightweight SelectableRoundedImageView,
@@ -134,8 +134,6 @@ private static class RoundedCornerDrawable extends Drawable {
private final Paint mBitmapPaint;
- private BitmapShader mBitmapShader;
-
private float[] mRadii = new float[]{0, 0, 0, 0, 0, 0, 0, 0};
private Path mPath = new Path();
@@ -144,7 +142,7 @@ private static class RoundedCornerDrawable extends Drawable {
private RoundedCornerDrawable(Bitmap bitmap, Resources r) {
mBitmap = bitmap;
- mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
+ BitmapShader mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mBitmapWidth = bitmap.getScaledWidth(r.getDisplayMetrics());
mBitmapHeight = bitmap.getScaledHeight(r.getDisplayMetrics());
diff --git a/chatkit/src/main/java/com/stfalcon/chatkit/utils/ShapeImageView.java b/chatkit/src/main/java/com/stfalcon/chatkit/utils/ShapeImageView.java
index b9f054c5..f212468a 100644
--- a/chatkit/src/main/java/com/stfalcon/chatkit/utils/ShapeImageView.java
+++ b/chatkit/src/main/java/com/stfalcon/chatkit/utils/ShapeImageView.java
@@ -26,7 +26,7 @@
* ImageView with mask what described with Bézier Curves
*/
-public class ShapeImageView extends android.support.v7.widget.AppCompatImageView {
+public class ShapeImageView extends androidx.appcompat.widget.AppCompatImageView {
private Path path;
public ShapeImageView(Context context) {
diff --git a/chatkit/src/main/res/layout/item_date_header.xml b/chatkit/src/main/res/layout/item_date_header.xml
index 3564394c..356aef27 100644
--- a/chatkit/src/main/res/layout/item_date_header.xml
+++ b/chatkit/src/main/res/layout/item_date_header.xml
@@ -1,6 +1,6 @@
\ No newline at end of file
+ android:id="@id/messageText"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:padding="16dp" />
\ No newline at end of file
diff --git a/chatkit/src/main/res/layout/item_dialog.xml b/chatkit/src/main/res/layout/item_dialog.xml
index 9820dec2..3e3f8b55 100644
--- a/chatkit/src/main/res/layout/item_dialog.xml
+++ b/chatkit/src/main/res/layout/item_dialog.xml
@@ -1,7 +1,7 @@
+ android:id="@id/dialogRootLayout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ android:layout_margin="16dp" />
+ android:maxLines="1" />
+ android:maxLines="1" />
+ android:layout_marginRight="7dp" />
+ android:maxLines="1" />
@@ -88,7 +88,7 @@
android:ellipsize="end"
android:fontFamily="@string/font_fontFamily_medium"
android:gravity="center"
- android:lines="1"/>
+ android:lines="1" />
+ android:background="@color/dialog_divider" />
diff --git a/chatkit/src/main/res/layout/item_incoming_image_message.xml b/chatkit/src/main/res/layout/item_incoming_image_message.xml
index 2685e398..73d614d4 100644
--- a/chatkit/src/main/res/layout/item_incoming_image_message.xml
+++ b/chatkit/src/main/res/layout/item_incoming_image_message.xml
@@ -1,5 +1,4 @@
-
+ android:layout_marginRight="8dp" />
+ android:layout_toRightOf="@id/messageUserAvatar" />
+ android:layout_alignTop="@id/image" />
+ android:layout_below="@id/image" />
\ No newline at end of file
diff --git a/chatkit/src/main/res/layout/item_incoming_text_message.xml b/chatkit/src/main/res/layout/item_incoming_text_message.xml
index 3c35437d..f7ba34b0 100644
--- a/chatkit/src/main/res/layout/item_incoming_text_message.xml
+++ b/chatkit/src/main/res/layout/item_incoming_text_message.xml
@@ -1,5 +1,4 @@
-
+ android:layout_marginRight="8dp" />
+ android:layout_height="wrap_content" />
+ app:layout_alignSelf="center" />
diff --git a/chatkit/src/main/res/layout/item_outcoming_image_message.xml b/chatkit/src/main/res/layout/item_outcoming_image_message.xml
index 21712d4f..0149b461 100644
--- a/chatkit/src/main/res/layout/item_outcoming_image_message.xml
+++ b/chatkit/src/main/res/layout/item_outcoming_image_message.xml
@@ -1,5 +1,4 @@
-
+ android:layout_marginStart="@dimen/message_outcoming_bubble_margin_left" />
+ android:layout_alignTop="@id/image" />
+ android:layout_below="@id/image" />
\ No newline at end of file
diff --git a/chatkit/src/main/res/layout/item_outcoming_text_message.xml b/chatkit/src/main/res/layout/item_outcoming_text_message.xml
index 51e5aeaa..58e58351 100644
--- a/chatkit/src/main/res/layout/item_outcoming_text_message.xml
+++ b/chatkit/src/main/res/layout/item_outcoming_text_message.xml
@@ -1,5 +1,4 @@
-
+ android:layout_alignWithParentIfMissing="true" />
+ app:layout_order="1" />
diff --git a/chatkit/src/main/res/layout/view_message_input.xml b/chatkit/src/main/res/layout/view_message_input.xml
index aaed1f5f..9ab1b4d9 100644
--- a/chatkit/src/main/res/layout/view_message_input.xml
+++ b/chatkit/src/main/res/layout/view_message_input.xml
@@ -1,5 +1,4 @@
-
@@ -8,14 +7,14 @@
android:id="@id/attachmentButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_centerVertical="true"/>
+ android:layout_centerVertical="true" />
-
+ android:layout_toRightOf="@id/attachmentButton" />
+ android:inputType="textAutoCorrect|textAutoComplete|textMultiLine|textCapSentences" />
-
+ android:layout_toStartOf="@id/messageSendButton" />
+ android:layout_centerVertical="true" />
\ No newline at end of file
diff --git a/chatkit/src/main/res/values/attrs.xml b/chatkit/src/main/res/values/attrs.xml
index 1cd0a317..4e996630 100644
--- a/chatkit/src/main/res/values/attrs.xml
+++ b/chatkit/src/main/res/values/attrs.xml
@@ -1,227 +1,227 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
+
-
-
+
+
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
+
-
-
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
+
+
diff --git a/chatkit/src/main/res/values/strings.xml b/chatkit/src/main/res/values/strings.xml
index ea100eae..2c5844dd 100644
--- a/chatkit/src/main/res/values/strings.xml
+++ b/chatkit/src/main/res/values/strings.xml
@@ -1 +1 @@
-
+
diff --git a/gradle.properties b/gradle.properties
index aac7c9b4..743d692c 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,16 +1,12 @@
# Project-wide Gradle settings.
-
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
-
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
-
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
-
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
diff --git a/gradlew b/gradlew
index 27309d92..dc2f857e 100755
--- a/gradlew
+++ b/gradlew
@@ -10,22 +10,22 @@
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
+while [ -h "$PRG" ]; do
+ ls=$(ls -ld "$PRG")
+ link=$(expr "$ls" : '.*-> \(.*\)$')
+ if expr "$link" : '/.*' >/dev/null; then
+ PRG="$link"
+ else
+ PRG=$(dirname "$PRG")"/$link"
+ fi
done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
+SAVED="$(pwd)"
+cd "$(dirname \"$PRG\")/" >/dev/null
+APP_HOME="$(pwd -P)"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
+APP_BASE_NAME=$(basename "$0")
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
@@ -33,15 +33,15 @@ DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
-warn ( ) {
- echo "$*"
+warn() {
+ echo "$*"
}
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
+die() {
+ echo
+ echo "$*"
+ echo
+ exit 1
}
# OS specific support (must be 'true' or 'false').
@@ -49,114 +49,114 @@ cygwin=false
msys=false
darwin=false
nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
+case "$(uname)" in
+CYGWIN*)
+ cygwin=true
+ ;;
+Darwin*)
+ darwin=true
+ ;;
+MINGW*)
+ msys=true
+ ;;
+NONSTOP*)
+ nonstop=true
+ ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+if [ -n "$JAVA_HOME" ]; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ]; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ]; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
- fi
+ fi
else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ]; then
+ MAX_FD_LIMIT=$(ulimit -H -n)
+ if [ $? -eq 0 ]; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
+ MAX_FD="$MAX_FD_LIMIT"
fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ]; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+if $cygwin; then
+ APP_HOME=$(cygpath --path --mixed "$APP_HOME")
+ CLASSPATH=$(cygpath --path --mixed "$CLASSPATH")
+ JAVACMD=$(cygpath --unix "$JAVACMD")
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null)
+ SEP=""
+ for dir in $ROOTDIRSRAW; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ]; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@"; do
+ CHECK=$(echo "$arg" | egrep -c "$OURCYGPATTERN" -)
+ CHECK2=$(echo "$arg" | egrep -c "^-") ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ### Added a condition
+ eval $(echo args$i)=$(cygpath --path --ignore --mixed "$arg")
+ else
+ eval $(echo args$i)="\"$arg\""
fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
+ i=$((i + 1))
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
- JVM_OPTS=("$@")
+ JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
diff --git a/sample/build.gradle b/sample/build.gradle
index dbed4d4e..15944d1b 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -1,14 +1,14 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 27
- buildToolsVersion "27.0.3"
+ compileSdkVersion 29
+ buildToolsVersion '29.0.2'
defaultConfig {
applicationId "com.stfalcon.chatkit.sample"
minSdkVersion 14
versionCode 1
versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
@@ -21,37 +21,34 @@ android {
abortOnError false
}
}
-}
-ext {
- supportVersion = '27.1.1'
- picassoVersion = '2.5.2'
- circleImageViewVersion = '2.2.0'
- shapeImageViewVersion = '0.9.3'
- circleindicatorVersion = '1.2.2@aar'
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
}
dependencies {
implementation project(':chatkit')
implementation fileTree(dir: 'libs', include: ['*.jar'])
- androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
+ androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
- testImplementation 'junit:junit:4.12'
+ testImplementation 'junit:junit:4.13'
- implementation "com.android.support:appcompat-v7:$supportVersion"
- implementation "com.android.support:cardview-v7:$supportVersion"
- implementation "com.android.support:design:$supportVersion"
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'androidx.cardview:cardview:1.0.0'
+ implementation 'com.google.android.material:material:1.2.1'
//Picasso
- implementation "com.squareup.picasso:picasso:$picassoVersion"
+ implementation "com.squareup.picasso:picasso:2.5.2"
//ImageViews
- implementation "de.hdodenhof:circleimageview:$circleImageViewVersion"
- implementation "com.github.siyamed:android-shape-imageview:$shapeImageViewVersion"
+ implementation "de.hdodenhof:circleimageview:2.2.0"
+ implementation "com.github.siyamed:android-shape-imageview:0.9.3"
//Utils
- implementation "me.relex:circleindicator:$circleindicatorVersion"
+ implementation "me.relex:circleindicator:1.2.2@aar"
}
diff --git a/sample/src/androidTest/java/com/stfalcon/chatkit/sample/ExampleInstrumentedTest.java b/sample/src/androidTest/java/com/stfalcon/chatkit/sample/ExampleInstrumentedTest.java
index 9ba761a3..ff85a942 100644
--- a/sample/src/androidTest/java/com/stfalcon/chatkit/sample/ExampleInstrumentedTest.java
+++ b/sample/src/androidTest/java/com/stfalcon/chatkit/sample/ExampleInstrumentedTest.java
@@ -1,13 +1,14 @@
package com.stfalcon.chatkit.sample;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
/**
* Instrumentation test, which will execute on an Android device.
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
index e95c5cbb..6526cb56 100644
--- a/sample/src/main/AndroidManifest.xml
+++ b/sample/src/main/AndroidManifest.xml
@@ -1,7 +1,7 @@
+ package="com.stfalcon.chatkit.sample">
-
+
-
-
+
+
+ android:theme="@style/BlueTheme" />
-
-
-
-
-
-
+ android:theme="@style/BlueTheme" />
+
+
+
+
+
+
+ android:theme="@style/BlueTheme" />
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoDialogsActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoDialogsActivity.java
index 770db5e5..568379a1 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoDialogsActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoDialogsActivity.java
@@ -1,9 +1,9 @@
package com.stfalcon.chatkit.sample.features.demo;
import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v7.app.AppCompatActivity;
-import android.widget.ImageView;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
import com.squareup.picasso.Picasso;
import com.stfalcon.chatkit.commons.ImageLoader;
@@ -25,12 +25,7 @@ public abstract class DemoDialogsActivity extends AppCompatActivity
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- imageLoader = new ImageLoader() {
- @Override
- public void loadImage(ImageView imageView, String url, Object payload) {
- Picasso.with(DemoDialogsActivity.this).load(url).into(imageView);
- }
- };
+ imageLoader = (imageView, url, payload) -> Picasso.with(DemoDialogsActivity.this).load(url).into(imageView);
}
@Override
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java
index b58867cb..d2eaca59 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java
@@ -2,12 +2,12 @@
import android.os.Bundle;
import android.os.Handler;
-import android.support.annotation.Nullable;
-import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
-import android.widget.ImageView;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
import com.squareup.picasso.Picasso;
import com.stfalcon.chatkit.commons.ImageLoader;
@@ -43,12 +43,7 @@ public abstract class DemoMessagesActivity extends AppCompatActivity
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- imageLoader = new ImageLoader() {
- @Override
- public void loadImage(ImageView imageView, String url, Object payload) {
- Picasso.with(DemoMessagesActivity.this).load(url).into(imageView);
- }
- };
+ imageLoader = (imageView, url, payload) -> Picasso.with(DemoMessagesActivity.this).load(url).into(imageView);
}
@Override
@@ -104,29 +99,24 @@ public void onSelectionChanged(int count) {
}
protected void loadMessages() {
- new Handler().postDelayed(new Runnable() { //imitation of internet connection
- @Override
- public void run() {
- ArrayList messages = MessagesFixtures.getMessages(lastLoadedDate);
- lastLoadedDate = messages.get(messages.size() - 1).getCreatedAt();
- messagesAdapter.addToEnd(messages, false);
- }
+ //imitation of internet connection
+ new Handler().postDelayed(() -> {
+ ArrayList messages = MessagesFixtures.getMessages(lastLoadedDate);
+ lastLoadedDate = messages.get(messages.size() - 1).getCreatedAt();
+ messagesAdapter.addToEnd(messages, false);
}, 1000);
}
private MessagesListAdapter.Formatter getMessageStringFormatter() {
- return new MessagesListAdapter.Formatter() {
- @Override
- public String format(Message message) {
- String createdAt = new SimpleDateFormat("MMM d, EEE 'at' h:mm a", Locale.getDefault())
- .format(message.getCreatedAt());
-
- String text = message.getText();
- if (text == null) text = "[attachment]";
-
- return String.format(Locale.getDefault(), "%s: %s (%s)",
- message.getUser().getName(), text, createdAt);
- }
+ return message -> {
+ String createdAt = new SimpleDateFormat("MMM d, EEE 'at' h:mm a", Locale.getDefault())
+ .format(message.getCreatedAt());
+
+ String text = message.getText();
+ if (text == null) text = "[attachment]";
+
+ return String.format(Locale.getDefault(), "%s: %s (%s)",
+ message.getUser().getName(), text, createdAt);
};
}
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/CustomHolderDialogsActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/CustomHolderDialogsActivity.java
index c08df41d..188aa038 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/CustomHolderDialogsActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/CustomHolderDialogsActivity.java
@@ -25,7 +25,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_holder_dialogs);
- dialogsList = (DialogsList) findViewById(R.id.dialogsList);
+ dialogsList = findViewById(R.id.dialogsList);
initAdapter();
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/CustomHolderMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/CustomHolderMessagesActivity.java
index 835dcf21..0a59d16f 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/CustomHolderMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/CustomHolderMessagesActivity.java
@@ -35,10 +35,10 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_holder_messages);
- messagesList = (MessagesList) findViewById(R.id.messagesList);
+ messagesList = findViewById(R.id.messagesList);
initAdapter();
- MessageInput input = (MessageInput) findViewById(R.id.input);
+ MessageInput input = findViewById(R.id.input);
input.setInputListener(this);
input.setAttachmentsListener(this);
}
@@ -65,13 +65,8 @@ private void initAdapter() {
//We can pass any data to ViewHolder with payload
CustomIncomingTextMessageViewHolder.Payload payload = new CustomIncomingTextMessageViewHolder.Payload();
//For example click listener
- payload.avatarClickListener = new CustomIncomingTextMessageViewHolder.OnAvatarClickListener() {
- @Override
- public void onAvatarClick() {
- Toast.makeText(CustomHolderMessagesActivity.this,
- "Text message avatar clicked", Toast.LENGTH_SHORT).show();
- }
- };
+ payload.avatarClickListener = () -> Toast.makeText(CustomHolderMessagesActivity.this,
+ "Text message avatar clicked", Toast.LENGTH_SHORT).show();
MessageHolders holdersConfig = new MessageHolders()
.setIncomingTextConfig(
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomIncomingTextMessageViewHolder.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomIncomingTextMessageViewHolder.java
index a846a840..fee813c1 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomIncomingTextMessageViewHolder.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/holder/holders/messages/CustomIncomingTextMessageViewHolder.java
@@ -29,12 +29,9 @@ public void onBind(Message message) {
//We can set click listener on view from payload
final Payload payload = (Payload) this.payload;
- userAvatar.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- if (payload != null && payload.avatarClickListener != null) {
- payload.avatarClickListener.onAvatarClick();
- }
+ userAvatar.setOnClickListener(view -> {
+ if (payload != null && payload.avatarClickListener != null) {
+ payload.avatarClickListener.onAvatarClick();
}
});
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/layout/CustomLayoutDialogsActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/layout/CustomLayoutDialogsActivity.java
index b8bddf84..faaea0b3 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/layout/CustomLayoutDialogsActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/layout/CustomLayoutDialogsActivity.java
@@ -24,7 +24,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_layout_dialogs);
- dialogsList = (DialogsList) findViewById(R.id.dialogsList);
+ dialogsList = findViewById(R.id.dialogsList);
initAdapter();
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/layout/CustomLayoutMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/layout/CustomLayoutMessagesActivity.java
index d7d7c14f..12e7749b 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/layout/CustomLayoutMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/layout/CustomLayoutMessagesActivity.java
@@ -30,10 +30,10 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_layout_messages);
- messagesList = (MessagesList) findViewById(R.id.messagesList);
+ messagesList = findViewById(R.id.messagesList);
initAdapter();
- MessageInput input = (MessageInput) findViewById(R.id.input);
+ MessageInput input = findViewById(R.id.input);
input.setInputListener(this);
input.setAttachmentsListener(this);
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/CustomMediaMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/CustomMediaMessagesActivity.java
index 7f3ae57f..caf47d13 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/CustomMediaMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/CustomMediaMessagesActivity.java
@@ -36,10 +36,10 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_media_messages);
- this.messagesList = (MessagesList) findViewById(R.id.messagesList);
+ this.messagesList = findViewById(R.id.messagesList);
initAdapter();
- MessageInput input = (MessageInput) findViewById(R.id.input);
+ MessageInput input = findViewById(R.id.input);
input.setInputListener(this);
input.setAttachmentsListener(this);
}
@@ -60,11 +60,10 @@ public void onAddAttachments() {
@Override
public boolean hasContentFor(Message message, byte type) {
- switch (type) {
- case CONTENT_TYPE_VOICE:
- return message.getVoice() != null
- && message.getVoice().getUrl() != null
- && !message.getVoice().getUrl().isEmpty();
+ if (type == CONTENT_TYPE_VOICE) {
+ return message.getVoice() != null
+ && message.getVoice().getUrl() != null
+ && !message.getVoice().getUrl().isEmpty();
}
return false;
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/IncomingVoiceMessageViewHolder.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/IncomingVoiceMessageViewHolder.java
index 80c64b5b..bdacb34a 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/IncomingVoiceMessageViewHolder.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/IncomingVoiceMessageViewHolder.java
@@ -20,8 +20,8 @@ public class IncomingVoiceMessageViewHolder
public IncomingVoiceMessageViewHolder(View itemView, Object payload) {
super(itemView, payload);
- tvDuration = (TextView) itemView.findViewById(R.id.duration);
- tvTime = (TextView) itemView.findViewById(R.id.time);
+ tvDuration = itemView.findViewById(R.id.duration);
+ tvTime = itemView.findViewById(R.id.time);
}
@Override
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/OutcomingVoiceMessageViewHolder.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/OutcomingVoiceMessageViewHolder.java
index 6d3dcbf8..b21db7d7 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/OutcomingVoiceMessageViewHolder.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/custom/media/holders/OutcomingVoiceMessageViewHolder.java
@@ -20,8 +20,8 @@ public class OutcomingVoiceMessageViewHolder
public OutcomingVoiceMessageViewHolder(View itemView, Object payload) {
super(itemView, payload);
- tvDuration = (TextView) itemView.findViewById(R.id.duration);
- tvTime = (TextView) itemView.findViewById(R.id.time);
+ tvDuration = itemView.findViewById(R.id.duration);
+ tvTime = itemView.findViewById(R.id.time);
}
@Override
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultDialogsActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultDialogsActivity.java
index 59c9cb4c..c88a3771 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultDialogsActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultDialogsActivity.java
@@ -25,7 +25,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_default_dialogs);
- dialogsList = (DialogsList) findViewById(R.id.dialogsList);
+ dialogsList = findViewById(R.id.dialogsList);
initAdapter();
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
index f13b839f..a74bca89 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/def/DefaultMessagesActivity.java
@@ -4,14 +4,12 @@
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
-import android.view.View;
import com.stfalcon.chatkit.messages.MessageInput;
import com.stfalcon.chatkit.messages.MessagesList;
import com.stfalcon.chatkit.messages.MessagesListAdapter;
import com.stfalcon.chatkit.sample.R;
import com.stfalcon.chatkit.sample.common.data.fixtures.MessagesFixtures;
-import com.stfalcon.chatkit.sample.common.data.model.Message;
import com.stfalcon.chatkit.sample.features.demo.DemoMessagesActivity;
import com.stfalcon.chatkit.sample.utils.AppUtils;
@@ -31,10 +29,10 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_default_messages);
- this.messagesList = (MessagesList) findViewById(R.id.messagesList);
+ this.messagesList = findViewById(R.id.messagesList);
initAdapter();
- MessageInput input = (MessageInput) findViewById(R.id.input);
+ MessageInput input = findViewById(R.id.input);
input.setInputListener(this);
input.setTypingListener(this);
input.setAttachmentsListener(this);
@@ -58,14 +56,9 @@ private void initAdapter() {
super.messagesAdapter.enableSelectionMode(this);
super.messagesAdapter.setLoadMoreListener(this);
super.messagesAdapter.registerViewClickListener(R.id.messageUserAvatar,
- new MessagesListAdapter.OnMessageViewClickListener() {
- @Override
- public void onMessageViewClick(View view, Message message) {
- AppUtils.showToast(DefaultMessagesActivity.this,
- message.getUser().getName() + " avatar click",
- false);
- }
- });
+ (view, message) -> AppUtils.showToast(DefaultMessagesActivity.this,
+ message.getUser().getName() + " avatar click",
+ false));
this.messagesList.setAdapter(super.messagesAdapter);
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledDialogsActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledDialogsActivity.java
index 1d8d2865..eb0acc9d 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledDialogsActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledDialogsActivity.java
@@ -28,7 +28,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_styled_dialogs);
- dialogsList = (DialogsList) findViewById(R.id.dialogsList);
+ dialogsList = findViewById(R.id.dialogsList);
initAdapter();
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledMessagesActivity.java
index ba01566a..e97ecec0 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/styled/StyledMessagesActivity.java
@@ -30,10 +30,10 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_styled_messages);
- messagesList = (MessagesList) findViewById(R.id.messagesList);
+ messagesList = findViewById(R.id.messagesList);
initAdapter();
- MessageInput input = (MessageInput) findViewById(R.id.input);
+ MessageInput input = findViewById(R.id.input);
input.setInputListener(this);
input.setAttachmentsListener(this);
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/MainActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/MainActivity.java
index 8a49e160..b05896ce 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/MainActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/MainActivity.java
@@ -1,8 +1,9 @@
package com.stfalcon.chatkit.sample.features.main;
import android.os.Bundle;
-import android.support.v4.view.ViewPager;
-import android.support.v7.app.AppCompatActivity;
+
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.viewpager.widget.ViewPager;
import com.stfalcon.chatkit.sample.R;
import com.stfalcon.chatkit.sample.features.demo.custom.holder.CustomHolderDialogsActivity;
@@ -26,12 +27,12 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- ViewPager pager = (ViewPager) findViewById(R.id.pager);
+ ViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MainActivityPagerAdapter(this, getSupportFragmentManager()));
pager.setPageMargin((int) getResources().getDimension(R.dimen.card_padding) / 4);
pager.setOffscreenPageLimit(3);
- CircleIndicator indicator = (CircleIndicator) findViewById(R.id.indicator);
+ CircleIndicator indicator = findViewById(R.id.indicator);
indicator.setViewPager(pager);
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/adapter/DemoCardFragment.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/adapter/DemoCardFragment.java
index 8d4054fd..c8779198 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/adapter/DemoCardFragment.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/adapter/DemoCardFragment.java
@@ -2,13 +2,14 @@
import android.content.Context;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
+import androidx.fragment.app.Fragment;
+
import com.stfalcon.chatkit.sample.R;
/*
@@ -54,9 +55,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_demo_card, container, false);
- TextView tvTitle = (TextView) v.findViewById(R.id.tvTitle);
- TextView tvDescription = (TextView) v.findViewById(R.id.tvDescription);
- Button button = (Button) v.findViewById(R.id.button);
+ TextView tvTitle = v.findViewById(R.id.tvTitle);
+ TextView tvDescription = v.findViewById(R.id.tvDescription);
+ Button button = v.findViewById(R.id.button);
tvTitle.setText(title);
tvDescription.setText(description);
@@ -67,10 +68,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
@Override
public void onClick(View view) {
- switch (view.getId()) {
- case R.id.button:
- onAction();
- break;
+ if (view.getId() == R.id.button) {
+ onAction();
}
}
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/adapter/MainActivityPagerAdapter.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/adapter/MainActivityPagerAdapter.java
index bfab5867..c1e01097 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/adapter/MainActivityPagerAdapter.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/adapter/MainActivityPagerAdapter.java
@@ -1,9 +1,10 @@
package com.stfalcon.chatkit.sample.features.main.adapter;
import android.content.Context;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentStatePagerAdapter;
+
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentStatePagerAdapter;
import com.stfalcon.chatkit.sample.R;
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/utils/AppUtils.java b/sample/src/main/java/com/stfalcon/chatkit/sample/utils/AppUtils.java
index 8c914dfd..ca49edef 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/utils/AppUtils.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/utils/AppUtils.java
@@ -1,9 +1,10 @@
package com.stfalcon.chatkit.sample.utils;
import android.content.Context;
-import android.support.annotation.StringRes;
import android.widget.Toast;
+import androidx.annotation.StringRes;
+
/*
* Created by troy379 on 04.04.17.
*/
diff --git a/sample/src/main/res/drawable/dark_blue_top_gradient.xml b/sample/src/main/res/drawable/dark_blue_top_gradient.xml
index fbfded4c..06162093 100644
--- a/sample/src/main/res/drawable/dark_blue_top_gradient.xml
+++ b/sample/src/main/res/drawable/dark_blue_top_gradient.xml
@@ -1,9 +1,9 @@
+ android:shape="rectangle">
+ android:startColor="@color/cornflower_blue_darkest" />
\ No newline at end of file
diff --git a/sample/src/main/res/drawable/ic_play_black.xml b/sample/src/main/res/drawable/ic_play_black.xml
index fd5de4d8..1a348327 100644
--- a/sample/src/main/res/drawable/ic_play_black.xml
+++ b/sample/src/main/res/drawable/ic_play_black.xml
@@ -1,5 +1,4 @@
-
+ android:pathData="M3,1.5v14l11,-7z" />
diff --git a/sample/src/main/res/drawable/ic_play_white.xml b/sample/src/main/res/drawable/ic_play_white.xml
index cf96f070..4196f11a 100644
--- a/sample/src/main/res/drawable/ic_play_white.xml
+++ b/sample/src/main/res/drawable/ic_play_white.xml
@@ -1,5 +1,4 @@
-
+ android:pathData="M3,1.5v14l11,-7z" />
diff --git a/sample/src/main/res/drawable/shape_bubble_offline.xml b/sample/src/main/res/drawable/shape_bubble_offline.xml
index d1cc3c34..219d82d1 100644
--- a/sample/src/main/res/drawable/shape_bubble_offline.xml
+++ b/sample/src/main/res/drawable/shape_bubble_offline.xml
@@ -1,13 +1,13 @@
+ android:shape="oval">
-
+
+ android:color="@color/white" />
+ android:height="20dp" />
\ No newline at end of file
diff --git a/sample/src/main/res/drawable/shape_bubble_online.xml b/sample/src/main/res/drawable/shape_bubble_online.xml
index 9b1bbe94..2b5f2386 100644
--- a/sample/src/main/res/drawable/shape_bubble_online.xml
+++ b/sample/src/main/res/drawable/shape_bubble_online.xml
@@ -1,13 +1,13 @@
+ android:shape="oval">
-
+
+ android:color="@color/white" />
+ android:height="20dp" />
\ No newline at end of file
diff --git a/sample/src/main/res/drawable/shape_custom_cursor.xml b/sample/src/main/res/drawable/shape_custom_cursor.xml
index c60888f9..ece0b260 100644
--- a/sample/src/main/res/drawable/shape_custom_cursor.xml
+++ b/sample/src/main/res/drawable/shape_custom_cursor.xml
@@ -1,8 +1,8 @@
+ android:shape="rectangle">
-
+
-
+
\ No newline at end of file
diff --git a/sample/src/main/res/layout/activity_custom_holder_dialogs.xml b/sample/src/main/res/layout/activity_custom_holder_dialogs.xml
index 81eb8ecd..0359eb85 100644
--- a/sample/src/main/res/layout/activity_custom_holder_dialogs.xml
+++ b/sample/src/main/res/layout/activity_custom_holder_dialogs.xml
@@ -1,5 +1,4 @@
-
+ app:dialogUnreadTitleTextStyle="bold" />
diff --git a/sample/src/main/res/layout/activity_custom_holder_messages.xml b/sample/src/main/res/layout/activity_custom_holder_messages.xml
index 88c6d1cc..723bca6c 100644
--- a/sample/src/main/res/layout/activity_custom_holder_messages.xml
+++ b/sample/src/main/res/layout/activity_custom_holder_messages.xml
@@ -1,5 +1,4 @@
-
+ app:outcomingTimeTextColor="@color/gray_dark_transparent" />
+ android:background="@color/gray_light" />
+ app:showAttachmentButton="true" />
\ No newline at end of file
diff --git a/sample/src/main/res/layout/activity_custom_layout_dialogs.xml b/sample/src/main/res/layout/activity_custom_layout_dialogs.xml
index 81eb8ecd..0359eb85 100644
--- a/sample/src/main/res/layout/activity_custom_layout_dialogs.xml
+++ b/sample/src/main/res/layout/activity_custom_layout_dialogs.xml
@@ -1,5 +1,4 @@
-
+ app:dialogUnreadTitleTextStyle="bold" />
diff --git a/sample/src/main/res/layout/activity_custom_layout_messages.xml b/sample/src/main/res/layout/activity_custom_layout_messages.xml
index 88c6d1cc..723bca6c 100644
--- a/sample/src/main/res/layout/activity_custom_layout_messages.xml
+++ b/sample/src/main/res/layout/activity_custom_layout_messages.xml
@@ -1,5 +1,4 @@
-
+ app:outcomingTimeTextColor="@color/gray_dark_transparent" />
+ android:background="@color/gray_light" />
+ app:showAttachmentButton="true" />
\ No newline at end of file
diff --git a/sample/src/main/res/layout/activity_custom_media_messages.xml b/sample/src/main/res/layout/activity_custom_media_messages.xml
index 9ce4da57..85e7db97 100644
--- a/sample/src/main/res/layout/activity_custom_media_messages.xml
+++ b/sample/src/main/res/layout/activity_custom_media_messages.xml
@@ -1,5 +1,4 @@
-
+ android:layout_above="@+id/input" />
+ android:background="@color/gray_light" />
+ app:showAttachmentButton="true" />
\ No newline at end of file
diff --git a/sample/src/main/res/layout/activity_default_dialogs.xml b/sample/src/main/res/layout/activity_default_dialogs.xml
index bb5e9436..a14ac43c 100644
--- a/sample/src/main/res/layout/activity_default_dialogs.xml
+++ b/sample/src/main/res/layout/activity_default_dialogs.xml
@@ -1,5 +1,4 @@
-
@@ -7,6 +6,6 @@
+ android:layout_height="match_parent" />
diff --git a/sample/src/main/res/layout/activity_default_messages.xml b/sample/src/main/res/layout/activity_default_messages.xml
index 9ce4da57..85e7db97 100644
--- a/sample/src/main/res/layout/activity_default_messages.xml
+++ b/sample/src/main/res/layout/activity_default_messages.xml
@@ -1,5 +1,4 @@
-
+ android:layout_above="@+id/input" />
+ android:background="@color/gray_light" />
+ app:showAttachmentButton="true" />
\ No newline at end of file
diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml
index a831f0b8..a84a40bf 100644
--- a/sample/src/main/res/layout/activity_main.xml
+++ b/sample/src/main/res/layout/activity_main.xml
@@ -1,5 +1,4 @@
-
@@ -8,7 +7,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/dark_blue_top_gradient"
- android:fitsSystemWindows="true"/>
+ android:fitsSystemWindows="true" />
+ android:textSize="28sp" />
-
+ android:paddingRight="@dimen/card_padding"
+ android:paddingBottom="20dp" />
+ android:layout_alignParentBottom="true" />
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/sample/src/main/res/layout/activity_styled_dialogs.xml b/sample/src/main/res/layout/activity_styled_dialogs.xml
index 81eb8ecd..0359eb85 100644
--- a/sample/src/main/res/layout/activity_styled_dialogs.xml
+++ b/sample/src/main/res/layout/activity_styled_dialogs.xml
@@ -1,5 +1,4 @@
-
+ app:dialogUnreadTitleTextStyle="bold" />
diff --git a/sample/src/main/res/layout/activity_styled_messages.xml b/sample/src/main/res/layout/activity_styled_messages.xml
index 62e217d3..9e2111d2 100644
--- a/sample/src/main/res/layout/activity_styled_messages.xml
+++ b/sample/src/main/res/layout/activity_styled_messages.xml
@@ -1,5 +1,4 @@
-
+ app:textAutoLink="all" />
+ android:background="@color/gray_light" />
+ app:showAttachmentButton="true" />
\ No newline at end of file
diff --git a/sample/src/main/res/layout/fragment_demo_card.xml b/sample/src/main/res/layout/fragment_demo_card.xml
index 87290af0..11841c1a 100644
--- a/sample/src/main/res/layout/fragment_demo_card.xml
+++ b/sample/src/main/res/layout/fragment_demo_card.xml
@@ -1,5 +1,4 @@
-
+ android:textSize="22sp" />
+ android:textSize="15sp" />
+ android:text="@string/view" />
-
+
diff --git a/sample/src/main/res/layout/item_custom_dialog.xml b/sample/src/main/res/layout/item_custom_dialog.xml
index a4129ab9..33b6e4d1 100644
--- a/sample/src/main/res/layout/item_custom_dialog.xml
+++ b/sample/src/main/res/layout/item_custom_dialog.xml
@@ -1,5 +1,4 @@
-
@@ -14,7 +13,7 @@
android:id="@id/dialogAvatar"
android:layout_width="@dimen/dialog_avatar_width"
android:layout_height="@dimen/dialog_avatar_height"
- android:layout_margin="16dp"/>
+ android:layout_margin="16dp" />
+ android:maxLines="1" />
+ android:maxLines="1" />
+ android:layout_marginRight="7dp" />
+ android:maxLines="1" />
@@ -91,7 +90,7 @@
android:ellipsize="end"
android:fontFamily="@string/font_fontFamily_medium"
android:gravity="center"
- android:lines="1"/>
+ android:lines="1" />
+ android:background="@color/dialog_divider" />
diff --git a/sample/src/main/res/layout/item_custom_dialog_view_holder.xml b/sample/src/main/res/layout/item_custom_dialog_view_holder.xml
index 7bb29768..96756e1b 100644
--- a/sample/src/main/res/layout/item_custom_dialog_view_holder.xml
+++ b/sample/src/main/res/layout/item_custom_dialog_view_holder.xml
@@ -1,5 +1,4 @@
-
@@ -14,7 +13,7 @@
android:id="@id/dialogAvatar"
android:layout_width="@dimen/dialog_avatar_width"
android:layout_height="@dimen/dialog_avatar_height"
- android:layout_margin="16dp"/>
+ android:layout_margin="16dp" />
+ android:maxLines="1" />
+ android:maxLines="1" />
+ android:layout_marginRight="7dp" />
+ android:maxLines="1" />
@@ -84,8 +83,7 @@
android:layout_alignRight="@id/dialogAvatar"
android:layout_alignTop="@id/dialogAvatar"
android:layout_marginRight="5dp"
- android:background="@drawable/shape_bubble_online"
- />
+ android:background="@drawable/shape_bubble_online" />
+ android:lines="1" />
+ android:background="@color/dialog_divider" />
diff --git a/sample/src/main/res/layout/item_custom_incoming_image_message.xml b/sample/src/main/res/layout/item_custom_incoming_image_message.xml
index c1455a24..9285789b 100644
--- a/sample/src/main/res/layout/item_custom_incoming_image_message.xml
+++ b/sample/src/main/res/layout/item_custom_incoming_image_message.xml
@@ -1,5 +1,4 @@
-
+ android:layout_marginRight="8dp" />
+ android:layout_marginRight="5dp" />
+ app:siSquare="false" />
+ android:layout_marginStart="16dp" />
\ No newline at end of file
diff --git a/sample/src/main/res/layout/item_custom_incoming_text_message.xml b/sample/src/main/res/layout/item_custom_incoming_text_message.xml
index bc1bbd96..a1ebdc02 100644
--- a/sample/src/main/res/layout/item_custom_incoming_text_message.xml
+++ b/sample/src/main/res/layout/item_custom_incoming_text_message.xml
@@ -1,5 +1,4 @@
-
+ android:layout_marginRight="8dp" />
+ android:layout_marginRight="5dp" />
+ android:layout_marginStart="8dp" />
@@ -54,6 +53,6 @@
android:layout_alignRight="@id/bubble"
android:layout_below="@id/bubble"
android:layout_marginLeft="16dp"
- android:layout_marginStart="16dp"/>
+ android:layout_marginStart="16dp" />
\ No newline at end of file
diff --git a/sample/src/main/res/layout/item_custom_incoming_voice_message.xml b/sample/src/main/res/layout/item_custom_incoming_voice_message.xml
index 0e3d29e8..164d9a33 100644
--- a/sample/src/main/res/layout/item_custom_incoming_voice_message.xml
+++ b/sample/src/main/res/layout/item_custom_incoming_voice_message.xml
@@ -1,5 +1,4 @@
-
+ android:layout_marginRight="8dp" />
+ android:src="@drawable/ic_play_black" />
+ android:textSize="15sp" />
@@ -55,6 +54,6 @@
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:textColor="@color/gray_dark"
- android:textSize="14sp"/>
+ android:textSize="14sp" />
\ No newline at end of file
diff --git a/sample/src/main/res/layout/item_custom_outcoming_image_message.xml b/sample/src/main/res/layout/item_custom_outcoming_image_message.xml
index f0dc5db0..28b04d38 100644
--- a/sample/src/main/res/layout/item_custom_outcoming_image_message.xml
+++ b/sample/src/main/res/layout/item_custom_outcoming_image_message.xml
@@ -1,5 +1,4 @@
-
+ app:siSquare="false" />
+ android:layout_marginStart="16dp" />
\ No newline at end of file
diff --git a/sample/src/main/res/layout/item_custom_outcoming_text_message.xml b/sample/src/main/res/layout/item_custom_outcoming_text_message.xml
index 5d63b5a5..3735ea98 100644
--- a/sample/src/main/res/layout/item_custom_outcoming_text_message.xml
+++ b/sample/src/main/res/layout/item_custom_outcoming_text_message.xml
@@ -1,5 +1,4 @@
-
+ android:layout_height="wrap_content" />
@@ -32,6 +31,6 @@
android:layout_alignStart="@id/bubble"
android:layout_below="@id/bubble"
android:layout_marginLeft="16dp"
- android:layout_marginStart="16dp"/>
+ android:layout_marginStart="16dp" />
\ No newline at end of file
diff --git a/sample/src/main/res/layout/item_custom_outcoming_voice_message.xml b/sample/src/main/res/layout/item_custom_outcoming_voice_message.xml
index fece235d..119f8ffc 100644
--- a/sample/src/main/res/layout/item_custom_outcoming_voice_message.xml
+++ b/sample/src/main/res/layout/item_custom_outcoming_voice_message.xml
@@ -1,5 +1,4 @@
-
+ android:src="@drawable/ic_play_white" />
+ android:textSize="15sp" />
@@ -45,6 +44,6 @@
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:textColor="@color/gray_dark"
- android:textSize="14sp"/>
+ android:textSize="14sp" />
\ No newline at end of file
diff --git a/sample/src/main/res/layout/item_sample.xml b/sample/src/main/res/layout/item_sample.xml
index f970b2e6..13e74cbd 100644
--- a/sample/src/main/res/layout/item_sample.xml
+++ b/sample/src/main/res/layout/item_sample.xml
@@ -1,5 +1,4 @@
-
+ android:scaleType="centerCrop" />
+ android:background="@color/gray" />
+ android:textSize="16sp" />
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/sample/src/main/res/menu/chat_actions_menu.xml b/sample/src/main/res/menu/chat_actions_menu.xml
index 746c7f73..1b1101e0 100644
--- a/sample/src/main/res/menu/chat_actions_menu.xml
+++ b/sample/src/main/res/menu/chat_actions_menu.xml
@@ -1,16 +1,16 @@
+ xmlns:app="http://schemas.android.com/apk/res-auto">
+ app:showAsAction="always" />
+ app:showAsAction="always" />
\ No newline at end of file
diff --git a/sample/src/test/java/com/stfalcon/chatkit/sample/ExampleUnitTest.java b/sample/src/test/java/com/stfalcon/chatkit/sample/ExampleUnitTest.java
index e6d4b1d2..6bed7c54 100644
--- a/sample/src/test/java/com/stfalcon/chatkit/sample/ExampleUnitTest.java
+++ b/sample/src/test/java/com/stfalcon/chatkit/sample/ExampleUnitTest.java
@@ -2,7 +2,7 @@
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
/**
* Example local unit test, which will execute on the development machine (host).
From f10254ba353b9f710f886d38bb945b6c4ce63613 Mon Sep 17 00:00:00 2001
From: Ankit
Date: Thu, 28 Jan 2021 17:18:13 +0530
Subject: [PATCH 77/85] Updated broken link
Link for [custom layout looks like](https://github.com/stfalcon-studio/ChatKit/blob/master/sample/src/main/res/layout/item_custom_dialog.xml) at line 224 is broken.
---
docs/COMPONENT_DIALOGS_LIST.MD | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/COMPONENT_DIALOGS_LIST.MD b/docs/COMPONENT_DIALOGS_LIST.MD
index e219fc1a..21763d0b 100644
--- a/docs/COMPONENT_DIALOGS_LIST.MD
+++ b/docs/COMPONENT_DIALOGS_LIST.MD
@@ -221,7 +221,7 @@ But what if changing appearance is not enough? Not a problem, create your own la
* `@id/dialogDividerContainer` (ViewGroup)
* `@id/dialogDivider` (View)
-For better understanding see how [custom layout looks like](https://github.com/stfalcon-studio/ChatKit/blob/master/sample/src/main/res/layout/item_dialog_custom.xml).
+For better understanding see how [custom layout looks like](https://github.com/stfalcon-studio/ChatKit/blob/master/sample/src/main/res/layout/item_custom_dialog.xml).
After creating layout you need to transfer it to the adapter’s constructor.
```java
From f966d46f5a38503cfa44d39553189d0205c1771e Mon Sep 17 00:00:00 2001
From: Anton
Date: Thu, 11 Feb 2021 16:08:10 +0200
Subject: [PATCH 78/85] update Picasso version
---
build.gradle | 20 +++++--------
chatkit/build.gradle | 29 ++++++++++++-------
gradle.properties | 3 ++
gradle/wrapper/gradle-wrapper.properties | 4 +--
sample/build.gradle | 2 +-
.../features/demo/DemoDialogsActivity.java | 2 +-
.../features/demo/DemoMessagesActivity.java | 2 +-
.../adapter/MainActivityPagerAdapter.java | 6 ++--
8 files changed, 36 insertions(+), 32 deletions(-)
diff --git a/build.gradle b/build.gradle
index 80103afe..9c349992 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,28 +3,22 @@
buildscript {
repositories {
jcenter()
- maven {
- url 'https://maven.google.com/'
- name 'Google'
- }
google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.1.3'
- classpath 'com.novoda:bintray-release:0.8.0'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
+ classpath 'com.android.tools.build:gradle:4.1.2'
}
}
+plugins {
+ id 'maven-publish'
+}
+
allprojects {
repositories {
jcenter()
- maven {
- url 'https://maven.google.com/'
- name 'Google'
- }
+ google()
+ maven { url "https://jitpack.io" }
}
}
diff --git a/chatkit/build.gradle b/chatkit/build.gradle
index 14d6746d..d9edfd58 100644
--- a/chatkit/build.gradle
+++ b/chatkit/build.gradle
@@ -1,5 +1,5 @@
apply plugin: 'com.android.library'
-apply plugin: 'com.novoda.bintray-release'
+apply plugin: 'maven-publish'
android {
compileSdkVersion 29
@@ -8,7 +8,7 @@ android {
defaultConfig {
minSdkVersion 14
versionCode 1
- versionName "0.3.3"
+ versionName '0.4.0'
consumerProguardFiles 'proguard.txt'
}
android {
@@ -21,16 +21,23 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
-}
-publish {
- groupId = 'com.github.stfalcon'
- artifactId = 'chatkit'
- publishVersion = '0.3.3'
- desc = 'ChatKit - is a library designed to simplify the development of UI for such a trivial task as chat. It have flexible possibilities for styling, customizing and data management'
- licences = ['Apache-2.0']
- uploadName = 'ChatKit'
- website = 'https://github.com/stfalcon-studio/ChatKit.git'
+ afterEvaluate {
+ publishing {
+ publications {
+ // Creates a Maven publication called "release".
+ release(MavenPublication) {
+ // Applies the component for the release build variant.
+ from components.release
+
+ // You can then customize attributes of the publication as shown below.
+ groupId = 'com.github.stfalcon'
+ artifactId = 'chatkit'
+ version = '0.4.0'
+ }
+ }
+ }
+ }
}
dependencies {
diff --git a/gradle.properties b/gradle.properties
index 743d692c..de89bf94 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -11,3 +11,6 @@ org.gradle.jvmargs=-Xmx1536m
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index d0edd216..66f1fe62 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Tue Jul 03 14:43:10 EEST 2018
+#Thu Feb 11 12:56:05 EET 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
diff --git a/sample/build.gradle b/sample/build.gradle
index 15944d1b..ec6c1258 100644
--- a/sample/build.gradle
+++ b/sample/build.gradle
@@ -42,7 +42,7 @@ dependencies {
implementation 'com.google.android.material:material:1.2.1'
//Picasso
- implementation "com.squareup.picasso:picasso:2.5.2"
+ implementation "com.squareup.picasso:picasso:2.71828"
//ImageViews
implementation "de.hdodenhof:circleimageview:2.2.0"
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoDialogsActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoDialogsActivity.java
index 568379a1..51d649c3 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoDialogsActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoDialogsActivity.java
@@ -25,7 +25,7 @@ public abstract class DemoDialogsActivity extends AppCompatActivity
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- imageLoader = (imageView, url, payload) -> Picasso.with(DemoDialogsActivity.this).load(url).into(imageView);
+ imageLoader = (imageView, url, payload) -> Picasso.get().load(url).into(imageView);
}
@Override
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java
index d2eaca59..5566a519 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/demo/DemoMessagesActivity.java
@@ -43,7 +43,7 @@ public abstract class DemoMessagesActivity extends AppCompatActivity
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- imageLoader = (imageView, url, payload) -> Picasso.with(DemoMessagesActivity.this).load(url).into(imageView);
+ imageLoader = (imageView, url, payload) -> Picasso.get().load(url).into(imageView);
}
@Override
diff --git a/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/adapter/MainActivityPagerAdapter.java b/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/adapter/MainActivityPagerAdapter.java
index c1e01097..09f9d842 100644
--- a/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/adapter/MainActivityPagerAdapter.java
+++ b/sample/src/main/java/com/stfalcon/chatkit/sample/features/main/adapter/MainActivityPagerAdapter.java
@@ -19,10 +19,10 @@ public class MainActivityPagerAdapter extends FragmentStatePagerAdapter {
public static final int ID_CUSTOM_VIEW_HOLDER = 3;
public static final int ID_CUSTOM_CONTENT = 4;
- private Context context;
+ private final Context context;
public MainActivityPagerAdapter(Context context, FragmentManager fm) {
- super(fm);
+ super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
this.context = context;
}
@@ -59,4 +59,4 @@ public Fragment getItem(int position) {
public int getCount() {
return 5;
}
-}
\ No newline at end of file
+}
From 3d4baf009a8ee2b769ec94bbdc0715afc7417c2d Mon Sep 17 00:00:00 2001
From: Anton
Date: Thu, 11 Feb 2021 16:38:07 +0200
Subject: [PATCH 79/85] update gradle-wrapper.properties
---
gradle/wrapper/gradle-wrapper.properties | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 66f1fe62..b12ede36 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Thu Feb 11 12:56:05 EET 2021
+#Tue Feb 09 17:12:38 EET 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
From ee44d1323b59322d117dd15f16b1a28267a7a66e Mon Sep 17 00:00:00 2001
From: Anton
Date: Thu, 11 Feb 2021 17:18:15 +0200
Subject: [PATCH 80/85] add gradle-wrapper.jar
---
.gitignore | 3 +--
gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53636 bytes
2 files changed, 1 insertion(+), 2 deletions(-)
create mode 100644 gradle/wrapper/gradle-wrapper.jar
diff --git a/.gitignore b/.gitignore
index f8d94768..03b224d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
# built application files
*.apk
*.ap_
-*.jar
# files for the dex VM
*.dex
@@ -38,4 +37,4 @@ android/proguard/
*.iws
.idea/
build/
-.gradle
\ No newline at end of file
+.gradle
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000000000000000000000000000000000000..13372aef5e24af05341d49695ee84e5f9b594659
GIT binary patch
literal 53636
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