Coder Social home page Coder Social logo

stfalcon-studio / chatkit Goto Github PK

View Code? Open in Web Editor NEW
3.7K 3.7K 813.0 5.99 MB

Android library. Flexible components for chat UI implementation with flexible possibilities for styling, customizing and data management. Made by Stfalcon

Home Page: http://stfalcon.com

License: Apache License 2.0

Java 100.00%
android android-library chat chatview jsqmessagesviewcontroller messages messaging uikit

chatkit's People

Contributors

6bangs avatar alexz89ua avatar alouanemed avatar andriizhumela avatar anymol avatar bevzaanton avatar dmathewwws avatar hbmartin avatar ilyagazman avatar joostfunkekupper avatar kirvis250 avatar mathroule avatar mradzinski avatar muankit avatar mweathers avatar philippeauriach avatar seunadelekan avatar sulfkain avatar tibolte avatar toanpv avatar troy379 avatar ynagarjuna2012 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chatkit's Issues

Put user name on top of the message

Can you help me creating the Layout of setIncoming where the username appears on top like messenger does? Like this: "Panmorn"

chatkit help

I tried to do but I was nowhere close
`

<com.stfalcon.chatkit.utils.ShapeImageView
    android:id="@id/messageUserAvatar"
    android:layout_width="40dp"
    android:layout_height="40dp"
    android:layout_alignParentBottom="true"
    android:layout_marginRight="8dp" />



<!--<ImageView
    android:id="@+id/online"
    android:layout_width="12dp"
    android:layout_height="12dp"
    android:layout_alignRight="@id/messageUserAvatar"
    android:layout_alignTop="@id/messageUserAvatar"
    android:layout_marginRight="5dp"
    android:background="@drawable/shape_bubble_online" />
-->
<com.google.android.flexbox.FlexboxLayout
    android:id="@id/bubble"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginRight="@dimen/message_incoming_bubble_margin_right"
    android:layout_toRightOf="@id/messageUserAvatar"
    app:flexWrap="wrap"
    app:alignItems="stretch"
    app:alignContent="stretch"
    app:justifyContent="flex_end"
    android:orientation="vertical">

    <TextView
        android:id="@id/messageText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />



    <TextView
        android:id="@id/messageTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_alignSelf="center"
        android:layout_marginLeft="8dp"
        android:layout_below="@id/messageText"/>

</com.google.android.flexbox.FlexboxLayout>

<TextView
    android:id="@+id/nomeuser"
    android:layout_width="wrap_content"
    android:layout_alignTop="@id/bubble"
    android:text="Pedro Barbosa"
    android:layout_marginTop="10dp"
    android:layout_marginLeft="@dimen/message_incoming_bubble_margin_right"
    android:layout_height="wrap_content" />
`

How to listen the user avatar click event?

Hi,
How to listen the user avatar tapped event?

If user avatar clicked, I want to open user profile image.
But When click image view or text view, need to open some menus.

Dismiss keyboard on enter

There is no way I can dismiss the keyboard when the user presses enter. A method such as getEditText() from within MessageInput would allow this feature to be possible.

Edit: It would also be great if the keyboard could be dismissed when the area above it is touched, like Instagram or other DM/IM/Messaging clients.

Manifest merger failed - `allowBackup` tag duplicated

Seems like the library project's manifest includes allowBackup and supportsRtl application attributes. I don't think these are necessary, since it's application's role to define whether it supports RTL/backup.

Right now the presence of these attributes is problematic, since if the consumer of the library explicitly sets allowBackup=false in their app's Manifest, the manifest merger complains about duplicate element, forcing the developer to use <tools:replace="android:allowBackup">

I'm happy to submit a pull request if what I say makes sense to you

ImageLoader with 2 differents URL

I would like to display a thumbnail (URL 1) in the message preview and implement an onClickListener in the imageLoader and use another URL(URL 2) to show it.
Is there a way to do that?

How can I update the specific message?

Is it possible to update the specific message content (UI) while in runtime?

The case that I encounter is when user send the message when the app is disconnecting the internet, it will show the loading icon, which can be achieved in onBind() function in custom view holder. But the question is how can I update the specific message (hidden the loading icon) when reconnecting the network?

