Skip to content

Commit

Permalink
Merge pull request #31 from MATDEV-Technologies/working
Browse files Browse the repository at this point in the history
Bugfix for update 1.1 MERGED
  • Loading branch information
MichaelSDavid authored Aug 21, 2020
2 parents d5e06c8 + 0a034fa commit ea5c050
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
14 changes: 4 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 30
//noinspection GradleDependency
buildToolsVersion "30.0.0"
buildToolsVersion "30.0.1"

defaultConfig {
applicationId "com.matdevtech.multility"
minSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
versionCode 2
versionName "1.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -31,32 +30,27 @@ dependencies {
implementation 'androidx.cardview:cardview:1.0.0'
//noinspection GradleDependency
implementation 'com.ismaeldivita.chipnavigation:chip-navigation-bar:1.2.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.72'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.4.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
testImplementation 'junit:junit:4.13'
implementation 'org.apache.commons:commons-lang3:3.11'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'


implementation 'androidx.recyclerview:recyclerview:1.1.0'

//Image
//noinspection GradleDependency
implementation 'com.github.bumptech.glide:glide:4.7.1'
//noinspection GradleDependency
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'

//Network
//noinspection GradleDependency
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
//noinspection GradleDependency
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
//noinspection GradleDependency
implementation 'com.google.code.gson:gson:2.8.6'

//Times Formatter
implementation 'org.ocpsoft.prettytime:prettytime:4.0.5.Final'
}
22 changes: 16 additions & 6 deletions app/src/main/java/com/matdevtech/multility/TipCalculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import java.util.Objects;
Expand Down Expand Up @@ -100,14 +102,22 @@ public void onClick(View view) {
percentage_tip.setText("");
}

float total_price_int = Float.parseFloat(total_price.getText().toString());
float percentage_tip_int = Float.parseFloat(percentage_tip.getText().toString());
float total_price_int;
float percentage_tip_int;
float calculated_tip;
double rounded_tip;

try{
total_price_int = Float.parseFloat(total_price.getText().toString());
percentage_tip_int = Float.parseFloat(percentage_tip.getText().toString());

float calculated_tip = (total_price_int * (percentage_tip_int / 100));
double rounded_tip = Math.round(calculated_tip * 100.0) / 100.0;
calculated_tip = (total_price_int * (percentage_tip_int / 100));
rounded_tip = Math.round(calculated_tip * 100.0) / 100.0;

// String formatting for displaying a trailing zero if there is only a value in the tenths
tip_result.setText("TIP: $" + String.format("%.2f", rounded_tip));
tip_result.setText("TIP: $" + String.format("%.2f", rounded_tip));
}catch(Exception e){
Toast.makeText(getActivity(), "Enter Price/Percentage Info!", Toast.LENGTH_SHORT).show();
}
}
});
}
Expand Down

0 comments on commit ea5c050

Please sign in to comment.