This commit is contained in:
Sergey Solovyev 2012-10-05 22:08:37 +04:00
parent c1a65f4aad
commit 638ee2e851
13 changed files with 405 additions and 392 deletions

View File

@ -123,7 +123,7 @@
<dependency>
<groupId>achartengine</groupId>
<artifactId>achartengine</artifactId>
<version>0.7.0</version>
<version>0.7.1</version>
</dependency>
<dependency>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -15,6 +15,6 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#393939"/>
<solid android:color="@color/metro_light_button_background"/>
<corners android:radius="1dp" />
</shape>

View File

@ -1,5 +1,7 @@
<resources>
<dimen name="fragment_text_size">10sp</dimen>
<dimen name="fragment_title_text_size">20sp</dimen>
<dimen name="editor_text_size">15sp</dimen>
<dimen name="display_text_size">15sp</dimen>
<dimen name="keyboard_button_text_size">20dp</dimen>

View File

@ -0,0 +1,9 @@
<resources>
<dimen name="fragment_text_size">20sp</dimen>
<dimen name="fragment_title_text_size">30sp</dimen>
<dimen name="editor_text_size">30sp</dimen>
<dimen name="display_text_size">30sp</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>
</resources>

View File

@ -18,4 +18,5 @@
<color name="metro_blue_color">#10648c</color>
<color name="metro_green_color">#088e3a</color>
<color name="metro_purple_color">#651456</color>
<color name="metro_light_button_background">#393939</color>
</resources>

View File

@ -1,7 +1,10 @@
<resources>
<dimen name="button_margin">0.5dp</dimen>
<dimen name="text_size">20sp</dimen>
<dimen name="fragment_text_size">15sp</dimen>
<dimen name="fragment_title_text_size">20sp</dimen>
<dimen name="keyboard_button_text_size">30dp</dimen>
<dimen name="button_text_size">20dp</dimen>
<dimen name="display_text_size">25sp</dimen>

View File

@ -37,7 +37,7 @@
<style name="default_fragment_title_style">
<item name="android:textColor">@android:color/white</item>
<item name="android:textSize">20sp</item>
<item name="android:textSize">@dimen/fragment_title_text_size</item>
</style>
<style name="default_button_style" parent="button_style">

View File

@ -171,6 +171,8 @@ public class CalculatorPlotFragment extends CalculatorFragment implements Calcul
//noinspection ConstantConditions
this.chart = PlotUtils.prepareChart(getMinValue(null), getMaxValue(null), preparedInput.getExpression(), preparedInput.getVariable(), bgColor, interpolate, realLineColor.getColor(), imagLineColor.getColor());
} else {
this.chart = null;
}
}
@ -203,6 +205,12 @@ public class CalculatorPlotFragment extends CalculatorFragment implements Calcul
}
private void createGraphicalView(@NotNull View root, @Nullable PlotBoundaries plotBoundaries) {
final ViewGroup graphContainer = (ViewGroup) root.findViewById(R.id.main_fragment_layout);
if (graphicalView != null) {
graphContainer.removeView(graphicalView);
}
if (!preparedInput.isError()) {
final XYChart chart = this.chart;
assert chart != null;
@ -210,12 +218,6 @@ public class CalculatorPlotFragment extends CalculatorFragment implements Calcul
double minValue = getMinValue(plotBoundaries);
double maxValue = getMaxValue(plotBoundaries);
final ViewGroup graphContainer = (ViewGroup) root.findViewById(R.id.main_fragment_layout);
if (graphicalView != null) {
graphContainer.removeView(graphicalView);
}
// reverting boundaries (as in prepareChart() we add some cached values )
double minX = Double.MAX_VALUE;
double minY = Double.MAX_VALUE;
@ -260,7 +262,6 @@ public class CalculatorPlotFragment extends CalculatorFragment implements Calcul
graphicalView.addPanListener(new PanListener() {
@Override
public void panApplied() {
Log.d(TAG, "org.achartengine.tools.PanListener.panApplied");
updateDataSets(chart);
}
@ -269,7 +270,7 @@ public class CalculatorPlotFragment extends CalculatorFragment implements Calcul
updateDataSets(chart, 50);
} else {
Toast.makeText(this.getActivity(), "Plot is not possible!", Toast.LENGTH_LONG).show();
graphicalView = null;
}
}
@ -294,6 +295,7 @@ public class CalculatorPlotFragment extends CalculatorFragment implements Calcul
final Generic expression = preparedInput.getExpression();
final Constant variable = preparedInput.getVariable();
if (expression != null && variable != null) {
pendingOperation.setObject(new Runnable() {
@Override
public void run() {
@ -305,12 +307,8 @@ public class CalculatorPlotFragment extends CalculatorFragment implements Calcul
plotExecutor.execute(new Runnable() {
@Override
public void run() {
Log.d(TAG, "org.solovyev.android.calculator.plot.CalculatorPlotActivity.updateDataSets");
final XYMultipleSeriesRenderer dr = chart.getRenderer();
//Log.d(CalculatorPlotActivity.class.getName(), "x = [" + dr.getXAxisMin() + ", " + dr.getXAxisMax() + "], y = [" + dr.getYAxisMin() + ", " + dr.getYAxisMax() + "]");
final MyXYSeries realSeries = (MyXYSeries) chart.getDataset().getSeriesAt(0);
final MyXYSeries imagSeries;
@ -344,6 +342,7 @@ public class CalculatorPlotFragment extends CalculatorFragment implements Calcul
}
}
});
}
uiHandler.postDelayed(pendingOperation.getObject(), millisToWait);

View File

@ -9,8 +9,7 @@ package org.solovyev.android.calculator.plot;
import org.achartengine.model.XYSeries;
import org.achartengine.util.MathHelper;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
/**
* User: serso