This commit is contained in:
serso 2012-10-09 18:03:16 +04:00
parent 21640c051a
commit 5d6ea3d58e
7 changed files with 608 additions and 584 deletions

View File

@ -211,15 +211,19 @@
<string name="result">Result</string>
<string name="other">Other</string>
<string name="derivatives">Derivatives/Integrals</string>
<string name="crashed">Calculator++ has been crashed…</string>
<string name="crashed">Calculator++ has crashed…</string>
<string name="crash_dialog_title">Calculator++ crash report</string>
<string name="crash_dialog_text">
Unfortunately, Calculator++ has been crashed.\n\n
Unfortunately, Calculator++ has crashed.\n\n
In order to fix the problem we need some information about it. It\'s highly recommended to send crash report via email (after pressing \'Ok\' button you will see all sent data in the new window).\n\n
Do you want to send crash report?
</string>
<string name="c_prefs_graph">Graph preferences</string>
<string name="c_show_complex_graph_summary">If checked complex graph will be plotted</string>
<string name="c_show_complex_graph_title">Show complex graph</string>
<string name="prefs_graph_scren_title">Graph preferences</string>
<string name="prefs_graph_interpolate_function">Interpolate function\'s graph</string>
<string name="prefs_graph_real_color_title">Color of real part of functions graph</string>
<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

@ -2,21 +2,27 @@
<PreferenceScreen xmlns:a="http://schemas.android.com/apk/res/android">
<PreferenceScreen a:title="@string/prefs_graph_scren_title">
<org.solovyev.android.ads.AdViewPreference a:layout="@layout/admob_pref"/>
<android.preference.CheckBoxPreference
a:key="graph_interpolate"
a:title="Interpolate function's graph"
a:title="@string/prefs_graph_interpolate_function"
a:summary="If checked cubic interpolation will be used in function graph drawing"/>
<ListPreference a:key="graph_line_color_real"
a:title="Color of real part of functions graph"
a:summary="Sets color of real part functions graph"
a:title="@string/prefs_graph_real_color_title"
a:summary="@string/prefs_graph_real_color_summary"
a:entries="@array/graph_line_color_names"
a:entryValues="@array/graph_line_color_values"/>
<ListPreference a:key="graph_line_color_imag"
a:title="Color of imaginary part of functions graph"
a:summary="Sets color of imaginary part functions graph"
a:title="@string/prefs_graph_imag_color_title"
a:summary="@string/prefs_graph_imag_color_summary"
a:entries="@array/graph_line_color_names"
a:entryValues="@array/graph_line_color_values"/>
</PreferenceScreen>
</PreferenceScreen>

View File

@ -60,16 +60,6 @@
a:defaultValue="5"
range:boundaries="3;1000"/>
<!-- <PreferenceScreen a:title="@string/c_prefs_graph">
<android.preference.CheckBoxPreference
a:key="show_complex_graph"
a:summary="@string/c_show_complex_graph_summary"
a:title="@string/c_show_complex_graph_title"
a:defaultValue="false"/>
</PreferenceScreen>-->
</PreferenceScreen>
<PreferenceScreen

View File

