diff --git a/ScientificCalculator/MyApplication/.gitignore b/ScientificCalculator/MyApplication/.gitignore new file mode 100644 index 0000000..afbdab3 --- /dev/null +++ b/ScientificCalculator/MyApplication/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/ScientificCalculator/MyApplication/.idea/.name b/ScientificCalculator/MyApplication/.idea/.name new file mode 100644 index 0000000..e7ea5e8 --- /dev/null +++ b/ScientificCalculator/MyApplication/.idea/.name @@ -0,0 +1 @@ +Scientific Calculator \ No newline at end of file diff --git a/ScientificCalculator/MyApplication/.idea/compiler.xml b/ScientificCalculator/MyApplication/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/ScientificCalculator/MyApplication/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/ScientificCalculator/MyApplication/.idea/copyright/profiles_settings.xml b/ScientificCalculator/MyApplication/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/ScientificCalculator/MyApplication/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/ScientificCalculator/MyApplication/.idea/encodings.xml b/ScientificCalculator/MyApplication/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/ScientificCalculator/MyApplication/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ScientificCalculator/MyApplication/.idea/gradle.xml b/ScientificCalculator/MyApplication/.idea/gradle.xml new file mode 100644 index 0000000..fe865d3 --- /dev/null +++ b/ScientificCalculator/MyApplication/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/ScientificCalculator/MyApplication/.idea/misc.xml b/ScientificCalculator/MyApplication/.idea/misc.xml new file mode 100644 index 0000000..59436c9 --- /dev/null +++ b/ScientificCalculator/MyApplication/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ScientificCalculator/MyApplication/.idea/modules.xml b/ScientificCalculator/MyApplication/.idea/modules.xml new file mode 100644 index 0000000..2e1012c --- /dev/null +++ b/ScientificCalculator/MyApplication/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ScientificCalculator/MyApplication/.idea/scopes/scope_settings.xml b/ScientificCalculator/MyApplication/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/ScientificCalculator/MyApplication/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/ScientificCalculator/MyApplication/.idea/vcs.xml b/ScientificCalculator/MyApplication/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/ScientificCalculator/MyApplication/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ScientificCalculator/MyApplication/MyApplication.iml b/ScientificCalculator/MyApplication/MyApplication.iml new file mode 100644 index 0000000..0bb6048 --- /dev/null +++ b/ScientificCalculator/MyApplication/MyApplication.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/ScientificCalculator/MyApplication/app/.gitignore b/ScientificCalculator/MyApplication/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/ScientificCalculator/MyApplication/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/ScientificCalculator/MyApplication/app/app.iml b/ScientificCalculator/MyApplication/app/app.iml new file mode 100644 index 0000000..22c39c8 --- /dev/null +++ b/ScientificCalculator/MyApplication/app/app.iml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ScientificCalculator/MyApplication/app/build.gradle b/ScientificCalculator/MyApplication/app/build.gradle new file mode 100644 index 0000000..98682ab --- /dev/null +++ b/ScientificCalculator/MyApplication/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 22 + buildToolsVersion "22.0.1" + + defaultConfig { + applicationId "abassawo.c4q.nyc.scientificcalculator" + minSdkVersion 15 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:22.1.1' +} diff --git a/ScientificCalculator/MyApplication/app/proguard-rules.pro b/ScientificCalculator/MyApplication/app/proguard-rules.pro new file mode 100644 index 0000000..dcb04d2 --- /dev/null +++ b/ScientificCalculator/MyApplication/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/c4q-Abass/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/ScientificCalculator/MyApplication/app/src/androidTest/java/abassawo/c4q/nyc/scientificcalculator/ApplicationTest.java b/ScientificCalculator/MyApplication/app/src/androidTest/java/abassawo/c4q/nyc/scientificcalculator/ApplicationTest.java new file mode 100644 index 0000000..d73ede3 --- /dev/null +++ b/ScientificCalculator/MyApplication/app/src/androidTest/java/abassawo/c4q/nyc/scientificcalculator/ApplicationTest.java @@ -0,0 +1,13 @@ +package abassawo.c4q.nyc.scientificcalculator; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/ScientificCalculator/MyApplication/app/src/main/AndroidManifest.xml b/ScientificCalculator/MyApplication/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..98852d4 --- /dev/null +++ b/ScientificCalculator/MyApplication/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/ScientificCalculator/MyApplication/app/src/main/java/abassawo/c4q/nyc/scientificcalculator/MainActivity.java b/ScientificCalculator/MyApplication/app/src/main/java/abassawo/c4q/nyc/scientificcalculator/MainActivity.java new file mode 100644 index 0000000..b9d245a --- /dev/null +++ b/ScientificCalculator/MyApplication/app/src/main/java/abassawo/c4q/nyc/scientificcalculator/MainActivity.java @@ -0,0 +1,39 @@ +package abassawo.c4q.nyc.scientificcalculator; + +import android.support.v7.app.ActionBarActivity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; + + +public class MainActivity extends ActionBarActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/ScientificCalculator/MyApplication/app/src/main/res/layout/activity_main.xml b/ScientificCalculator/MyApplication/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..5cec720 --- /dev/null +++ b/ScientificCalculator/MyApplication/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,9 @@ + + + + diff --git a/ScientificCalculator/MyApplication/app/src/main/res/menu/menu_main.xml b/ScientificCalculator/MyApplication/app/src/main/res/menu/menu_main.xml new file mode 100644 index 0000000..b1cb908 --- /dev/null +++ b/ScientificCalculator/MyApplication/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,6 @@ + + + diff --git a/ScientificCalculator/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.png b/ScientificCalculator/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..cde69bc Binary files /dev/null and b/ScientificCalculator/MyApplication/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/ScientificCalculator/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.png b/ScientificCalculator/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c133a0c Binary files /dev/null and b/ScientificCalculator/MyApplication/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/ScientificCalculator/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/ScientificCalculator/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..bfa42f0 Binary files /dev/null and b/ScientificCalculator/MyApplication/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/ScientificCalculator/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/ScientificCalculator/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..324e72c Binary files /dev/null and b/ScientificCalculator/MyApplication/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/ScientificCalculator/MyApplication/app/src/main/res/values-w820dp/dimens.xml b/ScientificCalculator/MyApplication/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/ScientificCalculator/MyApplication/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/ScientificCalculator/MyApplication/app/src/main/res/values/dimens.xml b/ScientificCalculator/MyApplication/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..47c8224 --- /dev/null +++ b/ScientificCalculator/MyApplication/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git a/ScientificCalculator/MyApplication/app/src/main/res/values/strings.xml b/ScientificCalculator/MyApplication/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..6f91701 --- /dev/null +++ b/ScientificCalculator/MyApplication/app/src/main/res/values/strings.xml @@ -0,0 +1,6 @@ + + "Scientific Calculator " + + Hello world! + Settings + diff --git a/ScientificCalculator/MyApplication/app/src/main/res/values/styles.xml b/ScientificCalculator/MyApplication/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..766ab99 --- /dev/null +++ b/ScientificCalculator/MyApplication/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/ScientificCalculator/MyApplication/build.gradle b/ScientificCalculator/MyApplication/build.gradle new file mode 100644 index 0000000..d3ff69d --- /dev/null +++ b/ScientificCalculator/MyApplication/build.gradle @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.1.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/ScientificCalculator/MyApplication/gradle.properties b/ScientificCalculator/MyApplication/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/ScientificCalculator/MyApplication/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/ScientificCalculator/MyApplication/gradle/wrapper/gradle-wrapper.jar b/ScientificCalculator/MyApplication/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/ScientificCalculator/MyApplication/gradle/wrapper/gradle-wrapper.jar differ diff --git a/ScientificCalculator/MyApplication/gradle/wrapper/gradle-wrapper.properties b/ScientificCalculator/MyApplication/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0c71e76 --- /dev/null +++ b/ScientificCalculator/MyApplication/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip diff --git a/ScientificCalculator/MyApplication/gradlew b/ScientificCalculator/MyApplication/gradlew new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/ScientificCalculator/MyApplication/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/ScientificCalculator/MyApplication/gradlew.bat b/ScientificCalculator/MyApplication/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/ScientificCalculator/MyApplication/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/ScientificCalculator/MyApplication/settings.gradle b/ScientificCalculator/MyApplication/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/ScientificCalculator/MyApplication/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/ScientificCalculator/README.md b/ScientificCalculator/README.md new file mode 100644 index 0000000..9844ba0 --- /dev/null +++ b/ScientificCalculator/README.md @@ -0,0 +1,12 @@ +Schedule + +May 5 - Initial Meet +May 6 - Work on basic layout - pair programming + +May 12 - Basic Calculator and Scientific Calculator graphics finalized +May 13 - meet-up + +May 19 - Ready Date - Basic app works and crash free +May 20 - Pre-Demo test and additional features +May 21 - Demo night + diff --git a/ScientificCalculator/ScientificCalculator_Build/.gitignore b/ScientificCalculator/ScientificCalculator_Build/.gitignore new file mode 100644 index 0000000..afbdab3 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/ScientificCalculator/ScientificCalculator_Build/.idea/.name b/ScientificCalculator/ScientificCalculator_Build/.idea/.name new file mode 100644 index 0000000..6851d01 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/.idea/.name @@ -0,0 +1 @@ +Scientific Calculator_Build \ No newline at end of file diff --git a/ScientificCalculator/ScientificCalculator_Build/.idea/compiler.xml b/ScientificCalculator/ScientificCalculator_Build/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/ScientificCalculator/ScientificCalculator_Build/.idea/copyright/profiles_settings.xml b/ScientificCalculator/ScientificCalculator_Build/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/ScientificCalculator/ScientificCalculator_Build/.idea/encodings.xml b/ScientificCalculator/ScientificCalculator_Build/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ScientificCalculator/ScientificCalculator_Build/.idea/gradle.xml b/ScientificCalculator/ScientificCalculator_Build/.idea/gradle.xml new file mode 100644 index 0000000..fe865d3 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/ScientificCalculator/ScientificCalculator_Build/.idea/inspectionProfiles/Project_Default.xml b/ScientificCalculator/ScientificCalculator_Build/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..1920283 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,14 @@ + + + + \ No newline at end of file diff --git a/ScientificCalculator/ScientificCalculator_Build/.idea/inspectionProfiles/profiles_settings.xml b/ScientificCalculator/ScientificCalculator_Build/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..3b31283 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/ScientificCalculator/ScientificCalculator_Build/.idea/misc.xml b/ScientificCalculator/ScientificCalculator_Build/.idea/misc.xml new file mode 100644 index 0000000..59436c9 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ScientificCalculator/ScientificCalculator_Build/.idea/modules.xml b/ScientificCalculator/ScientificCalculator_Build/.idea/modules.xml new file mode 100644 index 0000000..433c815 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ScientificCalculator/ScientificCalculator_Build/.idea/scopes/scope_settings.xml b/ScientificCalculator/ScientificCalculator_Build/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/ScientificCalculator/ScientificCalculator_Build/.idea/vcs.xml b/ScientificCalculator/ScientificCalculator_Build/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ScientificCalculator/ScientificCalculator_Build/ScientificCalculator_Build.iml b/ScientificCalculator/ScientificCalculator_Build/ScientificCalculator_Build.iml new file mode 100644 index 0000000..0bb6048 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/ScientificCalculator_Build.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/ScientificCalculator/ScientificCalculator_Build/app/.gitignore b/ScientificCalculator/ScientificCalculator_Build/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/ScientificCalculator/ScientificCalculator_Build/app/app.iml b/ScientificCalculator/ScientificCalculator_Build/app/app.iml new file mode 100644 index 0000000..425f97e --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/app/app.iml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ScientificCalculator/ScientificCalculator_Build/app/build.gradle b/ScientificCalculator/ScientificCalculator_Build/app/build.gradle new file mode 100644 index 0000000..b4d124d --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/app/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 22 + buildToolsVersion "22.0.1" + + defaultConfig { + applicationId "abassawo.c4q.nyc.scientificcalculator_build" + minSdkVersion 15 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:22.1.1' + compile files('libs/Javaluator-v3.0.0 2/javaluator-3.0.0.jar') +} diff --git a/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-3.0.0-javadoc.jar b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-3.0.0-javadoc.jar new file mode 100644 index 0000000..48d78d2 Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-3.0.0-javadoc.jar differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-3.0.0-sources.jar b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-3.0.0-sources.jar new file mode 100644 index 0000000..7da1c98 Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-3.0.0-sources.jar differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-3.0.0.jar b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-3.0.0.jar new file mode 100644 index 0000000..a70ae9c Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-3.0.0.jar differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-demo-2.1.0-sources.jar b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-demo-2.1.0-sources.jar new file mode 100644 index 0000000..efe094f Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-demo-2.1.0-sources.jar differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-demo-2.1.0.jar b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-demo-2.1.0.jar new file mode 100755 index 0000000..6379332 Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-demo-2.1.0.jar differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-examples-2.1.0-javadoc.jar b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-examples-2.1.0-javadoc.jar new file mode 100644 index 0000000..c466d68 Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-examples-2.1.0-javadoc.jar differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-examples-2.1.0-sources.jar b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-examples-2.1.0-sources.jar new file mode 100644 index 0000000..52d0a49 Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-examples-2.1.0-sources.jar differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-examples-2.1.0.jar b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-examples-2.1.0.jar new file mode 100644 index 0000000..8aa3941 Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/javaluator-examples-2.1.0.jar differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/license.html b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/license.html new file mode 100644 index 0000000..4df4d30 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/license.html @@ -0,0 +1,19 @@ + + +License + + + +This +program is free software: you can redistribute it and/or modify it +under the terms of the GNU Lesser General Public License as published +by the +Free Software Foundation, either version 3 of the License, or (at your +option) any later version.
+
+This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even the +implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU Lesser General +Public License for more details.
+ \ No newline at end of file diff --git a/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/original-javaluator-demo-2.1.0.jar b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/original-javaluator-demo-2.1.0.jar new file mode 100755 index 0000000..80eea69 Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/libs/Javaluator-v3.0.0 2/original-javaluator-demo-2.1.0.jar differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/proguard-rules.pro b/ScientificCalculator/ScientificCalculator_Build/app/proguard-rules.pro new file mode 100644 index 0000000..dcb04d2 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/c4q-Abass/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/ScientificCalculator/ScientificCalculator_Build/app/src/androidTest/java/abassawo/c4q/nyc/scientificcalculator_build/ApplicationTest.java b/ScientificCalculator/ScientificCalculator_Build/app/src/androidTest/java/abassawo/c4q/nyc/scientificcalculator_build/ApplicationTest.java new file mode 100644 index 0000000..bffe20f --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/app/src/androidTest/java/abassawo/c4q/nyc/scientificcalculator_build/ApplicationTest.java @@ -0,0 +1,13 @@ +package abassawo.c4q.nyc.scientificcalculator_build; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/ScientificCalculator/ScientificCalculator_Build/app/src/main/AndroidManifest.xml b/ScientificCalculator/ScientificCalculator_Build/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..fe02887 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/app/src/main/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + diff --git a/ScientificCalculator/ScientificCalculator_Build/app/src/main/java/abassawo/c4q/nyc/scientificcalculator_build/MainActivity.java b/ScientificCalculator/ScientificCalculator_Build/app/src/main/java/abassawo/c4q/nyc/scientificcalculator_build/MainActivity.java new file mode 100644 index 0000000..f45ba57 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/app/src/main/java/abassawo/c4q/nyc/scientificcalculator_build/MainActivity.java @@ -0,0 +1,433 @@ +package abassawo.c4q.nyc.scientificcalculator_build; + +import android.app.Activity; +import android.content.res.Configuration; +import android.support.v7.app.ActionBarActivity; +import android.os.Bundle; +import android.text.Layout; +import android.text.method.ScrollingMovementMethod; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.Button; +import android.widget.ImageButton; +import android.widget.TextView; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.math.MathContext; +import java.text.DecimalFormat; +import java.util.Iterator; + +import com.fathzer.soft.javaluator.Constant; +import com.fathzer.soft.javaluator.DoubleEvaluator; +import com.fathzer.soft.javaluator.Function; +import com.fathzer.soft.javaluator.Operator; +import com.fathzer.soft.javaluator.Parameters; + +public class MainActivity extends Activity implements Serializable{ + private String expression, calcExpr; //expression is for Human Display. calcExpr is for calculator to calculate. + private TextView calcDisplay, answerDisplay; //together, both displays show expression and answer below. (see xml) + private Button equalsButton; + DoubleEvaluator expressionEvaluator; + private String delString; + private double result; + private String resultStr, ANS; + private Button radButton; + private static final Operator factorial = new Operator("!", 2, Operator.Associativity.LEFT, 3); //symbol, operand count, associativity, and precedence) + private static final Function sqrt = new Function("√", 1); + private static final Function SINE = new Function("sin", 1); + private static final Function COSINE = new Function("sin", 1); + private static final Function TANGENT = new Function("sin", 1); + + // if (function == SINE){ +// double sinResult = 0; +// if (radButton.isSelected()){ +// try { +// double x = Math.toDegrees((Double.parseDouble(argument))); +// String xString = String.valueOf(x); +// sinResult = expressionEvaluator.evaluate("sin"+(xString)); +// } catch (RuntimeException e){ +// System.out.println("err"); +// } +// } + + @Override + protected void onSaveInstanceState(Bundle outState){ + super.onSaveInstanceState(outState); + outState.putString("expressionStr", expression); + outState.putString("ANS", ANS); + outState.putString("resultStr", resultStr); + } + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Parameters params = DoubleEvaluator.getDefaultParameters(); + params.add(sqrt); + params.add(factorial); + + if ( (savedInstanceState != null)) { + //Restore value of members from saved state + expression = savedInstanceState.getString("expressionStr"); + ANS = savedInstanceState.getString("ANS"); + resultStr = savedInstanceState.getString("resultStr"); + } + else { + + expression = ""; + ANS= ""; + } + + + try { + expressionEvaluator = new DoubleEvaluator(params) { + @Override + protected Double evaluate(Operator operator, Iterator operands, Object evaluationContext) { + double facResult = 1; + if (operator == factorial) { + double num = operands.next(); + for (double i = num; i >= 1; i--) { + facResult = facResult * i; + } + return facResult; + } else { + return super.evaluate(operator, operands, evaluationContext); + } + //if toggle button is selected...convert all sins to radian + + + } + + @Override + public Double evaluate(Function function, Iterator arguments, Object evaluationContext) { + radButton = (Button) findViewById(R.id.togglebutton); + if (function == sqrt) { + // Implements the new function + return Math.sqrt((double) arguments.next()); + } + + + else { + // If it's another function, pass it to DoubleEvaluator + return super.evaluate(function, arguments, evaluationContext); + } + } + + }; + } + catch (IllegalArgumentException e){ + + } + + final DecimalFormat doubleFormat = new DecimalFormat("0.000"); + + + answerDisplay = (TextView) findViewById(R.id.tvAnswer); + calcDisplay = (TextView) findViewById(R.id.tvExpression); + calcDisplay.setMovementMethod(new ScrollingMovementMethod()); + equalsButton = (Button) findViewById(R.id.equalsButton); + equalsButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("expression", expression); + + try { + if (expression.contains("!") ){ + String factorialExp = expression.replace("!", "!1 "); + calcExpr = factorialExp; + } else if (expression.contains("%")){ + calcExpr = expression.replace("%", "* .01"); //calculate percent.) + } else { + calcExpr = expression; + } + result = (expressionEvaluator.evaluate(calcExpr)); + + Log.d("expr to be calculated", calcExpr); + resultStr = String.valueOf(result); + + + Log.d("test string", "resultStr"); + if ( (resultStr.contains(".")) && (resultStr.endsWith("00") )){ + //resultStr = resultStr.replace("00000", ""); + resultStr = resultStr.replace("00", ""); + answerDisplay.setText("=" + resultStr); //exper + } + + else { + answerDisplay.setText("" + resultStr); //perhaps format this for maximum # of digits after decimal place. "0.000" + // clear content for new calculations, unless an operation sign is selected. see comment above. + } + Log.d("calc Expr", calcExpr); + + } catch (IllegalArgumentException e) { + answerDisplay.setText("err"); //experimental. + } + catch (NullPointerException e){ + answerDisplay.setText("err"); + } + expression = String.valueOf(resultStr); //for user convenience when an operation is pressed. + + expression = ""; //to prevent repeated text. + ANS = resultStr; //stored answer for user. + } + }); + + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } + + public void onOperationClick(View v){ + + switch (v.getId()) { + case R.id.delButton: + + delString = calcDisplay.getText().toString(); + ImageButton backspace = (ImageButton) findViewById(R.id.delButton); + if (backspace != null) { + if (delString.length() > 0) { + delString = delString.substring(0, delString.length() - 1); + expression = delString; + } else if (delString == resultStr) { + expression = ""; + } else { + backspace.setClickable(false); //stop clicking! no more text! + } + calcDisplay.setText(expression); + } + break; + case R.id.minusButton: + if (expression == "" && ANS != null) { + expression += (ANS + "-"); + calcDisplay.setText(expression); + } else { + expression += ("" + "-"); + calcDisplay.setText(expression); + } + break; + case R.id.plusButton: + if (expression == "" && ANS != null) { + expression += (ANS + "+"); + calcDisplay.setText(expression); + } else { + expression += ("" + "+"); + calcDisplay.setText(expression); + } + break; + + case R.id.xButton: + if (expression == "" && ANS != null) { + expression += (ANS + "+"); + calcDisplay.setText(expression); + } else { + expression += ("" + '*'); + calcDisplay.setText(expression); + } + break; + case R.id.divButton: + if (expression == "" && ANS != null) { + expression += (ANS + "+"); + calcDisplay.setText(expression); + } else { + expression += ("" + '/'); + calcDisplay.setText(expression); + } + break; + case R.id.ansButton: + if (ANS == null) { + expression += ""; + calcDisplay.setText(""); + } else if (expression.equals(ANS)) {//works + calcDisplay.setText(expression); + } else { + expression += ANS; + calcDisplay.setText(expression); + } + break; + } + answerDisplay.setText(""); + } + + public void onNumbersClicked(View v) { + switch (v.getId()) { + case R.id.zeroButton: + expression += ("" + 0); + break; + case R.id.oneButton: + expression += ("" + 1); + break; + case R.id.twoButton: + expression += ("" + 2); + break; + case R.id.threeButton: + expression += ("" + 3); + break; + case R.id.fourButton: + expression += ("" + 4); + break; + case R.id.fiveButton: + expression += ("" + 5); + break; + case R.id.sixButton: + expression += ("" + 6); + break; + case R.id.sevenButton: + expression += ("" + 7); + break; + case R.id.eightButton: + expression += ("" + 8); + break; + case R.id.nineButton: + expression += ("" + 9); + break; + } + calcDisplay.setText(expression); + answerDisplay.setText(""); + } + + public void onButtonClick(View v) { + switch (v.getId()) { + case R.id.roundButton: + expression += "round("; + break; + case R.id.decimalButton: + Button decimalButton = (Button) findViewById(R.id.decimalButton); + expression += ("" + '.'); + break; + case R.id.openParensButton: + Button openParensButton = (Button) findViewById(R.id.openParensButton); + expression += ("" + '('); + break; + case R.id.closeParensButton: + Button closeParensButton = (Button) findViewById(R.id.closeParensButton); + expression += ("" + ')'); + break; + case R.id.piButton: + Button piButton = (Button) findViewById(R.id.piButton); + expression += ("pi"); + break; + case R.id.sinButton: + Button sinButton = (Button) findViewById(R.id.sinButton); + expression += ("sin("); + break; + case R.id.cosButton: + Button cosButton = (Button) findViewById(R.id.cosButton); + expression += ("cos("); + break; + case R.id.tanButton: + Button tanButton = (Button) findViewById(R.id.tanButton); + expression += ("tan("); + break; + case R.id.lnButton: + Button lnButton = (Button) findViewById(R.id.lnButton); + expression += ("ln("); + break; + case R.id.exp_EXPButton: + Button expButton = (Button) findViewById(R.id.exp_EXPButton); + if (expression == "" && ANS != null) { + expression += (ANS + "^"); + calcDisplay.setText(expression); + } else { + expression += ("^"); + } + break; + case R.id.eButton: + Button eButton = (Button) findViewById(R.id.eButton); + expression += ("e"); + break; + case R.id.logButton: + Button logButton = (Button) findViewById(R.id.logButton); + expression += ("log("); + break; + case R.id.sqrtButton: + Button sqrtButton = (Button) findViewById(R.id.sqrtButton); + expression += ("√("); + break; + case R.id.factorialButton: + Button facButton = (Button) findViewById(R.id.factorialButton); + expression += ("!"); + //} + break; + case R.id.pctSignButton: + Button pctButton = (Button) findViewById(R.id.pctSignButton); + expression += ("%"); + break; + case R.id.invButton: + Button invButton = (Button) findViewById(R.id.invButton); + expression += ("1/"); + break; + case R.id.cancelButton: + Button clearButton = (Button) findViewById(R.id.cancelButton); + if (clearButton != null) { + calcExpr = ""; + expression = ""; + + } + break; + } + calcDisplay.setText(expression); + answerDisplay.setText(""); + + } + + public void onToggleClicked(View v){ + resultStr = ANS; + try { + expression = calcDisplay.getText().toString(); + if (expression.contains("sin(")) { + result = expressionEvaluator.evaluate(expression); + + result = (Math.sin(Math.toDegrees(result)*(Math.PI/180))); + //result = Math.asin(result); + +// + answerDisplay.setText("" + result); + + } else if (expression.contains("cos")){ + result = expressionEvaluator.evaluate(expression); + + + result = (Math.cos(Math.toDegrees(result)*(Math.PI/180))); + answerDisplay.setText("" + result); + + + } else if (expression.contains("tan")){ + + result = (Math.tan(Math.toDegrees(result)*(Math.PI/180))); + answerDisplay.setText("" + result); + + + } + } + catch (IllegalStateException e){ + + } + + } + + +} diff --git a/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable-hdpi/ic_action_backspace.png b/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable-hdpi/ic_action_backspace.png new file mode 100644 index 0000000..5980431 Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable-hdpi/ic_action_backspace.png differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable-mdpi/ic_action_backspace.png b/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable-mdpi/ic_action_backspace.png new file mode 100644 index 0000000..2046071 Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable-mdpi/ic_action_backspace.png differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable-xhdpi/ic_action_backspace.png b/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable-xhdpi/ic_action_backspace.png new file mode 100644 index 0000000..50caef1 Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable-xhdpi/ic_action_backspace.png differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable-xxhdpi/ic_action_backspace.png b/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable-xxhdpi/ic_action_backspace.png new file mode 100644 index 0000000..b4e4a73 Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable-xxhdpi/ic_action_backspace.png differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable/ic_action_backspace.png b/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable/ic_action_backspace.png new file mode 100644 index 0000000..5980431 Binary files /dev/null and b/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/drawable/ic_action_backspace.png differ diff --git a/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/layout-land/activity_main.xml b/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/layout-land/activity_main.xml new file mode 100644 index 0000000..2e28332 --- /dev/null +++ b/ScientificCalculator/ScientificCalculator_Build/app/src/main/res/layout-land/activity_main.xml @@ -0,0 +1,411 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +