Git Product home page Git Product logo

slycemessaging's Introduction

Slyce Messaging API

Basic features of the API:

  • Full custimization of colors
  • Dynamic timestamps
  • Support for (optional) photo messages
  • Avatar photos (with onclick listeners)
  • Copy text with long press
  • Allows for more mesages to be loaded when user scrolls close to the top
  • Upon recieval of a message, a snackbar is shown which the user can use to scroll to the next message

Installation

Add the following to your app's gradle file:

repositories {
    jcenter()
    maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
    maven { url "https://jitpack.io" }
}

dependencies {
    compile 'com.github.Slyce-Inc:SlyceMessaging:1.1.2'
}

The API

You must initialize the fragment by declaring an XML tag like the following:

<fragment
            android:name="it.slyce.messaging.SlyceMessagingFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/messaging_fragment"/>

SlyceMessagingFragment

public void setUserSendsMessageListener(UserSendsMessageListener listener); // gets called when the user sends a message
public void setUserClicksAvatarPhotoListener(UserClicksAvatarPhotoListener listener); // gets called when a user clicks an avatar photo. Optional.
public void setDefaultAvatarUrl(String url); // The avatar for the current user.
public void setDefaultUserId(String id); // A unique identifier for the current user.
public void setPictureButtonVisible(boolean bool); // Used to toggle whether the user can send picture messages. Default is true.
public void setStyle(int style); // See section "Custimize colors"
public void setMoreMessagesExist(boolean bool); // Sets whether more messages can be loaded from the top
public void setLoadMoreMessagesListener(ShouldLoadMoreMessagesListener listener); // Gets called when the user scrolls close to the top, if relevent

public void addMessage(Message message);
public void addMessages(List<Message> messages);
public void replaceMessages(List<MessageItems> messages);

Message System

public abstract class Message {
    public void setDate(String date);
	public void setSource(MessageSource source);
	public void setAvatarUrl(String url);
	public void setDisplayName(String name);
	public void setUserId(String id);
}

public class TextMessage extends Message {
	public void setText(String text);
}

public class MediaMessage extends Message{
	public void setPhotoUrl(String url);
}

public enum MessageSource {
	LOCAL_USER,
	EXTERNAL_USER
}

Listeners

public interface UserSendsMessageListener {
	public void onUserSendsTextMessage(String text);
	public void onUserSendsMediaMessage(Uri imageUri);
}

public interface UserClicksAvatarPictureListener {
	public void userClicksAvatarPhoto(MessageOrigin messageOrigin, String userId);
}

public interface LoadMoreMessagesListener {
    public List<Message> loadMoreMessages();
}

General Messages

We now allow for messages to enter the feed that come from the app itself rather than one of the users. This message can also contain a sequence of options.

public class GeneralTextMessage extends Message {
    public void setText(String text);
}

public class GeneralOptionsMessage extends Message {
    public void setTitle(String title);
    public void setOptions(String[] options);
    public void setOnOptionSelectedListener(OnOptionSelectedListener onOptionSelectedListener);
}

public interface OnOptionSelectedListener {
    String onOptionSelected(int optionSelected); 
            // Returns the string that should replace the title text after the options are removed.
}

Custimize colors

You can custimize the colors of the fragment by providing a style with the following attributes in a method call to SlyceMessagingFragment. All attributes are colors.

  • backgroundColor
  • timestampTextColor
  • localBubbleBackground
  • localBubbleTextColor
  • externalBubbleBackground
  • externalBubbleTextColor
  • snackbarBackground
  • snackbarTitleColor
  • snackbarButtonColor

Example

