Added backward button on conversation fragment.

This commit is contained in:
Pierre HUBERT 2018-07-31 11:12:09 +02:00
parent d2fbd4213e
commit 36cba023af
2 changed files with 11 additions and 0 deletions

View File

@ -188,6 +188,12 @@ public class MainActivity extends AppCompatActivity implements openConversationL
//Get action id //Get action id
int id = item.getItemId(); int id = item.getItemId();
//To go backward
if(id == android.R.id.home){
getSupportFragmentManager().popBackStack();
return true;
}
//To search a user //To search a user
if(id == R.id.action_search_user){ if(id == R.id.action_search_user){
searchUser(); searchUser();

View File

@ -13,6 +13,7 @@ import android.util.ArrayMap;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
@ -305,6 +306,8 @@ public class ConversationFragment extends Fragment
((MainActivity) getActivity()) ((MainActivity) getActivity())
.setSelectedNavigationItem(R.id.main_bottom_navigation_conversations); .setSelectedNavigationItem(R.id.main_bottom_navigation_conversations);
((MainActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//Check for conversation information //Check for conversation information
if(conversationInfo == null){ if(conversationInfo == null){
@ -333,6 +336,8 @@ public class ConversationFragment extends Fragment
super.onPause(); super.onPause();
refreshRunnable.quitSafely(); refreshRunnable.quitSafely();
((MainActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);
} }
@Override @Override