use of ee.ioc.phon.android.speechutils.RecognitionServiceManager in project K6nele by Kaljurand.
the class Utils method setUpDefaultCombos.
/**
* If either the search panel or the IME combos have not been selected, then set them based on
* the fallbackServices, using the "und" locale.
* TODO: call this in Panel, IME, and Settings
*/
public static void setUpDefaultCombos(SharedPreferences prefs, Resources res, PackageManager pm) {
Set<String> combos1 = PreferenceUtils.getPrefStringSet(prefs, res, R.string.keyCombo);
Set<String> combos2 = PreferenceUtils.getPrefStringSet(prefs, res, R.string.keyImeCombo);
if (combos1.isEmpty() || combos2.isEmpty()) {
RecognitionServiceManager mngr = new RecognitionServiceManager();
List<String> services = mngr.getServices(pm);
for (String service : res.getStringArray(R.array.fallbackServices)) {
if (services.contains(service)) {
Set<String> combos = Collections.singleton(service + ";und");
if (combos1.isEmpty()) {
PreferenceUtils.putPrefStringSet(prefs, res, R.string.keyCombo, combos);
}
if (combos2.isEmpty()) {
PreferenceUtils.putPrefStringSet(prefs, res, R.string.keyImeCombo, combos);
}
break;
}
}
}
}
Aggregations