Thanks for your help!!

Layout is not adjusting when keyboard is shown

I am implementing the same layout as shown in example which looks like this:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.stfalcon.chatkit.messages.MessagesList
        android:id="@+id/messages_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:dateHeaderTextColor="#ffffff"
        android:overScrollMode="never"
        app:textAutoLink="all"
        android:layout_above="@+id/input"
        android:visibility="invisible"/>

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_above="@+id/input"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:background="#9e9e9e"/>

    <com.stfalcon.chatkit.messages.MessageInput
        android:id="@+id/input"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        app:inputHint="enter a message..." />

</RelativeLayout>

But for some reason the input layout is not lifting up when keyboard is shown. Maybe because it is fragment inside the viewpager and not separate activity? And how can i fix it?

API 10 Support

Hi! Can you change the min sdk to API 10? I've seen they are not a lot of changes to do. It's simply to change the setBackground to ViewCompat.setBackground and two changes more.
Thanks

MessageInput Error. Is it a Bug of new version?

Error log is
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myhouse.woohyun.tripal2/com.myhouse.woohyun.tripal2.DefaultMessagesActivity}: android.view.InflateException: Binary XML file line #25: Error inflating class com.stfalcon.chatkit.messages.MessageInput
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2436)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495)
at android.app.ActivityThread.access$900(ActivityThread.java:170)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5635)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class com.stfalcon.chatkit.messages.MessageInput
at android.view.LayoutInflater.createView(LayoutInflater.java:626)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.myhouse.woohyun.tripal2.DefaultMessagesActivity.onCreate(DefaultMessagesActivity.java:88)
at android.app.Activity.performCreate(Activity.java:5580)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495) 
at android.app.ActivityThread.access$900(ActivityThread.java:170) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:146) 
at android.app.ActivityThread.main(ActivityThread.java:5635) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:600)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.myhouse.woohyun.tripal2.DefaultMessagesActivity.onCreate(DefaultMessagesActivity.java:88) 
at android.app.Activity.performCreate(Activity.java:5580) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495) 
at android.app.ActivityThread.access$900(ActivityThread.java:170) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:146) 
at android.app.ActivityThread.main(ActivityThread.java:5635) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 
at dalvik.system.NativeStart.main(Native Method) 
Caused by: java.lang.NullPointerException
at com.stfalcon.chatkit.messages.MessageInput.init(MessageInput.java:201)
at com.stfalcon.chatkit.messages.MessageInput.init(MessageInput.java:151)
at com.stfalcon.chatkit.messages.MessageInput.(MessageInput.java:58)
at java.lang.reflect.Constructor.constructNative(Native Method) 
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
at android.view.LayoutInflater.createView(LayoutInflater.java:600) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:292) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
at com.myhouse.woohyun.tripal2.DefaultMessagesActivity.onCreate(DefaultMessagesActivity.java:88) 
at android.app.Activity.performCreate(Activity.java:5580) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495) 
at android.app.ActivityThread.access$900(ActivityThread.java:170) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:146) 
at android.app.ActivityThread.main(ActivityThread.java:5635) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 
at dalvik.system.NativeStart.main(Native Method) 

And at com.stfalcon.chatkit.messages.MessageInput.init(MessageInput.java:201) is
attachmentButton.setOnClickListener(this);

Is it a Bug of the new version of ChatKit?

Ordering dialogs