public class MainActivity extends AppCompatActivity {
    private static int n = 0;
    private static String[] latin = {
            "Vestibulum dignissim enim a mauris malesuada fermentum. Vivamus tristique consequat turpis, pellentesque.",
            "Quisque nulla leo, venenatis ut augue nec, dictum gravida nibh. Donec augue nisi, volutpat nec libero.",
            "Cras varius risus a magna egestas.",
            "Mauris tristique est eget massa mattis iaculis. Aenean sed purus tempus, vestibulum ante eget, vulputate mi. Pellentesque hendrerit luctus tempus. Cras feugiat orci.",
            "Morbi ullamcorper, sapien mattis viverra facilisis, nisi urna sagittis nisi, at luctus lectus elit.",
            "Phasellus porttitor fermentum neque. In semper, libero id mollis.",
            "Praesent fermentum hendrerit leo, ac rutrum ipsum vestibulum at. Curabitur pellentesque augue.",
            "Mauris finibus mi commodo molestie placerat. Curabitur aliquam metus vitae erat vehicula ultricies. Sed non quam nunc.",
            "Praesent vel velit at turpis vestibulum eleifend ac vehicula leo. Nunc lacinia tellus eget ipsum consequat fermentum. Nam purus erat, mollis sed ullamcorper nec, efficitur.",
            "Suspendisse volutpat enim eros, et."
    };

    private static Message getRandomMessage() {
        n++;
        TextMessage textMessage = new TextMessage();
        textMessage.setText(n + ""); // +  ": " + latin[(int) (Math.random() * 10)]);
        textMessage.setDate(new Date().getTime());
        if (Math.random() > 0.5) {
            textMessage.setAvatarUrl("https://lh3.googleusercontent.com/-Y86IN-vEObo/AAAAAAAAAAI/AAAAAAAKyAM/6bec6LqLXXA/s0-c-k-no-ns/photo.jpg");
            textMessage.setUserId("LP");
            textMessage.setSource(MessageSource.EXTERNAL_USER);
        } else {
            textMessage.setAvatarUrl("https://scontent-lga3-1.xx.fbcdn.net/v/t1.0-9/10989174_799389040149643_722795835011402620_n.jpg?oh=bff552835c414974cc446043ac3c70ca&oe=580717A5");
            textMessage.setUserId("MP");
            textMessage.setSource(MessageSource.LOCAL_USER);
        }
        return textMessage;
    }

    SlyceMessagingFragment slyceMessagingFragment;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        slyceMessagingFragment = (SlyceMessagingFragment) getFragmentManager().findFragmentById(R.id.fragment_for_slyce);
        slyceMessagingFragment.setDefaultAvatarUrl("https://scontent-lga3-1.xx.fbcdn.net/v/t1.0-9/10989174_799389040149643_722795835011402620_n.jpg?oh=bff552835c414974cc446043ac3c70ca&oe=580717A5");
        slyceMessagingFragment.setDefaultDisplayName("Matthew Page");
        slyceMessagingFragment.setDefaultUserId("uhtnaeohnuoenhaeuonthhntouaetnheuontheuo");

        slyceMessagingFragment.setOnSendMessageListener(new UserSendsMessageListener() {
            @Override
            public void onUserSendsTextMessage(String text) {
                Log.d("inf", "******************************** " + text);
            }

            @Override
            public void onUserSendsMediaMessage(Uri imageUri) {
                Log.d("inf", "******************************** " + imageUri);
            }
        });

        slyceMessagingFragment.setLoadMoreMessagesListener(new LoadMoreMessagesListener() {
            @Override
            public List<Message> loadMoreMessages() {
                ArrayList<Message> messages = new ArrayList<>();
                for (int i = 0; i < 50; i++)
                    messages.add(getRandomMessage());
                return messages;
            }
        });

        slyceMessagingFragment.setMoreMessagesExist(true);
    }
}
<style name="MyTheme">
    <item name="backgroundColor">@color/background_white</item>
    <item name="timestampTextColor">@color/text_black</item>
    <item name="localBubbleBackground">@color/background_blue</item>
    <item name="localBubbleTextColor">@color/text_white</item>
    <item name="externalBubbleBackground">@color/background_gray</item>
    <item name="externalBubbleTextColor">@color/text_black</item>
    <item name="snackbarBackground">@color/background_gray_darkest</item>
    <item name="snackbarTitleColor">@color/text_black</item>
    <item name="snackbarButtonColor">@color/text_blue</item>
