Merge "Turned the "copy local" command into a button under the contact detail view"
diff --git a/res/drawable-hdpi/ic_menu_copy_contact.png b/res/drawable-hdpi/ic_menu_copy_contact.png
deleted file mode 100644
index e6be48b..0000000
--- a/res/drawable-hdpi/ic_menu_copy_contact.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_menu_copy_contact.png b/res/drawable-mdpi/ic_menu_copy_contact.png
deleted file mode 100644
index 750db62..0000000
--- a/res/drawable-mdpi/ic_menu_copy_contact.png
+++ /dev/null
Binary files differ
diff --git a/res/layout-xlarge/contact_detail_fragment.xml b/res/layout-xlarge/contact_detail_fragment.xml
index 66c7eed..034d1ce 100644
--- a/res/layout-xlarge/contact_detail_fragment.xml
+++ b/res/layout-xlarge/contact_detail_fragment.xml
@@ -14,68 +14,76 @@
limitations under the License.
-->
-<FrameLayout
+<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
+ android:id="@+id/contact_detail"
+ android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/panel_message">
- <LinearLayout
- android:id="@+id/contact_detail"
- android:orientation="vertical"
+
+ <!-- Header View (including social status) -->
+ <com.android.contacts.widget.InterpolatingLayout
android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <!-- Header View (including social status) -->
- <com.android.contacts.widget.InterpolatingLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
- <com.android.contacts.views.detail.ContactDetailHeaderView
- android:id="@+id/contact_header_widget"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- ex:layout_wideParentWidth="800dip"
- ex:layout_wideLeftMargin="80dip"
- ex:layout_narrowParentWidth="500dip"
- ex:layout_narrowLeftMargin="15dip"
- />
- </com.android.contacts.widget.InterpolatingLayout>
-
- <!-- Placeholder for empty list -->
- <com.android.contacts.widget.InterpolatingLayout
- android:id="@android:id/empty"
+ android:layout_height="wrap_content">
+ <com.android.contacts.views.detail.ContactDetailHeaderView
+ android:id="@+id/contact_header_widget"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:visibility="gone">
- <TextView android:id="@+id/emptyText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/no_contact_details"
- android:textSize="20sp"
- android:textColor="?android:attr/textColorSecondary"
- ex:layout_wideParentWidth="800dip"
- ex:layout_wideLeftMargin="144dip"
- ex:layout_narrowParentWidth="500dip"
- ex:layout_narrowLeftMargin="42dip"
- android:paddingTop="10dip"
- android:lineSpacingMultiplier="0.92"
- />
- </com.android.contacts.widget.InterpolatingLayout>
+ ex:layout_wideParentWidth="800dip"
+ ex:layout_wideLeftMargin="80dip"
+ ex:layout_narrowParentWidth="500dip"
+ ex:layout_narrowLeftMargin="15dip"
+ />
+ </com.android.contacts.widget.InterpolatingLayout>
- <!-- Real list -->
- <com.android.contacts.widget.InterpolatingLayout
+ <!-- Placeholder for empty list -->
+ <com.android.contacts.widget.InterpolatingLayout
+ android:id="@android:id/empty"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="gone">
+ <TextView android:id="@+id/emptyText"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/no_contact_details"
+ android:textSize="20sp"
+ android:textColor="?android:attr/textColorSecondary"
+ ex:layout_wideParentWidth="800dip"
+ ex:layout_wideLeftMargin="144dip"
+ ex:layout_narrowParentWidth="500dip"
+ ex:layout_narrowLeftMargin="42dip"
+ android:paddingTop="10dip"
+ android:lineSpacingMultiplier="0.92"
+ />
+ </com.android.contacts.widget.InterpolatingLayout>
+
+ <!-- Real list -->
+ <com.android.contacts.widget.InterpolatingLayout
+ android:layout_width="match_parent"
+ android:layout_height="0px"
+ android:layout_weight="1">
+ <ListView android:id="@android:id/list"
android:layout_width="match_parent"
- android:layout_height="0px"
- android:layout_weight="1">
- <ListView android:id="@android:id/list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- ex:layout_wideParentWidth="800dip"
- ex:layout_wideLeftMargin="144dip"
- ex:layout_narrowParentWidth="500dip"
- ex:layout_narrowLeftMargin="42dip"
- android:cacheColorHint="#00000000"
- />
- </com.android.contacts.widget.InterpolatingLayout>
- </LinearLayout>
-</FrameLayout>
\ No newline at end of file
+ android:layout_height="match_parent"
+ ex:layout_wideParentWidth="800dip"
+ ex:layout_wideLeftMargin="144dip"
+ ex:layout_narrowParentWidth="500dip"
+ ex:layout_narrowLeftMargin="42dip"
+ android:cacheColorHint="#00000000"
+ />
+ </com.android.contacts.widget.InterpolatingLayout>
+
+ <!-- "Copy to my contacts"- button -->
+ <Button
+ android:id="@+id/copyLocal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/menu_copyContact"
+ android:visibility="gone"
+ android:layout_gravity="right"
+ android:layout_marginRight="40dip"
+ android:layout_marginTop="20dip"
+ android:layout_marginBottom="20dip" />
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/contact_detail_fragment.xml b/res/layout/contact_detail_fragment.xml
index 180114b..a3ca198 100644
--- a/res/layout/contact_detail_fragment.xml
+++ b/res/layout/contact_detail_fragment.xml
@@ -50,5 +50,17 @@
android:lineSpacingMultiplier="0.92"
/>
</ScrollView>
+
+ <!-- "Copy to my contacts"- button -->
+ <Button
+ android:id="@+id/copyLocal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/menu_copyContact"
+ android:visibility="gone"
+ android:layout_gravity="right"
+ android:layout_marginRight="40dip"
+ android:layout_marginTop="20dip"
+ android:layout_marginBottom="20dip" />
</LinearLayout>
diff --git a/res/menu/view.xml b/res/menu/view.xml
index ea8fe7f..0bd1477 100644
--- a/res/menu/view.xml
+++ b/res/menu/view.xml
@@ -37,9 +37,4 @@
android:id="@+id/menu_delete"
android:icon="@android:drawable/ic_menu_delete"
android:title="@string/menu_deleteContact" />
-
- <item
- android:id="@+id/menu_copy"
- android:icon="@drawable/ic_menu_copy_contact"
- android:title="@string/menu_copyContact" />
</menu>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 98537b6..9cf4398 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1322,7 +1322,7 @@
<string name="visualScrollerAlphabet">A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z</string>
<!-- The menu item (or button) that creates a local copy of a corporate contact. [CHAR LIMIT=40]-->
- <string name="menu_copyContact">Make personal copy</string>
+ <string name="menu_copyContact">Copy to my contacts</string>
<!-- The description of the directory where the contact was found [CHAR LIMIT=100]-->
<string name="contact_directory_description">from <xliff:g id="type" example="Corporate Directory">%1$s</xliff:g></string>
diff --git a/src/com/android/contacts/views/detail/ContactDetailFragment.java b/src/com/android/contacts/views/detail/ContactDetailFragment.java
index 9e5ec95..b456f59 100644
--- a/src/com/android/contacts/views/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/views/detail/ContactDetailFragment.java
@@ -93,6 +93,7 @@
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
+import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@@ -118,6 +119,7 @@
private ViewAdapter mAdapter;
private Uri mPrimaryPhoneUri = null;
+ private Button mCopyGalToLocalButton;
private boolean mAllRestricted;
private final ArrayList<Long> mWritableRawContactIds = new ArrayList<Long>();
private int mNumPhoneNumbers = 0;
@@ -200,6 +202,14 @@
// Don't set it to mListView yet. We do so later when we bind the adapter.
mEmptyView = view.findViewById(android.R.id.empty);
+ mCopyGalToLocalButton = (Button) view.findViewById(R.id.copyLocal);
+ mCopyGalToLocalButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ makePersonalCopy();
+ }
+ });
+
return view;
}
@@ -247,6 +257,19 @@
}
mListView.setEmptyView(mEmptyView);
+ // Configure copy gal button
+ if (mContactData.isDirectoryEntry()) {
+ final int exportSupport = mContactData.getDirectoryExportSupport();
+ if (exportSupport == Directory.EXPORT_SUPPORT_ANY_ACCOUNT
+ || exportSupport == Directory.EXPORT_SUPPORT_SAME_ACCOUNT_ONLY) {
+ mCopyGalToLocalButton.setVisibility(View.VISIBLE);
+ } else {
+ mCopyGalToLocalButton.setVisibility(View.GONE);
+ }
+ } else {
+ mCopyGalToLocalButton.setVisibility(View.GONE);
+ }
+
getActivity().invalidateOptionsMenu();
}
@@ -921,15 +944,6 @@
final MenuItem shareMenu = menu.findItem(R.id.menu_share);
shareMenu.setVisible(!isDirectoryEntry && !mAllRestricted);
-
- final MenuItem copyMenu = menu.findItem(R.id.menu_copy);
- if (isDirectoryEntry) {
- int exportSupport = mContactData.getDirectoryExportSupport();
- copyMenu.setVisible(exportSupport == Directory.EXPORT_SUPPORT_ANY_ACCOUNT
- || exportSupport == Directory.EXPORT_SUPPORT_SAME_ACCOUNT_ONLY);
- } else {
- copyMenu.setVisible(false);
- }
}
@Override
@@ -970,10 +984,6 @@
}
return true;
}
- case R.id.menu_copy: {
- makePersonalCopy();
- return true;
- }
}
return false;
}