Hi!
I'm new on android development... I'm using this library and is amazing!, it works perfectly, but now I want to keep the dialog list ordered by last messages.
My problem is not the SQL query or how can I get the List ordered, but how can I set the order in this library (I think that it gets ordered by seeing the lastMessage's createdAt, but seems that not)...

Can you help me, please?

Thanks!

DialogsList in reverse mode

Using the dialogs list I saw that dialogs were added at the bottom and reversed. So I looked for the issue and I found that in the setAdapter() method from the DialogsList class you are setting the layoutManager with the "reverseLayout" flag as true. Is that ok?

Custom inputButtonBackground for different states?

Is it possible to add a custom drawable for different states?

In "selector_bg_send.xml" I see:

<item android:drawable="@drawable/mask" android:state_enabled="false" />
<item android:drawable="@drawable/mask_active" android:state_enabled="true" />

But we are only able to set a static custom drawable using "app:inputButtonBackground".

I'd like to simply change the colour of the default purple background when it is active to blue.

Thanks for your help, love ChatKit!

Change some interface method's name

Hi, I'm using Kotlin in my project and in some models, the overrided method clash with the default getter (or setter) defined by Kotlin. Like this:

` var lastMessage: ChatMessage? = null

override fun getLastMessage(): ChatMessage? {
    return lastMessage
}
override fun setLastMessage(message: ChatMessage?) {
    lastMessage = message
}`

This give me an error at compile time.

So I'm suggesting to rename interfaces method's name to something like "getDialogId" in order to avoid that clash with common field's names.

Problems with scrolling

When I called adapter.addToStart(), incoming messages were never shown in messages list, but when I scroll this list to bottom, messages appear. Outcoming messages appear correctly, but not always, it's absolutely random, but when keyboard dissapears, they appear always. So, we tried to call addToStart like this:

                    @Override
                    public void onTextMessage(WebSocket websocket, final String message) {
                        Log.d("ChatFragment", message);
                        //По идее postDelayed быть не должно, но оно без него очень странно скроллит, а так все ок.
                        messagesList.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                MsgGson msg = gson.fromJson(message, MsgGson.class);
                                msg.setChatId(Integer.valueOf(chatId));
                                msg.save();
                                if(msg.getSender() == userId){
                                    Log.d("ChatFragment", "msg outcoming");
                                    messagesListAdapter.addToStart(new MsgChatKit(msg, self), true);
                                } else {
                                    Log.d("ChatFragment", "msg incoming");
                                    messagesListAdapter.addToStart(new MsgChatKit(msg, mate), true);
                                }
                            }
                        }, 300);
                    } 

And it works!

На англ. мб не очень грамотно пишу, продублирую, чтобы была ясна суть вопроса. Мы использовали MessagesList, сообщения приходят на вебсокет,  в OnTextMessage мы делаем код, который внутри run выше. Если сообщение входящее, то список с сообщениями не прокручивается и сообщения не видно, пока пальцем не проскроллишь их вниз. Исходящие иногда отображаются, иногда нет. Если потыкать по разным частя экрана, в тексте повыделять че нибудь, потыкать на одну, на другую вьюху, показать убрать клаву, то скроллинг может поломаться и работать также как с входящими, причем, иногда, если клавиатуру убрать показать, то оно снова работает. Долго не могли понять почему так, и тупо установка задержки в 300мс решила проблему.

Typing indicator

Hi
Is there any support for a typing indicator?

Best regards
Jonas

findViewById within a MessageListAdapter

When i use "MessageListAdapter".setOnMessageClickListener into the
onMessageClick i would like to get the View which i suppose it's a TextView
from the MessageListAdapter object by using the findViewbyId method.
What i'm missing its how do i get the View id that i should pass to findViewById method ?!?

The thing i need to do is to change the color of a part of the text dynamically and that's why i need the TextView.

NullPointerException

java.lang.NullPointerException: Attempt to write to field 'int android.support.v7.widget.RecyclerView$ViewHolder.mItemViewType' on a null object reference

Code:

        MessagesListAdapter<Message> adapter = new MessagesListAdapter<>(fromId, (imageView, url) -> Glide.with(ConversationActivity.this)
                .load(url)
                .into(imageView));
        messagesList.setAdapter(adapter);

        adapter.addToEnd(convert(list), false);


    private List<Message> convert(List<AVIMMessage> list) {
        List<Message> messages = new ArrayList<>();

        Log.d(TAG, "convert: " + list.size());
        for (AVIMMessage m : list) {
            if (m instanceof AVIMTextMessage) {
                AVIMTextMessage text = (AVIMTextMessage) m;
                Message message = new Message();
                message.setText(text.getText());
                message.setCreatedAt(new Date(m.getTimestamp()));
                message.setId(m.getMessageId());
                User u = new User(Integer.parseInt(text.getFrom()));
                message.setAuthor(new Author(u));
                Log.d(TAG, "convert: add message");
                messages.add(message);
            }
        }

        return messages;
    }

Using Glide with ImageLoader causes memory leak

Hi,

I'm using Glide to load images with the MessagesListAdapter ImageLoader, and it seems to be causing a memory leak. Here is my setup:

In my fragment:

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
        adapter = new MessagesListAdapter<>(getUser().email, (imageView, url) -> {
            Glide.with(getContext())
                    .load(url)
                    .fitCenter()
                    .into(imageView);

            imageView.setOnClickListener(view -> goToFragment(FullImageFragment.newInstance(url, getTitleString())));
        });
}

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_chat, container, false);

        MessagesList messagesList = (MessagesList)view.findViewById(R.id.messages_list);
        messagesList.setAdapter(adapter);
}

goToFragment in the onClickListener above uses a FragmentTransaction to replace the current fragment with the messages list, with another fragment that shows the full image blown up (for zooming in, etc).

However, when going back to the chat fragment, onCreateView is called again, and the memory spikes because the messages list is loading the image again. Is there something I should be doing in onDestroyView? onCreate is not called again when going back to the messages list.

I know the cause is the messages list and not the full image fragment because showing the full image fragment from other fragments (non message list fragments) does not cause the memory spike.

Any ideas?

Thanks

get View of dialog List item

Hi, I want to show popup menu when a user longClick on any dialog list item, to show popup menu I need the view of that list item, how can I get that? kindly help.

Textwatcher for MessageInput

Hello, is there a way to implement a textwatcher for the MessageInput, I need to know when I'm typing and when I'm done typing. Thank you.

学习和主要点的笔记

chatkit现在有很多了偶然的机会看到这个,虽不一定是最好的,但是对于我这种android开始的时候介入,最终放下4年以上时间来说的人,对于新的UI的模式还是挺累,感谢ChatKit的开发人员,有些重点的地方梳理如下:本来想提交到Wiki的,这个交给作者了,因为Wiki没办法打开

chatkit 中的消息被定义在RecyclerView中采用了MVP结构设计,Recyclerview中的事件,被外部接口包装并被set到RecyclerView具体可以在Activity来定义具体实现
参考
http://blog.csdn.net/chathello/article/details/69056663

chatkit中消息收发的信息的展示部分

收发信息的展示都在
MessageHolders代码里,
this.incomingTextConfig = new HolderConfig<>(DefaultIncomingTextMessageViewHolder.class, R.layout.talk_receive_msg);
this.outcomingTextConfig = new HolderConfig<>(DefaultOutcomingTextMessageViewHolder.class, R.layout.talk_send_msg);

收发信息颜色
MessagesListStyle
style.incomingTextLinkColor = typedArray.getColor(R.styleable.MessagesList_incomingTextLinkColor,
style.getSystemAccentColor());
style.outcomingTextLinkColor = typedArray.getColor(R.styleable.MessagesList_outcomingTextLinkColor,
style.getSystemAccentColor());
收发信息显示的区别:

根据发送的senderId即该位是否和窗体的用户ID一致

进入点在类MessagesListAdapter中的
public int getItemViewType(int position) {
return holders.getViewType(items.get(position).item, senderId);
}

调用
MessageHolders中的下面的

int getViewType(Object item, String senderId) {
boolean isOutcoming = false;
int viewType;

    if (item instanceof IMessage) {
        IMessage message = (IMessage) item;
        isOutcoming = message.getUser().getId().contentEquals(senderId);
        viewType = getContentViewType(message);

    } else viewType = VIEW_TYPE_DATE_HEADER;

    return isOutcoming ? viewType * -1 : viewType;
}

消息列表中数据的输入:
在每个activity中如下的地方initAdapter
super.dialogsAdapter.setItems(DialogsFixtures.getDialogs()); //输入数据

chatkit中消息列表里的代码在dialogsListAdapter中,xml文件是talk_item_dialog,其中未读消息的标签如下:

Doubt about chat groups.

