Remove dependency from NumeralBaseButton
This commit is contained in:
parent
b40b82574e
commit
467789d323
@ -68,6 +68,9 @@ public class PartialKeyboardUi extends BaseKeyboardUi {
|
|||||||
prepareButton(leftButton);
|
prepareButton(leftButton);
|
||||||
prepareButton(equalsButton);
|
prepareButton(equalsButton);
|
||||||
prepareButton(clearButton);
|
prepareButton(clearButton);
|
||||||
|
if (clearButton != null) {
|
||||||
|
clearButton.setNumeralBase(numeralBase.getPreference(preferences));
|
||||||
|
}
|
||||||
if (eraseButton != null) {
|
if (eraseButton != null) {
|
||||||
Check.isTrue(IMAGE_SCALE == 0.6f);
|
Check.isTrue(IMAGE_SCALE == 0.6f);
|
||||||
// backspace button is too big, scale it more
|
// backspace button is too big, scale it more
|
||||||
|
@ -28,7 +28,6 @@ import android.support.v4.content.ContextCompat;
|
|||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import jscl.NumeralBase;
|
import jscl.NumeralBase;
|
||||||
import org.solovyev.android.calculator.Locator;
|
|
||||||
import org.solovyev.android.calculator.R;
|
import org.solovyev.android.calculator.R;
|
||||||
import org.solovyev.android.views.dragbutton.DirectionDragButton;
|
import org.solovyev.android.views.dragbutton.DirectionDragButton;
|
||||||
|
|
||||||
@ -37,11 +36,10 @@ import javax.annotation.Nonnull;
|
|||||||
public class NumeralBasesButton extends DirectionDragButton {
|
public class NumeralBasesButton extends DirectionDragButton {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private NumeralBase numeralBase;
|
private NumeralBase numeralBase = NumeralBase.dec;
|
||||||
|
|
||||||
public NumeralBasesButton(Context context, @Nonnull AttributeSet attrs) {
|
public NumeralBasesButton(Context context, @Nonnull AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
this.numeralBase = Locator.getInstance().getEngine().getMathEngine().getNumeralBase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -70,9 +68,10 @@ public class NumeralBasesButton extends DirectionDragButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setNumeralBase(@Nonnull NumeralBase numeralBase) {
|
public void setNumeralBase(@Nonnull NumeralBase numeralBase) {
|
||||||
if (this.numeralBase != numeralBase) {
|
if (this.numeralBase == numeralBase) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.numeralBase = numeralBase;
|
this.numeralBase = numeralBase;
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user