-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new functionality with trigonometry
- Loading branch information
root
committed
Nov 9, 2016
1 parent
9e8baf2
commit 9ee124f
Showing
23 changed files
with
783 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
app/src/main/java/tv/tvquetzachapin/graphfunctions/Activites/CatActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package tv.tvquetzachapin.graphfunctions.Activites; | ||
|
||
import android.os.Bundle; | ||
import android.support.design.widget.FloatingActionButton; | ||
import android.support.design.widget.Snackbar; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.Toolbar; | ||
import android.view.View; | ||
import android.widget.EditText; | ||
import android.widget.TextView; | ||
|
||
import org.mariuszgromada.math.mxparser.Argument; | ||
import org.mariuszgromada.math.mxparser.Expression; | ||
|
||
import tv.tvquetzachapin.graphfunctions.R; | ||
|
||
public class CatActivity extends AppCompatActivity { | ||
|
||
private EditText cat3, cat4; | ||
private TextView txtR1; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_cat); | ||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
setSupportActionBar(toolbar); | ||
|
||
cat3 = (EditText) findViewById(R.id.ct4); | ||
cat4 = (EditText) findViewById(R.id.ct5); | ||
txtR1 = (TextView) findViewById(R.id.txtCat); | ||
|
||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | ||
fab.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
|
||
String firstValue = cat3.getText().toString(); | ||
String secondValue = cat4.getText().toString(); | ||
|
||
Argument x = new Argument("x = " + firstValue); | ||
Argument y = new Argument("y = " + secondValue); | ||
Expression e = new Expression("(y)^2-(x)^2", x,y); | ||
|
||
Double rst = e.calculate(); | ||
|
||
Argument rz = new Argument("r = " + rst); | ||
Expression raiz = new Expression("sqrt(r)",rz); | ||
|
||
String rzm = Double.toString(raiz.calculate()); | ||
|
||
txtR1.setText(rzm.substring(0, 2)); | ||
|
||
//Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) | ||
//.setAction("Action", null).show(); | ||
} | ||
}); | ||
} | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
app/src/main/java/tv/tvquetzachapin/graphfunctions/Activites/HipActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package tv.tvquetzachapin.graphfunctions.Activites; | ||
|
||
import android.os.Bundle; | ||
import android.support.design.widget.FloatingActionButton; | ||
import android.support.design.widget.Snackbar; | ||
import android.support.design.widget.TextInputLayout; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.Toolbar; | ||
import android.view.View; | ||
import android.widget.EditText; | ||
import android.widget.TextView; | ||
|
||
import org.mariuszgromada.math.mxparser.Argument; | ||
import org.mariuszgromada.math.mxparser.Expression; | ||
|
||
import tv.tvquetzachapin.graphfunctions.R; | ||
|
||
public class HipActivity extends AppCompatActivity { | ||
|
||
private EditText cat1, cat2; | ||
private TextView txtR; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_hip); | ||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
setSupportActionBar(toolbar); | ||
|
||
cat1 = (EditText) findViewById(R.id.ct1); | ||
cat2 = (EditText) findViewById(R.id.ct2); | ||
txtR = (TextView) findViewById(R.id.txtHip); | ||
|
||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | ||
fab.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
|
||
String firstValue = cat1.getText().toString(); | ||
String secondValue = cat2.getText().toString(); | ||
|
||
Argument x = new Argument("x = " + firstValue); | ||
Argument y = new Argument("y = " + secondValue); | ||
Expression e = new Expression("(x)^2+(y)^2", x,y); | ||
|
||
Double rst = e.calculate(); | ||
|
||
Argument rz = new Argument("r = " + rst); | ||
Expression raiz = new Expression("sqrt(r)",rz); | ||
|
||
String rzm = Double.toString(raiz.calculate()); | ||
|
||
txtR.setText(rzm.substring(0, 2)); | ||
|
||
//Snackbar.make(view, "The value is: " + rzm, Snackbar.LENGTH_LONG) | ||
//.setAction("Action", null).show(); | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
app/src/main/java/tv/tvquetzachapin/graphfunctions/Activites/TrigonometricActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package tv.tvquetzachapin.graphfunctions.Activites; | ||
|
||
import android.content.Intent; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
|
||
import tv.tvquetzachapin.graphfunctions.R; | ||
|
||
public class TrigonometricActivity extends AppCompatActivity { | ||
|
||
Button btnHip, btnCat; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_trigonometric); | ||
|
||
btnHip = (Button)findViewById(R.id.btnHipotenusa); | ||
btnCat = (Button)findViewById(R.id.btnCat); | ||
|
||
btnHip.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
Intent intHip = new Intent(TrigonometricActivity.this, HipActivity.class); | ||
startActivity(intHip); | ||
} | ||
}); | ||
|
||
btnCat.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
Intent intCat = new Intent(TrigonometricActivity.this, CatActivity.class); | ||
startActivity(intCat); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android" > | ||
<item android:state_pressed="true" > | ||
<shape android:shape="rectangle" > | ||
<corners android:radius="3dip" /> | ||
<stroke android:width="1dip" android:color="#d32f2d" /> | ||
<gradient android:angle="-90" android:startColor="#f44336" android:endColor="#d32f2f" /> | ||
</shape> | ||
</item> | ||
<item android:state_focused="true"> | ||
<shape android:shape="rectangle" > | ||
<corners android:radius="3dip" /> | ||
<stroke android:width="1dip" android:color="#ffcdd2" /> | ||
<solid android:color="#ffcdd2"/> | ||
</shape> | ||
</item> | ||
<item > | ||
<shape android:shape="rectangle" > | ||
<corners android:radius="3dip" /> | ||
<stroke android:width="1dip" android:color="#d32f2d" /> | ||
<gradient android:angle="-90" android:startColor="#f44336" android:endColor="#d32f2f" /> | ||
</shape> | ||
</item> | ||
</selector> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:fitsSystemWindows="true" | ||
tools:context="tv.tvquetzachapin.graphfunctions.Activites.CatActivity"> | ||
|
||
<android.support.design.widget.AppBarLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:theme="@style/AppTheme.AppBarOverlay"> | ||
|
||
<android.support.v7.widget.Toolbar | ||
android:id="@+id/toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="?attr/actionBarSize" | ||
android:background="?attr/colorPrimary" | ||
app:popupTheme="@style/AppTheme.PopupOverlay" /> | ||
|
||
</android.support.design.widget.AppBarLayout> | ||
|
||
<include layout="@layout/content_cat" /> | ||
|
||
<android.support.design.widget.FloatingActionButton | ||
android:id="@+id/fab" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="bottom|end" | ||
android:layout_margin="@dimen/fab_margin" | ||
app:srcCompat="@android:drawable/ic_dialog_email" /> | ||
|
||
</android.support.design.widget.CoordinatorLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:fitsSystemWindows="true" | ||
tools:context="tv.tvquetzachapin.graphfunctions.Activites.HipActivity"> | ||
|
||
<android.support.design.widget.AppBarLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:theme="@style/AppTheme.AppBarOverlay"> | ||
|
||
<android.support.v7.widget.Toolbar | ||
android:id="@+id/toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="?attr/actionBarSize" | ||
android:background="?attr/colorPrimary" | ||
app:popupTheme="@style/AppTheme.PopupOverlay" /> | ||
|
||
</android.support.design.widget.AppBarLayout> | ||
|
||
<include layout="@layout/content_hip" /> | ||
|
||
<android.support.design.widget.FloatingActionButton | ||
android:id="@+id/fab" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="bottom|end" | ||
android:layout_margin="@dimen/fab_margin" | ||
app:srcCompat="@android:drawable/ic_dialog_email" /> | ||
|
||
</android.support.design.widget.CoordinatorLayout> |
Oops, something went wrong.