</style>

Inspired by JSQMessagesViewController

This library was inspired by JSQMessagesViewController, an excellent messages UI library for iOS.

Stay tuned -- we are joining forces with JSQ for the next generation of messages UI libraries: MessageKit for iOS AND Android! https://github.com/MessageKit/MessageKit-Android

Developers

We have a local.properties file checked in for CI builds. Please do not check in changes to local.properties. Run this command to prevent that file from showing up as changed:

git update-index --assume-unchanged local.properties

slycemessaging's People

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

slycemessaging's Issues

Instantiate SlyceMessagingFragment programmatically?

I've tried to generate a new SlyceMessagingFragment via Java, but the instance generated throws a NullPointerException when trying to set LoadMoreMessagesListener(). .getId() also returns null.

This is the code I used to construct it, as well as trying the default empty constructor:

slyceMessagingFragment = (SlyceMessagingFragment) SlyceMessagingFragment.instantiate(this, "MatchFragment.class");

Has anyone been able to achieve this?

Crash related to scrolling while loading more

I had a batch size of 20 and when I hit the top the app crashes with an error

E/AndroidRuntime: FATAL EXCEPTION: main java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{2e25931 position=34 id=-1, oldPos=14, pLpos:14 scrap [attachedScrap] tmpDetached no parent} at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:4505) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4636) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4617) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1994) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1390) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1353) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:549) at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:2979) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2904) at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1482) at android.support.v7.widget.RecyclerView.access$400(RecyclerView.java:147) at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4037) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858) at android.view.Choreographer.doCallbacks(Choreographer.java:670) at android.view.Choreographer.doFrame(Choreographer.java:603) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844) at android.os.Handler.handleCallback(Handler.java:746) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5443) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

I found a similar error in another library and someone there suggested that the solution is to block scrolling while the adapter's dataset is being updated frogermcs/InstaMaterial#25 I think this would need to be done in the library's code.

NullPointerException on void com.commonsware.cwac.cam2.CameraFragment.shutdown()

Steps to recreate this crash:

  1. When it asks for permissions deny them
  2. Press camera button at the bottom
  3. It asks again for permission, deny it again
  4. CRASH

java.lang.RuntimeException: Unable to stop activity {com.vish.app/com.commonsware.cwac.cam2.CameraActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.commonsware.cwac.cam2.CameraFragment.shutdown()' on a null object reference
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4165)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4221)
at android.app.ActivityThread.-wrap6(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1538)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.commonsware.cwac.cam2.CameraFragment.shutdown()' on a null object reference
at com.commonsware.cwac.cam2.AbstractCameraActivity.onStop(AbstractCameraActivity.java:272)
at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1289)
at android.app.Activity.performStop(Activity.java:6854)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4160)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4221) 
at android.app.ActivityThread.-wrap6(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1538) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6119) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

Let me also use this platform to ask for a feature. There should be a function that enables/disables media messaging. When disabled, you can only send text messages and there are no permissions asked when opening MessagingFragment

Thanks.

Exception

Hi all

I'm getting the following exception:

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference
     at it.slyce.messaging.SlyceMessagingFragment.updateTimestampAtValue(SlyceMessagingFragment.java:346)
     at it.slyce.messaging.SlyceMessagingFragment.access$500(SlyceMessagingFragment.java:61)
     at it.slyce.messaging.SlyceMessagingFragment$4.run(SlyceMessagingFragment.java:250)
     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:278)
     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:270)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)

but I haven't been able to pinpoint the conditions when is thrown. Rings any bells?

Thanks in advance!!!
Esteban

Is this project alive?

Hi,

I'm wondering if this project is alive? I want to know if It's good to use this in a new project?

Best regards
jonisak

Handling Participants

Your App is really cool, helped me make a lot of decisions on mine. Wanted to find out how to handle a two way chat with the ability to add more later. Like a channel of two users that allows me to add more users later. Hope am making sense. Regards.

