Button capitalization is turned off in greek alphabet

This commit is contained in:
serso 2015-01-28 12:09:20 +01:00
parent 77e1570088
commit 6639e847f4

View File

@ -22,6 +22,8 @@
package org.solovyev.android.calculator.math.edit; package org.solovyev.android.calculator.math.edit;
import android.annotation.TargetApi;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
@ -30,7 +32,6 @@ import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewPropertyAnimator;
import android.widget.*; import android.widget.*;
import jscl.math.function.IConstant; import jscl.math.function.IConstant;
import org.solovyev.android.Views; import org.solovyev.android.Views;
@ -192,7 +193,11 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE
} }
final Button button = new Button(getActivity()); final Button button = new Button(getActivity());
button.setText(String.valueOf(greekAlphabet.charAt(i))); button.setText(String.valueOf(greekAlphabet.charAt(i)));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
fixCapitalization(button);
}
button.setOnClickListener(buttonOnClickListener); button.setOnClickListener(buttonOnClickListener);
assert keyboardRow != null;
keyboardRow.addView(button, new LinearLayout.LayoutParams(0, WRAP_CONTENT, 1F)); keyboardRow.addView(button, new LinearLayout.LayoutParams(0, WRAP_CONTENT, 1F));
} }
final Button button = new Button(getActivity()); final Button button = new Button(getActivity());
@ -222,6 +227,11 @@ public class VarEditDialogFragment extends DialogFragment implements CalculatorE
keyboardRow.addView(button, new LinearLayout.LayoutParams(0, WRAP_CONTENT, 1F)); keyboardRow.addView(button, new LinearLayout.LayoutParams(0, WRAP_CONTENT, 1F));
} }
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void fixCapitalization(Button button) {
button.setAllCaps(false);
}
@Override @Override
public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) { public void onCalculatorEvent(@Nonnull CalculatorEventData calculatorEventData, @Nonnull CalculatorEventType calculatorEventType, @Nullable Object data) {
switch (calculatorEventType) { switch (calculatorEventType) {