Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId 'com.blogspot.e_kanivets.moneytracker'
minSdkVersion 17
targetSdkVersion 23
versionCode 15
versionName '1.7.8'
versionCode 16
versionName '1.7.9'
}
signingConfigs {
releaseConfig {
Expand Down Expand Up @@ -64,4 +64,4 @@ dependencies {
androidTestCompile 'com.crittercism.dexmaker:dexmaker:1.4'
androidTestCompile 'com.crittercism.dexmaker:dexmaker-dx:1.4'
androidTestCompile 'com.crittercism.dexmaker:dexmaker-mockito:1.4'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,31 @@ public boolean onCreateOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_done:
addAccount();

setResult(RESULT_OK);
finish();
if (addAccount()) {
setResult(RESULT_OK);
finish();
} else showToast(R.string.wrong_number_text);
return true;

default:
return super.onOptionsItemSelected(item);
}
}

private void addAccount() {
private boolean addAccount() {
String title = etTitle.getText().toString().trim();
double initSum = Double.parseDouble(etInitSum.getText().toString().trim());

double initSum;
try {
initSum = Double.parseDouble(etInitSum.getText().toString().trim());
} catch (NumberFormatException e) {
e.printStackTrace();
return false;
}

String currency = (String) spinner.getSelectedItem();

Account account = new Account(title, initSum, currency);
accountController.create(account);
return accountController.create(account) != null;
}
}
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.android.tools.build:gradle:2.1.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.5.2'
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Apr 19 13:31:21 GMT+02:00 2016
#Wed Aug 24 14:58:14 GMT+02:00 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip