Pressed state for buttons
- Delete button, expansion button, fix padding on messaging icon
Bug: 4382255
Change-Id: I5ef0a9ee760a095b4f9e0efda71c13c4b89328e6
diff --git a/res/layout-xlarge-land/contact_detail_list_item.xml b/res/layout-xlarge-land/contact_detail_list_item.xml
index 47af40a..9749f2a 100644
--- a/res/layout-xlarge-land/contact_detail_list_item.xml
+++ b/res/layout-xlarge-land/contact_detail_list_item.xml
@@ -97,14 +97,26 @@
android:layout_marginRight="14dip"
android:background="?android:attr/dividerVertical" />
- <ImageView
- android:id="@+id/secondary_action_button"
- android:layout_width="32dip"
+ <FrameLayout
+ android:id="@+id/secondary_action_button_container"
+ android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:layout_centerVertical="true"
- android:gravity="center"
- android:scaleType="center"
- android:background="?android:attr/selectableItemBackground" />
+ android:layout_marginTop="10dip"
+ android:paddingLeft="@dimen/detail_item_icon_margin"
+ android:paddingRight="@dimen/detail_item_icon_margin"
+ android:duplicateParentState="false"
+ android:background="?android:attr/selectableItemBackground">
+
+ <ImageView
+ android:id="@+id/secondary_action_button"
+ android:layout_width="32dip"
+ android:layout_height="match_parent"
+ android:layout_centerVertical="true"
+ android:gravity="center"
+ android:scaleType="center"
+ android:duplicateParentState="false" />
+
+ </FrameLayout>
</LinearLayout>
</LinearLayout>
diff --git a/res/layout-xlarge/phonetic_name_editor_view.xml b/res/layout-xlarge/phonetic_name_editor_view.xml
index 0ce560e..be36915 100644
--- a/res/layout-xlarge/phonetic_name_editor_view.xml
+++ b/res/layout-xlarge/phonetic_name_editor_view.xml
@@ -53,8 +53,8 @@
layout="@layout/edit_field_list" />
<include
- android:id="@+id/expansion_button_container"
- layout="@layout/edit_expansion_button"
+ android:id="@+id/expansion_view_container"
+ layout="@layout/edit_expansion_view"
android:visibility="gone" />
<include
diff --git a/res/layout-xlarge/structured_name_editor_view.xml b/res/layout-xlarge/structured_name_editor_view.xml
index 048d1db..87f788a 100644
--- a/res/layout-xlarge/structured_name_editor_view.xml
+++ b/res/layout-xlarge/structured_name_editor_view.xml
@@ -52,8 +52,8 @@
layout="@layout/edit_field_list" />
<include
- android:id="@+id/expansion_button_container"
- layout="@layout/edit_expansion_button"
+ android:id="@+id/expansion_view_container"
+ layout="@layout/edit_expansion_view"
android:visibility="gone" />
<include
diff --git a/res/layout-xlarge/text_fields_editor_view.xml b/res/layout-xlarge/text_fields_editor_view.xml
index 927654b..5e77a97 100644
--- a/res/layout-xlarge/text_fields_editor_view.xml
+++ b/res/layout-xlarge/text_fields_editor_view.xml
@@ -48,8 +48,8 @@
android:visibility="gone" />
<include
- android:id="@+id/expansion_button_container"
- layout="@layout/edit_expansion_button"
+ android:id="@+id/expansion_view_container"
+ layout="@layout/edit_expansion_view"
android:visibility="gone" />
<include
diff --git a/res/layout/contact_detail_list_item.xml b/res/layout/contact_detail_list_item.xml
index db37862..b504fe0 100644
--- a/res/layout/contact_detail_list_item.xml
+++ b/res/layout/contact_detail_list_item.xml
@@ -85,15 +85,22 @@
android:layout_marginBottom="8dip"
android:background="?android:attr/dividerVertical" />
- <ImageView
- android:id="@+id/secondary_action_button"
- android:layout_width="32dip"
+ <FrameLayout
+ android:id="@+id/secondary_action_button_container"
+ android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:layout_marginLeft="@dimen/detail_item_icon_margin"
- android:layout_marginRight="@dimen/detail_item_icon_margin"
+ android:layout_marginTop="10dip"
+ android:paddingLeft="@dimen/detail_item_icon_margin"
+ android:paddingRight="@dimen/detail_item_icon_margin"
android:duplicateParentState="false"
- android:layout_gravity="bottom"
- android:background="?android:attr/selectableItemBackground" />
+ android:background="?android:attr/selectableItemBackground">
+ <ImageView
+ android:id="@+id/secondary_action_button"
+ android:layout_width="32dip"
+ android:layout_height="match_parent"
+ android:duplicateParentState="false" />
+ </FrameLayout>
+
</LinearLayout>
<!-- Separating line (only for the last row) -->
diff --git a/res/layout/edit_delete_button.xml b/res/layout/edit_delete_button.xml
index c0a895e..790163e 100644
--- a/res/layout/edit_delete_button.xml
+++ b/res/layout/edit_delete_button.xml
@@ -21,7 +21,7 @@
android:layout_width="wrap_content"
android:layout_height="@dimen/editor_min_line_item_height"
android:layout_gravity="top">
- <ImageButton
+ <ImageView
android:id="@+id/delete_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/res/layout/edit_expansion_button.xml b/res/layout/edit_expansion_view.xml
similarity index 95%
rename from res/layout/edit_expansion_button.xml
rename to res/layout/edit_expansion_view.xml
index 27e6102..6368c4b 100644
--- a/res/layout/edit_expansion_button.xml
+++ b/res/layout/edit_expansion_view.xml
@@ -21,8 +21,8 @@
android:layout_width="wrap_content"
android:layout_height="@dimen/editor_min_line_item_height"
android:layout_gravity="top">
- <ImageButton
- android:id="@+id/expansion_button"
+ <ImageView
+ android:id="@+id/expansion_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:duplicateParentState="true"
diff --git a/res/layout/phonetic_name_editor_view.xml b/res/layout/phonetic_name_editor_view.xml
index 3a3987d..1f17f69 100644
--- a/res/layout/phonetic_name_editor_view.xml
+++ b/res/layout/phonetic_name_editor_view.xml
@@ -49,8 +49,8 @@
layout="@layout/edit_field_list" />
<include
- android:id="@+id/expansion_button_container"
- layout="@layout/edit_expansion_button"
+ android:id="@+id/expansion_view_container"
+ layout="@layout/edit_expansion_view"
android:visibility="gone" />
<include
diff --git a/res/layout/structured_name_editor_view.xml b/res/layout/structured_name_editor_view.xml
index 8820c56..039baa8 100644
--- a/res/layout/structured_name_editor_view.xml
+++ b/res/layout/structured_name_editor_view.xml
@@ -48,8 +48,8 @@
layout="@layout/edit_field_list" />
<include
- android:id="@+id/expansion_button_container"
- layout="@layout/edit_expansion_button"
+ android:id="@+id/expansion_view_container"
+ layout="@layout/edit_expansion_view"
android:visibility="gone" />
<include
diff --git a/res/layout/text_fields_editor_view.xml b/res/layout/text_fields_editor_view.xml
index f9e6a29..8279ee7 100644
--- a/res/layout/text_fields_editor_view.xml
+++ b/res/layout/text_fields_editor_view.xml
@@ -48,8 +48,8 @@
layout="@layout/edit_field_list" />
<include
- android:id="@+id/expansion_button_container"
- layout="@layout/edit_expansion_button"
+ android:id="@+id/expansion_view_container"
+ layout="@layout/edit_expansion_view"
android:visibility="gone" />
<include
diff --git a/src/com/android/contacts/detail/ContactDetailFragment.java b/src/com/android/contacts/detail/ContactDetailFragment.java
index 7a74228..dd7b906 100644
--- a/src/com/android/contacts/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/detail/ContactDetailFragment.java
@@ -853,6 +853,7 @@
public TextView footer;
public ImageView presenceIcon;
public ImageView secondaryActionButton;
+ public View secondaryActionButtonContainer;
public View secondaryActionDivider;
}
@@ -882,7 +883,10 @@
viewCache.presenceIcon = (ImageView) v.findViewById(R.id.presence_icon);
viewCache.secondaryActionButton = (ImageView) v.findViewById(
R.id.secondary_action_button);
- viewCache.secondaryActionButton.setOnClickListener(mSecondaryActionClickListener);
+ viewCache.secondaryActionButtonContainer = v.findViewById(
+ R.id.secondary_action_button_container);
+ viewCache.secondaryActionButtonContainer.setOnClickListener(
+ mSecondaryActionClickListener);
viewCache.secondaryActionDivider = v.findViewById(R.id.divider);
v.setTag(viewCache);
}
@@ -964,11 +968,11 @@
if (entry.secondaryIntent != null && secondaryActionIcon != null) {
secondaryActionView.setImageDrawable(secondaryActionIcon);
- secondaryActionView.setTag(entry);
- secondaryActionView.setVisibility(View.VISIBLE);
+ views.secondaryActionButtonContainer.setTag(entry);
+ views.secondaryActionButtonContainer.setVisibility(View.VISIBLE);
views.secondaryActionDivider.setVisibility(View.VISIBLE);
} else {
- secondaryActionView.setVisibility(View.GONE);
+ views.secondaryActionButtonContainer.setVisibility(View.GONE);
views.secondaryActionDivider.setVisibility(View.GONE);
}
}
diff --git a/src/com/android/contacts/editor/LabeledEditorView.java b/src/com/android/contacts/editor/LabeledEditorView.java
index db80580..011804c 100644
--- a/src/com/android/contacts/editor/LabeledEditorView.java
+++ b/src/com/android/contacts/editor/LabeledEditorView.java
@@ -43,7 +43,7 @@
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
-import android.widget.ImageButton;
+import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
@@ -66,7 +66,7 @@
private Spinner mLabel;
private EditTypeAdapter mEditTypeAdapter;
private View mDeleteContainer;
- private ImageButton mDelete;
+ private ImageView mDelete;
private DataKind mKind;
private ValuesDelta mEntry;
@@ -128,9 +128,9 @@
mLabel = (Spinner) findViewById(R.id.spinner);
mLabel.setOnItemSelectedListener(mSpinnerListener);
+ mDelete = (ImageView) findViewById(R.id.delete_button);
mDeleteContainer = findViewById(R.id.delete_button_container);
- mDelete = (ImageButton) findViewById(R.id.delete_button);
- mDelete.setOnClickListener(new OnClickListener() {
+ mDeleteContainer.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// defer removal of this button so that the pressed state is visible shortly
@@ -218,7 +218,7 @@
return mLabel;
}
- public ImageButton getDelete() {
+ public ImageView getDelete() {
return mDelete;
}
diff --git a/src/com/android/contacts/editor/TextFieldsEditorView.java b/src/com/android/contacts/editor/TextFieldsEditorView.java
index 9b93700..1ca0c4f 100644
--- a/src/com/android/contacts/editor/TextFieldsEditorView.java
+++ b/src/com/android/contacts/editor/TextFieldsEditorView.java
@@ -38,7 +38,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
-import android.widget.ImageButton;
+import android.widget.ImageView;
import android.widget.LinearLayout;
/**
@@ -49,8 +49,8 @@
public class TextFieldsEditorView extends LabeledEditorView {
private EditText[] mFieldEditTexts = null;
private ViewGroup mFields = null;
- private View mExpansionButtonContainer;
- private ImageButton mExpansionButton;
+ private View mExpansionViewContainer;
+ private ImageView mExpansionView;
private boolean mHideOptional = true;
private boolean mHasShortAndLongForms;
private int mEditorTextSize;
@@ -77,9 +77,9 @@
mEditorTextSize = getResources().getDimensionPixelSize(R.dimen.editor_field_text_size);
mFields = (ViewGroup) findViewById(R.id.editors);
- mExpansionButtonContainer = findViewById(R.id.expansion_button_container);
- mExpansionButton = (ImageButton) findViewById(R.id.expansion_button);
- mExpansionButton.setOnClickListener(new OnClickListener() {
+ mExpansionView = (ImageView) findViewById(R.id.expansion_view);
+ mExpansionViewContainer = findViewById(R.id.expansion_view_container);
+ mExpansionViewContainer.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Save focus
@@ -115,20 +115,20 @@
mFieldEditTexts[index].setEnabled(!isReadOnly() && enabled);
}
}
- mExpansionButton.setEnabled(!isReadOnly() && enabled);
+ mExpansionView.setEnabled(!isReadOnly() && enabled);
}
/**
* Creates or removes the type/label button. Doesn't do anything if already correctly configured
*/
- private void setupMoreOrLessButton(boolean shouldExist, boolean collapsed) {
+ private void setupExpansionView(boolean shouldExist, boolean collapsed) {
if (shouldExist) {
- mExpansionButtonContainer.setVisibility(View.VISIBLE);
- mExpansionButton.setImageResource(collapsed
+ mExpansionViewContainer.setVisibility(View.VISIBLE);
+ mExpansionView.setImageResource(collapsed
? R.drawable.ic_menu_expander_minimized_holo_light
: R.drawable.ic_menu_expander_maximized_holo_light);
} else {
- mExpansionButtonContainer.setVisibility(View.GONE);
+ mExpansionViewContainer.setVisibility(View.GONE);
}
}
@@ -230,8 +230,8 @@
}
// When hiding fields, place expandable
- setupMoreOrLessButton(hidePossible, mHideOptional);
- mExpansionButton.setEnabled(!readOnly && isEnabled());
+ setupExpansionView(hidePossible, mHideOptional);
+ mExpansionView.setEnabled(!readOnly && isEnabled());
}
@Override