#Atlas
Atlas is an open source framework of customizable UI components for use with the Layer SDK designed to get messaging tested and integrated quickly. This repository contains the Atlas library. For a fully-featured messaging app, see the open source Atlas Messenger project, which uses this Atlas library and the Layer SDK.
###Feature Priorities We are actively adding features for the following priorities:
- Configurable styling
- Animated GIFs
- Video
- Automated UI tests
Please see the list of branches for work in progress. If you don't see a feature you are interested in there, please start a branch and submit a pull request.
##Key Concepts With Atlas, Messages have types. One type might be rich text, and another might be a map location or photo. Anything that can be packaged into a set of MIME Types and data can be represented by Atlas.
Under the hood, MessageSenders send individual Message types, and AtlasCellFactories render them. Additional Message types can be added to your app by extending these classes. For a list of default types, see the messagetypes subpackage.
##API Quickstart
The Atlas library is located in the layer-atlas
directory. The table below details the most important classes in Atlas and is hyperlinked directly to the current java file.
Views | |
---|---|
AtlasConversationsRecyclerView | A list of Conversations |
AtlasMessagesRecyclerView | A list of Messages within a Conversation |
AtlasMessageComposer | A View used to compose and send Messages |
AtlasAddressBar | Participant selection with dynamic filtering |
AtlasTypingIndicator | Displays TypingIndicator information for a Conversation |
Factories and Senders | |
AtlasCellFactory | Classifies, parses, and renders Messages |
MessageSender | Sends Messages |
AtlasTypingIndicator. TypingIndicatorFactory | Renders typing indicators |
Interfaces | |
Participant | Allows Atlas classes to render Participant information |
ParticipantProvider | Provides Atlas classes with Participants from a backend Identity Provider |
##Installation Maven publication coming soon. In the meantime, include this repository as a git submodule or similar, as in the Atlas Messenger.
Atlas uses Picasso for image caching, resizing, and processing, and Subsampling Scale Image View for image its in-app lightbox. Other dependencies include the Android recyclerview
, appcompat
, and design
libraries.
##Component Details
Atlas is divided into five basic View
components, typically presented on a screen with a user's conversations, a screen with messages within a conversation, and a component that lets the user select participants.
####AtlasConversationsRecyclerView
The AtlasConversationsRecyclerView is a list of Conversations.
#####XML
<com.layer.atlas.AtlasConversationsRecyclerView
android:id="@+id/conversations_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
#####Java
conversationsList = ((AtlasConversationsRecyclerView) findViewById(R.id.conversations_list))
.init(layerClient, participantProvider, picasso)
.setOnConversationClickListener(new OnConversationClickListener() {
public void onConversationClick(AtlasConversationsAdapter adapter, Conversation conversation) {
launchMessagesList(conversation);
}
public boolean onConversationLongClick(AtlasConversationsAdapter adapter, Conversation conversation) {
return false;
}
});
####AtlasMessagesRecyclerView
The AtlasMessagesRecyclerView is list of Messages, rendered by AtlasCellFactories.
#####XML
<com.layer.atlas.AtlasMessagesRecyclerView
android:id="@+id/messages_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
#####Java
messagesList = ((AtlasMessagesRecyclerView) findViewById(R.id.messages_list))
.init(layerClient, participantProvider, picasso)
.setConversation(conversation)
.addCellFactories(
new TextCellFactory(),
new ThreePartImageCellFactory(this, layerClient, picasso),
new LocationCellFactory(this, picasso));
####AtlasMessageComposer
The AtlasMessageComposer is a text entry area for composing messages and a menu of AttachmentSenders.
#####XML
<com.layer.atlas.AtlasMessageComposer
android:id="@+id/message_composer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
#####Java
messageComposer = ((AtlasMessageComposer) findViewById(R.id.message_composer))
.init(layerClient, participantProvider)
.setTextSender(new TextSender())
.addAttachmentSenders(
new CameraSender("Camera", R.drawable.ic_photo_camera_white_24dp, this),
new GallerySender("Gallery", R.drawable.ic_photo_white_24dp, this),
new LocationSender("Location", R.drawable.ic_place_white_24dp, this));
####AtlasTypingIndicator
The AtlasTypingIndicator presents the user with active typists.
#####XML
<com.layer.atlas.AtlasTypingIndicator
android:id="@+id/typing_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
#####Java
typingIndicator = new AtlasTypingIndicator(this)
.init(layerClient)
.setTypingIndicatorFactory(new BubbleTypingIndicatorFactory())
.setTypingActivityListener(new AtlasTypingIndicator.TypingActivityListener() {
public void onTypingActivityChange(AtlasTypingIndicator typingIndicator, boolean active) {
messagesList.setFooterView(active ? typingIndicator : null);
}
});
####AtlasParticipantPicker
The AtlasParticipantPicker allows the user to search and select one or more participants, or jump to existing Conversations.
#####XML
<com.layer.atlas.AtlasAddressBar
android:id="@+id/address_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
#####Java
addressBar = (AtlasAddressBar) findViewById(R.id.address_bar)
.init(layerClient, participantProvider, picasso)
.setOnConversationClickListener(new OnConversationClickListenertener() {
public void onConversationClick(AtlasAddressBar addressBar, Conversation conversation) {
setConversation(conversation);
}
})
.setOnParticipantSelectionChangeListener(new OnParticipantSelectionChangeListener() {
public void onParticipantSelectionChanged(AtlasAddressBar addressBar, List<String> participantIds) {
if (participantIds.isEmpty()) {
setConversation(null);
return;
}
try {
ConversationOptions options = new ConversationOptions().distinct(true);
setConversation(layerClient.newConversation(options, participantIds), false);
} catch (LayerConversationException e) {
setConversation(e.getConversation(), false);
}
}
});
##Contributing Atlas is an Open Source project maintained by Layer. Feedback and contributions are always welcome and the maintainers try to process patches as quickly as possible. Feel free to open up a Pull Request or Issue on Github.
Atlas is licensed under the terms of the Apache License, version 2.0. Please see the LICENSE file for full details.
Atlas was developed in San Francisco by the Layer team. If you have any technical questions or concerns about this project feel free to reach out to Layer Support.