translations + preferences

This commit is contained in:
serso 2012-10-09 18:24:53 +04:00
parent 5d6ea3d58e
commit 9b6997e91b
12 changed files with 699 additions and 848 deletions

View File

@ -1,113 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:c="http://schemas.android.com/apk/res/org.solovyev.android.calculator"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
a:id="@+id/main_layout"
a:orientation="vertical"
a:layout_gravity="center"
a:background="#ff000000">
<include layout="@layout/calc_editor"/>
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
<org.solovyev.android.view.drag.DirectionDragButton xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:c="http://schemas.android.com/apk/res/org.solovyev.android.calculator"
a:id="@+id/leftButton"
c:textUp="◀◀"
a:text="◀"
c:directionTextScale="0.5"
style="?controlButtonStyle"
a:onClick="moveLeftButtonClickHandler"
a:layout_width="0dp"
a:layout_height="fill_parent"
a:layout_weight="1"/>
<org.solovyev.android.view.ColorButton xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:c="http://schemas.android.com/apk/res/org.solovyev.android.calculator"
a:id="@+id/eraseButton"
a:drawableTop="@drawable/kb_delete"
style="?controlImageButtonStyle"
a:onClick="eraseButtonClickHandler"
a:layout_width="0dp"
a:layout_height="fill_parent"
a:layout_weight="1"/>
<include layout="@layout/calc_display"
a:layout_width="0dp"
a:layout_height="fill_parent"
a:layout_weight="4"/>
<org.solovyev.android.calculator.view.NumeralBasesButton xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:c="http://schemas.android.com/apk/res/org.solovyev.android.calculator"
a:id="@+id/clearButton"
c:textUp="dec"
a:text="@string/c_clear"
c:textDown="bin"
c:textLeft="hex"
a:textStyle="bold"
style="?controlImageButtonStyle"
a:onClick="clearButtonClickHandler"
a:layout_width="0dp"
a:layout_height="fill_parent"
a:layout_weight="1"/>
<org.solovyev.android.view.drag.DirectionDragButton xmlns:a="http://schemas.android.com/apk/res/android"
xmlns:c="http://schemas.android.com/apk/res/org.solovyev.android.calculator"
a:id="@+id/rightButton"
c:textUp="▶▶"
a:text="▶"
c:directionTextScale="0.5"
style="?controlButtonStyle"
a:onClick="moveRightButtonClickHandler"
a:layout_width="0dp"
a:layout_height="fill_parent"
a:layout_weight="1"/>
</LinearLayout>
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
<include layout="@layout/calc_vars_button"/>
<include layout="@layout/calc_copy_button"/>
<include layout="@layout/calc_one_digit_button"/>
<include layout="@layout/calc_two_digit_button"/>
<include layout="@layout/calc_three_digit_button"/>
<include layout="@layout/calc_multiplication_button"/>
<include layout="@layout/calc_division_button"/>
<include layout="@layout/calc_equals_button"/>
</LinearLayout>
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
<include layout="@layout/calc_functions_button"/>
<include layout="@layout/calc_paste_button"/>
<include layout="@layout/calc_four_digit_button"/>
<include layout="@layout/calc_five_digit_button"/>
<include layout="@layout/calc_six_digit_button"/>
<include layout="@layout/calc_plus_button"/>
<include layout="@layout/calc_subtraction_button"/>
<include layout="@layout/calc_round_brackets_button"/>
</LinearLayout>
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
<include layout="@layout/calc_operators_button"/>
<include layout="@layout/calc_donate_button"/>
<include layout="@layout/calc_seven_digit_button"/>
<include layout="@layout/calc_eight_digit_button"/>
<include layout="@layout/calc_nine_digit_button"/>
<include layout="@layout/calc_zero_digit_button"/>
<include layout="@layout/calc_dot_button"/>
<include layout="@layout/calc_history_button"/>
</LinearLayout>
</LinearLayout>

View File

@ -34,9 +34,10 @@
a:layout_weight="1"/>
<LinearLayout a:id="@+id/displayContainer"
a:layout_weight="4"
a:layout_height="match_parent"
a:layout_width="0dp"
a:layout_height="match_parent"/>
a:layout_weight="4"
a:layout_margin="@dimen/display_margin_land"/>
<include layout="@layout/calc_clear_button"
a:layout_margin="@dimen/button_margin"

