mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-28 02:27:41 +00:00
feat(android): Allow uninstall of sil_euro_latin keyboard
This commit is contained in:
parent
b99d196609
commit
2113bebcf7
4 changed files with 9 additions and 12 deletions
|
|
@ -32,6 +32,7 @@ import com.tavultesoft.kmea.KMHelpFileActivity;
|
|||
import com.tavultesoft.kmea.KMManager;
|
||||
import com.tavultesoft.kmea.KMKeyboardDownloaderActivity;
|
||||
import com.tavultesoft.kmea.data.Keyboard;
|
||||
import com.tavultesoft.kmea.data.KeyboardController;
|
||||
import com.tavultesoft.kmea.util.FileUtils;
|
||||
import com.tavultesoft.kmea.util.FileProviderUtils;
|
||||
import com.tavultesoft.kmea.util.KMLog;
|
||||
|
|
@ -113,9 +114,8 @@ public final class KeyboardSettingsActivity extends AppCompatActivity {
|
|||
hashMap.put(iconKey, icon);
|
||||
infoList.add(hashMap);
|
||||
|
||||
// If not default keyboard, display uninstall keyboard
|
||||
if (!(kbID.equalsIgnoreCase(KMManager.KMDefault_KeyboardID) &&
|
||||
languageID.equalsIgnoreCase(KMManager.KMDefault_LanguageID))) {
|
||||
// As long as more than 1 keyboard installed, display uninstall keyboard
|
||||
if (KeyboardController.getInstance().get().size() > 1 && KMManager.canRemoveKeyboard()) {
|
||||
hashMap = new HashMap<>();
|
||||
hashMap.put(titleKey, getString(R.string.uninstall_keyboard));
|
||||
hashMap.put(subtitleKey, "");
|
||||
|
|
|
|||
|
|
@ -136,8 +136,8 @@ public final class KeyboardPickerActivity extends BaseActivity {
|
|||
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
|
||||
// Prevent the default keyboard from being removed
|
||||
if (position > 0 && canRemoveKeyboard) {
|
||||
// As long as more than 1 keyboard installed, display uninstall keyboard
|
||||
if (KeyboardController.getInstance().get().size() > 1 && canRemoveKeyboard) {
|
||||
PopupMenu popup = new PopupMenu(context, view);
|
||||
popup.getMenuInflater().inflate(R.menu.popup, popup.getMenu());
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
|
|
@ -370,11 +370,8 @@ public final class KeyboardPickerActivity extends BaseActivity {
|
|||
protected static boolean removeKeyboard(Context context, int position) {
|
||||
boolean result = false;
|
||||
|
||||
// Prevent the first keyboard (index 0) from being removed
|
||||
if (position > 0) {
|
||||
KeyboardController.getInstance().remove(position);
|
||||
result = KeyboardController.getInstance().save(context);
|
||||
}
|
||||
KeyboardController.getInstance().remove(position);
|
||||
result = KeyboardController.getInstance().save(context);
|
||||
|
||||
notifyKeyboardsUpdate(context);
|
||||
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ public class KeyboardController {
|
|||
* @param index
|
||||
*/
|
||||
public void remove(int index) {
|
||||
// Check initialized, and disallow removing default keyboard
|
||||
// Check initialized
|
||||
if (!isInitialized) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ Step 5)
|
|||
The bottom of the keyboard settings menu displays an option to uninstall the keyboard.
|
||||
Select 'Uninstall keyboard' to get a prompt to delete the keyboard.
|
||||
|
||||
**Note:** The default 'SIL EuroLatin' keyboard for English cannot be removed.
|
||||
**Note:** Two or more keyboards need to be installed in order to display this option of uninstalling a keyboard.
|
||||
|
||||

|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue