am 50655afc: Adds getTypeLabel to ContactsContract Event
* commit '50655afc0d536f0bc87432116fded36d439da099':
Adds getTypeLabel to ContactsContract Event
diff --git a/api/current.txt b/api/current.txt
index d482260..37f83a6 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -24343,6 +24343,7 @@
}
public static final class ContactsContract.CommonDataKinds.Event implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+ method public static final java.lang.CharSequence getTypeLabel(android.content.res.Resources, int, java.lang.CharSequence);
method public static int getTypeResource(java.lang.Integer);
field public static final java.lang.String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_event";
field public static final java.lang.String START_DATE = "data1";
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index d0dbd96..762e1ee 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -6802,6 +6802,21 @@
default: return com.android.internal.R.string.eventTypeCustom;
}
}
+
+ /**
+ * Return a {@link CharSequence} that best describes the given type,
+ * possibly substituting the given {@link #LABEL} value
+ * for {@link #TYPE_CUSTOM}.
+ */
+ public static final CharSequence getTypeLabel(Resources res, int type,
+ CharSequence label) {
+ if (type == TYPE_CUSTOM && !TextUtils.isEmpty(label)) {
+ return label;
+ } else {
+ final int labelRes = getTypeResource(type);
+ return res.getText(labelRes);
+ }
+ }
}
/**