diff --git a/catroid/src/main/java/org/catrobat/catroid/formulaeditor/FormulaEditorEditText.java b/catroid/src/main/java/org/catrobat/catroid/formulaeditor/FormulaEditorEditText.java index 199f6b333d5..95456731c43 100644 --- a/catroid/src/main/java/org/catrobat/catroid/formulaeditor/FormulaEditorEditText.java +++ b/catroid/src/main/java/org/catrobat/catroid/formulaeditor/FormulaEditorEditText.java @@ -426,6 +426,9 @@ public FormulaEditorHistory getHistory() { } public boolean isThereSomethingToDelete() { + if (internFormula == null) { + return false; + } return internFormula.isThereSomethingToDelete(); } diff --git a/catroid/src/main/java/org/catrobat/catroid/ui/fragment/FormulaEditorFragment.java b/catroid/src/main/java/org/catrobat/catroid/ui/fragment/FormulaEditorFragment.java index d0d4c5f1482..0f5d4a72ee3 100644 --- a/catroid/src/main/java/org/catrobat/catroid/ui/fragment/FormulaEditorFragment.java +++ b/catroid/src/main/java/org/catrobat/catroid/ui/fragment/FormulaEditorFragment.java @@ -732,6 +732,7 @@ public void onPrepareOptionsMenu(Menu menu) { menu.findItem(R.id.menu_redo).setVisible(true); super.onPrepareOptionsMenu(menu); + updateButtonsOnKeyboard(); } @Override @@ -1076,7 +1077,10 @@ public void onHiddenChanged(boolean hidden) { public void updateButtonsOnKeyboardAndInvalidateOptionsMenu() { getActivity().invalidateOptionsMenu(); + updateButtonsOnKeyboard(); + } + public void updateButtonsOnKeyboard() { ImageButton backspaceOnKeyboard = getActivity().findViewById(R.id.formula_editor_keyboard_delete); if (!formulaEditorEditText.isThereSomethingToDelete()) { backspaceOnKeyboard.setAlpha(255 / 3);