diff --git a/android/KMEA/app/src/main/java/com/tavultesoft/kmea/LanguageSettingsActivity.java b/android/KMEA/app/src/main/java/com/tavultesoft/kmea/LanguageSettingsActivity.java index b7d9002498..bd021f5484 100644 --- a/android/KMEA/app/src/main/java/com/tavultesoft/kmea/LanguageSettingsActivity.java +++ b/android/KMEA/app/src/main/java/com/tavultesoft/kmea/LanguageSettingsActivity.java @@ -40,6 +40,7 @@ public final class LanguageSettingsActivity extends AppCompatActivity { private Context context; private static Toolbar toolbar = null; private static ListView listView = null; + private static TextView lexicalModelTextView = null; private ImageButton addButton = null; private String associatedLexicalModel = ""; private String lgCode; @@ -77,7 +78,6 @@ public final class LanguageSettingsActivity extends AppCompatActivity { } } - associatedLexicalModel = bundle.getString(KMManager.KMKey_LexicalModelName, ""); lgCode = bundle.getString(KMManager.KMKey_LanguageID); lgName = bundle.getString(KMManager.KMKey_LanguageName); @@ -98,11 +98,11 @@ public final class LanguageSettingsActivity extends AppCompatActivity { layout = (RelativeLayout)findViewById(R.id.model_picker); textView = (TextView) layout.findViewById(R.id.text1); textView.setText(getString(R.string.model)); - if (!associatedLexicalModel.isEmpty()) { - textView = (TextView) layout.findViewById(R.id.text2); - textView.setText(associatedLexicalModel); - textView.setEnabled(true); - } + + lexicalModelTextView = layout.findViewById(R.id.text2); + + updateActiveLexicalModel(); + ImageView imageView = (ImageView) layout.findViewById(R.id.image1); imageView.setImageResource(R.drawable.ic_arrow_forward); layout.setEnabled(true); @@ -198,6 +198,19 @@ public final class LanguageSettingsActivity extends AppCompatActivity { // need a manual call here for things to happen in a timely fashion. adapter.notifyDataSetChanged(); } + + updateActiveLexicalModel(); + } + + public void updateActiveLexicalModel() { + associatedLexicalModel = KMManager.getAssociatedLexicalModel(lgCode).get(KMManager.KMKey_LexicalModelName); + if (!associatedLexicalModel.isEmpty()) { + lexicalModelTextView.setText(associatedLexicalModel); + lexicalModelTextView.setEnabled(true); + } else { + lexicalModelTextView.setText(""); + lexicalModelTextView.setEnabled(false); + } } @Override diff --git a/android/KMEA/app/src/main/java/com/tavultesoft/kmea/data/CloudRepository.java b/android/KMEA/app/src/main/java/com/tavultesoft/kmea/data/CloudRepository.java index 6097d57998..e5520bd2c9 100644 --- a/android/KMEA/app/src/main/java/com/tavultesoft/kmea/data/CloudRepository.java +++ b/android/KMEA/app/src/main/java/com/tavultesoft/kmea/data/CloudRepository.java @@ -421,7 +421,8 @@ public class CloudRepository { // Determine package ID from packageFilename modelURL = model.optString("packageFilename", ""); packageID = FileUtils.getFilename(modelURL); - packageID = packageID.replace(".model.kmp", ""); + // Android keeps the .model part of the file extension as part of the package ID. + packageID = packageID.replace(".kmp", ""); } // api.keyman.com query returns an array of language IDs Strings while