From c4395111940f496d5ae404f9e8bf2915c4221796 Mon Sep 17 00:00:00 2001 From: Alessandro Digilio Date: Fri, 30 Oct 2020 01:07:48 +0100 Subject: [PATCH] updated dependencies, fixed app crash when pressing '/' operator before numbers --- app/build.gradle | 17 ++++++++--------- .../java/com/exuberant/calci/HomeActivity.java | 4 +++- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c87d2d7..1667529 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,12 +1,11 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 29 - buildToolsVersion "29.0.2" + compileSdkVersion 30 defaultConfig { applicationId "com.exuberant.calci" minSdkVersion 21 - targetSdkVersion 29 + targetSdkVersion 30 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -21,10 +20,10 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.2.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' - implementation 'com.google.android.material:material:1.1.0-beta01' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + testImplementation 'junit:junit:4.13' + androidTestImplementation 'androidx.test:runner:1.3.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + implementation 'com.google.android.material:material:1.3.0-alpha03' } diff --git a/app/src/main/java/com/exuberant/calci/HomeActivity.java b/app/src/main/java/com/exuberant/calci/HomeActivity.java index c0f9ac0..c36fc84 100644 --- a/app/src/main/java/com/exuberant/calci/HomeActivity.java +++ b/app/src/main/java/com/exuberant/calci/HomeActivity.java @@ -83,7 +83,9 @@ private void handleOperatorClick(String operator){ totalCalculation += currentNumber + operator; currentNumber = ""; } else { - totalCalculation = totalCalculation.substring(0, totalCalculation.length() - 1); + if(totalCalculation.length()>0){ + totalCalculation = totalCalculation.substring(0, totalCalculation.length() - 1); + } totalCalculation += operator; } } diff --git a/build.gradle b/build.gradle index 05d53ae..874fc1f 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.1' + classpath 'com.android.tools.build:gradle:4.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 29a3ec4..5727f5a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun Oct 06 21:16:07 IST 2019 +#Fri Oct 30 01:01:22 CET 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip