diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UpdateConversationFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UpdateConversationFragment.java index 929e252..24cfc8f 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UpdateConversationFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UpdateConversationFragment.java @@ -33,6 +33,7 @@ import org.communiquons.android.comunic.client.ui.adapters.UsersAsysncInfoAdapte import org.communiquons.android.comunic.client.data.models.ConversationsInfo; import org.communiquons.android.comunic.client.data.helpers.ConversationsListHelper; import org.communiquons.android.comunic.client.ui.listeners.openConversationListener; +import org.communiquons.android.comunic.client.ui.views.AppBarLayout; import java.util.ArrayList; @@ -85,6 +86,11 @@ public class UpdateConversationFragment extends Fragment { */ private boolean conversation_owner = true; + /** + * Application bar + */ + private AppBarLayout mAppBar; + /** * The name of the conversation */ @@ -193,6 +199,7 @@ public class UpdateConversationFragment extends Fragment { super.onViewCreated(view, savedInstanceState); //Get the views + mAppBar = view.findViewById(R.id.appbar); progressBar = view.findViewById(R.id.progress_bar); nameView = view.findViewById(R.id.fragment_update_conversation_name); followCheckbox = view.findViewById(R.id.fragment_update_conversation_follow); @@ -222,7 +229,13 @@ public class UpdateConversationFragment extends Fragment { //Set members list context menu membersList.setOnCreateContextMenuListener(membersListContext); - + //Add back buttn + mAppBar.addBackButton(new View.OnClickListener() { + @Override + public void onClick(View v) { + MainActivity.goBackward(getActivity()); + } + }); } @@ -232,9 +245,9 @@ public class UpdateConversationFragment extends Fragment { //Set the adapted title if(current_action == ACTION_CREATE_CONVERSATION) - getActivity().setTitle(R.string.fragment_update_conversation_title_create); + mAppBar.setTitle(R.string.fragment_update_conversation_title_create); else - getActivity().setTitle(R.string.fragment_update_conversation_title_update); + mAppBar.setTitle(R.string.fragment_update_conversation_title_update); MainActivity.SetNavbarSelectedOption(getActivity(), R.id.action_conversations); } diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/views/AppBarLayout.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/views/AppBarLayout.java index 40ba407..6064ce8 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/views/AppBarLayout.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/views/AppBarLayout.java @@ -45,6 +45,15 @@ public class AppBarLayout extends BaseFrameLayoutView { return mToolbar; } + /** + * Update (set) the title of the conversatoin + * + * @param resId The ID of the target ressource + */ + public void setTitle(int resId){ + setTitle(UiUtils.getString(getContext(), resId)); + } + /** * Update the title of the appbar * @@ -81,7 +90,7 @@ public class AppBarLayout extends BaseFrameLayoutView { AppCompatImageButton btn = new AppCompatImageButton(getActivity(), null, android.support.v7.appcompat.R.attr.toolbarStyle); - btn.setPadding(5, 0, 5, 0); + btn.setPadding(10, 0, 10, 0); btn.setImageDrawable(drawable); btn.setOnClickListener(listener); getToolbar().addView(btn); diff --git a/app/src/main/res/layout/fragment_update_conversation.xml b/app/src/main/res/layout/fragment_update_conversation.xml index 279b610..287abf8 100644 --- a/app/src/main/res/layout/fragment_update_conversation.xml +++ b/app/src/main/res/layout/fragment_update_conversation.xml @@ -3,7 +3,12 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> - + + +