APISonar


co.chatsdk.core.session.ChatSDK.ui

> co > chatsdk > core > session > ChatSDK > ui
co APIs chatsdk APIs core APIs session APIs ChatSDK APIs ui APIs

Example 1
public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == R.id.action_search) {
            ChatSDK.ui().startSearchActivity(this);
        }
        return true;
    }
Example 2
public void conversationFragmentExample () {
        Fragment publicChatsFragment = ChatSDK.ui().publicThreadsFragment();
        Fragment privateChatsFragment = ChatSDK.ui().privateThreadsFragment();
    }
Example 3
public Completable startPrivateChatActivityWithUser (Context context, String userEntityID) {
        return createPrivateChatWithUser(userEntityID).doOnSuccess(thread -> {
            // Start the chat activity
            ChatSDK.ui().startChatActivityForID(context, userEntityID);
        }).ignoreElement();
    }
Example 4
public PagerAdapterTabs(FragmentManager fm) {
        super(fm);
        tabs = ChatSDK.ui().tabs();
    }
Example 5
protected void createAndOpenThread (String name, List<User> users) {
        showProgressDialog(getString(R.string.pick_friends_activity_prog_dialog_open_new_convo_message));
        disposableList.add(ChatSDK.thread()
                .createThread(name, users)
                .observeOn(AndroidSchedulers.mainThread())
                .doOnEvent((thread, throwable) -> dismissProgressDialog())
                .subscribe(thread -> {
                    ChatSDK.ui().startChatActivityForID(this, thread.getEntityID());
                    finish();
                }, toastOnErrorConsumer()));
    }
Example 6
public static String payloadAsString (Message message) {
        MessageDisplayHandler handler =  ChatSDK.ui().getMessageHandler(message.getMessageType());
        if (handler != null) {
            return handler.displayName(message);
        }
        return t(R.string.unknown_message);
    }
Example 7
public boolean showLocalNotificationsForTab (TabLayout.Tab tab, Thread thread) {
        // Don't show notifications on the threads tabs
        Tab t = adapter.getTabs().get(tab.getPosition());

        if (thread.typeIs(ThreadType.Private)) {
            Class privateThreadsFragmentClass = ChatSDK.ui().privateThreadsFragment().getClass();
            return !t.fragment.getClass().isAssignableFrom(privateThreadsFragmentClass);
        }
        if (thread.typeIs(ThreadType.Public)) {
            Class publicThreadsFragmentClass = ChatSDK.ui().publicThreadsFragment().getClass();
            return !t.fragment.getClass().isAssignableFrom(publicThreadsFragmentClass);
        }
        return true;
    }
Example 8
public void createMessageNotification(Message message) {

        Context context = ChatSDK.shared().context();
        String threadID = message.getThread().getEntityID();

        Intent openChatIntent = new Intent(context, ChatSDK.ui().getChatActivity());
        openChatIntent.putExtra(Keys.IntentKeyThreadEntityID, threadID);
        openChatIntent.setAction(threadID);
        openChatIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

        MessageDisplayHandler displayHandler = ChatSDK.ui().getMessageHandler(message.getMessageType());

        createMessageNotification(context, openChatIntent, message.getSender().getEntityID(), message.getSender().getName(), displayHandler.displayName(message));

    }
Example 9
public void launchFromPush (Bundle bundle) {
        if (bundle != null) {
            String threadID = bundle.getString(Keys.IntentKeyThreadEntityID);
            if (threadID != null && !threadID.isEmpty()) {
                ChatSDK.ui().startChatActivityForID(getBaseContext(), threadID);
            }
        }
    }
Example 10
protected void setFragmentForPosition (int position) {
        Tab tab = ChatSDK.ui().defaultTabs().get(position);

        getSupportFragmentManager()
                .beginTransaction()
                .add(R.id.content, tab.fragment)
                .disallowAddToBackStack()
                .commit();
    }
Example 11
public void updateLocalNotificationsForTab () {
        TabLayout.Tab tab = tabLayout.getTabAt(tabLayout.getSelectedTabPosition());
        ChatSDK.ui().setLocalNotificationHandler(thread -> showLocalNotificationsForTab(tab, thread));
    }
Example 12
public void initViews() {
        searchField = mainView.findViewById(R.id.search_field);
        listThreads = mainView.findViewById(R.id.list_threads);

        adapter = new ThreadsListAdapter(getActivity());

        listThreads.setLayoutManager(new LinearLayoutManager(this.getActivity()));
        listThreads.setAdapter(adapter);

        Disposable d = adapter.onClickObservable().subscribe(thread -> {
            ChatSDK.ui().startChatActivityForID(getContext(), thread.getEntityID());
        });
    }
Example 13
protected void startAddUsersActivity() {
        Intent intent = new Intent(this, ChatSDK.ui().getAddUsersToThreadActivity());
        intent.putExtra(Keys.IntentKeyThreadEntityID, thread.getEntityID());
        intent.putExtra(Keys.IntentKeyListPosSelectEnabled, listPos);
        intent.putExtra(Keys.IntentKeyAnimateExit, true);

        startActivityForResult(intent, ADD_USERS);

        overridePendingTransition(R.anim.slide_bottom_top, R.anim.dummy);
    }