diff --git a/Calculator.iml b/Calculator.iml new file mode 100644 index 0000000..0bb6048 --- /dev/null +++ b/Calculator.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/Calculator1.iml b/Calculator1.iml new file mode 100644 index 0000000..0bb6048 --- /dev/null +++ b/Calculator1.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/app.iml b/app/app.iml new file mode 100644 index 0000000..5274ead --- /dev/null +++ b/app/app.iml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..a119470 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 22 + buildToolsVersion "22.0.1" + + defaultConfig { + applicationId "nyc.c4q.yuliyakaleda.calculator" + 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 'com.fathzer:javaluator:3.0.0' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..322d5c6 --- /dev/null +++ b/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/July/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/app/src/androidTest/java/nyc/c4q/yuliyakaleda/calculator/ApplicationTest.java b/app/src/androidTest/java/nyc/c4q/yuliyakaleda/calculator/ApplicationTest.java new file mode 100644 index 0000000..7ba1dfa --- /dev/null +++ b/app/src/androidTest/java/nyc/c4q/yuliyakaleda/calculator/ApplicationTest.java @@ -0,0 +1,13 @@ +package nyc.c4q.yuliyakaleda.calculator; + +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/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..ff98fb7 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,22 @@ + + + + + + > + + + + + + + + + diff --git a/app/src/main/assets/fonts/LOOPY.ttf b/app/src/main/assets/fonts/LOOPY.ttf new file mode 100644 index 0000000..52fbcb4 Binary files /dev/null and b/app/src/main/assets/fonts/LOOPY.ttf differ diff --git a/app/src/main/assets/fonts/digital-7.ttf b/app/src/main/assets/fonts/digital-7.ttf new file mode 100755 index 0000000..5dbe6f9 Binary files /dev/null and b/app/src/main/assets/fonts/digital-7.ttf differ diff --git a/app/src/main/assets/fonts/dotty.ttf b/app/src/main/assets/fonts/dotty.ttf new file mode 100644 index 0000000..4ce2814 Binary files /dev/null and b/app/src/main/assets/fonts/dotty.ttf differ diff --git a/app/src/main/assets/fonts/pocket_digital.ttf b/app/src/main/assets/fonts/pocket_digital.ttf new file mode 100755 index 0000000..adf78e1 Binary files /dev/null and b/app/src/main/assets/fonts/pocket_digital.ttf differ diff --git a/app/src/main/java/nyc/c4q/yuliyakaleda/calculator/MainActivity.java b/app/src/main/java/nyc/c4q/yuliyakaleda/calculator/MainActivity.java new file mode 100644 index 0000000..2ac1dab --- /dev/null +++ b/app/src/main/java/nyc/c4q/yuliyakaleda/calculator/MainActivity.java @@ -0,0 +1,657 @@ +package nyc.c4q.yuliyakaleda.calculator; + +import android.graphics.Typeface; +import android.media.MediaPlayer; +import android.os.Bundle; +import android.support.v7.app.ActionBarActivity; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.Switch; +import android.widget.TableLayout; +import android.widget.TextView; +import android.widget.Toast; +import android.widget.CompoundButton; +import android.widget.CompoundButton.OnCheckedChangeListener; + +import java.util.ArrayList; +import java.util.Random; + + +public class MainActivity extends ActionBarActivity { + + private static final String CHOSEN_THEME_ID = "chosen_theme_id"; + private static final String DISPLAY_COLOR_KEY = "colorChanges" ; + private static final String DISPLAY_BACKGROUND_COLOR="table_background_color"; + private static final String DISPLAY_FONT="display_font"; + + private static final String DISPLAY_RESULT_KEY = "displayResult"; + + TextView display; + + Button bClear; + Button bSum; + Button bSubtraction; + Button bDivision; + Button bMultiplication; + Button bDot; + Button bOpenParen; + Button bClosedParen; + Button bSin; + Button bCos; + Button bTan; + Button bLN; + Button bLog; + Button bOneDivideX; + Button bAbs; + Button bYToPowX; + Button bPI; + Button bE; + Button bEToPowX; + Button bXToPow2; + Button bEqual; + Button bPerCent; + Button bCurious; + + Button b1; + Button b2; + Button b3; + Button b4; + Button b5; + Button b6; + Button b7; + Button b8; + Button b9; + Button b0; + + + String result = "testing"; + + + private int chosenTheme = 0; + private int tableBackgroundColor = 0; + private String fontsFamily=""; + + private Switch soundSwitch; + MediaPlayer mMediaPlayer1; + MediaPlayer mMediaPlayer2; + MediaPlayer mMediaPlayer3; + MediaPlayer mMediaPlayer4; + MediaPlayer mMediaPlayer5; + + + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + if (savedInstanceState != null) { + chosenTheme = (int) savedInstanceState.get(CHOSEN_THEME_ID); + tableBackgroundColor = (int) savedInstanceState.get(DISPLAY_BACKGROUND_COLOR); + fontsFamily = (String) savedInstanceState.get(DISPLAY_FONT); + + if (chosenTheme > 0) { + setTheme(chosenTheme); + } + + } + + + setContentView(R.layout.activity_main); + +// now that the layout is specified, we can get the view items to change color + LinearLayout relativeLayout = (LinearLayout )findViewById(R.id.main_layout); + if (tableBackgroundColor != 0) { + + relativeLayout.setBackgroundColor(tableBackgroundColor); + } + + + display = (TextView) findViewById(R.id.enter_numbers); + + + + if (!fontsFamily.isEmpty()) { + Typeface typeFace=Typeface.createFromAsset(getAssets(),fontsFamily); + + display.setTypeface(typeFace); + + if(fontsFamily.equals("fonts/dotty.ttf")){ + + display.setTextSize(TypedValue.COMPLEX_UNIT_DIP,80); + + }else if (fontsFamily.equals("fonts/digital-7.ttf")){ + + display.setTextSize(TypedValue.COMPLEX_UNIT_DIP,50); + + }else { + display.setTextSize(TypedValue.COMPLEX_UNIT_DIP,40); + } + + + } + + soundSwitch = (Switch) findViewById(R.id.sound_switch); + + //set the switch to on + soundSwitch.setChecked(false); + //attach a listener to check for changes in state + soundSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { + + @Override + public void onCheckedChanged(CompoundButton buttonView, + boolean isChecked) { + + if(isChecked){ + + mMediaPlayer1.setVolume(1,1); + mMediaPlayer2.setVolume(1,1); + mMediaPlayer3.setVolume(1,1); + mMediaPlayer4.setVolume(1,1); + mMediaPlayer5.setVolume(1,1); + + }else{ + + mMediaPlayer1.setVolume(0,0); + mMediaPlayer2.setVolume(0,0); + mMediaPlayer3.setVolume(0,0); + mMediaPlayer4.setVolume(0,0); + mMediaPlayer5.setVolume(0,0); + } + + } + }); + + + ArrayList