This commit is contained in:
serso 2012-10-02 12:29:56 +04:00
parent 999299d9bb
commit 327f43a323
39 changed files with 1564 additions and 1540 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 785 B

After

Width:  |  Height:  |  Size: 785 B

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 807 B

After

Width:  |  Height:  |  Size: 807 B

View File

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 630 B

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -30,7 +30,7 @@
<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/sym_keyboard_delete"
a:drawableTop="@drawable/kb_delete"
style="?controlImageButtonStyle"
a:onClick="eraseButtonClickHandler"
a:layout_width="0dp"

View File

@ -5,6 +5,21 @@
a:layout_height="match_parent"
a:orientation="vertical">
<LinearLayout a:layout_weight="1"
a:layout_width="match_parent"
a:layout_height="0dp">
<include layout="@layout/calc_left_button"/>
<include layout="@layout/calc_erase_button"/>
<include layout="@layout/calc_empty_button"/>
<include layout="@layout/calc_empty_button"/>
<include layout="@layout/calc_empty_button"/>
<include layout="@layout/calc_empty_button"/>
<include layout="@layout/calc_clear_button"/>
<include layout="@layout/calc_right_button"/>
</LinearLayout>
<LinearLayout a:layout_weight="1"
a:layout_width="match_parent"
a:layout_height="0dp">

View File

@ -9,6 +9,6 @@
<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/pasteButton"
a:drawableTop="@drawable/copy"
a:drawableTop="@drawable/kb_copy"
style="?controlImageButtonStyle"
a:onClick="copyButtonClickHandler"/>

View File

@ -8,6 +8,6 @@
<org.solovyev.android.view.ColorButton xmlns:a="http://schemas.android.com/apk/res/android"
a:id="@+id/pasteButton"
a:drawableTop="@drawable/heart2"
a:drawableTop="@drawable/kb_heart"
style="?controlImageButtonStyle"
a:onClick="donateButtonClickHandler"/>

View File

@ -9,6 +9,6 @@
<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/sym_keyboard_delete"
a:drawableTop="@drawable/kb_delete"
style="?controlImageButtonStyle"
a:onClick="eraseButtonClickHandler"/>

View File

@ -9,6 +9,6 @@
<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/pasteButton"
a:drawableTop="@drawable/paste"
a:drawableTop="@drawable/kb_paste"
style="?controlImageButtonStyle"
a:onClick="pasteButtonClickHandler"/>

View File

@ -7,19 +7,20 @@
-->
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:orientation="vertical"
a:layout_width="fill_parent"
a:layout_height="fill_parent">
a:layout_height="wrap_content"
a:layout_width="match_parent"
a:paddingBottom="@dimen/pane_padding"
a:orientation="vertical">
<TextView a:id="@+id/math_entity_text"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
a:layout_height="wrap_content"
a:layout_width="match_parent"
style="@style/math_entity_text">
</TextView>
<TextView a:id="@+id/math_entity_description"
a:layout_width="fill_parent"
a:layout_height="fill_parent"
a:layout_height="wrap_content"
a:layout_width="match_parent"
style="@style/math_entity_description">
</TextView>

View File

@ -9,7 +9,7 @@
<ScrollView xmlns:a="http://schemas.android.com/apk/res/android"
a:layout_height="wrap_content"
a:layout_width="match_parent"
a:minWidth="200dp">
a:minWidth="300dp">
<LinearLayout a:layout_height="wrap_content"
a:layout_width="match_parent"

View File

@ -2,4 +2,6 @@
<dimen name="editor_text_size">15sp</dimen>
<dimen name="display_text_size">15sp</dimen>
<dimen name="keyboard_button_text_size">20dp</dimen>
<dimen name="math_entity_text_size">15sp</dimen>
<dimen name="math_entity_description_text_size">10sp</dimen>
</resources>

View File

@ -7,6 +7,8 @@
<dimen name="editor_text_size">25sp</dimen>
<dimen name="pane_margin">5dp</dimen>
<dimen name="pane_padding">5dp</dimen>
<dimen name="math_entity_text_size">20sp</dimen>
<dimen name="math_entity_description_text_size">15sp</dimen>
<!--only for not multipane-->
<dimen name="editor_padding">5dp</dimen>

View File

@ -8,16 +8,11 @@
<resources>
<style name="math_entity_text" parent="math_entity_text_parent">
<item name="android:paddingTop">0dp</item>
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
<item name="android:paddingBottom">@dimen/pane_padding</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@android:color/white</item>
</style>
<style name="math_entity_description" parent="math_entity_description_parent">
<item name="android:padding">0dp</item>
<item name="android:textColor">#bebebe</item>
</style>

View File

@ -48,11 +48,11 @@
</style>
<style name="math_entity_text_parent">
<item name="android:textSize">20dp</item>
<item name="android:textSize">@dimen/math_entity_text_size</item>
</style>
<style name="math_entity_description_parent">
<item name="android:textSize">15dp</item>
<item name="android:textSize">@dimen/math_entity_description_text_size</item>
</style>
<style name="add_var_button_parent">

