diff --git a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculator.java b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculator.java
index 5bd719e0..b5a0ecba 100644
--- a/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculator.java
+++ b/android-app/src/main/java/org/solovyev/android/calculator/AndroidCalculator.java
@@ -22,7 +22,6 @@
package org.solovyev.android.calculator;
-import android.app.Activity;
import android.app.Application;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
@@ -60,27 +59,6 @@ public class AndroidCalculator implements Calculator, CalculatorEventListener, S
PreferenceManager.getDefaultSharedPreferences(application).registerOnSharedPreferenceChangeListener(this);
}
- public void setDisplay(@Nonnull Activity activity) {
- final AndroidCalculatorDisplayView displayView = (AndroidCalculatorDisplayView) activity.findViewById(R.id.calculator_display);
- displayView.init(activity);
- Locator.getInstance().getDisplay().setView(displayView);
- }
-
- public void clearDisplay() {
- Locator.getInstance().getDisplay().setView(null);
- }
-
- public void setEditor(@Nonnull Activity activity) {
- final AndroidCalculatorEditorView editorView = (AndroidCalculatorEditorView) activity.findViewById(R.id.calculator_editor);
- editorView.init();
- Locator.getInstance().getEditor().setView(editorView);
- }
-
- public void clearEditor() {
- Locator.getInstance().getEditor().setView(null);
- }
-
-
/*
**********************************************************************
*
diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDisplayFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDisplayFragment.java
index bf54816a..229662d2 100644
--- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDisplayFragment.java
+++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorDisplayFragment.java
@@ -42,6 +42,8 @@ public class CalculatorDisplayFragment extends Fragment {
@Nonnull
private FragmentUi fragmentHelper;
+ @Nonnull
+ private AndroidCalculatorDisplayView displayView;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -67,7 +69,9 @@ public class CalculatorDisplayFragment extends Fragment {
public void onViewCreated(View root, Bundle savedInstanceState) {
super.onViewCreated(root, savedInstanceState);
- ((AndroidCalculator) Locator.getInstance().getCalculator()).setDisplay(getActivity());
+ displayView = (AndroidCalculatorDisplayView) root.findViewById(R.id.calculator_display);
+ displayView.init(getActivity());
+ Locator.getInstance().getDisplay().setView(displayView);
fragmentHelper.onViewCreated(this, root);
}
@@ -93,7 +97,7 @@ public class CalculatorDisplayFragment extends Fragment {
@Override
public void onDestroyView() {
- ((AndroidCalculator) Locator.getInstance().getCalculator()).clearDisplay();
+ Locator.getInstance().getDisplay().clearView(displayView);
super.onDestroyView();
}
diff --git a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorEditorFragment.java b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorEditorFragment.java
index 02760593..19aaae4a 100644
--- a/android-app/src/main/java/org/solovyev/android/calculator/CalculatorEditorFragment.java
+++ b/android-app/src/main/java/org/solovyev/android/calculator/CalculatorEditorFragment.java
@@ -47,6 +47,9 @@ public class CalculatorEditorFragment extends Fragment {
@Nonnull
private ActivityMenu