Tabnine Logo
AbstractThreadHandler
Code IndexAdd Tabnine to your IDE (free)

How to use
AbstractThreadHandler
in
co.chatsdk.core.base

Best Java code snippets using co.chatsdk.core.base.AbstractThreadHandler (Showing top 13 results out of 315)

origin: chat-sdk/chat-sdk-android

public Completable addUsersToThread(Thread thread, User... users) {
  return addUsersToThread(thread, Arrays.asList(users));
}
origin: chat-sdk/chat-sdk-android

public Single<Thread> createThread(List<User> users) {
  return createThread(null, users);
}
origin: chat-sdk/chat-sdk-android

public List<Thread> getThreads(int type) {
  return getThreads(type, false);
}
origin: chat-sdk/chat-sdk-android

/**
 * Preparing a text message,
 * This is only the build part of the send from here the message will passed to "sendMessage" Method.
 * From there the message will be uploaded to the server if the upload fails the message will be deleted from the local db.
 * If the upload is successful we will update the message entity so the entityId given from the server will be saved.
 * The message will be received before sending in the onMainFinished Callback with a Status that its in the sending process.
 * When the message is fully sent the status will be changed and the onItem callback will be invoked.
 * When done or when an error occurred the calling method will be notified.
 */
public Observable<MessageSendProgress> sendMessageWithText(final String text, final Thread thread) {
  return Observable.create((ObservableOnSubscribe<MessageSendProgress>) e -> {
    final Message message = newMessage(MessageType.Text, thread);
    message.setText(text);
    e.onNext(new MessageSendProgress(message));
    ObservableConnector<MessageSendProgress> connector = new ObservableConnector<>();
    connector.connect(implSendMessage(message), e);
  }).subscribeOn(Schedulers.single());
}
origin: chat-sdk/chat-sdk-android

public static Message newMessage (MessageType type, Thread thread) {
  return newMessage(type.ordinal(), thread);
}
origin: chat-sdk/chat-sdk-android

public Completable removeUsersFromThread(Thread thread, User... users) {
  return removeUsersFromThread(thread, Arrays.asList(users));
}
origin: chat-sdk/chat-sdk-android

public Single<List<Message>> loadMoreMessagesForThread(final Message fromMessage, final Thread thread) {
  return super.loadMoreMessagesForThread(fromMessage, thread).flatMap(messages -> {
    if (messages.isEmpty()) {
      return new ThreadWrapper(thread).loadMoreMessages(fromMessage, ChatSDK.config().messagesToLoadPerBatch);
    }
    return Single.just(messages);
  });
}
origin: chat-sdk/chat-sdk-android

/**
/* Convenience method to save the message to the database then pass it to the token network adapter
 * send method so it can be sent via the network
 */
public Observable<MessageSendProgress> implSendMessage(final Message message) {
  return Observable.create((ObservableOnSubscribe<MessageSendProgress>) e -> {
    message.update();
    message.getThread().update();
    if (ChatSDK.encryption() != null) {
      ChatSDK.encryption().encrypt(message);
    }
    e.onNext(new MessageSendProgress(message));
    e.onComplete();
  }).concatWith(sendMessage(message))
      .subscribeOn(Schedulers.single()).doOnComplete(() -> {
        message.setMessageStatus(MessageSendStatus.Sent);
        message.update();
      }).doOnError(throwable -> {
        message.setMessageStatus(MessageSendStatus.Failed);
        message.update();
      });
}
origin: chat-sdk/chat-sdk-android

return Observable.create((ObservableOnSubscribe<MessageSendProgress>) e -> {
  final Message message = AbstractThreadHandler.newMessage(MessageType.Image, thread);
origin: chat-sdk/chat-sdk-android

public List<Thread> getThreads(int type, boolean allowDeleted) {
  return getThreads(type, allowDeleted, ChatSDK.config().showEmptyChats);
}
origin: chat-sdk/chat-sdk-android

public Observable<MessageSendProgress> sendMessageWithLocation(final String filePath, final LatLng location, final Thread thread) {
  return Observable.create((ObservableOnSubscribe<MessageSendProgress>) e -> {
    final Message message = AbstractThreadHandler.newMessage(MessageType.Location, thread);
origin: chat-sdk/chat-sdk-android

public Single<Thread> createThread(String name, User... users) {
  return createThread(name, Arrays.asList(users));
}
origin: chat-sdk/chat-sdk-android

public int getUnreadMessagesAmount(boolean onePerThread){
  List<Thread> threads = getThreads(ThreadType.Private, false);
  int count = 0;
  for (Thread t : threads) {
    if (onePerThread) {
      if(!t.isLastMessageWasRead()) {
        count++;
      }
    }
    else {
      count += t.getUnreadMessagesCount();
    }
  }
  return count;
}
co.chatsdk.core.baseAbstractThreadHandler

Javadoc

Created by benjaminsmiley-andrews on 25/05/2017.

Most used methods

  • addUsersToThread
  • createThread
  • getThreads
  • implSendMessage
    /* Convenience method to save the message to the database then pass it to the token network adapter
  • loadMoreMessagesForThread
  • newMessage
  • removeUsersFromThread
  • sendMessage

Popular in Java

  • Start an intent from android
  • getContentResolver (Context)
  • startActivity (Activity)
  • onRequestPermissionsResult (Fragment)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now