Fix fragment back button and add cancel button for contact editor
This commit is contained in:
parent
90c5faa6f8
commit
2ea62bb0c9
4 changed files with 28 additions and 16 deletions
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,14 +110,16 @@ 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() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getFragmentManager().popBackStackImmediate();
|
||||
}
|
||||
});
|
||||
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
ok = (ImageView) view.findViewById(R.id.ok);
|
||||
ok.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
|
@ -221,8 +223,10 @@ public class ContactEditorFragment extends Fragment {
|
|||
lastName.setText(contact.getName());
|
||||
firstName.setText("");
|
||||
}
|
||||
} else {
|
||||
deleteContact.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
|
||||
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
|
||||
if (contact != null && contact.getPhotoUri() != null) {
|
||||
InputStream input = Compatibility.getContactPictureInputStream(getActivity().getContentResolver(), contact.getID());
|
||||
|
|
|
@ -454,7 +454,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
if (newFragmentType.shouldAddItselfToTheRightOf(currentFragment)) {
|
||||
ll.setVisibility(View.VISIBLE);
|
||||
|
||||
transaction.addToBackStack(newFragmentType.toString());
|
||||
if(newFragmentType == FragmentsAvailable.CONTACT_EDITOR){
|
||||
transaction.addToBackStack(newFragmentType.toString());
|
||||
}
|
||||
transaction.replace(R.id.fragmentContainer2, newFragment);
|
||||
} else {
|
||||
if (newFragmentType == FragmentsAvailable.DIALER
|
||||
|
|
Loading…
Reference in a new issue