Fix crash when opening the editor and move buttons to ActionBar
Change-Id: Id079a1e88c06aee2d1ff2894bc516c4df8b43406
diff --git a/res/layout/contact_editor_activity.xml b/res/layout/contact_editor_activity.xml
index 630e82c..8c13629 100644
--- a/res/layout/contact_editor_activity.xml
+++ b/res/layout/contact_editor_activity.xml
@@ -22,21 +22,4 @@
android:id="@+id/contact_editor_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="50dip"
- android:orientation="horizontal"
- android:gravity="center_horizontal">
-
- <Button
- android:id="@+id/done"
- android:layout_width="150dip"
- android:layout_height="match_parent"
- android:text="@string/menu_done" />
- <Button
- android:id="@+id/revert"
- android:layout_width="150dip"
- android:layout_height="match_parent"
- android:text="@string/menu_doNotSave" />
- </LinearLayout>
</FrameLayout>
diff --git a/res/layout/item_kind_section.xml b/res/layout/item_kind_section.xml
index fdb55c9..c0e42a0 100644
--- a/res/layout/item_kind_section.xml
+++ b/res/layout/item_kind_section.xml
@@ -53,18 +53,23 @@
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
- <ImageButton
- android:id="@+id/kind_plus"
+ <FrameLayout
+ android:id="@+id/kind_plus_container"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:duplicateParentState="true"
- android:background="?android:attr/selectableItemBackground"
- android:src="@drawable/ic_menu_add_field_holo_light"
- android:paddingLeft="@dimen/editor_round_button_padding_left"
- android:paddingRight="@dimen/editor_round_button_padding_right"
- android:paddingTop="@dimen/editor_round_button_padding_top"
- android:paddingBottom="@dimen/editor_round_button_padding_bottom"
- android:contentDescription="@string/description_plus_button" />
+ android:layout_height="@dimen/editor_min_line_item_height">
+ <ImageButton
+ android:id="@+id/kind_plus"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:duplicateParentState="true"
+ android:background="?android:attr/selectableItemBackground"
+ android:src="@drawable/ic_menu_add_field_holo_light"
+ android:paddingLeft="@dimen/editor_round_button_padding_left"
+ android:paddingRight="@dimen/editor_round_button_padding_right"
+ android:paddingTop="@dimen/editor_round_button_padding_top"
+ android:paddingBottom="@dimen/editor_round_button_padding_bottom"
+ android:contentDescription="@string/description_plus_button" />
+ </FrameLayout>
</LinearLayout>
diff --git a/src/com/android/contacts/activities/ContactEditorActivity.java b/src/com/android/contacts/activities/ContactEditorActivity.java
index 35f7413..cedde4e 100644
--- a/src/com/android/contacts/activities/ContactEditorActivity.java
+++ b/src/com/android/contacts/activities/ContactEditorActivity.java
@@ -53,8 +53,6 @@
public static final String ACTION_SAVE_COMPLETED = "saveCompleted";
private ContactEditorFragment mFragment;
- private Button mDoneButton;
- private Button mRevertButton;
private DialogManager mDialogManager = new DialogManager(this);
@@ -90,22 +88,6 @@
mFragment.setListener(mFragmentListener);
Uri uri = Intent.ACTION_EDIT.equals(action) ? getIntent().getData() : null;
mFragment.load(action, uri, getIntent().getExtras());
-
- // Depending on the use-case, this activity has Done and Revert buttons or not.
- mDoneButton = (Button) findViewById(R.id.done);
- mRevertButton = (Button) findViewById(R.id.revert);
- if (mDoneButton != null) mDoneButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- mFragment.save(SaveMode.CLOSE);
- }
- });
- if (mRevertButton != null) mRevertButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- finish();
- }
- });
}
@Override