@ -57,6 +57,7 @@ public class CalculatorApplication extends android.app.Application {
ACRA.init(this);
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
CalculatorPreferences.setDefaultValues(preferences);
setTheme(preferences);
@ -84,8 +85,6 @@ public class CalculatorApplication extends android.app.Application {
return CalculatorSecurity.getPK();
}
});
CalculatorPreferences.setDefaultValues(preferences);
}
private void setTheme(@NotNull SharedPreferences preferences) {

View File

@ -102,7 +102,6 @@ public final class CalculatorPreferences {
public static final Preference<Boolean> interpolate = new BooleanPreference("graph_interpolate", true);
public static final Preference<GraphLineColor> lineColorReal = StringPreference.newInstance("graph_line_color_real", GraphLineColor.white, GraphLineColor.class);
public static final Preference<GraphLineColor> lineColorImag = StringPreference.newInstance("graph_line_color_imag", GraphLineColor.blue, GraphLineColor.class);
}
@ -137,6 +136,29 @@ public final class CalculatorPreferences {
AndroidCalculatorEngine.Preferences.multiplicationSign.putPreference(preferences, "*");
}
}
applyDefaultPreference(preferences, Gui.theme);
applyDefaultPreference(preferences, Gui.layout);
applyDefaultPreference(preferences, Gui.feedbackWindowShown);
applyDefaultPreference(preferences, Gui.notesppAnnounceShown);
applyDefaultPreference(preferences, Gui.showReleaseNotes);
applyDefaultPreference(preferences, Gui.usePrevAsBack);
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);
applyDefaultPreference(preferences, Graph.lineColorReal);
}
private static void applyDefaultPreference(@NotNull SharedPreferences preferences, @NotNull Preference<?> preference) {
if (!preference.isSet(preferences)) {
preference.putDefault(preferences);
}
}
}

View File

@ -14,7 +14,7 @@ import android.view.View;
import android.widget.TextView;
import org.jetbrains.annotations.NotNull;
import org.solovyev.android.AndroidUtils;
import org.solovyev.android.calculator.CalculatorActivity;
import org.solovyev.android.calculator.CalculatorApplication;
import org.solovyev.android.calculator.CalculatorFragment;
import org.solovyev.android.calculator.R;
import org.solovyev.common.text.StringUtils;
@ -50,9 +50,9 @@ public class CalculatorReleaseNotesFragment extends CalculatorFragment {
final StringBuilder result = new StringBuilder();
final String releaseNotesForTitle = context.getString(R.string.c_release_notes_for_title);
final int version = AndroidUtils.getAppVersionCode(context, CalculatorActivity.class.getPackage().getName());
final int version = AndroidUtils.getAppVersionCode(context, CalculatorApplication.class.getPackage().getName());
final TextHelper textHelper = new TextHelper(context.getResources(), R.class.getPackage().getName());
final TextHelper textHelper = new TextHelper(context.getResources(), CalculatorApplication.class.getPackage().getName());
boolean first = true;
for ( int i = version; i >= minVersion; i-- ) {

View File

@ -6,12 +6,15 @@ import android.view.View;
import android.view.WindowManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.solovyev.android.calculator.*;
import org.solovyev.android.calculator.CalculatorLocatorImpl;
import org.solovyev.android.calculator.CalculatorParseException;
import org.solovyev.android.calculator.R;
import org.solovyev.android.calculator.ToJsclTextProcessor;
import org.solovyev.android.calculator.units.CalculatorNumeralBase;
import org.solovyev.math.units.Unit;
import org.solovyev.math.units.UnitImpl;
import org.solovyev.common.MutableObject;
import org.solovyev.common.text.StringUtils;
import org.solovyev.math.units.Unit;
import org.solovyev.math.units.UnitImpl;
import java.util.Arrays;
@ -64,8 +67,8 @@ public class NumeralBaseConverterDialog {
public void onClick(@NotNull Unit<String> fromUnits, @NotNull Unit<String> toUnits) {
String toUnitsValue = toUnits.getValue();
if (!toUnits.getUnitType().equals(AndroidNumeralBase.valueOf(CalculatorLocatorImpl.getInstance().getEngine().getNumeralBase()))) {
toUnitsValue = ((AndroidNumeralBase) toUnits.getUnitType()).getNumeralBase().getJsclPrefix() + toUnitsValue;
if (!toUnits.getUnitType().equals(CalculatorNumeralBase.valueOf(CalculatorLocatorImpl.getInstance().getEngine().getNumeralBase()))) {
toUnitsValue = ((CalculatorNumeralBase) toUnits.getUnitType()).getNumeralBase().getJsclPrefix() + toUnitsValue;
}
CalculatorLocatorImpl.getInstance().getKeyboard().digitButtonPressed(toUnitsValue);