Calculation fixable messages

This commit is contained in:
Sergey Solovyev 2012-11-18 00:39:04 +04:00
parent ef11120244
commit 606a5ffc99
9 changed files with 20 additions and 19 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:layout_width="match_parent"
a:layout_height="match_parent"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
style="?dialogStyle"
a:orientation="vertical">

View File

@ -3,20 +3,19 @@
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:layout_width="match_parent"
a:layout_height="wrap_content"
a:orientation="horizontal">
a:orientation="horizontal"
a:padding="6dp">
<TextView a:id="@+id/calculation_messages_text_view"
a:layout_width="0dp"
a:layout_height="wrap_content"
a:layout_weight="5"
a:layout_gravity="top|left"/>
a:layout_weight="5"/>
<Button
a:id="@+id/fix_button"
a:layout_width="0dp"
a:layout_height="wrap_content"
a:layout_weight="1"
a:layout_gravity="top|right"
a:text="@string/fix"/>
</LinearLayout>

View File

@ -4,6 +4,7 @@
<dimen name="editor_text_size">25sp</dimen>
<dimen name="display_text_size">25sp</dimen>
<dimen name="button_text_size_mobile">35dp</dimen>
<dimen name="keyboard_button_text_size">40dp</dimen>
<dimen name="math_entity_text_size">25sp</dimen>
<dimen name="math_entity_description_text_size">20sp</dimen>

View File

@ -4,6 +4,7 @@
<dimen name="editor_text_size">30sp</dimen>
<dimen name="display_text_size">30sp</dimen>
<dimen name="button_text_size_mobile">65dp</dimen>
<dimen name="keyboard_button_text_size">40dp</dimen>
<dimen name="math_entity_text_size">30sp</dimen>
<dimen name="math_entity_description_text_size">20sp</dimen>

View File

@ -8,7 +8,7 @@
<dimen name="keyboard_button_text_size">30dp</dimen>
<dimen name="button_text_size">20dp</dimen>
<dimen name="button_text_size_mobile">20dp</dimen>
<dimen name="button_text_size_mobile">25dp</dimen>
<dimen name="display_text_size">25sp</dimen>
<dimen name="editor_text_size">25sp</dimen>
<dimen name="pane_margin">5dp</dimen>

View File

@ -248,7 +248,7 @@
<string name="function_removal_confirmation_question">Do you really want to delete \'%s\' function?</string>
<string name="empty_function_error">Unable to create empty function!</string>
<string name="do_not_show_messages_in_session">Do not show this message until next session</string>
<string name="calculation_messages_dialog_title">Calculation messages</string>
<string name="calculation_messages_dialog_title">Calculator++ warning</string>
<string name="arithmetic_error_while_plot">Arithmetic error occurred while plotting: %s</string>
<string name="ok">OK</string>
<string name="p_show_calculation_messages_dialog_title">Show calculation messages in dialog</string>

View File

@ -32,16 +32,16 @@ public class AndroidCalculatorPreferenceService implements CalculatorPreferenceS
@Override
public void checkPreferredPreferences(boolean force) {
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(application);
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(application);
final Long currentTime = System.currentTimeMillis();
if ( force || isTimeForCheck(currentTime, preferences)) {
final NumeralBase preferredNumeralBase = CalculatorPreferences.Calculations.preferredNumeralBase.getPreference(preferences);
final NumeralBase numeralBase = AndroidCalculatorEngine.Preferences.numeralBase.getPreference(preferences);
if ( force || ( CalculatorPreferences.Calculations.showCalculationMessagesDialog.getPreference(prefs) && isTimeForCheck(currentTime, prefs))) {
final NumeralBase preferredNumeralBase = CalculatorPreferences.Calculations.preferredNumeralBase.getPreference(prefs);
final NumeralBase numeralBase = AndroidCalculatorEngine.Preferences.numeralBase.getPreference(prefs);
final AngleUnit preferredAngleUnits = CalculatorPreferences.Calculations.preferredAngleUnits.getPreference(preferences);
final AngleUnit angleUnits = AndroidCalculatorEngine.Preferences.angleUnit.getPreference(preferences);
final AngleUnit preferredAngleUnits = CalculatorPreferences.Calculations.preferredAngleUnits.getPreference(prefs);
final AngleUnit angleUnits = AndroidCalculatorEngine.Preferences.angleUnit.getPreference(prefs);
final List<CalculatorFixableMessage> messages = new ArrayList<CalculatorFixableMessage>(2);
if ( numeralBase != preferredNumeralBase ) {
@ -54,7 +54,7 @@ public class AndroidCalculatorPreferenceService implements CalculatorPreferenceS
CalculatorMessagesDialog.showDialog(messages, application);
CalculatorPreferences.Calculations.lastPreferredPreferencesCheck.putPreference(preferences, currentTime);
CalculatorPreferences.Calculations.lastPreferredPreferencesCheck.putPreference(prefs, currentTime);
}
}

View File

@ -79,6 +79,8 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
toggleOrientationChange(preferences);
preferences.registerOnSharedPreferenceChangeListener(this);
CalculatorLocatorImpl.getInstance().getPreferenceService().checkPreferredPreferences(false);
}
@NotNull

View File

@ -126,8 +126,6 @@ public class CalculatorApplication extends android.app.Application {
CalculatorLocatorImpl.getInstance().getLogger().debug(TAG, "Application started!");
CalculatorLocatorImpl.getInstance().getNotifier().showDebugMessage(TAG, "Application started!");
CalculatorLocatorImpl.getInstance().getPreferenceService().checkPreferredPreferences(true);
}
private void setTheme(@NotNull SharedPreferences preferences) {