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
17 changes: 6 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,26 @@ language: android
jdk: oraclejdk8
android:
components:
# Uncomment the lines below if you want to
# use the latest revision of Android SDK Tools
- platform-tools
- tools

# The BuildTools version used by your project
- build-tools-25.0.2
- build-tools-26.0.2

# The SDK version used to compile your project
- android-25
- android-21
- android-26

# Additional components
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
- addon-google_apis-google-19
- addon-google_apis-google-26

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

# Emulator Management: Create, Start and Wait
before_script:
- echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
- echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
Expand Down
34 changes: 17 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,22 @@ repositories {
maven { url 'https://maven.fabric.io/public' }
}

apply plugin: 'com.neenbedankt.android-apt'

android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId 'com.blogspot.e_kanivets.moneytracker'
minSdkVersion 17
targetSdkVersion 25
versionCode 20
versionName '1.8.3'
targetSdkVersion 26
versionCode 21
versionName '1.8.5'
}
signingConfigs {
releaseConfig {
storeFile file('mt_keystore.jks');
storePassword('moneytracker');
storeFile file('mt_keystore.jks')
storePassword('moneytracker')
keyAlias 'moneytracker'
keyPassword 'moneytracker';
keyPassword 'moneytracker'
}
}
buildTypes {
Expand Down Expand Up @@ -64,23 +62,25 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
transitive = true;
transitive = true
}

compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'

compile 'com.jakewharton:butterknife:7.0.1' // View annotation bindings
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.jakewharton:butterknife:8.5.1' // View annotation bindings
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' // ButterKnife compiler
compile 'com.google.dagger:dagger:2.0.1' // Dependency injection tool
compile 'com.github.PhilJay:MPAndroidChart:v2.2.4' // Charts
compile 'com.jakewharton.timber:timber:4.1.2' // Advanced logging tool
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.dropbox.core:dropbox-core-sdk:3.0.5' // Dropbox Core API

testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.0.43-beta'
androidTestCompile 'com.crittercism.dexmaker:dexmaker:1.4'
androidTestCompile 'com.crittercism.dexmaker:dexmaker-dx:1.4'
androidTestCompile 'com.crittercism.dexmaker:dexmaker-mockito:1.4'
apt 'com.google.dagger:dagger-compiler:2.0.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.0.1'
provided 'org.glassfish:javax.annotation:10.0-b28'
}
Binary file removed app/libs/dropbox-android-sdk-1.6.3.jar
Binary file not shown.
Binary file removed app/libs/json_simple-1.1.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ public void testGetTable() throws Exception {
}

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

ContentValues expected = new ContentValues();
expected.put(DbHelper.TITLE_COLUMN, "title1");
expected.put(DbHelper.CUR_SUM_COLUMN, 100L);
expected.put(DbHelper.CURRENCY_COLUMN, "NON");
expected.put(DbHelper.DECIMALS_COLUMN, 30L);
expected.put(DbHelper.GOAL_COLUMN, 0.0);
expected.put(DbHelper.ARCHIVED_COLUMN, false);
expected.put(DbHelper.COLOR_COLUMN, 0);

ContentValues actual = repo.contentValues(account);

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

List<Account> expected = new ArrayList<>();
expected.add(new Account(1, "title", 100, "NON", 0));
expected.add(new Account(1, "title", 100, "NON", 0, 0, false, 0));

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

Expand Down
9 changes: 8 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@
android:label="@string/title_activity_about"
android:screenOrientation="portrait"
android:theme="@style/Theme.Default" />

<activity
android:name=".activity.account.EditAccountActivity"
android:label="@string/title_activity_edit_account"
android:screenOrientation="portrait"
android:theme="@style/Theme.Default"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.dropbox.client2.android.AuthActivity"
android:configChanges="orientation|keyboard"
Expand All @@ -111,9 +116,11 @@
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>

<meta-data
android:name="io.fabric.ApiKey"
android:value="955ae4864ae2a833aeda5b62631512524288adf8" />

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import com.blogspot.e_kanivets.moneytracker.R;
import com.blogspot.e_kanivets.moneytracker.activity.base.BaseBackActivity;

