Permalink
Browse files

panning in graphs enabled

nl translations, more options on hold in history
  • Loading branch information...
1 parent 2d8fac7 commit f37b0430ed88e3c2208cf6109801b8fb9b211f12 @Xlythe committed Sep 19, 2012
View
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android2.calculator3"
- android:versionCode="19"
- android:versionName="1.7.3"
+ android:versionCode="21"
+ android:versionName="1.7.5"
android:installLocation="auto">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16"/>
@@ -42,4 +42,6 @@
<string name="advanced" msgid="7122495413742976492">"Geavanceerd"</string>
<string name="clear_history" msgid="8458043980601165012">"Geschiedenis wissen"</string>
<string name="text_copied_toast" msgid="5801480710472541833">"Tekst is gekopieerd."</string>
+ <string name="copy">Kopieer \"%s\"</string>
+ <string name="remove_from_history"> Verwijder uit geschiedenis </string>
</resources>
View
@@ -114,6 +114,8 @@
<string name="clear_history">Clear history</string>
<!-- Toast shown when text is copied to the clipboard. -->
<string name="text_copied_toast">Text copied.</string>
+ <!-- History menu item for copying item -->
+ <string name="copy">Copy \"%s\"</string>
<!-- History menu item for removing item from history -->
<string name="remove_from_history">Remove from history</string>
@@ -129,7 +129,7 @@ private XYMultipleSeriesRenderer buildRenderer(Context context) {
renderer.setLabelsColor(Color.LTGRAY);
renderer.setXLabels(20);
renderer.setYLabels(20);
- renderer.setPanEnabled(false, false);
+ renderer.setPanEnabled(true);
renderer.setZoomEnabled(true);
renderer.setShowGrid(true);
renderer.setZoomButtonsVisible(true);
@@ -15,7 +15,9 @@
public class HistoryTextView extends TextView {
private static final int COPY = 0;
- private static final int REMOVE = 1;
+ private static final int COPY_BASE = 1;
+ private static final int COPY_EDITED = 2;
+ private static final int REMOVE = 3;
private String[] mMenuItemsStrings;
private HistoryEntry mHistoryEntry;
private History mHistory;
@@ -37,8 +39,10 @@ public void onCreateContextMenu(ContextMenu menu) {
MenuHandler handler = new MenuHandler();
if (mMenuItemsStrings == null) {
Resources resources = getResources();
- mMenuItemsStrings = new String[2];
- mMenuItemsStrings[COPY] = resources.getString(android.R.string.copy) + " \"" + getText().toString() + "\"";
+ mMenuItemsStrings = new String[4];
+ mMenuItemsStrings[COPY] = String.format(resources.getString(R.string.copy), mHistoryEntry.getBase()+"="+mHistoryEntry.getEdited());
+ mMenuItemsStrings[COPY_BASE] = String.format(resources.getString(R.string.copy), mHistoryEntry.getBase());
+ mMenuItemsStrings[COPY_EDITED] = String.format(resources.getString(R.string.copy), mHistoryEntry.getEdited());
mMenuItemsStrings[REMOVE] = resources.getString(R.string.remove_from_history);
}
for (int i = 0; i < mMenuItemsStrings.length; i++) {
@@ -55,7 +59,15 @@ public boolean onMenuItemClick(MenuItem item) {
public boolean onTextContextMenuItem(CharSequence title) {
boolean handled = false;
if (TextUtils.equals(title, mMenuItemsStrings[COPY])) {
- copyContent();
+ copyContent(mHistoryEntry.getBase()+"="+mHistoryEntry.getEdited());
+ handled = true;
+ }
+ else if (TextUtils.equals(title, mMenuItemsStrings[COPY_BASE])) {
+ copyContent(mHistoryEntry.getBase());
+ handled = true;
+ }
+ else if (TextUtils.equals(title, mMenuItemsStrings[COPY_EDITED])) {
+ copyContent(mHistoryEntry.getEdited());
handled = true;
}
else if (TextUtils.equals(title, mMenuItemsStrings[REMOVE])) {
@@ -65,10 +77,10 @@ else if (TextUtils.equals(title, mMenuItemsStrings[REMOVE])) {
return handled;
}
- private void copyContent() {
+ private void copyContent(String content) {
ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(
Context.CLIPBOARD_SERVICE);
- clipboard.setPrimaryClip(ClipData.newPlainText(null, getText()));
+ clipboard.setPrimaryClip(ClipData.newPlainText(null, content));
Toast.makeText(getContext(), R.string.text_copied_toast, Toast.LENGTH_SHORT).show();
}
@@ -477,7 +477,7 @@ public void run() {
mSymbols.define(mX, x);
double y = mSymbols.eval(equation[1]);
- if(y>(maxY*2) || y<(minY*2) || y==Double.NaN) {
+ if(y>(maxY+((maxY-minY)*4)) || y<(minY-((maxY-minY)*4)) || y==Double.NaN) {
//If we're not exactly on the mark with a break in the graph, we get lines where we shouldn't like with y=1/x
//Better to be safe and just treat anything a lot larger than the min/max height to be a break then pray we're perfect and get NaN
series.add(x, MathHelper.NULL_VALUE);
@@ -502,7 +502,7 @@ else if(equation[0].equals(mX) && !equation[1].contains(mX)) {
mSymbols.define(mY, y);
double x = mSymbols.eval(equation[1]);
- if(x>(maxX*2) || x<(minX*2) || x==Double.NaN) {
+ if(x>(maxX+((maxX-minX)*4)) || x<(minX-((maxX-minX)*4)) || x==Double.NaN) {
series.add(MathHelper.NULL_VALUE, y);
}
else{
@@ -525,7 +525,7 @@ else if(equation[1].equals(mY) && !equation[0].contains(mY)) {
mSymbols.define(mX, x);
double y = mSymbols.eval(equation[0]);
- if(y>(maxY*2) || y<(minY*2) || y==Double.NaN) {
+ if(y>(maxY+((maxY-minY)*4)) || y<(minY-((maxY-minY)*4)) || y==Double.NaN) {
series.add(x, MathHelper.NULL_VALUE);
}
else{
@@ -548,7 +548,7 @@ else if(equation[1].equals(mX) && !equation[0].contains(mX)) {
mSymbols.define(mY, y);
double x = mSymbols.eval(equation[0]);
- if(x>(maxX*2) || x<(minX*2) || x==Double.NaN) {
+ if(x>(maxX+((maxX-minX)*4)) || x<(minX-((maxX-minX)*4)) || x==Double.NaN) {
series.add(MathHelper.NULL_VALUE, y);
}
else{

0 comments on commit f37b043

Please sign in to comment.