Hello, I'm implementing the library but I've noticed that when you create a dialogList, you've to set how many users will be on that chat.
I want to create a anonymous chat, something like Telegram groups where anyone can register into the application (via firebase) and there will be cardviews with content and a button where any one can press and join to a chat with the topic of this card.
Is this possible? What I've supposed to put when I create a dialogList into User[] argument.

PS: I save into firebase database a object called 'AppUser' with some attributes like 'name', 'picture' and 'password'. I know that it's not secure and firebase implements it's own login implementation.

Thank you so much. :)

Gradle Install is not working

Hi All

compile 'com.github.stfalcon:chatkit:0.2.2' is added

gradle return Error:(47, 13) Failed to resolve: com.github.stfalcon:chatkit:0.2.2

Please hrlp

Regards
Taka Wong

Online indicator - Null Pointer Exception

I am trying to use custom viewholder to show if the user is online or offline, but the app crashes everytime when it comes to checking the online indicator

Error takes me to this code

if (dialog.getUsers().size() > 1) {
onlineIndicator.setVisibility(View.GONE);
} else {
boolean isOnline = dialog.getUsers().get(0).isOnline();
onlineIndicator.setVisibility(View.VISIBLE);
if (isOnline) {
onlineIndicator.setBackgroundResource(R.drawable.shape_bubble_online);
} else {
onlineIndicator.setBackgroundResource(R.drawable.shape_bubble_offline);
}
}

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean in.voiceme.app.voiceme.DTO.UserPojo.getIsOnline()' on a null object reference
at in.voiceme.app.voiceme.chat.CustomDialogViewHolder.onBind(CustomDialogViewHolder.java:30)
at in.voiceme.app.voiceme.chat.CustomDialogViewHolder.onBind(CustomDialogViewHolder.java:13)
at com.stfalcon.chatkit.dialogs.DialogsListAdapter.onBindViewHolder(DialogsListAdapter.java:101)
at com.stfalcon.chatkit.dialogs.DialogsListAdapter.onBindViewHolder(DialogsListAdapter.java:49)
at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6356)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6389)
at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5335)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5598)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1551)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3583)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3312)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3844)
at android.view.View.layout(View.java:16953)
at android.view.ViewGroup.layout(ViewGroup.java:5579)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:2001)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1844)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1753)
at android.view.View.layout(View.java:16953)
at android.view.ViewGroup.layout(ViewGroup.java:5579)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1189)
at android.view.View.layout(View.java:16953)
at android.view.ViewGroup.layout(ViewGroup.java:5579)
at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1193)
at android.view.View.layout(View.java:16953)
at android.view.ViewGroup.layout(ViewGroup.java:5579)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:396)
at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
at android.view.View.layout(View.java:16953)
at android.view.ViewGroup.layout(ViewGroup.java:5579)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:396)
at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
at android.view.View.layout(View.java:16953)
at android.view.ViewGroup.layout(ViewGroup.java:5579)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:396)
at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
at android.view.View.layout(View.java:16953)
at android.view.ViewGroup.layout(ViewGroup.java:5579)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:2001)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1844)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1753)
at android.view.View.layout(View.java:16953)
at android.view.ViewGroup.layout(ViewGroup.java:5579)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:396)
at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2740)
at android.view.View.layout(View.java:16953)
at android.view.ViewGroup.layout(ViewGroup.java:5579)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2562)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2265)
at android.view.ViewRootImpl.doTraver

Images

Is it possible to add images? Send photo from camera? Or is it only text messaging that is supported?

Best regards
Björn

Crash when enable Proguard

I have a problem when I enable proguard for release in my project.
When starting activity that has MessagesList, it crashed.
It's fine if I don't enable proguard.

I also try enabling proguard in sample project, and it also crash when showing MessagesList.

