Contacts: added source account name to view/edit activity.
Internal Bug: 2129158
diff --git a/res/drawable/section_dark.9.png b/res/drawable/section_dark.9.png
new file mode 100644
index 0000000..5d1e1ae
--- /dev/null
+++ b/res/drawable/section_dark.9.png
Binary files differ
diff --git a/res/layout-finger/contact_card_layout.xml b/res/layout-finger/contact_card_layout.xml
index 3f090f5..fe931ec 100644
--- a/res/layout-finger/contact_card_layout.xml
+++ b/res/layout-finger/contact_card_layout.xml
@@ -36,6 +36,16 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
+ <TextView android:id="@+id/account_name"
+ style="?android:attr/listSeparatorTextViewStyle"
+ android:textColor="@*android:color/dim_foreground_dark"
+ android:textSize="12sp"
+ android:textStyle="normal"
+ android:background="@drawable/section_dark"
+ android:paddingLeft="7dp"
+ android:gravity="left|center_vertical"
+ android:visibility="gone" />
+
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0dip"
diff --git a/res/layout/act_edit.xml b/res/layout/act_edit.xml
index 250a0e1..47f1454 100644
--- a/res/layout/act_edit.xml
+++ b/res/layout/act_edit.xml
@@ -37,6 +37,16 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
+ <TextView android:id="@+id/account_name"
+ style="?android:attr/listSeparatorTextViewStyle"
+ android:textColor="@*android:color/dim_foreground_dark"
+ android:textSize="12sp"
+ android:textStyle="normal"
+ android:background="@drawable/section_dark"
+ android:paddingLeft="7dp"
+ android:gravity="left|center_vertical"
+ android:visibility="gone" />
+
<include
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 77659ad..316792d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1138,5 +1138,8 @@
<string name="split_label">Split</string>
<!-- The explanation of what "split" will do. This needs word-smithing. -->
<string name="split_explanation">Make this data its own contact.</string>
+
+ <!-- Formatting string for account name -->
+ <string name="account_name_format">From account: <xliff:g id="account" example="user@gmail.com">%s</xliff:g></string>
</resources>
diff --git a/src/com/android/contacts/ViewContactActivity.java b/src/com/android/contacts/ViewContactActivity.java
index 5233619..921d5a7 100644
--- a/src/com/android/contacts/ViewContactActivity.java
+++ b/src/com/android/contacts/ViewContactActivity.java
@@ -74,13 +74,11 @@
import android.view.Window;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
import android.view.animation.TranslateAnimation;
import android.view.animation.Animation.AnimationListener;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ImageView;
-import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
@@ -137,6 +135,7 @@
protected ScrollingTabWidget mTabWidget;
protected ContactHeaderWidget mContactHeaderWidget;
protected View mBelowHeader;
+ protected TextView mAccountName;
protected View mBufferView;
private NotifyingAsyncQueryHandler mHandler;
@@ -218,6 +217,7 @@
mTabsVisible = false;
mBelowHeader = findViewById(R.id.below_header);
+ mAccountName = (TextView) findViewById(R.id.account_name);
mTabRawContactIdMap = new SparseArray<Long>();
@@ -941,6 +941,14 @@
continue;
}
+ if (mTabsVisible) {
+ final String accountName = entValues.getAsString(RawContacts.ACCOUNT_NAME);
+ mAccountName.setText(getString(R.string.account_name_format, accountName));
+ mAccountName.setVisibility(View.VISIBLE);
+ } else {
+ mAccountName.setVisibility(View.GONE);
+ }
+
for (NamedContentValues subValue : entity.getSubValues()) {
ViewEntry entry = new ViewEntry();
diff --git a/src/com/android/contacts/ui/EditContactActivity.java b/src/com/android/contacts/ui/EditContactActivity.java
index 51b10c5..bb10a8a 100644
--- a/src/com/android/contacts/ui/EditContactActivity.java
+++ b/src/com/android/contacts/ui/EditContactActivity.java
@@ -97,6 +97,7 @@
private ScrollingTabWidget mTabWidget;
private ContactHeaderWidget mHeader;
+ private TextView mAccountName;
private ContactEditorView mEditor;
@@ -125,6 +126,7 @@
mTabWidget = (ScrollingTabWidget)this.findViewById(R.id.tab_widget);
mTabWidget.setTabSelectionListener(this);
+ mAccountName = (TextView)this.findViewById(R.id.account_name);
// Build editor and listen for photo requests
mEditor = (ContactEditorView)this.findViewById(android.R.id.tabcontent);
@@ -394,10 +396,15 @@
if (entity == null) return;
final Sources sources = Sources.getInstance(this);
- final String accountType = entity.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
+ final ValuesDelta values = entity.getValues();
+ final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE);
+ final String accountName = values.getAsString(RawContacts.ACCOUNT_NAME);
final ContactsSource source = sources.getInflatedSource(accountType,
ContactsSource.LEVEL_CONSTRAINTS);
+ mAccountName.setText(getString(R.string.account_name_format, accountName));
+ mAccountName.setVisibility(View.VISIBLE);
+
// Assign editor state based on entity and source
mEditor.setState(entity, source);
}