Navigation Menu

Skip to content

Commit

Permalink
Use locale ID + rewrites names for shortcut label
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaljurand committed Sep 27, 2020
1 parent 1089ddb commit 836bb04
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Expand Up @@ -26,8 +26,8 @@ android {
applicationId 'ee.ioc.phon.android.speak'
minSdkVersion 16
targetSdkVersion 30
versionCode 1740
versionName '1.7.40'
versionCode 1741
versionName '1.7.41'
vectorDrawables.useSupportLibrary = true
// Keep only en and et resources
resConfigs "en", "et"
Expand Down
Expand Up @@ -32,7 +32,7 @@ public Combo(Context context, String id) {
mComponentName = pair.first;
mLocaleAsStr = pair.second;
mServiceLabel = RecognitionServiceManager.getServiceLabel(context, mComponentName);
mLocaleShortLabel = RecognitionServiceManager.getDisplayLanguage(mLocaleAsStr);
mLocaleShortLabel = mLocaleAsStr;
mLocaleLongLabel = RecognitionServiceManager.makeLangLabel(mLocaleAsStr);
mFormatLabelComboItem = context.getString(R.string.labelComboItem);
mAsString = String.format(context.getString(R.string.labelComboListItem), mServiceLabel, mLocaleLongLabel);
Expand Down
10 changes: 7 additions & 3 deletions app/src/main/java/ee/ioc/phon/android/speak/utils/Utils.java
Expand Up @@ -141,7 +141,7 @@ public static AlertDialog getYesNoDialog(Context context, String confirmationMes

public static AlertDialog getTextEntryDialog(Context context, String title, String initialText, final ExecutableString ex) {
final View textEntryView = LayoutInflater.from(context).inflate(R.layout.alert_dialog_url_entry, null);
final EditText et = (EditText) textEntryView.findViewById(R.id.url_edit);
final EditText et = textEntryView.findViewById(R.id.url_edit);
if (initialText != null) {
et.setText(initialText);
et.setSelection(initialText.length());
Expand Down Expand Up @@ -299,6 +299,10 @@ public static void publishShortcuts(Context context, List<Combo> selectedCombos,
String[] names = rewriteTables.toArray(new String[rewriteTables.size()]);
Arrays.sort(names);
String rewritesId = TextUtils.join(", ", names);
String rewritesIdSuffix = "";
if (!rewritesId.isEmpty()) {
rewritesIdSuffix = "; " + rewritesId;
}

for (Combo combo : selectedCombos) {
Intent intent = new Intent(context, SpeechActionActivity.class);
Expand All @@ -314,8 +318,8 @@ public static void publishShortcuts(Context context, List<Combo> selectedCombos,
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
shortcuts.add(new ShortcutInfo.Builder(context, combo.getId() + rewritesId)
.setIntent(intent)
.setShortLabel(combo.getShortLabel())
.setLongLabel(combo.getLongLabel() + "; " + rewritesId)
.setShortLabel(combo.getShortLabel() + rewritesIdSuffix)
.setLongLabel(combo.getLongLabel() + rewritesIdSuffix)
.setIcon(Icon.createWithBitmap(drawableToBitmap(combo.getIcon(context))))
.build());
counter++;
Expand Down
2 changes: 1 addition & 1 deletion speechutils

0 comments on commit 836bb04

Please sign in to comment.