Git Product home page Git Product logo

radchatapp's Introduction

RADChatApp

RADChatApp is a full-featured chat room app UI component in Java/Kotlin for Codename One. It helps building an elaborate cross-platform chat app UI much faster. Easily customizable to clone UI of social chat apps like WhatsApp, Twitter or Messenger etc.

chat ui kit feature

This component designed as a proof of concept for the CodeRAD library, which facilitates the development of rich, reusable UI components for Codename One. It contains everything you should need to incorporate chat into your mobile app.

License

Apache 2.0

Features

  1. Provides nice Chat room view out of the box.

  2. User avatar support

  3. Use provided view models or bind to your own view models.

  4. Add your own custom actions.

  5. Nice UI animations when messages are added or removed, or to indicate other users are typing

  6. Add badges (e.g. Like, or Thumbs up) to chat messages

Note
This component is only a UI component. It doesn’t connect to any back-end services. You would need to implement that in your controller.

Demo

Image 210220 105119.095
Note
These demos aren’t connected to any back-end server. The contain some sample chat messages, and they allow you to post your own messages and images, which are just stored locally.

See how to build this demo in the Getting Started Tutorial

Documentation

  1. Getting Started Tutorial

  2. Javadoc

  3. RADChatRoom Cookbook - A growing list of recipes to show you how to customize the chatroom component.

Requirements

Installation

Further Reading

Credits

radchatapp's People

Contributors

dependabot[bot] avatar shannah avatar yo-zubair avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

radchatapp's Issues

Scroll to the last chat message

Hi,
When a new chat room view is opened it is usually populated with a list of existing/old messages loaded from the server. A preferred behavior might be to scroll the view to the last message or better yet to the first unread message on the list.
What would be the best way to scroll the chat room view to the last message or a specific message after the view is created?

Invalid Maven dependencies

Hello :)

On initializing the project various dependencies and plugins could not be resolved by maven.
Has someone fixed this ?

`
Cannot resolve com.codenameone:codenameone-core:7.0.16-SNAPSHOT
Cannot resolve com.codenameone:chat-ui-kit-lib:1.0.1-SNAPSHOT
Cannot resolve com.codenameone:codenameone-javase:7.0.16-SNAPSHOT
Cannot resolve plugin org.apache.maven.plugins:maven-source-plugin:
Cannot resolve plugin org.apache.maven.plugins:maven-source-plugin:
Cannot resolve plugin com.codenameone:codenameone-maven-plugin:7.0.16-SNAPSHOT
Cannot resolve plugin org.codehaus.mojo:build-helper-maven-plugin:
Cannot resolve plugin org.apache.maven.plugins:maven-source-plugin:
Cannot resolve plugin com.codenameone:codenameone-maven-plugin:7.0.16-SNAPSHOT
Cannot resolve plugin org.apache.maven.plugins:maven-source-plugin:
Cannot resolve plugin com.codenameone:codenameone-maven-plugin:7.0.16-SNAPSHOT
Cannot resolve plugin org.apache.maven.plugins:maven-source-plugin:
Cannot resolve plugin org.apache.maven.plugins:maven-source-plugin:
Cannot resolve plugin org.apache.maven.plugins:maven-source-plugin:
Cannot resolve plugin org.apache.maven.plugins:maven-source-plugin:
Cannot resolve plugin org.apache.maven.plugins:maven-source-plugin:
Cannot resolve plugin org.apache.maven.plugins:maven-source-plugin:
Cannot resolve plugin org.apache.maven.plugins:maven-source-plugin:

`

Best regards

Joost

How to correctly define complex entity

I would like to have a ChatMessage entity to have property sender. Sender is a 'Contact' entity with own definition:

class Contact(n: String, a: String) : Entity() {
    var name: StringProperty?
    var avatar: StringProperty?
    private val TYPE: EntityType = object : EntityType() {
        init {
            name = string(tags(Thing.name))
            avatar = string(tags(Thing.thumbnailUrl))
        }
    }
    init {
        entityType = TYPE
        set(name, n)
        set(avatar, a)
    }
}