Error about picasso method call from main thread

When I posted an image I noticed an error in the logs related to Picasso

W/System.err: java.lang.IllegalStateException: Method call should not happen from the main thread. W/System.err: at com.squareup.picasso.Utils.checkNotMain(Utils.java:130) W/System.err: at com.squareup.picasso.RequestCreator.get(RequestCreator.java:383) W/System.err: at it.slyce.slyce_messaging.messenger.utils.Utils.getWidthToHeightRatio(Utils.java:19) W/System.err: at it.slyce.slyce_messaging.messenger.message.messageItem.master.media.MessageMediaItem.buildMessageItem(MessageMediaItem.java:41) W/System.err: at it.slyce.slyce_messaging.messenger.message.messageItem.MessageRecyclerAdapter.onBindViewHolder(MessageRecyclerAdapter.java:95) W/System.err: at it.slyce.slyce_messaging.messenger.message.messageItem.MessageRecyclerAdapter.onBindViewHolder(MessageRecyclerAdapter.java:26)

Set Avatar using Bitmap

As of now, you can only set avatar by using avatarUrl. Are there any plans to add bitmap support?

Fragment leaks due to ScheduledExecutorService

I found that my Activity which use SlyceMessagingFragment leaks because the ScheduledExecutorService created in the startUpdateTimestampsThread holds a reference to the Fragment (through the inner Runnable class), and this executor is never stopped!

No way to customize input bar?

I'm making an app with a quite dark design. Is there a way to change colors or the input bar at the bottom? Also, I haven't found any way to change labels. Any ways to localize the chat? I can provide russian strings if you want.

More than 2 participants (group chat) are not splitted properly

Hi!
Maybe it's not a issue because it works. It's more a request:

When I recover messages to show (load history) , even if I put the correct userID , all the messages with "External_User" are showed under the same user. Is there any way to avoid this?
I understand the messages are of the same user, it has to show like, that, but not for the all external users

Example:
screenshot_20161116-135719

The all the messages under user (A), are not all from this contact.

Thanks

Localize texts

Hi

I'm trying to localize my app, and I cant find the way to localize some text in Slyce views, like: "Just now", "Text copied", etc

Do you have any config I can change?

Thanks!
Esteban

Add a listener where pre-sending logic can be enforced.

Right now, I don't see an easy way to enforce a character limit on outgoing messages, or to even handle situations such as detecting an issue with network connectivity. There are a number of kinds of checks I'd like to be able to do before the message is "sent" and displayed in the UI. This could be called something like setShouldSendMessageListener for example.

How to change text link color?

Hello!! I encounter a problem, the url link in bubble are the same color of background, how to solve that? So many thanks if any reply!

java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.app.Activity.getApplicationContext()' on a null object reference

Hi,

I get "java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.app.Activity.getApplicationContext()' on a null object reference"

On line 155, in SlyceMessagingFragment :

 public void addNewMessages(List<Message> messages) {
        mMessages.addAll(messages);
        new AddNewMessageTask(messages, mMessageItems, mRecyclerAdapter, mRecyclerView, getActivity().getApplicationContext(), customSettings).execute();
    }

getActivity() sometimes is null

Double outgoing messages

I hooked up my SlyceMessaging UI to a Firebase backend and I'm seeing the issue when I send a message there are two showing up on the screen. It's because the library adds the first copy when the message is sent and then Firebase notifies me of the new message coming back from the server and I display that as well.

What is the recommended pattern for avoiding this?

I don't want to simply ignore messages from the local user coming from the server because then I won't be able to display the history correctly (messages I sent in previous sessions).

Scroll position moves automatically when timestamps are updated

Found on my Nexus 5 Running 6.0.1 (but I have seen this on other devices as well)

I have noticed an issue where whenever the timestamps are to be updated, the scroll position in the recyclerview will change, such that it seems to push the user "up" the list. You can see this issue more pronounced by changing the timestamps to update every 5 seconds (instead of 62) and always forcing the notifyItemChanged to be called.