View File

@ -10,7 +10,7 @@
xmlns:a="http://schemas.android.com/apk/res/android"
a:id="@+id/calculatorDisplay"
style="@style/display_style"
a:padding="@dimen/editor_padding"
a:padding="@dimen/display_padding"
a:inputType="textMultiLine"
a:maxLines="3"
a:scrollHorizontally="false"

View File

@ -1,77 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:a="http://schemas.android.com/apk/res/android"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
a:id="@+id/main_layout"
a:orientation="vertical"
a:layout_gravity="center"
a:background="#ff000000">
<include layout="@layout/calc_editor"/>
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
<include layout="@layout/calc_equals_button"
a:layout_weight="1"
a:layout_width="0dp"
a:layout_height="fill_parent"/>
<include layout="@layout/calc_display"
a:layout_weight="4"
a:layout_width="0dp"
a:layout_height="fill_parent"/>
</LinearLayout>
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
<include layout="@layout/calc_one_digit_button"/>
<include layout="@layout/calc_two_digit_button"/>
<include layout="@layout/calc_three_digit_button"/>
<include layout="@layout/calc_multiplication_button"/>
<include layout="@layout/calc_clear_button"/>
</LinearLayout>
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
<include layout="@layout/calc_four_digit_button"/>
<include layout="@layout/calc_five_digit_button"/>
<include layout="@layout/calc_six_digit_button"/>
<include layout="@layout/calc_division_button"/>
<include layout="@layout/calc_erase_button"/>
</LinearLayout>
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
<include layout="@layout/calc_seven_digit_button"/>
<include layout="@layout/calc_eight_digit_button"/>
<include layout="@layout/calc_nine_digit_button"/>
<include layout="@layout/calc_plus_button"/>
<include layout="@layout/calc_copy_button"/>
</LinearLayout>
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
<include layout="@layout/calc_round_brackets_button"/>
<include layout="@layout/calc_zero_digit_button"/>
<include layout="@layout/calc_dot_button"/>
<include layout="@layout/calc_subtraction_button"/>
<include layout="@layout/calc_paste_button"/>
</LinearLayout>
<LinearLayout a:layout_weight="1" a:layout_width="fill_parent" a:layout_height="0dp">
<include layout="@layout/calc_left_button"/>
<include layout="@layout/calc_right_button"/>
<include layout="@layout/calc_vars_button"/>
<include layout="@layout/calc_functions_button"/>
<include layout="@layout/calc_history_button"/>
</LinearLayout>
</LinearLayout>

View File

