package chat.rocket.android.fragment.chatroom;

import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import chat.rocket.android.R;
import chat.rocket.android.fragment.AbstractFragment;
import chat.rocket.android.widget.RoomToolbar;

abstract class AbstractChatRoomFragment extends AbstractFragment {

  private RoomToolbar roomToolbar;

  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                           @Nullable Bundle savedInstanceState) {
    roomToolbar = (RoomToolbar) getActivity().findViewById(R.id.activity_main_toolbar);
    return super.onCreateView(inflater, container, savedInstanceState);
  }

  protected void setToolbarTitle(@StringRes int stringResId) {
    if (roomToolbar == null) {
      return;
    }

    roomToolbar.setTitle(stringResId);
  }

  protected void setToolbarTitle(CharSequence title) {
    if (roomToolbar == null) {
      return;
    }

    roomToolbar.setTitle(title);
  }

  protected void setToolbarRoomIcon(@DrawableRes int drawableResId) {
    if (roomToolbar == null) {
      return;
    }

    roomToolbar.setRoomIcon(drawableResId);
  }
}

@@ -105,108 +105,16 @@
 ion.
-DrawableRes;%0Aimport android.support.annotation.Nullable;%0Aimport android.support.annotation.StringRes
+Nullable
 ;%0Aim
@@ -335,16 +335,53 @@
 Toolbar;
+%0Aimport chat.rocket.core.models.User;
 %0A%0Aabstra
@@ -441,17 +441,16 @@
 gment %7B%0A
-%0A
   privat
@@ -587,35 +587,8 @@
 ner,
-%0A                          
  @Nu
@@ -644,22 +644,8 @@
 ar =
- (RoomToolbar)
  get
@@ -811,42 +811,34 @@
 tle(
-@StringRes int stringResId
+CharSequence title
 ) %7B%0A    
 if (
@@ -825,36 +825,32 @@
 ce title) %7B%0A    
-if (
 roomToolbar == n
@@ -848,77 +848,121 @@
 lbar
- == null) %7B%0A      return;%0A    %7D%0A%0A    roomToolbar.setTitle(stringResId
+.setTitle(title);%0A  %7D%0A%0A  protected void showToolbarPrivateChannelIcon() %7B%0A    roomToolbar.showPrivateChannelIcon(
 );%0A 
@@ -987,49 +987,44 @@
 id s
-et
+how
 Toolbar
-Title(CharSequence title
+PublicChannelIcon(
 ) %7B%0A    
 if (
@@ -1011,36 +1011,32 @@
 nelIcon() %7B%0A    
-if (
 roomToolbar == n
@@ -1034,157 +1034,493 @@
 lbar
- == null) %7B%0A      return;%0A    %7D%0A%0A    roomToolbar.setTitle(title);%0A  %7D%0A%0A  protected void setToolbarRoomIcon(@DrawableRes int drawableResId) %7B
+.showPublicChannelIcon();%0A  %7D%0A%0A  protected void showToolbarUserStatuslIcon(String status) %7B%0A    switch (status) %7B%0A      case User.STATUS_ONLINE:%0A        roomToolbar.showUserStatusIcon(RoomToolbar.STATUS_ONLINE);%0A        break;%0A      case User.STATUS_BUSY:%0A        roomToolbar.showUserStatusIcon(RoomToolbar.STATUS_BUSY);%0A        break;%0A      case User.STATUS_AWAY:%0A        roomToolbar.showUserStatusIcon(RoomToolbar.STATUS_AWAY);%0A        break;%0A      case User.STATUS_OFFLINE:
 %0A    
-if (
+    
 room
@@ -1530,41 +1530,91 @@
 lbar
- == null) %7B%0A
+.showUserStatusIcon(RoomToolbar.STATUS_OFFLINE);%0A  
       
+b
 re
-turn
+ak
 ;%0A    
-%7D%0A%0A
+  default:%0A    
     
@@ -1630,37 +1630,77 @@
 ar.s
-etRoomIcon(drawableResId);
+howUserStatusIcon(RoomToolbar.STATUS_OFFLINE);%0A        break;%0A    %7D
 %0A  %7D%0A%7D
-%0A

Update AbstractChatRoomFragment.java