Digging around it appears it may be an issue with RecyclerView itself (https://code.google.com/p/android/issues/detail?id=203574)

=== My Fix ===
I have made some changes to our forked repo that tries to circumvent the problem.

  • mRecyclerView.setHasFixedSize(true); // Fixes redraw resize issue that was forcing a scroll position change.
  • mRecyclerView.getItemAnimator().setChangeDuration(0); // Removes flicker happening on notifyItemChanged redraw.

It still needs testing, and the animation now doesn't look as nice when adding new chats, but the scrolling bug appears to be solved by this.

If I have time I will look at making a PR against the lib with these changes.

How to add message from service?

I have a live service which listening to new message, I want add this new message to SlyceFragment, I am using this:

public void addNewMessageToChat(Message message) {
        DebugHelper.LogMessage("接收到了消息啊,", "chat");
        messages.add(message);
        slyceMessagingFragment.addNewMessages(messages);
    }

whatever I try it not add message except I add messages in onCreate method. Any suggestion about this?

Readme

The readme file should explain what SpinnerMessages are.

setLoadMoreMessagesListener has issues loading less number of messages

I am using the following code :
`slyceMessagingFragment.setLoadMoreMessagesListener(new LoadMoreMessagesListener() {
@OverRide
public List loadMoreMessages() {
Log.d("info", "loadMoreMessages()");

            if (!hasLoadedMore) {
                hasLoadedMore = true;
                ArrayList<Message> messages = new ArrayList<>();

                for (int i = 0; i < 2; i++)
                    messages.add(getRandomMessage());
                Log.d("info", "loadMoreMessages() returns");
                return messages;
            } else {
                slyceMessagingFragment.setMoreMessagesExist(false);
                Log.d("info","loadMoreMessages() false");
                return new ArrayList<>();
            }
        }
    });

    slyceMessagingFragment.setMoreMessagesExist(true);`

In this case, whenever i send a new message, the window gets cleared up of all messages.

Allow inserting a message at a specific index

It would be nice to be able to easily add a message to the top of the messages with something like:

slyceMessagingFragment.insertNewMessage(0, message);

with a method signature:

public void insertNewMessage(int index, Message message)

Crash after scrolling up a few times and then back down

I had load more messages as it is in the sample code (loads 50 more each time) and after scrolling up a few times when I go to scroll back down I sometimes get a crash.

Here's the error:
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.audreytroutt.android.androidbeginnerchat, PID: 1103 java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{1c2ac73 position=154 id=-1, oldPos=4, pLpos:4 scrap [attachedScrap] tmpDetached no parent} at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:4505) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4636) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4617) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1994) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1390) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1353) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:549) at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:2979) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2904) at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1482) at android.support.v7.widget.RecyclerView.scrollByInternal(RecyclerView.java:1519) at android.support.v7.widget.RecyclerView.onTouchEvent(RecyclerView.java:2486) at android.view.View.dispatchTouchEvent(View.java:9297) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2549) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2240) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2555) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2254) at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2403) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1737) at android.app.Activity.dispatchTouchEvent(Activity.java:2769) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60) at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2364) at android.view.View.dispatchPointerEvent(View.java:9517) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4242) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4108) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3654) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3707) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3673) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3799) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3681) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3856) at android.vi

Add more types.

Hi, First of all.. Thanks for this useful lib.
I need a help, i want to use your library. But i need modifications so i have copied the code, besides adding as library. Actually i need to add more different views. like polls.
i need to add another view (like Poll) like:- u used Text and Image.
SO, where i need to put the type and where i need to change the code to add another type of view.

  1. I have modified the adapter. and added new Holder Type.
  2. I have modified Message types class as..

public enum MessageItemType {
INCOMING_MEDIA,
INCOMING_TEXT,
INCOMING_POLL,
OUTGOING_MEDIA,
OUTGOING_TEXT,
OUTGOING_POLL,
SPINNER;

But, its never called for INCOMING_POLL or OUTGOING_POLL.
Thanks again. :)

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.