Add placeholder button for showing fully expanded contact editor
Bug 19124091
Change-Id: I8051b8df460fd0bbc30466d736c7606caaa0837c
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