Giter Site home page Giter Site logo

chatmessageview's People

Contributors

himanshu-soni avatar johnjohndoe avatar liaohuqiu avatar mathbl 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

chatmessageview's Issues

How to change background color on the bubble in java code?

Please help!

ChatMessageView messageView = (ChatMessageView) view.findViewById(R.id.chatMessageView);
messageTextView.setBackgroundColor(Color.parseColor("#FF4081"));

This only sets the color to the whole parent not just wrapped bubble.

Text in bubble is not displaying properly on older APIs

Not sure why this happens. It seems like the text is not wrapping correctly on older apis. Here's a screenshot of the word "test".
screen shot 2015-10-20 at 10 23 48

I'm testing on a Galaxy Nexus running 4.2 and an emulator running 4.1. It's not happening on Lollipop. Thanks.

arrowPosition : bottom & arrowGravity : end, not working properly

Hi, I've been testing your library and I'd like to put the arrow on the bottom|right of the bubble.

app:cmv_arrowPosition="bottom"
app:cmv_arrowGravity="end"

At this moment, there is no way, as far as I know, to put the bubble on the right part.

Can you help me with this?

Best regards

Strange artefakt error 2.0

Using the ChatMessageView version 1.0.7 and loading asynchronously from Picasso gives me this cut of picture:

screenshot_2017-02-15-10-55-10

Notice the Picasso setIndicatorsEnabled(true)blue color marker saying it´s loaded from disk.
The bottom picture is nr: 1 in the RecyclerViewList. I dont see this on the other landscapes pictures only the portrait is affected

When i swipe down and swipe up again it looks like this.
Picasso working ok as setIndicatorsEnabled(true)now show the green color loaded from memory.
but the picture is cut of if like the reused viewholder misses a layout run:

screenshot_2017-02-15-10-55-22

Also the orange timestamp text is hidden behind the cut of picture but on the other picture the time stamp is below.

Basically could you make it work using async loading would be grate. This picture problem is also happening for text. I have to execute the chatAdapter.notifyItemChanged(position); to create the layout in ChatMessageView.
Here´s my xml maybe I did something wrong:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:layout_marginBottom="10dp">

    <com.github.curioustechizen.ago.RelativeTimeTextView
        android:id="@+id/timestamp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="16dp"
        android:textColor="?AppTheme.ChatBubbleTextColor"
        android:textSize="@dimen/chat_timestamp_text_size"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toLeftOf="@+id/guideline1"
        tools:text="Just Now" />

    <android.support.constraint.Guideline
        android:id="@+id/guideline1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.88611114"
        tools:layout_editor_absoluteX="319dp"
        tools:layout_editor_absoluteY="0dp" />

    <ImageView
        android:id="@+id/thumbnail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="@+id/guideline1"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:src="@drawable/tw__composer_logo_blue" />

    <me.himanshusoni.chatmessageview.ChatMessageView
        android:id="@+id/chatMessageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:cmv_arrowGravity="center"
        app:cmv_arrowPosition="right"
        app:cmv_backgroundColor="?AppTheme.ChatBubbleBackGroundColor"
        app:cmv_backgroundColorPressed="?AppTheme.ChatBubbleBackGroundColorPressed"
        app:cmv_contentPadding="10dp"
        app:cmv_cornerRadius="10dp"
        app:cmv_showArrow="true"
        app:layout_constraintBottom_toTopOf="@+id/timestamp"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginStart="16dp"
        app:layout_constraintLeft_toLeftOf="parent"
        android:layout_marginLeft="16dp"
        app:layout_constraintRight_toLeftOf="@+id/guideline1"
        android:layout_marginEnd="8dp"
        android:layout_marginRight="8dp"
        app:layout_constraintHorizontal_bias="1.0">

        <ImageView
            android:id="@+id/image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="?AppTheme.ChatBubbleBackGroundColor"/>

    </me.himanshusoni.chatmessageview.ChatMessageView>

</android.support.constraint.ConstraintLayout>

ChatMessageView with no content padding not rounding borders

When setting the content_padding xml property to 0dp the view does not round the corners.
In my case I'm using the ChatMessageView to show an ImageView and I'd like to not show any background around the ImageView. Here is my xml:

<me.himanshusoni.chatmessageview.ChatMessageView xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cmv_arrowGravity="start"
        app:cmv_arrowMargin="3dp"
        app:cmv_arrowPosition="right"
        app:cmv_backgroundColor="@color/md_grey_300"
        app:cmv_backgroundColorPressed="@color/md_pink_50"
        app:cmv_contentPadding="0dp"
        app:cmv_cornerRadius="3dp"
        app:cmv_showArrow="true">

        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"            
            android:orientation="vertical">

            <ImageView
                android:id="@+id/imageView"
                android:layout_width="200dp"
                android:layout_height="180dp"
                android:adjustViewBounds="true"
                android:scaleType="centerCrop" />

            <TextView
                android:id="@+id/tVtimestamp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|end"
                android:fontFamily="sans-serif"
                android:padding="4dp"
                android:text="14:30"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textColor="@color/md_white_1000"
                android:textSize="12sp"
                android:shadowColor="#8000"
                android:shadowDx="0"
                android:shadowDy="2"
                android:shadowRadius="2"/>

        </FrameLayout>
    </me.himanshusoni.chatmessageview.ChatMessageView>

And this is what shows in app:

screenshot_20151124-142937

Strange artefakt error

UPDATE Even I think it has nothing to do with ChatMessageView but would love a comment on this problem. Maybe ChatMessageView can be changed to address this problem

Working on an app project . When I fresh install app and insert an image into ChatMessageView the image becomes shopped like this:
screenshot_2017-02-12-22-21-32

When I rotate device to landscape and back to portrait it looks ok like this:

screenshot_2017-02-12-22-25-03

What could cause this to happen.

I am not changing the xml code between rotate...

wrap_content doesn't work?

I'm trying to use android:layout_width="wrap_content"
android:layout_height="wrap_content" in CMV but it seems to ignore them and other layout params! Is it a bug??

ChatMessageView does not allow parent view to catch onclick event

I have a parent layout that contains a ChatMessageView and I want that the parent view can catch an OnLongClick event to show a Context Action Bar. But even though I've set the ChatMessageView not clickable and focusable on xml, it stills prevent my parent layout to catch the event.
Here is my layout:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/messageLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:paddingEnd="56dp"
    android:paddingRight="56dp">

    <View
        android:id="@+id/dummyArrow"
        android:layout_width="26dp"
        android:layout_height="21dp"
        android:layout_marginLeft="21dp"
        android:layout_marginStart="21dp"
        android:background="@color/md_grey_800" />

    <de.hdodenhof.circleimageview.CircleImageView 
        android:id="@+id/iVPhoto"
        android:layout_width="42dp"
        android:layout_height="42dp"
        android:layout_gravity="start"
        android:layout_marginTop="0dp"
        android:src="@drawable/ic_profile_default"
        app:civ_border_color="@color/md_grey_900"
        app:civ_border_overlay="true"
        app:civ_border_width="1dp" />

    <me.himanshusoni.chatmessageview.ChatMessageView 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="36dp"
        android:layout_marginStart="36dp"
        app:cmv_backgroundColor="@color/md_grey_800"
        app:cmv_backgroundColorPressed="@color/md_grey_700"
        app:cmv_contentPadding="6dp"
        app:cmv_cornerRadius="3dp"
        app:cmv_showArrow="false"
        android:clickable="false"
        android:focusable="false">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="4dp"
            android:layout_marginStart="4dp"
            android:minWidth="120dp"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tVusername"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="start"
                android:paddingBottom="2dp"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textSize="12sp" />

            <TextView
                android:id="@+id/tVmessage"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:autoLink="web"
                android:paddingBottom="2dp"
                android:paddingTop="2dp"
                android:textAppearance="?android:attr/textAppearance" />

            <TextView
                android:id="@+id/tVtimestamp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="end"
                android:fontFamily="sans-serif-light"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textSize="12sp" />

        </LinearLayout>
    </me.himanshusoni.chatmessageview.ChatMessageView>

</FrameLayout>

Little bottom bevels

Hello,nice job on this library. Someone really appreciates the time and effort put into building this library. I was thinking, is there any way I can enable some sort of little bevels underneath my ChatMessageView to give the illusion of depth as seen in Chat bubbles in apps like WhatsApp. The entire view is quite flat..Thanks once again for this nice job.

RelativeLayout End/Start crashes on API < 17

Hello,
Got this stack trace on some devices:

