@@ -21,6 +21,7 @@ public class Combo {
21
21
private final ComponentName mComponentName ;
22
22
private final String mLocaleLongLabel ;
23
23
private final String mLocaleAsStr ;
24
+ private final String mTinyLabel ;
24
25
private final String mShortLabel ;
25
26
private final String mLongLabel ;
26
27
private boolean mIsSelected ;
@@ -31,18 +32,22 @@ public Combo(Context context, String id) {
31
32
mId = id ;
32
33
mComponentName = pair .first ;
33
34
mLocaleAsStr = pair .second ;
34
- mServiceLabel = RecognitionServiceManager .getServiceLabel (context , mComponentName );
35
+ String serviceLabel = RecognitionServiceManager .getServiceLabel (context , mComponentName );
36
+ // Present the service by its short class name, if it does not have a label.
37
+ mServiceLabel = serviceLabel .isEmpty () ? mComponentName .getShortClassName () : serviceLabel ;
35
38
if (mLocaleAsStr .isEmpty () || "und" .equals (mLocaleAsStr )) {
36
39
mLocaleLongLabel = "" ;
37
40
mAsString = String .format (context .getString (R .string .labelComboListItemWithoutLocale ), mServiceLabel );
38
41
mShortLabel = mServiceLabel ;
39
42
mLongLabel = mServiceLabel ;
43
+ mTinyLabel = mServiceLabel .length () < 3 ? mServiceLabel : mServiceLabel .substring (0 , 3 );
40
44
} else {
41
45
mLocaleLongLabel = RecognitionServiceManager .makeLangLabel (mLocaleAsStr );
42
46
mAsString = String .format (context .getString (R .string .labelComboListItem ), mServiceLabel , mLocaleLongLabel );
43
47
String mFormatLabelComboItem = context .getString (R .string .labelComboItem );
44
48
mShortLabel = String .format (mFormatLabelComboItem , mServiceLabel , mLocaleAsStr );
45
49
mLongLabel = String .format (mFormatLabelComboItem , mServiceLabel , mLocaleLongLabel );
50
+ mTinyLabel = mLocaleAsStr ;
46
51
}
47
52
}
48
53
@@ -66,6 +71,10 @@ public String getLanguage() {
66
71
return mLocaleLongLabel ;
67
72
}
68
73
74
+ public String getTinyLabel () {
75
+ return mTinyLabel ;
76
+ }
77
+
69
78
public String getShortLabel () {
70
79
return mShortLabel ;
71
80
}
0 commit comments