Fix fragment back button and add cancel button for contact editor

This commit is contained in:
Margaux Clerc 2016-02-10 12:23:55 +01:00
parent 90c5faa6f8
commit 2ea62bb0c9
4 changed files with 28 additions and 16 deletions

View file

@ -12,14 +12,14 @@
android:layout_height="60dp">
<ImageView
android:id="@+id/back"
android:src="@drawable/back"
android:id="@+id/cancel"
android:src="@drawable/cancel_edit"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_back"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:padding="18dp"/>
android:padding="15dp"/>
<View
android:layout_width="0dp"
@ -27,7 +27,7 @@
android:layout_weight="0.4"/>
<ImageView
android:id="@+id/deleteContact"
android:id="@+id/delete_contact"
android:src="@drawable/delete"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_delete"

View file

@ -956,8 +956,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
messagesList.setVisibility(View.VISIBLE);
contactName.setVisibility(View.VISIBLE);
edit.setVisibility(View.VISIBLE);
back.setVisibility(View.VISIBLE);
startCall.setVisibility(View.VISIBLE);
if(getResources().getBoolean(R.bool.isTablet)){
back.setVisibility(View.INVISIBLE);
} else {
back.setOnClickListener(this);
}
newChatConversation = false;
initChatRoom(sipUri);
}

View file

@ -65,7 +65,7 @@ import android.widget.LinearLayout;
public class ContactEditorFragment extends Fragment {
private View view;
private ImageView back, edit, ok;
private ImageView cancel, deleteContact, ok;
private ImageView addNumber, addSipAddress, contactPicture;
private EditText firstName, lastName;
private LayoutInflater inflater;
@ -110,8 +110,10 @@ public class ContactEditorFragment extends Fragment {
view = inflater.inflate(R.layout.contact_edit, container, false);
ImageView back = (ImageView) view.findViewById(R.id.back);
back.setOnClickListener(new OnClickListener() {
deleteContact = (ImageView) view.findViewById(R.id.delete_contact);
cancel = (ImageView) view.findViewById(R.id.cancel);
cancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getFragmentManager().popBackStackImmediate();
@ -221,6 +223,8 @@ public class ContactEditorFragment extends Fragment {
lastName.setText(contact.getName());
firstName.setText("");
}
} else {
deleteContact.setVisibility(View.INVISIBLE);
}
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);

View file

@ -454,7 +454,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if (newFragmentType.shouldAddItselfToTheRightOf(currentFragment)) {
ll.setVisibility(View.VISIBLE);
if(newFragmentType == FragmentsAvailable.CONTACT_EDITOR){
transaction.addToBackStack(newFragmentType.toString());
}
transaction.replace(R.id.fragmentContainer2, newFragment);
} else {
if (newFragmentType == FragmentsAvailable.DIALER