Idea is to get to a single-responsibility design. Therefore, history should not be part of BitmapFragment. Maybe it can be its own Fragment. Anyways, the historyMaintainer should register as a listener with the BitmapFragment. BitmapFragment itself should not do anything fancy.
The BitmapFragmentListeners should be informed when the specification changed (which excludes changes of the image size).
current
stack
setCurrent(Fractal)
push() : if(current != null) stack.push(current); current = null;
current can be null if imageSize was changed.
pop() : return stack.pop(); null if no more elements. 'current is kept'
calculationStarted calls push().
This way, MainActivity.back calls bitmapFragment.setFractal(history.pop()) and the popped fractal is added as current again.
Idea is to get to a single-responsibility design. Therefore, history should not be part of BitmapFragment. Maybe it can be its own Fragment. Anyways, the historyMaintainer should register as a listener with the BitmapFragment. BitmapFragment itself should not do anything fancy.
The BitmapFragmentListeners should be informed when the specification changed (which excludes changes of the image size).
History itself is the recipient of 'back'-keys.
History is a List + a current-field.
This way, MainActivity.back calls bitmapFragment.setFractal(history.pop()) and the popped fractal is added as current again.