summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWalter Jang <wjang@google.com>2015-07-07 16:10:41 -0700
committerWalter Jang <wjang@google.com>2015-07-07 16:18:06 -0700
commitae9c9ec49c460d34f7c649c3a3bf684fc5ef262d (patch)
tree90e0dce9cc012c86cff31db9940d1abb82372875 /src
parent995bb4af702a619bda3819daeeaa68c55d9e96bd (diff)
downloadpackages_apps_Contacts-ae9c9ec49c460d34f7c649c3a3bf684fc5ef262d.tar.gz
packages_apps_Contacts-ae9c9ec49c460d34f7c649c3a3bf684fc5ef262d.tar.bz2
packages_apps_Contacts-ae9c9ec49c460d34f7c649c3a3bf684fc5ef262d.zip
Hide all empty email and phone KindSectionViews expect the last
Bug 22331611 Change-Id: I5c4544ed3cc82982f159f7c1758a1e6cd8868c48
Diffstat (limited to 'src')
-rw-r--r--src/com/android/contacts/editor/CompactRawContactsEditorView.java11
-rw-r--r--src/com/android/contacts/editor/KindSectionView.java10
2 files changed, 20 insertions, 1 deletions
diff --git a/src/com/android/contacts/editor/CompactRawContactsEditorView.java b/src/com/android/contacts/editor/CompactRawContactsEditorView.java
index d1159a469..6b7df6768 100644
--- a/src/com/android/contacts/editor/CompactRawContactsEditorView.java
+++ b/src/com/android/contacts/editor/CompactRawContactsEditorView.java
@@ -666,7 +666,7 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O
final List<ValuesDelta> valuesDeltas = getNonEmptyValuesDeltas(
rawContactDelta, Nickname.CONTENT_ITEM_TYPE, dataKind);
if (valuesDeltas != null && !valuesDeltas.isEmpty()) {
- for (ValuesDelta valuesDelta : valuesDeltas){
+ for (ValuesDelta valuesDelta : valuesDeltas) {
mNicknames.addView(inflateNicknameEditorView(
mNicknames, dataKind, valuesDelta, rawContactDelta));
}
@@ -744,6 +744,15 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O
}
// Only the last editor should show an empty editor
if (lastVisibleKindSectionView != null) {
+ // Hide all empty kind sections except the last one
+ for (int i = 0; i < viewGroup.getChildCount(); i++) {
+ final KindSectionView kindSectionView = (KindSectionView) viewGroup.getChildAt(i);
+ if (kindSectionView != lastVisibleKindSectionView
+ && kindSectionView.areAllEditorsEmpty()) {
+ kindSectionView.setVisibility(View.GONE);
+ }
+ }
+ // Set the last editor to show empty editor fields
lastVisibleKindSectionView.setShowOneEmptyEditor(true);
lastVisibleKindSectionView.updateEmptyEditors(/* shouldAnimate =*/ false);
}
diff --git a/src/com/android/contacts/editor/KindSectionView.java b/src/com/android/contacts/editor/KindSectionView.java
index bf456d5ff..5837ab1aa 100644
--- a/src/com/android/contacts/editor/KindSectionView.java
+++ b/src/com/android/contacts/editor/KindSectionView.java
@@ -326,6 +326,16 @@ public class KindSectionView extends LinearLayout implements EditorListener {
return emptyEditorViews;
}
+ public boolean areAllEditorsEmpty() {
+ for (int i = 0; i < mEditors.getChildCount(); i++) {
+ final View view = mEditors.getChildAt(i);
+ if (!((Editor) view).isEmpty()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
public int getEditorCount() {
return mEditors.getChildCount();
}