├── common
├── .gitignore
├── build.gradle
└── src
│ └── main
│ └── java
│ └── com
│ └── code44
│ └── finance
│ └── common
│ ├── utils
│ └── Strings.java
│ ├── Constants.java
│ └── model
│ ├── DecimalSeparator.java
│ ├── GroupSeparator.java
│ ├── TransactionState.java
│ ├── ModelState.java
│ ├── TransactionType.java
│ └── SymbolPosition.java
├── financius
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── menu
│ │ │ │ ├── common.xml
│ │ │ │ ├── currencies.xml
│ │ │ │ ├── user.xml
│ │ │ │ ├── models.xml
│ │ │ │ └── model.xml
│ │ │ ├── values
│ │ │ │ ├── ids.xml
│ │ │ │ └── consts.xml
│ │ │ ├── drawable-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── drawable-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── drawable-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── drawable-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_arrow_down_small.png
│ │ │ │ ├── ic_arrow_right_small.png
│ │ │ │ ├── ic_action_chevron_left.png
│ │ │ │ ├── ic_action_chevron_right.png
│ │ │ │ └── navigation_header_placeholder.png
│ │ │ ├── drawable-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── btn_fab_normal.png
│ │ │ │ ├── ic_action_date.png
│ │ │ │ ├── ic_action_edit.png
│ │ │ │ ├── ic_action_new.png
│ │ │ │ ├── ic_action_note.png
│ │ │ │ ├── ic_action_tags.png
│ │ │ │ ├── ic_empty_add.png
│ │ │ │ ├── btn_fab_pressed.png
│ │ │ │ ├── ic_action_account.png
│ │ │ │ ├── ic_action_overview.png
│ │ │ │ ├── ic_action_refresh.png
│ │ │ │ ├── ic_action_reports.png
│ │ │ │ ├── ic_action_settings.png
│ │ │ │ ├── ic_action_category_type.png
│ │ │ │ └── ic_action_transactions.png
│ │ │ ├── values-land
│ │ │ │ ├── consts.xml
│ │ │ │ └── dimens.xml
│ │ │ ├── values-sw600dp
│ │ │ │ └── consts.xml
│ │ │ ├── values-sw720dp
│ │ │ │ └── consts.xml
│ │ │ ├── values-sw600dp-land
│ │ │ │ └── consts.xml
│ │ │ ├── values-sw720dp-land
│ │ │ │ └── consts.xml
│ │ │ ├── values-v16
│ │ │ │ └── consts.xml
│ │ │ ├── layout
│ │ │ │ ├── toolbar.xml
│ │ │ │ ├── toolbar_transparent.xml
│ │ │ │ ├── fragment_navigation.xml
│ │ │ │ ├── li_navigation_divider.xml
│ │ │ │ ├── activity_settings.xml
│ │ │ │ ├── activity_simple.xml
│ │ │ │ ├── include_navigation.xml
│ │ │ │ ├── li_dialog_multiple_choice.xml
│ │ │ │ ├── activity_export.xml
│ │ │ │ ├── activity_import.xml
│ │ │ │ ├── activity_drawer.xml
│ │ │ │ ├── li_settings.xml
│ │ │ │ ├── li_dialog_simple.xml
│ │ │ │ ├── li_navigation_header.xml
│ │ │ │ ├── li_category_header.xml
│ │ │ │ ├── li_transaction_header.xml
│ │ │ │ ├── activity_unlock.xml
│ │ │ │ ├── view_empty_container.xml
│ │ │ │ ├── view_pin_lock.xml
│ │ │ │ ├── activity_lock.xml
│ │ │ │ ├── view_balance_graph.xml
│ │ │ │ ├── view_trends_graph.xml
│ │ │ │ ├── activity_categories.xml
│ │ │ │ ├── li_dialog_single_choice.xml
│ │ │ │ ├── activity_transactions.xml
│ │ │ │ ├── li_settings_subtitle.xml
│ │ │ │ ├── include_account.xml
│ │ │ │ ├── li_currency_account.xml
│ │ │ │ ├── activity_tags.xml
│ │ │ │ ├── view_categories_report.xml
│ │ │ │ ├── fragment_reports.xml
│ │ │ │ ├── dialog_fragment_list.xml
│ │ │ │ ├── li_category.xml
│ │ │ │ ├── li_tag.xml
│ │ │ │ ├── include_dialog_buttons.xml
│ │ │ │ ├── li_navigation.xml
│ │ │ │ ├── fragment_user.xml
│ │ │ │ ├── activity_categories_report.xml
│ │ │ │ ├── li_currency.xml
│ │ │ │ ├── include_edit_buttons.xml
│ │ │ │ ├── li_account.xml
│ │ │ │ ├── li_category_report_tag.xml
│ │ │ │ ├── view_overview_graph.xml
│ │ │ │ ├── view_accounts.xml
│ │ │ │ ├── view_active_interval.xml
│ │ │ │ ├── dialog_fragment_alert.xml
│ │ │ │ ├── activity_accounts.xml
│ │ │ │ └── activity_tag_edit.xml
│ │ │ ├── drawable-v21
│ │ │ │ └── btn_fab.xml
│ │ │ ├── drawable
│ │ │ │ ├── btn_fab.xml
│ │ │ │ └── circle.xml
│ │ │ └── layout-land
│ │ │ │ └── activity_categories_report.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── code44
│ │ │ │ └── finance
│ │ │ │ ├── graphs
│ │ │ │ ├── plot
│ │ │ │ │ └── Plot.java
│ │ │ │ ├── bar
│ │ │ │ │ └── BarGraphView.java
│ │ │ │ ├── GraphValue.java
│ │ │ │ ├── line
│ │ │ │ │ ├── PathMaker.java
│ │ │ │ │ ├── LineGraphValue.java
│ │ │ │ │ └── SharpPathMaker.java
│ │ │ │ ├── pie
│ │ │ │ │ ├── PieChartValue.java
│ │ │ │ │ └── PieChartData.java
│ │ │ │ └── MoneyGraphValue.java
│ │ │ │ ├── ui
│ │ │ │ ├── dialogs
│ │ │ │ │ └── IntervalDialogFragment.java
│ │ │ │ ├── reports
│ │ │ │ │ ├── BaseReportFragment.java
│ │ │ │ │ ├── BaseReportActivity.java
│ │ │ │ │ └── categories
│ │ │ │ │ │ ├── TagExpenseComparator.java
│ │ │ │ │ │ └── CategoryExpenseComparator.java
│ │ │ │ ├── transactions
│ │ │ │ │ ├── edit
│ │ │ │ │ │ ├── autocomplete
│ │ │ │ │ │ │ ├── FinderScore.java
│ │ │ │ │ │ │ └── TransactionAutoComplete.java
│ │ │ │ │ │ ├── presenters
│ │ │ │ │ │ │ ├── AutoCompletePresenter.java
│ │ │ │ │ │ │ ├── FlagsPresenter.java
│ │ │ │ │ │ │ ├── TransactionStatePresenter.java
│ │ │ │ │ │ │ ├── DateTimePresenter.java
│ │ │ │ │ │ │ └── TransactionTypePresenter.java
│ │ │ │ │ │ └── TransactionEditActivity.java
│ │ │ │ │ ├── detail
│ │ │ │ │ │ └── TransactionActivity.java
│ │ │ │ │ └── list
│ │ │ │ │ │ └── TransactionsActivity.java
│ │ │ │ ├── common
│ │ │ │ │ ├── ViewBackgroundTheme.java
│ │ │ │ │ ├── navigation
│ │ │ │ │ │ └── NavigationScreen.java
│ │ │ │ │ ├── presenters
│ │ │ │ │ │ └── Presenter.java
│ │ │ │ │ ├── BaseModelsAdapter.java
│ │ │ │ │ └── views
│ │ │ │ │ │ ├── TintImageView.java
│ │ │ │ │ │ └── TintImageButton.java
│ │ │ │ ├── BaseFragment.java
│ │ │ │ ├── ModelEditActivityOld.java
│ │ │ │ ├── tags
│ │ │ │ │ ├── edit
│ │ │ │ │ │ └── TagEditActivity.java
│ │ │ │ │ ├── list
│ │ │ │ │ │ ├── TagsActivityPresenter.java
│ │ │ │ │ │ ├── TagsActivity.java
│ │ │ │ │ │ └── TagsAdapter.java
│ │ │ │ │ └── detail
│ │ │ │ │ │ └── TagActivity.java
│ │ │ │ ├── categories
│ │ │ │ │ ├── edit
│ │ │ │ │ │ └── CategoryEditActivity.java
│ │ │ │ │ ├── detail
│ │ │ │ │ │ └── CategoryActivity.java
│ │ │ │ │ └── list
│ │ │ │ │ │ └── CategoriesActivity.java
│ │ │ │ ├── currencies
│ │ │ │ │ ├── edit
│ │ │ │ │ │ └── CurrencyEditActivity.java
│ │ │ │ │ └── detail
│ │ │ │ │ │ └── CurrencyActivity.java
│ │ │ │ ├── SplashActivity.java
│ │ │ │ ├── settings
│ │ │ │ │ ├── data
│ │ │ │ │ │ └── DataActivity.java
│ │ │ │ │ └── security
│ │ │ │ │ │ └── LockView.java
│ │ │ │ ├── FilePickerActivity.java
│ │ │ │ ├── playservices
│ │ │ │ │ └── GoogleApiConnection.java
│ │ │ │ └── accounts
│ │ │ │ │ ├── edit
│ │ │ │ │ └── AccountEditActivity.java
│ │ │ │ │ └── detail
│ │ │ │ │ └── AccountActivity.java
│ │ │ │ ├── qualifiers
│ │ │ │ ├── Local.java
│ │ │ │ ├── Network.java
│ │ │ │ ├── AppTracker.java
│ │ │ │ └── ApplicationContext.java
│ │ │ │ ├── utils
│ │ │ │ ├── errors
│ │ │ │ │ ├── ExportError.java
│ │ │ │ │ ├── ImportError.java
│ │ │ │ │ └── AppError.java
│ │ │ │ ├── interval
│ │ │ │ │ ├── CurrentInterval.java
│ │ │ │ │ └── ActiveInterval.java
│ │ │ │ ├── EventBus.java
│ │ │ │ ├── ThemeUtils.java
│ │ │ │ ├── LocalExecutor.java
│ │ │ │ ├── AccountUtils.java
│ │ │ │ ├── TextBackgroundSpan.java
│ │ │ │ ├── LayoutType.java
│ │ │ │ ├── analytics
│ │ │ │ │ └── Analytics.java
│ │ │ │ └── CategoryUtils.java
│ │ │ │ ├── api
│ │ │ │ ├── currencies
│ │ │ │ │ ├── CurrenciesRequestService.java
│ │ │ │ │ ├── ExchangeRatesResponse.java
│ │ │ │ │ └── CurrenciesApi.java
│ │ │ │ ├── Result.java
│ │ │ │ ├── requests
│ │ │ │ │ ├── PostRequest.java
│ │ │ │ │ ├── GetTagsRequest.java
│ │ │ │ │ ├── PostTagsRequest.java
│ │ │ │ │ ├── GetCategoriesRequest.java
│ │ │ │ │ ├── PostAccountsRequest.java
│ │ │ │ │ ├── GetCurrenciesRequest.java
│ │ │ │ │ ├── PostCategoriesRequest.java
│ │ │ │ │ ├── PostCurrenciesRequest.java
│ │ │ │ │ └── PostTransactionsRequest.java
│ │ │ │ ├── NetworkExecutor.java
│ │ │ │ └── Request.java
│ │ │ │ ├── modules
│ │ │ │ ├── ViewModule.java
│ │ │ │ ├── providers
│ │ │ │ │ ├── ContextProviderModule.java
│ │ │ │ │ └── AnalyticsProviderModule.java
│ │ │ │ ├── AppModule.java
│ │ │ │ ├── AccountModule.java
│ │ │ │ └── CurrenciesApiModule.java
│ │ │ │ ├── data
│ │ │ │ ├── backup
│ │ │ │ │ ├── DataImporter.java
│ │ │ │ │ ├── DataExporter.java
│ │ │ │ │ ├── DataExporterRunnable.java
│ │ │ │ │ └── DataImporterRunnable.java
│ │ │ │ ├── model
│ │ │ │ │ ├── SyncState.java
│ │ │ │ │ └── BaseModel.java
│ │ │ │ └── providers
│ │ │ │ │ └── BaseProvider.java
│ │ │ │ ├── receivers
│ │ │ │ └── GcmBroadcastReceiver.java
│ │ │ │ ├── services
│ │ │ │ └── GcmService.java
│ │ │ │ ├── views
│ │ │ │ └── SquareButton.java
│ │ │ │ └── App.java
│ │ └── assets
│ │ │ └── fonts
│ │ │ ├── Roboto-Light.ttf
│ │ │ ├── Roboto-Medium.ttf
│ │ │ └── Roboto-Regular.ttf
│ ├── test
│ │ └── resources
│ │ │ └── org.robolectric.Config.properties
│ ├── debug
│ │ ├── res
│ │ │ └── values
│ │ │ │ └── strings_consts.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── code44
│ │ │ └── finance
│ │ │ └── Modules.java
│ └── release
│ │ └── java
│ │ └── com
│ │ └── code44
│ │ └── finance
│ │ └── Modules.java
├── debug.keystore
├── libs
│ └── hellocharts-library-1.3.aar
└── proguard-rules.pro
├── SETUP.md
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── backend
├── src
│ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── code44
│ │ │ └── finance
│ │ │ └── backend
│ │ │ ├── endpoint
│ │ │ └── body
│ │ │ │ ├── Body.java
│ │ │ │ ├── EntitiesBody.java
│ │ │ │ ├── TagsBody.java
│ │ │ │ ├── CategoriesBody.java
│ │ │ │ ├── CurrenciesBody.java
│ │ │ │ ├── AccountsBody.java
│ │ │ │ ├── TransactionsBody.java
│ │ │ │ ├── RegisterDeviceBody.java
│ │ │ │ └── RegisterBody.java
│ │ │ ├── entity
│ │ │ ├── DeviceEntity.java
│ │ │ └── TagEntity.java
│ │ │ └── OfyService.java
│ │ └── webapp
│ │ └── WEB-INF
│ │ ├── appengine-web.xml
│ │ ├── logging.properties
│ │ └── web.xml
└── build.gradle
├── .gitignore
├── gradle.properties
└── README.md
/common/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/financius/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/SETUP.md:
--------------------------------------------------------------------------------
1 | - Add crashlytics.properties to financius module.
--------------------------------------------------------------------------------
/financius/src/main/res/menu/common.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':financius', ':backend', ':common'
2 |
--------------------------------------------------------------------------------
/financius/src/test/resources/org.robolectric.Config.properties:
--------------------------------------------------------------------------------
1 | emulateSdk: 18
2 | reportSdk: 18
--------------------------------------------------------------------------------
/financius/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/financius/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/debug.keystore
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/common/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 |
3 | dependencies {
4 | compile fileTree(dir: 'libs', include: ['*.jar'])
5 | }
--------------------------------------------------------------------------------
/financius/libs/hellocharts-library-1.3.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/libs/hellocharts-library-1.3.aar
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/graphs/plot/Plot.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.graphs.plot;
2 |
3 | public class Plot {
4 | }
5 |
--------------------------------------------------------------------------------
/financius/src/main/assets/fonts/Roboto-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/assets/fonts/Roboto-Light.ttf
--------------------------------------------------------------------------------
/financius/src/main/assets/fonts/Roboto-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/assets/fonts/Roboto-Medium.ttf
--------------------------------------------------------------------------------
/financius/src/main/assets/fonts/Roboto-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/assets/fonts/Roboto-Regular.ttf
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/graphs/bar/BarGraphView.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.graphs.bar;
2 |
3 | public class BarGraphView {
4 | }
5 |
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/backend/src/main/java/com/code44/finance/backend/endpoint/body/Body.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.backend.endpoint.body;
2 |
3 | public interface Body {
4 | }
5 |
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/btn_fab_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/btn_fab_normal.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_action_date.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_action_date.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_action_edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_action_edit.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_action_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_action_new.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_action_note.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_action_note.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_action_tags.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_action_tags.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_empty_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_empty_add.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/btn_fab_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/btn_fab_pressed.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxhdpi/ic_arrow_down_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxhdpi/ic_arrow_down_small.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxhdpi/ic_arrow_right_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxhdpi/ic_arrow_right_small.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_action_account.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_action_account.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_action_overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_action_overview.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_action_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_action_refresh.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_action_reports.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_action_reports.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_action_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_action_settings.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxhdpi/ic_action_chevron_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxhdpi/ic_action_chevron_left.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxhdpi/ic_action_chevron_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxhdpi/ic_action_chevron_right.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_action_category_type.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_action_category_type.png
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxxhdpi/ic_action_transactions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxxhdpi/ic_action_transactions.png
--------------------------------------------------------------------------------
/financius/src/main/res/values-land/consts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - 1
4 |
--------------------------------------------------------------------------------
/financius/src/main/res/values-sw600dp/consts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - 2
4 |
--------------------------------------------------------------------------------
/financius/src/main/res/values-sw720dp/consts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - 4
4 |
--------------------------------------------------------------------------------
/financius/src/main/res/values-sw600dp-land/consts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - 3
4 |
--------------------------------------------------------------------------------
/financius/src/main/res/values-sw720dp-land/consts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - 5
4 |
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-xxhdpi/navigation_header_placeholder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mvarnagiris/financius/HEAD/financius/src/main/res/drawable-xxhdpi/navigation_header_placeholder.png
--------------------------------------------------------------------------------
/financius/src/debug/res/values/strings_consts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Financius D
5 |
6 |
7 |
--------------------------------------------------------------------------------
/financius/src/main/res/values-v16/consts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - sans-serif-thin
4 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/graphs/GraphValue.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.graphs;
2 |
3 | public interface GraphValue {
4 | public double getValue();
5 |
6 | public abstract String getFormattedValue();
7 | }
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | local.properties
4 | build
5 | /.idea/*
6 | !/.idea/codeStyleSettings.xml
7 | financius/crashlytics.properties
8 | com_crashlytics_export_strings.xml
9 | crashlytics-build.properties
10 | .DS_Store
11 | Thumbs.db
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/dialogs/IntervalDialogFragment.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.dialogs;
2 |
3 | import android.app.DialogFragment;
4 |
5 | public class IntervalDialogFragment extends DialogFragment {
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/reports/BaseReportFragment.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.reports;
2 |
3 | import com.code44.finance.ui.BaseFragment;
4 |
5 | public abstract class BaseReportFragment extends BaseFragment {
6 | }
7 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/financius/src/main/res/values-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 64dp
4 |
5 | 40dp
6 | 56dp
7 |
8 |
9 |
--------------------------------------------------------------------------------
/financius/src/main/res/drawable-v21/btn_fab.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/reports/BaseReportActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.reports;
2 |
3 | import com.code44.finance.ui.common.activities.BaseDrawerActivity;
4 |
5 | public abstract class BaseReportActivity extends BaseDrawerActivity {
6 | }
7 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/toolbar_transparent.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Oct 31 22:04:07 GMT 2014
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
7 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/fragment_navigation.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/common/src/main/java/com/code44/finance/common/utils/Strings.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.common.utils;
2 |
3 | public final class Strings {
4 | private Strings() {
5 | }
6 |
7 | public static boolean isEmpty(String str) {
8 | return str == null || str.length() == 0;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/graphs/line/PathMaker.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.graphs.line;
2 |
3 | import android.graphics.Path;
4 | import android.graphics.PointF;
5 |
6 | import java.util.List;
7 |
8 | public interface PathMaker {
9 | public Path makePath(List points);
10 | }
11 |
--------------------------------------------------------------------------------
/financius/src/main/res/drawable/btn_fab.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/financius/src/main/res/menu/currencies.xml:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/transactions/edit/autocomplete/FinderScore.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.transactions.edit.autocomplete;
2 |
3 | import com.code44.finance.data.model.Transaction;
4 |
5 | public interface FinderScore {
6 | public void add(Transaction transaction);
7 |
8 | public float getScore();
9 | }
10 |
--------------------------------------------------------------------------------
/financius/src/main/res/menu/user.xml:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/financius/src/main/res/menu/models.xml:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/common/ViewBackgroundTheme.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.common;
2 |
3 | public enum ViewBackgroundTheme {
4 | Light, Dark;
5 |
6 | public static ViewBackgroundTheme from(int value) {
7 | if (value == 1) {
8 | return Dark;
9 | }
10 | return Light;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/graphs/line/LineGraphValue.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.graphs.line;
2 |
3 | public class LineGraphValue {
4 | private final double value;
5 |
6 | public LineGraphValue(double value) {
7 | this.value = value;
8 | }
9 |
10 | public double getValue() {
11 | return value;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/financius/src/main/res/drawable/circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
--------------------------------------------------------------------------------
/financius/src/debug/java/com/code44/finance/Modules.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance;
2 |
3 | import com.code44.finance.modules.AppModule;
4 |
5 | final class Modules {
6 | private Modules() {
7 | // No instances.
8 | }
9 |
10 | static Object[] list(App app) {
11 | return new Object[]{
12 | new AppModule(app)
13 | };
14 | }
15 | }
--------------------------------------------------------------------------------
/financius/src/release/java/com/code44/finance/Modules.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance;
2 |
3 | import com.code44.finance.modules.AppModule;
4 |
5 | final class Modules {
6 | private Modules() {
7 | // No instances.
8 | }
9 |
10 | static Object[] list(App app) {
11 | return new Object[]{
12 | new AppModule(app)
13 | };
14 | }
15 | }
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/qualifiers/Local.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.qualifiers;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 |
7 | import javax.inject.Qualifier;
8 |
9 | @Qualifier
10 | @Documented
11 | @Retention(RetentionPolicy.RUNTIME)
12 | public @interface Local {
13 | }
14 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/qualifiers/Network.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.qualifiers;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 |
7 | import javax.inject.Qualifier;
8 |
9 | @Qualifier
10 | @Documented
11 | @Retention(RetentionPolicy.RUNTIME)
12 | public @interface Network {
13 | }
14 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/utils/errors/ExportError.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.utils.errors;
2 |
3 | public class ExportError extends AppError {
4 | public ExportError(String detailMessage) {
5 | super(detailMessage);
6 | }
7 |
8 | public ExportError(String detailMessage, Throwable throwable) {
9 | super(detailMessage, throwable);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/utils/errors/ImportError.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.utils.errors;
2 |
3 | public class ImportError extends AppError {
4 | public ImportError(String detailMessage) {
5 | super(detailMessage);
6 | }
7 |
8 | public ImportError(String detailMessage, Throwable throwable) {
9 | super(detailMessage, throwable);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/qualifiers/AppTracker.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.qualifiers;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 |
7 | import javax.inject.Qualifier;
8 |
9 | @Qualifier
10 | @Documented
11 | @Retention(RetentionPolicy.RUNTIME)
12 | public @interface AppTracker {
13 | }
14 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/code44/finance/backend/endpoint/body/EntitiesBody.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.backend.endpoint.body;
2 |
3 | public class EntitiesBody {
4 | private final String deviceRegId;
5 |
6 | public EntitiesBody(String deviceRegId) {
7 | this.deviceRegId = deviceRegId;
8 | }
9 |
10 | public String getDeviceRegId() {
11 | return deviceRegId;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/currencies/CurrenciesRequestService.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api.currencies;
2 |
3 | import retrofit.http.GET;
4 | import retrofit.http.Query;
5 |
6 | public interface CurrenciesRequestService {
7 | @GET("/v1/public/yql?env=store://datatables.org/alltableswithkeys&format=json")
8 | public ExchangeRatesResponse getExchangeRates(@Query("q") String query);
9 | }
10 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/qualifiers/ApplicationContext.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.qualifiers;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 |
7 | import javax.inject.Qualifier;
8 |
9 | @Qualifier
10 | @Documented
11 | @Retention(RetentionPolicy.RUNTIME)
12 | public @interface ApplicationContext {
13 | }
14 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_navigation_divider.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/common/navigation/NavigationScreen.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.common.navigation;
2 |
3 | public enum NavigationScreen {
4 | User(1), Overview(2), Accounts(3), Transactions(4), Reports(5), Settings(6);
5 |
6 | private final int id;
7 |
8 | NavigationScreen(int id) {
9 | this.id = id;
10 | }
11 |
12 | public int getId() {
13 | return id;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/graphs/pie/PieChartValue.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.graphs.pie;
2 |
3 | public class PieChartValue {
4 | private final long value;
5 | private final int color;
6 |
7 | public PieChartValue(long value, int color) {
8 | this.value = value;
9 | this.color = color;
10 | }
11 |
12 | public long getValue() {
13 | return value;
14 | }
15 |
16 | public int getColor() {
17 | return color;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/graphs/MoneyGraphValue.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.graphs;
2 |
3 | public class MoneyGraphValue implements GraphValue {
4 | private final long value;
5 |
6 | public MoneyGraphValue(long value) {
7 | this.value = value;
8 | }
9 |
10 | @Override
11 | public double getValue() {
12 | return value;
13 | }
14 |
15 | @Override
16 | public String getFormattedValue() {
17 | return String.valueOf(value);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
13 |
14 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/activity_simple.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/utils/errors/AppError.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.utils.errors;
2 |
3 | public class AppError extends RuntimeException {
4 | public AppError() {
5 | }
6 |
7 | public AppError(String detailMessage) {
8 | super(detailMessage);
9 | }
10 |
11 | public AppError(String detailMessage, Throwable throwable) {
12 | super(detailMessage, throwable);
13 | }
14 |
15 | public AppError(Throwable throwable) {
16 | super(throwable);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/backend/src/main/webapp/WEB-INF/appengine-web.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | financius-app
4 | 1
5 | true
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/include_navigation.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/backend/src/main/webapp/WEB-INF/logging.properties:
--------------------------------------------------------------------------------
1 | # A default java.util.logging configuration.
2 | # (All App Engine logging is through java.util.logging by default).
3 | #
4 | # To use this configuration, copy it into your application's WEB-INF
5 | # folder and add the following to your appengine-web.xml:
6 | #
7 | #
8 | #
9 | #
10 | #
11 |
12 | # Set the default logging level for all loggers to WARNING
13 | .level = WARNING
14 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/transactions/edit/presenters/AutoCompletePresenter.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.transactions.edit.presenters;
2 |
3 | import android.view.View;
4 |
5 | import com.code44.finance.ui.transactions.edit.autocomplete.AutoCompleteAdapter;
6 |
7 | public interface AutoCompletePresenter {
8 | public AutoCompleteAdapter showAutoComplete(AutoCompleteAdapter> currentAdapter, TransactionEditData transactionEditData, AutoCompleteAdapter.OnAutoCompleteItemClickListener clickListener, View view);
9 | }
10 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_dialog_multiple_choice.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/code44/finance/backend/endpoint/body/TagsBody.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.backend.endpoint.body;
2 |
3 | import com.code44.finance.backend.entity.TagEntity;
4 |
5 | import java.util.List;
6 |
7 | public class TagsBody extends EntitiesBody {
8 | private final List tags;
9 |
10 | public TagsBody(List tags, String deviceRegId) {
11 | super(deviceRegId);
12 | this.tags = tags;
13 | }
14 |
15 | public List getTags() {
16 | return tags;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/Result.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api;
2 |
3 | public class Result {
4 | private final T data;
5 | private final Exception error;
6 |
7 | public Result(T data, Exception error) {
8 | this.data = data;
9 | this.error = error;
10 | }
11 |
12 | public T getData() {
13 | return data;
14 | }
15 |
16 | public Exception getError() {
17 | return error;
18 | }
19 |
20 | public boolean isSuccess() {
21 | return error == null;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/activity_export.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/activity_import.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/activity_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/financius/src/main/res/menu/model.xml:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/financius/src/main/res/values/consts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | - 0
4 | - sans-serif
5 | - sans-serif-light
6 |
7 | - sans-serif-thin
8 | - sans-serif-medium
9 |
10 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_dialog_simple.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_navigation_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/code44/finance/backend/endpoint/body/CategoriesBody.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.backend.endpoint.body;
2 |
3 | import com.code44.finance.backend.entity.CategoryEntity;
4 |
5 | import java.util.List;
6 |
7 | public class CategoriesBody extends EntitiesBody {
8 | private final List categories;
9 |
10 | public CategoriesBody(List categories, String deviceRegId) {
11 | super(deviceRegId);
12 | this.categories = categories;
13 | }
14 |
15 | public List getCategories() {
16 | return categories;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/code44/finance/backend/endpoint/body/CurrenciesBody.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.backend.endpoint.body;
2 |
3 | import com.code44.finance.backend.entity.CurrencyEntity;
4 |
5 | import java.util.List;
6 |
7 | public class CurrenciesBody extends EntitiesBody {
8 | private final List currencies;
9 |
10 | public CurrenciesBody(List currencies, String deviceRegId) {
11 | super(deviceRegId);
12 | this.currencies = currencies;
13 | }
14 |
15 | public List getCurrencies() {
16 | return currencies;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/common/src/main/java/com/code44/finance/common/Constants.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.common;
2 |
3 | public class Constants {
4 | public static final String WEB_CLIENT_ID = "1007413878843-5t32vfui2r35ufc56usmicfnnfkt3h1u.apps.googleusercontent.com";
5 | public static final String ANDROID_AUDIENCE = WEB_CLIENT_ID;
6 | public static final String ANDROID_CLIENT_ID = "1007413878843-suhpr9i0apd98bd8louuvs6g3p9nc8vk.apps.googleusercontent.com";
7 | public static final String IOS_CLIENT_ID = "3-ios-apps.googleusercontent.com";
8 | public static final String EMAIL_SCOPE = "https://www.googleapis.com/auth/userinfo.email";
9 | }
10 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/BaseFragment.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui;
2 |
3 |
4 | import android.app.Activity;
5 | import android.support.v4.app.Fragment;
6 |
7 | import com.code44.finance.App;
8 | import com.code44.finance.utils.EventBus;
9 |
10 | import javax.inject.Inject;
11 |
12 | public class BaseFragment extends Fragment {
13 | @Inject EventBus eventBus;
14 |
15 | @Override public void onAttach(Activity activity) {
16 | super.onAttach(activity);
17 | App.with(activity).inject(this);
18 | }
19 |
20 | protected EventBus getEventBus() {
21 | return eventBus;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_category_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_transaction_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/activity_unlock.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/code44/finance/backend/endpoint/body/AccountsBody.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.backend.endpoint.body;
2 |
3 | import com.code44.finance.backend.entity.AccountEntity;
4 | import com.code44.finance.backend.entity.CategoryEntity;
5 |
6 | import java.util.List;
7 |
8 | public class AccountsBody extends EntitiesBody {
9 | private final List accounts;
10 |
11 | public AccountsBody(List accounts, String deviceRegId) {
12 | super(deviceRegId);
13 | this.accounts = accounts;
14 | }
15 |
16 | public List getAccounts() {
17 | return accounts;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/view_empty_container.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/modules/ViewModule.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.modules;
2 |
3 | import com.code44.finance.ui.common.ActiveIntervalView;
4 | import com.code44.finance.ui.overview.OverviewGraphView;
5 | import com.code44.finance.ui.reports.categories.CategoriesReportView;
6 | import com.code44.finance.views.AccountsView;
7 |
8 | import dagger.Module;
9 |
10 | @Module(
11 | complete = false,
12 | injects = {
13 | OverviewGraphView.class,
14 | AccountsView.class,
15 | ActiveIntervalView.class,
16 | CategoriesReportView.class
17 | }
18 | )
19 | public class ViewModule {
20 | }
21 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/utils/interval/CurrentInterval.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.utils.interval;
2 |
3 | import android.content.Context;
4 |
5 | import com.code44.finance.utils.EventBus;
6 | import com.squareup.otto.Produce;
7 |
8 | /**
9 | * Interval based on user settings and phone timestamp.
10 | */
11 | public class CurrentInterval extends BaseInterval {
12 | public CurrentInterval(Context context, EventBus eventBus, Type type, int length) {
13 | super(context, eventBus, type, length);
14 | eventBus.register(this);
15 | }
16 |
17 | @Produce public CurrentInterval produceCurrentInterval() {
18 | return this;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/view_pin_lock.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/reports/categories/TagExpenseComparator.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.reports.categories;
2 |
3 | import android.support.v4.util.Pair;
4 |
5 | import com.code44.finance.data.model.Tag;
6 |
7 | import java.util.Comparator;
8 |
9 | class TagExpenseComparator implements Comparator> {
10 | @Override public int compare(Pair leftValue, Pair rightValue) {
11 | if (leftValue.second < rightValue.second) {
12 | return 1;
13 | } else if (leftValue.second > rightValue.second) {
14 | return -1;
15 | } else {
16 | return 0;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/reports/categories/CategoryExpenseComparator.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.reports.categories;
2 |
3 | import android.support.v4.util.Pair;
4 |
5 | import com.code44.finance.data.model.Category;
6 |
7 | import java.util.Comparator;
8 |
9 | class CategoryExpenseComparator implements Comparator> {
10 | @Override public int compare(Pair leftValue, Pair rightValue) {
11 | if (leftValue.second < rightValue.second) {
12 | return 1;
13 | } else if (leftValue.second > rightValue.second) {
14 | return -1;
15 | } else {
16 | return 0;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/activity_lock.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/code44/finance/backend/endpoint/body/TransactionsBody.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.backend.endpoint.body;
2 |
3 | import com.code44.finance.backend.entity.CategoryEntity;
4 | import com.code44.finance.backend.entity.TransactionEntity;
5 |
6 | import java.util.List;
7 |
8 | public class TransactionsBody extends EntitiesBody {
9 | private final List transactions;
10 |
11 | public TransactionsBody(List transactions, String deviceRegId) {
12 | super(deviceRegId);
13 | this.transactions = transactions;
14 | }
15 |
16 | public List getTransactions() {
17 | return transactions;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/ModelEditActivityOld.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui;
2 |
3 | import android.os.Bundle;
4 | import android.view.Menu;
5 |
6 | public abstract class ModelEditActivityOld extends ModelActivityOld implements ModelEditFragment.ModelEditListener {
7 | @Override protected void onCreate(Bundle savedInstanceState) {
8 | super.onCreate(savedInstanceState);
9 | getSupportActionBar().hide();
10 | }
11 |
12 | @Override public boolean onCreateOptionsMenu(Menu menu) {
13 | return false;
14 | }
15 |
16 | @Override public void onModelSaved() {
17 | finish();
18 | }
19 |
20 | @Override public void onModelCanceled() {
21 | finish();
22 | }
23 | }
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/modules/providers/ContextProviderModule.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.modules.providers;
2 |
3 | import android.content.Context;
4 |
5 | import com.code44.finance.common.utils.Preconditions;
6 | import com.code44.finance.qualifiers.ApplicationContext;
7 |
8 | import dagger.Module;
9 | import dagger.Provides;
10 |
11 | @Module(
12 | library = true
13 | )
14 | public class ContextProviderModule {
15 | private final Context context;
16 |
17 | public ContextProviderModule(Context context) {
18 | this.context = Preconditions.notNull(context, "Context cannot be null.");
19 | }
20 |
21 | @Provides @ApplicationContext Context provideApplicationContext() {
22 | return context;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/view_balance_graph.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
20 |
21 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/view_trends_graph.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
20 |
21 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/code44/finance/backend/endpoint/body/RegisterDeviceBody.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.backend.endpoint.body;
2 |
3 | import com.code44.finance.common.utils.Strings;
4 | import com.google.api.server.spi.response.BadRequestException;
5 | import com.google.gson.annotations.SerializedName;
6 |
7 | public class RegisterDeviceBody implements Body {
8 | @SerializedName(value = "registration_id")
9 | private String regId;
10 |
11 | public void verifyRequiredFields() throws BadRequestException {
12 | if (Strings.isEmpty(regId)) {
13 | throw new BadRequestException("registration_id cannot be empty.");
14 | }
15 | }
16 |
17 | public String getRegId() {
18 | return regId;
19 | }
20 |
21 | public void setRegId(String regId) {
22 | this.regId = regId;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/activity_categories.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
11 |
12 |
15 |
16 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/data/backup/DataImporter.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.data.backup;
2 |
3 | import com.code44.finance.common.utils.Preconditions;
4 |
5 | import java.io.Closeable;
6 | import java.io.IOException;
7 | import java.io.InputStream;
8 |
9 | public abstract class DataImporter implements Closeable {
10 | private final InputStream inputStream;
11 |
12 | public DataImporter(InputStream inputStream) {
13 | this.inputStream = Preconditions.notNull(inputStream, "InputStream cannot be null.");
14 | }
15 |
16 | @Override public void close() throws IOException {
17 | inputStream.close();
18 | }
19 |
20 | public void importData() throws Exception {
21 | importData(inputStream);
22 | }
23 |
24 | protected abstract void importData(InputStream inputStream) throws Exception;
25 | }
26 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/common/presenters/Presenter.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.common.presenters;
2 |
3 | import android.app.Activity;
4 | import android.support.annotation.IdRes;
5 | import android.view.View;
6 |
7 | public abstract class Presenter {
8 | protected T findView(Activity activity, @IdRes int viewId) {
9 | return findView(activity.findViewById(android.R.id.content), viewId);
10 | }
11 |
12 | protected T findView(View parent, @IdRes int viewId) {
13 | //noinspection unchecked
14 | T view = (T) parent.findViewById(viewId);
15 | if (view == null) {
16 | throw new IllegalStateException("Layout must contain view with id: " + parent.getContext().getResources().getResourceName(viewId));
17 | }
18 |
19 | return view;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/data/backup/DataExporter.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.data.backup;
2 |
3 | import com.code44.finance.common.utils.Preconditions;
4 |
5 | import java.io.Closeable;
6 | import java.io.IOException;
7 | import java.io.OutputStream;
8 |
9 | public abstract class DataExporter implements Closeable {
10 | private final OutputStream outputStream;
11 |
12 | protected DataExporter(OutputStream outputStream) {
13 | this.outputStream = Preconditions.notNull(outputStream, "OutputStream cannot be null.");
14 | }
15 |
16 | @Override public void close() throws IOException {
17 | outputStream.close();
18 | }
19 |
20 | public void exportData() throws Exception {
21 | exportData(outputStream);
22 | }
23 |
24 | public abstract void exportData(OutputStream outputStream) throws Exception;
25 | }
26 |
--------------------------------------------------------------------------------
/common/src/main/java/com/code44/finance/common/model/DecimalSeparator.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.common.model;
2 |
3 | public enum DecimalSeparator {
4 | Dot("."),
5 | Comma(","),
6 | Space(" ");
7 |
8 | private final String symbol;
9 |
10 | private DecimalSeparator(String symbol) {
11 | this.symbol = symbol;
12 | }
13 |
14 | public static DecimalSeparator fromSymbol(String symbol) {
15 | switch (symbol) {
16 | case ".":
17 | return Dot;
18 |
19 | case ",":
20 | return Comma;
21 |
22 | case " ":
23 | return Space;
24 |
25 | default:
26 | throw new IllegalArgumentException("Symbol '" + symbol + "' is not supported.");
27 | }
28 | }
29 |
30 | public String symbol() {
31 | return symbol;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/graphs/line/SharpPathMaker.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.graphs.line;
2 |
3 | import android.graphics.Path;
4 | import android.graphics.PointF;
5 |
6 | import java.util.List;
7 |
8 | public class SharpPathMaker implements PathMaker {
9 | @Override public Path makePath(List points) {
10 | final Path path = new Path();
11 |
12 | for (int i = 0, size = points != null ? points.size() : 0; i < size; i++) {
13 | final PointF point = points.get(i);
14 | if (point == null) {
15 | continue;
16 | }
17 |
18 | if (i == 0 || points.get(i - 1) == null) {
19 | path.moveTo(point.x, point.y);
20 | } else {
21 | path.lineTo(point.x, point.y);
22 | }
23 | }
24 |
25 | return path;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_dialog_single_choice.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/activity_transactions.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
12 |
13 |
16 |
17 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_settings_subtitle.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
23 |
24 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/utils/EventBus.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.utils;
2 |
3 | import android.os.Handler;
4 | import android.os.Looper;
5 |
6 | import com.squareup.otto.Bus;
7 | import com.squareup.otto.ThreadEnforcer;
8 |
9 | import javax.inject.Inject;
10 |
11 | public class EventBus extends Bus {
12 | private final Handler handler = new Handler(Looper.getMainLooper());
13 |
14 | @Inject public EventBus() {
15 | super(ThreadEnforcer.ANY);
16 | }
17 |
18 | @Override public void post(final Object event) {
19 | if (Looper.myLooper() == Looper.getMainLooper()) {
20 | super.post(event);
21 | } else {
22 | handler.post(new Runnable() {
23 | @Override
24 | public void run() {
25 | EventBus.super.post(event);
26 | }
27 | });
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Settings specified in this file will override any Gradle settings
5 | # configured through the IDE.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/receivers/GcmBroadcastReceiver.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.receivers;
2 |
3 | import android.app.Activity;
4 | import android.content.ComponentName;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.support.v4.content.WakefulBroadcastReceiver;
8 |
9 | import com.code44.finance.services.GcmService;
10 |
11 | public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {
12 | @Override
13 | public void onReceive(Context context, Intent intent) {
14 | // Explicitly specify that GcmIntentService will handle the intent.
15 | ComponentName comp = new ComponentName(context.getPackageName(), GcmService.class.getName());
16 | // Start the service, keeping the device awake while it is launching.
17 | startWakefulService(context, (intent.setComponent(comp)));
18 | setResultCode(Activity.RESULT_OK);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/utils/ThemeUtils.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.utils;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.drawable.Drawable;
6 | import android.support.annotation.AttrRes;
7 |
8 | public final class ThemeUtils {
9 | private ThemeUtils() {
10 | }
11 |
12 | public static int getColor(Context context, @AttrRes int resId) {
13 | final TypedArray a = context.getTheme().obtainStyledAttributes(new int[]{resId});
14 | final int color = a.getColor(0, 0);
15 | a.recycle();
16 | return color;
17 | }
18 |
19 | public static Drawable getDrawable(Context context, @AttrRes int resId) {
20 | final TypedArray a = context.getTheme().obtainStyledAttributes(new int[]{resId});
21 | final Drawable drawable = a.getDrawable(0);
22 | a.recycle();
23 | return drawable;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/services/GcmService.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.services;
2 |
3 | import android.app.IntentService;
4 | import android.content.Intent;
5 |
6 | import com.code44.finance.App;
7 | import com.code44.finance.api.Api;
8 | import com.code44.finance.receivers.GcmBroadcastReceiver;
9 |
10 | import javax.inject.Inject;
11 |
12 | public class GcmService extends IntentService {
13 | @Inject Api api;
14 |
15 | public GcmService() {
16 | super(GcmService.class.getSimpleName());
17 | }
18 |
19 | @Override public void onCreate() {
20 | super.onCreate();
21 | App.with(getApplicationContext()).inject(this);
22 | }
23 |
24 | @Override protected void onHandleIntent(Intent intent) {
25 | api.sync();
26 |
27 | // Release the wake lock provided by the WakefulBroadcastReceiver.
28 | GcmBroadcastReceiver.completeWakefulIntent(intent);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/code44/finance/backend/entity/DeviceEntity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.backend.entity;
2 |
3 | import com.google.api.server.spi.config.AnnotationBoolean;
4 | import com.google.api.server.spi.config.ApiResourceProperty;
5 | import com.googlecode.objectify.Key;
6 | import com.googlecode.objectify.annotation.Entity;
7 |
8 | import static com.code44.finance.backend.OfyService.ofy;
9 |
10 | @Entity
11 | public class DeviceEntity extends BaseEntity {
12 | @ApiResourceProperty(ignored = AnnotationBoolean.TRUE)
13 | private Key userAccount;
14 |
15 | public static DeviceEntity find(String id) {
16 | return ofy().load().type(DeviceEntity.class).id(id).now();
17 | }
18 |
19 | public Key getUserAccount() {
20 | return userAccount;
21 | }
22 |
23 | public void setUserAccount(Key userAccount) {
24 | this.userAccount = userAccount;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/common/src/main/java/com/code44/finance/common/model/GroupSeparator.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.common.model;
2 |
3 | public enum GroupSeparator {
4 | None(""),
5 | Dot("."),
6 | Comma(","),
7 | Space(" ");
8 |
9 | private final String symbol;
10 |
11 | private GroupSeparator(String symbol) {
12 | this.symbol = symbol;
13 | }
14 |
15 | public static GroupSeparator fromSymbol(String symbol) {
16 | switch (symbol) {
17 | case "":
18 | return None;
19 |
20 | case ".":
21 | return Dot;
22 |
23 | case ",":
24 | return Comma;
25 |
26 | case " ":
27 | return Space;
28 |
29 | default:
30 | throw new IllegalArgumentException("Symbol '" + symbol + "' is not supported.");
31 | }
32 | }
33 |
34 | public String symbol() {
35 | return symbol;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/views/SquareButton.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.views;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.Button;
6 |
7 | @SuppressWarnings("UnusedDeclaration")
8 | public class SquareButton extends Button {
9 | public SquareButton(Context context) {
10 | super(context);
11 | }
12 |
13 | public SquareButton(Context context, AttributeSet attrs) {
14 | super(context, attrs);
15 | }
16 |
17 | public SquareButton(Context context, AttributeSet attrs, int defStyle) {
18 | super(context, attrs, defStyle);
19 | }
20 |
21 | @Override
22 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
23 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
24 | final int size = Math.min(getMeasuredWidth(), getMeasuredHeight());
25 | setMeasuredDimension(size, size);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/include_account.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
25 |
26 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_currency_account.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
26 |
27 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/data/backup/DataExporterRunnable.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.data.backup;
2 |
3 | import com.code44.finance.utils.EventBus;
4 | import com.code44.finance.utils.errors.ExportError;
5 | import com.crashlytics.android.Crashlytics;
6 |
7 | public class DataExporterRunnable implements Runnable {
8 | private final EventBus eventBus;
9 | private final DataExporter dataExporter;
10 |
11 | public DataExporterRunnable(EventBus eventBus, DataExporter dataExporter) {
12 | this.eventBus = eventBus;
13 | this.dataExporter = dataExporter;
14 | }
15 |
16 | @Override public void run() {
17 | try {
18 | dataExporter.exportData();
19 | eventBus.post(dataExporter);
20 | } catch (Exception e) {
21 | e.printStackTrace();
22 | final ExportError error = new ExportError("Data export has failed. " + e.getMessage(), e);
23 | Crashlytics.logException(error);
24 | eventBus.post(error);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/activity_tags.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
13 |
14 |
17 |
18 |
22 |
23 |
24 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/view_categories_report.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
24 |
25 |
--------------------------------------------------------------------------------
/common/src/main/java/com/code44/finance/common/model/TransactionState.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.common.model;
2 |
3 | public enum TransactionState {
4 | Confirmed(TransactionState.VALUE_CONFIRMED),
5 | Pending(TransactionState.VALUE_PENDING);
6 |
7 | private static final int VALUE_CONFIRMED = 1;
8 | private static final int VALUE_PENDING = 2;
9 |
10 | private final int value;
11 |
12 | private TransactionState(int value) {
13 | this.value = value;
14 | }
15 |
16 | public static TransactionState fromInt(int value) {
17 | switch (value) {
18 | case VALUE_CONFIRMED:
19 | return Confirmed;
20 |
21 | case VALUE_PENDING:
22 | return Pending;
23 |
24 | default:
25 | throw new IllegalArgumentException("State " + value + " is not supported.");
26 | }
27 | }
28 |
29 | public int asInt() {
30 | return value;
31 | }
32 |
33 | public String asString() {
34 | return String.valueOf(value);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/code44/finance/backend/OfyService.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.backend;
2 |
3 | import com.code44.finance.backend.entity.CurrencyEntity;
4 | import com.code44.finance.backend.entity.DeviceEntity;
5 | import com.code44.finance.backend.entity.UserAccount;
6 | import com.googlecode.objectify.Objectify;
7 | import com.googlecode.objectify.ObjectifyFactory;
8 | import com.googlecode.objectify.ObjectifyService;
9 |
10 | /**
11 | * Objectify service wrapper so we can statically register our persistence classes
12 | * More on Objectify here : https://code.google.com/p/objectify-appengine/
13 | */
14 | public class OfyService {
15 |
16 | static {
17 | ObjectifyService.register(UserAccount.class);
18 | ObjectifyService.register(DeviceEntity.class);
19 | ObjectifyService.register(CurrencyEntity.class);
20 | }
21 |
22 | public static Objectify ofy() {
23 | return ObjectifyService.ofy();
24 | }
25 |
26 | public static ObjectifyFactory factory() {
27 | return ObjectifyService.factory();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/fragment_reports.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
23 |
24 |
--------------------------------------------------------------------------------
/financius/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:/Developer/Android Studio/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | -keep class !android.support.v7.internal.view.menu.MenuBuilder, !android.support.v7.internal.view.menu.SubMenuBuilder { *; }
20 | -keepattributes SourceFile, LineNumberTable
21 |
22 | -dontwarn retrofit.**
23 | -dontwarn okio.**
24 | -dontwarn com.squareup.okhttp.**
25 | -dontwarn com.google.common.**
26 | -dontwarn dagger.internal.**
--------------------------------------------------------------------------------
/financius/src/main/res/layout/dialog_fragment_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_category.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
26 |
27 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/utils/interval/ActiveInterval.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.utils.interval;
2 |
3 | import android.content.Context;
4 |
5 | import com.code44.finance.utils.EventBus;
6 | import com.squareup.otto.Produce;
7 |
8 | import org.joda.time.Interval;
9 | import org.joda.time.Period;
10 |
11 | /**
12 | * Interval based on user's choice.
13 | */
14 | public class ActiveInterval extends BaseInterval {
15 | public ActiveInterval(Context context, EventBus eventBus, Type type, int length) {
16 | super(context, eventBus, type, length);
17 | eventBus.register(this);
18 | }
19 |
20 | @Produce public ActiveInterval produceActiveInterval() {
21 | return this;
22 | }
23 |
24 | public void previous() {
25 | final Period period = getPeriodForType();
26 | interval = new Interval(period, interval.getStart());
27 | notifyChanged();
28 | }
29 |
30 | public void next() {
31 | final Period period = getPeriodForType();
32 | interval = new Interval(interval.getEnd(), period);
33 | notifyChanged();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_tag.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
21 |
22 |
28 |
29 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/include_dialog_buttons.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
19 |
27 |
28 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_navigation.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
19 |
20 |
26 |
27 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/modules/AppModule.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.modules;
2 |
3 | import android.content.Context;
4 |
5 | import com.code44.finance.App;
6 | import com.code44.finance.modules.providers.AnalyticsProviderModule;
7 | import com.code44.finance.qualifiers.ApplicationContext;
8 |
9 | import javax.inject.Singleton;
10 |
11 | import dagger.Module;
12 | import dagger.Provides;
13 |
14 | @Module(
15 | injects = {
16 | App.class
17 | },
18 | includes = {
19 | UtilsModule.class,
20 | UIModule.class,
21 | ApiModule.class,
22 | CurrenciesApiModule.class,
23 | AccountModule.class,
24 | PersistenceModule.class,
25 | ViewModule.class,
26 | AnalyticsProviderModule.class
27 | }
28 | )
29 | public final class AppModule {
30 | private final App app;
31 |
32 | public AppModule(App app) {
33 | this.app = app;
34 | }
35 |
36 | @Provides @Singleton @ApplicationContext Context provideApplication() {
37 | return app;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/data/backup/DataImporterRunnable.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.data.backup;
2 |
3 | import com.code44.finance.utils.EventBus;
4 | import com.code44.finance.utils.IOUtils;
5 | import com.code44.finance.utils.errors.ImportError;
6 | import com.crashlytics.android.Crashlytics;
7 |
8 | public class DataImporterRunnable implements Runnable {
9 | private final EventBus eventBus;
10 | private final DataImporter dataImporter;
11 |
12 | public DataImporterRunnable(EventBus eventBus, DataImporter dataImporter) {
13 | this.eventBus = eventBus;
14 | this.dataImporter = dataImporter;
15 | }
16 |
17 | @Override public void run() {
18 | try {
19 | dataImporter.importData();
20 | eventBus.post(dataImporter);
21 | } catch (Exception e) {
22 | e.printStackTrace();
23 | final ImportError error = new ImportError("Data import has failed. " + e.getMessage(), e);
24 | Crashlytics.logException(error);
25 | eventBus.post(error);
26 | } finally {
27 | IOUtils.closeQuietly(dataImporter);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/utils/LocalExecutor.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.utils;
2 |
3 | import android.os.Process;
4 | import android.support.annotation.NonNull;
5 |
6 | import java.util.concurrent.LinkedBlockingQueue;
7 | import java.util.concurrent.ThreadFactory;
8 | import java.util.concurrent.ThreadPoolExecutor;
9 | import java.util.concurrent.TimeUnit;
10 |
11 | public class LocalExecutor extends ThreadPoolExecutor {
12 | public LocalExecutor(int maxThreads) {
13 | super(0, maxThreads, 30, TimeUnit.SECONDS, new LinkedBlockingQueue(), new LocalThreadFactory());
14 | }
15 |
16 | private static class LocalThreadFactory implements ThreadFactory {
17 | @Override public Thread newThread(@NonNull Runnable runnable) {
18 | return new LocalThread(runnable);
19 | }
20 | }
21 |
22 | private static class LocalThread extends Thread {
23 | private LocalThread(Runnable runnable) {
24 | super(runnable);
25 | }
26 |
27 | @Override public void run() {
28 | Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
29 | super.run();
30 | }
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/common/src/main/java/com/code44/finance/common/model/ModelState.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.common.model;
2 |
3 | public enum ModelState {
4 | Normal(ModelState.VALUE_NORMAL),
5 | Deleted(ModelState.VALUE_DELETED),
6 | DeletedUndo(ModelState.VALUE_DELETED_UNDO);
7 |
8 | private static final int VALUE_NORMAL = 1;
9 | private static final int VALUE_DELETED = 2;
10 | private static final int VALUE_DELETED_UNDO = 3;
11 |
12 | private final int value;
13 |
14 | private ModelState(int value) {
15 | this.value = value;
16 | }
17 |
18 | public static ModelState fromInt(int value) {
19 | switch (value) {
20 | case VALUE_NORMAL:
21 | return Normal;
22 |
23 | case VALUE_DELETED:
24 | return Deleted;
25 |
26 | case VALUE_DELETED_UNDO:
27 | return DeletedUndo;
28 |
29 | default:
30 | throw new IllegalArgumentException("Value " + value + " is not supported.");
31 | }
32 | }
33 |
34 | public int asInt() {
35 | return value;
36 | }
37 |
38 | public String asString() {
39 | return String.valueOf(value);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/backend/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SystemServiceServlet
5 | com.google.api.server.spi.SystemServiceServlet
6 |
7 | services
8 |
9 | com.code44.finance.backend.endpoint.UsersEndpoint,
10 | com.code44.finance.backend.endpoint.CurrenciesEndpoint,
11 | com.code44.finance.backend.endpoint.CategoriesEndpoint,
12 | com.code44.finance.backend.endpoint.TagsEndpoint,
13 | com.code44.finance.backend.endpoint.AccountsEndpoint,
14 | com.code44.finance.backend.endpoint.TransactionsEndpoint
15 |
16 |
17 |
18 |
19 | SystemServiceServlet
20 | /_ah/spi/*
21 |
22 |
23 |
24 | index.html
25 |
26 |
--------------------------------------------------------------------------------
/common/src/main/java/com/code44/finance/common/model/TransactionType.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.common.model;
2 |
3 | public enum TransactionType {
4 | Expense(TransactionType.VALUE_EXPENSE),
5 | Income(TransactionType.VALUE_INCOME),
6 | Transfer(TransactionType.VALUE_TRANSFER);
7 |
8 | private static final int VALUE_EXPENSE = 1;
9 | private static final int VALUE_INCOME = 2;
10 | private static final int VALUE_TRANSFER = 3;
11 |
12 | private final int value;
13 |
14 | private TransactionType(int value) {
15 | this.value = value;
16 | }
17 |
18 | public static TransactionType fromInt(int value) {
19 | switch (value) {
20 | case VALUE_EXPENSE:
21 | return Expense;
22 |
23 | case VALUE_INCOME:
24 | return Income;
25 |
26 | case VALUE_TRANSFER:
27 | return Transfer;
28 |
29 | default:
30 | throw new IllegalArgumentException("Value " + value + " is not supported.");
31 | }
32 | }
33 |
34 | public int asInt() {
35 | return value;
36 | }
37 |
38 | public String asString() {
39 | return String.valueOf(value);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/utils/AccountUtils.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.utils;
2 |
3 | import com.code44.finance.data.model.Transaction;
4 |
5 | public final class AccountUtils {
6 | private static final String UNKNOWN_VALUE = "?";
7 | private static final String TRANSFER_SYMBOL = " → ";
8 |
9 | private AccountUtils() {
10 | }
11 |
12 | public static String getTitle(Transaction transaction) {
13 | switch (transaction.getTransactionType()) {
14 | case Expense:
15 | return transaction.getAccountFrom() != null ? transaction.getAccountFrom().getTitle() : UNKNOWN_VALUE;
16 | case Income:
17 | return transaction.getAccountTo() != null ? transaction.getAccountTo().getTitle() : UNKNOWN_VALUE;
18 | case Transfer:
19 | return (transaction.getAccountFrom() != null ? transaction.getAccountFrom().getTitle() : UNKNOWN_VALUE) + TRANSFER_SYMBOL + (transaction.getAccountTo() != null ? transaction.getAccountTo().getTitle() : UNKNOWN_VALUE);
20 | default:
21 | throw new IllegalArgumentException("Transaction type " + transaction.getTransactionType() + " is not supported.");
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/tags/edit/TagEditActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.tags.edit;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 |
7 | import com.code44.finance.R;
8 | import com.code44.finance.ui.common.activities.BaseActivity;
9 | import com.code44.finance.ui.common.presenters.ActivityPresenter;
10 | import com.code44.finance.utils.analytics.Analytics;
11 |
12 | public class TagEditActivity extends BaseActivity {
13 | public static void start(Context context, String tagId) {
14 | final Intent intent = makeIntentForActivity(context, TagEditActivity.class);
15 | TagEditActivityPresenter.addExtras(intent, tagId);
16 | startActivity(context, intent);
17 | }
18 |
19 | @Override protected void onCreateView(Bundle savedInstanceState) {
20 | super.onCreateView(savedInstanceState);
21 | setContentView(R.layout.activity_tag_edit);
22 | }
23 |
24 | @Override protected ActivityPresenter onCreateActivityPresenter() {
25 | return new TagEditActivityPresenter(getEventBus());
26 | }
27 |
28 | @Override protected Analytics.Screen getScreen() {
29 | return Analytics.Screen.TagEdit;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/code44/finance/backend/entity/TagEntity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.backend.entity;
2 |
3 | import com.google.api.server.spi.config.AnnotationBoolean;
4 | import com.google.api.server.spi.config.ApiResourceProperty;
5 | import com.googlecode.objectify.Key;
6 | import com.googlecode.objectify.annotation.Entity;
7 | import com.googlecode.objectify.annotation.Index;
8 |
9 | import static com.code44.finance.backend.OfyService.ofy;
10 |
11 | @Entity
12 | public class TagEntity extends BaseEntity {
13 | @Index
14 | @ApiResourceProperty(ignored = AnnotationBoolean.TRUE)
15 | private Key userAccount;
16 |
17 | @ApiResourceProperty(name = "title")
18 | private String title;
19 |
20 | public static TagEntity find(String id) {
21 | return ofy().load().type(TagEntity.class).id(id).now();
22 | }
23 |
24 | public Key getUserAccount() {
25 | return userAccount;
26 | }
27 |
28 | public void setUserAccount(Key userAccount) {
29 | this.userAccount = userAccount;
30 | }
31 |
32 | public String getTitle() {
33 | return title;
34 | }
35 |
36 | public void setTitle(String title) {
37 | this.title = title;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/transactions/edit/presenters/FlagsPresenter.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.transactions.edit.presenters;
2 |
3 | import android.widget.CheckBox;
4 | import android.widget.CompoundButton;
5 |
6 | import com.code44.finance.R;
7 | import com.code44.finance.ui.common.activities.BaseActivity;
8 | import com.code44.finance.ui.common.presenters.Presenter;
9 |
10 | public class FlagsPresenter extends Presenter {
11 | private final CheckBox includeInReportsCheckBox;
12 | private final CompoundButton.OnCheckedChangeListener onCheckedChangeListener;
13 |
14 | public FlagsPresenter(BaseActivity activity, CompoundButton.OnCheckedChangeListener checkedChangeListener) {
15 | includeInReportsCheckBox = findView(activity, R.id.includeInReportsCheckBox);
16 |
17 | onCheckedChangeListener = checkedChangeListener;
18 | includeInReportsCheckBox.setOnCheckedChangeListener(checkedChangeListener);
19 | }
20 |
21 | public void setIncludeInReports(boolean includeInReports) {
22 | includeInReportsCheckBox.setOnCheckedChangeListener(null);
23 | includeInReportsCheckBox.setChecked(includeInReports);
24 | includeInReportsCheckBox.setOnCheckedChangeListener(onCheckedChangeListener);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/common/BaseModelsAdapter.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.common;
2 |
3 | import android.content.Context;
4 | import android.support.v4.widget.CursorAdapter;
5 |
6 | import com.code44.finance.data.model.Model;
7 |
8 | import java.util.HashSet;
9 | import java.util.Set;
10 |
11 | public abstract class BaseModelsAdapter extends CursorAdapter {
12 | private final Set selectedModels = new HashSet<>();
13 |
14 | public BaseModelsAdapter(Context context) {
15 | super(context, null, true);
16 | }
17 |
18 | public Set getSelectedModels() {
19 | return selectedModels;
20 | }
21 |
22 | public void setSelectedModels(Set extends Model> selectedModels) {
23 | this.selectedModels.clear();
24 | if (selectedModels != null) {
25 | this.selectedModels.addAll(selectedModels);
26 | }
27 | notifyDataSetChanged();
28 | }
29 |
30 | public boolean isModelSelected(Model model) {
31 | return selectedModels.contains(model);
32 | }
33 |
34 | public void toggleModelSelected(Model model) {
35 | if (!selectedModels.add(model)) {
36 | selectedModels.remove(model);
37 | }
38 | notifyDataSetChanged();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/categories/edit/CategoryEditActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.categories.edit;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 |
7 | import com.code44.finance.R;
8 | import com.code44.finance.ui.common.activities.BaseActivity;
9 | import com.code44.finance.ui.common.presenters.ActivityPresenter;
10 | import com.code44.finance.utils.analytics.Analytics;
11 |
12 | public class CategoryEditActivity extends BaseActivity {
13 | public static void start(Context context, String categoryId) {
14 | final Intent intent = makeIntentForActivity(context, CategoryEditActivity.class);
15 | CategoryEditActivityPresenter.addExtras(intent, categoryId);
16 | startActivity(context, intent);
17 | }
18 |
19 | @Override protected void onCreateView(Bundle savedInstanceState) {
20 | super.onCreateView(savedInstanceState);
21 | setContentView(R.layout.activity_category_edit);
22 | }
23 |
24 | @Override protected ActivityPresenter onCreateActivityPresenter() {
25 | return new CategoryEditActivityPresenter(getEventBus());
26 | }
27 |
28 | @Override protected Analytics.Screen getScreen() {
29 | return Analytics.Screen.CategoryEdit;
30 | }
31 | }
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/currencies/edit/CurrencyEditActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.currencies.edit;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 |
7 | import com.code44.finance.R;
8 | import com.code44.finance.ui.common.activities.BaseActivity;
9 | import com.code44.finance.ui.common.presenters.ActivityPresenter;
10 | import com.code44.finance.utils.analytics.Analytics;
11 |
12 | public class CurrencyEditActivity extends BaseActivity {
13 | public static void start(Context context, String currencyId) {
14 | final Intent intent = makeIntentForActivity(context, CurrencyEditActivity.class);
15 | CurrencyEditActivityPresenter.addExtras(intent, currencyId);
16 | startActivity(context, intent);
17 | }
18 |
19 | @Override protected void onCreateView(Bundle savedInstanceState) {
20 | super.onCreateView(savedInstanceState);
21 | setContentView(R.layout.activity_currency_edit);
22 | }
23 |
24 | @Override protected ActivityPresenter onCreateActivityPresenter() {
25 | return new CurrencyEditActivityPresenter(getEventBus());
26 | }
27 |
28 | @Override protected Analytics.Screen getScreen() {
29 | return Analytics.Screen.CurrencyEdit;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/fragment_user.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
22 |
23 |
28 |
29 |
34 |
35 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/common/views/TintImageView.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.common.views;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.util.AttributeSet;
6 | import android.widget.ImageView;
7 |
8 | import com.code44.finance.R;
9 |
10 | public class TintImageView extends ImageView {
11 | public TintImageView(Context context) {
12 | super(context);
13 | init(context, null);
14 | }
15 |
16 | public TintImageView(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | init(context, attrs);
19 | }
20 |
21 | public TintImageView(Context context, AttributeSet attrs, int defStyleAttr) {
22 | super(context, attrs, defStyleAttr);
23 | init(context, attrs);
24 | }
25 |
26 | private void init(Context context, AttributeSet attrs) {
27 | int tintColor = 0;
28 |
29 | if (attrs != null) {
30 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TintImageView);
31 |
32 | tintColor = a.getColor(R.styleable.TintImageView_supportTintColor, 0);
33 |
34 | a.recycle();
35 | }
36 |
37 | if (tintColor != 0) {
38 | setColorFilter(tintColor);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/SplashActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.code44.finance.BuildConfig;
6 | import com.code44.finance.services.StartupService;
7 | import com.code44.finance.ui.common.activities.BaseActivity;
8 | import com.code44.finance.ui.overview.OverviewActivity;
9 | import com.code44.finance.utils.preferences.GeneralPrefs;
10 | import com.crashlytics.android.Crashlytics;
11 |
12 | import javax.inject.Inject;
13 |
14 | public class SplashActivity extends BaseActivity {
15 | @Inject GeneralPrefs generalPrefs;
16 |
17 | @Override protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | Crashlytics.start(this);
20 |
21 | checkVersionUpdate();
22 |
23 | OverviewActivity.start(this);
24 | StartupService.start(this);
25 | finish();
26 | }
27 |
28 | private void checkVersionUpdate() {
29 | final int lastVersionCode = generalPrefs.getLastVersionCode();
30 | final int currentVersionCode = BuildConfig.VERSION_CODE;
31 |
32 | if (lastVersionCode < currentVersionCode) {
33 | // TODO Start upgrade service.
34 | generalPrefs.setLastVersionCode(currentVersionCode);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/settings/data/DataActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.settings.data;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.view.Menu;
6 |
7 | import com.code44.finance.R;
8 | import com.code44.finance.ui.common.activities.BaseActivity;
9 | import com.code44.finance.utils.analytics.Analytics;
10 |
11 | public class DataActivity extends BaseActivity {
12 | public static void start(Context context) {
13 | startActivity(context, makeIntentForActivity(context, DataActivity.class));
14 | }
15 |
16 | @Override protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.activity_simple);
19 | getSupportActionBar().setTitle(R.string.your_data);
20 |
21 | if (savedInstanceState == null) {
22 | getSupportFragmentManager().beginTransaction().replace(R.id.content, DataFragment.newInstance()).commit();
23 | }
24 | }
25 |
26 | @Override public boolean onCreateOptionsMenu(Menu menu) {
27 | super.onCreateOptionsMenu(menu);
28 | menu.clear();
29 | return true;
30 | }
31 |
32 | @Override protected Analytics.Screen getScreen() {
33 | return Analytics.Screen.YourData;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/common/views/TintImageButton.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.common.views;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.util.AttributeSet;
6 | import android.widget.ImageButton;
7 |
8 | import com.code44.finance.R;
9 |
10 | public class TintImageButton extends ImageButton {
11 | public TintImageButton(Context context) {
12 | super(context);
13 | init(context, null);
14 | }
15 |
16 | public TintImageButton(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | init(context, attrs);
19 | }
20 |
21 | public TintImageButton(Context context, AttributeSet attrs, int defStyleAttr) {
22 | super(context, attrs, defStyleAttr);
23 | init(context, attrs);
24 | }
25 |
26 | private void init(Context context, AttributeSet attrs) {
27 | int tintColor = 0;
28 |
29 | if (attrs != null) {
30 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TintImageButton);
31 |
32 | tintColor = a.getColor(R.styleable.TintImageButton_supportTintColor, 0);
33 |
34 | a.recycle();
35 | }
36 |
37 | if (tintColor != 0) {
38 | setColorFilter(tintColor);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/currencies/ExchangeRatesResponse.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api.currencies;
2 |
3 | import com.code44.finance.data.model.ExchangeRate;
4 | import com.google.gson.JsonArray;
5 | import com.google.gson.JsonObject;
6 | import com.google.gson.annotations.SerializedName;
7 |
8 | import java.util.HashSet;
9 | import java.util.Set;
10 |
11 | public class ExchangeRatesResponse {
12 | @SerializedName("query")
13 | private JsonObject query;
14 |
15 | public Set getExchangeRates() {
16 | final Set exchangeRates = new HashSet<>();
17 | final JsonArray jsonArray = query.getAsJsonObject("results").getAsJsonArray("rate");
18 | for (int i = 0, size = jsonArray.size(); i < size; i++) {
19 | final JsonObject jsonObject = jsonArray.get(i).getAsJsonObject();
20 | final String id = jsonObject.get("id").getAsString();
21 | final double rate = jsonObject.get("Rate").getAsDouble();
22 | final ExchangeRate exchangeRate = new ExchangeRate();
23 | exchangeRate.setFromCode(id.substring(0, 3));
24 | exchangeRate.setToCode(id.substring(3));
25 | exchangeRate.setRate(rate);
26 | exchangeRates.add(exchangeRate);
27 | }
28 |
29 | return exchangeRates;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/transactions/edit/presenters/TransactionStatePresenter.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.transactions.edit.presenters;
2 |
3 | import android.widget.CheckBox;
4 | import android.widget.CompoundButton;
5 |
6 | import com.code44.finance.R;
7 | import com.code44.finance.common.model.TransactionState;
8 | import com.code44.finance.ui.common.activities.BaseActivity;
9 | import com.code44.finance.ui.common.presenters.Presenter;
10 |
11 | public class TransactionStatePresenter extends Presenter {
12 | private final CheckBox confirmedCheckBox;
13 | private final CompoundButton.OnCheckedChangeListener onCheckedChangeListener;
14 |
15 | public TransactionStatePresenter(BaseActivity activity, CompoundButton.OnCheckedChangeListener checkedChangeListener) {
16 | confirmedCheckBox = findView(activity, R.id.confirmedCheckBox);
17 |
18 | onCheckedChangeListener = checkedChangeListener;
19 | confirmedCheckBox.setOnCheckedChangeListener(checkedChangeListener);
20 | }
21 |
22 | public void setTransactionState(TransactionState transactionState) {
23 | confirmedCheckBox.setOnCheckedChangeListener(null);
24 | confirmedCheckBox.setChecked(transactionState == TransactionState.Confirmed);
25 | confirmedCheckBox.setOnCheckedChangeListener(onCheckedChangeListener);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/requests/PostRequest.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api.requests;
2 |
3 | import com.code44.finance.api.GcmRegistration;
4 | import com.code44.finance.api.Request;
5 | import com.code44.finance.common.utils.Preconditions;
6 | import com.code44.finance.utils.EventBus;
7 | import com.google.api.client.json.GenericJson;
8 |
9 | public abstract class PostRequest extends Request {
10 | private final GcmRegistration gcmRegistration;
11 |
12 | public PostRequest(EventBus eventBus, GcmRegistration gcmRegistration) {
13 | super(eventBus);
14 |
15 | Preconditions.notNull(gcmRegistration, "GCM registration cannot be null.");
16 |
17 | this.gcmRegistration = gcmRegistration;
18 | }
19 |
20 | @Override protected Object performRequest() throws Exception {
21 | T body = createBody();
22 | body.set("deviceRegId", gcmRegistration.getRegistrationId());
23 | onAddPostData(body);
24 | if (!isPostDataEmpty(body)) {
25 | performRequest(body);
26 | }
27 | return null;
28 | }
29 |
30 | protected abstract T createBody();
31 |
32 | protected abstract void onAddPostData(T body);
33 |
34 | protected abstract boolean isPostDataEmpty(T body);
35 |
36 | protected abstract void performRequest(T body) throws Exception;
37 | }
38 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/data/model/SyncState.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.data.model;
2 |
3 | public enum SyncState {
4 | None(SyncState.VALUE_NONE),
5 | InProgress(SyncState.VALUE_IN_PROGRESS),
6 | Synced(SyncState.VALUE_SYNCED),
7 | LocalChanges(SyncState.VALUE_LOCAL_CHANGES);
8 |
9 | private static final int VALUE_NONE = 1;
10 | private static final int VALUE_IN_PROGRESS = 2;
11 | private static final int VALUE_SYNCED = 3;
12 | private static final int VALUE_LOCAL_CHANGES = 4;
13 |
14 | private final int value;
15 |
16 | private SyncState(int value) {
17 | this.value = value;
18 | }
19 |
20 | public static SyncState fromInt(int value) {
21 | switch (value) {
22 | case VALUE_NONE:
23 | return None;
24 |
25 | case VALUE_IN_PROGRESS:
26 | return InProgress;
27 |
28 | case VALUE_SYNCED:
29 | return Synced;
30 |
31 | case VALUE_LOCAL_CHANGES:
32 | return LocalChanges;
33 |
34 | default:
35 | throw new IllegalArgumentException("Value " + value + " is not supported.");
36 | }
37 | }
38 |
39 | public int asInt() {
40 | return value;
41 | }
42 |
43 | public String asString() {
44 | return String.valueOf(value);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/activity_categories_report.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
17 |
18 |
26 |
27 |
32 |
33 |
--------------------------------------------------------------------------------
/common/src/main/java/com/code44/finance/common/model/SymbolPosition.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.common.model;
2 |
3 | public enum SymbolPosition {
4 | CloseRight(SymbolPosition.VALUE_CLOSE_RIGHT),
5 | FarRight(SymbolPosition.VALUE_FAR_RIGHT),
6 | CloseLeft(SymbolPosition.VALUE_CLOSE_LEFT),
7 | FarLeft(SymbolPosition.VALUE_FAR_LEFT);
8 |
9 | private static final int VALUE_CLOSE_RIGHT = 1;
10 | private static final int VALUE_FAR_RIGHT = 2;
11 | private static final int VALUE_CLOSE_LEFT = 3;
12 | private static final int VALUE_FAR_LEFT = 4;
13 |
14 | private final int value;
15 |
16 | private SymbolPosition(int value) {
17 | this.value = value;
18 | }
19 |
20 | public static SymbolPosition fromInt(int value) {
21 | switch (value) {
22 | case VALUE_CLOSE_RIGHT:
23 | return CloseRight;
24 |
25 | case VALUE_FAR_RIGHT:
26 | return FarRight;
27 |
28 | case VALUE_CLOSE_LEFT:
29 | return CloseLeft;
30 |
31 | case VALUE_FAR_LEFT:
32 | return FarLeft;
33 |
34 | default:
35 | throw new IllegalArgumentException("Value " + value + " is not supported.");
36 | }
37 | }
38 |
39 | public int asInt() {
40 | return value;
41 | }
42 |
43 | public String asString() {
44 | return String.valueOf(value);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_currency.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
26 |
27 |
37 |
38 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/FilePickerActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 |
7 | import com.code44.finance.common.utils.Strings;
8 |
9 | import java.io.File;
10 |
11 | public class FilePickerActivity extends com.nononsenseapps.filepicker.FilePickerActivity {
12 | public static void startFile(Activity activity, int requestCode, String startPath) {
13 | final Intent intent = makeIntent(activity, false, MODE_FILE, startPath);
14 | activity.startActivityForResult(intent, requestCode);
15 | }
16 |
17 | public static void startDir(Activity activity, int requestCode, String startPath) {
18 | final Intent intent = makeIntent(activity, true, MODE_DIR, startPath);
19 | activity.startActivityForResult(intent, requestCode);
20 | }
21 |
22 | private static Intent makeIntent(Context context, boolean allowCreateDir, int mode, String startPath) {
23 | final Intent intent = new Intent(context, FilePickerActivity.class);
24 | intent.putExtra(EXTRA_ALLOW_CREATE_DIR, allowCreateDir);
25 | intent.putExtra(EXTRA_ALLOW_MULTIPLE, false);
26 | intent.putExtra(EXTRA_MODE, mode);
27 | if (!Strings.isEmpty(startPath) && new File(startPath).exists()) {
28 | intent.putExtra(EXTRA_START_PATH, startPath);
29 | }
30 | return intent;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/utils/TextBackgroundSpan.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.utils;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.Paint;
5 | import android.graphics.RectF;
6 | import android.text.style.ReplacementSpan;
7 |
8 | public class TextBackgroundSpan extends ReplacementSpan {
9 | private final Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
10 | private final RectF backgroundRect = new RectF();
11 | private final float radius;
12 | private int size;
13 |
14 | public TextBackgroundSpan(int color, float radius) {
15 | this.backgroundPaint.setColor(color);
16 | this.radius = radius;
17 | }
18 |
19 | @Override public int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fontMetricsInt) {
20 | size = Math.round(measureText(paint, text, start, end) + radius);
21 | return size;
22 | }
23 |
24 | @Override public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) {
25 | backgroundRect.set(x, top, x + size, bottom);
26 | canvas.drawRoundRect(backgroundRect, radius, radius, backgroundPaint);
27 | canvas.drawText(text, start, end, x + radius / 2, y, paint);
28 | }
29 |
30 | private float measureText(Paint paint, CharSequence text, int start, int end) {
31 | return paint.measureText(text, start, end);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/transactions/detail/TransactionActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.transactions.detail;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 |
7 | import com.code44.finance.R;
8 | import com.code44.finance.money.AmountFormatter;
9 | import com.code44.finance.ui.common.activities.BaseActivity;
10 | import com.code44.finance.ui.common.presenters.ActivityPresenter;
11 | import com.code44.finance.utils.analytics.Analytics;
12 |
13 | import javax.inject.Inject;
14 |
15 | public class TransactionActivity extends BaseActivity {
16 | @Inject AmountFormatter amountFormatter;
17 |
18 | public static void start(Context context, String transactionId) {
19 | final Intent intent = makeIntentForActivity(context, TransactionActivity.class);
20 | TransactionActivityPresenter.addExtras(intent, transactionId);
21 | startActivity(context, intent);
22 | }
23 |
24 | @Override protected void onCreateView(Bundle savedInstanceState) {
25 | super.onCreateView(savedInstanceState);
26 | setContentView(R.layout.activity_transaction);
27 | }
28 |
29 | @Override protected ActivityPresenter onCreateActivityPresenter() {
30 | return new TransactionActivityPresenter(getEventBus(), amountFormatter);
31 | }
32 |
33 | @Override protected Analytics.Screen getScreen() {
34 | return Analytics.Screen.Transaction;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/playservices/GoogleApiConnection.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.playservices;
2 |
3 | import com.code44.finance.utils.EventBus;
4 | import com.google.android.gms.common.api.GoogleApiClient;
5 | import com.squareup.otto.Produce;
6 |
7 | import java.util.HashMap;
8 | import java.util.Map;
9 |
10 | public class GoogleApiConnection {
11 | private final EventBus eventBus;
12 | private final Map googleApiClients = new HashMap<>();
13 |
14 | public GoogleApiConnection(EventBus eventBus) {
15 | this.eventBus = eventBus;
16 | eventBus.register(this);
17 | }
18 |
19 | @Produce public GoogleApiConnection produceGoogleApiConnection() {
20 | return googleApiClients.size() > 0 ? this : null;
21 | }
22 |
23 | public void put(String clientUniqueId, GoogleApiClient client) {
24 | if (client != null && (client.isConnected() || client.isConnecting())) {
25 | googleApiClients.put(clientUniqueId, client);
26 | eventBus.post(this);
27 | }
28 | }
29 |
30 | public void remove(String clientUniqueId) {
31 | googleApiClients.remove(clientUniqueId);
32 | }
33 |
34 | public GoogleApiClient get(String clientUniqueId) {
35 | return googleApiClients.get(clientUniqueId);
36 | }
37 |
38 | public boolean contains(String clientUniqueId) {
39 | return googleApiClients.containsKey(clientUniqueId);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/modules/AccountModule.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.modules;
2 |
3 | import android.content.Context;
4 |
5 | import com.code44.finance.api.GcmRegistration;
6 | import com.code44.finance.api.User;
7 | import com.code44.finance.data.db.DBHelper;
8 | import com.code44.finance.qualifiers.ApplicationContext;
9 | import com.code44.finance.services.StartupService;
10 | import com.code44.finance.ui.settings.security.Security;
11 | import com.code44.finance.utils.EventBus;
12 | import com.code44.finance.utils.preferences.GeneralPrefs;
13 |
14 | import javax.inject.Singleton;
15 |
16 | import dagger.Module;
17 | import dagger.Provides;
18 |
19 | @Module(
20 | library = true,
21 | complete = false,
22 | injects = {
23 | StartupService.class
24 | }
25 | )
26 | class AccountModule {
27 | @Provides @Singleton public User provideUser(@ApplicationContext Context context, DBHelper dbHelper, GcmRegistration gcmRegistration, Security security, EventBus eventBus) {
28 | return new User(context, dbHelper, gcmRegistration, security, eventBus);
29 | }
30 |
31 | @Provides @Singleton public GcmRegistration provideGcmRegistration(@ApplicationContext Context context) {
32 | return new GcmRegistration(context);
33 | }
34 |
35 | @Provides @Singleton public GeneralPrefs provideGeneralPrefs(@ApplicationContext Context context, EventBus eventBus) {
36 | return new GeneralPrefs(context, eventBus);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/utils/LayoutType.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.utils;
2 |
3 | import android.content.Context;
4 |
5 | import com.code44.finance.R;
6 |
7 | public final class LayoutType {
8 | private static final int DEFAULT = 0;
9 | private static final int DEFAULT_LAND = 1;
10 | private static final int SW600 = 2;
11 | private static final int SW600_LAND = 3;
12 | private static final int SW720 = 4;
13 | private static final int SW720_LAND = 5;
14 |
15 | private final Context context;
16 |
17 | public LayoutType(Context context) {
18 | this.context = context;
19 | }
20 |
21 | public boolean isDefault() {
22 | final int layoutType = getLayoutType();
23 | return layoutType == DEFAULT || layoutType == DEFAULT_LAND;
24 | }
25 |
26 | public boolean isSW600() {
27 | final int layoutType = getLayoutType();
28 | return layoutType == SW600 || layoutType == SW600_LAND;
29 | }
30 |
31 | public boolean isSW720() {
32 | final int layoutType = getLayoutType();
33 | return layoutType == SW720 || layoutType == SW720_LAND;
34 | }
35 |
36 | public boolean isPortrait() {
37 | final int layoutType = getLayoutType();
38 | return layoutType % 2 == 0;
39 | }
40 |
41 | public boolean isLandscape() {
42 | return !isPortrait();
43 | }
44 |
45 | private int getLayoutType() {
46 | return context.getResources().getInteger(R.integer.layout_type);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/transactions/edit/autocomplete/TransactionAutoComplete.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.transactions.edit.autocomplete;
2 |
3 | import android.os.Handler;
4 | import android.os.Looper;
5 |
6 | import java.util.concurrent.Executor;
7 |
8 | public abstract class TransactionAutoComplete implements Runnable {
9 | private final Executor executor;
10 | private final TransactionAutoCompleteListener listener;
11 | private final AutoCompleteInput autoCompleteInput;
12 |
13 | protected TransactionAutoComplete(Executor executor, TransactionAutoCompleteListener listener, AutoCompleteInput autoCompleteInput) {
14 | this.executor = executor;
15 | this.listener = listener;
16 | this.autoCompleteInput = autoCompleteInput;
17 | }
18 |
19 | @Override public void run() {
20 | final AutoCompleteResult result = autoComplete(autoCompleteInput);
21 |
22 | final Handler handler = new Handler(Looper.getMainLooper());
23 | handler.post(new Runnable() {
24 | @Override public void run() {
25 | listener.onTransactionAutoComplete(result);
26 | }
27 | });
28 | }
29 |
30 | public void execute() {
31 | executor.execute(this);
32 | }
33 |
34 | protected abstract AutoCompleteResult autoComplete(AutoCompleteInput input);
35 |
36 | public static interface TransactionAutoCompleteListener {
37 | public void onTransactionAutoComplete(AutoCompleteResult result);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/tags/list/TagsActivityPresenter.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.tags.list;
2 |
3 | import android.content.Context;
4 | import android.database.Cursor;
5 | import android.support.v4.content.CursorLoader;
6 | import android.view.View;
7 |
8 | import com.code44.finance.data.db.Tables;
9 | import com.code44.finance.data.model.Tag;
10 | import com.code44.finance.data.providers.TagsProvider;
11 | import com.code44.finance.ui.common.adapters.ModelsAdapter;
12 | import com.code44.finance.ui.common.presenters.ModelsActivityPresenter;
13 | import com.code44.finance.ui.tags.detail.TagActivity;
14 | import com.code44.finance.ui.tags.edit.TagEditActivity;
15 |
16 | class TagsActivityPresenter extends ModelsActivityPresenter {
17 | @Override protected ModelsAdapter createAdapter(ModelsAdapter.OnModelClickListener defaultOnModelClickListener) {
18 | return new TagsAdapter(defaultOnModelClickListener);
19 | }
20 |
21 | @Override protected CursorLoader getModelsCursorLoader(Context context) {
22 | return Tables.Tags.getQuery().sortOrder("lower(" + Tables.Tags.TITLE + ")").asCursorLoader(context, TagsProvider.uriTags());
23 | }
24 |
25 | @Override protected void onModelClick(Context context, View view, Tag model, Cursor cursor, int position) {
26 | TagActivity.start(context, model.getId());
27 | }
28 |
29 | @Override protected void startModelEdit(Context context, String modelId) {
30 | TagEditActivity.start(context, modelId);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/include_edit_buttons.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
25 |
26 |
35 |
36 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/data/providers/BaseProvider.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.data.providers;
2 |
3 | import android.content.ContentProvider;
4 | import android.content.UriMatcher;
5 | import android.database.sqlite.SQLiteDatabase;
6 |
7 | import com.code44.finance.App;
8 | import com.code44.finance.BuildConfig;
9 | import com.code44.finance.data.db.DBHelper;
10 |
11 | import javax.inject.Inject;
12 |
13 | public abstract class BaseProvider extends ContentProvider {
14 | protected static final String CONTENT_URI_BASE = "content://";
15 |
16 | protected static final String TYPE_LIST_BASE = "vnd.android.cursor.dir/vnd.code44.";
17 | protected static final String TYPE_ITEM_BASE = "vnd.android.cursor.item/vnd.code44.";
18 |
19 | protected final UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
20 | @Inject DBHelper dbHelper;
21 | private SQLiteDatabase database;
22 |
23 | protected static String getAuthority(Class extends BaseProvider> cls) {
24 | return BuildConfig.APPLICATION_ID + ".data.providers." + cls.getSimpleName();
25 | }
26 |
27 | @Override public boolean onCreate() {
28 | return true;
29 | }
30 |
31 | protected String getAuthority() {
32 | return getAuthority(getClass());
33 | }
34 |
35 | protected SQLiteDatabase getDatabase() {
36 | if (database == null) {
37 | App.with(getContext()).inject(this);
38 | database = dbHelper.getWritableDatabase();
39 | }
40 | return database;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/currencies/CurrenciesApi.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api.currencies;
2 |
3 | import android.content.Context;
4 |
5 | import com.code44.finance.api.Request;
6 | import com.code44.finance.common.utils.Preconditions;
7 | import com.code44.finance.utils.EventBus;
8 |
9 | import java.util.concurrent.ExecutorService;
10 |
11 | public class CurrenciesApi {
12 | private final ExecutorService executor;
13 | private final Context context;
14 | private final EventBus eventBus;
15 | private final CurrenciesRequestService requestService;
16 |
17 | public CurrenciesApi(ExecutorService executor, Context context, EventBus eventBus, CurrenciesRequestService requestService) {
18 | this.executor = Preconditions.notNull(executor, "Executor cannot be null.");
19 | this.context = Preconditions.notNull(context, "Context cannot be null.");
20 | this.eventBus = Preconditions.notNull(eventBus, "EventBus cannot be null.");
21 | this.requestService = Preconditions.notNull(requestService, "CurrenciesRequestService cannot be null.");
22 | }
23 |
24 | public void updateExchangeRates() {
25 | updateExchangeRates(null);
26 | }
27 |
28 | public void updateExchangeRates(String fromCode) {
29 | final UpdateExchangeRatesRequest request = new UpdateExchangeRatesRequest(eventBus, requestService, context, fromCode);
30 | executeRequest(request);
31 | }
32 |
33 | private void executeRequest(Request request) {
34 | executor.submit(request);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/NetworkExecutor.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api;
2 |
3 | import android.os.Process;
4 | import android.support.annotation.NonNull;
5 |
6 | import java.util.concurrent.LinkedBlockingQueue;
7 | import java.util.concurrent.ThreadFactory;
8 | import java.util.concurrent.ThreadPoolExecutor;
9 | import java.util.concurrent.TimeUnit;
10 |
11 | public class NetworkExecutor extends ThreadPoolExecutor {
12 | private static NetworkExecutor singleton;
13 |
14 | public NetworkExecutor(int maxThreads) {
15 | super(0, maxThreads, 30, TimeUnit.SECONDS, new LinkedBlockingQueue(), new NetworkThreadFactory());
16 | }
17 |
18 | public static synchronized NetworkExecutor get() {
19 | if (singleton == null) {
20 | final int numberCores = Runtime.getRuntime().availableProcessors();
21 | singleton = new NetworkExecutor(numberCores * 2 + 1);
22 | }
23 | return singleton;
24 | }
25 |
26 | private static class NetworkThreadFactory implements ThreadFactory {
27 | @Override public Thread newThread(@NonNull Runnable runnable) {
28 | return new NetworkThread(runnable);
29 | }
30 | }
31 |
32 | private static class NetworkThread extends Thread {
33 | private NetworkThread(Runnable runnable) {
34 | super(runnable);
35 | }
36 |
37 | @Override public void run() {
38 | Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
39 | super.run();
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/accounts/edit/AccountEditActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.accounts.edit;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 |
7 | import com.code44.finance.R;
8 | import com.code44.finance.money.AmountFormatter;
9 | import com.code44.finance.money.CurrenciesManager;
10 | import com.code44.finance.ui.common.activities.BaseActivity;
11 | import com.code44.finance.ui.common.presenters.ActivityPresenter;
12 | import com.code44.finance.utils.analytics.Analytics;
13 |
14 | import javax.inject.Inject;
15 |
16 | public class AccountEditActivity extends BaseActivity {
17 | @Inject CurrenciesManager currenciesManager;
18 | @Inject AmountFormatter amountFormatter;
19 |
20 | public static void start(Context context, String accountId) {
21 | final Intent intent = makeIntentForActivity(context, AccountEditActivity.class);
22 | AccountEditActivityPresenter.addExtras(intent, accountId);
23 | startActivity(context, intent);
24 | }
25 |
26 | @Override protected void onCreateView(Bundle savedInstanceState) {
27 | super.onCreateView(savedInstanceState);
28 | setContentView(R.layout.activity_account_edit);
29 | }
30 |
31 | @Override protected ActivityPresenter onCreateActivityPresenter() {
32 | return new AccountEditActivityPresenter(getEventBus(), currenciesManager, amountFormatter);
33 | }
34 |
35 | @Override protected Analytics.Screen getScreen() {
36 | return Analytics.Screen.AccountEdit;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_account.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
23 |
24 |
31 |
32 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/requests/GetTagsRequest.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api.requests;
2 |
3 | import android.content.Context;
4 | import android.net.Uri;
5 |
6 | import com.code44.finance.api.User;
7 | import com.code44.finance.backend.endpoint.tags.Tags;
8 | import com.code44.finance.backend.endpoint.tags.model.TagEntity;
9 | import com.code44.finance.common.utils.Preconditions;
10 | import com.code44.finance.data.model.Model;
11 | import com.code44.finance.data.providers.TagsProvider;
12 |
13 | import java.util.List;
14 |
15 | public class GetTagsRequest extends GetRequest {
16 | private final Tags tagsService;
17 |
18 | public GetTagsRequest(Context context, User user, Tags tagsService) {
19 | super(null, context, user);
20 | Preconditions.notNull(tagsService, "Tags service cannot be null.");
21 |
22 | this.tagsService = tagsService;
23 | }
24 |
25 | @Override protected long getLastTimestamp(User user) {
26 | return user.getCategoriesTimestamp();
27 | }
28 |
29 | @Override protected List performRequest(long timestamp) throws Exception {
30 | return tagsService.list(timestamp).execute().getItems();
31 | }
32 |
33 | @Override protected Model getModelFrom(TagEntity entity) {
34 | return null;
35 | }
36 |
37 | @Override protected void saveNewTimestamp(User user, long newTimestamp) {
38 | user.setTagsTimestamp(newTimestamp);
39 | }
40 |
41 | @Override protected Uri getSaveUri() {
42 | return TagsProvider.uriTags();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/Request.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api;
2 |
3 | import com.code44.finance.utils.EventBus;
4 | import com.code44.finance.utils.Logger;
5 | import com.crashlytics.android.Crashlytics;
6 |
7 | import java.util.concurrent.Callable;
8 |
9 | public abstract class Request implements Callable> {
10 | protected final EventBus eventBus;
11 | private final Logger logger = Logger.with(Request.class.getSimpleName());
12 | private Result result;
13 |
14 | /**
15 | * @param eventBus If {@code null}, then event will not be posted.
16 | */
17 | protected Request(EventBus eventBus) {
18 | this.eventBus = eventBus;
19 | }
20 |
21 | @Override public Result call() throws Exception {
22 | try {
23 | final T data = performRequest();
24 | result = new Result<>(data, null);
25 | } catch (Exception error) {
26 | Crashlytics.logException(error);
27 | logger.error("Request failed.", error);
28 | result = new Result<>(null, error);
29 | }
30 |
31 | if (eventBus != null) {
32 | eventBus.post(this);
33 | }
34 |
35 | return result;
36 | }
37 |
38 | public Result getResult() {
39 | return result;
40 | }
41 |
42 | public boolean isFinished() {
43 | return result != null;
44 | }
45 |
46 | public boolean isSuccess() {
47 | return isFinished() && result.isSuccess();
48 | }
49 |
50 | protected abstract T performRequest() throws Exception;
51 | }
52 |
--------------------------------------------------------------------------------
/backend/build.gradle:
--------------------------------------------------------------------------------
1 | // Currently, the appengine gradle plugin's appengine devappserver launch doesn't interact well with Intellij/AndroidStudio's
2 | // Gradle integration. As a temporary solution, please launch from the command line.
3 | // ./gradlew modulename:appengineRun
4 | // If you would like more information on the gradle-appengine-plugin please refer to the github page
5 | // https://github.com/GoogleCloudPlatform/gradle-appengine-plugin
6 |
7 | buildscript {
8 | repositories {
9 | mavenLocal()
10 | mavenCentral()
11 | }
12 | dependencies {
13 | classpath 'com.google.appengine:gradle-appengine-plugin:1.9.17'
14 | }
15 | }
16 |
17 | repositories {
18 | mavenCentral();
19 | }
20 |
21 | apply plugin: 'java'
22 | apply plugin: 'war'
23 | apply plugin: 'appengine'
24 |
25 | sourceCompatibility = 1.7
26 | targetCompatibility = 1.7
27 |
28 | dependencies {
29 | appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.17'
30 | compile project(path: ':common')
31 | compile 'com.google.appengine:appengine-endpoints:1.9.17'
32 | compile 'com.google.appengine:appengine-endpoints-deps:1.9.17'
33 | compile 'javax.servlet:servlet-api:2.5'
34 | compile 'com.googlecode.objectify:objectify:5.0+'
35 | compile 'com.ganyo:gcm-server:1.0.2'
36 | compile 'com.google.code.gson:gson:2.+'
37 | compile project(':common')
38 | }
39 |
40 | appengine {
41 | httpAddress = '0.0.0.0'
42 | downloadSdk = true
43 | appcfg {
44 | oauth2 = true
45 | }
46 | endpoints {
47 | getClientLibsOnBuild = true
48 | getDiscoveryDocsOnBuild = true
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/li_category_report_tag.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
18 |
19 |
30 |
31 |
41 |
42 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/tags/detail/TagActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.tags.detail;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 |
7 | import com.code44.finance.R;
8 | import com.code44.finance.money.AmountFormatter;
9 | import com.code44.finance.money.CurrenciesManager;
10 | import com.code44.finance.ui.common.activities.BaseActivity;
11 | import com.code44.finance.ui.common.presenters.ActivityPresenter;
12 | import com.code44.finance.utils.analytics.Analytics;
13 | import com.code44.finance.utils.interval.CurrentInterval;
14 |
15 | import javax.inject.Inject;
16 |
17 | public class TagActivity extends BaseActivity {
18 | @Inject CurrentInterval currentInterval;
19 | @Inject CurrenciesManager currenciesManager;
20 | @Inject AmountFormatter amountFormatter;
21 |
22 | public static void start(Context context, String tagId) {
23 | final Intent intent = makeIntentForActivity(context, TagActivity.class);
24 | TagActivityPresenter.addExtras(intent, tagId);
25 | startActivity(context, intent);
26 | }
27 |
28 | @Override protected void onCreateView(Bundle savedInstanceState) {
29 | super.onCreateView(savedInstanceState);
30 | setContentView(R.layout.activity_tag);
31 | }
32 |
33 | @Override protected Analytics.Screen getScreen() {
34 | return Analytics.Screen.Tag;
35 | }
36 |
37 | @Override protected ActivityPresenter onCreateActivityPresenter() {
38 | return new TagActivityPresenter(getEventBus(), currentInterval, currenciesManager, amountFormatter);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/transactions/edit/presenters/DateTimePresenter.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.transactions.edit.presenters;
2 |
3 | import android.view.View;
4 | import android.widget.Button;
5 |
6 | import com.code44.finance.R;
7 | import com.code44.finance.ui.common.activities.BaseActivity;
8 | import com.code44.finance.ui.common.presenters.Presenter;
9 |
10 | import net.danlew.android.joda.DateUtils;
11 |
12 | import org.joda.time.DateTime;
13 |
14 | public class DateTimePresenter extends Presenter {
15 | private final Button dateButton;
16 | private final Button timeButton;
17 |
18 | public DateTimePresenter(BaseActivity activity, View.OnClickListener clickListener, View.OnLongClickListener longClickListener) {
19 | dateButton = findView(activity, R.id.dateButton);
20 | timeButton = findView(activity, R.id.timeButton);
21 |
22 | dateButton.setOnClickListener(clickListener);
23 | dateButton.setOnLongClickListener(longClickListener);
24 | timeButton.setOnClickListener(clickListener);
25 | timeButton.setOnLongClickListener(longClickListener);
26 | }
27 |
28 | public void setDateTime(long date) {
29 | final DateTime dateTime = new DateTime(date);
30 | dateButton.setText(DateUtils.formatDateTime(dateButton.getContext(), dateTime, DateUtils.FORMAT_SHOW_DATE));
31 | timeButton.setText(DateUtils.formatDateTime(timeButton.getContext(), dateTime, DateUtils.FORMAT_SHOW_TIME));
32 | }
33 |
34 | public void isSetByUser(boolean isSetByUser) {
35 | // dateTimeImageView.setImageAlpha(isSetByUser ? 255 : 64);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/tags/list/TagsActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.tags.list;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 |
8 | import com.code44.finance.R;
9 | import com.code44.finance.data.model.Tag;
10 | import com.code44.finance.ui.common.activities.BaseActivity;
11 | import com.code44.finance.ui.common.presenters.ActivityPresenter;
12 | import com.code44.finance.utils.analytics.Analytics;
13 |
14 | import java.util.List;
15 |
16 | public class TagsActivity extends BaseActivity {
17 | public static void start(Context context) {
18 | final Intent intent = makeIntentForActivity(context, TagsActivity.class);
19 | TagsActivityPresenter.addViewExtras(intent);
20 | startActivity(context, intent);
21 | }
22 |
23 | public static void startMultiSelect(Activity activity, int requestCode, List selectedTags) {
24 | final Intent intent = makeIntentForActivity(activity, TagsActivity.class);
25 | TagsActivityPresenter.addMultiSelectExtras(intent, selectedTags);
26 | startActivityForResult(activity, intent, requestCode);
27 | }
28 |
29 | @Override protected void onCreateView(Bundle savedInstanceState) {
30 | super.onCreateView(savedInstanceState);
31 | setContentView(R.layout.activity_tags);
32 | }
33 |
34 | @Override protected ActivityPresenter onCreateActivityPresenter() {
35 | return new TagsActivityPresenter();
36 | }
37 |
38 | @Override protected Analytics.Screen getScreen() {
39 | return Analytics.Screen.TagList;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/App.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 |
6 | import net.danlew.android.joda.JodaTimeAndroid;
7 |
8 | import dagger.ObjectGraph;
9 | import hugo.weaving.DebugLog;
10 | import uk.co.chrisjenx.calligraphy.CalligraphyConfig;
11 |
12 | public class App extends Application {
13 | private ObjectGraph objectGraph;
14 |
15 | public static App with(Context context) {
16 | return (App) context.getApplicationContext();
17 | }
18 |
19 | @Override public void onCreate() {
20 | super.onCreate();
21 | // StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
22 | // .detectAll()
23 | // .penaltyLog()
24 | // .penaltyDialog()
25 | // .build());
26 | // StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
27 | // .detectAll()
28 | // .penaltyDeath()
29 | // .penaltyLog()
30 | // .build());
31 | CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
32 | // .setDefaultFontPath("fonts/Roboto-Regular.ttf")
33 | .setFontAttrId(R.attr.fontPath)
34 | .build()
35 | );
36 | buildObjectGraphAndInject();
37 | JodaTimeAndroid.init(this);
38 | }
39 |
40 | @DebugLog public void buildObjectGraphAndInject() {
41 | objectGraph = ObjectGraph.create(Modules.list(this));
42 | objectGraph.inject(this);
43 | }
44 |
45 | public void inject(Object o) {
46 | objectGraph.inject(o);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/accounts/detail/AccountActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.accounts.detail;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 |
7 | import com.code44.finance.R;
8 | import com.code44.finance.money.AmountFormatter;
9 | import com.code44.finance.money.CurrenciesManager;
10 | import com.code44.finance.ui.common.activities.BaseActivity;
11 | import com.code44.finance.ui.common.presenters.ActivityPresenter;
12 | import com.code44.finance.utils.analytics.Analytics;
13 | import com.code44.finance.utils.interval.CurrentInterval;
14 |
15 | import javax.inject.Inject;
16 |
17 | public class AccountActivity extends BaseActivity {
18 | @Inject CurrentInterval currentInterval;
19 | @Inject CurrenciesManager currenciesManager;
20 | @Inject AmountFormatter amountFormatter;
21 |
22 | public static void start(Context context, String accountId) {
23 | final Intent intent = makeIntentForActivity(context, AccountActivity.class);
24 | AccountActivityPresenter.addExtras(intent, accountId);
25 | startActivity(context, intent);
26 | }
27 |
28 | @Override protected void onCreateView(Bundle savedInstanceState) {
29 | super.onCreateView(savedInstanceState);
30 | setContentView(R.layout.activity_account);
31 | }
32 |
33 | @Override protected ActivityPresenter onCreateActivityPresenter() {
34 | return new AccountActivityPresenter(getEventBus(), currentInterval, currenciesManager, amountFormatter);
35 | }
36 |
37 | @Override protected Analytics.Screen getScreen() {
38 | return Analytics.Screen.Account;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/currencies/detail/CurrencyActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.currencies.detail;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 |
7 | import com.code44.finance.R;
8 | import com.code44.finance.api.currencies.CurrenciesApi;
9 | import com.code44.finance.money.AmountFormatter;
10 | import com.code44.finance.money.CurrenciesManager;
11 | import com.code44.finance.ui.common.activities.BaseActivity;
12 | import com.code44.finance.ui.common.presenters.ActivityPresenter;
13 | import com.code44.finance.utils.analytics.Analytics;
14 |
15 | import javax.inject.Inject;
16 |
17 | public class CurrencyActivity extends BaseActivity {
18 | @Inject CurrenciesApi currenciesApi;
19 | @Inject CurrenciesManager currenciesManager;
20 | @Inject AmountFormatter amountFormatter;
21 |
22 | public static void start(Context context, String currencyId) {
23 | final Intent intent = makeIntentForActivity(context, CurrencyActivity.class);
24 | CurrencyActivityPresenter.addExtras(intent, currencyId);
25 | startActivity(context, intent);
26 | }
27 |
28 | @Override protected void onCreateView(Bundle savedInstanceState) {
29 | super.onCreateView(savedInstanceState);
30 | setContentView(R.layout.activity_currency);
31 | }
32 |
33 | @Override protected ActivityPresenter onCreateActivityPresenter() {
34 | return new CurrencyActivityPresenter(getEventBus(), currenciesApi, currenciesManager, amountFormatter);
35 | }
36 |
37 | @Override protected Analytics.Screen getScreen() {
38 | return Analytics.Screen.Currency;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/categories/detail/CategoryActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.categories.detail;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 |
7 | import com.code44.finance.R;
8 | import com.code44.finance.money.AmountFormatter;
9 | import com.code44.finance.money.CurrenciesManager;
10 | import com.code44.finance.ui.common.activities.BaseActivity;
11 | import com.code44.finance.ui.common.presenters.ActivityPresenter;
12 | import com.code44.finance.utils.analytics.Analytics;
13 | import com.code44.finance.utils.interval.CurrentInterval;
14 |
15 | import javax.inject.Inject;
16 |
17 | public class CategoryActivity extends BaseActivity {
18 | @Inject CurrentInterval currentInterval;
19 | @Inject CurrenciesManager currenciesManager;
20 | @Inject AmountFormatter amountFormatter;
21 |
22 | public static void start(Context context, String categoryId) {
23 | final Intent intent = makeIntentForActivity(context, CategoryActivity.class);
24 | CategoryActivityPresenter.addExtras(intent, categoryId);
25 | startActivity(context, intent);
26 | }
27 |
28 | @Override protected void onCreateView(Bundle savedInstanceState) {
29 | super.onCreateView(savedInstanceState);
30 | setContentView(R.layout.activity_category);
31 | }
32 |
33 | @Override protected Analytics.Screen getScreen() {
34 | return Analytics.Screen.Category;
35 | }
36 |
37 | @Override protected ActivityPresenter onCreateActivityPresenter() {
38 | return new CategoryActivityPresenter(getEventBus(), currentInterval, currenciesManager, amountFormatter);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/modules/CurrenciesApiModule.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.modules;
2 |
3 | import android.content.Context;
4 |
5 | import com.code44.finance.BuildConfig;
6 | import com.code44.finance.api.currencies.CurrenciesApi;
7 | import com.code44.finance.api.currencies.CurrenciesRequestService;
8 | import com.code44.finance.qualifiers.ApplicationContext;
9 | import com.code44.finance.qualifiers.Network;
10 | import com.code44.finance.services.StartupService;
11 | import com.code44.finance.utils.EventBus;
12 |
13 | import java.util.concurrent.ExecutorService;
14 |
15 | import javax.inject.Singleton;
16 |
17 | import dagger.Module;
18 | import dagger.Provides;
19 | import retrofit.RestAdapter;
20 |
21 | @Module(
22 | complete = false,
23 | library = true,
24 | injects = {
25 | StartupService.class
26 | }
27 | )
28 | public class CurrenciesApiModule {
29 | @Provides @Singleton public CurrenciesApi provideCurrenciesApi(@Network ExecutorService executor, @ApplicationContext Context context, EventBus eventBus, CurrenciesRequestService currenciesRequestService) {
30 | return new CurrenciesApi(executor, context, eventBus, currenciesRequestService);
31 | }
32 |
33 | @Provides @Singleton public CurrenciesRequestService provideCurrenciesRequestService() {
34 | final String endpoint = "http://query.yahooapis.com";
35 | final RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(endpoint).build();
36 | restAdapter.setLogLevel(BuildConfig.DEBUG ? RestAdapter.LogLevel.FULL : RestAdapter.LogLevel.NONE);
37 | return restAdapter.create(CurrenciesRequestService.class);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/requests/PostTagsRequest.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api.requests;
2 |
3 | import com.code44.finance.api.GcmRegistration;
4 | import com.code44.finance.backend.endpoint.tags.Tags;
5 | import com.code44.finance.backend.endpoint.tags.model.TagEntity;
6 | import com.code44.finance.backend.endpoint.tags.model.TagsBody;
7 | import com.code44.finance.common.utils.Preconditions;
8 | import com.code44.finance.data.model.Tag;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class PostTagsRequest extends PostRequest {
14 | private final Tags tagsService;
15 | private final List tags;
16 |
17 | public PostTagsRequest(GcmRegistration gcmRegistration, Tags tagsService, List tags) {
18 | super(null, gcmRegistration);
19 | Preconditions.notNull(tagsService, "Tags service cannot be null.");
20 | Preconditions.notNull(tags, "Tags list cannot be null.");
21 |
22 | this.tagsService = tagsService;
23 | this.tags = tags;
24 | }
25 |
26 | @Override protected TagsBody createBody() {
27 | return new TagsBody();
28 | }
29 |
30 | @Override protected void onAddPostData(TagsBody body) {
31 | final List entities = new ArrayList<>();
32 | for (Tag tag : tags) {
33 | // entities.add(tag.asEntity());
34 | }
35 | body.setTags(entities);
36 | }
37 |
38 | @Override protected boolean isPostDataEmpty(TagsBody body) {
39 | return body.getTags().isEmpty();
40 | }
41 |
42 | @Override protected void performRequest(TagsBody body) throws Exception {
43 | tagsService.save(body);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/requests/GetCategoriesRequest.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api.requests;
2 |
3 | import android.content.Context;
4 | import android.net.Uri;
5 |
6 | import com.code44.finance.api.User;
7 | import com.code44.finance.backend.endpoint.categories.Categories;
8 | import com.code44.finance.backend.endpoint.categories.model.CategoryEntity;
9 | import com.code44.finance.common.utils.Preconditions;
10 | import com.code44.finance.data.model.Model;
11 | import com.code44.finance.data.providers.CategoriesProvider;
12 |
13 | import java.util.List;
14 |
15 | public class GetCategoriesRequest extends GetRequest {
16 | private final Categories categoriesService;
17 |
18 | public GetCategoriesRequest(Context context, User user, Categories categoriesService) {
19 | super(null, context, user);
20 | Preconditions.notNull(categoriesService, "Categories cannot be null.");
21 |
22 | this.categoriesService = categoriesService;
23 | }
24 |
25 | @Override protected long getLastTimestamp(User user) {
26 | return user.getCategoriesTimestamp();
27 | }
28 |
29 | @Override protected List performRequest(long timestamp) throws Exception {
30 | return categoriesService.list(timestamp).execute().getItems();
31 | }
32 |
33 | @Override protected Model getModelFrom(CategoryEntity entity) {
34 | return null;
35 | }
36 |
37 | @Override protected void saveNewTimestamp(User user, long newTimestamp) {
38 | user.setCategoriesTimestamp(newTimestamp);
39 | }
40 |
41 | @Override protected Uri getSaveUri() {
42 | return CategoriesProvider.uriCategories();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/categories/list/CategoriesActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.categories.list;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 |
8 | import com.code44.finance.R;
9 | import com.code44.finance.common.model.TransactionType;
10 | import com.code44.finance.ui.common.activities.BaseActivity;
11 | import com.code44.finance.ui.common.presenters.ActivityPresenter;
12 | import com.code44.finance.utils.analytics.Analytics;
13 |
14 | public class CategoriesActivity extends BaseActivity {
15 | public static void start(Context context) {
16 | final Intent intent = makeIntentForActivity(context, CategoriesActivity.class);
17 | CategoriesActivityPresenter.addViewExtras(intent);
18 | startActivity(context, intent);
19 | }
20 |
21 | public static void startSelect(Activity activity, int requestCode, TransactionType transactionType) {
22 | final Intent intent = makeIntentForActivity(activity, CategoriesActivity.class);
23 | CategoriesActivityPresenter.addSelectExtras(intent);
24 | CategoriesActivityPresenter.addExtras(intent, transactionType);
25 | startActivityForResult(activity, intent, requestCode);
26 | }
27 |
28 | @Override protected void onCreateView(Bundle savedInstanceState) {
29 | super.onCreateView(savedInstanceState);
30 | setContentView(R.layout.activity_categories);
31 | }
32 |
33 | @Override protected ActivityPresenter onCreateActivityPresenter() {
34 | return new CategoriesActivityPresenter();
35 | }
36 |
37 | @Override protected Analytics.Screen getScreen() {
38 | return Analytics.Screen.CategoryList;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/view_overview_graph.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
15 |
16 |
20 |
21 |
27 |
28 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/view_accounts.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
19 |
20 |
25 |
26 |
33 |
34 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout-land/activity_categories_report.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
17 |
18 |
21 |
22 |
30 |
31 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/graphs/pie/PieChartData.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.graphs.pie;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collections;
5 | import java.util.List;
6 |
7 | public final class PieChartData {
8 | private final List values;
9 | private final long totalValue;
10 |
11 | private PieChartData(List values) {
12 | this.values = values;
13 |
14 | long total = 0;
15 | for (PieChartValue value : values) {
16 | total += value.getValue();
17 | }
18 | this.totalValue = total;
19 | }
20 |
21 | public static Builder builder() {
22 | return new Builder();
23 | }
24 |
25 | public List getValues() {
26 | return values;
27 | }
28 |
29 | public long getTotalValue() {
30 | return totalValue;
31 | }
32 |
33 | public static class Builder {
34 | private List values;
35 |
36 | public Builder() {
37 | }
38 |
39 | public Builder setValues(List values) {
40 | this.values = values;
41 | return this;
42 | }
43 |
44 | public Builder addValues(PieChartValue value) {
45 | if (values == null) {
46 | values = new ArrayList<>();
47 | }
48 |
49 | values.add(value);
50 | return this;
51 | }
52 |
53 | public PieChartData build() {
54 | ensureSaneDefaults();
55 | return new PieChartData(values);
56 | }
57 |
58 | private void ensureSaneDefaults() {
59 | if (values == null) {
60 | values = Collections.emptyList();
61 | }
62 | }
63 |
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/view_active_interval.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
32 |
33 |
42 |
43 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/transactions/edit/TransactionEditActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.transactions.edit;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 |
7 | import com.code44.finance.R;
8 | import com.code44.finance.money.AmountFormatter;
9 | import com.code44.finance.money.CurrenciesManager;
10 | import com.code44.finance.qualifiers.Local;
11 | import com.code44.finance.ui.common.activities.BaseActivity;
12 | import com.code44.finance.ui.common.presenters.ActivityPresenter;
13 | import com.code44.finance.utils.analytics.Analytics;
14 |
15 | import java.util.concurrent.ExecutorService;
16 |
17 | import javax.inject.Inject;
18 |
19 | public class TransactionEditActivity extends BaseActivity {
20 | @Inject CurrenciesManager currenciesManager;
21 | @Inject AmountFormatter amountFormatter;
22 | @Inject @Local ExecutorService localExecutor;
23 |
24 | public static void start(Context context, String transactionId) {
25 | final Intent intent = makeIntentForActivity(context, TransactionEditActivity.class);
26 | TransactionEditActivityPresenter.addExtras(intent, transactionId);
27 | startActivity(context, intent);
28 | }
29 |
30 | @Override protected void onCreateView(Bundle savedInstanceState) {
31 | super.onCreateView(savedInstanceState);
32 | setContentView(R.layout.activity_transaction_edit);
33 | }
34 |
35 | @Override protected ActivityPresenter onCreateActivityPresenter() {
36 | return new TransactionEditActivityPresenter(getEventBus(), localExecutor, currenciesManager, amountFormatter);
37 | }
38 |
39 | @Override protected Analytics.Screen getScreen() {
40 | return Analytics.Screen.TransactionEdit;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/data/model/BaseModel.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.data.model;
2 |
3 | import android.content.ContentValues;
4 | import android.database.Cursor;
5 | import android.os.Parcel;
6 | import android.os.Parcelable;
7 |
8 | import com.code44.finance.data.db.Column;
9 |
10 | public abstract class BaseModel implements Parcelable {
11 | private long localId;
12 |
13 | protected BaseModel() {
14 | }
15 |
16 | protected BaseModel(Parcel parcel) {
17 | localId = parcel.readLong();
18 | }
19 |
20 | @Override public int describeContents() {
21 | return 0;
22 | }
23 |
24 | @Override public void writeToParcel(Parcel dest, int flags) {
25 | dest.writeLong(localId);
26 | }
27 |
28 | public ContentValues asContentValues() {
29 | prepareForContentValues();
30 | validateForContentValues();
31 |
32 | final ContentValues values = new ContentValues();
33 |
34 | if (localId != 0) {
35 | values.put(getLocalIdColumn().getName(), localId);
36 | }
37 |
38 | return new ContentValues();
39 | }
40 |
41 | public void prepareForContentValues() {
42 | }
43 |
44 | public void validateForContentValues() {
45 | }
46 |
47 | public void updateFromCursor(Cursor cursor, String columnPrefixTable) {
48 | int index;
49 |
50 | // Local id
51 | index = cursor.getColumnIndex(getLocalIdColumn().getName(columnPrefixTable));
52 | if (index >= 0) {
53 | localId = cursor.getLong(index);
54 | }
55 | }
56 |
57 | public long getLocalId() {
58 | return localId;
59 | }
60 |
61 | public void setLocalId(long localId) {
62 | this.localId = localId;
63 | }
64 |
65 | protected abstract Column getLocalIdColumn();
66 | }
67 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/requests/PostAccountsRequest.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api.requests;
2 |
3 | import com.code44.finance.api.GcmRegistration;
4 | import com.code44.finance.backend.endpoint.accounts.Accounts;
5 | import com.code44.finance.backend.endpoint.accounts.model.AccountEntity;
6 | import com.code44.finance.backend.endpoint.accounts.model.AccountsBody;
7 | import com.code44.finance.common.utils.Preconditions;
8 | import com.code44.finance.data.model.Account;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class PostAccountsRequest extends PostRequest {
14 | private final Accounts accountsService;
15 | private final List accounts;
16 |
17 | public PostAccountsRequest(GcmRegistration gcmRegistration, Accounts accountsService, List accounts) {
18 | super(null, gcmRegistration);
19 | Preconditions.notNull(accountsService, "Accounts service cannot be null.");
20 | Preconditions.notNull(accounts, "Accounts list cannot be null.");
21 |
22 | this.accountsService = accountsService;
23 | this.accounts = accounts;
24 | }
25 |
26 | @Override protected AccountsBody createBody() {
27 | return new AccountsBody();
28 | }
29 |
30 | @Override protected void onAddPostData(AccountsBody body) {
31 | final List accountEntities = new ArrayList<>();
32 | for (Account account : accounts) {
33 | // accountEntities.add(account.asEntity());
34 | }
35 | body.setAccounts(accountEntities);
36 | }
37 |
38 | @Override protected boolean isPostDataEmpty(AccountsBody body) {
39 | return body.getAccounts().isEmpty();
40 | }
41 |
42 | @Override protected void performRequest(AccountsBody body) throws Exception {
43 | accountsService.save(body);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/transactions/edit/presenters/TransactionTypePresenter.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.transactions.edit.presenters;
2 |
3 | import android.view.View;
4 | import android.widget.ImageView;
5 |
6 | import com.code44.finance.R;
7 | import com.code44.finance.common.model.TransactionType;
8 | import com.code44.finance.ui.common.activities.BaseActivity;
9 | import com.code44.finance.ui.common.presenters.Presenter;
10 | import com.code44.finance.utils.ThemeUtils;
11 |
12 | public class TransactionTypePresenter extends Presenter {
13 | private final ImageView transactionTypeImageView;
14 |
15 | public TransactionTypePresenter(BaseActivity activity, View.OnClickListener clickListener) {
16 | final View transactionTypeContainerView = findView(activity, R.id.transactionTypeContainerView);
17 | transactionTypeImageView = findView(activity, R.id.transactionTypeImageView);
18 |
19 | transactionTypeContainerView.setOnClickListener(clickListener);
20 | }
21 |
22 | public void setTransactionType(TransactionType transactionType) {
23 | final int color;
24 | switch (transactionType) {
25 | case Expense:
26 | color = ThemeUtils.getColor(transactionTypeImageView.getContext(), R.attr.textColorNegative);
27 | break;
28 | case Income:
29 | color = ThemeUtils.getColor(transactionTypeImageView.getContext(), R.attr.textColorPositive);
30 | break;
31 | case Transfer:
32 | color = ThemeUtils.getColor(transactionTypeImageView.getContext(), R.attr.textColorNeutral);
33 | break;
34 | default:
35 | throw new IllegalArgumentException("Transaction type " + transactionType + " is not supported.");
36 | }
37 | transactionTypeImageView.setColorFilter(color);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/dialog_fragment_alert.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
18 |
19 |
26 |
27 |
31 |
32 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/utils/analytics/Analytics.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.utils.analytics;
2 |
3 | import com.google.android.gms.analytics.HitBuilders;
4 | import com.google.android.gms.analytics.Tracker;
5 |
6 | public class Analytics {
7 | private final Tracker tracker;
8 |
9 | public Analytics(Tracker tracker) {
10 | this.tracker = tracker;
11 | }
12 |
13 | public void setUserId(String userId) {
14 | tracker.set("&uid", userId);
15 | }
16 |
17 | public void trackScreen(Screen screen) {
18 | tracker.setScreenName(screen.getName());
19 | tracker.send(new HitBuilders.ScreenViewBuilder().build());
20 | }
21 |
22 | public void clearScreen() {
23 | tracker.setScreenName(Screen.None.getName());
24 | }
25 |
26 | public static enum Screen {
27 | None(null),
28 | Overview("Overview"),
29 | AccountList("Account list"),
30 | Account("Account"),
31 | AccountEdit("Account edit"),
32 | TransactionList("Transaction list"),
33 | Transaction("Transaction"),
34 | TransactionEdit("Transaction edit"),
35 | CategoriesReport("Categories report"),
36 | Settings("Settings"),
37 | About("About"),
38 | YourData("Your data"),
39 | Export("Export"),
40 | Import("Import"),
41 | CurrencyList("Currency list"),
42 | Currency("Currency"),
43 | CurrencyEdit("Currency edit"),
44 | CategoryList("Category list"),
45 | Category("Category"),
46 | CategoryEdit("Category edit"),
47 | TagList("Tag list"),
48 | Tag("Tag"),
49 | TagEdit("Tag edit");
50 |
51 | private final String name;
52 |
53 | private Screen(String name) {
54 | this.name = name;
55 | }
56 |
57 | public String getName() {
58 | return name;
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/modules/providers/AnalyticsProviderModule.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.modules.providers;
2 |
3 | import android.content.Context;
4 |
5 | import com.code44.finance.BuildConfig;
6 | import com.code44.finance.qualifiers.AppTracker;
7 | import com.code44.finance.qualifiers.ApplicationContext;
8 | import com.code44.finance.utils.analytics.Analytics;
9 | import com.code44.finance.utils.preferences.GeneralPrefs;
10 | import com.google.android.gms.analytics.GoogleAnalytics;
11 | import com.google.android.gms.analytics.Tracker;
12 |
13 | import javax.inject.Singleton;
14 |
15 | import dagger.Module;
16 | import dagger.Provides;
17 |
18 | @Module(
19 | library = true,
20 | complete = false
21 | )
22 | public class AnalyticsProviderModule {
23 | private static final String APP_TRACKER_ID = "UA-38249360-1";
24 | private static final long SESSION_TIMEOUT = 3 * 60; // 3 minutes
25 |
26 | @Provides @Singleton public Analytics provideAnalytics(@AppTracker Tracker tracker) {
27 | return new Analytics(tracker);
28 | }
29 |
30 | @Provides public GoogleAnalytics provideGoogleAnalytics(@ApplicationContext Context context, GeneralPrefs generalPrefs) {
31 | final GoogleAnalytics googleAnalytics = GoogleAnalytics.getInstance(context);
32 | googleAnalytics.setDryRun(BuildConfig.DEBUG);
33 | googleAnalytics.setAppOptOut(generalPrefs.isAnalyticsOptOut());
34 | return googleAnalytics;
35 | }
36 |
37 | @Provides @Singleton @AppTracker public Tracker provideAppTracker(GoogleAnalytics googleAnalytics) {
38 | final Tracker tracker = googleAnalytics.newTracker(APP_TRACKER_ID);
39 | tracker.enableAdvertisingIdCollection(true);
40 | tracker.enableExceptionReporting(true);
41 | tracker.enableAutoActivityTracking(false);
42 | tracker.setSessionTimeout(SESSION_TIMEOUT);
43 | return tracker;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/requests/GetCurrenciesRequest.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api.requests;
2 |
3 | import android.content.ContentValues;
4 | import android.content.Context;
5 | import android.net.Uri;
6 |
7 | import com.code44.finance.api.User;
8 | import com.code44.finance.backend.endpoint.currencies.Currencies;
9 | import com.code44.finance.backend.endpoint.currencies.model.CurrencyEntity;
10 | import com.code44.finance.common.utils.Preconditions;
11 | import com.code44.finance.data.model.Model;
12 | import com.code44.finance.data.providers.CurrenciesProvider;
13 |
14 | import java.util.List;
15 |
16 | public class GetCurrenciesRequest extends GetRequest {
17 | private final Currencies currenciesService;
18 |
19 | public GetCurrenciesRequest(Context context, User user, Currencies currenciesService) {
20 | super(null, context, user);
21 | Preconditions.notNull(currenciesService, "Currencies cannot be null.");
22 |
23 | this.currenciesService = currenciesService;
24 | }
25 |
26 | @Override protected long getLastTimestamp(User user) {
27 | return user.getCurrenciesTimestamp();
28 | }
29 |
30 | @Override protected List performRequest(long timestamp) throws Exception {
31 | return currenciesService.list(timestamp).execute().getItems();
32 | }
33 |
34 | @Override protected Model getModelFrom(CurrencyEntity entity) {
35 | return null;
36 | }
37 |
38 | @Override protected void saveNewTimestamp(User user, long newTimestamp) {
39 | user.setCurrenciesTimestamp(newTimestamp);
40 | }
41 |
42 | @Override protected Uri getSaveUri() {
43 | return CurrenciesProvider.uriCurrencies();
44 | }
45 |
46 | @Override protected void onValuesCreated(ContentValues values) {
47 | super.onValuesCreated(values);
48 | // values.remove(Tables.Currencies.EXCHANGE_RATE.getName());
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/requests/PostCategoriesRequest.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api.requests;
2 |
3 | import com.code44.finance.api.GcmRegistration;
4 | import com.code44.finance.backend.endpoint.categories.Categories;
5 | import com.code44.finance.backend.endpoint.categories.model.CategoriesBody;
6 | import com.code44.finance.backend.endpoint.categories.model.CategoryEntity;
7 | import com.code44.finance.common.utils.Preconditions;
8 | import com.code44.finance.data.model.Category;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class PostCategoriesRequest extends PostRequest {
14 | private final Categories categoriesService;
15 | private final List categories;
16 |
17 | public PostCategoriesRequest(GcmRegistration gcmRegistration, Categories categoriesService, List categories) {
18 | super(null, gcmRegistration);
19 | Preconditions.notNull(categoriesService, "Categories service cannot be null.");
20 | Preconditions.notNull(categories, "Categories list cannot be null.");
21 |
22 | this.categoriesService = categoriesService;
23 | this.categories = categories;
24 | }
25 |
26 | @Override protected CategoriesBody createBody() {
27 | return new CategoriesBody();
28 | }
29 |
30 | @Override protected void onAddPostData(CategoriesBody body) {
31 | final List categoryEntities = new ArrayList<>();
32 | for (Category category : categories) {
33 | // categoryEntities.add(category.asEntity());
34 | }
35 | body.setCategories(categoryEntities);
36 | }
37 |
38 | @Override protected boolean isPostDataEmpty(CategoriesBody body) {
39 | return body.getCategories().isEmpty();
40 | }
41 |
42 | @Override protected void performRequest(CategoriesBody body) throws Exception {
43 | categoriesService.save(body);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/utils/CategoryUtils.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.utils;
2 |
3 | import android.content.Context;
4 |
5 | import com.code44.finance.R;
6 | import com.code44.finance.data.model.Transaction;
7 |
8 | public final class CategoryUtils {
9 | private CategoryUtils() {
10 | }
11 |
12 | public static int getColor(Context context, Transaction transaction) {
13 | if (transaction.getCategory() == null) {
14 | switch (transaction.getTransactionType()) {
15 | case Expense:
16 | return ThemeUtils.getColor(context, R.attr.textColorNegative);
17 | case Income:
18 | return ThemeUtils.getColor(context, R.attr.textColorPositive);
19 | case Transfer:
20 | return ThemeUtils.getColor(context, R.attr.textColorNeutral);
21 | default:
22 | throw new IllegalArgumentException("Transaction type " + transaction.getTransactionType() + " is not supported.");
23 | }
24 | } else {
25 | return transaction.getCategory().getColor();
26 | }
27 | }
28 |
29 | public static String getTitle(Context context, Transaction transaction) {
30 | if (transaction.getCategory() != null) {
31 | return transaction.getCategory().getTitle();
32 | } else {
33 | switch (transaction.getTransactionType()) {
34 | case Expense:
35 | return context.getString(R.string.expense);
36 | case Income:
37 | return context.getString(R.string.income);
38 | case Transfer:
39 | return context.getString(R.string.transfer);
40 | default:
41 | throw new IllegalArgumentException("Transaction type " + transaction.getTransactionType() + " is not supported.");
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Financius
2 | Personal finance tracking tool for Android.
3 |
4 | ## Quick links
5 | - [Download app from Google Play][1]
6 | - [Google+ community][2]
7 | - [Join beta testing program][3] *(You must be joined to Google+ community)*
8 | - [Report an issue or request a feature][4] but before **[read this](#report-a-bug-or-request-a-feature)**
9 | - [Translate to a different language][7]
10 |
11 | ## Report a bug or request a feature
12 | Before creating a new issue please make sure that same or similar issue is not already created by checking
13 | [open issues][5] and [closed issues][6] *(please note that there might be multiple pages)*. If your issue is already
14 | there, don't create a new one, but leave a comment under already existing one.
15 |
16 | Checklist for creating issues:
17 |
18 | - Keep titles short but descriptive.
19 | - For feature requests leave a clear description about the feature with examples where appropriate.
20 | - For bug reports leave as much information as possible about your device, android version, etc.
21 | - For bug reports also write steps to reproduce the issue.
22 |
23 | [Create new issue][4]
24 |
25 | ## License
26 | ```
27 | GNU GENERAL PUBLIC LICENSE
28 | Version 2, June 1991
29 |
30 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
31 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
32 | Everyone is permitted to copy and distribute verbatim copies
33 | of this license document, but changing it is not allowed.
34 | ```
35 |
36 | [1]: https://play.google.com/store/apps/details?id=com.code44.finance
37 | [2]: https://plus.google.com/communities/105052097023793642366
38 | [3]: https://play.google.com/apps/testing/com.code44.finance
39 | [4]: https://github.com/mvarnagiris/financius-public/issues/new
40 | [5]: https://github.com/mvarnagiris/financius-public/issues?state=open
41 | [6]: https://github.com/mvarnagiris/financius-public/issues?state=closed
42 | [7]: https://crowdin.com/project/financius
43 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/requests/PostCurrenciesRequest.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api.requests;
2 |
3 | import com.code44.finance.api.GcmRegistration;
4 | import com.code44.finance.backend.endpoint.currencies.Currencies;
5 | import com.code44.finance.backend.endpoint.currencies.model.CurrenciesBody;
6 | import com.code44.finance.backend.endpoint.currencies.model.CurrencyEntity;
7 | import com.code44.finance.common.utils.Preconditions;
8 | import com.code44.finance.data.model.CurrencyFormat;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class PostCurrenciesRequest extends PostRequest {
14 | private final Currencies currenciesService;
15 | private final List currencies;
16 |
17 | public PostCurrenciesRequest(GcmRegistration gcmRegistration, Currencies currenciesService, List currencies) {
18 | super(null, gcmRegistration);
19 | Preconditions.notNull(currenciesService, "Currencies service cannot be null.");
20 | Preconditions.notNull(currencies, "Currencies list cannot be null.");
21 |
22 | this.currenciesService = currenciesService;
23 | this.currencies = currencies;
24 | }
25 |
26 | @Override protected CurrenciesBody createBody() {
27 | return new CurrenciesBody();
28 | }
29 |
30 | @Override protected void onAddPostData(CurrenciesBody body) {
31 | final List serverCurrencies = new ArrayList<>();
32 | for (CurrencyFormat currencyFormat : currencies) {
33 | // serverCurrencies.add(currency.asEntity());
34 | }
35 | body.setCurrencies(serverCurrencies);
36 | }
37 |
38 | @Override protected boolean isPostDataEmpty(CurrenciesBody body) {
39 | return body.getCurrencies().isEmpty();
40 | }
41 |
42 | @Override protected void performRequest(CurrenciesBody body) throws Exception {
43 | currenciesService.save(body);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/transactions/list/TransactionsActivity.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.transactions.list;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 |
7 | import com.code44.finance.R;
8 | import com.code44.finance.money.AmountFormatter;
9 | import com.code44.finance.ui.common.activities.BaseDrawerActivity;
10 | import com.code44.finance.ui.common.navigation.NavigationScreen;
11 | import com.code44.finance.ui.common.presenters.ActivityPresenter;
12 | import com.code44.finance.utils.analytics.Analytics;
13 | import com.code44.finance.utils.interval.CurrentInterval;
14 |
15 | import javax.inject.Inject;
16 |
17 | public class TransactionsActivity extends BaseDrawerActivity {
18 | @Inject AmountFormatter amountFormatter;
19 | @Inject CurrentInterval currentInterval;
20 |
21 | public static Intent makeViewIntent(Context context) {
22 | final Intent intent = makeIntentForActivity(context, TransactionsActivity.class);
23 | TransactionsActivityPresenter.addViewExtras(intent);
24 | return intent;
25 | }
26 |
27 | @Override protected void onCreate(Bundle savedInstanceState) {
28 | setShowDrawer(true);
29 | setShowDrawerToggle(true);
30 | super.onCreate(savedInstanceState);
31 | }
32 |
33 | @Override protected void onCreateView(Bundle savedInstanceState) {
34 | super.onCreateView(savedInstanceState);
35 | setContentView(R.layout.activity_transactions);
36 | }
37 |
38 | @Override protected ActivityPresenter onCreateActivityPresenter() {
39 | return new TransactionsActivityPresenter(getEventBus(), amountFormatter, currentInterval);
40 | }
41 |
42 | @Override protected NavigationScreen getNavigationScreen() {
43 | return NavigationScreen.Transactions;
44 | }
45 |
46 | @Override protected Analytics.Screen getScreen() {
47 | return Analytics.Screen.TransactionList;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/activity_accounts.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
20 |
21 |
31 |
32 |
33 |
34 |
37 |
38 |
41 |
42 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/financius/src/main/res/layout/activity_tag_edit.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
17 |
18 |
25 |
26 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/settings/security/LockView.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.settings.security;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.FrameLayout;
6 |
7 | public abstract class LockView extends FrameLayout {
8 | private OnPasswordEnteredListener listener;
9 | private State state;
10 |
11 | public LockView(Context context, AttributeSet attrs) {
12 | this(context, attrs, 0);
13 | }
14 |
15 | public LockView(Context context, AttributeSet attrs, int defStyleAttr) {
16 | super(context, attrs, defStyleAttr);
17 | }
18 |
19 | public void setListener(OnPasswordEnteredListener listener) {
20 | this.listener = listener;
21 | }
22 |
23 | public State getState() {
24 | return state;
25 | }
26 |
27 | public void setState(State state) {
28 | this.state = state;
29 | switch (state) {
30 | case NewLock:
31 | onShowNewLock();
32 | break;
33 | case NewLockConfirm:
34 | onShowNewLockConfirm();
35 | break;
36 | case Unlock:
37 | onShowUnlock();
38 | break;
39 | default:
40 | throw new IllegalArgumentException("State " + state + " is not supported.");
41 | }
42 | }
43 |
44 | public abstract void showError(String message);
45 |
46 | protected abstract void onShowNewLock();
47 |
48 | protected abstract void onShowNewLockConfirm();
49 |
50 | protected abstract void onShowUnlock();
51 |
52 | protected void onPasswordEntered(String password) {
53 | if (listener != null) {
54 | listener.onPasswordEntered(password);
55 | }
56 | }
57 |
58 | public static enum State {
59 | NewLock, NewLockConfirm, Unlock
60 | }
61 |
62 | public static interface OnPasswordEnteredListener {
63 | public void onPasswordEntered(String password);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/api/requests/PostTransactionsRequest.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.api.requests;
2 |
3 | import com.code44.finance.api.GcmRegistration;
4 | import com.code44.finance.backend.endpoint.transactions.Transactions;
5 | import com.code44.finance.backend.endpoint.transactions.model.TransactionEntity;
6 | import com.code44.finance.backend.endpoint.transactions.model.TransactionsBody;
7 | import com.code44.finance.common.utils.Preconditions;
8 | import com.code44.finance.data.model.Transaction;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class PostTransactionsRequest extends PostRequest {
14 | private final Transactions transactionsService;
15 | private final List transactions;
16 |
17 | public PostTransactionsRequest(GcmRegistration gcmRegistration, Transactions transactionsService, List transactions) {
18 | super(null, gcmRegistration);
19 | Preconditions.notNull(transactionsService, "Transactions service cannot be null.");
20 | Preconditions.notNull(transactions, "Transactions list cannot be null.");
21 |
22 | this.transactionsService = transactionsService;
23 | this.transactions = transactions;
24 | }
25 |
26 | @Override protected TransactionsBody createBody() {
27 | return new TransactionsBody();
28 | }
29 |
30 | @Override protected void onAddPostData(TransactionsBody body) {
31 | final List transactionEntities = new ArrayList<>();
32 | for (Transaction transaction : transactions) {
33 | // transactionEntities.add(transaction.asEntity());
34 | }
35 | body.setTransactions(transactionEntities);
36 | }
37 |
38 | @Override protected boolean isPostDataEmpty(TransactionsBody body) {
39 | return body.getTransactions().isEmpty();
40 | }
41 |
42 | @Override protected void performRequest(TransactionsBody body) throws Exception {
43 | transactionsService.save(body);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/financius/src/main/java/com/code44/finance/ui/tags/list/TagsAdapter.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.ui.tags.list;
2 |
3 | import android.database.Cursor;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.CheckBox;
8 | import android.widget.TextView;
9 |
10 | import com.code44.finance.R;
11 | import com.code44.finance.data.model.Tag;
12 | import com.code44.finance.ui.common.adapters.ModelsAdapter;
13 | import com.code44.finance.ui.common.presenters.ModelsActivityPresenter;
14 |
15 | class TagsAdapter extends ModelsAdapter {
16 | public TagsAdapter(OnModelClickListener onModelClickListener) {
17 | super(onModelClickListener);
18 | }
19 |
20 | @Override public ViewHolder createModelViewHolder(ViewGroup parent, int viewType) {
21 | return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.li_tag, parent, false));
22 | }
23 |
24 | @Override protected Tag modelFromCursor(Cursor cursor) {
25 | return Tag.from(cursor);
26 | }
27 |
28 | private static class ViewHolder extends ModelViewHolder {
29 | private final CheckBox selectCheckBox;
30 | private final TextView titleTextView;
31 |
32 | public ViewHolder(View itemView) {
33 | super(itemView);
34 |
35 | // Get views
36 | selectCheckBox = (CheckBox) itemView.findViewById(R.id.selectCheckBox);
37 | titleTextView = (TextView) itemView.findViewById(R.id.titleTextView);
38 | }
39 |
40 | @Override protected void bind(Tag tag, Cursor cursor, int position, ModelsActivityPresenter.Mode mode, boolean isSelected) {
41 | titleTextView.setText(tag.getTitle());
42 | if (mode != ModelsActivityPresenter.Mode.View) {
43 | selectCheckBox.setVisibility(View.VISIBLE);
44 | selectCheckBox.setChecked(isSelected);
45 | } else {
46 | selectCheckBox.setVisibility(View.GONE);
47 | }
48 | }
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/backend/src/main/java/com/code44/finance/backend/endpoint/body/RegisterBody.java:
--------------------------------------------------------------------------------
1 | package com.code44.finance.backend.endpoint.body;
2 |
3 | import com.code44.finance.common.utils.Strings;
4 | import com.google.api.server.spi.response.BadRequestException;
5 | import com.google.gson.annotations.SerializedName;
6 |
7 | public class RegisterBody implements Body {
8 | @SerializedName(value = "google_id")
9 | private String googleId;
10 |
11 | @SerializedName(value = "first_name")
12 | private String firstName;
13 |
14 | @SerializedName(value = "last_name")
15 | private String lastName;
16 |
17 | @SerializedName(value = "photo_url")
18 | private String photoUrl;
19 |
20 | @SerializedName(value = "cover_url")
21 | private String coverUrl;
22 |
23 | public void verifyRequiredFields() throws BadRequestException {
24 | if (Strings.isEmpty(googleId)) {
25 | throw new BadRequestException("google_id cannot be empty.");
26 | }
27 |
28 | if (Strings.isEmpty(firstName)) {
29 | throw new BadRequestException("first_name cannot be empty.");
30 | }
31 | }
32 |
33 | public String getGoogleId() {
34 | return googleId;
35 | }
36 |
37 | public void setGoogleId(String googleId) {
38 | this.googleId = googleId;
39 | }
40 |
41 | public String getFirstName() {
42 | return firstName;
43 | }
44 |
45 | public void setFirstName(String firstName) {
46 | this.firstName = firstName;
47 | }
48 |
49 | public String getLastName() {
50 | return lastName;
51 | }
52 |
53 | public void setLastName(String lastName) {
54 | this.lastName = lastName;
55 | }
56 |
57 | public String getPhotoUrl() {
58 | return photoUrl;
59 | }
60 |
61 | public void setPhotoUrl(String photoUrl) {
62 | this.photoUrl = photoUrl;
63 | }
64 |
65 | public String getCoverUrl() {
66 | return coverUrl;
67 | }
68 |
69 | public void setCoverUrl(String coverUrl) {
70 | this.coverUrl = coverUrl;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------