Search in sources :

Example 1 with ChatListAdapter

use of com.xabber.android.ui.adapter.ChatListAdapter in project xabber-android by redsolution.

the class RecentChatFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View rootView = inflater.inflate(R.layout.recent_chats, container, false);
    ArrayList<AbstractChat> activeChats = ((ChatViewer) getActivity()).getChatViewerAdapter().getActiveChats();
    ((ChatListAdapter) getListAdapter()).updateChats(activeChats);
    if (getListAdapter().isEmpty()) {
        Activity activity = getActivity();
        Toast.makeText(activity, R.string.chat_list_is_empty, Toast.LENGTH_LONG).show();
        activity.finish();
    }
    Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar_default);
    toolbar.setTitle(R.string.recent_chats);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            NavUtils.navigateUpFromSameTask(getActivity());
        }
    });
    toolbar.inflateMenu(R.menu.recent_chats);
    toolbar.setOnMenuItemClickListener(this);
    toolbar.setBackgroundColor(ColorManager.getInstance().getAccountPainter().getDefaultMainColor());
    return rootView;
}
Also used : ChatListAdapter(com.xabber.android.ui.adapter.ChatListAdapter) AbstractChat(com.xabber.android.data.message.AbstractChat) Activity(android.app.Activity) View(android.view.View) ListView(android.widget.ListView) Toolbar(android.support.v7.widget.Toolbar)

Example 2 with ChatListAdapter

use of com.xabber.android.ui.adapter.ChatListAdapter in project xabber-android by redsolution.

the class RecentChatFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setListAdapter(new ChatListAdapter(getActivity()));
}
Also used : ChatListAdapter(com.xabber.android.ui.adapter.ChatListAdapter)

Aggregations

ChatListAdapter (com.xabber.android.ui.adapter.ChatListAdapter)2 Activity (android.app.Activity)1 Toolbar (android.support.v7.widget.Toolbar)1 View (android.view.View)1 ListView (android.widget.ListView)1 AbstractChat (com.xabber.android.data.message.AbstractChat)1