fix for simple layout

This commit is contained in:
Sergey Solovyev 2013-06-25 13:26:45 +04:00
parent 334470bce4
commit 9399172ff1
6 changed files with 10 additions and 16 deletions

View File

@ -180,7 +180,7 @@ public class AndroidCalculatorDisplayView extends AutoResizeTextView implements
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
final CalculatorPreferences.Gui.Layout layout = CalculatorPreferences.Gui.getLayout(preferences); final CalculatorPreferences.Gui.Layout layout = CalculatorPreferences.Gui.getLayout(preferences);
if (layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile) { if (!layout.isOptimized()) {
setTextSize(TypedValue.COMPLEX_UNIT_SP, getResources().getDimension(R.dimen.cpp_display_text_size_mobile)); setTextSize(TypedValue.COMPLEX_UNIT_SP, getResources().getDimension(R.dimen.cpp_display_text_size_mobile));
} }

View File

@ -40,7 +40,7 @@ public final class CalculatorButtons {
public static void processButtons(@Nonnull CalculatorPreferences.Gui.Theme theme, public static void processButtons(@Nonnull CalculatorPreferences.Gui.Theme theme,
@Nonnull CalculatorPreferences.Gui.Layout layout, @Nonnull CalculatorPreferences.Gui.Layout layout,
@Nonnull View root) { @Nonnull View root) {
if (layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile) { if (!layout.isOptimized()) {
final float textSize = root.getContext().getResources().getDimension(R.dimen.cpp_keyboard_button_text_size_mobile); final float textSize = root.getContext().getResources().getDimension(R.dimen.cpp_keyboard_button_text_size_mobile);
@ -70,7 +70,7 @@ public final class CalculatorButtons {
preferences = preferences == null ? PreferenceManager.getDefaultSharedPreferences(activity) : preferences; preferences = preferences == null ? PreferenceManager.getDefaultSharedPreferences(activity) : preferences;
final boolean large = Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, activity.getResources().getConfiguration()) && final boolean large = Views.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE, activity.getResources().getConfiguration()) &&
CalculatorPreferences.Gui.getLayout(preferences) != CalculatorPreferences.Gui.Layout.main_calculator_mobile; CalculatorPreferences.Gui.getLayout(preferences).isOptimized();
if (!large) { if (!large) {
if (Views.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT if (Views.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT

View File

@ -25,7 +25,7 @@ public class CalculatorDisplayFragment extends SherlockFragment {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getActivity()); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getActivity());
final CalculatorPreferences.Gui.Layout layout = CalculatorPreferences.Gui.getLayout(prefs); final CalculatorPreferences.Gui.Layout layout = CalculatorPreferences.Gui.getLayout(prefs);
if (layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile) { if (!layout.isOptimized()) {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_display_mobile, R.string.result); fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_display_mobile, R.string.result);
} else { } else {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_display, R.string.result); fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_display, R.string.result);

View File

@ -52,7 +52,7 @@ public class CalculatorEditorFragment extends SherlockFragment {
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getActivity()); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getActivity());
final CalculatorPreferences.Gui.Layout layout = CalculatorPreferences.Gui.getLayout(prefs); final CalculatorPreferences.Gui.Layout layout = CalculatorPreferences.Gui.getLayout(prefs);
if (layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile) { if (!layout.isOptimized()) {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_editor_mobile, R.string.editor); fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_editor_mobile, R.string.editor);
} else { } else {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_editor, R.string.editor); fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_editor, R.string.editor);

View File

@ -31,7 +31,7 @@ public class CalculatorKeyboardFragment extends SherlockFragment implements Shar
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this.getActivity()); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this.getActivity());
final CalculatorPreferences.Gui.Layout layout = CalculatorPreferences.Gui.getLayout(preferences); final CalculatorPreferences.Gui.Layout layout = CalculatorPreferences.Gui.getLayout(preferences);
if (layout == CalculatorPreferences.Gui.Layout.main_calculator_mobile) { if (!layout.isOptimized()) {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_keyboard_mobile); fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_keyboard_mobile);
} else { } else {
fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_keyboard); fragmentHelper = CalculatorApplication.getInstance().createFragmentHelper(R.layout.cpp_app_keyboard);

View File

@ -49,16 +49,10 @@ enum CalculatorLayout {
@Nonnull @Nonnull
static CalculatorLayout fromGuiLayout(@Nonnull CalculatorPreferences.Gui.Layout layout) { static CalculatorLayout fromGuiLayout(@Nonnull CalculatorPreferences.Gui.Layout layout) {
switch (layout) { if(layout.isOptimized()) {
case main_calculator: return optimized;
case main_cellphone: } else {
case simple: return big_buttons;
return optimized;
case main_calculator_mobile:
case simple_mobile:
return big_buttons;
default:
return getDefaultLayout();
} }
} }
} }