Caused by: java.lang.ArrayIndexOutOfBoundsException: length=16; index=17
       at android.widget.RelativeLayout$LayoutParams.addRule(RelativeLayout.java:1222)
       at me.himanshusoni.chatmessageview.ChatMessageView.initContent(ChatMessageView.java:118)
       at me.himanshusoni.chatmessageview.ChatMessageView.initialize(ChatMessageView.java:67)
       at me.himanshusoni.chatmessageview.ChatMessageView.<init>(ChatMessageView.java:42)
       at java.lang.reflect.Constructor.constructNative(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
       at android.view.LayoutInflater.createView(LayoutInflater.java:587)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
       at com.classcraft.android.views.adapters.MessagingDiscussionAdapter.getIncomingView(MessagingDiscussionAdapter.java:111)
       at com.classcraft.android.views.adapters.MessagingDiscussionAdapter.getView(MessagingDiscussionAdapter.java:101)
       at android.widget.AbsListView.obtainView(AbsListView.java:2465)
       at android.widget.ListView.makeAndAddView(ListView.java:1775)
       at android.widget.ListView.fillUp(ListView.java:712)
       at android.widget.ListView.layoutChildren(ListView.java:1632)
       at android.widget.AbsListView.onLayout(AbsListView.java:2300)
       at android.view.View.layout(View.java:13856)
       at android.view.ViewGroup.layout(ViewGroup.java:4424)
       at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
       at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
       at android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
       at android.view.View.layout(View.java:13856)
       at android.view.ViewGroup.layout(ViewGroup.java:4424)
       at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
       at android.view.View.layout(View.java:13856)
       at android.view.ViewGroup.layout(ViewGroup.java:4424)
       at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
       at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
       at android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
       at android.view.View.layout(View.java:13856)
       at android.view.ViewGroup.layout(ViewGroup.java:4424)
       at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
       at android.view.View.layout(View.java:13856)
       at android.view.ViewGroup.layout(ViewGroup.java:4424)
       at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
       at android.view.View.layout(View.java:13856)
       at android.view.ViewGroup.layout(ViewGroup.java:4424)
       at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
       at android.view.View.layout(View.java:13856)
       at android.view.ViewGroup.layout(ViewGroup.java:4424)
       at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
       at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
       at android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
       at android.view.View.layout(View.java:13856)
       at android.view.ViewGroup.layout(ViewGroup.java:4424)
       at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
       at android.view.View.layout(View.java:13856)
       at android.view.ViewGroup.layout(ViewGroup.java:4424)
       at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1992)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1813)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1113)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4481)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
       at android.view.Choreographer.doCallbacks(Choreographer.java:555)
       at android.view.Choreographer.doFrame(Choreographer.java:525)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
       at android.os.Handler.handleCallback(Handler.java:615)
       at android.os.Handler.dispatchMessage(Handler.java:92)
       at android.os.Looper.loop(Looper.java:137)
       at android.app.ActivityThread.main(ActivityThread.java:4867)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
       at dalvik.system.NativeStart.main(NativeStart.java)

According to this SO post, problem seems related to Start/End rules.
http://stackoverflow.com/questions/25763142/android-arrayindexoutofbounds-exception-on-addrule-in-layoutparams

Thanks for your time.

OnItemClickListener does not working

i'm using recycle view for show messages and my onitemclicklistener does not working with messages. I think ChatMessageView is inpercepting ontemclick event. How i can avoid this?

app is crashin on 4.1.1

Fatal Exception: java.lang.RuntimeException: Unable to start activity android.view.InflateException: Binary XML file line #38: Error inflating class me.himanshusoni.chatmessageview.ChatMessageView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2118) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2143) at android.app.ActivityThread.access$700(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:174) at android.app.ActivityThread.main(ActivityThread.java:4952) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794) at dalvik.system.NativeStart.main(NativeStart.java)

but works in kitkat and above

.setBackgroundColors gives an error when I give it a valid color

android.content.res.Resources$NotFoundException: Resource ID #0xffd4e157 return when I give it a valid colour, what values are we supposed to use when changing it programatically?

I see you have called it like this:

public void setBackgroundColors(int bgColorRes, int bgPressedColorRes) {
this.backgroundColorPressed = this.getResources().getColor(bgPressedColorRes);
this.backgroundColor = this.getResources().getColor(bgColorRes);
this.updateColors();
}

Why is it not just:

public void setBackgroundColors(int bgColorRes, int bgPressedColorRes) {
this.backgroundColorPressed = bgPressedColorRes;
this.backgroundColor = bgColorRes;
this.updateColors();
}

Perhaps I am missing some logic? I could just be very confused. Please help and give an example, thank you very much. Love the library

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.