├── .gitignore
├── .gradle
├── 1.12
│ └── taskArtifacts
│ │ ├── cache.properties
│ │ ├── cache.properties.lock
│ │ ├── fileHashes.bin
│ │ ├── fileSnapshots.bin
│ │ ├── outputFileStates.bin
│ │ └── taskArtifacts.bin
├── 2.2.1
│ └── taskArtifacts
│ │ ├── cache.properties
│ │ ├── cache.properties.lock
│ │ ├── fileHashes.bin
│ │ ├── fileSnapshots.bin
│ │ ├── outputFileStates.bin
│ │ └── taskArtifacts.bin
└── 2.8
│ └── taskArtifacts
│ ├── cache.properties
│ ├── cache.properties.lock
│ ├── fileHashes.bin
│ ├── fileSnapshots.bin
│ ├── outputFileStates.bin
│ └── taskArtifacts.bin
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── build.gradle
├── libs
│ └── symja-2015-08-09.jar
├── manifest-merger-release-report.txt
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── trutechinnovations
│ │ └── calculall
│ │ ├── AboutActivity.java
│ │ ├── Advanced.java
│ │ ├── AdvancedFragment.java
│ │ ├── Basic.java
│ │ ├── BasicFragment.java
│ │ ├── Bracket.java
│ │ ├── BracketFactory.java
│ │ ├── Command.java
│ │ ├── Complex.java
│ │ ├── Constant.java
│ │ ├── ConstantFactory.java
│ │ ├── ConstantsActivity.java
│ │ ├── DecompositionSelectionActivity.java
│ │ ├── Digit.java
│ │ ├── DigitFactory.java
│ │ ├── DisplayView.java
│ │ ├── ExpressionFactory.java
│ │ ├── Function.java
│ │ ├── FunctionFactory.java
│ │ ├── FunctionFragment.java
│ │ ├── FunctionMode.java
│ │ ├── GraphView.java
│ │ ├── GridViewItem.java
│ │ ├── HistoryActivity.java
│ │ ├── JFok.java
│ │ ├── ListViewActivity.java
│ │ ├── MainActivity.java
│ │ ├── MathUtilities.java
│ │ ├── Matrix.java
│ │ ├── MatrixFragment.java
│ │ ├── MatrixFunction.java
│ │ ├── MatrixFunctionFactory.java
│ │ ├── MatrixMode.java
│ │ ├── MatrixOperator.java
│ │ ├── MatrixOperatorFactory.java
│ │ ├── MatrixUtils.java
│ │ ├── MultiButton.java
│ │ ├── NaturalView.java
│ │ ├── Node.java
│ │ ├── Number.java
│ │ ├── NumberTooLargeException.java
│ │ ├── Operator.java
│ │ ├── OperatorFactory.java
│ │ ├── OrderComparable.java
│ │ ├── OutputView.java
│ │ ├── Placeholder.java
│ │ ├── PlaceholderFactory.java
│ │ ├── ReductionActivity.java
│ │ ├── SettingsActivity.java
│ │ ├── StringToken.java
│ │ ├── ThemeHelper.java
│ │ ├── ThemeSelectActivity.java
│ │ ├── Token.java
│ │ ├── Utility.java
│ │ ├── Variable.java
│ │ ├── VariableFactory.java
│ │ ├── Vector.java
│ │ ├── VectorFragment.java
│ │ ├── VectorFunction.java
│ │ ├── VectorFunctionFactory.java
│ │ ├── VectorMode.java
│ │ ├── VectorOperator.java
│ │ ├── VectorOperatorFactory.java
│ │ └── VectorUtilities.java
│ └── res
│ ├── drawable-hdpi
│ ├── Thumbs.db
│ ├── drawable
│ │ ├── button_light_trailblazer.xml
│ │ ├── change_black.png
│ │ ├── change_white.png
│ │ ├── frac_black.png
│ │ ├── frac_white.png
│ │ ├── history_black.png
│ │ ├── history_white.png
│ │ ├── ic_launcher.png
│ │ ├── settings_black.png
│ │ ├── settings_white.png
│ │ ├── toggle_alston.xml
│ │ ├── toggle_panda.xml
│ │ ├── toggle_trailblazer.xml
│ │ └── trutech.png
│ ├── ic_action_assignment.png
│ ├── ic_action_assignment_black.png
│ ├── ic_action_settings.png
│ ├── ic_action_settings_black.png
│ ├── ic_change.png
│ ├── ic_change_black.png
│ ├── ic_frac_black.png
│ ├── ic_frac_white.png
│ └── ic_launcher.png
│ ├── drawable-mdpi
│ ├── ic_action_assignment.png
│ ├── ic_action_assignment_black.png
│ ├── ic_action_settings.png
│ ├── ic_action_settings_black.png
│ ├── ic_change.png
│ ├── ic_change_black.png
│ ├── ic_frac_black.png
│ ├── ic_frac_white.png
│ └── ic_launcher.png
│ ├── drawable-v21
│ ├── ripple_button.xml
│ └── ripple_button_dark.xml
│ ├── drawable-xhdpi
│ ├── Thumbs.db
│ ├── ic_action_assignment.png
│ ├── ic_action_assignment_black.png
│ ├── ic_action_settings.png
│ ├── ic_action_settings_black.png
│ ├── ic_change.png
│ ├── ic_change_black.png
│ ├── ic_frac_black.png
│ ├── ic_frac_white.png
│ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ ├── ic_action_assignment.png
│ ├── ic_action_assignment_black.png
│ ├── ic_action_settings.png
│ ├── ic_action_settings_black.png
│ ├── ic_change.png
│ ├── ic_change_black.png
│ ├── ic_frac_black.png
│ ├── ic_frac_white.png
│ └── ic_launcher.png
│ ├── drawable-xxxhdpi
│ └── ic_launcher.png
│ ├── drawable
│ ├── change_black.png
│ ├── change_white.png
│ ├── eigenvector.png
│ ├── frac_black.png
│ ├── frac_white.png
│ ├── history_black.png
│ ├── history_white.png
│ ├── ic_launcher.png
│ ├── ripple_button.xml
│ ├── ripple_button_dark.xml
│ ├── settings_black.png
│ ├── settings_white.png
│ ├── trutech.png
│ └── vector.png
│ ├── layout
│ ├── about_page.xml
│ ├── advanced.xml
│ ├── basic.xml
│ ├── constants_element.xml
│ ├── constants_view.xml
│ ├── decomposition_element.xml
│ ├── decomposition_view.xml
│ ├── element.xml
│ ├── element_layout.xml
│ ├── elements_layout.xml
│ ├── frame.xml
│ ├── function.xml
│ ├── graph_dialog.xml
│ ├── graph_view.xml
│ ├── history_activity.xml
│ ├── history_element.xml
│ ├── matrix.xml
│ ├── matrix_num.xml
│ ├── reduction_element.xml
│ ├── reduction_view.xml
│ ├── settings.xml
│ ├── spinner_item.xml
│ ├── theme_item.xml
│ ├── themes_select.xml
│ └── vector.xml
│ ├── menu
│ ├── matrix_mode.xml
│ ├── menu_settings.xml
│ ├── ocrmode.xml
│ └── vector.xml
│ ├── res
│ ├── drawable-hdpi
│ │ └── ic_action_done.png
│ ├── drawable-mdpi
│ │ └── ic_action_done.png
│ ├── drawable-xhdpi
│ │ └── ic_action_done.png
│ ├── drawable-xxhdpi
│ │ └── ic_action_done.png
│ └── drawable-xxxhdpi
│ │ └── ic_action_done.png
│ ├── values-v21
│ └── styles.xml
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── attr.xml
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ ├── styles.xml
│ └── themes.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── import-summary.txt
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | app/CalculallKey.jks
2 | app/CalculallKeyAf.jks
3 | app/CalculallKeyAlpha.jks
4 |
5 | .idea/*
6 | gradle/*
7 | gradlew
8 | gradlew.bat
9 | local.properties
10 |
11 | # Built application files
12 | *.apk
13 | *.ap_
14 |
15 | # Files for the ART/Dalvik VM
16 | *.dex
17 |
18 | # Java class files
19 | *.class
20 |
21 | # Generated files
22 | bin/
23 | gen/
24 | out/
25 |
26 | # Gradle files
27 | .gradle/
28 | build/
29 |
30 | # Local configuration file (sdk path, etc)
31 | local.properties
32 |
33 | # Proguard folder generated by Eclipse
34 | proguard/
35 |
36 | # Log Files
37 | *.log
38 |
39 | # Android Studio Navigation editor temp files
40 | .navigation/
41 |
42 | # Android Studio captures folder
43 | captures/
44 |
45 | # Intellij
46 | *.iml
47 | .idea/workspace.xml
48 | .idea/tasks.xml
49 | .idea/gradle.xml
50 | .idea/libraries
51 |
52 | # Keystore files
53 | *.jks
54 |
55 | # External native build folder generated in Android Studio 2.2 and later
56 | .externalNativeBuild
57 |
58 | # Release apk
59 | app/app-release.apk
60 |
61 | # Build files
62 | app/build/
63 |
64 | # IntelliJ
65 | *.iml
66 |
--------------------------------------------------------------------------------
/.gradle/1.12/taskArtifacts/cache.properties:
--------------------------------------------------------------------------------
1 | #Sun Jul 27 23:10:24 EDT 2014
2 |
--------------------------------------------------------------------------------
/.gradle/1.12/taskArtifacts/cache.properties.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/1.12/taskArtifacts/cache.properties.lock
--------------------------------------------------------------------------------
/.gradle/1.12/taskArtifacts/fileHashes.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/1.12/taskArtifacts/fileHashes.bin
--------------------------------------------------------------------------------
/.gradle/1.12/taskArtifacts/fileSnapshots.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/1.12/taskArtifacts/fileSnapshots.bin
--------------------------------------------------------------------------------
/.gradle/1.12/taskArtifacts/outputFileStates.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/1.12/taskArtifacts/outputFileStates.bin
--------------------------------------------------------------------------------
/.gradle/1.12/taskArtifacts/taskArtifacts.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/1.12/taskArtifacts/taskArtifacts.bin
--------------------------------------------------------------------------------
/.gradle/2.2.1/taskArtifacts/cache.properties:
--------------------------------------------------------------------------------
1 | #Mon Mar 16 21:53:54 EDT 2015
2 |
--------------------------------------------------------------------------------
/.gradle/2.2.1/taskArtifacts/cache.properties.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/2.2.1/taskArtifacts/cache.properties.lock
--------------------------------------------------------------------------------
/.gradle/2.2.1/taskArtifacts/fileHashes.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/2.2.1/taskArtifacts/fileHashes.bin
--------------------------------------------------------------------------------
/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin
--------------------------------------------------------------------------------
/.gradle/2.2.1/taskArtifacts/outputFileStates.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/2.2.1/taskArtifacts/outputFileStates.bin
--------------------------------------------------------------------------------
/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin
--------------------------------------------------------------------------------
/.gradle/2.8/taskArtifacts/cache.properties:
--------------------------------------------------------------------------------
1 | #Sat Jan 16 13:57:04 EST 2016
2 |
--------------------------------------------------------------------------------
/.gradle/2.8/taskArtifacts/cache.properties.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/2.8/taskArtifacts/cache.properties.lock
--------------------------------------------------------------------------------
/.gradle/2.8/taskArtifacts/fileHashes.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/2.8/taskArtifacts/fileHashes.bin
--------------------------------------------------------------------------------
/.gradle/2.8/taskArtifacts/fileSnapshots.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/2.8/taskArtifacts/fileSnapshots.bin
--------------------------------------------------------------------------------
/.gradle/2.8/taskArtifacts/outputFileStates.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/2.8/taskArtifacts/outputFileStates.bin
--------------------------------------------------------------------------------
/.gradle/2.8/taskArtifacts/taskArtifacts.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/.gradle/2.8/taskArtifacts/taskArtifacts.bin
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Calculall
2 |
3 |
4 | An Android Calculator app that does all
5 |
6 | This is an Android Application created by TruTech Innovations Inc.
7 | ### Description
8 | At TruTech Innovations, we believe that our phones, with superior processing power, should take over the antiquated technology of expensive and inconvenient scientific and graphing calculators. With these ideals, we decided to create Calculall, an Android Application that brings all of the features of a Graphing Calculator, and more, onto your phone. We spent over a year developing and refining to make this calculator to be the most beautiful, effective and efficient tool to use for assisting in any mathematical problems, from finding the most complex indefinite integral, to simple everyday calculations.
9 | Calculall provides a vast arsenal of mathematical capabilities, far beyond virtually any calculator would have, while providing an intuitive, simple, and beautiful user interface. There are five modes in Calculall:
10 |
11 | ##### Basic
12 | - Basic mathematical operations
13 |
14 | ##### Advanced
15 | - Standard functions found on most scientific calculators (such as trigonometric functions)
16 | - Displaying fractions and superscripts naturally
17 | - Ability to calculate in exact values (fractions) or in decimals
18 |
19 | ##### Function
20 | - Root finding for polynomials
21 | - Factoring
22 | - Expanding
23 | - Differentiation
24 | - Indefinite Integration
25 |
26 | ##### Vector
27 | - Vector addition and subtraction
28 | - Dot and Cross product
29 | - Angles between vectors
30 | - Unit vectors
31 | - Magnitudes of vectors
32 | - Scalar forms of 2D and 3D vectors
33 |
34 | ##### Matrix
35 | - Basic matrix operations
36 | - Row Reduction
37 | - Inverses
38 | - Eigenvalues and Eigenvectors
39 | - Diagonalization, QR, and SVD Decomposition
40 |
41 | ##### In addition, for all modes we offer
42 | - Calculation History
43 | - Custom Themes
44 |
45 | [Download at Google Play](https://play.google.com/store/apps/details?id=com.trutechinnovations.calculall)
46 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | android {
3 | compileSdkVersion 25
4 | buildToolsVersion "25.0.2"
5 |
6 | defaultConfig {
7 | applicationId "com.trutechinnovations.calculall"
8 | minSdkVersion 21
9 | targetSdkVersion 25
10 | vectorDrawables.useSupportLibrary = true
11 | }
12 | buildTypes {
13 | release {
14 | minifyEnabled false
15 | shrinkResources true
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile 'com.android.support:support-compat:25.1.0'
23 | compile 'com.android.support:appcompat-v7:25.1.0'
24 | compile files('libs/symja-2015-08-09.jar')
25 | compile 'com.android.support:design:25.1.0'
26 | }
27 |
--------------------------------------------------------------------------------
/app/libs/symja-2015-08-09.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/libs/symja-2015-08-09.jar
--------------------------------------------------------------------------------
/app/manifest-merger-release-report.txt:
--------------------------------------------------------------------------------
1 | -- Merging decision tree log ---
2 | manifest
3 | ADDED from AndroidManifest.xml:2:1
4 | package
5 | ADDED from AndroidManifest.xml:3:5
6 | INJECTED from AndroidManifest.xml:0:0
7 | INJECTED from AndroidManifest.xml:0:0
8 | android:versionName
9 | ADDED from AndroidManifest.xml:6:5
10 | android:versionCode
11 | ADDED from AndroidManifest.xml:5:5
12 | INJECTED from AndroidManifest.xml:0:0
13 | INJECTED from AndroidManifest.xml:0:0
14 | xmlns:android
15 | ADDED from AndroidManifest.xml:2:11
16 | android:theme
17 | ADDED from AndroidManifest.xml:4:5
18 | uses-permission#android.permission.WRITE_EXTERNAL_STORAGE
19 | ADDED from AndroidManifest.xml:8:5
20 | android:name
21 | ADDED from AndroidManifest.xml:8:22
22 | uses-permission#android.permission.VIBRATE
23 | ADDED from AndroidManifest.xml:9:5
24 | android:name
25 | ADDED from AndroidManifest.xml:9:22
26 | application
27 | ADDED from AndroidManifest.xml:11:5
28 | MERGED from com.balysv:material-ripple:1.0.2:12:5
29 | MERGED from com.google.android.gms:play-services:6.5.87:20:5
30 | MERGED from com.android.support:support-v4:21.0.0:16:5
31 | android:allowBackup
32 | ADDED from AndroidManifest.xml:13:9
33 | android:icon
34 | ADDED from AndroidManifest.xml:14:9
35 | android:theme
36 | ADDED from AndroidManifest.xml:15:9
37 | android:name
38 | ADDED from AndroidManifest.xml:12:9
39 | meta-data#com.google.android.gms.version
40 | ADDED from AndroidManifest.xml:16:9
41 | MERGED from com.google.android.gms:play-services:6.5.87:21:9
42 | android:value
43 | ADDED from AndroidManifest.xml:18:13
44 | android:name
45 | ADDED from AndroidManifest.xml:17:13
46 | activity#com.trutechinnovations.calculall.MainActivity
47 | ADDED from AndroidManifest.xml:20:9
48 | android:screenOrientation
49 | ADDED from AndroidManifest.xml:23:13
50 | android:label
51 | ADDED from AndroidManifest.xml:22:13
52 | android:name
53 | ADDED from AndroidManifest.xml:21:13
54 | intent-filter#android.intent.action.MAIN+android.intent.category.LAUNCHER
55 | ADDED from AndroidManifest.xml:24:13
56 | action#android.intent.action.MAIN
57 | ADDED from AndroidManifest.xml:25:17
58 | android:name
59 | ADDED from AndroidManifest.xml:25:25
60 | category#android.intent.category.LAUNCHER
61 | ADDED from AndroidManifest.xml:27:17
62 | android:name
63 | ADDED from AndroidManifest.xml:27:27
64 | activity#com.trutechinnovations.calculall.SettingsActivity
65 | ADDED from AndroidManifest.xml:30:9
66 | android:screenOrientation
67 | ADDED from AndroidManifest.xml:33:13
68 | android:label
69 | ADDED from AndroidManifest.xml:32:13
70 | android:name
71 | ADDED from AndroidManifest.xml:31:13
72 | uses-sdk
73 | INJECTED from AndroidManifest.xml:0:0 reason: use-sdk injection requested
74 | MERGED from com.android.support:multidex:1.0.0:18:5
75 | MERGED from com.balysv:material-ripple:1.0.2:8:5
76 | MERGED from com.google.android.gms:play-services:6.5.87:18:5
77 | MERGED from com.android.support:support-v4:21.0.0:15:5
78 | android:targetSdkVersion
79 | INJECTED from AndroidManifest.xml:0:0
80 | INJECTED from AndroidManifest.xml:0:0
81 | android:minSdkVersion
82 | INJECTED from AndroidManifest.xml:0:0
83 | INJECTED from AndroidManifest.xml:0:0
84 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
14 |
15 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
31 |
35 |
39 |
43 |
47 |
51 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/AboutActivity.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.MenuItem;
7 |
8 | /**
9 | * Created by david on 1/15/2017.
10 | */
11 |
12 | public class AboutActivity extends AppCompatActivity {
13 | @Override
14 | protected void onCreate(@Nullable Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | ThemeHelper.setUpTheme(this,true);
17 | setContentView(R.layout.about_page);
18 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
19 | getSupportActionBar().setDisplayShowHomeEnabled(true);
20 | setTitle("About Us");
21 | }
22 |
23 | public boolean onOptionsItemSelected(MenuItem item){
24 | switch(item.getItemId()) {
25 | case android.R.id.home:
26 | finish();
27 | return true;
28 | }
29 | return false;
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/BasicFragment.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | /**
10 | * Represents the front-end UI (Fragment) component of the overall Basic Mode.
11 | *
12 | * @author Alston Lin
13 | * @version 3.0
14 | */
15 | public class BasicFragment extends Fragment {
16 |
17 | protected MainActivity activity;
18 |
19 | public BasicFragment() {
20 | activity = (MainActivity) getActivity();
21 | }
22 |
23 | /**
24 | * When the fragment needs to be created.
25 | *
26 | * @param inflater Inflater for the fragment
27 | * @param container What the fragment is contained within
28 | * @param savedInstanceState Not Used
29 | * @return The View of this Fragment
30 | */
31 | @Override
32 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
33 | activity = (MainActivity) getActivity();
34 | Basic.getInstance().setFragment(this);
35 | return inflater.inflate(R.layout.basic, container, false);
36 | }
37 |
38 | @Override
39 | public void onResume() {
40 | super.onResume();
41 | activity = (MainActivity) getActivity();
42 | }
43 |
44 | /**
45 | * Stops the ad if not already shown.
46 | */
47 | @Override
48 | public void onPause() {
49 | super.onPause();
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Bracket.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * When an expression is processed, the pieces within the bracket will be evaluated first. They
7 | * can be used alone or in conjunction with a function.
8 | *
9 | * @author Alston Lin, Ejaaz Merali
10 | * @version 3.0
11 | */
12 | public class Bracket extends Token implements Serializable {
13 | //Constants
14 | public static final int OPEN = 1, CLOSE = 2, SQUAREOPEN = 3, SQUARECLOSED = 4, MAGNITUDE_OPEN = 5, SUPERSCRIPT_OPEN = 6, SUPERSCRIPT_CLOSE = 7,
15 | NUM_OPEN = 8, NUM_CLOSE = 9, DENOM_OPEN = 10, DENOM_CLOSE = 11, MAGNITUDE_CLOSE = 12, FRACTION_OPEN = 13, FRACTION_CLOSE = 14;
16 | private static final long serialVersionUID = 752647220;
17 |
18 | /**
19 | * Should not be used outside of a factory; to create a type of bracket,
20 | * see class BracketFactory.
21 | *
22 | * @param symbol The symbol of the bracket.
23 | * @param type The type of bracket it is
24 | */
25 | public Bracket(String symbol, int type) {
26 | super(symbol);
27 | this.type = type;
28 | }
29 |
30 | /**
31 | * @return The type of Bracket (open or closed) this is (see class constants).
32 | */
33 | public int getType() {
34 | return type;
35 | }
36 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/BracketFactory.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | /**
4 | * Contains static methods that will create Brackets.
5 | *
6 | * @author Alston Lin, Ejaaz Merali, Jason Fok
7 | * @version 3.0
8 | */
9 | public class BracketFactory {
10 |
11 | public static Bracket makeOpenBracket() {
12 | return new Bracket("(", Bracket.OPEN);
13 | }
14 |
15 | public static Bracket makeCloseBracket() {
16 | return new Bracket(")", Bracket.CLOSE);
17 | }
18 |
19 | public static Bracket makeOpenSquareBracket() {
20 | return new Bracket("[", Bracket.SQUAREOPEN);
21 | }
22 |
23 | public static Bracket makeCloseSquareBracket() {
24 | return new Bracket("]", Bracket.SQUARECLOSED);
25 | }
26 |
27 | public static Bracket makeMagnitudeOpen() {
28 | return new Bracket("‖(", Bracket.MAGNITUDE_OPEN);
29 | }
30 |
31 | public static Bracket makeMagnitudeClose() {
32 | return new Bracket(")‖", Bracket.MAGNITUDE_CLOSE);
33 | }
34 |
35 | public static Bracket makeSuperscriptOpen() {
36 | return new Bracket("", Bracket.SUPERSCRIPT_OPEN);
37 | }
38 |
39 | public static Bracket makeSuperscriptClose() {
40 | return new Bracket("", Bracket.SUPERSCRIPT_CLOSE);
41 | }
42 |
43 | public static Bracket makeNumOpen() {
44 | return new Bracket("", Bracket.NUM_OPEN);
45 | }
46 |
47 | public static Bracket makeNumClose() {
48 | return new Bracket("", Bracket.NUM_CLOSE);
49 | }
50 |
51 | public static Bracket makeDenomOpen() {
52 | return new Bracket("", Bracket.DENOM_OPEN);
53 | }
54 |
55 | public static Bracket makeDenomClose() {
56 | return new Bracket("", Bracket.DENOM_CLOSE);
57 | }
58 |
59 | public static Bracket makeFracOpen() {
60 | return new Bracket("", Bracket.FRACTION_OPEN);
61 | }
62 |
63 | public static Bracket makeFracClose() {
64 | return new Bracket("", Bracket.FRACTION_CLOSE);
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Command.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | /**
4 | * Uses the Command Design Pattern to effectively have lambda expressions in a pre-Java 8 environment.
5 | * Note: E is the return Object, F is the param Object.
6 | *
7 | * @author Alston Lin
8 | * @version 3.0
9 | */
10 | public interface Command {
11 | public E execute(F o);
12 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Complex.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 TruTech Innovations Inc - All Rights Reserved
3 | */
4 |
5 | package com.trutechinnovations.calculall;
6 |
7 | /**
8 | * Object which represents a complex number
9 | *
10 | * @author Ejaaz Merali
11 | * @version 3.0
12 | */
13 | public class Complex {
14 | private static final double e = Math.E;
15 | private double real, imaginary;
16 |
17 | public Complex() {
18 | real = 0;
19 | imaginary = 0;
20 | }
21 |
22 | public Complex(Complex c) {
23 | real = c.getReal();
24 | imaginary = c.getImaginary();
25 | }
26 |
27 | public Complex(double r, double i) {
28 | real = r;
29 | imaginary = i;
30 | }
31 |
32 | public Complex(int r, int i) {
33 | real = r;
34 | imaginary = i;
35 | }
36 |
37 | public static boolean isReal(Complex c) {
38 | if (c.getImaginary() == 0) {
39 | return true;
40 | } else {
41 | return false;
42 | }
43 | }
44 |
45 | public static double abs(Complex c) {
46 | return c.abs();
47 | }
48 |
49 | public static Complex sqrt(double a) {//returns the complex sqrt of a negative number
50 | double x = Math.abs(a);
51 | return new Complex(0, Math.sqrt(x));
52 | }
53 |
54 | public static Complex pow(Complex expression, int power) {
55 | if (power == 1) {
56 | return expression;
57 | } else {
58 | Complex c = expression;
59 | for (int i = 2; i <= power; i++) {
60 | c = c.times(expression);
61 | }
62 | return c;
63 | }
64 | }
65 |
66 | public static Complex cis(double angle) {
67 | return new Complex(Math.cos(angle), Math.sin(angle));
68 | }
69 |
70 | public static double arg(Complex c) {
71 | double x = c.getReal();
72 | double y = c.getImaginary();
73 | if (x == 0 && y == 0) {
74 | throw new IllegalArgumentException();
75 | }
76 |
77 | if (x > 0 && y > 0) {
78 | return Math.atan(y / x);
79 | } else if (x < 0 && y > 0) {
80 | return Math.PI - Math.atan(Math.abs(x / y));
81 | } else if (x < 0 && y < 0) {
82 | return Math.atan(Math.abs(y / x)) - Math.PI;
83 | } else if (x > 0 && y < 0) {
84 | return (-1) * Math.atan(Math.abs(y / x));
85 | } else if (y == 0 && x > 0) {
86 | return 0;
87 | } else if (y == 0 && x < 0) {
88 | return Math.PI;
89 | } else if (x == 0 && y > 0) {
90 | return Math.PI / 2;
91 | } else if (x == 0 && y < 0) {
92 | return 3 * Math.PI / 2;
93 | } else {
94 | return 0;
95 | }
96 | }
97 |
98 | public double getReal() {
99 | return real;
100 | }
101 |
102 | public double getImaginary() {
103 | return imaginary;
104 | }
105 |
106 | public boolean isReal() {
107 | if (imaginary == 0) {
108 | return true;
109 | } else {
110 | return false;
111 | }
112 | }
113 |
114 | public Complex add(Complex b) {//this+b
115 | return new Complex(this.real + b.real, this.imaginary + b.imaginary);
116 | }
117 |
118 | public Complex add(double b) {
119 | return new Complex(this.real + b, this.imaginary);
120 | }
121 |
122 | public Complex subtract(Complex b) {//this-b
123 | return new Complex(this.real - b.real, this.imaginary - b.imaginary);
124 | }
125 |
126 | public Complex subtract(double b) {
127 | return new Complex(this.real - b, this.imaginary);
128 | }
129 |
130 | public Complex times(Complex b) {
131 | return new Complex(
132 | this.real * b.real - this.imaginary * b.imaginary,
133 | this.real * b.imaginary + this.imaginary * b.real);
134 | }
135 |
136 | public Complex times(double a) {//scalar multiplication
137 | return new Complex(a * this.real, a * this.imaginary);
138 | }
139 |
140 | public Complex times(int a) {
141 | return new Complex(a * this.real, a * this.imaginary);
142 | }
143 |
144 | public Complex recip() {
145 | return this.conjugate().times(1 / Math.pow(this.abs(), 2));
146 | }
147 |
148 | public Complex divide(Complex b) {
149 | return this.times(b.recip());
150 | }
151 |
152 | public Complex conjugate() {
153 | return new Complex(real, -imaginary);
154 | }
155 |
156 | public double abs() {
157 | return Math.sqrt(Math.pow(real, 2) + Math.pow(imaginary, 2));
158 | }
159 |
160 | public Complex complexExp() {//returns e raised to the power of this complex object
161 | double r = real, i = imaginary;
162 | return new Complex(Math.cos(i), Math.sin(i)).times(Math.pow(e, r));
163 | }
164 |
165 | public Complex complexExp(double b) {//returns b raised to the power of this complex object
166 | if (b < 0) {
167 | throw new IllegalArgumentException();
168 | } else if (b == 0) {
169 | return null;
170 | } else {
171 | double r = real, i = imaginary;
172 | return new Complex(Math.cos(i * Math.log(b)), Math.sin(i * Math.log(b))).times(Math.pow(b, r));
173 | }
174 | }
175 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Constant.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.util.ArrayList;
4 |
5 | /**
6 | * An Object that represents a mathematical / physical Constant.
7 | *
8 | * @author Jason Fok
9 | * @version 3.0
10 | */
11 | public class Constant extends Variable {
12 |
13 | private String name;
14 | private String HTML; //The HTML encoded symbol
15 | private double value;
16 | private String units;
17 |
18 | public Constant(String name, String HTML, String symbol, double value, String units) {
19 | super(Variable.CONSTANT, symbol);
20 | this.name = name;
21 | this.value = value;
22 | this.units = units;
23 | this.HTML = HTML;
24 | }
25 |
26 | public double getNumericValue() {
27 | return value;
28 | }
29 |
30 | public String getName() {
31 | return name;
32 | }
33 |
34 | public String getUnits() {
35 | return units;
36 | }
37 |
38 | public ArrayList getValue() {
39 | ArrayList tokens = new ArrayList<>();
40 | Token tempToken = new Number(value);
41 | tokens.add(tempToken);
42 | return tokens;
43 | }
44 |
45 | public String getHTML() {
46 | return HTML;
47 | }
48 |
49 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Digit.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Represents a single Digit of a number.
7 | *
8 | * @author Alston Lin
9 | * @version 3.0
10 | */
11 | public class Digit extends Token implements Serializable {
12 | private static final long serialVersionUID = 752647221;
13 | private int value;
14 |
15 | /**
16 | * Should not be used outside of a factory; to create a type of digit,
17 | * see class DigitFactory.
18 | *
19 | * @param symbol The symbol of the Token to be shown on the calculator screen
20 | * @param value The value of the Digit (0 - 9) or as defined by DigitFactory class constants
21 | */
22 | protected Digit(String symbol, int value) {
23 | super(symbol);
24 | this.value = value;
25 | }
26 |
27 | /**
28 | * @return The value of the Digit (0 - 9) or as defined by DigitFactory class constants
29 | */
30 | public int getValue() {
31 | return value;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/DigitFactory.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | /**
4 | * Contains static methods that will create Digit pieces.
5 | *
6 | * @author Alston Lin
7 | * @version 3.0
8 | */
9 | public class DigitFactory {
10 |
11 | public static int DECIMAL = -1, NEGATIVE = -10;
12 |
13 | public static Digit makeOne() {
14 | return new Digit("1", 1);
15 | }
16 |
17 | public static Digit makeTwo() {
18 | return new Digit("2", 2);
19 | }
20 |
21 | public static Digit makeThree() {
22 | return new Digit("3", 3);
23 | }
24 |
25 | public static Digit makeFour() {
26 | return new Digit("4", 4);
27 | }
28 |
29 | public static Digit makeFive() {
30 | return new Digit("5", 5);
31 | }
32 |
33 | public static Digit makeSix() {
34 | return new Digit("6", 6);
35 | }
36 |
37 | public static Digit makeSeven() {
38 | return new Digit("7", 7);
39 | }
40 |
41 | public static Digit makeEight() {
42 | return new Digit("8", 8);
43 | }
44 |
45 | public static Digit makeNine() {
46 | return new Digit("9", 9);
47 | }
48 |
49 | public static Digit makeZero() {
50 | return new Digit("0", 0);
51 | }
52 |
53 | public static Digit makeDecimal() {
54 | return new Digit(".", DECIMAL);
55 | }
56 |
57 | public static Digit makeNegative() {
58 | return new Digit("-", NEGATIVE);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/ExpressionFactory.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | /**
4 | * Contains methods that builds commonly used expressions as subtrees.
5 | *
6 | * @author Alston Lin
7 | * @version 3.0
8 | */
9 | public class ExpressionFactory {
10 |
11 | /**
12 | * Builds an expression of npi / m as a Node.
13 | *
14 | * @param n The multiplier for pi
15 | * @param m The denom
16 | * @return The built expression
17 | */
18 | public static Node makeNPiOverM(double n, double m) {
19 | Node piOverTwo = new Node(OperatorFactory.makeDivide());
20 | Node multiply = new Node(OperatorFactory.makeMultiply());
21 |
22 | multiply.addChild(new Node(new Number(n)));
23 | multiply.addChild(new Node(VariableFactory.makePI()));
24 |
25 | piOverTwo.addChild(multiply);
26 | piOverTwo.addChild(new Node(new Number(m)));
27 |
28 | return piOverTwo;
29 | }
30 |
31 | /**
32 | * Makes an expression of pi/n, where n is given.
33 | *
34 | * @param negative If pi should be negative
35 | * @param n The denom
36 | * @return The built expression
37 | */
38 | public static Node makePiOverN(boolean negative, double n) {
39 | Node piOverTwo = new Node(OperatorFactory.makeDivide());
40 | Variable pi = VariableFactory.makePI();
41 | pi.setNegative(negative);
42 | piOverTwo.addChild(new Node(pi));
43 | piOverTwo.addChild(new Node(new Number(n)));
44 | return piOverTwo;
45 | }
46 |
47 | public static Node makeOneHalf(boolean negative) {
48 | Node oneHalf = new Node(OperatorFactory.makeDivide());
49 | if (negative) {
50 | oneHalf.addChild(new Node(new Number(-1)));
51 | oneHalf.addChild(new Node(new Number(2)));
52 | } else {
53 | oneHalf.addChild(new Node(new Number(1)));
54 | oneHalf.addChild(new Node(new Number(2)));
55 | }
56 | return oneHalf;
57 | }
58 |
59 | public static Node makeSqrt2Over2(boolean negative) {
60 | Node sqrt2Over2 = new Node(OperatorFactory.makeDivide());
61 | Node sqrt = new Node(FunctionFactory.makeSqrt());
62 | sqrt.addChild(new Node(new Number(2)));
63 | sqrt2Over2.addChild(sqrt);
64 | if (negative) {
65 | sqrt2Over2.addChild(new Node(new Number(-2)));
66 | } else {
67 | sqrt2Over2.addChild(new Node(new Number(2)));
68 | }
69 | return sqrt2Over2;
70 | }
71 |
72 | public static Node makeSqrt3Over2(boolean negative) {
73 | Node sqrt3Over2 = new Node(OperatorFactory.makeDivide());
74 | Node sqrt = new Node(FunctionFactory.makeSqrt());
75 | sqrt.addChild(new Node(new Number(3)));
76 | sqrt3Over2.addChild(sqrt);
77 | if (negative) {
78 | sqrt3Over2.addChild(new Node(new Number(-2)));
79 | } else {
80 | sqrt3Over2.addChild(new Node(new Number(2)));
81 | }
82 | return sqrt3Over2;
83 | }
84 |
85 | public static Node makeSqrt3Over3(boolean negative) {
86 | Node sqrt3Over2 = new Node(OperatorFactory.makeDivide());
87 | Node sqrt = new Node(FunctionFactory.makeSqrt());
88 | sqrt.addChild(new Node(new Number(3)));
89 | sqrt3Over2.addChild(sqrt);
90 | if (negative) {
91 | sqrt3Over2.addChild(new Node(new Number(-3)));
92 | } else {
93 | sqrt3Over2.addChild(new Node(new Number(3)));
94 | }
95 | return sqrt3Over2;
96 | }
97 |
98 | public static Node makeSqrt3(boolean negative) {
99 | Node sqrt3 = new Node(FunctionFactory.makeSqrt());
100 | sqrt3.addChild(new Node(new Number(3)));
101 | if (negative) {
102 | Node multiply = new Node(OperatorFactory.makeMultiply());
103 | multiply.addChild(new Node(new Number(-1)));
104 | multiply.addChild(sqrt3);
105 | return multiply;
106 | }
107 | return sqrt3;
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Function.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | /**
4 | * A piece that receives a collection of pieces as an input, and then outputs a resulting number.
5 | *
6 | * @author Ejaaz Merali, Alston Lin
7 | * @version 3.0
8 | */
9 |
10 | public abstract class Function extends Token {
11 |
12 | public static final int DEGREE = 1, RADIAN = 2, GRADIAN = 3; //angleMode options
13 | public static int angleMode = DEGREE;
14 | public static final int SIN = 1, COS = 2, TAN = 3, SINH = 4, COSH = 5, TANH = 6, ARCSIN = 7, ARCCOS = 8, ARCTAN = 9,
15 | ARCSINH = 10, ARCCOSH = 11, ARCTANH = 12, LOG10 = 17,
16 | LN = 19, SQRT = 21, CSC = 24, SEC = 25, COT = 26, ERF = 27, APPELLF1 = 28, ERFI = 29, GAMMA = 30;
17 |
18 | /**
19 | * Should not be used outside of a factory; to create a type of function,
20 | * see class FunctionFactory.
21 | *
22 | * @param symbol The symbol of the Token to be shown on the calculator screen
23 | * @param type The type of Function this is, as defined by the class constants
24 | */
25 | protected Function(String symbol, int type) {
26 | super(symbol);
27 | this.type = type;
28 | }
29 |
30 | /**
31 | * Performs the function with the given input.
32 | *
33 | * @param input The input that is given for the function
34 | * @return The output of the performed function
35 | */
36 | public abstract double perform(double input);
37 |
38 | /**
39 | * @return The type of Function this is, as defined by the class constants
40 | */
41 | public int getType() {
42 | return type;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/GridViewItem.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.ImageView;
6 |
7 | /**
8 | * A square item on the GridView.
9 | *
10 | * @author Alston Lin
11 | * @version 3.0
12 | */
13 | public class GridViewItem extends ImageView {
14 |
15 | public GridViewItem(Context context) {
16 | super(context);
17 | }
18 |
19 | public GridViewItem(Context context, AttributeSet attrs) {
20 | super(context, attrs);
21 | }
22 |
23 | public GridViewItem(Context context, AttributeSet attrs, int defStyle) {
24 | super(context, attrs, defStyle);
25 | }
26 |
27 | @Override
28 | public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
29 | super.onMeasure(widthMeasureSpec, widthMeasureSpec); // This is the key that will make the height equivalent to its width
30 | }
31 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/ListViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.CallSuper;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.MenuItem;
8 |
9 | /**
10 | * Created by david on 1/20/2017.
11 | */
12 |
13 | public abstract class ListViewActivity extends AppCompatActivity {
14 |
15 | @CallSuper
16 | protected void onCreate(@Nullable Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | ThemeHelper.setUpTheme(this,true);
19 | getSupportActionBar().setTitle(getViewTitle());
20 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
21 | getSupportActionBar().setDisplayShowHomeEnabled(true);
22 | }
23 |
24 | public abstract String getViewTitle();
25 |
26 | public boolean onOptionsItemSelected (MenuItem item){
27 | switch (item.getItemId()) {
28 | case android.R.id.home:
29 | finish();
30 | return true;
31 | }
32 | return false;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Matrix.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Arrays;
5 |
6 | /**
7 | * The Object representation of a mathematical Matrix.
8 | *
9 | * @author Ejaaz Merali
10 | * @version 3.0
11 | */
12 |
13 | public class Matrix extends Token {
14 |
15 | private ArrayList[][] entries;
16 |
17 | public Matrix(ArrayList[][] entries) {
18 | super(null);
19 | this.entries = entries;
20 | }
21 |
22 | public Matrix(double[][] entries) {
23 | super(null);
24 | ArrayList[][] temp = new ArrayList[entries.length][entries[0].length];
25 | for (int i = 0; i < entries.length; i++) {
26 | for (int j = 0; j < entries[0].length; j++) {
27 | ArrayList entry = new ArrayList<>();
28 | entry.add(new Number(entries[i][j]));
29 | temp[i][j] = entry;
30 | }
31 | }
32 | this.entries = temp;
33 | }
34 |
35 | /**
36 | * Changes the size of the Matrix while keeping the values
37 | *
38 | * @param numOfRows The new number of rows of the Matrix
39 | * @param numOfCols The new number of columns of the Matrix
40 | */
41 | public void changeSize(int numOfRows, int numOfCols) {
42 | ArrayList[][] temp = entries;
43 | entries = new ArrayList[numOfRows][numOfCols];
44 | //Populates the entries
45 | for (int i = 0; i < numOfRows; i++) {
46 | for (int j = 0; j < numOfCols; j++) {
47 | if (i < temp.length && j < temp[0].length) { //Existing entry exists
48 | entries[i][j] = temp[i][j];
49 | } else { //Creates a new entry
50 | ArrayList entry = new ArrayList<>();
51 | entry.add(new Number(0));
52 | entries[i][j] = entry;
53 | }
54 | }
55 | }
56 | }
57 |
58 | /**
59 | * Sets the entry at the given row and column number to the given.
60 | *
61 | * @param x Row number
62 | * @param y Column number
63 | * @param entry The entry to set
64 | */
65 | public void setEntry(int x, int y, ArrayList entry) {
66 | entries[x][y] = entry;
67 | }
68 |
69 | public ArrayList[][] getEntries() {
70 | return entries;
71 | }
72 |
73 | public double[][] getEntriesAsDbls() {
74 | double[][] output = new double[getNumOfRows()][getNumOfCols()];
75 | for (int i = 0; i < getNumOfRows(); i++) {
76 | for (int j = 0; j < getNumOfCols(); j++) {
77 | output[i][j] = Utility.process(getEntry(i, j));
78 | }
79 | }
80 | return output;
81 | }
82 |
83 | public ArrayList getEntry(int i, int j) {
84 | if (i >= 0 && i < entries.length && j >= 0 && j < entries[0].length) {
85 | return entries[i][j];
86 | } else {
87 | throw new IllegalArgumentException("Entry does not exist");
88 | }
89 | }
90 |
91 | public ArrayList[] getRow(int i) {
92 | if (i >= 0 && i < entries.length) {
93 | return entries[i];
94 | } else {
95 | throw new IllegalArgumentException("Not enough rows");
96 | }
97 | }
98 |
99 | public ArrayList[] getColumn(int j) {
100 | if (j >= 0 && j < entries[0].length) {
101 | ArrayList[] col = new ArrayList[entries.length];
102 | for (int i = 0; i < entries.length; i++) {
103 | col[i] = getEntry(i, j);
104 | }
105 | return col;
106 | } else {
107 | throw new IllegalArgumentException("Not enough columns");
108 | }
109 | }
110 |
111 | public int getNumOfRows() {
112 | return entries.length;
113 | }
114 |
115 | public int getNumOfCols() {
116 | return entries[0].length;
117 | }
118 |
119 | public boolean isSquare() {
120 | return getNumOfCols() == getNumOfRows();
121 | }
122 |
123 | public boolean isSymmetric() {
124 | double[][] a = getEntriesAsDbls();
125 | return isSquare() && Arrays.deepEquals(a, MatrixUtils.transpose(a));
126 | }
127 |
128 | /**
129 | * Determines whats gets displayed onto the Screen.
130 | *
131 | * @return The visual representation of the Matrix
132 | */
133 | public String getSymbol() {
134 | String s = "";
135 | for (int i = 0; i < entries.length; i++) {
136 | String temp = "";
137 | for (int j = 0; j < entries[i].length; j++) {
138 | if (j != 0) {
139 | s += ", ";
140 | }
141 | s += Utility.printExpression(entries[i][j]);
142 | }
143 | s += "\\";
144 | }
145 | return s;
146 | }
147 |
148 | /**
149 | * Converts decimal entries into fractions if practical.
150 | */
151 | public void fractionalize() {
152 | for (int i = 0; i < entries.length; i++) {
153 | for (int j = 0; j < entries[i].length; j++) {
154 | ArrayList entry = entries[i][j];
155 | if (entry.size() == 1 && entry.get(0) instanceof Number) { //A single number entry
156 | Number n = (Number) entry.get(0);
157 | entries[i][j] = JFok.fractionalize(n);
158 | }
159 | }
160 | }
161 | }
162 |
163 | /**
164 | * Creates the LaTeX code required to typeset this Matrix
165 | *
166 | * @return The LaTeX representation of the Matrix
167 | */
168 | public String toLaTeX() {
169 | String output = "$" + "\\begin{bmatrix}";
170 | for (int i = 0; i < getNumOfRows(); i++) {
171 | for (int j = 0; j < getNumOfCols(); j++) {
172 | if (j != 0) {
173 | output += "&";
174 | }
175 | output += Utility.machinePrintExpression(entries[i][j]);
176 | }
177 | output += "\\\\";
178 | }
179 | output += "\\end{bmatrix}" + "$";
180 | return output;
181 | }
182 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/MatrixFragment.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import android.os.Bundle;
4 | import android.text.Html;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.Button;
9 |
10 | /**
11 | * Defines the UI for MatrixMode.
12 | *
13 | * @author Alston Lin
14 | * @version Alpha 2.0
15 | */
16 | public class MatrixFragment extends BasicFragment {
17 | @Override
18 | public void onResume() {
19 | super.onResume();
20 | setupButtons();
21 | }
22 |
23 | @Override
24 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
25 | MatrixMode.getInstance().setFragment(this);
26 | return inflater.inflate(R.layout.matrix, container, false);
27 | }
28 |
29 | /**
30 | * Programmaticly sets the texts that can't be defined with XML.
31 | */
32 | private void setupButtons() {
33 | Button transButton = (Button) getActivity().findViewById(R.id.transpose_button);
34 | Button powButton = (Button) getActivity().findViewById(R.id.pow_button);
35 | Button inverseButton = (Button) getActivity().findViewById(R.id.inverse_button);
36 | Button newButton = (Button) getActivity().findViewById(R.id.new_button);
37 | transButton.setText(Html.fromHtml(getString(R.string.transpose)));
38 | powButton.setText(Html.fromHtml(getString(R.string.matrix_pow)));
39 | inverseButton.setText(Html.fromHtml(getString(R.string.inverse_a)));
40 | newButton.setText(Html.fromHtml(getString(R.string.newe)));
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/MatrixFunction.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | /**
4 | * The Object representation of a mathematical Function that has a Matrix as the input.
5 | *
6 | * @author Ejaaz Merali
7 | * @version 3.0
8 | */
9 | public abstract class MatrixFunction extends Token {
10 |
11 | public static final int REF = 1, RREF = 2, DET = 3, TRANSPOSE = 4, INVERSE = 5, DIAG = 6,
12 | EIGENVECT = 7, EIGENVAL = 8, TRACE = 9, RANK = 10, LU = 11;
13 |
14 | /**
15 | * Should not be used outside of a factory; to create a type of function,
16 | * see class FunctionFactory.
17 | *
18 | * @param symbol The symbol of the Token to be shown on the calculator screen
19 | * @param type The type of Function this is, as defined by the class constants
20 | */
21 | protected MatrixFunction(String symbol, int type) {
22 | super(symbol);
23 | this.type = type;
24 | }
25 |
26 | /**
27 | * Performs the function with the given input.
28 | *
29 | * @param input The input that is given for the function
30 | * @return The output of the performed function
31 | */
32 | public abstract double[][] perform(double[][] input);
33 |
34 | /**
35 | * @return The type of Function this is, as defined by the class constants
36 | */
37 | public int getType() {
38 | return type;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/MatrixFunctionFactory.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.util.Random;
4 |
5 | /**
6 | * Contains a static Factory to create Functions for Matrix Mode.
7 | *
8 | * @author Ejaaz Merali, Keith Wong, Alston Lin
9 | * @version 3.0
10 | */
11 | public class MatrixFunctionFactory {
12 |
13 | public static MatrixFunction makeTranspose() {
14 | return new MatrixFunction("trans", MatrixFunction.TRANSPOSE) {
15 | @Override
16 | public double[][] perform(double[][] input) {
17 | return MatrixUtils.transpose(input);
18 | }
19 | };
20 | }
21 |
22 | public static MatrixFunction makeREF() {
23 | return new MatrixFunction("REF", MatrixFunction.REF) {
24 | @Override
25 | public double[][] perform(double[][] input) {
26 | return MatrixUtils.toREF(input);
27 | }
28 | };
29 | }
30 |
31 | public static MatrixFunction makeRREF() {
32 | return new MatrixFunction("RREF", MatrixFunction.RREF) {
33 | @Override
34 | public double[][] perform(double[][] input) {
35 | return MatrixUtils.toRREF(input);
36 | }
37 | };
38 | }
39 |
40 | public static MatrixFunction makeDeterminant() {
41 | return new MatrixFunction("det", MatrixFunction.DET) {
42 | @Override
43 | public double[][] perform(double[][] input) {
44 | if (input.length == input[0].length) {
45 | double[][] output = new double[1][1];
46 | output[0][0] = MatrixUtils.findDeterminant(input);
47 | return output;
48 | } else {
49 | throw new IllegalArgumentException("Determinant is only defined for square matrices");
50 | }
51 | }
52 | };
53 | }
54 |
55 | public static MatrixFunction makeTrace() {
56 | return new MatrixFunction("tr", MatrixFunction.TRACE) {
57 | @Override
58 | public double[][] perform(double[][] input) {
59 | if (input.length != input[0].length) {
60 | throw new IllegalArgumentException("Trace is only defined for square matrices");
61 | } else {
62 | double[][] trace = new double[1][1];
63 | trace[0][0] = MatrixUtils.trace(input);
64 | return trace;
65 | }
66 | }
67 | };
68 | }
69 |
70 | public static MatrixFunction makeRank() {
71 | return new MatrixFunction("rank", MatrixFunction.RANK) {
72 | @Override
73 | public double[][] perform(double[][] input) {
74 | double[][] output = new double[1][1];
75 | output[0][0] = MatrixUtils.rank(input);
76 | return output;
77 | }
78 | };
79 | }
80 |
81 | public static MatrixFunction makeInverse() {
82 | return new MatrixFunction("inv", MatrixFunction.INVERSE) {
83 | @Override
84 | public double[][] perform(double[][] input) {
85 | if (input.length != input[0].length) {
86 | throw new IllegalArgumentException("Matrix must be n*n to be invertible");
87 | }
88 | return MatrixUtils.findInverse(input);
89 | }
90 | };
91 | }
92 |
93 | public static MatrixFunction makeLU() {
94 | return new MatrixFunction("LU", MatrixFunction.LU) {
95 | @Override
96 | public double[][] perform(double[][] input) {
97 | if (input.length != input[0].length) {
98 | throw new IllegalArgumentException("Matrix must be n*n to be LU factorizable");
99 | }
100 | Random r = new Random();
101 | double[][][] m = MatrixUtils.getLUDecomposition(input);
102 | return m[r.nextInt(m.length)];
103 | }
104 | };
105 | }
106 |
107 | public static MatrixFunction makeDiag() {
108 | return new MatrixFunction("diag", MatrixFunction.DIAG) {
109 | @Override
110 | public double[][] perform(double[][] input) {
111 | if (input.length != input[0].length) {
112 | throw new IllegalArgumentException("Matrix must be n*n to be diagonalizable");
113 | }
114 | Random r = new Random();
115 | double[][][] m = MatrixUtils.getEigenDecomposition(input);
116 | return m[r.nextInt(m.length)];
117 | }
118 | };
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/MatrixOperator.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | /**
4 | * A Object representation of a Operator for Matrices, which may also accept Numbers as well.
5 | *
6 | * @author Alston Lin, Ejaaz Merali
7 | */
8 |
9 | public abstract class MatrixOperator extends Token {
10 | public static final int ADD = 1, SUBTRACT = 2, MULTIPLY = 3, DIVIDE = 4, EXPONENT = 5;
11 | private int precedence;
12 | private boolean leftAssociative, commutative, anticommutative, associative;
13 |
14 | /**
15 | * Should not be used outside of a factory; to create a type of operation,
16 | * see class MatrixOperatorFactory.
17 | *
18 | * @param symbol The symbol of the Token to be shown on the calculator screen
19 | * @param type The type of Operator (defined by the class constants)
20 | * @param precedence Defines the order the operator is used (bigger = higher priority)
21 | * @param leftAssociative If the operator is left or right associative
22 | * @param c If the operator is commutative, anticommutative, or noncommutative
23 | * @param a If the operator is associative
24 | */
25 | protected MatrixOperator(String symbol, int type, int precedence, boolean leftAssociative, int c, boolean a) {
26 | super(symbol);
27 | this.leftAssociative = leftAssociative;
28 | this.type = type;
29 | this.precedence = precedence;
30 | this.setCommutativity(c);
31 | this.associative = a;
32 | }
33 |
34 | /**
35 | * Performs the operation with the given surrounding values.
36 | *
37 | * @param left The matrix left of the operation
38 | * @param right The matrix right of the operation
39 | * @return The result of the operation
40 | */
41 | public abstract Object operate(Object left, Object right);
42 |
43 | /**
44 | * @return The type of operation this is (see class constants for possible values)
45 | */
46 | public int getType() {
47 | return type;
48 | }
49 |
50 | /**
51 | * @return true if the operator is left associative, false if it's right
52 | */
53 | public boolean isLeftAssociative() {
54 | return leftAssociative;
55 | }
56 |
57 | /**
58 | * @return true if the operator is associative, false if it's right
59 | */
60 | public boolean isAssociative() {
61 | return associative;
62 | }
63 |
64 | /**
65 | * @return true if the operator is commutative, false if it is not
66 | */
67 | public boolean isCommutative() {
68 | return commutative;
69 | }
70 |
71 | /**
72 | * @return true if the operator is anticommutative, false if it is not
73 | */
74 | public boolean isAntiCommutative() {
75 | return anticommutative;
76 | }
77 |
78 | /**
79 | * @param c if it is 1 the operator is commutative, 0: noncommutative, -1: anticommutative
80 | */
81 | private void setCommutativity(int c) {
82 | if (c > 0) {
83 | commutative = true;
84 | anticommutative = false;
85 | } else if (c == 0) {
86 | commutative = false;
87 | anticommutative = false;
88 | } else {
89 | commutative = false;
90 | anticommutative = true;
91 | }
92 | }
93 |
94 | /**
95 | * @return The order of which the Operator is operated (higher = more priority)
96 | */
97 | public int getPrecedence() {
98 | return precedence;
99 | }
100 | }
101 |
102 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/MatrixOperatorFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 TruTech Innovations Inc - All Rights Reserved
3 | */
4 |
5 | package com.trutechinnovations.calculall;
6 |
7 | /**
8 | * Contains static factory methods for Operators in Matrix Mode.
9 | *
10 | * @author Ejaaz Merali, Keith Wong
11 | * @version 3.0
12 | */
13 |
14 | public class MatrixOperatorFactory {
15 |
16 | public static MatrixOperator makeMatrixAdd() {
17 | return new MatrixOperator("+", MatrixOperator.ADD, 2, true, 1, true) {
18 | @Override
19 | public Object operate(Object left, Object right) {
20 | if (left instanceof double[][] && right instanceof double[][]) {
21 | double[][] leftD = (double[][]) left;
22 | double[][] rightD = (double[][]) right;
23 | if (leftD.length == rightD.length && leftD[0].length == rightD[0].length) {
24 | return MatrixUtils.add(leftD, rightD);
25 | } else {
26 | throw new IllegalArgumentException("Matrices are not the same size");
27 | }
28 | } else if (left instanceof Number && right instanceof Number) {
29 | return new Number(OperatorFactory.makeAdd().operate(((Number) left).getValue(), ((Number) right).getValue()));
30 | } else {
31 | throw new IllegalArgumentException("Both arguments must be Matrices or Numbers");
32 | }
33 | }
34 | };
35 | }
36 |
37 | public static MatrixOperator makeMatrixSubtract() {
38 | return new MatrixOperator("-", MatrixOperator.SUBTRACT, 2, true, 1, true) {
39 | @Override
40 | public Object operate(Object left, Object right) {
41 | if (left instanceof double[][] && right instanceof double[][]) {
42 | double[][] leftD = (double[][]) left;
43 | double[][] rightD = (double[][]) right;
44 | if (leftD.length == rightD.length && leftD[0].length == rightD[0].length) {
45 | return MatrixUtils.subtract(leftD, rightD);
46 | } else {
47 | throw new IllegalArgumentException("Matrices are not the same size");
48 | }
49 | } else if (left instanceof Number && right instanceof Number) {
50 | return new Number(OperatorFactory.makeSubtract().operate(((Number) left).getValue(), ((Number) right).getValue()));
51 | } else {
52 | throw new IllegalArgumentException("Both arguments must be Matrices or Numbers");
53 | }
54 | }
55 | };
56 | }
57 |
58 | public static MatrixOperator makeMatrixMultiply() {
59 | return new MatrixOperator("·", MatrixOperator.MULTIPLY, 2, true, 1, true) {
60 | @Override
61 | public Object operate(Object left, Object right) {
62 | if (left instanceof double[][] && right instanceof double[][]) {//matrix-matrix multiplication
63 | try {
64 | return MatrixUtils.multiply((double[][]) left, (double[][]) right);
65 | } catch (Exception e) {
66 | throw e;
67 | }
68 | } else if (left instanceof Number && right instanceof double[][]) {//scalar multiplication
69 | return MatrixUtils.scalarMultiply((double[][]) right, ((Number) left).getValue());
70 | } else if (right instanceof Number && left instanceof double[][]) {//scalar multiplication
71 | return MatrixUtils.scalarMultiply((double[][]) left, ((Number) right).getValue());
72 | } else if (left instanceof Number && right instanceof Number) {
73 | return new Number(OperatorFactory.makeMultiply().operate(((Number) left).getValue(), ((Number) right).getValue()));
74 | } else {
75 | throw new IllegalArgumentException("Invalid Input");
76 | }
77 | }
78 | };
79 | }
80 |
81 | public static MatrixOperator makeMatrixDivide() {
82 | return new MatrixOperator("/", MatrixOperator.DIVIDE, 2, true, 1, true) {
83 | @Override
84 | public Object operate(Object left, Object right) {
85 | if (left instanceof double[][] && right instanceof double[][]) {//matrix-matrix multiplication
86 | try {
87 | return MatrixUtils.multiply((double[][]) left, MatrixUtils.findInverse((double[][]) right));
88 | } catch (Exception e) {
89 | throw e;
90 | }
91 | } else if (left instanceof Number && right instanceof double[][]) {//scalar multiplication + inversion
92 | return MatrixUtils.scalarMultiply(MatrixUtils.findInverse((double[][]) right), ((Number) left).getValue());
93 | } else if (right instanceof Number && left instanceof double[][]) {//scalar multiplication
94 | return MatrixUtils.scalarMultiply((double[][]) left, 1 / (((Number) right).getValue()));
95 | } else if (left instanceof Number && right instanceof Number) {
96 | return new Number(OperatorFactory.makeDivide().operate(((Number) left).getValue(), ((Number) right).getValue()));
97 | } else {
98 | throw new IllegalArgumentException("Invalid Input");
99 | }
100 | }
101 | };
102 | }
103 |
104 | public static MatrixOperator makeMatrixExponent() {
105 | return new MatrixOperator("^", MatrixOperator.EXPONENT, 2, true, 1, true) {
106 | @Override
107 | public Object operate(Object left, Object right) {
108 | if (left instanceof double[][] && right instanceof Number) {
109 | try {
110 | return MatrixUtils.exponentiate((double[][]) left, ((Number) right).getValue());
111 | } catch (Exception e) {
112 | throw e;
113 | }
114 | } else {
115 | throw new IllegalArgumentException("Invalid Input");
116 | }
117 | }
118 | };
119 | }
120 |
121 | }
122 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/MultiButton.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 TruTech Innovations Inc - All Rights Reserved
3 | */
4 |
5 | package com.trutechinnovations.calculall;
6 |
7 | import android.content.Context;
8 | import android.text.Spanned;
9 | import android.util.AttributeSet;
10 | import android.widget.Button;
11 |
12 | /**
13 | * A Button that will have multiple functions.
14 | *
15 | * @author Alston Lin
16 | * @version 3.0
17 | */
18 | public class MultiButton extends Button {
19 |
20 | //Constants
21 | public static int NORMAL = 0, SECOND = 1, HYP = 2, SECONDHYP = 3;
22 | //Fields
23 | private int mode = 0;
24 | private Spanned[] modeTexts;
25 | private Command[] onClicks;
26 |
27 | public MultiButton(Context context, AttributeSet attrs) {
28 | super(context, attrs);
29 | }
30 |
31 | /**
32 | * Creates a new Button capable of switching between two or four texts and onClick results.
33 | *
34 | * @param context The context the Button is being created in
35 | * @param modeTexts An array of either size 2 or 4 of which the Button will display
36 | * @param onClicks What function would be called for each respective mode (size 2 or 4)
37 | */
38 | public MultiButton(Context context, Spanned[] modeTexts, Command[] onClicks) {
39 | super(context);
40 | this.modeTexts = modeTexts;
41 | this.onClicks = onClicks;
42 | setText(modeTexts[mode]);
43 | }
44 |
45 | /**
46 | * Changes the mode and text of this button.
47 | *
48 | * @param second If 2nd is toggled
49 | * @param hyp If hyp is toggled
50 | */
51 | public void changeMode(boolean second, boolean hyp) {
52 | if (second && hyp) {
53 | if (modeTexts.length == 4) {
54 | mode = SECONDHYP;
55 | } else {
56 | mode = SECOND;
57 | }
58 | } else if (second) {
59 | mode = SECOND;
60 | } else if (hyp) {
61 | if (modeTexts.length == 4) {
62 | mode = HYP;
63 | } else {
64 | mode = NORMAL;
65 | }
66 | } else {
67 | mode = NORMAL;
68 | }
69 | setText(modeTexts[mode]);
70 | }
71 |
72 | /**
73 | * Call this method when the Button is clicked.
74 | */
75 | public void onClick() {
76 | onClicks[mode].execute(null);
77 | }
78 |
79 | public void setModeTexts(Spanned[] modeTexts) {
80 | this.modeTexts = modeTexts;
81 | }
82 |
83 | public void setOnClicks(Command[] onClicks) {
84 | this.onClicks = onClicks;
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Node.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.util.ArrayList;
4 |
5 | /**
6 | * Used as an unit within a tree.
7 | *
8 | * @author Alston Lin
9 | * @version 3.0
10 | */
11 | public class Node {
12 |
13 | private ArrayList> children;
14 | private E content;
15 | private Node parent;
16 |
17 | /**
18 | * Constructs a new Node<> for a tree.
19 | *
20 | * @param content The contents of the node
21 | */
22 | public Node(E content) {
23 | this.content = content;
24 | children = new ArrayList<>();
25 | }
26 |
27 | /**
28 | * Adds the given child to this Node.
29 | *
30 | * @param child the child Node
31 | */
32 | public void addChild(Node child) {
33 | children.add(child);
34 | child.parent = this;
35 | }
36 |
37 | /**
38 | * Adds the given child to this Node.
39 | *
40 | * @param newChildren a list of all the children to be added to this Node
41 | */
42 | public void addChildren(ArrayList> newChildren) {
43 | for (int i = 0; i < newChildren.size(); i++) {
44 | this.addChild(newChildren.get(i));
45 | }
46 | }
47 |
48 | /**
49 | * Deletes the nth child
50 | *
51 | * @param n the index of the child Node to be deleted
52 | */
53 | public void delChild(int n) {
54 | children.remove(n);
55 | }
56 |
57 | /**
58 | * Creates a copy this node
59 | */
60 | public Node copy() {
61 | Node newRoot = new Node<>(this.getContent());
62 | for (int i = 0; i < this.getNumOfChildren(); i++) {
63 | newRoot.addChild(this.getChildren().get(i).copy());
64 | }
65 | return newRoot;
66 | }
67 |
68 | /**
69 | * @return The children of this Node
70 | */
71 | public ArrayList> getChildren() {
72 | return children;
73 | }
74 |
75 | /**
76 | * @return The number of children in this Node
77 | */
78 | public int getNumOfChildren() {
79 | return children.size();
80 | }
81 |
82 | /**
83 | * @return The data that this Node stores
84 | */
85 | public E getContent() {
86 | return content;
87 | }
88 |
89 | /**
90 | * @return The parent of this Node
91 | */
92 | public Node getParent() {
93 | return parent;
94 | }
95 |
96 | /**
97 | * Prints the tree that this node is the root of
98 | *
99 | * @param indent String used to indent the subtrees
100 | * @param last Is this the root's last child?
101 | */
102 | public void printTree(String indent, boolean last) {
103 | System.out.print(indent);
104 | if (last) {
105 | System.out.print("\\>");
106 | indent += " ";
107 | } else {
108 | System.out.print("|>");
109 | indent += "| ";
110 | }
111 | if (this.content instanceof Token) {
112 | if (this.content instanceof Number) {
113 | if (((Number) this.content).getValue() % 1 != 0) {
114 | System.out.println(" " + ((Number) this.content).getValue());
115 | } else {
116 | System.out.println(" " + (int) (((Number) this.content).getValue()));
117 | }
118 | } else {
119 | System.out.println(" " + ((Token) this.content).getSymbol());
120 | }
121 | }
122 | for (int i = 0; i < children.size(); i++) {
123 | children.get(i).printTree(indent, i == children.size() - 1);
124 | }
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Number.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * This is the class for the main activity (entry-point to the app). It will simply configure
7 | * the setting then go to the basic activity.
8 | *
9 | * @author Alston Lin
10 | * @version 3.0
11 | */
12 | public class Number extends Token implements Serializable {
13 |
14 | private static final long serialVersionUID = 752647223;
15 | public static int roundTo = 9;
16 | private double value;
17 |
18 | /**
19 | * Only to be used during expression simplification for the purpose of efficiency. Stores
20 | * multiple digits into a single piece with the total value of the digits stored.
21 | */
22 | protected Number(double value) {
23 | super(null); //No image for this; it should never be shown on screen
24 | this.value = value;
25 | this.type = -1;
26 | }
27 |
28 | /**
29 | * @return The value of the number
30 | */
31 | public double getValue() {
32 | return value;
33 | }
34 |
35 | public String getSymbol() {
36 | if (Double.isInfinite(value) || Double.isNaN(value)){
37 | return ("A Really Big Number");
38 | }
39 | //Rounds
40 | value = Utility.round(value, roundTo);
41 | String s = Double.toString(value);
42 | s = !s.contains(".") ? s : (s.indexOf("E") > 0 ? s.substring(0, s.indexOf("E")).replaceAll("0*$", "")
43 | .replaceAll("\\.$", "").concat(s.substring(s.indexOf("E"))) : s.replaceAll("0*$", "")
44 | .replaceAll("\\.$", "")); //Removes trailing zeroes
45 | return s;
46 | }
47 |
48 | public String toLaTeX() {
49 | return "$" + getSymbol() + "$";
50 | }
51 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/NumberTooLargeException.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | /**
4 | * An Exception to be thrown when the Number is too large
5 | *
6 | * @author Alston Lin
7 | * @version 3.0
8 | */
9 | public class NumberTooLargeException extends RuntimeException {
10 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Operator.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Receives input from the digits surrounding the operation piece and results in a new number.
7 | *
8 | * @author Alston Lin, Ejaaz Merali
9 | * @version 3.0
10 | */
11 | public abstract class Operator extends Token implements Serializable, OrderComparable {
12 |
13 | public static final int ADD = 1, SUBTRACT = 2, MULTIPLY = 3, DIVIDE = 4, EXPONENT = 5, PERMUTATION = 6,
14 | COMBINATION = 7, FACTORIAL = 8, VARROOT = 9, FRACTION = 10;
15 | public static final int ADD_SUBTRACT = 2, MULTIPLY_DIVIDE = 3, EXPONENT_PRECEDENCE = 5; //Precedences
16 | private int precedence;
17 | private boolean leftAssociative, commutative, anticommutative, associative;
18 |
19 | /**
20 | * Should not be used outside of a factory; to create a type of operation,
21 | * see class OperatorFactory.
22 | *
23 | * @param symbol The symbol of the Token to be shown on the calculator screen
24 | * @param type The type of Operator (defined by the class constants)
25 | * @param precedence Defines the order the operator is used (bigger = higher priority)
26 | * @param leftAssociative If the operator is left or right associative
27 | * @param c If the operator is commutative, anticommutative, or noncommutative
28 | * @param a If the operator is associative
29 | */
30 | protected Operator(String symbol, int type, int precedence, boolean leftAssociative, int c, boolean a) {
31 | super(symbol);
32 | this.leftAssociative = leftAssociative;
33 | this.type = type;
34 | this.precedence = precedence;
35 | this.setCommutativity(c);
36 | this.associative = a;
37 | }
38 |
39 | /**
40 | * Performs the operation with the given surrounding values.
41 | *
42 | * @param left The value left of the operation
43 | * @param right The value right of the operation
44 | * @return The result of the operation
45 | */
46 | public abstract double operate(double left, double right) throws NumberTooLargeException;
47 |
48 | /**
49 | * @return The type of operation this is (see class constants for possible values)
50 | */
51 | public int getType() {
52 | return type;
53 | }
54 |
55 | /**
56 | * @return true if the operator is left associative, false if it's right
57 | */
58 | public boolean isLeftAssociative() {
59 | return leftAssociative;
60 | }
61 |
62 | /**
63 | * @return true if the operator is associative, false if it's right
64 | */
65 | public boolean isAssociative() {
66 | return associative;
67 | }
68 |
69 | /**
70 | * @return true if the operator is commutative, false if it is not
71 | */
72 | public boolean isCommutative() {
73 | return commutative;
74 | }
75 |
76 | /**
77 | * @return true if the operator is anticommutative, false if it is not
78 | */
79 | public boolean isAntiCommutative() {
80 | return anticommutative;
81 | }
82 |
83 | /**
84 | * @param c if it is 1 the operator is commutative, 0: noncommutative, -1: anticommutative
85 | */
86 | private void setCommutativity(int c) {
87 | if (c > 0) {
88 | commutative = true;
89 | anticommutative = false;
90 | } else if (c == 0) {
91 | commutative = false;
92 | anticommutative = false;
93 | } else {
94 | commutative = false;
95 | anticommutative = true;
96 | }
97 | }
98 |
99 | /**
100 | * @return The order of which the Operator is operated (higher = more priority)
101 | */
102 | public int getPrecedence() {
103 | return precedence;
104 | }
105 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/OperatorFactory.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | /**
4 | * Contains static methods that will create Operator pieces.
5 | *
6 | * @author Alston Lin, Ejaaz Merali
7 | * @version 3.0
8 | */
9 | public class OperatorFactory {
10 |
11 | public static Operator makeAdd() {
12 | return new Operator("+", Operator.ADD, Operator.ADD_SUBTRACT, true, 1, true) {
13 | @Override
14 | public double operate(double left, double right) {
15 | return left + right;
16 | }
17 | };
18 | }
19 |
20 | public static Operator makeSubtract() {
21 | return new Operator("−", Operator.SUBTRACT, Operator.ADD_SUBTRACT, true, -1, false) {
22 | @Override
23 | public double operate(double left, double right) {
24 | return left - right;
25 | }
26 | };
27 | }
28 |
29 | public static Operator makeMultiply() {
30 | return new Operator("×", Operator.MULTIPLY, Operator.MULTIPLY_DIVIDE, true, 1, true) {
31 | @Override
32 | public double operate(double left, double right) {
33 | return left * right;
34 | }
35 | };
36 | }
37 |
38 | public static Operator makeDivide() {
39 | return new Operator("/", Operator.DIVIDE, Operator.MULTIPLY_DIVIDE, true, 0, false) {
40 | @Override
41 | public double operate(double left, double right) {
42 | if (right == 0) {
43 | throw new ArithmeticException("Division by zero");
44 | } else {
45 | return left / right;
46 | }
47 | }
48 | };
49 | }
50 |
51 | public static Operator makeFraction() {
52 | return new Operator("", Operator.FRACTION, Operator.MULTIPLY_DIVIDE, true, 0, false) {
53 | @Override
54 | public double operate(double left, double right) {
55 | if (right == 0) {
56 | throw new ArithmeticException("Division by zero");
57 | } else {
58 | return left / right;
59 | }
60 | }
61 | };
62 | }
63 |
64 | public static Operator makeExponent() {
65 | return new Operator("", Operator.EXPONENT, Operator.EXPONENT_PRECEDENCE, false, 0, false) {
66 | @Override
67 | public double operate(double left, double right) {
68 | double result = Math.pow(left, right);
69 | if (result == Double.NaN)
70 | throw new IllegalArgumentException("The answer involves Imaginary numbers (currently not supported)");
71 | return result;
72 | }
73 | };
74 | }
75 |
76 | public static Operator makeFactorial() {
77 | return new Operator("!", Operator.FACTORIAL, Operator.EXPONENT_PRECEDENCE, false, 0, false) {
78 | @Override
79 | public double operate(double left, double right) {
80 | if (left % 1 != 0) { // Makes sure this is an integer
81 | throw new IllegalArgumentException();
82 | }
83 | return Utility.factorial((int) left);
84 | }
85 | };
86 | }
87 |
88 | public static Operator makeVariableRoot() {
89 | return new Operator("√", Operator.VARROOT, Operator.EXPONENT_PRECEDENCE, false, 0, false) {
90 | @Override
91 | public double operate(double left, double right) {
92 | if (left == 0) {
93 | throw new IllegalArgumentException("Cannot have 0 as the base for a variable root!");
94 | }
95 | return Math.pow(right, 1 / left);
96 | }
97 | };
98 | }
99 |
100 | public static Operator makePermutation() {
101 | return new Operator("P", Operator.PERMUTATION, Operator.EXPONENT_PRECEDENCE, false, 0, false) {
102 | @Override
103 | public double operate(double left, double right) {
104 | if (left % 1 != 0 || right % 1 != 0) {
105 | throw new IllegalArgumentException("Arguments must be integers");
106 | } else if (right > left) {
107 | throw new IllegalArgumentException("n must be greater than or equal to r");
108 | } else {
109 | try {
110 | if (right == left) {
111 | return Utility.factorial((int) left);
112 | } else {
113 | double unrounded = Utility.factorial((int) left) / Utility.factorial((int) (left - right));
114 | return Math.round(unrounded); //Can only give integer ansswers; fixes floating point errors
115 | }
116 | } catch (StackOverflowError e) {
117 | throw new IllegalArgumentException("The calculation is to large to compute.");
118 | }
119 | }
120 | }
121 | };
122 | }
123 |
124 | public static Operator makeCombination() {
125 | return new Operator("C", Operator.COMBINATION, Operator.EXPONENT_PRECEDENCE, false, 0, false) {
126 | @Override
127 | public double operate(double left, double right) throws NumberTooLargeException {
128 | if (left % 1 != 0 || right % 1 != 0) {
129 | throw new IllegalArgumentException("Arguments must be integers");
130 | } else {
131 | if (right > left) {
132 | throw new IllegalArgumentException("n must be greater than or equal to r");
133 | } else if (right == left) {
134 | return 1;
135 | } else {
136 | try {
137 | double unrounded = Utility.factorial((int) left) / (Utility.factorial((int) right) * Utility.factorial((int) (left - right)));
138 | return Math.round(unrounded);
139 | } catch (StackOverflowError e) {
140 | throw new IllegalArgumentException("The calculation is to large to compute.");
141 | }
142 | }
143 | }
144 | }
145 | };
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/OrderComparable.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | /**
4 | * Indicates that the Implementing Object has a getPrecedence() method.
5 | *
6 | * @author Alston Lin
7 | * @version 3.0
8 | */
9 | public interface OrderComparable {
10 | public int getPrecedence();
11 |
12 | public boolean isLeftAssociative();
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/OutputView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 TruTech Innovations Inc - All Rights Reserved
3 | */
4 |
5 | package com.trutechinnovations.calculall;
6 |
7 | import android.content.Context;
8 | import android.graphics.Canvas;
9 | import android.util.AttributeSet;
10 |
11 | import java.util.ArrayList;
12 |
13 | /**
14 | * Modified DisplayView to display outputs.
15 | *
16 | * @author Alston Lin
17 | * @version 3.0
18 | */
19 | public class OutputView extends NaturalView {
20 |
21 | private ArrayList expression = new ArrayList();
22 |
23 | public OutputView(Context context, AttributeSet attr) {
24 | super(context, attr);
25 | }
26 |
27 | /**
28 | * Displays the given mathematical expression on the view.
29 | *
30 | * @param expression The expression to display
31 | */
32 | public void display(ArrayList expression) {
33 | this.expression = Utility.cleanupExpressionForReading(expression);
34 | requestLayout();
35 | invalidate();
36 | }
37 |
38 | /**
39 | * Overrides the default android drawing method for this View.
40 | * This is where all the drawing for the display is handled.
41 | *
42 | * @param canvas The canvas that will be drawn on
43 | */
44 | @Override
45 | public void onDraw(Canvas canvas) {
46 | super.onDraw(canvas);
47 | drawExpression(expression, canvas, 0);
48 | }
49 |
50 | /**
51 | * Overrides the superclass' onMeasure to set the dimensions of the View
52 | * according to the parent's.
53 | *
54 | * @param widthMeasureSpec given by the parent class
55 | * @param heightMeasureSpec given by the parent class
56 | */
57 | @Override
58 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
59 | //Finds max X
60 | ArrayList drawX = calculateDrawX(expression);
61 | if (drawX.size() > 1) {
62 | maxX = drawX.get(drawX.size() - 1);
63 | }
64 | float maxY = drawExpression(expression, new Canvas(), 0);
65 | int width = (int) (maxX + textHeight);
66 | int height = expression.size() == 0 ? (int) textHeight : (int) (maxY + textHeight);
67 | this.setMeasuredDimension(width, height);
68 | }
69 |
70 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Placeholder.java:
--------------------------------------------------------------------------------
1 |
2 | package com.trutechinnovations.calculall;
3 |
4 | import java.io.Serializable;
5 |
6 | /**
7 | * Tokens that have no function at all, simply used to mark a point and add a visual.
8 | *
9 | * @author Alston Lin
10 | * @version 3.0
11 | */
12 | public class Placeholder extends Token implements Serializable {
13 |
14 | public static final int SUPERSCRIPT_BLOCK = 0, COMMA = 1, BASE_BLOCK = 2;
15 |
16 | /**
17 | * Creates a new Placeholder to be shown on the calculator screen.
18 | *
19 | * @param symbol The symbol of the Token to be shown on the calculator screen
20 | */
21 | protected Placeholder(String symbol, int type) {
22 | super(symbol);
23 | this.type = type;
24 | }
25 |
26 | /**
27 | * @return The type of Placeholder this is
28 | */
29 | public int getType() {
30 | return type;
31 | }
32 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/PlaceholderFactory.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | /**
4 | * Statically create Placeholders through anonymous classes.
5 | *
6 | * @author Alston Lin
7 | * @version 3.0
8 | */
9 | public class PlaceholderFactory {
10 |
11 | public static Placeholder makeSuperscriptBlock() {
12 | return new Placeholder("□", Placeholder.SUPERSCRIPT_BLOCK);
13 | }
14 |
15 | public static Placeholder makeBaseBlock() {
16 | return new Placeholder("□", Placeholder.BASE_BLOCK);
17 | }
18 |
19 | public static Placeholder makeComma() {
20 | return new Placeholder(",", Placeholder.COMMA);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/ReductionActivity.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.os.Bundle;
6 | import android.support.annotation.Nullable;
7 | import android.util.Log;
8 | import android.view.Gravity;
9 | import android.view.LayoutInflater;
10 | import android.view.MotionEvent;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.BaseAdapter;
14 | import android.widget.ListView;
15 |
16 | import java.util.ArrayList;
17 |
18 | /**
19 | * Created by david on 1/22/2017.
20 | */
21 |
22 | public class ReductionActivity extends ListViewActivity {
23 | public static final double CONSTANTS_IO_RATIO = 0.7; //The size of the output / input in the
24 | public static final String RREF = "RREF";
25 |
26 | ArrayList steps;
27 |
28 |
29 | @Override
30 | protected void onCreate(@Nullable Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.reduction_view);
33 |
34 | setUpListView(getIntent().getBooleanExtra(RREF,false));
35 |
36 | //Finds the ListView from the inflated consts XML so it could be manipulated
37 | ListView lv = (ListView) findViewById(R.id.reductionList);
38 |
39 | //Attaches the custom Adapter to the ListView so that it can configure the items and their Views within it
40 | lv.setAdapter(new ReductionAdapter());
41 | }
42 |
43 | public void setUpListView(boolean rref){
44 | steps = new ArrayList<>();
45 |
46 | try {
47 | ArrayList temp = MatrixUtils.setupExpression(Utility.condenseDigits(
48 | MatrixMode.getInstance().tokens
49 | ));
50 | temp = MatrixUtils.convertToReversePolish(temp);
51 | Token t = MatrixUtils.evaluateExpression(temp, false);
52 | if (t instanceof Matrix) {
53 | double[][] a = ((Matrix) t).getEntriesAsDbls();
54 | ArrayList input = new ArrayList<>();
55 | ArrayList output = new ArrayList<>();
56 | if (rref) {
57 | steps = MatrixUtils.knitSteps(a, MatrixUtils.getRREFSteps(a));
58 | input.add(0, new StringToken("RREF of "));
59 | } else {
60 | steps = MatrixUtils.knitSteps(a, MatrixUtils.getREFSteps(a));
61 | input.add(0, new StringToken("REF of "));
62 | }
63 | if (steps.size() == 0) {
64 | Token[] temp1 = new Token[2];
65 | temp1[0] = new StringToken("No Steps to show");
66 | temp1[1] = new StringToken("");
67 | steps.add(temp1);
68 | }
69 | input.addAll(MatrixMode.getInstance().tokens);
70 | output.add(steps.get(steps.size() - 1)[0]);
71 | MatrixMode.getInstance().saveEquation(input, output, MatrixMode.getInstance().filename);
72 | } else {
73 | throw new IllegalArgumentException("The result must be a single Matrix to be row reducible");
74 | }
75 | } catch (Exception e) { //an error was thrown
76 | Log.d(ReductionActivity.class.getSimpleName(),e.getMessage());
77 | }
78 | }
79 |
80 | @Override
81 | public String getViewTitle() {
82 | return "Row Reduction Steps";
83 | }
84 |
85 |
86 | /**
87 | * The custom Adapter for the ListView in the row reduction steps.
88 | */
89 | private class ReductionAdapter extends BaseAdapter {
90 |
91 | @Override
92 | public int getCount() {
93 | return steps.size();
94 | }
95 |
96 | @Override
97 | public Object getItem(int position) {
98 | return steps.get(position);
99 | }
100 |
101 | @Override
102 | public long getItemId(int position) {
103 | return position;
104 | }
105 |
106 | /**
107 | * Prepares the View of each item in the ListView that this Adapter will be attached to.
108 | *
109 | * @param position The index of the item
110 | * @param convertView The old view that may be reused, or null if not possible
111 | * @param parent The parent view
112 | * @return The newly prepared View that will visually represent the item in the ListView in the given position
113 | */
114 | @Override
115 | public View getView(int position, View convertView, ViewGroup parent) {
116 | if (convertView == null) { //For efficiency purposes so that it does not unnecessarily inflate Views
117 | //Inflates the XML file to get the View of the consts element
118 | LayoutInflater inflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
119 | convertView = inflater.inflate(R.layout.reduction_element, parent, false);
120 | }
121 |
122 | //Sets up the child Views within each item in the ListView
123 | OutputView intermediate = (OutputView) convertView.findViewById(R.id.input);
124 | OutputView step = (OutputView) convertView.findViewById(R.id.step);
125 |
126 | //Sets the font size of each OutputView
127 | intermediate.setFontSize(MatrixMode.getInstance().activity.getFontSize());
128 | step.setFontSize((int) (MatrixMode.getInstance().activity.getFontSize() * CONSTANTS_IO_RATIO));
129 |
130 | //Enters the appropriate expressions to the OutputView
131 | Token[] entry = steps.get(position);
132 | ArrayList temp = new ArrayList<>();
133 | temp.add(entry[0]);
134 | intermediate.display(temp);
135 | temp.clear();
136 | temp.add(entry[1]);
137 | step.display(temp);
138 | temp.clear();
139 |
140 | //To respond to user touches
141 | final Token INPUT = steps.get(position)[0]; //Makes a constant reference so that intermediate matrices can be accessed by an inner class
142 | convertView.findViewById(R.id.reduction_wrapper).setOnClickListener(new View.OnClickListener() {
143 | @Override
144 | public void onClick(View v) {
145 | ArrayList input = new ArrayList<>();
146 | //Removes any StringTokens
147 | if (!(INPUT instanceof StringToken)) {
148 | input.add(INPUT);
149 | }
150 | //Adds the input expression to the current tokens
151 | MatrixMode.getInstance().tokens.addAll(input); //Adds the input of the entry
152 | finish();
153 | MatrixMode.getInstance().updateInput();
154 | }
155 | });
156 | return convertView;
157 | }
158 | }
159 | }
160 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/StringToken.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * A Token that holds a String for display purposes.
7 | *
8 | * @author Alston Lin
9 | * @version 3.0
10 | */
11 | public class StringToken extends Token implements Serializable {
12 | /**
13 | * Creates a new Token to be shown on the calculator screen.
14 | *
15 | * @param s The string to display
16 | */
17 | protected StringToken(String s) {
18 | super(s);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/ThemeHelper.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 |
6 | /**
7 | * Created by david on 1/15/2017.
8 | */
9 |
10 | public class ThemeHelper {
11 |
12 | public final static int BLACK_AND_YELLOW = 2;
13 | public final static int DEFAULT_THEME = 2;
14 | public final static int DAVID = 1;
15 | public final static int PURPLE = 3;
16 | public final static int BLUE = 4;
17 | public final static int BLUEGREEN = 5;
18 | public final static int DONATE = 6;
19 |
20 | public static int setUpTheme(Context context, boolean appbar){
21 | SharedPreferences pref = context.getSharedPreferences(context.getString(R.string.preference_key), Context.MODE_PRIVATE);
22 | int currentTheme = pref.getInt(context.getString(R.string.theme), 2);
23 | //Sets up the current theme
24 | switch (currentTheme) {
25 | case DAVID:
26 | context.setTheme(appbar?
27 | R.style.AppTheme_David:
28 | R.style.AppThemeNoActionBar_David);
29 | return DAVID;
30 | case PURPLE:
31 | context.setTheme(appbar?
32 | R.style.AppTheme_Purple:
33 | R.style.AppThemeNoActionBar_Purple);
34 | return PURPLE;
35 | case BLUE:
36 | context.setTheme(appbar?
37 | R.style.AppTheme_Blue:
38 | R.style.AppThemeNoActionBar_Blue);
39 | return BLUE;
40 | case BLUEGREEN:
41 | context.setTheme(appbar?
42 | R.style.AppTheme_BlueGreen:
43 | R.style.AppThemeNoActionBar_BlueGreen);
44 | return BLUEGREEN;
45 | case DONATE:
46 | context.setTheme(appbar?
47 | R.style.AppTheme_Donate:
48 | R.style.AppThemeNoActionBar_Donate);
49 | return DONATE;
50 | default:
51 | context.setTheme(appbar?
52 | R.style.AppTheme_BlackAndYellow:
53 | R.style.AppThemeNoActionBar_BlackAndYellow);
54 | return BLACK_AND_YELLOW;
55 | }
56 |
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/ThemeSelectActivity.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.graphics.drawable.ColorDrawable;
6 | import android.os.Bundle;
7 | import android.support.annotation.Nullable;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.view.LayoutInflater;
10 | import android.view.MenuItem;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.BaseAdapter;
14 | import android.widget.ImageButton;
15 | import android.widget.ImageView;
16 | import android.widget.LinearLayout;
17 | import android.widget.ListView;
18 | import android.widget.TextView;
19 |
20 | /**
21 | * Created by david on 1/16/2017.
22 | */
23 |
24 | public class ThemeSelectActivity extends AppCompatActivity {
25 | public static final boolean DONATE_ON = true;;
26 | private ImageAdapter adapter;
27 |
28 | @Override
29 | protected void onCreate(@Nullable Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | ThemeHelper.setUpTheme(this,true);
32 | setContentView(R.layout.themes_select);
33 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
34 | getSupportActionBar().setDisplayShowHomeEnabled(true);
35 | setTitle("Select A Theme");
36 | //Sets up the theme
37 | ListView gv = (ListView) findViewById(R.id.themes_grid);
38 | adapter = new ImageAdapter(this);
39 | gv.setAdapter(adapter);
40 | }
41 |
42 | public boolean onOptionsItemSelected(MenuItem item){
43 | switch(item.getItemId()) {
44 | case android.R.id.home:
45 | finish();
46 | return true;
47 | }
48 | return false;
49 | }
50 |
51 |
52 | public class ImageAdapter extends BaseAdapter {
53 | LayoutInflater inflater;
54 | private Context mContext;
55 | private String[] theme_names = new String[]{"Blue Delight", "Orange on Black", "Purple Monster", "Green Forest", "Carribean Blue", "Donate"};
56 | private int[] color1 = new int[]{R.color.dThemePrimary,R.color.byThemePrimary,R.color.pThemePrimary,R.color.bThemePrimary,R.color.bgThemePrimary,R.color.donateThemePrimary};
57 | private int[] color2 = new int[]{R.color.dThemePrimaryDark,R.color.byThemePrimaryDark,R.color.pThemePrimaryDark,R.color.bThemePrimaryDark,R.color.bgThemePrimaryDark,R.color.donateThemePrimaryDark};
58 | private int[] text = new int[]{R.color.dThemeHighlight,R.color.byThemeHighlight,R.color.pThemeHighlight,R.color.bThemeHighlight,R.color.bgThemeHighlight,R.color.donateThemeHighlight};
59 |
60 | // Constructor
61 | public ImageAdapter(Context c) {
62 | mContext = c;
63 | inflater = LayoutInflater.from(mContext);
64 | }
65 |
66 | public int getCount() {
67 | return DONATE_ON ? theme_names.length : theme_names.length - 1;
68 | }
69 |
70 | public Object getItem(int position) {
71 | return null;
72 | }
73 |
74 | public long getItemId(int position) {
75 | return 0;
76 | }
77 |
78 | // create a new ImageView for each item referenced by the Adapter
79 | public View getView(final int position, View convertView, ViewGroup parent) {
80 | ThemeHolder mViewHolder;
81 | final int curr = position;
82 | if (convertView == null) {
83 | convertView = inflater.inflate(R.layout.theme_item, parent, false);
84 | mViewHolder = new ThemeHolder(convertView);
85 | convertView.setTag(mViewHolder);
86 |
87 | convertView.setOnClickListener(new View.OnClickListener() {
88 | @Override
89 | public void onClick(View v) {
90 | SharedPreferences pref = getSharedPreferences(getString(R.string.preference_key), Context.MODE_PRIVATE);
91 | SharedPreferences.Editor editor = pref.edit();
92 | editor.putInt(getString(R.string.theme), position+1);
93 | editor.apply();
94 | finish();
95 | }
96 | });
97 | } else {
98 | mViewHolder = (ThemeHolder) convertView.getTag();
99 | }
100 |
101 | ((TextView) convertView.findViewById(R.id.title)).setText(theme_names[position]);
102 | //((TextView) convertView.findViewById(R.id.sample_text)).setTextColor(getResources().getColor(text[position]));
103 | ((ImageButton) convertView.findViewById(R.id.color1)).setImageDrawable(
104 | new ColorDrawable(getResources().getColor(color1[position])));
105 | ((ImageButton) convertView.findViewById(R.id.color2)).setImageDrawable(
106 | new ColorDrawable(getResources().getColor(color2[position])));
107 |
108 | return convertView;
109 | }
110 |
111 | private class ThemeHolder {
112 | TextView title;
113 | ImageView color1, color2;
114 | LinearLayout section;
115 |
116 | public ThemeHolder(View item) {
117 | title = (TextView) item.findViewById(R.id.title);
118 | color1 = (ImageView) item.findViewById(R.id.color1);
119 | color2 = (ImageView) item.findViewById(R.id.color2);
120 | section = (LinearLayout) item.findViewById(R.id.theme_select);
121 | }
122 | }
123 |
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Token.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.io.Serializable;
4 | import java.util.ArrayList;
5 |
6 | /**
7 | * Represents a digit, operation, brackets, or a function on the calculator screen; cannot be used by itself
8 | * (must use a subclass of this).
9 | *
10 | * @author Alston Lin
11 | * @version 3.0
12 | */
13 | public abstract class Token implements Serializable {
14 |
15 | protected int type;
16 | private ArrayList dependencies = new ArrayList(); //Tokens that are dependent with this token
17 | private String symbol;
18 |
19 | /**
20 | * Creates a new Token to be shown on the calculator screen.
21 | *
22 | * @param symbol The symbol of the Token to be shown on the calculator screen
23 | */
24 | protected Token(String symbol) {
25 | this.symbol = symbol;
26 | }
27 |
28 | /**
29 | * @return The symbol for this Token to be shown on the display
30 | */
31 | public String getSymbol() {
32 | return symbol;
33 | }
34 |
35 | /**
36 | * Adds a dependent token to the list; if this token is removed so would the dependencies.
37 | *
38 | * @param t The token that is dependent on this one
39 | */
40 | public void addDependency(Token t) {
41 | dependencies.add(t);
42 | }
43 |
44 | /**
45 | * @return The Tokens that are dependent on this one
46 | */
47 | public ArrayList getDependencies() {
48 | return dependencies;
49 | }
50 |
51 | public int getType() {
52 | return type;
53 | }
54 | }
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Variable.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.io.Serializable;
4 | import java.util.ArrayList;
5 |
6 | /**
7 | * Represents either a user-defined value or a variable for a function, represented by
8 | * english letters (ex. x, y, z). It also includes constants as well (such as Pi and e)
9 | *
10 | * @author Alston Lin
11 | * @version 3.0
12 | */
13 | public abstract class Variable extends Token implements Serializable {
14 |
15 | public static final int A = 1, B = 2, C = 3, X = 4, PI = 5, E = 6, ANS = 7,
16 | CONSTANT = 8, MATRIX_A = 9, MATRIX_B = 10, MATRIX_C = 11, U = 12,
17 | V = 13, S = 14, T = 15, Y = 16;
18 | public static final double PI_VALUE = Math.PI, E_VALUE = Math.E;
19 | public boolean negative = false;
20 |
21 | /**
22 | * Constructor for a Token that represents a user-defined value (algebraic variable)
23 | *
24 | * @param type The type of variable as defined by the class constants
25 | * @param symbol The symbol as it will be shown as on the display
26 | */
27 | protected Variable(int type, String symbol) {
28 | super(symbol);
29 | this.type = type;
30 | }
31 |
32 | public int getType() {
33 | return type;
34 | }
35 |
36 | public boolean isNegative() {
37 | return negative;
38 | }
39 |
40 | public void setNegative(boolean negative) {
41 | this.negative = negative;
42 | }
43 |
44 | public String getSymbol() {
45 | String symbol = "";
46 | if (negative) {
47 | symbol = "-";
48 | }
49 | symbol += super.getSymbol();
50 | return symbol;
51 | }
52 |
53 | /**
54 | * @return The value of the variable/constant
55 | */
56 | public abstract ArrayList getValue();
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/VariableFactory.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.util.ArrayList;
4 |
5 | /**
6 | * Contains static methods that will create Variable tokens.
7 | *
8 | * @author Alston Lin, Ejaaz Merali
9 | * @version 3.0
10 | */
11 | public class VariableFactory {
12 | //Advanced
13 | public static ArrayList aValue = new ArrayList<>();
14 | public static ArrayList bValue = new ArrayList<>();
15 | public static ArrayList cValue = new ArrayList<>();
16 |
17 | //Function
18 | public static ArrayList xValue = new ArrayList<>();
19 | public static ArrayList yValue = new ArrayList<>();
20 |
21 | //Vector
22 | public static ArrayList uValue = new ArrayList<>();
23 | public static ArrayList vValue = new ArrayList<>();
24 | public static ArrayList sValue = new ArrayList<>();
25 | public static ArrayList tValue = new ArrayList<>();
26 |
27 | //Matrix
28 | public static ArrayList matrixAValue = new ArrayList<>();
29 | public static ArrayList matrixBValue = new ArrayList<>();
30 | public static ArrayList matrixCValue = new ArrayList<>();
31 |
32 | //Ans
33 | public static ArrayList ansValueAdv = new ArrayList<>(); //Values of the variables
34 | public static ArrayList ansValueFunc = new ArrayList<>(); //Values of the variables
35 | public static ArrayList ansValueVec = new ArrayList<>(); //Values of the variables
36 | public static ArrayList ansValueMat = new ArrayList<>(); //Values of the variables
37 |
38 | public static Variable makeA() {
39 | return new Variable(Variable.A, "A") {
40 | public ArrayList getValue() {
41 | return aValue;
42 | }
43 | };
44 | }
45 |
46 | public static Variable makeB() {
47 | return new Variable(Variable.B, "B") {
48 | public ArrayList getValue() {
49 | return bValue;
50 | }
51 | };
52 | }
53 |
54 | public static Variable makeC() {
55 | return new Variable(Variable.C, "C") {
56 | public ArrayList getValue() {
57 | return cValue;
58 | }
59 | };
60 | }
61 |
62 | public static Variable makeConstant() {
63 | return new Variable(Variable.CONSTANT, "Constant") {
64 | public ArrayList getValue() {
65 | return cValue;
66 | }
67 | };
68 | }
69 |
70 | public static Variable makeX() {
71 | return new Variable(Variable.X, "X") {
72 | public ArrayList getValue() {
73 | return xValue;
74 | }
75 | };
76 | }
77 |
78 | public static Variable makeY() {
79 | return new Variable(Variable.Y, "Y") {
80 | public ArrayList getValue() {
81 | return yValue;
82 | }
83 | };
84 | }
85 |
86 | public static Variable makePI() {
87 | return new Variable(Variable.PI, "π") {
88 | public ArrayList getValue() {
89 | ArrayList tokens = new ArrayList<>();
90 | tokens.add(new Number(PI_VALUE));
91 | return tokens;
92 | }
93 |
94 | public String toLaTeX() {
95 | return "$\\pi$";
96 | }
97 | };
98 | }
99 |
100 | public static Variable makeE() {
101 | return new Variable(Variable.E, "e") {
102 | public ArrayList getValue() {
103 | ArrayList tokens = new ArrayList<>();
104 | tokens.add(new Number(E_VALUE));
105 | return tokens;
106 | }
107 |
108 | public String toLaTeX() {
109 | return "$e$";
110 | }
111 | };
112 | }
113 |
114 | public static Variable makeAnsAdv() {
115 | return new Variable(Variable.ANS, "ANS") {
116 | public ArrayList getValue() {
117 | return ansValueAdv;
118 | }
119 | };
120 | }
121 |
122 | public static Variable makeAnsFunc() {
123 | return new Variable(Variable.ANS, "ANS") {
124 | public ArrayList getValue() {
125 | return ansValueFunc;
126 | }
127 | };
128 | }
129 |
130 | public static Variable makeAnsVec() {
131 | return new Variable(Variable.ANS, "ANS") {
132 | public ArrayList getValue() {
133 | return ansValueVec;
134 | }
135 | };
136 | }
137 |
138 | public static Variable makeAnsMat() {
139 | return new Variable(Variable.ANS, "ANS") {
140 | public ArrayList getValue() {
141 | return ansValueMat;
142 | }
143 | };
144 | }
145 |
146 | public static Variable makeU() {
147 | return new Variable(Variable.U, "U") {
148 | public ArrayList getValue() {
149 | return uValue;
150 | }
151 | };
152 | }
153 |
154 | public static Variable makeV() {
155 | return new Variable(Variable.V, "V") {
156 | public ArrayList getValue() {
157 | return vValue;
158 | }
159 | };
160 | }
161 |
162 | public static Variable makeS() {
163 | return new Variable(Variable.S, "s") {
164 | public ArrayList getValue() {
165 | return sValue;
166 | }
167 | };
168 | }
169 |
170 | public static Variable makeT() {
171 | return new Variable(Variable.T, "t") {
172 | public ArrayList getValue() {
173 | return tValue;
174 | }
175 | };
176 | }
177 |
178 | public static Variable makeMatrixA() {
179 | return new Variable(Variable.MATRIX_A, "A") {
180 | public ArrayList getValue() {
181 | return matrixAValue;
182 | }
183 | };
184 | }
185 |
186 | public static Variable makeMatrixB() {
187 | return new Variable(Variable.MATRIX_B, "B") {
188 | public ArrayList getValue() {
189 | return matrixBValue;
190 | }
191 | };
192 | }
193 |
194 | public static Variable makeMatrixC() {
195 | return new Variable(Variable.MATRIX_C, "C") {
196 | public ArrayList getValue() {
197 | return matrixCValue;
198 | }
199 | };
200 | }
201 |
202 | public static Variable makeConstantToken(Constant inConstant) {
203 | final Constant constant = inConstant;
204 | return new Variable(Variable.CONSTANT, constant.getSymbol()) {
205 | public ArrayList getValue() {
206 | ArrayList tokens = new ArrayList<>();
207 | tokens.addAll(constant.getValue());
208 | return tokens;
209 | }
210 |
211 | public String toLaTeX() {
212 | return constant.getSymbol();
213 | }
214 | };
215 | }
216 |
217 | }
218 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/Vector.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Represents a Vector for Vector Mode.
7 | *
8 | * @author Alston Lin
9 | * @version 3.0
10 | */
11 | public class Vector extends Token implements Serializable {
12 | private double[] values;
13 |
14 | public Vector(double[] values) {
15 | super(null);
16 | this.values = values;
17 | }
18 |
19 | public double[] getValues() {
20 | return values;
21 | }
22 |
23 | public int getDimensions() {
24 | return values.length;
25 | }
26 |
27 | /**
28 | * Determines whats gets displayed onto the Screen.
29 | *
30 | * @return The visual representation of the Vector
31 | */
32 | public String getSymbol() {
33 | String s = "[";
34 | for (int i = 0; i < values.length; i++) {
35 | if (i != 0) {
36 | s += ", ";
37 | }
38 | double value = Utility.round(values[i], Number.roundTo);
39 | String string = Double.toString(value);
40 | string = !string.contains(".") ? string : (string.indexOf("E") > 0 ? string.substring(0, string.indexOf("E")).replaceAll("0*$", "")
41 | .replaceAll("\\.$", "").concat(string.substring(string.indexOf("E"))) : string.replaceAll("0*$", "")
42 | .replaceAll("\\.$", "")); //Removes trailing zeroes
43 | s += string;
44 | }
45 | s += "]";
46 | return s;
47 | }
48 |
49 | public String getLaTeX() {
50 | String output = "$" + "\\begin{bmatrix}";
51 | for (int i = 0; i < values.length; i++) {
52 | output += (new Double(values[i])).toString();
53 | output += "\\\\";
54 | }
55 | output += "\\end{bmatrix}" + "$";
56 | return output;
57 | }
58 |
59 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/VectorFragment.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import android.os.Bundle;
4 | import android.text.Html;
5 | import android.text.Spanned;
6 | import android.text.SpannedString;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.Button;
11 | import android.widget.ToggleButton;
12 |
13 | import java.util.ArrayList;
14 |
15 | /**
16 | * Defines the UI ofr VectorMode.
17 | *
18 | * @author Alston Lin
19 | * @version Alpha 3.0
20 | */
21 | public class VectorFragment extends BasicFragment {
22 | @Override
23 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
24 | VectorMode.getInstance().setFragment(this);
25 | View v = inflater.inflate(R.layout.vector, container, false);
26 | setupButtons(v);
27 | return v;
28 | }
29 |
30 | /**
31 | * Sets up the buttons.
32 | *
33 | * @param v The view of the Fragment
34 | */
35 | private void setupButtons(View v) {
36 | MultiButton sinButton = (MultiButton) v.findViewById(R.id.sin_button);
37 | MultiButton cosButton = (MultiButton) v.findViewById(R.id.cos_button);
38 | MultiButton tanButton = (MultiButton) v.findViewById(R.id.tan_button);
39 | //Sets up the MultiButtons
40 | Spanned[] sinStrings = new Spanned[4];
41 | Spanned[] cosStrings = new Spanned[4];
42 | Spanned[] tanStrings = new Spanned[4];
43 | Command[] sinCommands = new Command[4];
44 | Command[] cosCommands = new Command[4];
45 | Command[] tanCommands = new Command[4];
46 | //Sets the strings
47 | sinStrings[0] = SpannedString.valueOf("sin");
48 | sinStrings[1] = Html.fromHtml(getString(R.string.arcsin));
49 | sinStrings[2] = SpannedString.valueOf("sinh");
50 | sinStrings[3] = Html.fromHtml(getString(R.string.arcsinh));
51 |
52 | cosStrings[0] = SpannedString.valueOf("cos");
53 | cosStrings[1] = Html.fromHtml(getString(R.string.arccos));
54 | cosStrings[2] = SpannedString.valueOf("cosh");
55 | cosStrings[3] = Html.fromHtml(getString(R.string.arccosh));
56 |
57 | tanStrings[0] = SpannedString.valueOf("tan");
58 | tanStrings[1] = Html.fromHtml(getString(R.string.arctan));
59 | tanStrings[2] = SpannedString.valueOf("tanh");
60 | tanStrings[3] = Html.fromHtml(getString(R.string.arctanh));
61 | //Sets the commands
62 | final VectorMode advanced = (VectorMode) VectorMode.getInstance();
63 | sinCommands[0] = new Command() {
64 | @Override
65 | public Void execute(Void o) {
66 | advanced.clickSin();
67 | return null;
68 | }
69 | };
70 | sinCommands[1] = new Command() {
71 | @Override
72 | public Void execute(Void o) {
73 | advanced.clickASin();
74 | return null;
75 | }
76 | };
77 | sinCommands[2] = new Command() {
78 | @Override
79 | public Void execute(Void o) {
80 | advanced.clickSinh();
81 | return null;
82 | }
83 | };
84 | sinCommands[3] = new Command() {
85 | @Override
86 | public Void execute(Void o) {
87 | advanced.clickASinh();
88 | return null;
89 | }
90 | };
91 |
92 | cosCommands[0] = new Command() {
93 | @Override
94 | public Void execute(Void o) {
95 | advanced.clickCos();
96 | return null;
97 | }
98 | };
99 | cosCommands[1] = new Command() {
100 | @Override
101 | public Void execute(Void o) {
102 | advanced.clickACos();
103 | return null;
104 | }
105 | };
106 | cosCommands[2] = new Command() {
107 | @Override
108 | public Void execute(Void o) {
109 | advanced.clickCosh();
110 | return null;
111 | }
112 | };
113 | cosCommands[3] = new Command() {
114 | @Override
115 | public Void execute(Void o) {
116 | advanced.clickACosh();
117 | return null;
118 | }
119 | };
120 |
121 | tanCommands[0] = new Command() {
122 | @Override
123 | public Void execute(Void o) {
124 | advanced.clickTan();
125 | return null;
126 | }
127 | };
128 | tanCommands[1] = new Command() {
129 | @Override
130 | public Void execute(Void o) {
131 | advanced.clickATan();
132 | return null;
133 | }
134 | };
135 | tanCommands[2] = new Command() {
136 | @Override
137 | public Void execute(Void o) {
138 | advanced.clickTanh();
139 | return null;
140 | }
141 | };
142 | tanCommands[3] = new Command() {
143 | @Override
144 | public Void execute(Void o) {
145 | advanced.clickATanh();
146 | return null;
147 | }
148 | };
149 |
150 | sinButton.setModeTexts(sinStrings);
151 | sinButton.setOnClicks(sinCommands);
152 |
153 | cosButton.setModeTexts(cosStrings);
154 | cosButton.setOnClicks(cosCommands);
155 |
156 | tanButton.setModeTexts(tanStrings);
157 | tanButton.setOnClicks(tanCommands);
158 |
159 | //Stores the MultiButtons to the back-end
160 | ArrayList buttons = new ArrayList<>();
161 | buttons.add(sinButton);
162 | buttons.add(cosButton);
163 | buttons.add(tanButton);
164 |
165 | advanced.setMultiButtons(buttons);
166 |
167 | //Sets the Angle mode button the the appropriate text
168 | Button angleModeButton = (Button) v.findViewById(R.id.angle_mode_vector);
169 | switch (Function.angleMode) {
170 | case Function.DEGREE:
171 | angleModeButton.setText("DEG");
172 | break;
173 | case Function.RADIAN:
174 | angleModeButton.setText("RAD");
175 | break;
176 | case Function.GRADIAN:
177 | angleModeButton.setText("GRAD");
178 | break;
179 | }
180 | //Restores the toggle buttons to their states
181 | ToggleButton shift = (ToggleButton) v.findViewById(R.id.shift_button);
182 | ToggleButton mem = (ToggleButton) v.findViewById(R.id.mem_button_v);
183 | shift.setChecked(((VectorMode) VectorMode.getInstance()).isShift());
184 | mem.setChecked(((VectorMode) VectorMode.getInstance()).isMem());
185 | }
186 |
187 | }
188 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/VectorFunction.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | /**
4 | * Object representation of a Function used with Vectors.
5 | *
6 | * @author Alston Lin
7 | * @version 3.0
8 | */
9 | public abstract class VectorFunction extends Token {
10 | public static final int MAGNITUDE = 1, UNIT = 2, PROJ = 3;
11 | private int type;
12 |
13 | public VectorFunction(String symbol, int type) {
14 | super(symbol);
15 | this.type = type;
16 | }
17 |
18 | public abstract Token perform(Vector v);
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/VectorFunctionFactory.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | /**
4 | * Contains static factory methods for Functions used by Vector Mode.
5 | *
6 | * @author Alston Lin
7 | * @version 3.0
8 | */
9 | public class VectorFunctionFactory {
10 | public static VectorFunction makeMagnitude() {
11 | return new VectorFunction("MAGNITUDE", VectorFunction.MAGNITUDE) {
12 | @Override
13 | public Number perform(Vector v) {
14 | return new Number(VectorUtilities.calculateMagnitude(v));
15 | }
16 | };
17 | }
18 |
19 | public static VectorFunction makeUnit() {
20 | return new VectorFunction("Û", VectorFunction.UNIT) {
21 | @Override
22 | public Token perform(Vector v) {
23 | double magnitude = VectorUtilities.calculateMagnitude(v);
24 | double[] unitVector = new double[v.getDimensions()];
25 | for (int i = 0; i < v.getDimensions(); i++) {
26 | unitVector[i] = v.getValues()[i] / magnitude;
27 | }
28 | return new Vector(unitVector);
29 | }
30 |
31 | };
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/trutechinnovations/calculall/VectorOperator.java:
--------------------------------------------------------------------------------
1 | package com.trutechinnovations.calculall;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Object representation of an Operator to be used by Vectors.
7 | *
8 | * @author Alston Lin
9 | * @version 3.0
10 | */
11 | public abstract class VectorOperator extends Token implements Serializable, OrderComparable {
12 | public static final int ADD = 1, SUBTRACT = 2, DOT = 3, CROSS = 4, ANGLE = 5;
13 | private int type;
14 | private int precedence;
15 | private boolean leftAssociative;
16 |
17 | public VectorOperator(String symbol, int type, int precedence, boolean leftAssociative) {
18 | super(symbol);
19 | this.type = type;
20 | this.precedence = precedence;
21 | this.leftAssociative = leftAssociative;
22 | }
23 |
24 | public abstract Token operate(Token left, Token right);
25 |
26 | public int getPrecedence() {
27 | return precedence;
28 | }
29 |
30 | public boolean isLeftAssociative() {
31 | return leftAssociative;
32 | }
33 |
34 | public int getType() {
35 | return type;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/Thumbs.db
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/button_light_trailblazer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 | -
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/change_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/drawable/change_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/change_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/drawable/change_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/frac_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/drawable/frac_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/frac_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/drawable/frac_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/history_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/drawable/history_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/history_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/drawable/history_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/drawable/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/settings_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/drawable/settings_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/settings_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/drawable/settings_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/toggle_alston.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/toggle_panda.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/toggle_trailblazer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/drawable/trutech.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/drawable/trutech.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_assignment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/ic_action_assignment.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_assignment_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/ic_action_assignment_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/ic_action_settings.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_settings_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/ic_action_settings_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/ic_change.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_change_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/ic_change_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_frac_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/ic_frac_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_frac_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/ic_frac_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_assignment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-mdpi/ic_action_assignment.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_assignment_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-mdpi/ic_action_assignment_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-mdpi/ic_action_settings.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_settings_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-mdpi/ic_action_settings_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-mdpi/ic_change.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_change_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-mdpi/ic_change_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_frac_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-mdpi/ic_frac_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_frac_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-mdpi/ic_frac_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ripple_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
5 |
6 |
-
7 |
8 |
-
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | -
19 |
20 |
-
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | -
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ripple_button_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
5 |
6 |
-
7 |
8 |
-
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | -
19 |
20 |
-
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | -
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xhdpi/Thumbs.db
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_assignment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xhdpi/ic_action_assignment.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_assignment_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xhdpi/ic_action_assignment_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xhdpi/ic_action_settings.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_settings_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xhdpi/ic_action_settings_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xhdpi/ic_change.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_change_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xhdpi/ic_change_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_frac_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xhdpi/ic_frac_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_frac_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xhdpi/ic_frac_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_assignment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xxhdpi/ic_action_assignment.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_assignment_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xxhdpi/ic_action_assignment_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xxhdpi/ic_action_settings.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_settings_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xxhdpi/ic_action_settings_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xxhdpi/ic_change.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_change_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xxhdpi/ic_change_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_frac_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xxhdpi/ic_frac_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_frac_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xxhdpi/ic_frac_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/change_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable/change_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/change_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable/change_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/eigenvector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable/eigenvector.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/frac_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable/frac_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/frac_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable/frac_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/history_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable/history_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/history_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable/history_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ripple_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
-
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | -
16 |
17 |
-
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | -
28 |
29 |
-
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | -
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ripple_button_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
-
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | -
16 |
17 |
-
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | -
28 |
29 |
-
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | -
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/settings_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable/settings_black.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/settings_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable/settings_white.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/trutech.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable/trutech.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/vector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/drawable/vector.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/about_page.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
22 |
23 |
33 |
34 |
44 |
45 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/constants_element.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
19 |
20 |
31 |
32 |
43 |
44 |
55 |
56 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/constants_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/decomposition_element.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
22 |
23 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/decomposition_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/element.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/elements_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
32 |
33 |
34 |
43 |
44 |
50 |
51 |
62 |
63 |
69 |
70 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/frame.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
13 |
14 |
22 |
23 |
33 |
34 |
39 |
40 |
44 |
45 |
53 |
54 |
59 |
60 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
86 |
87 |
88 |
97 |
98 |
103 |
104 |
105 |
119 |
120 |
121 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/graph_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
16 |
21 |
30 |
40 |
41 |
45 |
54 |
55 |
64 |
65 |
66 |
67 |
76 |
81 |
90 |
91 |
99 |
100 |
104 |
113 |
114 |
123 |
124 |
125 |
126 |
133 |
134 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/graph_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/history_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/history_element.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
22 |
23 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/reduction_element.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
29 |
30 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/reduction_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/spinner_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/theme_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
26 |
27 |
32 |
33 |
43 |
44 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/themes_select.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/matrix_mode.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_settings.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/ocrmode.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/vector.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/res/drawable-hdpi/ic_action_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/res/drawable-hdpi/ic_action_done.png
--------------------------------------------------------------------------------
/app/src/main/res/res/drawable-mdpi/ic_action_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/res/drawable-mdpi/ic_action_done.png
--------------------------------------------------------------------------------
/app/src/main/res/res/drawable-xhdpi/ic_action_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/res/drawable-xhdpi/ic_action_done.png
--------------------------------------------------------------------------------
/app/src/main/res/res/drawable-xxhdpi/ic_action_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/res/drawable-xxhdpi/ic_action_done.png
--------------------------------------------------------------------------------
/app/src/main/res/res/drawable-xxxhdpi/ic_action_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/app/src/main/res/res/drawable-xxxhdpi/ic_action_done.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attr.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #F44336
4 | #B71C1C
5 | #FF1744
6 |
7 | #ff282f34
8 | #ffFF9900
9 | #ff333c42
10 | #fff
11 |
12 | #21303f
13 | #ff34495d
14 | #ecf0f0
15 | #ef4848
16 |
17 | #1b0b22
18 | #3a215f
19 | #ecf0f0
20 | #d1a7ff
21 |
22 | #1c393a
23 | #245554
24 | #ecf0f0
25 | #9affd0
26 |
27 | #0B486B
28 | #3B8686
29 | #ecf0f0
30 | #98f0b6
31 |
32 | #c5b210
33 | #e8c400
34 | #ecf0f0
35 | #ffe113
36 |
37 | #33000000
38 | #222
39 | #00ffffff
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 0dp
4 | 0dp
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
13 |
18 |
23 |
24 |
27 |
30 |
33 |
34 |
35 |
36 |
46 |
47 |
51 |
52 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 |
20 |
24 |
25 |
35 |
36 |
42 |
43 |
49 |
50 |
56 |
57 |
63 |
64 |
70 |
71 |
77 |
78 |
84 |
85 |
91 |
92 |
98 |
99 |
105 |
106 |
112 |
113 |
119 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:2.2.3'
8 | }
9 | }
10 | allprojects {
11 | repositories {
12 | jcenter()
13 | }
14 | }
15 | dependencies {
16 | }
17 | task clean(type: Delete) {
18 | delete rootProject.buildDir
19 | }
20 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx4096m
2 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlstonLin/Calculall/e975aca17acadac32690ce7f97739165398a4c0a/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jan 09 03:13:13 EST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/import-summary.txt:
--------------------------------------------------------------------------------
1 | ECLIPSE ANDROID PROJECT IMPORT SUMMARY
2 | ======================================
3 |
4 | Ignored Files:
5 | --------------
6 | The following files were *not* copied into the new Gradle project; you
7 | should evaluate whether these are still needed in your project and if
8 | so manually move them:
9 |
10 | * TruTech Calculall Work Docs.docx
11 | * color scheme.PNG
12 | * ic_launcher-web.png
13 | * proguard-project.txt
14 |
15 | Moved Files:
16 | ------------
17 | Android Gradle projects use a different directory structure than ADT
18 | Eclipse projects. Here's how the projects were restructured:
19 |
20 | * AndroidManifest.xml => app\src\main\AndroidManifest.xml
21 | * assets\ => app\src\main\assets\
22 | * res\ => app\src\main\res\
23 | * src\ => app\src\main\java\
24 |
25 | Next Steps:
26 | -----------
27 | You can now build the project. The Gradle project needs network
28 | connectivity to download dependencies.
29 |
30 | Bugs:
31 | -----
32 | If for some reason your project does not build, and you determine that
33 | it is due to a bug or limitation of the Eclipse to Gradle importer,
34 | please file a bug at http://b.android.com with category
35 | Component-Tools.
36 |
37 | (This import summary is for your information only, and can be deleted
38 | after import once you are satisfied with the results.)
39 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------