Commit 7c2fa9dc authored by Grigory Fedorov's avatar Grigory Fedorov

Hardware menu button fixed in chat screen #456

parent 92489a7f
...@@ -15,6 +15,7 @@ import android.text.TextWatcher; ...@@ -15,6 +15,7 @@ import android.text.TextWatcher;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -131,6 +132,8 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem ...@@ -131,6 +132,8 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
} }
}); });
setHasOptionsMenu(true);
AccountPainter accountPainter = new AccountPainter(getActivity()); AccountPainter accountPainter = new AccountPainter(getActivity());
toolbar.setBackgroundColor(accountPainter.getAccountMainColor(account)); toolbar.setBackgroundColor(accountPainter.getAccountMainColor(account));
...@@ -326,6 +329,23 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem ...@@ -326,6 +329,23 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
updateChat(); updateChat();
} }
/**
* This method used for hardware menu button
*/
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.chat, menu);
setUpOptionsMenu(menu);
}
/**
* This method used for hardware menu button
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return onMenuItemClick(item);
}
private void setUpOptionsMenu(Menu menu) { private void setUpOptionsMenu(Menu menu) {
AbstractChat abstractChat = MessageManager.getInstance().getChat(account, user); AbstractChat abstractChat = MessageManager.getInstance().getChat(account, user);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment