This repository was archived by the owner on Jun 27, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +22
-14
lines changed
src/main/java/com/blogspot/e_kanivets/moneytracker/activity/account Expand file tree Collapse file tree 4 files changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ android {
88 applicationId ' com.blogspot.e_kanivets.moneytracker'
99 minSdkVersion 17
1010 targetSdkVersion 23
11- versionCode 15
12- versionName ' 1.7.8 '
11+ versionCode 16
12+ versionName ' 1.7.9 '
1313 }
1414 signingConfigs {
1515 releaseConfig {
@@ -64,4 +64,4 @@ dependencies {
6464 androidTestCompile ' com.crittercism.dexmaker:dexmaker:1.4'
6565 androidTestCompile ' com.crittercism.dexmaker:dexmaker-dx:1.4'
6666 androidTestCompile ' com.crittercism.dexmaker:dexmaker-mockito:1.4'
67- }
67+ }
Original file line number Diff line number Diff line change @@ -65,23 +65,31 @@ public boolean onCreateOptionsMenu(Menu menu) {
6565 public boolean onOptionsItemSelected (MenuItem item ) {
6666 switch (item .getItemId ()) {
6767 case R .id .action_done :
68- addAccount ();
69-
70- setResult ( RESULT_OK );
71- finish ( );
68+ if ( addAccount ()) {
69+ setResult ( RESULT_OK );
70+ finish ( );
71+ } else showToast ( R . string . wrong_number_text );
7272 return true ;
7373
7474 default :
7575 return super .onOptionsItemSelected (item );
7676 }
7777 }
7878
79- private void addAccount () {
79+ private boolean addAccount () {
8080 String title = etTitle .getText ().toString ().trim ();
81- double initSum = Double .parseDouble (etInitSum .getText ().toString ().trim ());
81+
82+ double initSum ;
83+ try {
84+ initSum = Double .parseDouble (etInitSum .getText ().toString ().trim ());
85+ } catch (NumberFormatException e ) {
86+ e .printStackTrace ();
87+ return false ;
88+ }
89+
8290 String currency = (String ) spinner .getSelectedItem ();
8391
8492 Account account = new Account (title , initSum , currency );
85- accountController .create (account );
93+ return accountController .create (account ) != null ;
8694 }
87- }
95+ }
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ buildscript {
33 jcenter()
44 }
55 dependencies {
6- classpath ' com.android.tools.build:gradle:2.1.2 '
6+ classpath ' com.android.tools.build:gradle:2.1.3 '
77 classpath ' com.neenbedankt.gradle.plugins:android-apt:1.4'
88 classpath ' com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.5.2'
99 }
Original file line number Diff line number Diff line change 1- # Tue Apr 19 13:31:21 GMT+02:00 2016
1+ # Wed Aug 24 14:58:14 GMT+02:00 2016
22distributionBase =GRADLE_USER_HOME
33distributionPath =wrapper/dists
44zipStoreBase =GRADLE_USER_HOME
55zipStorePath =wrapper/dists
6- distributionUrl =https\://services.gradle.org/distributions/gradle-2.10 -all.zip
6+ distributionUrl =https\://services.gradle.org/distributions/gradle-2.14.1 -all.zip
You can’t perform that action at this time.
0 commit comments