Here's the log:
java.lang.NullPointerException: Attempt to write to field 'int android.support.v7.widget.RecyclerView$ViewHolder.mItemViewType' on a null object reference at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(Unknown Source) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(Unknown Source) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(Unknown Source) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(Unknown Source) at android.support.v7.widget.LinearLayoutManager$b.a(Unknown Source) at android.support.v7.widget.LinearLayoutManager.layoutChunk(Unknown Source) at android.support.v7.widget.LinearLayoutManager.fill(Unknown Source) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(Unknown Source) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(Unknown Source) at android.support.v7.widget.RecyclerView.dispatchLayout(Unknown Source) at android.support.v7.widget.RecyclerView.onLayout(Unknown Source) at android.view.View.layout(View.java:17641) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585) at android.widget.LinearLayout.onLayout(LinearLayout.java:1494) at android.view.View.layout(View.java:17641) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079) at android.view.View.layout(View.java:17641) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:17641) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585) at android.widget.LinearLayout.onLayout(LinearLayout.java:1494) at android.view.View.layout(View.java:17641) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at android.view.View.layout(View.java:17641) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585) at android.widget.LinearLayout.onLayout(LinearLayout.java:1494) at android.view.View.layout(View.java:17641) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323) at android.widget.FrameLayout.onLayout(FrameLayout.java:261) at com.android.internal.policy.DecorView.onLayout(DecorView.java:726) at android.view.View.layout(View.java:17641) at android.view.ViewGroup.layout(ViewGroup.java:5575) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2346) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2068) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6343) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874) at android.view.Choreographer.doCallbacks(Choreographer.java:686) at android.view.Choreographer.doFrame(Choreographer.java:621) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6126) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 03-15 01:19:00.421 4469-4469/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Did you know the solution for having proguard enable without causing this crash?

MessageInput property inputCursorDrawable does not work.

I am trying to set a custom cursor drawable for the MessageInput EditText, but it is not working. I am using a simple rectangle shape, and I have tested this in other EditTexts, and it works:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
    <size android:width="1dp" />
    <solid android:color="@android:color/black" />
</shape>

The property I'm setting in XML is:

app:inputCursorDrawable="@drawable/black_cursor"

You can't set adapter to DialogsList. Use #setAdapter(DialogsListAdapter) instead.

Hi,
I am android development novice, and i am use kotlin and ChatKit in my project,
when i set Adapter in fragment, i always get this error:
You can't set adapter to DialogsList. Use #setAdapter(DialogsListAdapter) instead.

This is part of the code:

mList = view.findViewById<DialogsList>(R.id.dialogsList)

mAdapter = DialogsListAdapter(R.layout.dialog_view_holder,
                DialogViewHolder::class.java,
                ImageLoader { imageView: ImageView, url: String ->
                    Picasso.with(this.context).load(url).into(imageView)
                })

mList.adapter = mAdapter

any suggestions for this error?

Chat Layout

Currently when I use the library, the chat appears starts from bottom to top. Could anyone help me in re configuring the chat layout to start from top to bottom like whatsapp?

MessageListAdapter clear crashes no matter how I use it?

I've got a working demo on v1.2.0 and it's all good except now I want I need to clear the whole list and throw in new data. I'm calling this:

messagesListAdapter.clear();
setupMessages();

however whenever I call this I crash with the following if I tap anywhere in the scrollview

E/AndroidRuntime: FATAL EXCEPTION: main
                                                                      Process: com.XXXXXXXX, PID: 13177
                                                                      java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{56e36af position=6 id=-1, oldPos=-1, pLpos:-1 no parent}
                                                                          at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5297)
                                                                          at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5479)
                                                                          at android.support.v7.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:282)
                                                                          at android.support.v7.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:336)
                                                                          at android.support.v7.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:349)
                                                                          at android.support.v7.widget.GapWorker.prefetch(GapWorker.java:356)
                                                                          at android.support.v7.widget.GapWorker.run(GapWorker.java:387)
                                                                          at android.os.Handler.handleCallback(Handler.java:751)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                          at android.os.Looper.loop(Looper.java:154)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:6121)
                                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

It's not an issue with setupMessages since clearing it doesn't actually seem to clear properly since everything is still in the MessageList view despite clearing. My guess at the issue is that clear works properly for the datasource held internally however this doesn't remove all the rows from the listview and so as it tries to draw them (touching the scrollview causes it to try to draw the cells out of view). I'm calling this all on UI thread.