Now, I would like to have a ChatMessage entity defined like this:

class ChatMessage(m: String, s: Contact) : Entity() {
    var sender: EntityProperty<Contact>
    var content: StringProperty?

    private val TYPE: EntityType = object : EntityType() {
        init {
            content = string(tags(ChatMessage.text))
            sender = entity(tags(ChatMessage.creator)) // <--- This is the place I do not understand 
         // how to specify the entity type
        }
    }

    init {
        entityType = TYPE
        set(content, m)
        set(sender, s)
    }
}

How to specify entity type of complex entities?

Too much slow when posting a photo

Trying your demo Android apk on my Android 7 device, the app is completely frozen for some seconds to load a photo.

My hypothesis is that your code resizes the photo and it needs some seconds, blocking the EDT.

.IllegalArgumentException: Entity type ChatMessageModel does not contain property DateProperty

Executing your RADChatRoom code downloaded from Github, I get an exception trying to enter the text "Hello World"...

Please note in the screenshot below the text "MultiButton", appeared after entering "Hello World".

Full log:

ant -f /home/francesco/Teamify/ChatRAD -Dnb.internal.action.name=run run
Generating GUI sources
No GUI Entries available
init:
Deleting: /home/francesco/Teamify/ChatRAD/build/built-jar.properties
deps-jar:
Updating property file: /home/francesco/Teamify/ChatRAD/build/built-jar.properties
JavaFX is loaded
Retina Scale: 1.0
Updating merge file /home/francesco/Teamify/ChatRAD/css/theme.css.merged
Input: /home/francesco/Teamify/ChatRAD/css/theme.css
Output: /home/francesco/Teamify/ChatRAD/src/theme.res
Acquiring lock on CSS checksums file /home/francesco/Teamify/ChatRAD/.cn1_css_checksums...
Lock obtained
File has not changed since last compile.
Releasing lock
CSS file successfully compiled.  /home/francesco/Teamify/ChatRAD/src/theme.res
Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller
        code size and wider device support
compile:
run:
JavaFX is loaded
Found theme.css file.  Watching for changes...
CSS> JavaFX is loaded
CSS> Retina Scale: 1.0
CSS> Updating merge file /home/francesco/Teamify/ChatRAD/css/theme.css.merged
CSS> Input: /home/francesco/Teamify/ChatRAD/css/theme.css
CSS> Output: /home/francesco/Teamify/ChatRAD/src/theme.res
CSS> Acquiring lock on CSS checksums file /home/francesco/Teamify/ChatRAD/.cn1_css_checksums...
CSS> Lock obtained
CSS> File has not changed since last compile.
CSS> Releasing lock
CSS> CSS file successfully compiled.  /home/francesco/Teamify/ChatRAD/src/theme.res
Retina Scale: 1.0
[EDT] 0:0:9,507 - Codename One revisions: 7dd4e7d08b3442d90959477ee52a5ae8c4361b29