View File

@ -33,6 +33,9 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
@NotNull
private CalculatorPreferences.Gui.Layout layout;
@NotNull
private CalculatorPreferences.Gui.Theme theme;
@Nullable
private Vibrator vibrator;
@ -54,6 +57,7 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
vibrator = (Vibrator) activity.getSystemService(Activity.VIBRATOR_SERVICE);
layout = CalculatorPreferences.Gui.layout.getPreferenceNoError(preferences);
theme = CalculatorPreferences.Gui.theme.getPreferenceNoError(preferences);
preferences.registerOnSharedPreferenceChangeListener(this);
}
@ -146,6 +150,9 @@ public abstract class AbstractCalculatorHelper implements SharedPreferences.OnSh
toggleButtonDirectionText(root, R.id.multiplicationButton, false, DragDirection.left);
toggleButtonDirectionText(root, R.id.plusButton, false, DragDirection.down, DragDirection.up);
}
CalculatorButtons.processButtons(true, theme, root);
CalculatorButtons.toggleEqualsButton(preferences, activity);
}
private void toggleButtonDirectionText(@NotNull View root, int id, boolean showDirectionText, @NotNull DragDirection... dragDirections) {

View File

@ -113,8 +113,6 @@ public class CalculatorActivity extends SherlockFragmentActivity implements Shar
toggleOrientationChange(preferences);
CalculatorButtons.toggleEqualsButton(preferences, this, activityHelper.getTheme(), findViewById(R.id.main_layout));
preferences.registerOnSharedPreferenceChangeListener(this);
}

View File

@ -2,6 +2,7 @@ package org.solovyev.android.calculator;
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
@ -80,7 +81,7 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
final View root = activity.findViewById(R.id.main_layout);
if (root != null) {
CalculatorButtons.processButtons(true, theme, root);
processButtons(activity, root);
} else {
Log.e(CalculatorActivityHelperImpl.class.getSimpleName(), "Root is null for " + activity.getClass().getName());
}
@ -99,8 +100,12 @@ public class CalculatorActivityHelperImpl extends AbstractCalculatorHelper imple
actionBar.setDisplayHomeAsUpEnabled(homeIcon);
actionBar.setHomeButtonEnabled(false);
actionBar.setDisplayShowHomeEnabled(true);
if (activity instanceof CalculatorActivity) {
actionBar.setDisplayShowTitleEnabled(false);
if ( AndroidUtils.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT ) {
actionBar.setDisplayShowTitleEnabled(true);
} else {
}
} else {
actionBar.setDisplayShowTitleEnabled(true);
}

View File

@ -63,9 +63,7 @@ public final class CalculatorButtons {
}
public static void toggleEqualsButton(@Nullable SharedPreferences preferences,
@NotNull Activity activity,
@NotNull CalculatorPreferences.Gui.Theme theme,
@NotNull View root) {
@NotNull Activity activity) {
preferences = preferences == null ? PreferenceManager.getDefaultSharedPreferences(activity) : preferences;
if (AndroidUtils.getScreenOrientation(activity) == Configuration.ORIENTATION_PORTRAIT || !CalculatorPreferences.Gui.autoOrientation.getPreference(preferences)) {
@ -73,22 +71,23 @@ public final class CalculatorButtons {
final DragButton equalsButton = (DragButton)activity.findViewById(R.id.equalsButton);
if (equalsButton != null) {
// todo serso: visibility should be changed only for some cases (like small screens)
if (CalculatorPreferences.Gui.showEqualsButton.getPreference(preferences)) {
equalsButton.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.FILL_PARENT, 1f));
equalsButton.setVisibility(View.VISIBLE);
if (display.getWidth() <= 480) {
// mobile phones
final AndroidCalculatorDisplayView calculatorDisplayView = getCalculatorDisplayView();
if (calculatorDisplayView != null) {
calculatorDisplayView.setBackgroundDrawable(null);
calculatorDisplayView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
}
}
} else {
equalsButton.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.FILL_PARENT, 0f));
equalsButton.setVisibility(View.GONE);
if (display.getWidth() <= 480) {
// mobile phones
final AndroidCalculatorDisplayView calculatorDisplayView = getCalculatorDisplayView();
if (calculatorDisplayView != null) {
calculatorDisplayView.setBackgroundDrawable(activity.getResources().getDrawable(R.drawable.equals9));
calculatorDisplayView.setCompoundDrawablesWithIntrinsicBounds(activity.getResources().getDrawable(R.drawable.equals9), null, null, null);
}
}
}

View File

@ -107,7 +107,7 @@ public class CalculatorKeyboardFragment extends SherlockFragment implements Shar
}
if ( CalculatorPreferences.Gui.showEqualsButton.getKey().equals(key) ) {
CalculatorButtons.toggleEqualsButton(preferences, this.getActivity(), theme, getView());
CalculatorButtons.toggleEqualsButton(preferences, this.getActivity());
}
if ( AndroidCalculatorEngine.Preferences.multiplicationSign.getKey().equals(key) ) {