Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit 5d675fd

Browse files
author
Evgenii Kanivets
authored
Merge pull request #144 from evgenii-kanivets/dev
v1.8.5. Migrate Dropbox from v1 to v2. Edit account. Archive account.
2 parents b3dc49d + ea63db2 commit 5d675fd

File tree

57 files changed

+726
-272
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+726
-272
lines changed

.travis.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,26 @@ language: android
22
jdk: oraclejdk8
33
android:
44
components:
5-
# Uncomment the lines below if you want to
6-
# use the latest revision of Android SDK Tools
7-
- platform-tools
8-
- tools
9-
105
# The BuildTools version used by your project
11-
- build-tools-25.0.2
6+
- build-tools-26.0.2
127

138
# The SDK version used to compile your project
14-
- android-25
9+
- android-21
10+
- android-26
1511

1612
# Additional components
1713
- extra-google-google_play_services
1814
- extra-google-m2repository
1915
- extra-android-m2repository
20-
- addon-google_apis-google-19
16+
- addon-google_apis-google-26
2117

2218
# Specify at least one system image,
2319
# if you need to run emulator(s) during your tests
24-
- sys-img-armeabi-v7a-android-19
25-
- sys-img-x86-android-17
20+
- sys-img-armeabi-v7a-android-21
2621

2722
# Emulator Management: Create, Start and Wait
2823
before_script:
29-
- echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
24+
- echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
3025
- emulator -avd test -no-skin -no-audio -no-window &
3126
- android-wait-for-emulator
3227
- adb shell input keyevent 82 &

app/build.gradle

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,22 @@ repositories {
1414
maven { url 'https://maven.fabric.io/public' }
1515
}
1616

