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">
|
android:layout_height="60dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/back"
|
android:id="@+id/cancel"
|
||||||
android:src="@drawable/back"
|
android:src="@drawable/cancel_edit"
|
||||||
android:background="@drawable/toolbar_button"
|
android:background="@drawable/toolbar_button"
|
||||||
android:contentDescription="@string/content_description_back"
|
android:contentDescription="@string/content_description_back"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="0.2"
|
android:layout_weight="0.2"
|
||||||
android:padding="18dp"/>
|
android:padding="15dp"/>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
android:layout_weight="0.4"/>
|
android:layout_weight="0.4"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/deleteContact"
|
android:id="@+id/delete_contact"
|
||||||
android:src="@drawable/delete"
|
android:src="@drawable/delete"
|
||||||
android:background="@drawable/toolbar_button"
|
android:background="@drawable/toolbar_button"
|
||||||
android:contentDescription="@string/content_description_delete"
|
android:contentDescription="@string/content_description_delete"
|
||||||
|
|
|
@ -956,8 +956,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
messagesList.setVisibility(View.VISIBLE);
|
messagesList.setVisibility(View.VISIBLE);
|
||||||
contactName.setVisibility(View.VISIBLE);
|
contactName.setVisibility(View.VISIBLE);
|
||||||
edit.setVisibility(View.VISIBLE);
|
edit.setVisibility(View.VISIBLE);
|
||||||
back.setVisibility(View.VISIBLE);
|
|
||||||
startCall.setVisibility(View.VISIBLE);
|
startCall.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if(getResources().getBoolean(R.bool.isTablet)){
|
||||||
|
back.setVisibility(View.INVISIBLE);
|
||||||
|
} else {
|
||||||
|
back.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
newChatConversation = false;
|
newChatConversation = false;
|
||||||
initChatRoom(sipUri);
|
initChatRoom(sipUri);
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ import android.widget.LinearLayout;
|
||||||
|
|
||||||
public class ContactEditorFragment extends Fragment {
|
public class ContactEditorFragment extends Fragment {
|
||||||
private View view;
|
private View view;
|
||||||
private ImageView back, edit, ok;
|
private ImageView cancel, deleteContact, ok;
|
||||||
private ImageView addNumber, addSipAddress, contactPicture;
|
private ImageView addNumber, addSipAddress, contactPicture;
|
||||||
private EditText firstName, lastName;
|
private EditText firstName, lastName;
|
||||||
private LayoutInflater inflater;
|
private LayoutInflater inflater;
|
||||||
|
@ -110,8 +110,10 @@ public class ContactEditorFragment extends Fragment {
|
||||||
|
|
||||||
view = inflater.inflate(R.layout.contact_edit, container, false);
|
view = inflater.inflate(R.layout.contact_edit, container, false);
|
||||||
|
|
||||||
ImageView back = (ImageView) view.findViewById(R.id.back);
|
deleteContact = (ImageView) view.findViewById(R.id.delete_contact);
|
||||||
back.setOnClickListener(new OnClickListener() {
|
|
||||||
|
cancel = (ImageView) view.findViewById(R.id.cancel);
|
||||||
|
cancel.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
getFragmentManager().popBackStackImmediate();
|
getFragmentManager().popBackStackImmediate();
|
||||||
|
@ -221,6 +223,8 @@ public class ContactEditorFragment extends Fragment {
|
||||||
lastName.setText(contact.getName());
|
lastName.setText(contact.getName());
|
||||||
firstName.setText("");
|
firstName.setText("");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
deleteContact.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
|
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
|
||||||
|
|
|
@ -454,7 +454,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
||||||
if (newFragmentType.shouldAddItselfToTheRightOf(currentFragment)) {
|
if (newFragmentType.shouldAddItselfToTheRightOf(currentFragment)) {
|
||||||
ll.setVisibility(View.VISIBLE);
|
ll.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if(newFragmentType == FragmentsAvailable.CONTACT_EDITOR){
|
||||||
transaction.addToBackStack(newFragmentType.toString());
|
transaction.addToBackStack(newFragmentType.toString());
|
||||||
|
}
|
||||||
transaction.replace(R.id.fragmentContainer2, newFragment);
|
transaction.replace(R.id.fragmentContainer2, newFragment);
|
||||||
} else {
|
} else {
|
||||||
if (newFragmentType == FragmentsAvailable.DIALER
|
if (newFragmentType == FragmentsAvailable.DIALER
|
||||||
|
|
Loading…
Reference in a new issue