Simplify IM types to be consistent with Exchange
Bug:2473310
Change-Id: I79dfd5d919504d434f5ba3629c92c53226c8ea24
diff --git a/src/com/android/contacts/model/ExchangeAccountType.java b/src/com/android/contacts/model/ExchangeAccountType.java
index c3b48c4..7aa6ace 100644
--- a/src/com/android/contacts/model/ExchangeAccountType.java
+++ b/src/com/android/contacts/model/ExchangeAccountType.java
@@ -218,27 +218,12 @@
final DataKind kind = super.inflateIm(context, BaseAccountType.LEVEL_MIMETYPES);
if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
+ // Types are not supported for IM. There can be 3 IMs, but OWA only shows only the first
kind.typeOverallMax = 3;
- // NOTE: even though a traditional "type" exists, for editing
- // purposes we're using the protocol to pick labels
-
kind.defaultValues = new ContentValues();
kind.defaultValues.put(Im.TYPE, Im.TYPE_OTHER);
- kind.typeColumn = Im.PROTOCOL;
- kind.typeList = Lists.newArrayList();
- kind.typeList.add(buildImType(Im.PROTOCOL_AIM));
- kind.typeList.add(buildImType(Im.PROTOCOL_MSN));
- kind.typeList.add(buildImType(Im.PROTOCOL_YAHOO));
- kind.typeList.add(buildImType(Im.PROTOCOL_SKYPE));
- kind.typeList.add(buildImType(Im.PROTOCOL_QQ));
- kind.typeList.add(buildImType(Im.PROTOCOL_GOOGLE_TALK));
- kind.typeList.add(buildImType(Im.PROTOCOL_ICQ));
- kind.typeList.add(buildImType(Im.PROTOCOL_JABBER));
- kind.typeList.add(buildImType(Im.PROTOCOL_CUSTOM).setSecondary(true).setCustomColumn(
- Im.CUSTOM_PROTOCOL));
-
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(Im.DATA, R.string.imLabelsGroup, FLAGS_EMAIL));
}
diff --git a/src/com/android/contacts/views/editor/KindSectionView.java b/src/com/android/contacts/views/editor/KindSectionView.java
index 814ce8c..c2773e4 100644
--- a/src/com/android/contacts/views/editor/KindSectionView.java
+++ b/src/com/android/contacts/views/editor/KindSectionView.java
@@ -89,7 +89,7 @@
/** {@inheritDoc} */
@Override
public void onDeleted(Editor editor) {
- updateAddEnabled();
+ updateAddVisible();
updateVisible();
}
@@ -113,11 +113,8 @@
: getResources().getString(kind.titleRes);
mTitle.setText(mTitleString.toUpperCase());
- // Only show the add button if this is a list
- mAddPlusButton.setVisibility(mKind.isList ? View.VISIBLE : View.INVISIBLE);
-
rebuildFromState();
- updateAddEnabled();
+ updateAddVisible();
updateVisible();
}
@@ -195,11 +192,16 @@
}
- protected void updateAddEnabled() {
- // Set enabled state on the "add" view
- final boolean canInsert = EntityModifier.canInsert(mState, mKind);
- final boolean isEnabled = !mReadOnly && canInsert;
- mAddPlusButton.setEnabled(isEnabled);
+ protected void updateAddVisible() {
+ final boolean isVisible;
+ if (!mKind.isList) {
+ isVisible = false;
+ } else {
+ // Set enabled state on the "add" view
+ final boolean canInsert = EntityModifier.canInsert(mState, mKind);
+ isVisible = !mReadOnly && canInsert;
+ }
+ mAddPlusButton.setVisibility(isVisible ? View.VISIBLE : View.INVISIBLE);
}
public void addItem() {
@@ -214,7 +216,7 @@
// For non-lists (e.g. Notes we can only have one field. in that case we need to disable
// the add button
- updateAddEnabled();
+ updateAddVisible();
// Ensure we are visible
updateVisible();