Do I need to somehow tell the MessageList to update?

Getting a caption with an image message?

Is there any good way (other than I suppose detecting images with captions and then duplicating the message? It'd look better if I could have the text be a part of the same bubble. It's not really that super edgecase so I figured it's worth suggesting here instead of just making a custom holder

Error while importing library

Error:org.gradle.api.UncheckedIOException: Could not HEAD 'https://jitpack.io/com/github/stfalcon/chatkit/0.1.2/chatkit-0.1.2.pom'. Received status code 401 from server: Unauthorized
Error:org.gradle.api.resources.ResourceException: Could not get resource 'https://jitpack.io/com/github/stfalcon/chatkit/0.1.2/chatkit-0.1.2.pom'.

I keep getting this error when trying to pull the library

Setting Dialog's unReadCount to 0 doesn't change the typeface of title and date from unread to default

I faced this issue today and have tried a couple of workarounds without any success.
Issue -
Once the user clicks on a dialog in dialogList screen having unreadCount > 0 and goes to the messageList screen, and then presses back and comes back to the dialogList screen, I'm resetting that dialog's unreadCount to 0 in order to update the UI. And after doing that, the unreadCountBubble hides, textColor of date & title changes to normal, but what doesn't change is the typeface of title and date. It still remains bold.

Here's how I'm using dialogList in my xml -

 <com.stfalcon.chatkit.dialogs.DialogsList
            android:id="@+id/dialogsList"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:dialogDateStyle="normal"
            app:dialogDividerLeftPadding="0dp"
            app:dialogMessageTextColor="@color/colorPrimaryLightGrey"
            app:dialogMessageTextSize="@dimen/text_view_size_medium"
            app:dialogTitleTextColor="@color/colorPrimary"
            app:dialogTitleTextSize="@dimen/text_view_size_large"
            app:dialogTitleTextStyle="normal"
            app:dialogUnreadBubbleBackgroundColor="@color/red"
            app:dialogUnreadBubbleTextSize="@dimen/text_view_size_very_small"
            app:dialogUnreadDateColor="@color/colorPrimary"
            app:dialogUnreadDateStyle="bold"
            app:dialogUnreadTitleTextColor="@color/colorPrimary"
            app:dialogUnreadTitleTextStyle="bold" />

And here's what I'm doing on returning to dialogList screen from messageList screen -

@Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == MSG_LIST && resultCode == RESULT_OK && data != null) {
            Dialog updatedDialog = data.getParcelableExtra(DIALOG_OBJECT);
            dialogAdapter.updateItemById(updatedDialog);
       }
}

Can you tell me as to what am I doing wrong here, and how you'd have ideally updated the dialogList UI from unread to normal state for a particular dialog.
It works fine if I set the items in adapter and reset the adapter again, but that's not the right solution.

Thanks in advance! Really appreciate your time and efforts working on this library.
Cheers!

Custom View Holder throws java.lang.NoSuchMethodException <init> [class android.view.View]