java.lang.IllegalArgumentException: Entity type net.informaticalibera.test.chatrad.ChatMessageModel$1@6e07c9d1 does not contain property com.codename1.rad.models.DateProperty@54a32e09
[EDT] 0:0:9,508 - Exception: java.lang.IllegalArgumentException - Entity type net.informaticalibera.test.chatrad.ChatMessageModel$1@6e07c9d1 does not contain property com.codename1.rad.models.DateProperty@54a32e09
	at com.codename1.rad.models.Entity.get(Entity.java:440)
	at com.codename1.rad.ui.chatroom.ChatBubbleView$ChatBubbleListCellRenderer.getListCellRendererComponent(ChatBubbleView.java:591)
	at com.codename1.rad.ui.entityviews.EntityListView.lambda$new$1(EntityListView.java:78)
	at com.codename1.ui.util.EventDispatcher.fireActionEvent(EventDispatcher.java:349)
	at com.codename1.rad.models.EntityList.fireEntityAdded(EntityList.java:151)
	at com.codename1.rad.models.EntityList.add(EntityList.java:106)
	at com.codename1.rad.ui.chatroom.ChatRoomView$ViewModel.addMessages(ChatRoomView.java:462)
	at net.informaticalibera.test.chatrad.ChatFormController.lambda$new$4(ChatFormController.java:114)
	at com.codename1.rad.controllers.Controller.lambda$addActionListener$0(Controller.java:131)
	at com.codename1.ui.util.EventDispatcher.fireActionSync(EventDispatcher.java:459)
	at com.codename1.ui.util.EventDispatcher.fireActionEvent(EventDispatcher.java:362)
	at com.codename1.rad.controllers.Controller.dispatchEvent(Controller.java:154)
	at com.codename1.rad.controllers.ActionSupport.dispatchEvent(ActionSupport.java:79)
	at com.codename1.rad.nodes.ActionNode.fireEvent(ActionNode.java:438)
	at com.codename1.rad.nodes.ActionNode.fireEvent(ActionNode.java:411)
	at com.codename1.rad.ui.DefaultActionViewFactory.lambda$initUI$0(DefaultActionViewFactory.java:216)
	at com.codename1.ui.util.EventDispatcher.fireActionEvent(EventDispatcher.java:349)
	at com.codename1.ui.Button.fireActionEvent(Button.java:679)
	at com.codename1.ui.Button.released(Button.java:720)
	at com.codename1.ui.Button.pointerReleased(Button.java:827)
	at com.codename1.ui.LeadUtil.pointerReleased(LeadUtil.java:153)
	at com.codename1.ui.Form.pointerReleased(Form.java:3677)
	at com.codename1.ui.Component.pointerReleased(Component.java:4729)
	at com.codename1.ui.Display.handleEvent(Display.java:2324)
	at com.codename1.ui.Display.edtLoopImpl(Display.java:1216)
	at com.codename1.ui.Display.mainEDTLoop(Display.java:1134)
	at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
	at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Found theme.css file.  Watching for changes...
BUILD SUCCESSFUL (total time: 50 seconds)

Screenshot:
error

Blog article?

I'm completely new to your CodeRAD library and RADChatRoom. I just discovered them by accident, noticing your last commit.

Have you wrote something the Codename One blog? Maybe I missed the news.

IllegalArgumentException: Component is already contained in Container

Hi,
I am going through the tutorial and I am at step 6. So, very simple code, just the beginning. The app compiles but I am getting the error at runtime:

java.lang.IllegalArgumentException: Component is already contained in Container: Container[x=0 y=0 width=0 height=0 name=null, layout = BoxLayout, scrollableX = false, scrollableY = false, components = [TextAreaPropertyView]]
	at com.codename1.ui.Container.insertComponentAtImpl(Container.java:927)
	at com.codename1.ui.Container.insertComponentAt(Container.java:918)
	at com.codename1.ui.Container.addComponent(Container.java:840)
	at com.codename1.ui.Container.encloseIn(Container.java:250)
	at com.codename1.ui.layouts.BoxLayout.encloseYCenter(BoxLayout.java:447)
	at com.codename1.rad.ui.chatroom.ChatRoomView.<init>(ChatRoomView.java:281)
	at com.codename1.rad.ui.chatroom.ChatRoomView.<init>(ChatRoomView.java:112)
	at com.example.controller.ChatFormController.<init>(ChatFormController.kt:16)

Do you have any suggestions on what can be wrong? My code is the exact copy of the code from examples in the tutorial.

RFE: option to disable swipe

Currently the swipe on the right to see time details can be nice, but in some circumstances it's better disabled. For example, I have to develop an app in which the swipe will be used to change the Form: in this case, the swipe of the RADChatRoom and the swipe that I'll add to change the Form will conflict.

actions for ProfileAvatarView.PROFILE_AVATAR_CLICKED_MENU does not show menu when clicked on title

