Merge "Fix bugs on RTL alignments." into ub-contactsdialer-a-dev
diff --git a/res/layout/quickcontact_expand_suggestion_card.xml b/res/layout/quickcontact_expand_suggestion_card.xml
index 645d796..9c19efc 100644
--- a/res/layout/quickcontact_expand_suggestion_card.xml
+++ b/res/layout/quickcontact_expand_suggestion_card.xml
@@ -90,7 +90,7 @@
 
                 <TextView
                     android:id="@+id/suggestion_for_name"
-                    android:layout_width="match_parent"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_weight="1"
                     android:textAppearance="?android:attr/textAppearanceMedium"
@@ -134,6 +134,7 @@
             android:layout_width="wrap_content"
             android:layout_height="@dimen/quickcontact_expanding_button_section_height"
             android:layout_gravity="center_vertical|end"
+            android:layout_marginEnd="@dimen/quickcontact_expanding_button_right_padding"
             android:layout_marginRight="@dimen/quickcontact_expanding_button_right_padding"
             android:layout_marginTop="@dimen/quickcontact_expanding_button_section_padding"
             android:layout_marginBottom="@dimen/quickcontact_expanding_button_section_padding"
diff --git a/src/com/android/contacts/activities/ContactEditorBaseActivity.java b/src/com/android/contacts/activities/ContactEditorBaseActivity.java
index d19f467..ffbeb49 100644
--- a/src/com/android/contacts/activities/ContactEditorBaseActivity.java
+++ b/src/com/android/contacts/activities/ContactEditorBaseActivity.java
@@ -67,7 +67,7 @@
     public static final String ACTION_JOIN_COMPLETED = "joinCompleted";
     public static final String ACTION_SAVE_COMPLETED = "saveCompleted";
 
-    public static final int RESULT_SPLIT_COMPLETED = 2;
+    public static final int RESULT_CODE_SPLIT = 2;
 
     protected int mActionBarTitleResId;
 
@@ -307,7 +307,7 @@
 
         @Override
         public void onContactSplit(Uri newLookupUri) {
-            setResult(RESULT_SPLIT_COMPLETED, /* data */ null);
+            setResult(RESULT_CODE_SPLIT, /* data */ null);
             finish();
         }
 
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index e2ffc2f..143cb47 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -1104,15 +1104,11 @@
 
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        if (requestCode == REQUEST_CODE_CONTACT_EDITOR_ACTIVITY &&
-                resultCode == ContactDeletionInteraction.RESULT_CODE_DELETED) {
-            // The contact that we were showing has been deleted.
+        final boolean deletedOrSplit = requestCode == REQUEST_CODE_CONTACT_EDITOR_ACTIVITY &&
+                (resultCode == ContactDeletionInteraction.RESULT_CODE_DELETED ||
+                resultCode == ContactEditorBaseActivity.RESULT_CODE_SPLIT);
+        if (deletedOrSplit) {
             finish();
-        } else if (requestCode == REQUEST_CODE_CONTACT_EDITOR_ACTIVITY &&
-                resultCode == ContactEditorBaseActivity.RESULT_SPLIT_COMPLETED) {
-            // The contact that we were showing has been unlinked, and we reload this activity.
-            finish();
-            startActivity(getIntent());
         } else if (requestCode == REQUEST_CODE_CONTACT_SELECTION_ACTIVITY &&
                 resultCode != RESULT_CANCELED) {
             processIntent(data);