@ -207,4 +207,22 @@
<string name="convert_to_bin">Перевести в bin</string>
<string name="convert_to_dec">Перевести в dec</string>
<string name="editor">Редактор</string>
<string name="result">Результат</string>
<string name="other">Другие</string>
<string name="derivatives">Производные/Интегралы</string>
<string name="crashed">Калькулятор++ обнаружил ошибку…</string>
<string name="crash_dialog_title">Отчёт об ошибке в Калькуляторе++</string>
<string name="crash_dialog_text">
К сожалению, Калькулятор++ был остановлен ошибкой.\n\n
Для того чтобы исправить, её нам необходима некоторая информация. Мы рекомендуем вам послать этот отчёт об ошибке (после нажатия кнопки \'Да\' вы увидите всю передаваемую информацию в новом окне).\n\n
Хотите лы вы послать отчёт об ошибке?
</string>
<string name="prefs_graph_scren_title">Настройки графика</string>
<string name="prefs_graph_interpolate_function">Интерполировать график</string>
<string name="prefs_graph_real_color_title">Цвет вещественной части графика</string>
<string name="prefs_graph_real_color_summary">Устанавливает цвет вещественной части графика</string>
<string name="prefs_graph_imag_color_title">Цвет мнимой части графика</string>
<string name="prefs_graph_imag_color_summary">Устанавливает цвет мнимой части графика</string>
</resources>

View File

@ -42,12 +42,10 @@
<string-array name="p_layout_names">
<item>@string/p_layout_calculator</item>
<item>@string/p_layout_simple</item>
<item>@string/p_layout_cellphone</item>
</string-array>
<string-array name="p_layout_values">
<item>main_calculator</item>
<item>simple</item>
<item>main_cellphone</item>
</string-array>
<string-array name="p_calc_haptic_feedback_duration_names">

View File

@ -1,6 +1,7 @@
<resources>
<dimen name="button_margin">0.5dp</dimen>
<dimen name="text_size">20sp</dimen>
<dimen name="button_margin">0.5dp</dimen>
<dimen name="display_margin_land">2.5dp</dimen>
<dimen name="fragment_text_size">15sp</dimen>
<dimen name="fragment_title_text_size">20sp</dimen>

View File

@ -225,5 +225,4 @@
<string name="prefs_graph_real_color_summary">Sets color of real part functions graph</string>
<string name="prefs_graph_imag_color_title">Color of imaginary part of functions graph</string>
<string name="prefs_graph_imag_color_summary">Sets color of imaginary part functions graph</string>
</resources>

View File

@ -212,7 +212,7 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
final CalculatorPreferences.Gui.Layout newLayout = CalculatorPreferences.Gui.layout.getPreference(preferences);
if ( newLayout.getLayoutId() != activityHelper.getLayoutId() ) {
if ( newLayout != activityHelper.getLayout() ) {
AndroidUtils.restartActivity(this);
}

View File

@ -27,6 +27,9 @@ public interface CalculatorActivityHelper {
@NotNull
CalculatorPreferences.Gui.Theme getTheme();
@NotNull
CalculatorPreferences.Gui.Layout getLayout();
void onResume(@NotNull SherlockFragmentActivity activity);
void onResume(@NotNull Activity activity);

View File

@ -48,6 +48,9 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
@NotNull
private CalculatorPreferences.Gui.Theme theme;
@NotNull
private CalculatorPreferences.Gui.Layout layout;
private int selectedNavigationIndex = 0;
public CalculatorActivityHelperImpl(int layoutId, @NotNull String logTag) {
@ -73,6 +76,8 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
this.theme = CalculatorPreferences.Gui.getTheme(preferences);
activity.setTheme(this.theme.getThemeId());
this.layout = CalculatorPreferences.Gui.getLayout(preferences);
activity.setContentView(layoutId);
final View root = activity.findViewById(R.id.main_layout);
@ -230,6 +235,12 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
return theme;
}
@Override
@NotNull
public CalculatorPreferences.Gui.Layout getLayout() {
return layout;
}
@Override
public void onResume(@NotNull SherlockFragmentActivity activity) {
onResume((Activity) activity);

View File

@ -45,6 +45,11 @@ public final class CalculatorPreferences {
return theme.getPreferenceNoError(preferences);
}
@NotNull
public static Layout getLayout(@NotNull SharedPreferences preferences) {
return layout.getPreferenceNoError(preferences);
}
public static enum Theme {
default_theme(ThemeType.other, R.style.default_theme),
@ -83,7 +88,11 @@ public final class CalculatorPreferences {
public static enum Layout {
main_calculator(R.layout.main_calculator),
main_cellphone(R.layout.main_cellphone),
// not used anymore
@Deprecated
main_cellphone(R.layout.main_calculator),
simple(R.layout.main_calculator);
private final int layoutId;
@ -139,6 +148,9 @@ public final class CalculatorPreferences {
applyDefaultPreference(preferences, Gui.theme);
applyDefaultPreference(preferences, Gui.layout);
if ( Gui.layout.getPreference(preferences) == Gui.Layout.main_cellphone ) {
Gui.layout.putDefault(preferences);
}
applyDefaultPreference(preferences, Gui.feedbackWindowShown);
applyDefaultPreference(preferences, Gui.notesppAnnounceShown);
applyDefaultPreference(preferences, Gui.showReleaseNotes);
@ -146,8 +158,6 @@ public final class CalculatorPreferences {
applyDefaultPreference(preferences, Gui.showEqualsButton);
applyDefaultPreference(preferences, Gui.autoOrientation);
applyDefaultPreference(preferences, Gui.hideNumeralBaseDigits);
applyDefaultPreference(preferences, Gui.theme);
applyDefaultPreference(preferences, Gui.theme);
applyDefaultPreference(preferences, Graph.interpolate);
applyDefaultPreference(preferences, Graph.lineColorImag);