import butterknife.Bind;
import butterknife.BindView;

public class AboutActivity extends BaseBackActivity {
@Bind(R.id.tv_about)
@BindView(R.id.tv_about)
TextView tvAbout;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import javax.inject.Inject;

import butterknife.Bind;
import butterknife.BindView;

public class ReportActivity extends BaseBackActivity {
@SuppressWarnings("unused")
Expand All @@ -43,9 +43,9 @@ public class ReportActivity extends BaseBackActivity {

private ShortSummaryPresenter shortSummaryPresenter;

@Bind(R.id.spinner_currency)
@BindView(R.id.spinner_currency)
AppCompatSpinner spinnerCurrency;
@Bind(R.id.exp_list_view)
@BindView(R.id.exp_list_view)
ExpandableListView expandableListView;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void setupDefaultAccountPref() {
ListPreference defaultAccountPref = (ListPreference) findPreference(getString(R.string.pref_default_account));
defaultAccountPref.setOnPreferenceChangeListener(preferenceChangeListener);

List<Account> accountList = accountController.readAll();
List<Account> accountList = accountController.readActiveAccounts();
defaultAccountPref.setEntries(getEntries(accountList));
defaultAccountPref.setEntryValues(getEntryValues(accountList));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

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

import javax.inject.Inject;

import butterknife.Bind;
import butterknife.BindView;
import butterknife.OnClick;
import butterknife.OnItemClick;

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

private static final int REQUEST_ADD_ACCOUNT = 1;
private static final int REQUEST_TRANSFER = 2;
private static final int REQUEST_EDIT_ACCOUNT = 3;

@Inject
AccountController accountController;

private AccountsSummaryPresenter summaryPresenter;

@Bind(R.id.list_view)
@BindView(R.id.list_view)
ListView listView;

@Override
Expand Down Expand Up @@ -77,26 +76,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
}

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
getMenuInflater().inflate(R.menu.menu_account, menu);
}

@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();

switch (item.getItemId()) {
case R.id.delete:
// Minus one because of list view's header view
accountController.delete(accountController.readAll().get(info.position - 1));
update();
setResult(RESULT_OK);
return true;
default:
return super.onContextItemSelected(item);
}
@OnItemClick(R.id.list_view)
public void onAccountClick(int position) {
Intent intent = new Intent(this, EditAccountActivity.class);
intent.putExtra(EditAccountActivity.KEY_ACCOUNT, accountController.readAll().get(position - 1));
startActivityForResult(intent, REQUEST_EDIT_ACCOUNT);
}

public void makeTransfer() {
Expand Down Expand Up @@ -127,6 +111,11 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
setResult(RESULT_OK);
break;

case REQUEST_EDIT_ACCOUNT:
update();
setResult(RESULT_OK);
break;

default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import javax.inject.Inject;

import butterknife.Bind;
import butterknife.BindView;

public class AddAccountActivity extends BaseBackActivity {
@SuppressWarnings("unused")
Expand All @@ -33,13 +33,13 @@ public class AddAccountActivity extends BaseBackActivity {

private IValidator<Account> accountValidator;

@Bind(R.id.content)
@BindView(R.id.content)
View contentView;
@Bind(R.id.et_title)
@BindView(R.id.et_title)
EditText etTitle;
@Bind(R.id.et_init_sum)
@BindView(R.id.et_init_sum)
EditText etInitSum;
@Bind(R.id.spinner)
@BindView(R.id.spinner)
AppCompatSpinner spinner;

@Override
Expand Down Expand Up @@ -97,7 +97,11 @@ private boolean addAccount() {
String title = etTitle.getText().toString().trim();
double initSum = Double.parseDouble(etInitSum.getText().toString().trim());
String currency = (String) spinner.getSelectedItem();
return accountController.create(new Account(title, initSum, currency)) != null;
double goal = 0;
int color = 0;

Account account = new Account(-1, title, initSum, currency, goal, false, color);
return accountController.create(account) != null;
} else {
return false;
}
Expand Down
Loading