Add placeholder button for showing fully expanded contact editor
Bug 19124091
Change-Id: I8051b8df460fd0bbc30466d736c7606caaa0837c
diff --git a/res/layout/compact_contact_editor_fragment.xml b/res/layout/compact_contact_editor_fragment.xml
index 58f426b..6eb32a7 100644
--- a/res/layout/compact_contact_editor_fragment.xml
+++ b/res/layout/compact_contact_editor_fragment.xml
@@ -65,6 +65,37 @@
android:layout_height="wrap_content"
android:orientation="vertical"/>
+ <LinearLayout
+ style="@style/SelectableItem"
+ android:id="@+id/more_fields"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical" >
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/divider_line_height"
+ android:background="@color/divider_line_color_light" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingEnd="@dimen/expanding_entry_card_item_image_spacing"
+ android:gravity="center_vertical"
+ android:paddingBottom="@dimen/expanding_entry_card_button_padding_vertical"
+ android:paddingTop="@dimen/expanding_entry_card_button_padding_vertical"
+ android:text="@string/compact_editor_more_fields"
+ android:textAlignment="textEnd"
+ android:textColor="@color/expanding_entry_card_button_text_color"
+ android:textSize="@dimen/expanding_entry_card_title_text_size" />
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/divider_line_height"
+ android:background="@color/divider_line_color_light" />
+
+ </LinearLayout>
+
</com.android.contacts.editor.CompactRawContactsEditorView>
</ScrollView>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1324317..30a6525 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -734,4 +734,7 @@
<!-- When a user tries to create an IM Hangouts field, an alert dialog pops up displaying this message. We don't want users entering email addresses of phone numbers into the IM field. [CHAR LIMIT=200] -->
<string name="contact_editor_hangouts_im_alert">Hangouts works better when you enter the person\'s Hangouts identifier into the email field or phone field.</string>
+
+ <!-- Button to expand the compact contact editor to show all available input fields. [CHAR LIMIT=60] -->
+ <string name="compact_editor_more_fields">More Fields</string>
</resources>
diff --git a/src/com/android/contacts/editor/CompactContactEditorFragment.java b/src/com/android/contacts/editor/CompactContactEditorFragment.java
index 8294365..425f7ce 100644
--- a/src/com/android/contacts/editor/CompactContactEditorFragment.java
+++ b/src/com/android/contacts/editor/CompactContactEditorFragment.java
@@ -28,11 +28,13 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
+import android.widget.Toast;
/**
* Contact editor with only the most important fields displayed initially.
*/
-public class CompactContactEditorFragment extends ContactEditorBaseFragment {
+public class CompactContactEditorFragment extends ContactEditorBaseFragment implements
+ CompactRawContactsEditorView.Listener {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
@@ -59,6 +61,7 @@
}
CompactRawContactsEditorView editorView = (CompactRawContactsEditorView) mContent;
+ editorView.setListener(this);
editorView.setState(mState, mViewIdGenerator);
editorView.setEnabled(isEnabled());
editorView.setVisibility(View.VISIBLE);
@@ -114,4 +117,9 @@
CompactContactEditorActivity.ACTION_JOIN_COMPLETED);
mContext.startService(intent);
}
+
+ @Override
+ public void onExpandEditor() {
+ Toast.makeText(mContext, "Not yet implemented", Toast.LENGTH_SHORT).show();
+ }
}
diff --git a/src/com/android/contacts/editor/CompactRawContactsEditorView.java b/src/com/android/contacts/editor/CompactRawContactsEditorView.java
index d8dea60..363fe8b 100644
--- a/src/com/android/contacts/editor/CompactRawContactsEditorView.java
+++ b/src/com/android/contacts/editor/CompactRawContactsEditorView.java
@@ -48,10 +48,23 @@
* View to display information from multiple {@link RawContactDelta}s grouped together
* (e.g. all the phone numbers from a {@link com.android.contacts.common.model.Contact} together.
*/
-public class CompactRawContactsEditorView extends LinearLayout {
+public class CompactRawContactsEditorView extends LinearLayout implements View.OnClickListener {
private static final String TAG = "CompactEditorView";
+ /**
+ * Callbacks for hosts of {@link CompactRawContactsEditorView}s.
+ */
+ public interface Listener {
+
+ /**
+ * Invoked when the compact editor should be expanded to show all fields.
+ */
+ public void onExpandEditor();
+ }
+
+ private Listener mListener;
+
private AccountTypeManager mAccountTypeManager;
private LayoutInflater mLayoutInflater;
private ViewIdGenerator mViewIdGenerator;
@@ -62,6 +75,7 @@
private ViewGroup mPhoneNumbers;
private ViewGroup mEmails;
private ViewGroup mOther;
+ private View mMoreFields;
public CompactRawContactsEditorView(Context context) {
super(context);
@@ -71,6 +85,13 @@
super(context, attrs);
}
+ /**
+ * Sets the receiver for {@link CompactRawContactsEditorView} callbacks.
+ */
+ public void setListener(Listener listener) {
+ mListener = listener;
+ }
+
@Override
protected void onFinishInflate() {
super.onFinishInflate();
@@ -85,6 +106,16 @@
mPhoneNumbers = (LinearLayout) findViewById(R.id.phone_numbers);
mEmails = (LinearLayout) findViewById(R.id.emails);
mOther = (LinearLayout) findViewById(R.id.other);
+ mMoreFields = findViewById(R.id.more_fields);
+ mMoreFields.setOnClickListener(this);
+ }
+
+
+ @Override
+ public void onClick(View view) {
+ if (view.getId() == R.id.more_fields && mListener != null ) {
+ mListener.onExpandEditor();
+ }
}
@Override