17-
apply plugin: 'com.neenbedankt.android-apt'
18-
1917
android {
20-
compileSdkVersion 25
21-
buildToolsVersion '25.0.2'
18+
compileSdkVersion 26
19+
buildToolsVersion '26.0.2'
2220
defaultConfig {
2321
applicationId 'com.blogspot.e_kanivets.moneytracker'
2422
minSdkVersion 17
25-
targetSdkVersion 25
26-
versionCode 20
27-
versionName '1.8.3'
23+
targetSdkVersion 26
24+
versionCode 21
25+
versionName '1.8.5'
2826
}
2927
signingConfigs {
3028
releaseConfig {
31-
storeFile file('mt_keystore.jks');
32-
storePassword('moneytracker');
29+
storeFile file('mt_keystore.jks')
30+
storePassword('moneytracker')
3331
keyAlias 'moneytracker'
34-
keyPassword 'moneytracker';
32+
keyPassword 'moneytracker'
3533
}
3634
}
3735
buildTypes {
@@ -64,23 +62,25 @@ dependencies {
6462
compile fileTree(dir: 'libs', include: ['*.jar'])
6563

6664
compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
67-
transitive = true;
65+
transitive = true
6866
}
6967

70-
compile 'com.android.support:support-v4:25.1.0'
71-
compile 'com.android.support:appcompat-v7:25.1.0'
72-
compile 'com.android.support:design:25.1.0'
73-
74-
compile 'com.jakewharton:butterknife:7.0.1' // View annotation bindings
68+
compile 'com.android.support:support-v4:26.1.0'
69+
compile 'com.android.support:appcompat-v7:26.1.0'
70+
compile 'com.android.support:design:26.1.0'
71+
compile 'com.jakewharton:butterknife:8.5.1' // View annotation bindings
72+
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' // ButterKnife compiler
7573
compile 'com.google.dagger:dagger:2.0.1' // Dependency injection tool
7674
compile 'com.github.PhilJay:MPAndroidChart:v2.2.4' // Charts
7775
compile 'com.jakewharton.timber:timber:4.1.2' // Advanced logging tool
76+
compile 'com.android.support.constraint:constraint-layout:1.0.2'
77+
compile 'com.dropbox.core:dropbox-core-sdk:3.0.5' // Dropbox Core API
7878

7979
testCompile 'junit:junit:4.12'
8080
testCompile 'org.mockito:mockito-core:2.0.43-beta'
8181
androidTestCompile 'com.crittercism.dexmaker:dexmaker:1.4'
8282
androidTestCompile 'com.crittercism.dexmaker:dexmaker-dx:1.4'
8383
androidTestCompile 'com.crittercism.dexmaker:dexmaker-mockito:1.4'
84-
apt 'com.google.dagger:dagger-compiler:2.0.1'
84+
annotationProcessor 'com.google.dagger:dagger-compiler:2.0.1'
8585
provided 'org.glassfish:javax.annotation:10.0-b28'
8686
}
-164 KB
Binary file not shown.

app/libs/json_simple-1.1.jar

-15.7 KB
Binary file not shown.

app/src/androidTest/java/com/blogspot/e_kanivets/moneytracker/repo/data/AccountRepoTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@ public void testGetTable() throws Exception {
4040
}
4141

4242
public void testContentValues() throws Exception {
43-
Account account = new Account(-1, "title1", 100, "NON", 30);
43+
Account account = new Account(-1, "title1", 100, "NON", 30, 0, false, 0);
4444

4545
ContentValues expected = new ContentValues();
4646
expected.put(DbHelper.TITLE_COLUMN, "title1");
4747
expected.put(DbHelper.CUR_SUM_COLUMN, 100L);
4848
expected.put(DbHelper.CURRENCY_COLUMN, "NON");
4949
expected.put(DbHelper.DECIMALS_COLUMN, 30L);
50+
expected.put(DbHelper.GOAL_COLUMN, 0.0);
51+
expected.put(DbHelper.ARCHIVED_COLUMN, false);
52+
expected.put(DbHelper.COLOR_COLUMN, 0);
5053

5154
ContentValues actual = repo.contentValues(account);
5255

@@ -71,7 +74,7 @@ public void testGetListFromCursor() throws Exception {
7174
Mockito.when(mockCursor.getString(4)).thenReturn("NON");
7275

7376
List<Account> expected = new ArrayList<>();
74-
expected.add(new Account(1, "title", 100, "NON", 0));
77+
expected.add(new Account(1, "title", 100, "NON", 0, 0, false, 0));
7578

7679
assertEquals(expected, repo.getListFromCursor(mockCursor));
7780

app/src/main/AndroidManifest.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@
8686
android:label="@string/title_activity_about"
8787
android:screenOrientation="portrait"
8888
android:theme="@style/Theme.Default" />
89-
89+
<activity
90+
android:name=".activity.account.EditAccountActivity"
91+
android:label="@string/title_activity_edit_account"
92+
android:screenOrientation="portrait"
93+
android:theme="@style/Theme.Default"
94+
android:windowSoftInputMode="adjustResize" />
9095
<activity
9196
android:name="com.dropbox.client2.android.AuthActivity"
9297
android:configChanges="orientation|keyboard"
@@ -111,9 +116,11 @@
111116
android:name="android.support.FILE_PROVIDER_PATHS"
112117
android:resource="@xml/file_paths" />
113118
</provider>
119+
114120
<meta-data
115121
android:name="io.fabric.ApiKey"
116122
android:value="955ae4864ae2a833aeda5b62631512524288adf8" />
123+
117124
</application>
118125

119126
</manifest>

app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/AboutActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import com.blogspot.e_kanivets.moneytracker.R;
77
import com.blogspot.e_kanivets.moneytracker.activity.base.BaseBackActivity;
88

9-
import butterknife.Bind;
9+
import butterknife.BindView;
1010

1111
public class AboutActivity extends BaseBackActivity {
12-
@Bind(R.id.tv_about)
12+
@BindView(R.id.tv_about)
1313
TextView tvAbout;
1414

1515
@Override

app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/ReportActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
import javax.inject.Inject;
2525

26-
import butterknife.Bind;
26+
import butterknife.BindView;
2727

2828
public class ReportActivity extends BaseBackActivity {
2929
@SuppressWarnings("unused")
@@ -43,9 +43,9 @@ public class ReportActivity extends BaseBackActivity {
4343

4444
private ShortSummaryPresenter shortSummaryPresenter;
4545

46-
@Bind(R.id.spinner_currency)
46+
@BindView(R.id.spinner_currency)
4747
AppCompatSpinner spinnerCurrency;
48-
@Bind(R.id.exp_list_view)
48+
@BindView(R.id.exp_list_view)
4949
ExpandableListView expandableListView;
5050

5151
@Override

app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/SettingsActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private void setupDefaultAccountPref() {
7373
ListPreference defaultAccountPref = (ListPreference) findPreference(getString(R.string.pref_default_account));
7474
defaultAccountPref.setOnPreferenceChangeListener(preferenceChangeListener);
7575

76-
List<Account> accountList = accountController.readAll();
76+
List<Account> accountList = accountController.readActiveAccounts();
7777
defaultAccountPref.setEntries(getEntries(accountList));
7878
defaultAccountPref.setEntryValues(getEntryValues(accountList));
7979

app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/account/AccountsActivity.java

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22

33
import android.content.Intent;
44
import android.support.v7.app.AppCompatActivity;
5-
import android.view.ContextMenu;
65
import android.view.Menu;
76
import android.view.MenuItem;
8-
import android.view.View;
9-
import android.widget.AdapterView;
107
import android.widget.ListView;
118

129
import com.blogspot.e_kanivets.moneytracker.R;
@@ -18,22 +15,24 @@
1815

1916
import javax.inject.Inject;
2017

21-
import butterknife.Bind;
18+
import butterknife.BindView;
2219
import butterknife.OnClick;
20+
import butterknife.OnItemClick;
2321

2422
public class AccountsActivity extends BaseBackActivity {
2523
@SuppressWarnings("unused")
2624
private static final String TAG = "AccountsActivity";
2725

2826
private static final int REQUEST_ADD_ACCOUNT = 1;
2927
private static final int REQUEST_TRANSFER = 2;
28+
private static final int REQUEST_EDIT_ACCOUNT = 3;
3029

3130
@Inject
3231
AccountController accountController;
3332

3433
private AccountsSummaryPresenter summaryPresenter;
3534

36-
@Bind(R.id.list_view)
35+
@BindView(R.id.list_view)
3736
ListView listView;
3837

3938
@Override
@@ -77,26 +76,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
7776
}
7877
}
7978

80-
@Override
81-
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
82-
super.onCreateContextMenu(menu, v, menuInfo);
83-
getMenuInflater().inflate(R.menu.menu_account, menu);
84-
}
85-
86-
@Override
87-
public boolean onContextItemSelected(MenuItem item) {
88-
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
89-
90-
switch (item.getItemId()) {
91-
case R.id.delete:
92-
// Minus one because of list view's header view
93-
accountController.delete(accountController.readAll().get(info.position - 1));
94-
update();
95-
setResult(RESULT_OK);
96-
return true;
97-
default:
98-
return super.onContextItemSelected(item);
99-
}
79+
@OnItemClick(R.id.list_view)
80+
public void onAccountClick(int position) {
81+
Intent intent = new Intent(this, EditAccountActivity.class);
82+
intent.putExtra(EditAccountActivity.KEY_ACCOUNT, accountController.readAll().get(position - 1));
83+
startActivityForResult(intent, REQUEST_EDIT_ACCOUNT);
10084
}
10185

10286
public void makeTransfer() {
@@ -127,6 +111,11 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
127111
setResult(RESULT_OK);
128112
break;
129113

114+
case REQUEST_EDIT_ACCOUNT:
115+
update();
116+
setResult(RESULT_OK);
117+
break;
118+
130119
default:
131120
break;
132121
}

0 commit comments

Comments
 (0)