Preferences fixes

This commit is contained in:
Sergey Solovyev 2012-10-12 21:16:53 +04:00
parent 86b68f2562
commit 66d5d20465
3 changed files with 137 additions and 137 deletions

View File

@ -157,6 +157,8 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
CalculatorButtons.processButtons(true, theme, root);
CalculatorButtons.toggleEqualsButton(preferences, activity);
CalculatorButtons.initMultiplicationButton(root);
NumeralBaseButtons.toggleNumericDigits(activity, preferences);
}
private void toggleButtonDirectionText(@NotNull View root, int id, boolean showDirectionText, @NotNull DragDirection... dragDirections) {

View File

@ -18,9 +18,6 @@ import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
*/
public class CalculatorKeyboardFragment extends SherlockFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
@NotNull
private NumeralBaseButtons numeralBaseButtons = new NumeralBaseButtons();
@NotNull
private CalculatorPreferences.Gui.Theme theme;
@ -102,8 +99,9 @@ public class CalculatorKeyboardFragment extends SherlockFragment implements Shar
@Override
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
if (AndroidCalculatorEngine.Preferences.numeralBase.getKey().equals(key)) {
numeralBaseButtons.toggleNumericDigits(this.getActivity(), preferences);
if (AndroidCalculatorEngine.Preferences.numeralBase.getKey().equals(key) ||
CalculatorPreferences.Gui.hideNumeralBaseDigits.getKey().equals(key) ) {
NumeralBaseButtons.toggleNumericDigits(this.getActivity(), preferences);
}
if ( CalculatorPreferences.Gui.showEqualsButton.getKey().equals(key) ) {

View File

@ -13,7 +13,7 @@ import org.solovyev.android.calculator.model.AndroidCalculatorEngine;
*/
public class NumeralBaseButtons {
public synchronized void toggleNumericDigits(@NotNull Activity activity, @NotNull NumeralBase currentNumeralBase) {
public static void toggleNumericDigits(@NotNull Activity activity, @NotNull NumeralBase currentNumeralBase) {
for (NumeralBase numeralBase : NumeralBase.values()) {
if ( currentNumeralBase != numeralBase ) {
AndroidNumeralBase.valueOf(numeralBase).toggleButtons(false, activity);
@ -23,10 +23,10 @@ public class NumeralBaseButtons {
AndroidNumeralBase.valueOf(currentNumeralBase).toggleButtons(true, activity);
}
public synchronized void toggleNumericDigits(@NotNull Activity activity, @NotNull SharedPreferences preferences) {
public static void toggleNumericDigits(@NotNull Activity activity, @NotNull SharedPreferences preferences) {
if (CalculatorPreferences.Gui.hideNumeralBaseDigits.getPreference(preferences)) {
final NumeralBase nb = AndroidCalculatorEngine.Preferences.numeralBase.getPreference(preferences);
this.toggleNumericDigits(activity, nb);
toggleNumericDigits(activity, nb);
} else {
// set HEX to show all digits
AndroidNumeralBase.valueOf(NumeralBase.hex).toggleButtons(true, activity);