I am following the tutorial and I am at the "Adding Phone and Video Conferencing" part. I used the code:

ViewNode viewNode = new ViewNode(
    actions(ChatRoomView.SEND_ACTION, send),
    actions(ProfileAvatarView.PROFILE_AVATAR_CLICKED_MENU, phone, videoConference) 
);

To add context menu for phone calls and videoconferencing. According to tutorial this should enable menu when clicked on title or on buble avatar. However, for me the menu only shows when I click on bubble avatar. Nothing happens when I click on title.

Bubble shape hardcoded - maybe it could be defined through CSS?

I wonder if it would be possible to change the implementation to have the bubble entire look defined in CSS?
I worked on a similar app in JavaFX and it was possible to define shape of the background label with round corners, all the colors, gradients, etc.... I am not sure if it is possible with Codename One, but it could be really useful.

ChatBubbleView update() method impossible to override

Hi,
I tried to reimplement the update method to put a custom content in the chat message, customize the chat bubble view and other things.
I am mostly interested in reimplementing the part within "if(changed) {...}" part, hoping to leave the rest of the code unchanged/copied.
However, the update() method uses lots of private fields and methods and most of the code in the class is private. This makes it nearly impossible to extended and customize some parts only.

I would suggest to change the access modifier to protected for most of the class members and/or split the update() method into smaller piece of code located in separate methods. This would allow for easier extensibility and flexibility in the future.

Input line does not show text typed in

I am still pretty early in the tutorial at adding send button.

The input line seems te not updated when I type text in there. I mean, I type a few letters 'abc' and nothing shows in the input line. Then I mouse-click on the any place inside the app and the input line shows the text I typed in. The same when I remove the text, etc...
So, the input seems like not being updated in letters typed.

Is there something I need to do in order to have the input show text typed right away?

Provide factory API for drawing a bubble

I had some suggestions in issues: #4 #5 However, the more I dig into the code the more different ideas I have. It seems the best solution would be to provide an API to create some sort of a factory to draw a buble and include all the information in the chat message that is needed.

Of course, I can write my own version of ChatBubbleView but it would be a waste of a very good piece of code which for the most part is perfectly fine. I suppose you plan to further work on it so more stuff would be coming in the future.

So, ways to inject customizations would be the best approach.

Add option to display avatar and postedBy for 'isOwnMessage = true'

Right now, the user avatar and nickname is displayed only for "other" users. It would be useful to allow to display avatar and user nickname for own messages well. This would provide more consistent UI plus it does look nice.

I agree that it may not make much practical sense. People mostly know their own name and how they look, unless their mirror is broken for a long time. Still an app looks and feels better of the UI is consistent in all places.

Therefore, some kind of an option to allow to display these elements would be nice.

CSS customization

Hi,
Is there any way to customize the look of the app, bubble colors and other elements through CSS?

Entity not set for addActionListener(phone)

I am following tutorial and I am now at "Adding phone and video conferencing". In the code example from the tutorial we have:

addActionListener(phone, evt->{
    evt.consume();
    if (!CN.canDial()) {
        Dialog.show("Not supported", "Phone calls not supported on this device", "OK", null);
        return;
    }
    if (evt.getEntity().isEmpty(Person.telephone)) {
        Dialog.show("No Phone", "This user has no phone number", "OK", null);
        return;
    }

    String phoneNumber = evt.getEntity().getText(Person.telephone);
    CN.dial(phoneNumber);

});

However, the "evt.getEntity().getText(Person.telephone)" is always null. In fact all other properties like "evt.getEntity().getText(Thing.name)" is null as well.
It seems like the "evt" event does not have the property field filled at all.

Chat input field does not regain focus after message is sent

Hi,
When on desktop and message is sent with ENTER it all works as expected. However, on mobile when a message is sent using "SEND" button, the input field does not regains focus after message is sent.
This leads to bad user experience as a user has to press "send" and then, again press on the input line to continue typing a message.

Correct behavior seems to make the focus return to the input field after message is sent.

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.