Added bar on update conversation fragment

This commit is contained in:
Pierre HUBERT 2018-08-22 10:46:13 +02:00
parent 3f3fa95d72
commit be8c904593
3 changed files with 32 additions and 5 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -3,7 +3,12 @@
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Progres bar -->
<org.communiquons.android.comunic.client.ui.views.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!-- Progress bar -->
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="wrap_content"