java.lang.NoSuchMethodException: <init> [class android.view.View]
    at java.lang.Class.getConstructorOrMethod(Class.java:472)
    at java.lang.Class.getDeclaredConstructor(Class.java:562)
    at com.stfalcon.chatkit.dialogs.DialogsListAdapter.onCreateViewHolder(DialogsListAdapter.java:113)
    at com.stfalcon.chatkit.dialogs.DialogsListAdapter.onCreateViewHolder(DialogsListAdapter.java:49)
    at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6367)
    at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5555)
    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440)
    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436)
    at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224)
    at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1551)
    at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)
    at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595)
    at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3583)
    at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3312)
    at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3844)
    at android.view.View.layout(View.java:14878)
    at android.view.ViewGroup.layout(ViewGroup.java:4653)
    at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:636)
    at android.view.View.layout(View.java:14878)
    at android.view.ViewGroup.layout(ViewGroup.java:4653)
    at android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1167)
    at android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:852)
    at android.support.design.widget.ViewOffsetBehavior.layoutChild(ViewOffsetBehavior.java:63)
    at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:135)
    at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
    at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1391)
    at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:870)
    at android.view.View.layout(View.java:14878)
    at android.view.ViewGroup.layout(ViewGroup.java:4653)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
    at android.view.View.layout(View.java:14878)
    at android.view.ViewGroup.layout(ViewGroup.java:4653)
    at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
    at android.view.View.layout(View.java:14878)
    at android.view.ViewGroup.layout(ViewGroup.java:4653)
    at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:131)
    at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
    at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1391)
    at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:870)
    at android.view.View.layout(View.java:14878)
    at android.view.ViewGroup.layout(ViewGroup.java:4653)
    at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1193)
    at android.view.View.layout(View.java:14878)
    at android.view.ViewGroup.layout(ViewGroup.java:4653)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
    at android.view.View.layout(View.java:14878)
    at android.view.ViewGroup.layout(ViewGroup.java:4653)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1694)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1548)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1457)
    at android.view.View.layout(View.java:14878)
    at android.view.ViewGroup.layout(ViewGroup.java:4653)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
    at android.view.View.layout(View.java:14878)
    at android.view.ViewGroup.layout(ViewGroup.java:4653)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1694)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1548)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1457)
    at android.view.View.layout(View.java:14878)
    at android.view.ViewGroup.layout(ViewGroup.java:4653)
    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
    at android.view.View.layout(View.java:14878)
    at android.view.ViewGroup.layout(ViewGroup.java:4653)
    at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2020)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1777)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1019)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5754)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
    at android.view.Choreographer.doCallbacks(Choreographer.java:574)
    at android.view.Choreographer.doFrame(Choreographer.java:544)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5271)
    at java.lang.reflect.Method.invokeNative(Native Method)

I have followed the steps on creating a CustomViewHolder in your sample project but still getting this error.

here's my CustomViewHolder

public class CustomConversationDialogViewHolder extends DialogsListAdapter.DialogViewHolder<ChatUserConversationsEntity> {
    private ProgressBar progressBar;

    public CustomConversationDialogViewHolder(View itemView) {
        super(itemView);
        progressBar = (ProgressBar) itemView.findViewById(R.id.progress_bar);
    }

    @Override
    public void onBind(ChatUserConversationsEntity dialog) {
            super.onBind(dialog);
            if (dialog.getLastMessage().getType() != null && dialog.getLastMessage().getType().equals(ChatMessagesEntity.I))
                tvLastMessage.setText(dialog.getLastMessage().getSender() + " sent a photo.");
            else if (dialog.getLastMessage().getType() != null && dialog.getLastMessage().getType().equals(ChatMessagesEntity.A))
                tvLastMessage.setText(dialog.getLastMessage().getSender() + " sent a link.");
    }
}

and here's how i implement into the adapter.

adapter = new DialogsListAdapter<>(R.layout.custom_item_dialog, CustomConversationDialogViewHolder.class, (imageView, url) -> {});

setDateHeaderHolder doesn't work

Hello, we are trying to make a custom date header for the message list, but it seems that the method setDateHeaderHolder(int layout) doesn't work. Also we didn't find any example in the repository.

Activity:

MessageHolders holdersConfig = new MessageHolders()
        .setDateHeaderLayout(R.layout.item_date_header);

mMessagesAdapter = new MessagesListAdapter<>(mConfig.getUserId(), holdersConfig, mImageLoader);

Layout:

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@id/messageText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:textColor="@color/blue"
    android:textSize="30dp"
    android:padding="16dp"/>

Expected: Blue color and 30dp of size for the text. What we get: the default style.

Are we doing something wrong or there is a bug in the library?

Note: for incoming/outcoming custom layout there is no any problem.

Thanks

Set user avatar from Resources

Hi, I started to use this library and I'm no able to find how to do this.

I'm following the sample that you provide and change something to fit in how I want. The problem is that I want to show a default avatar image that I have in my drawable or mipmap folders, but the IUser class uses a String avatar.

Any clue how to achieve what I want?

Thanks

"Admin Messages"

Thanks for this awesome library.
I wanted to know if there is a way to add a special "conversation bubble" to show an "admin message" like "UserA has joined the channel" ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.