├── screenshots ├── device.png ├── phone-1.png ├── phone-2.png ├── phone-3.png ├── phone-4.png ├── tablet7-1.png ├── tablet7-2.png ├── tablet7-3.png ├── tablet7-4.png ├── tablet10-1.png └── tablet10-2.png ├── libs └── android-support-v4.jar ├── res ├── drawable-hdpi │ ├── ic_launcher.png │ ├── earn_menuitem.png │ ├── ic_drawer_am.png │ ├── new_menuitem.png │ ├── color_menuitem.png │ ├── ic_notification.png │ ├── spend_menuitem.png │ ├── spinner_default.9.png │ ├── spinner_disabled.9.png │ ├── spinner_focused.9.png │ ├── spinner_pressed.9.png │ ├── textfield_active.9.png │ ├── transfer_menuitem.png │ ├── cab_background_top.9.png │ ├── progress_bg_example.9.png │ ├── textfield_disabled.9.png │ ├── textfield_inactive.9.png │ ├── btn_check_on_holo_light.png │ ├── btn_check_off_holo_light.png │ ├── dialog_background_title.9.png │ ├── progress_primary_example.9.png │ ├── progress_secondary_example.9.png │ ├── btn_check_on_focused_holo_light.png │ ├── btn_check_on_pressed_holo_light.png │ ├── btn_check_off_disabled_holo_light.png │ ├── btn_check_off_focused_holo_light.png │ ├── btn_check_off_pressed_holo_light.png │ ├── btn_check_on_disabled_holo_light.png │ ├── btn_check_off_disabled_focused_holo_light.png │ └── btn_check_on_disabled_focused_holo_light.png ├── drawable-mdpi │ ├── ic_launcher.png │ ├── earn_menuitem.png │ ├── ic_drawer_am.png │ ├── new_menuitem.png │ ├── color_menuitem.png │ ├── ic_notification.png │ ├── spend_menuitem.png │ ├── spinner_default.9.png │ ├── spinner_disabled.9.png │ ├── spinner_focused.9.png │ ├── spinner_pressed.9.png │ ├── textfield_active.9.png │ ├── transfer_menuitem.png │ ├── cab_background_top.9.png │ ├── progress_bg_example.9.png │ ├── textfield_disabled.9.png │ ├── textfield_inactive.9.png │ ├── btn_check_on_holo_light.png │ ├── btn_check_off_holo_light.png │ ├── dialog_background_title.9.png │ ├── progress_primary_example.9.png │ ├── progress_secondary_example.9.png │ ├── btn_check_on_focused_holo_light.png │ ├── btn_check_on_pressed_holo_light.png │ ├── btn_check_off_disabled_holo_light.png │ ├── btn_check_off_focused_holo_light.png │ ├── btn_check_off_pressed_holo_light.png │ ├── btn_check_on_disabled_holo_light.png │ ├── btn_check_off_disabled_focused_holo_light.png │ └── btn_check_on_disabled_focused_holo_light.png ├── drawable │ ├── widget_preview.png │ ├── selectable.xml │ ├── stateful_card_background.xml │ ├── ic_drawer.xml │ ├── spinner.xml │ ├── progress_horizontal.xml │ ├── textfield.xml │ └── btn_check_holo_light.xml ├── drawable-xhdpi │ ├── ic_drawer_am.png │ ├── ic_launcher.png │ ├── new_menuitem.png │ ├── color_menuitem.png │ ├── earn_menuitem.png │ ├── ic_notification.png │ ├── spend_menuitem.png │ ├── spinner_default.9.png │ ├── spinner_focused.9.png │ ├── spinner_pressed.9.png │ ├── transfer_menuitem.png │ ├── cab_background_top.9.png │ ├── spinner_disabled.9.png │ ├── textfield_active.9.png │ ├── textfield_disabled.9.png │ ├── textfield_inactive.9.png │ ├── progress_bg_example.9.png │ ├── btn_check_off_holo_light.png │ ├── btn_check_on_holo_light.png │ ├── dialog_background_title.9.png │ ├── progress_primary_example.9.png │ ├── progress_secondary_example.9.png │ ├── btn_check_off_focused_holo_light.png │ ├── btn_check_off_pressed_holo_light.png │ ├── btn_check_on_disabled_holo_light.png │ ├── btn_check_on_focused_holo_light.png │ ├── btn_check_on_pressed_holo_light.png │ ├── btn_check_off_disabled_holo_light.png │ ├── btn_check_on_disabled_focused_holo_light.png │ └── btn_check_off_disabled_focused_holo_light.png ├── drawable-xxhdpi │ └── ic_launcher.png ├── values │ ├── attrs.xml │ ├── dimens.xml │ ├── colors.xml │ ├── ids.xml │ ├── styles.xml │ └── strings.xml ├── menu │ ├── ok.xml │ ├── undo.xml │ ├── envelopedetailsactivity.xml │ └── envelopesactivity.xml ├── layout │ ├── envelopedetailsactivity.xml │ ├── spinner_item.xml │ ├── alltransactionsactivity.xml │ ├── dropdown_nothing.xml │ ├── card_just_text.xml │ ├── naventry_small.xml │ ├── naventry.xml │ ├── custom_title.xml │ ├── cards.xml │ ├── activity.xml │ ├── paycheckactivity_income.xml │ ├── envelopesactivity.xml │ ├── widget.xml │ ├── logentry_envelope.xml │ ├── card_widget.xml │ ├── logentry.xml │ ├── activity_pin.xml │ ├── card.xml │ ├── card_edit.xml │ ├── totalamount.xml │ ├── aboutactivity.xml │ ├── transferfragment.xml │ ├── spendfragment.xml │ └── paycheckactivity.xml ├── values-sw600dp │ └── dimens.xml ├── xml │ ├── widget.xml │ └── settings.xml ├── layout-w600dp │ └── envelopedetailsactivity.xml ├── layout-land │ └── spendfragment.xml ├── values-de │ └── strings.xml ├── values-fr │ └── strings.xml ├── values-pt-rBR │ └── strings.xml ├── values-es │ └── strings.xml ├── values-ru │ └── strings.xml ├── values-ar │ └── strings.xml └── values-nl │ └── strings.xml ├── .gitignore ├── project.properties ├── README.pt.md ├── RELEASE.md ├── proguard-project.txt ├── src └── com │ └── notriddle │ └── budget │ ├── TitleFragment.java │ ├── ColorFragment.java │ ├── CustomActionBarFragment.java │ ├── LockedActivity.java │ ├── MonitorScrollView.java │ ├── SimpleLogAdapter.java │ ├── SettingsFragment.java │ ├── TACGridView.java │ ├── ExportFragment.java │ ├── WidgetProvider.java │ ├── CheckableLinearLayout.java │ ├── CheckableRelativeLayout.java │ ├── NavAdapter.java │ ├── Util.java │ ├── EditTextDefaultFocus.java │ ├── SimpleEnvelopesAdapter.java │ ├── AboutFragment.java │ ├── EnvelopesAdapter.java │ ├── AllTransactionsFragment.java │ ├── FileCreatorFragment.java │ ├── SQLiteLoader.java │ ├── EditMoney.java │ ├── WidgetService.java │ ├── LogAdapter.java │ ├── PaycheckEnvelopesAdapter.java │ └── EditTransactionFragment.java ├── Android.mk ├── pictures ├── regen-icon.sh └── ic_launcher_hires.svg ├── AndroidManifest.xml ├── README.md └── README.es.md /screenshots/device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/screenshots/device.png -------------------------------------------------------------------------------- /screenshots/phone-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/screenshots/phone-1.png -------------------------------------------------------------------------------- /screenshots/phone-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/screenshots/phone-2.png -------------------------------------------------------------------------------- /screenshots/phone-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/screenshots/phone-3.png -------------------------------------------------------------------------------- /screenshots/phone-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/screenshots/phone-4.png -------------------------------------------------------------------------------- /screenshots/tablet7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/screenshots/tablet7-1.png -------------------------------------------------------------------------------- /screenshots/tablet7-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/screenshots/tablet7-2.png -------------------------------------------------------------------------------- /screenshots/tablet7-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/screenshots/tablet7-3.png -------------------------------------------------------------------------------- /screenshots/tablet7-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/screenshots/tablet7-4.png -------------------------------------------------------------------------------- /libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/libs/android-support-v4.jar -------------------------------------------------------------------------------- /screenshots/tablet10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/screenshots/tablet10-1.png -------------------------------------------------------------------------------- /screenshots/tablet10-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/screenshots/tablet10-2.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable/widget_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable/widget_preview.png -------------------------------------------------------------------------------- /res/drawable-hdpi/earn_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/earn_menuitem.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_drawer_am.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/ic_drawer_am.png -------------------------------------------------------------------------------- /res/drawable-hdpi/new_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/new_menuitem.png -------------------------------------------------------------------------------- /res/drawable-mdpi/earn_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/earn_menuitem.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_drawer_am.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/ic_drawer_am.png -------------------------------------------------------------------------------- /res/drawable-mdpi/new_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/new_menuitem.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_drawer_am.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/ic_drawer_am.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/new_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/new_menuitem.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-hdpi/color_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/color_menuitem.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/ic_notification.png -------------------------------------------------------------------------------- /res/drawable-hdpi/spend_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/spend_menuitem.png -------------------------------------------------------------------------------- /res/drawable-mdpi/color_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/color_menuitem.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/ic_notification.png -------------------------------------------------------------------------------- /res/drawable-mdpi/spend_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/spend_menuitem.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/color_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/color_menuitem.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/earn_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/earn_menuitem.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/ic_notification.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/spend_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/spend_menuitem.png -------------------------------------------------------------------------------- /res/drawable-hdpi/spinner_default.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/spinner_default.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/spinner_disabled.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/spinner_disabled.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/spinner_focused.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/spinner_focused.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/spinner_pressed.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/spinner_pressed.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/textfield_active.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/textfield_active.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/transfer_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/transfer_menuitem.png -------------------------------------------------------------------------------- /res/drawable-mdpi/spinner_default.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/spinner_default.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/spinner_disabled.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/spinner_disabled.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/spinner_focused.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/spinner_focused.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/spinner_pressed.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/spinner_pressed.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/textfield_active.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/textfield_active.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/transfer_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/transfer_menuitem.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/spinner_default.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/spinner_default.9.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/spinner_focused.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/spinner_focused.9.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/spinner_pressed.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/spinner_pressed.9.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/transfer_menuitem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/transfer_menuitem.png -------------------------------------------------------------------------------- /res/drawable-hdpi/cab_background_top.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/cab_background_top.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/progress_bg_example.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/progress_bg_example.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/textfield_disabled.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/textfield_disabled.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/textfield_inactive.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/textfield_inactive.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/cab_background_top.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/cab_background_top.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/progress_bg_example.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/progress_bg_example.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/textfield_disabled.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/textfield_disabled.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/textfield_inactive.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/textfield_inactive.9.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/cab_background_top.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/cab_background_top.9.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/spinner_disabled.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/spinner_disabled.9.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/textfield_active.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/textfield_active.9.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/textfield_disabled.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/textfield_disabled.9.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/textfield_inactive.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/textfield_inactive.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/btn_check_on_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/btn_check_on_holo_light.png -------------------------------------------------------------------------------- /res/drawable-mdpi/btn_check_on_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/btn_check_on_holo_light.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/progress_bg_example.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/progress_bg_example.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/btn_check_off_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/btn_check_off_holo_light.png -------------------------------------------------------------------------------- /res/drawable-hdpi/dialog_background_title.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/dialog_background_title.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/progress_primary_example.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/progress_primary_example.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/btn_check_off_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/btn_check_off_holo_light.png -------------------------------------------------------------------------------- /res/drawable-mdpi/dialog_background_title.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/dialog_background_title.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/progress_primary_example.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/progress_primary_example.9.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/btn_check_off_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/btn_check_off_holo_light.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/btn_check_on_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/btn_check_on_holo_light.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/dialog_background_title.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/dialog_background_title.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/progress_secondary_example.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/progress_secondary_example.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/progress_secondary_example.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/progress_secondary_example.9.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/progress_primary_example.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/progress_primary_example.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/btn_check_on_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/btn_check_on_focused_holo_light.png -------------------------------------------------------------------------------- /res/drawable-hdpi/btn_check_on_pressed_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/btn_check_on_pressed_holo_light.png -------------------------------------------------------------------------------- /res/drawable-mdpi/btn_check_on_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/btn_check_on_focused_holo_light.png -------------------------------------------------------------------------------- /res/drawable-mdpi/btn_check_on_pressed_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/btn_check_on_pressed_holo_light.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/progress_secondary_example.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/progress_secondary_example.9.png -------------------------------------------------------------------------------- /res/drawable-hdpi/btn_check_off_disabled_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/btn_check_off_disabled_holo_light.png -------------------------------------------------------------------------------- /res/drawable-hdpi/btn_check_off_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/btn_check_off_focused_holo_light.png -------------------------------------------------------------------------------- /res/drawable-hdpi/btn_check_off_pressed_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/btn_check_off_pressed_holo_light.png -------------------------------------------------------------------------------- /res/drawable-hdpi/btn_check_on_disabled_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/btn_check_on_disabled_holo_light.png -------------------------------------------------------------------------------- /res/drawable-mdpi/btn_check_off_disabled_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/btn_check_off_disabled_holo_light.png -------------------------------------------------------------------------------- /res/drawable-mdpi/btn_check_off_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/btn_check_off_focused_holo_light.png -------------------------------------------------------------------------------- /res/drawable-mdpi/btn_check_off_pressed_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/btn_check_off_pressed_holo_light.png -------------------------------------------------------------------------------- /res/drawable-mdpi/btn_check_on_disabled_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/btn_check_on_disabled_holo_light.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/btn_check_off_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/btn_check_off_focused_holo_light.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/btn_check_off_pressed_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/btn_check_off_pressed_holo_light.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/btn_check_on_disabled_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/btn_check_on_disabled_holo_light.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/btn_check_on_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/btn_check_on_focused_holo_light.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/btn_check_on_pressed_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/btn_check_on_pressed_holo_light.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/btn_check_off_disabled_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/btn_check_off_disabled_holo_light.png -------------------------------------------------------------------------------- /res/drawable-hdpi/btn_check_off_disabled_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/btn_check_off_disabled_focused_holo_light.png -------------------------------------------------------------------------------- /res/drawable-hdpi/btn_check_on_disabled_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-hdpi/btn_check_on_disabled_focused_holo_light.png -------------------------------------------------------------------------------- /res/drawable-mdpi/btn_check_off_disabled_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/btn_check_off_disabled_focused_holo_light.png -------------------------------------------------------------------------------- /res/drawable-mdpi/btn_check_on_disabled_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-mdpi/btn_check_on_disabled_focused_holo_light.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/btn_check_on_disabled_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/btn_check_on_disabled_focused_holo_light.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/btn_check_off_disabled_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/notriddle/budget-envelopes/HEAD/res/drawable-xhdpi/btn_check_off_disabled_focused_holo_light.png -------------------------------------------------------------------------------- /res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /res/menu/ok.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /res/menu/undo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /res/layout/envelopedetailsactivity.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /res/layout/spinner_item.xml: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /res/layout/alltransactionsactivity.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | -------------------------------------------------------------------------------- /res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | 8dp 4 | 4dp 5 | 24dp 6 | 88dp 7 | 40sp 8 | 1dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | 15 | # Local configuration file (sdk path, etc) 16 | local.properties 17 | 18 | # I'm not sharing my release key. 19 | ant.properties 20 | 21 | # Eclipse project files 22 | .classpath 23 | .project 24 | .settings/** 25 | -------------------------------------------------------------------------------- /res/layout/dropdown_nothing.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | -------------------------------------------------------------------------------- /res/xml/widget.xml: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /res/layout/card_just_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | -------------------------------------------------------------------------------- /res/layout/naventry_small.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | -------------------------------------------------------------------------------- /res/drawable/selectable.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /res/drawable/stateful_card_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /res/layout/naventry.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | -------------------------------------------------------------------------------- /res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 256dp 3 | 8dp 4 | 8dp 5 | 4dp 6 | 16dp 7 | 16dp 8 | 64dp 9 | 34sp 10 | 0dp 11 | 256dp 12 | 4dp 13 | 14 | 15 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | proguard.config=${sdk.dir}/tools/proguard/proguard-android-optimize.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | -------------------------------------------------------------------------------- /res/layout/custom_title.xml: -------------------------------------------------------------------------------- 1 | 5 | 12 | 13 | -------------------------------------------------------------------------------- /res/layout/cards.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | -------------------------------------------------------------------------------- /res/menu/envelopedetailsactivity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /res/xml/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 13 | 14 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /res/menu/envelopesactivity.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #aaa 4 | #ccc 5 | #eee 6 | #88336600 7 | #88669900 8 | #8899cc00 9 | #ff669900 10 | #ffcc0000 11 | #ff7a955f 12 | #ff95b15f 13 | #ffb0cc5f 14 | #ffb7b7b7 15 | 16 | 17 | -------------------------------------------------------------------------------- /README.pt.md: -------------------------------------------------------------------------------- 1 | Orçamento com envelopes 2 | =========================================== 3 | Assuma o controle de seu dinheiro. É fácil. 4 | ------------------------------------------- 5 | 6 | Evite as taxas do saldo negativo, escassez inesperados, a tarefa monótona assim como árdua do pagamento mínimo e o medo quando se da conta que não poderia ir para comer. 7 | 8 | Eso é o propósito de Orçamento; é fácil também. Coloque dineiro nos envelopes no dia de pagamento e retire o que gasta. Um envelope pode representar qualquer coisa—uma conta, dineiro reservado para os comestíveis ou dinheiro que economizou para comprar o novo celular fora de contrato. Pense de um talão de cheques, só mais flexível. 9 | 10 | Ao gerir o dinheiro é uma chatice, mas não tem que ser árduo ou difícil. 11 | 12 | 13 | -------------------------------------------------------------------------------- /res/layout/activity.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 13 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /res/layout-w600dp/envelopedetailsactivity.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /res/drawable/ic_drawer.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | The release system 2 | ================== 3 | 4 | * Only bug fixes happen directly in master: all new features are developed in separate branches and merged when they're considered ready-to-beta-test. 5 | 6 | * Beta releases that are uploaded to Google+ are just builds from master. 7 | 8 | * When a consensus is reached that the app is ready for another release (all the strings are translated into all supported languages, and no known critical bugs exist), the release branch is fast-forwarded to the tip of the master branch, the version number is incremented, and the tag is made. The release branch is just there to make finding the latest stable version easy. 9 | 10 | * The master branch always has an odd version number, while the actual releases always have an even version number. 11 | 12 | * On Google Play, I use a staggered roll-out. First day at 1%, second day at 10%, third day at 100%. 13 | 14 | -------------------------------------------------------------------------------- /proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | -optimizationpasses 7 14 | -dontobfuscate 15 | -optimizations !code/allocation/variable 16 | 17 | # If your project uses WebView with JS, uncomment the following 18 | # and specify the fully qualified class name to the JavaScript interface 19 | # class: 20 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 21 | # public *; 22 | #} 23 | -------------------------------------------------------------------------------- /res/layout/paycheckactivity_income.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/TitleFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | public interface TitleFragment { 22 | abstract public String getTitle(); 23 | }; 24 | 25 | -------------------------------------------------------------------------------- /res/layout/envelopesactivity.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 12 | 13 | 14 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /res/layout/widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 15 | 16 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /res/layout/logentry_envelope.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/ColorFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | public interface ColorFragment { 22 | 23 | public static interface OnColorChangeListener { 24 | public void onColorChange(int color); 25 | }; 26 | 27 | abstract public int getColor(); 28 | }; 29 | 30 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/CustomActionBarFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | import android.view.LayoutInflater; 21 | import android.view.View; 22 | import android.view.ViewGroup; 23 | 24 | public interface CustomActionBarFragment { 25 | abstract public View onCreateActionBarView(LayoutInflater i); 26 | }; 27 | 28 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # This file is a part of Budget with Envelopes. 3 | # Copyright 2013 Emilio López 4 | # 5 | # Budget is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # Budget is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with Budget. If not, see . 17 | 18 | LOCAL_PATH := $(call my-dir) 19 | 20 | include $(CLEAR_VARS) 21 | 22 | LOCAL_PACKAGE_NAME := Budget 23 | LOCAL_SRC_FILES := $(call all-subdir-java-files) 24 | 25 | ifneq ($(BUDGET_DEBUG),) 26 | LOCAL_CERTIFICATE := testkey 27 | LOCAL_AAPT_FLAGS := --rename-manifest-package com.notriddle.budget.dev 28 | else 29 | LOCAL_CERTIFICATE := platform 30 | endif 31 | 32 | include $(BUILD_PACKAGE) 33 | -------------------------------------------------------------------------------- /res/drawable/spinner.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 20 | 22 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /res/layout/card_widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 19 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/LockedActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Anatolij Zelenin 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.app.Activity; 22 | import android.os.Bundle; 23 | 24 | public abstract class LockedActivity extends Activity { 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | check(); 29 | } 30 | 31 | @Override public void onResume() { 32 | super.onResume(); 33 | check(); 34 | } 35 | 36 | private void check() { 37 | if (!PinActivity.ensureUnlocked(this)) { 38 | finish(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /res/drawable/progress_horizontal.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 28 | 29 | 30 | 31 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /res/drawable/textfield.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /res/layout/logentry.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 17 | 25 | 32 | 33 | -------------------------------------------------------------------------------- /res/layout/activity_pin.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 18 | 19 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /res/layout/card.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 21 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /res/layout/card_edit.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 20 | 25 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /res/layout/totalamount.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 18 | 25 | 34 | 35 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/MonitorScrollView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.content.Context; 22 | import android.util.AttributeSet; 23 | import android.widget.ScrollView; 24 | 25 | public class MonitorScrollView extends ScrollView { 26 | public static interface OnScrollListener { 27 | public void onScrollChanged(int pos, int oldPos); 28 | }; 29 | 30 | OnScrollListener mListener; 31 | 32 | public MonitorScrollView(Context context, AttributeSet attrs, int defStyle) { 33 | super(context, attrs, defStyle); 34 | 35 | } 36 | 37 | public MonitorScrollView(Context context, AttributeSet attrs) 38 | { 39 | super(context, attrs); 40 | } 41 | 42 | public MonitorScrollView(Context context) 43 | { 44 | super(context); 45 | } 46 | 47 | public void setOnScrollListener(OnScrollListener listener) { 48 | mListener = listener; 49 | } 50 | 51 | @Override 52 | public void onScrollChanged(int l, int t, int oL, int oT) { 53 | super.onScrollChanged(l, t, oL, oT); 54 | if (mListener != null) { 55 | mListener.onScrollChanged(t, oT); 56 | } 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /res/layout/aboutactivity.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 17 | 29 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /pictures/regen-icon.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This file is a part of Budget with Envelopes. 4 | # Copyright 2013 Michael Howell 5 | # 6 | # Budget is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Budget is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with Budget. If not, see . 18 | 19 | inkscape -e ../res/drawable-mdpi/ic_launcher.png -w 48 -h 48 -z ic_launcher.svg 20 | inkscape -e ../res/drawable-hdpi/ic_launcher.png -w 72 -h 72 -z ic_launcher.svg 21 | inkscape -e ../res/drawable-xhdpi/ic_launcher.png -w 96 -h 96 -z ic_launcher.svg 22 | inkscape -e ../res/drawable-xxhdpi/ic_launcher.png -w 144 -h 144 -z ic_launcher.svg 23 | 24 | inkscape -e ic_notification.png -w 24 -h 24 -z ic_notification.svg 25 | gm convert -recolor '0 0 0 1, 0 0 0 1, 0 0 0 1, 1 0 0 0' ic_notification.png ../res/drawable-mdpi/ic_notification.png 26 | inkscape -e ic_notification.png -w 36 -h 36 -z ic_notification.svg 27 | gm convert -recolor '0 0 0 1, 0 0 0 1, 0 0 0 1, 1 0 0 0' ic_notification.png ../res/drawable-hdpi/ic_notification.png 28 | inkscape -e ic_notification.png -w 48 -h 48 -z ic_notification.svg 29 | gm convert -recolor '0 0 0 1, 0 0 0 1, 0 0 0 1, 1 0 0 0' ic_notification.png ../res/drawable-xhdpi/ic_notification.png 30 | rm ic_notification.png 31 | 32 | for i in color_menuitem spend_menuitem earn_menuitem transfer_menuitem; do 33 | inkscape -e ../res/drawable-mdpi/$i.png -w 32 -h 32 -z $i.svg 34 | inkscape -e ../res/drawable-hdpi/$i.png -w 48 -h 48 -z $i.svg 35 | inkscape -e ../res/drawable-xhdpi/$i.png -w 64 -h 64 -z $i.svg 36 | #inkscape -e res/drawable-xxhdpi/$i.png -w 192 -h 192 -z $i.svg 37 | done 38 | -------------------------------------------------------------------------------- /res/layout/transferfragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 15 | 24 | 28 | 29 | 30 | 40 | 41 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /res/layout/spendfragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 18 | 19 | 28 | 29 | 33 | 39 | 45 | 46 | 47 | 51 | 52 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/SimpleLogAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.content.Context; 22 | import android.database.Cursor; 23 | import android.view.LayoutInflater; 24 | import android.view.View; 25 | import android.view.ViewGroup; 26 | import android.widget.SimpleCursorAdapter; 27 | import android.widget.TextView; 28 | 29 | public class SimpleLogAdapter extends SimpleCursorAdapter { 30 | static final String[] FROM = new String[] { 31 | "description" 32 | }; 33 | static final int[] TO = new int[] { 34 | android.R.id.text1 35 | }; 36 | public SimpleLogAdapter(Context cntx, Cursor csr) { 37 | super(cntx, android.R.layout.simple_list_item_1, csr, FROM, TO, 0); 38 | } 39 | public SimpleLogAdapter(Context cntx, Cursor csr, int layout) { 40 | super(cntx, layout, csr, FROM, TO, 0); 41 | } 42 | @Override public View newDropDownView(Context cntx, Cursor csr, 43 | ViewGroup parent) { 44 | View retVal = LayoutInflater.from(cntx).inflate( 45 | android.R.layout.simple_spinner_dropdown_item, 46 | parent, 47 | false 48 | ); 49 | bindView(retVal, cntx, csr); 50 | return retVal; 51 | } 52 | @Override public String convertToString(Cursor csr) { 53 | return csr.getString( 54 | csr.getColumnIndexOrThrow("description") 55 | ); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | 41 | 45 | 46 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Budget with envelopes 2 | ====================================== 3 | Take control of your money. It's easy. 4 | -------------------------------------- 5 | 6 | Avoid overdraft fees, unexpected shortages, the minimum payment treadmill, and that sinking dread when you realize you actually couldn't afford to go out. 7 | 8 | That's what Budget is for, and it's easy. You put money into the envelopes at payday, and take it out as you spend. An envelope can represent anything — a bank account, money set aside for groceries, or the cash you're saving to buy that new Android phone off-contract. Think of a checkbook, only more flexible. 9 | 10 | Managing money is a drag, but it doesn't have to be painful or difficult. 11 | 12 | 13 | Compiling 14 | ========= 15 | 16 | TL;DR : Just like every other Android project. 17 | 18 | 19 | Debug 20 | ----- 21 | 22 | To compile in debug mode, run this the first time: 23 | 24 | android update project -p . 25 | 26 | And run this every time. 27 | 28 | ant clean 29 | ant debug 30 | 31 | 32 | Release 33 | ------- 34 | 35 | Making a release build is a bit harder, because you need a release key. A howto is available at . Here's an example for generating the key (only do this once): 36 | 37 | android update project -p . # Unless you've already done it, of course. 38 | keytool -genkey -keystore budget.keystore -alias budget -keyalg RSA -keysize 2048 -validity 10000 39 | echo "key.store=budget.keystore" > ant.properties 40 | echo "key.alias=budget" >> ant.properties 41 | 42 | And to actually build the program: 43 | 44 | ant clean 45 | ant release 46 | 47 | 48 | Within an Android tree 49 | ---------------------- 50 | 51 | If you want to distribute Budget with a custom Android ROM, you'll want to build it this way. Here's an example `.repo/local_manifest.xml` file: 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | This will build Budget, in release mode signed with your platform key. If you want to be able to install your own build of Budget *and* the one from the Play Store or F-Droid, you can define `BUDGET_DEBUG` while building: 60 | 61 | BUDGET_DEBUG=1 mm 62 | 63 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/SettingsFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Anatolij Zelenin 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.app.DialogFragment; 22 | import android.content.Intent; 23 | import android.os.Bundle; 24 | import android.preference.EditTextPreference; 25 | import android.preference.Preference; 26 | import android.preference.PreferenceFragment; 27 | import android.text.InputType; 28 | import android.view.MenuItem; 29 | 30 | public class SettingsFragment extends PreferenceFragment 31 | implements Preference 32 | .OnPreferenceClickListener, 33 | TitleFragment { 34 | @Override 35 | public void onCreate(final Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | addPreferencesFromResource(R.xml.settings); 38 | 39 | EditTextPreference pref 40 | = (EditTextPreference) findPreference("com.notriddle.budget.pin"); 41 | pref.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER); 42 | 43 | Preference p = findPreference("com.notriddle.budget.export"); 44 | p.setOnPreferenceClickListener(this); 45 | p = findPreference("com.notriddle.budget.import"); 46 | p.setOnPreferenceClickListener(this); 47 | } 48 | 49 | @Override 50 | public boolean onPreferenceClick(Preference p) { 51 | DialogFragment f = (p == findPreference("com.notriddle.budget.import")) ? ImportFragment.newInstance() : ExportFragment.newInstance(); 52 | f.show(getFragmentManager(), "dialog"); 53 | return true; 54 | } 55 | 56 | @Override public String getTitle() { 57 | return getActivity().getString(R.string.settings_name); 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/TACGridView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | // Got it from here: http://theandroidcoder.com/graphical/android-forcing-a-gridview-or-listview-to-display-at-its-full-height/ 20 | 21 | package com.notriddle.budget; 22 | 23 | import android.content.Context; 24 | import android.util.AttributeSet; 25 | import android.widget.GridView; 26 | 27 | public class TACGridView extends GridView { 28 | 29 | public TACGridView(Context context, AttributeSet attrs, int defStyle) { 30 | super(context, attrs, defStyle); 31 | 32 | } 33 | 34 | public TACGridView(Context context, AttributeSet attrs) 35 | { 36 | super(context, attrs); 37 | } 38 | 39 | public TACGridView(Context context) 40 | { 41 | super(context); 42 | } 43 | 44 | boolean expanded = true; 45 | 46 | public boolean isExpanded() { 47 | return expanded; 48 | } 49 | 50 | public void setExpanded(boolean expanded) { 51 | this.expanded = expanded; 52 | } 53 | 54 | @Override 55 | public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 56 | if (isExpanded()) { 57 | // Calculate entire height by providing a very large height hint. 58 | // But do not use the highest 2 bits of this integer; those are 59 | // reserved for the MeasureSpec mode. 60 | int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, 61 | MeasureSpec.AT_MOST); 62 | super.onMeasure(widthMeasureSpec, expandSpec); 63 | 64 | android.view.ViewGroup.LayoutParams params = getLayoutParams(); 65 | params.height = getMeasuredHeight(); 66 | } else { 67 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 68 | } 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/ExportFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.app.DialogFragment; 22 | import android.app.ProgressDialog; 23 | import android.content.ContentValues; 24 | import android.content.Context; 25 | import android.content.Intent; 26 | import android.content.Loader; 27 | import android.database.Cursor; 28 | import android.database.sqlite.SQLiteDatabase; 29 | import android.net.Uri; 30 | import android.os.AsyncTask; 31 | import android.os.Bundle; 32 | import android.widget.Toast; 33 | import com.notriddle.budget.csv.CSVWriter; 34 | import java.io.FileWriter; 35 | 36 | public class ExportFragment extends FileCreatorFragment { 37 | public static ExportFragment newInstance() { 38 | return new ExportFragment(); 39 | } 40 | 41 | @Override protected void perform(Uri dest) throws Throwable { 42 | FileWriter f = new FileWriter(dest.getPath()); 43 | CSVWriter c = new CSVWriter(f); 44 | SQLiteDatabase db = (new EnvelopesOpenHelper(getActivity())) 45 | .getReadableDatabase(); 46 | Cursor csr = db.rawQuery("SELECT l.time, e.name, l.cents, l.description FROM log AS l LEFT JOIN envelopes AS e ON (l.envelope = e._id)", null); 47 | int l = csr.getCount(); 48 | csr.moveToFirst(); 49 | for (int i = 0; i != l; ++i) { 50 | c.writeNext(new String[] { 51 | csr.getString(0), csr.getString(1), csr.getString(2), 52 | csr.getString(3) 53 | }); 54 | csr.moveToNext(); 55 | } 56 | db.close(); 57 | f.close(); 58 | } 59 | 60 | @Override protected int getButtonTitle() { 61 | return R.string.export_name; 62 | } 63 | @Override protected int getDialogTitle() { 64 | return R.string.export_name; 65 | } 66 | }; 67 | 68 | -------------------------------------------------------------------------------- /README.es.md: -------------------------------------------------------------------------------- 1 | Presupuesto con sobres 2 | ========================================= 3 | Retome el control de su dinero. Es fácil. 4 | ----------------------------------------- 5 | 6 | Evite cargos por sobregiro, falta de dinero inesperada, el camino sin fin del pago mínimo, y ese sentimiento de ahogo cuando se da cuenta de que realmente no podía permitirse el lujo de salir. 7 | 8 | Eso es lo que Presupuesto hace, y es fácil. Usted divide su dinero en los sobres al día de pago, y retira de ellos a medida que gasta. Un sobre puede representar cualquier cosa - una cuenta bancaria, dinero destinado a alimentos, o el dinero que está ahorrando para comprar ese nuevo teléfono Android fuera de contrato. Piense en una chequera, pero más flexible. 9 | 10 | El manejo del dinero es un lastre, pero no tiene por qué ser doloroso o difícil. 11 | 12 | 13 | Compilación 14 | =========== 15 | 16 | En resumen: Igual que cualquier otro proyecto para Android. 17 | 18 | 19 | Versión de depuración: 20 | ---------------------- 21 | 22 | Para compilar en modo de depuración, ejecute lo siguiente la primera vez: 23 | 24 | android update project -p . 25 | 26 | Y luego, todas las veces: 27 | 28 | ant clean 29 | ant debug 30 | 31 | 32 | Versión de lanzamiento 33 | ---------------------- 34 | 35 | Compilar una versión de lanzamiento es un poco más difícil, porque se necesita una llave de lanzamiento. Hay un tutorial disponible sobre esto en (en inglés). A continuación puede ver un ejemplo para la generación de la llave (sólo es necesario hacerlo una vez): 36 | 37 | android update project -p . # A menos que ya lo haya hecho, por supuesto. 38 | keytool -genkey -keystore budget.keystore -alias budget -keyalg RSA -keysize 2048 -validity 10000 39 | echo "key.store=budget.keystore" > ant.properties 40 | echo "key.alias=budget" >> ant.properties 41 | 42 | Y para compilar el programa: 43 | 44 | ant clean 45 | ant release 46 | 47 | 48 | Dentro de un árbol de Android 49 | ----------------------------- 50 | 51 | Si quiere distribuir Presupuesto con una ROM personalizada de Android, querrá compilar de esta manera. He aquí un `.repo/local_manifest.xml` de ejemplo: 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | Esto compilará una versión de lanzamiento de Presupuesto, firmada con su llave de plataforma. Si usted quiere ser capaz de instalar su propia compilación de Presupuesto *y* la de la tienda Google Play o F-Droid, puede definir `BUDGET_DEBUG` mientras compila: 60 | 61 | BUDGET_DEBUG=1 mm 62 | 63 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/WidgetProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.app.PendingIntent; 22 | import android.appwidget.AppWidgetManager; 23 | import android.appwidget.AppWidgetProvider; 24 | import android.content.ComponentName; 25 | import android.content.Context; 26 | import android.content.Intent; 27 | import android.net.Uri; 28 | import android.os.Bundle; 29 | import android.os.Parcelable; 30 | import android.util.Log; 31 | import android.widget.RemoteViews; 32 | 33 | public class WidgetProvider extends AppWidgetProvider { 34 | @Override public void onUpdate(Context cntx, AppWidgetManager manager, 35 | int[] widgetIds) { 36 | final int l = widgetIds.length; 37 | for (int i = 0; i != l; ++i) { 38 | int widgetId = widgetIds[i]; 39 | Log.d("Budget", "WidgetProvider.id="+widgetId); 40 | RemoteViews views = new RemoteViews( 41 | cntx.getPackageName(), 42 | R.layout.widget 43 | ); 44 | Intent srv = new Intent(cntx, WidgetService.class); 45 | srv.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetIds[i]); 46 | srv.setData(Uri.parse(srv.toUri(Intent.URI_INTENT_SCHEME))); 47 | views.setRemoteAdapter(widgetIds[i], R.id.grid, srv); 48 | views.setEmptyView(R.id.grid, R.id.empty); 49 | Intent act = new Intent(cntx, EnvelopesActivity.class); 50 | act.setData(Uri.parse("fragment://"+EnvelopeDetailsFragment.class.getName()+"/"+widgetIds[i])); 51 | act.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetIds[i]); 52 | PendingIntent actPending = PendingIntent.getActivity( 53 | cntx, 0, act, PendingIntent.FLAG_UPDATE_CURRENT 54 | ); 55 | views.setPendingIntentTemplate(R.id.grid, actPending); 56 | manager.updateAppWidget(widgetIds[i], views); 57 | } 58 | super.onUpdate(cntx, manager, widgetIds); 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/CheckableLinearLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.content.Context; 22 | import android.util.AttributeSet; 23 | import android.view.View; 24 | import android.widget.Checkable; 25 | import android.widget.LinearLayout; 26 | 27 | /** 28 | * A special variation of LinearLayout that can be used as a checkable object. 29 | * This allows it to be used as the top-level view of a list view item, which 30 | * also supports checking. Otherwise, it works identically to a LinearLayout. 31 | * 32 | * http://alvinalexander.com/java/jwarehouse/apps-for-android/RingsExtended/src/com/example/android/rings_extended/CheckableLinearLayout.java.shtml 33 | */ 34 | 35 | public class CheckableLinearLayout extends LinearLayout implements Checkable { 36 | private boolean mChecked; 37 | 38 | private static final int[] CHECKED_STATE_SET = { 39 | android.R.attr.state_checked 40 | }; 41 | 42 | public CheckableLinearLayout(Context context, AttributeSet attrs) { 43 | super(context, attrs); 44 | } 45 | 46 | @Override 47 | protected int[] onCreateDrawableState(int extraSpace) { 48 | final int[] drawableState = super.onCreateDrawableState(extraSpace + 1); 49 | if (isChecked()) { 50 | mergeDrawableStates(drawableState, CHECKED_STATE_SET); 51 | } 52 | return drawableState; 53 | } 54 | 55 | public void toggle() { 56 | setChecked(!mChecked); 57 | } 58 | 59 | public boolean isChecked() { 60 | return mChecked; 61 | } 62 | 63 | public void setChecked(boolean checked) { 64 | if (mChecked != checked) { 65 | mChecked = checked; 66 | int s = getChildCount(); 67 | for (int i = 0; i != s; ++i) { 68 | View v = getChildAt(i); 69 | if (v instanceof Checkable) { 70 | Checkable c = (Checkable)v; 71 | c.setChecked(mChecked); 72 | } 73 | } 74 | refreshDrawableState(); 75 | } 76 | } 77 | } 78 | 79 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/CheckableRelativeLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.content.Context; 22 | import android.util.AttributeSet; 23 | import android.view.View; 24 | import android.widget.Checkable; 25 | import android.widget.RelativeLayout; 26 | 27 | /** 28 | * A special variation of RelativeLayout that can be used as a checkable object. 29 | * This allows it to be used as the top-level view of a list view item, which 30 | * also supports checking. Otherwise, it works identically to a RelativeLayout. 31 | * 32 | * http://alvinalexander.com/java/jwarehouse/apps-for-android/RingsExtended/src/com/example/android/rings_extended/CheckableRelativeLayout.java.shtml 33 | */ 34 | 35 | public class CheckableRelativeLayout extends RelativeLayout implements Checkable { 36 | private boolean mChecked; 37 | 38 | private static final int[] CHECKED_STATE_SET = { 39 | android.R.attr.state_checked 40 | }; 41 | 42 | public CheckableRelativeLayout(Context context, AttributeSet attrs) { 43 | super(context, attrs); 44 | } 45 | 46 | @Override 47 | protected int[] onCreateDrawableState(int extraSpace) { 48 | final int[] drawableState = super.onCreateDrawableState(extraSpace + 1); 49 | if (isChecked()) { 50 | mergeDrawableStates(drawableState, CHECKED_STATE_SET); 51 | } 52 | return drawableState; 53 | } 54 | 55 | public void toggle() { 56 | setChecked(!mChecked); 57 | } 58 | 59 | public boolean isChecked() { 60 | return mChecked; 61 | } 62 | 63 | public void setChecked(boolean checked) { 64 | if (mChecked != checked) { 65 | mChecked = checked; 66 | int s = getChildCount(); 67 | for (int i = 0; i != s; ++i) { 68 | View v = getChildAt(i); 69 | if (v instanceof Checkable) { 70 | Checkable c = (Checkable)v; 71 | c.setChecked(mChecked); 72 | } 73 | } 74 | refreshDrawableState(); 75 | } 76 | } 77 | } 78 | 79 | -------------------------------------------------------------------------------- /res/layout-land/spendfragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 25 | 26 | 35 | 36 | 40 | 46 | 52 | 53 | 54 | 58 | 59 | 60 | 61 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/NavAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.content.Context; 22 | import android.view.LayoutInflater; 23 | import android.view.View; 24 | import android.view.ViewGroup; 25 | import android.widget.BaseAdapter; 26 | import android.widget.TextView; 27 | import java.text.DateFormat; 28 | import java.util.Date; 29 | 30 | public class NavAdapter extends BaseAdapter { 31 | LayoutInflater mInflater; 32 | Context mCntx; 33 | 34 | public NavAdapter(Context cntx) { 35 | mInflater = LayoutInflater.from(cntx); 36 | mCntx = cntx; 37 | } 38 | 39 | @Override public int getCount() { 40 | return 4; 41 | } 42 | 43 | @Override public Class getItem(int pos) { 44 | return pos == 0 ? EnvelopesFragment.class : 45 | pos == 1 ? AllTransactionsFragment.class : 46 | pos == 2 ? SettingsFragment.class : 47 | pos == 3 ? AboutFragment.class : null; 48 | } 49 | 50 | public String getItemTitle(int pos) { 51 | return pos == 0 ? mCntx.getResources().getString(R.string.app_name) : 52 | pos == 1 ? mCntx.getResources().getString(R.string.allTransactions_menuItem) : 53 | pos == 2 ? mCntx.getResources().getString(R.string.settings_menuItem) : 54 | pos == 3 ? mCntx.getResources().getString(R.string.about_menuItem) : null; 55 | } 56 | 57 | @Override public long getItemId(int pos) { 58 | return pos; 59 | } 60 | 61 | @Override public boolean hasStableIds() { 62 | return true; 63 | } 64 | 65 | @Override public int getItemViewType(int pos) { 66 | return pos > 1 ? 1 : 0; 67 | } 68 | 69 | @Override public int getViewTypeCount() { 70 | return 2; 71 | } 72 | 73 | @Override public View getView(int pos, View conv, ViewGroup cont) { 74 | View retVal; 75 | if (conv == null) { 76 | retVal = mInflater.inflate(pos > 1 ? R.layout.naventry_small : R.layout.naventry, cont, false); 77 | } else { 78 | retVal = conv; 79 | } 80 | TextView text = (TextView) retVal.findViewById(android.R.id.text1); 81 | text.setText(getItemTitle(pos)); 82 | return retVal; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/Util.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.content.Context; 22 | import android.os.Bundle; 23 | import android.util.SparseArray; 24 | import android.util.SparseBooleanArray; 25 | import android.util.SparseIntArray; 26 | import java.io.InputStream; 27 | import java.io.IOException; 28 | import java.io.OutputStream; 29 | import java.util.Iterator; 30 | import java.util.Set; 31 | 32 | public class Util { 33 | public static Bundle packSparseIntArray(SparseIntArray a) { 34 | Bundle b = new Bundle(); 35 | for (int i = 0; i != a.size(); ++i) { 36 | b.putInt(Integer.toString(a.keyAt(i)), a.valueAt(i)); 37 | } 38 | return b; 39 | } 40 | public static SparseIntArray unpackSparseIntArray(Bundle b) { 41 | SparseIntArray a = new SparseIntArray(); 42 | Set k = b.keySet(); 43 | Iterator i = k.iterator(); 44 | while (i.hasNext()) { 45 | String key = i.next(); 46 | a.put(Integer.parseInt(key), b.getInt(key)); 47 | } 48 | return a; 49 | } 50 | public static Bundle packSparseLongArray(SparseArray a) { 51 | Bundle b = new Bundle(); 52 | for (int i = 0; i != a.size(); ++i) { 53 | b.putLong(Integer.toString(a.keyAt(i)), a.valueAt(i)); 54 | } 55 | return b; 56 | } 57 | public static SparseArray unpackSparseLongArray(Bundle b) { 58 | SparseArray a = new SparseArray(); 59 | Set k = b.keySet(); 60 | Iterator i = k.iterator(); 61 | while (i.hasNext()) { 62 | String key = i.next(); 63 | a.put(Integer.parseInt(key), b.getLong(key)); 64 | } 65 | return a; 66 | } 67 | static public int numberOf(SparseBooleanArray items, boolean value) { 68 | if (items == null) return 0; 69 | int retVal = 0; 70 | for (int i = 0; i != items.size(); ++i) { 71 | if (items.get(items.keyAt(i)) == value) 72 | retVal += 1; 73 | } 74 | return retVal; 75 | } 76 | static public void pump(InputStream src, OutputStream dest) throws IOException { 77 | byte[] buf = new byte[2048]; 78 | int len; 79 | while ((len = src.read(buf)) > 0) { 80 | dest.write(buf, 0, len); 81 | } 82 | } 83 | }; 84 | -------------------------------------------------------------------------------- /res/drawable/btn_check_holo_light.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 27 | 28 | 31 | 34 | 35 | 38 | 41 | 42 | 45 | 48 | 49 | 50 | 51 | 52 | 54 | 56 | 57 | 59 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/EditTextDefaultFocus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.app.Activity; 22 | import android.content.Context; 23 | import android.content.res.TypedArray; 24 | import android.graphics.Rect; 25 | import android.text.InputType; 26 | import android.util.AttributeSet; 27 | import android.util.Log; 28 | import android.view.View; 29 | import android.view.ViewGroup; 30 | import android.view.WindowManager; 31 | import android.widget.EditText; 32 | 33 | public class EditTextDefaultFocus extends EditText { 34 | boolean mDefaultFocus; 35 | 36 | public EditTextDefaultFocus(Context cntx) { 37 | super(cntx); 38 | } 39 | public EditTextDefaultFocus(Context cntx, AttributeSet attrs) { 40 | super(cntx, attrs); 41 | setDefaultFocus(attrs.getAttributeBooleanValue("http://schemas.android.com/apk/res/com.notriddle.budget", "defaultFocus", false)); 42 | } 43 | public EditTextDefaultFocus(Context cntx, AttributeSet attrs, 44 | int defStyle) { 45 | super(cntx, attrs, defStyle); 46 | TypedArray a = cntx.obtainStyledAttributes(attrs, R.styleable.EditTextDefaultFocus, defStyle, 0); 47 | setDefaultFocus(a.getBoolean(R.styleable.EditTextDefaultFocus_defaultFocus, false)); 48 | a.recycle(); 49 | } 50 | 51 | @Override protected void onAttachedToWindow() { 52 | super.onAttachedToWindow(); 53 | if (mDefaultFocus) { 54 | if (getContext() instanceof Activity) { 55 | ((Activity)getContext()) 56 | .getWindow() 57 | .setSoftInputMode(WindowManager 58 | .LayoutParams 59 | .SOFT_INPUT_STATE_ALWAYS_VISIBLE); 60 | } 61 | requestFocus(); 62 | } else { 63 | ViewGroup parent = (ViewGroup)getParent(); 64 | //while (parent.getParent() instanceof ViewGroup) { 65 | // parent = (ViewGroup)parent.getParent(); 66 | //} 67 | parent.setFocusableInTouchMode(true); 68 | parent.requestFocus(); 69 | clearFocus(); 70 | } 71 | } 72 | 73 | public void setDefaultFocus(boolean ex) { 74 | Log.d("EditTextDefaultFocus.setDefaultFocus", "ex="+ex); 75 | if (ex) { 76 | requestFocus(); 77 | } else { 78 | clearFocus(); 79 | } 80 | mDefaultFocus = ex; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /res/layout/paycheckactivity.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 11 | 17 | 21 | 27 | 34 | 35 | 36 | 40 | 48 | 56 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/SimpleEnvelopesAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.content.Context; 22 | import android.database.Cursor; 23 | import android.view.LayoutInflater; 24 | import android.view.View; 25 | import android.view.ViewGroup; 26 | import android.widget.SimpleCursorAdapter; 27 | import android.widget.TextView; 28 | 29 | public class SimpleEnvelopesAdapter extends SimpleCursorAdapter { 30 | private int sdkVersion = android.os.Build.VERSION.SDK_INT; 31 | 32 | boolean mExpanded; 33 | static final String[] FROM = new String[] { 34 | "name" 35 | }; 36 | static final int[] TO = new int[] { 37 | android.R.id.text1 38 | }; 39 | public SimpleEnvelopesAdapter(Context cntx, Cursor csr) { 40 | super(cntx, android.R.layout.simple_list_item_1, csr, FROM, TO, 0); 41 | mExpanded = false; 42 | } 43 | public SimpleEnvelopesAdapter(Context cntx, Cursor csr, int layout) { 44 | super(cntx, layout, csr, FROM, TO, 0); 45 | mExpanded = false; 46 | } 47 | public void setExpanded(boolean expanded) { 48 | mExpanded = expanded; 49 | } 50 | @Override public View getView(int pos, View conv, ViewGroup par) { 51 | View retVal = super.getView(pos, conv, par); 52 | if (mExpanded) { 53 | changeColor(pos, retVal); 54 | } 55 | return retVal; 56 | } 57 | @Override public View getDropDownView(int pos, View conv, ViewGroup par) { 58 | View retVal = super.getDropDownView(pos, conv, par); 59 | changeColor(pos, retVal); 60 | return retVal; 61 | } 62 | @Override public View newDropDownView(Context cntx, Cursor csr, 63 | ViewGroup parent) { 64 | View retVal = LayoutInflater.from(cntx).inflate( 65 | android.R.layout.simple_spinner_dropdown_item, 66 | parent, 67 | false 68 | ); 69 | bindView(retVal, cntx, csr); 70 | return retVal; 71 | } 72 | private void changeColor(int pos, View change) { 73 | Cursor csr = getCursor(); 74 | csr.moveToPosition(pos); 75 | int color = csr.getInt(csr.getColumnIndexOrThrow("color")); 76 | if(sdkVersion < android.os.Build.VERSION_CODES.JELLY_BEAN) { 77 | change.setBackgroundDrawable(EnvelopesAdapter.getColorStateDrawable(color)); 78 | } else { 79 | change.setBackground(EnvelopesAdapter.getColorStateDrawable(color)); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /res/values-de/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Budget 4 | Über 5 | Über Budgets with Envelopes 6 | Alle Transaktionen 7 | Alle Transaktionen 8 | Farbe ändern 9 | Rechnungen 10 | Nahrung 11 | Kleidung 12 | Verspätet 13 | Gelöscht 14 | Beschreibung 15 | Spenden an Michael (Entwickler der App) 16 | Navigation schließen 17 | Navigation öffnen 18 | Einnahmen 19 | Einnahmen 20 | Bearbeiten 21 | Rechnungsabschluss 22 | Umschlag 23 | Name des Umschlages 24 | Exportiere… 25 | Export 26 | Finanzdaten sichern 27 | × 28 | Graphische Darstellung 29 | Graphische Darstellung 30 | Zeit 31 | Importiere… 32 | Import 33 | Finanzdaten rücksichern 34 | Lade 35 | Neuer Umschlag 36 | OK 37 | Eingang 38 | Ordnen Sie Ihre Einnahmen↑ unterschiedlichen Verwendungszwecken zu ↓ 39 | Einnahme 40 | Einnahme 41 | Verteilen 42 | Geben Sie Ihre PIN ein 43 | Freischalten 44 | Freigeschaltet. Tippen um zu blockieren. 45 | PIN 46 | Lassen Sie das Feld leer, wenn Sie keine PIN-Sicherung verwenden wolllen. 47 | Versuchen Sie es nocheinmal. 48 | Wiederholen 49 | Einstellungen 50 | Einstellungen 51 | Ausgaben 52 | Ausgaben 53 | an 54 | Übertragen 55 | Übertragen 56 | Rückgängig 57 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/AboutFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.app.Fragment; 22 | import android.content.Intent; 23 | import android.net.Uri; 24 | import android.os.AsyncTask; 25 | import android.os.Bundle; 26 | import android.text.Html; 27 | import android.view.LayoutInflater; 28 | import android.view.Menu; 29 | import android.view.MenuInflater; 30 | import android.view.MenuItem; 31 | import android.view.View; 32 | import android.view.ViewGroup; 33 | import android.widget.TextView; 34 | import java.io.ByteArrayOutputStream; 35 | import java.io.InputStream; 36 | 37 | public class AboutFragment extends Fragment 38 | implements View.OnClickListener, 39 | TitleFragment { 40 | 41 | @Override public View onCreateView(LayoutInflater inflater, ViewGroup cont, 42 | Bundle state) { 43 | View retVal = inflater.inflate(R.layout.aboutactivity, cont, false); 44 | 45 | TextView txt = (TextView) retVal.findViewById(R.id.aboutText); 46 | try { 47 | txt.setText(String.format(txt.getText().toString(), getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0).versionName)); 48 | } catch (Throwable e) { 49 | throw new Error(e); 50 | } 51 | txt = (TextView) retVal.findViewById(R.id.donateButton); 52 | txt.setOnClickListener(this); 53 | final TextView gplView = (TextView) retVal.findViewById(R.id.gplText); 54 | (new AsyncTask() { 55 | protected CharSequence doInBackground(Object... o) { 56 | try { 57 | InputStream gplStream 58 | = getActivity().getResources().getAssets().open("gpl.html"); 59 | ByteArrayOutputStream gplBytes = new ByteArrayOutputStream( 60 | gplStream.available() 61 | ); 62 | Util.pump(gplStream, gplBytes); 63 | return Html.fromHtml( 64 | new String(gplBytes.toByteArray(), "ASCII") 65 | ); 66 | } catch (Throwable e) { 67 | return e.toString(); 68 | } 69 | } 70 | protected void onPostExecute(CharSequence result) { 71 | gplView.setText(result); 72 | } 73 | }).execute(); 74 | 75 | return retVal; 76 | } 77 | 78 | @Override public void onClick(View v) { 79 | startActivity(new Intent( 80 | Intent.ACTION_VIEW, 81 | Uri.parse("https://www.notriddle.com/donate/") 82 | )); 83 | } 84 | 85 | @Override public String getTitle() { 86 | return getActivity().getString(R.string.about_name); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/EnvelopesAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.content.Context; 22 | import android.database.Cursor; 23 | import android.graphics.drawable.ColorDrawable; 24 | import android.graphics.drawable.Drawable; 25 | import android.graphics.drawable.StateListDrawable; 26 | import android.view.LayoutInflater; 27 | import android.view.View; 28 | import android.view.ViewGroup; 29 | import android.widget.CursorAdapter; 30 | import android.widget.TextView; 31 | 32 | public class EnvelopesAdapter extends CursorAdapter { 33 | LayoutInflater mInflater; 34 | 35 | private int sdkVersion = android.os.Build.VERSION.SDK_INT; 36 | 37 | public EnvelopesAdapter(Context cntx, Cursor csr) { 38 | super(cntx, csr, 0); 39 | mInflater = LayoutInflater.from(cntx); 40 | } 41 | 42 | private static class CardContents { 43 | public CardContents(View v) { 44 | name = (TextView) v.findViewById(R.id.name); 45 | value = (TextView) v.findViewById(R.id.value); 46 | parent = v; 47 | } 48 | public View parent; 49 | public TextView name; 50 | public TextView value; 51 | }; 52 | 53 | @Override public void bindView(View v, Context cntx, Cursor csr) { 54 | CardContents contents = (CardContents) v.getTag(); 55 | fillCardContents(cntx, contents, csr); 56 | } 57 | 58 | @Override public View newView(Context cntx, Cursor csr, ViewGroup par) { 59 | View retVal = mInflater.inflate(R.layout.card, par, false); 60 | CardContents contents = new CardContents(retVal); 61 | retVal.setTag(contents); 62 | fillCardContents(cntx, contents, csr); 63 | return retVal; 64 | } 65 | 66 | private void fillCardContents(Context cntx, CardContents contents, Cursor csr) { 67 | contents.name.setText(csr.getString(csr.getColumnIndexOrThrow("name"))); 68 | long cents = csr.getLong(csr.getColumnIndexOrThrow("cents")); 69 | contents.value.setText(EditMoney.toColoredMoney(cntx, cents)); 70 | int color = csr.getInt(csr.getColumnIndexOrThrow("color")); 71 | if(sdkVersion < android.os.Build.VERSION_CODES.JELLY_BEAN) { 72 | contents.name.setBackgroundDrawable(getColorStateDrawable(color)); 73 | } else { 74 | contents.name.setBackground(getColorStateDrawable(color)); 75 | } 76 | 77 | } 78 | 79 | public static Drawable getColorStateDrawable(int color) { 80 | StateListDrawable retVal = new StateListDrawable(); 81 | Drawable normal = new ColorDrawable(color); 82 | Drawable superS = new ColorDrawable(0xFF99CC00); 83 | Drawable select = new ColorDrawable(0x8899CC00); 84 | retVal.addState(new int[] {android.R.attr.state_pressed}, select); 85 | retVal.addState(new int[] {android.R.attr.state_focused}, select); 86 | retVal.addState(new int[] {android.R.attr.state_checked}, superS); 87 | retVal.addState(new int[] {android.R.attr.state_selected}, select); 88 | retVal.addState(new int[0], normal); 89 | return retVal; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 40 | 41 | 45 | 48 | 52 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /res/values-fr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | Budget 9 | Supprimé 10 | Annuler 11 | Enveloppe 12 | Balance 13 | Nouvelle enveloppe 14 | Changer la couleur 15 | Nom de l'enveloppe 16 | Gain 17 | Gain 18 | Distribué 19 | Chèque 20 | Put your earnings ↑ to various uses ↓ 21 | Gain 22 | Gain 23 | Dépense 24 | Dépense 25 | Éditer 26 | Transférer 27 | Tranférer 28 | vers 29 | Factures 30 | Nourriture 31 | Vêtements 32 | OK 33 | Description 34 | 00.00 35 | × 36 | Chargment 37 | Montrer le graphe 38 | Cacher le graphe 39 | Toutes les transactions 40 | Toutes les transactions 41 | Exportation… 42 | Exporter 43 | Sauvegarder les données financières 44 | Importation… 45 | Importer 46 | Restaurer les données financières 47 | Reporté 48 | À propos 49 | À propos de Budget with Envelopes 50 | Donner à Michael 51 | Version %s de Budget\n© 2013 Michael Howell <michael@notriddle.com>\n\n 52 | 53 | Budget est un logiciel libre, vous pouvez le redistribuer et/ou le modifier 54 | selon les termes de la Licence Publique Générale GNU telle que publiée 55 | par la Free Software Foundation, version 3 ou ultérieure.\n\n 56 | 57 | Ce programme est distribué en espérant qu'il sera utile, 58 | mais SANS GARANTIE AUCUNE; ni implicite ni explicite, 59 | y compris les garanties de commercialisations ou 60 | d'adaptation dans un but spécifique. Voir la Licence Publique 61 | Générale GNU pour plus de détails. 62 | 63 | Déverouiller 64 | Entrez votre PIN 65 | Raté, un autre essaie ? 66 | PIN 67 | Laissez vide si vous n\'en avez pas besoin 68 | Paramètres 69 | Paramètres 70 | Déverouillé. Tapez pour verouiller. 71 | Temps 72 | 73 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/AllTransactionsFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.app.Fragment; 22 | import android.app.LoaderManager; 23 | import android.app.LoaderManager.LoaderCallbacks; 24 | import android.content.Intent; 25 | import android.content.Loader; 26 | import android.database.Cursor; 27 | import android.os.Bundle; 28 | import android.view.LayoutInflater; 29 | import android.view.MenuItem; 30 | import android.view.View; 31 | import android.view.ViewGroup; 32 | import android.widget.AdapterView; 33 | import android.widget.ListView; 34 | 35 | public class AllTransactionsFragment extends Fragment 36 | implements LoaderCallbacks, 37 | AdapterView.OnItemClickListener, 38 | TitleFragment { 39 | LogAdapter mAdapter; 40 | ListView mListView; 41 | 42 | @Override public void onCreate(Bundle state) { 43 | super.onCreate(state); 44 | } 45 | 46 | @Override public View onCreateView(LayoutInflater inflater, ViewGroup cont, 47 | Bundle state) { 48 | View retVal = inflater.inflate(R.layout.alltransactionsactivity, cont, false); 49 | mListView = (ListView) retVal.findViewById(android.R.id.list); 50 | mAdapter = new LogAdapter(getActivity(), null); 51 | mListView.setAdapter(mAdapter); 52 | mListView.setOnItemClickListener(this); 53 | getLoaderManager().initLoader(0, null, this); 54 | return retVal; 55 | } 56 | 57 | @Override public Loader onCreateLoader(int id, Bundle args) { 58 | String time = Long.toString(System.currentTimeMillis()-5184000000l); 59 | SQLiteLoader retVal = new SQLiteLoader( 60 | getActivity(), 61 | new EnvelopesOpenHelper(getActivity()), 62 | "SELECT e.name AS envelope, e.color AS color, l.description AS description, l.cents AS cents, l.time AS time, l._id AS _id, e._id AS envelope_id FROM log AS l LEFT JOIN envelopes AS e ON (e._id = l.envelope) ORDER BY l.time * -1" 63 | ); 64 | retVal.setNotificationUri(EnvelopesOpenHelper.URI); 65 | return retVal; 66 | } 67 | 68 | @Override public void onLoadFinished(Loader ldr, Cursor data) { 69 | mAdapter.changeCursor(data); 70 | } 71 | 72 | @Override public void onLoaderReset(Loader ldr) { 73 | // Do nothing. 74 | } 75 | 76 | @Override public void onItemClick(AdapterView a, View v, int pos, long id) { 77 | Cursor csr = mAdapter.getCursor(); 78 | csr.moveToPosition(pos); 79 | int envelopeId = csr.getInt(csr.getColumnIndexOrThrow("envelope_id")); 80 | 81 | Bundle args = new Bundle(); 82 | args.putInt("com.notriddle.budget.envelope", envelopeId); 83 | args.putInt("com.notriddle.budget.transaction", (int)id); 84 | ((EnvelopesActivity)getActivity()).switchFragment( 85 | EnvelopeDetailsFragment.class, 86 | "EnvelopeDetailsFragment", 87 | args 88 | ); 89 | } 90 | 91 | @Override public String getTitle() { 92 | return getActivity().getString(R.string.allTransactions_name); 93 | } 94 | }; 95 | 96 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/FileCreatorFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.app.Activity; 22 | import android.app.DialogFragment; 23 | import android.app.ProgressDialog; 24 | import android.content.ContentValues; 25 | import android.content.Context; 26 | import android.content.Intent; 27 | import android.content.Loader; 28 | import android.database.Cursor; 29 | import android.database.sqlite.SQLiteDatabase; 30 | import android.net.Uri; 31 | import android.os.AsyncTask; 32 | import android.os.Bundle; 33 | import android.os.Environment; 34 | import android.widget.Toast; 35 | import com.notriddle.budget.csv.CSVWriter; 36 | import java.io.FileWriter; 37 | import java.io.File; 38 | 39 | public abstract class FileCreatorFragment extends DialogFragment { 40 | @Override public void onActivityCreated(Bundle state) { 41 | super.onActivityCreated(state); 42 | Uri dest = Uri.fromFile(new File( 43 | Environment.getExternalStorageDirectory(), 44 | "budget.csv" 45 | )); 46 | Intent i = new Intent("org.openintents.action.PICK_FILE"); 47 | i.putExtra("org.openintents.extra.TITLE", 48 | getActivity().getString(getButtonTitle())); 49 | i.setData(dest); 50 | if (getActivity().getPackageManager() 51 | .queryIntentActivities(i, 0).size() == 0) { 52 | act(dest); 53 | } else { 54 | startActivityForResult(i, 42); 55 | } 56 | } 57 | 58 | @Override public void onActivityResult(int req, int res, Intent data) { 59 | if (req == 42) { 60 | if (res == Activity.RESULT_OK) { 61 | act(data.getData()); 62 | } else { 63 | dismiss(); 64 | } 65 | } else { 66 | super.onActivityResult(req, res, data); 67 | } 68 | } 69 | 70 | private void act(Uri uri) { 71 | ProgressDialog prog = (ProgressDialog) getDialog(); 72 | prog.setMessage(uri.getPath()); 73 | (new AsyncTask() { 74 | protected Throwable doInBackground(Uri... dests) { 75 | try { 76 | perform(dests[0]); 77 | return null; 78 | } catch (Throwable e) { 79 | return e; 80 | } 81 | } 82 | protected void onPostExecute(Throwable e) { 83 | dismiss(); 84 | if (e != null) { 85 | Toast.makeText( 86 | getActivity(), 87 | e.toString(), 88 | Toast.LENGTH_LONG 89 | ).show(); 90 | } 91 | } 92 | }).execute(uri); 93 | } 94 | 95 | abstract protected void perform(Uri uri) throws Throwable; 96 | abstract protected int getButtonTitle(); 97 | abstract protected int getDialogTitle(); 98 | 99 | @Override public ProgressDialog onCreateDialog(Bundle state) { 100 | ProgressDialog retVal = new ProgressDialog(getActivity()); 101 | retVal.setTitle(getActivity().getString(getDialogTitle())); 102 | return retVal; 103 | } 104 | }; 105 | 106 | -------------------------------------------------------------------------------- /res/values-pt-rBR/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | Orçamento 22 | Deletado 23 | Desfazer 24 | Envelope 25 | Saldo 26 | Novo envelope 27 | Mudar de cor 28 | Nome 29 | Ganhar 30 | Ganhar 31 | Distribuído 32 | Salário 33 | Coloque seus ganhos ↑ a vários usos ↓ 34 | Ganhar 35 | Ganhar 36 | Gastar 37 | Gastar 38 | Editar 39 | Transferir 40 | Transferir 41 | a 42 | Contas 43 | Alimentos 44 | Vestuário 45 | Aceitar 46 | Descripção 47 | 00.00 48 | × 49 | Carregando 50 | Gráfico 51 | Gráfico 52 | Todas as transacções 53 | Todas as transacções 54 | Exportando… 55 | Exportar 56 | Backup de dados financeiros 57 | Importando… 58 | Importar 59 | Restauração de dados financeiros 60 | Diferido 61 | Sobre 62 | Sobre Orçamento com envelopes 63 | Doe a Michael 64 | Orçamento versão %s\n© 2013 Michael Howell <michael@notriddle.com>\n© 2013 Melinda Howell <melinda@smhowell.net>\n\n 65 | 66 | Este programa é um software livre; você pode redistribui-lo e/ou modificá-lo sob os termos da Licença Pública Geral GNU, como publicada pela Free Software Foundation; pela versão 3 da Licença, ou (a seu critério) por qualquer versão posterior.\n\n 67 | 68 | Este programa é distribuído na esperança de que seja útil, mas SEM QUALQUER GARANTIA; sem mesmo garantias implícitas de COMERCIALIZAÇÃO ou de ADEQUAÇÃO A PROPÓSITO PARTICULAR. Veja a Licença Pública Geral GNU para mais detalhes. 69 | Desbloquear 70 | Insire o seu PIN 71 | Intente de novo. 72 | PIN 73 | Deixe o campo vazio se não precisa isto 74 | Configurações 75 | Configurações 76 | Desbloqueado. Toque para desbloquear. 77 | Hora 78 | 79 | -------------------------------------------------------------------------------- /res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | Presupuesto 23 | Eliminado 24 | Deshacer 25 | Sobre 26 | Balance 27 | Nuevo sobre 28 | Cambiar color 29 | Nombre 30 | Ingreso 31 | Añadir ingreso 32 | Distribuidos 33 | Sueldo 34 | Distribuye tus ingresos ↑ en sobres para varios usos ↓ 35 | Ingreso 36 | Añadir ingreso 37 | Gasto 38 | Añadir gasto 39 | Editar 40 | Transferir 41 | Transferir 42 | a 43 | Facturas 44 | Alimentos 45 | Vestimenta 46 | Aceptar 47 | Descripción 48 | 00.00 49 | × 50 | Cargando 51 | Gráfico 52 | Gráfico 53 | Todas las transacciones 54 | Todas las transacciones 55 | Exportando… 56 | Exportar 57 | Copie los datos financieros 58 | Importando… 59 | Importar 60 | Restaurar los datos financieros 61 | Diferido 62 | Acerca de 63 | Acerca de Presupuesto con Sobres 64 | Donar a Michael 65 | Presupuesto versión %s\n© 2013 Michael Howell <michael@notriddle.com>\n© 2013 Emilio López <emilio@elopez.com.ar>\n\n 66 | 67 | Presupuesto es software libre: puede redistribuirlo y/o modificarlo 68 | bajo los términos de la Licencia General Pública de GNU publicada por la 69 | Free Software Foundation, ya sea la versión 3 de la Licencia, o (a su 70 | elección) cualquier versión posterior.\n\n 71 | 72 | Este programa se distribuye con la esperanza de que sea útil pero SIN 73 | NINGUNA GARANTÍA; incluso sin la garantía implícita de MERCANTIBILIDAD o 74 | CALIFICADA PARA UN PROPÓSITO EN PARTICULAR. Vea la Licencia General 75 | Pública de GNU para más detalles. 76 | Desbloquear 77 | Ingrese su PIN 78 | Intente nuevamente. 79 | PIN 80 | Deje el campo vacío si no necesita esto 81 | Ajustes 82 | Ajustes 83 | Desbloqueado. Toque para bloquear. 84 | Fecha 85 | 86 | -------------------------------------------------------------------------------- /res/values-ru/strings.xml: -------------------------------------------------------------------------------- 1 | 20 | 21 | Бюджет 22 | Удалено 23 | Отмена 24 | Конверт 25 | Баланс 26 | Новый конверт 27 | Изменить цвет 28 | Название конверта 29 | Приход 30 | Приход 31 | Distributed 32 | Paycheck 33 | Распределите свои доходы ↑по различным расходам ↓ 34 | Приход 35 | Приход 36 | Расход 37 | Расход 38 | Правка 39 | Перевод 40 | Перевод 41 | в 42 | Квартплата 43 | Еда 44 | Одежда 45 | OK 46 | Описание 47 | 00.00 48 | × 49 | Загрузка 50 | график 51 | график 52 | Все операции 53 | Все операции 54 | Экспортировать… 55 | Экспорт 56 | Резервное копирование Ваших финансовых данных 57 | Импортировать… 58 | Импорт 59 | Восстановление из резерва Ваших финансовых данных 60 | Отложено 61 | О программе 62 | О программе Бюджет с Конвертами 63 | Пожертвуйте Michael Howell 64 | Программа бюджет версия %s\n© 2013 Michael Howell<michael@notriddle.com>\n\n 65 | Программа бюджет является свободным программным обеспечением. 66 | Вы можете распространять и/или изменять ее в соответствии с условиями 67 | общественной лицензии GNU , опубликованной Фондом свободного 68 | программного обеспечения версии 3, либо (по вашему выбору ) 69 | любой более поздней версии.\n\n 70 | 71 | Программа бюджет распространяется в надежде, что она будет полезной, 72 | но БЕЗ ВСЯКИХ ГАРАНТИЙ, даже без подразумеваемых гарантий 73 | Или ПРИМЕНИМОСТИ ДЛЯ КОНКРЕТНЫХ ЦЕЛЕЙ. Читайте 74 | GNU General Public License для более подробной информации. 75 | 76 | 77 | Разблокировать 78 | Введите ПИН 79 | Попробуйте еще раз 80 | ПИН 81 | Оставьте пустым, если не хотите использовать 82 | Настройки 83 | Настройки 84 | Разблокированно. Нажмите для блокировки. 85 | Время 86 | 87 | 88 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/SQLiteLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.content.AsyncTaskLoader; 22 | import android.content.Context; 23 | import android.database.ContentObserver; 24 | import android.database.Cursor; 25 | import android.database.sqlite.*; 26 | import android.net.Uri; 27 | 28 | public class SQLiteLoader extends AsyncTaskLoader { 29 | Context mCntx; 30 | SQLiteDatabase mDatabase; 31 | String mTable; 32 | String[] mColumns; 33 | String mSelection; 34 | String[] mSelectionArgs; 35 | String mGroupBy; 36 | String mHaving; 37 | String mOrderBy; 38 | String mLimit; 39 | Cursor mResults; 40 | String mRawQuery; 41 | ContentObserver mObserver; 42 | Uri mNotificationUri; 43 | 44 | public SQLiteLoader(Context cntx, SQLiteOpenHelper helper, String table, 45 | String[] columns, String selection, String[] args, 46 | String groupBy, String having, String orderBy, 47 | String limit) { 48 | super(cntx); 49 | mCntx = cntx; 50 | mDatabase = helper.getReadableDatabase(); 51 | mTable = table; 52 | mColumns = columns; 53 | mSelection = selection; 54 | mSelectionArgs = args; 55 | mGroupBy = groupBy; 56 | mHaving = having; 57 | mOrderBy = orderBy; 58 | mLimit = limit; 59 | mObserver = new ForceLoadContentObserver(); 60 | } 61 | 62 | public SQLiteLoader(Context cntx, SQLiteOpenHelper helper, 63 | String rawQuery) { 64 | super(cntx); 65 | mCntx = cntx; 66 | mDatabase = helper.getReadableDatabase(); 67 | mRawQuery = rawQuery; 68 | mObserver = new ForceLoadContentObserver(); 69 | } 70 | 71 | public SQLiteLoader(Context cntx, SQLiteOpenHelper helper, String table, 72 | String[] columns, String selection, String[] args, 73 | String groupBy, String having, String orderBy) { 74 | this(cntx, helper, table, columns, selection, args, groupBy, having, orderBy, null); 75 | } 76 | 77 | public SQLiteLoader(Context cntx, SQLiteOpenHelper helper, String table, 78 | String[] columns, String selection, String[] args) { 79 | this(cntx, helper, table, columns, selection, args, null, null, null, null); 80 | } 81 | 82 | public SQLiteLoader(Context cntx, SQLiteOpenHelper helper, String table, 83 | String[] columns) { 84 | this(cntx, helper, table, columns, null, null, null, null, null, null); 85 | } 86 | 87 | public void setNotificationUri(Uri uri) { 88 | mNotificationUri = uri; 89 | if (mResults != null) { 90 | mResults.setNotificationUri(mCntx.getContentResolver(), uri); 91 | } 92 | } 93 | 94 | @Override public synchronized Cursor loadInBackground() { 95 | if (mResults != null) { 96 | mResults.unregisterContentObserver(mObserver); 97 | } 98 | mResults = mRawQuery == null 99 | ? mDatabase.query( 100 | mTable, mColumns, mSelection, mSelectionArgs, 101 | mGroupBy, mHaving, mOrderBy, mLimit 102 | ) 103 | : mDatabase.rawQuery( 104 | mRawQuery, null 105 | ); 106 | mResults.registerContentObserver(mObserver); 107 | if (mNotificationUri != null) { 108 | mResults.setNotificationUri(mCntx.getContentResolver(), mNotificationUri); 109 | } 110 | return mResults; 111 | } 112 | 113 | @Override public synchronized void onStartLoading() { 114 | forceLoad(); 115 | } 116 | 117 | @Override public synchronized void abandon() { 118 | super.abandon(); 119 | mResults.unregisterContentObserver(mObserver); 120 | mResults = null; 121 | mDatabase.close(); 122 | } 123 | } 124 | 125 | -------------------------------------------------------------------------------- /res/values-ar/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | الميزانية 22 | تمت إزالته 23 | الغاء 24 | ظرف 25 | رصيد 26 | ظرف جديد 27 | غير اللون 28 | إسم الظرف 29 | إكسب 30 | إكسب 31 | موزع 32 | صك القبض 33 | قم بوضع أرباحك ↑ في إستعمالات متعددة ↓ 34 | إكسب 35 | إكسب 36 | أصرف 37 | أصرف 38 | عدل 39 | حول 40 | حول 41 | الى 42 | المصاريف 43 | الأكل 44 | الملابس 45 | حسنا 46 | الوصف 47 | 00.00 48 | × 49 | تحميل 50 | رسم بياني 51 | رسم بياني 52 | كل المعاملات 53 | كل المعاملات 54 | فتح الملاحة 55 | إغلاق الملاحة 56 | إستخراج… 57 | إستخرج 58 | نسخ إحتياطي للبيانات المالية 59 | إستيراد… 60 | إستورد 61 | إستعادة البيانات المالية 62 | مؤجل 63 | كرر 64 | 65 | يومي 66 | أسبوعي 67 | مرة كل اسبوعين 68 | شهري 69 | ربع سنوي 70 | سنوي 71 | 72 | حول 73 | حول الميزانية بالظروف 74 | تبرع الى مايكل(الكاتب الأصلي للبرنامج) 75 | Budget version %s\n© 2013 Michael Howell <michael@notriddle.com>\n\n 76 | 77 | الميزانية هو برنامج حر: يمكنك إعادة توزيعه و / أو تعديله 78 | بموجب شروط رخصة جنو العمومية كما نشرتها 79 | مؤسسة البرمجيات الحرة ، إما الإصدار 3 من الترخيص ، أو 80 | (حسب اختيارك) أي إصدار لاحق.\n\n 81 | 82 | يتم توزيع الميزانية على أمل أن يكون مفيد ، 83 | ولكن دون أي ضمانات ؛ دون حتى الضمان الضمني 84 | قابلية التسويق أو الملاءمة لغرض معين. انظر 85 | رخصة جنو العمومية العامة لمزيد من التفاصيل. 86 | 87 | فتح 88 | إرخال الرمز 89 | إعادة المحاولة 90 | الرمز 91 | دعه فارغ ان لم تحتاجه 92 | الإعدادات 93 | الإعدادات 94 | تم الفتح. إضغط للقفل. 95 | الوقت 96 | 97 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/EditMoney.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.content.Context; 22 | import android.graphics.Rect; 23 | import android.text.InputType; 24 | import android.text.SpannableString; 25 | import android.text.SpannableStringBuilder; 26 | import android.text.style.ForegroundColorSpan; 27 | import android.util.AttributeSet; 28 | import android.view.View; 29 | import android.widget.EditText; 30 | import java.io.IOException; 31 | 32 | public class EditMoney extends EditText { 33 | public EditMoney(Context cntx) { 34 | super(cntx); 35 | init(); 36 | } 37 | public EditMoney(Context cntx, AttributeSet attrs) { 38 | super(cntx, attrs); 39 | init(); 40 | } 41 | public EditMoney(Context cntx, AttributeSet attrs, int defStyle) { 42 | super(cntx, attrs, defStyle); 43 | init(); 44 | } 45 | 46 | private void init() { 47 | setInputType(InputType.TYPE_CLASS_NUMBER|InputType.TYPE_NUMBER_FLAG_DECIMAL); 48 | } 49 | 50 | public long getCents() { 51 | return EditMoney.toCents(getText().toString()); 52 | } 53 | public void setCents(long cents) { 54 | setText(cents == 0 ? "" : EditMoney.toMoney(cents)); 55 | } 56 | 57 | @Override public void onFocusChanged(boolean focus, int dir, Rect prev) { 58 | super.onFocusChanged(focus, dir, prev); 59 | if (!focus) { 60 | setCents(getCents()); 61 | } 62 | } 63 | 64 | public static Appendable toMoneyBuilder(long cents, Appendable builder) { 65 | try { 66 | if (cents < 0) { 67 | builder.append("-"); 68 | cents = -cents; 69 | } 70 | long dollarPart = cents/100; 71 | int centPart = (int)(cents - (dollarPart*100)); 72 | if (dollarPart < 10) { 73 | builder.append("0"); 74 | } 75 | builder.append(Long.toString(dollarPart)); 76 | builder.append(centPart < 10 ? ".0" : "."); 77 | builder.append(Integer.toString(centPart)); 78 | return builder; 79 | } catch (IOException e) { 80 | throw new Error(e); 81 | } 82 | } 83 | public static SpannableStringBuilder 84 | toColoredMoneyBuilder(Context cntx, long cents, 85 | SpannableStringBuilder builder) { 86 | toMoneyBuilder(cents, builder); 87 | if (cents < 0) { 88 | builder.setSpan(new ForegroundColorSpan(cntx.getResources().getColor(R.color.badForeground)), 0, builder.length(), SpannableStringBuilder.SPAN_INCLUSIVE_EXCLUSIVE); 89 | } 90 | return builder; 91 | } 92 | public static CharSequence toColoredMoney(Context cntx, long cents) { 93 | return toColoredMoneyBuilder(cntx, cents, new SpannableStringBuilder()); 94 | } 95 | public static CharSequence toMoney(long cents) { 96 | return toMoneyBuilder(cents, new StringBuilder(5)).toString(); 97 | } 98 | public static long toCents(String money) { 99 | String dollars = money.replaceAll("[^0-9\\.]", ""); 100 | if (dollars.equals("")) dollars = "0"; 101 | if (dollars.indexOf(".") == -1) { 102 | return Long.parseLong(dollars)*100; 103 | } else { 104 | int digitsAfterPoint = dollars.length()-(dollars.indexOf(".")+1); 105 | int placesFromCents = digitsAfterPoint-2; 106 | String cents = dollars.replaceAll("\\.",""); 107 | if (placesFromCents < 0) { 108 | StringBuilder zeroes = new StringBuilder(-placesFromCents); 109 | for (int i = 0; i != -placesFromCents; ++i) { 110 | zeroes.append("0"); 111 | } 112 | cents = cents + zeroes; 113 | } else { 114 | cents = cents.substring(0, cents.length()-placesFromCents); 115 | } 116 | return Long.parseLong(cents) * (money.charAt(0) == '-' ? -1 : 1); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | Budget 23 | Deleted 24 | Undo 25 | Envelope 26 | Balance 27 | New envelope 28 | Change color 29 | Envelope name 30 | Earn 31 | Earn 32 | Distributed 33 | Paycheck 34 | Put your earnings ↑ to various uses ↓ 35 | Earn 36 | Earn 37 | Spend 38 | Spend 39 | Edit 40 | Transfer 41 | Transfer 42 | to 43 | Bills 44 | Food 45 | Clothes 46 | OK 47 | Description 48 | 00.00 49 | × 50 | Loading 51 | Graph 52 | Graph 53 | All transactions 54 | All transactions 55 | Open navigation 56 | Close navigation 57 | Exporting… 58 | Export 59 | Back up financial data 60 | Importing… 61 | Import 62 | Restore financial data 63 | Delayed 64 | Repeat 65 | 66 | Daily 67 | Weekly 68 | Fortnightly 69 | Monthly 70 | Quarterly 71 | Yearly 72 | 73 | About 74 | About Budget with Envelopes 75 | Donate to Michael 76 | Budget version %s\n© 2013 Michael Howell <michael@notriddle.com>\n\n 77 | 78 | Budget is free software: you can redistribute it and/or modify 79 | it under the terms of the GNU General Public License as published by 80 | the Free Software Foundation, either version 3 of the License, or 81 | (at your option) any later version.\n\n 82 | 83 | Budget is distributed in the hope that it will be useful, 84 | but WITHOUT ANY WARRANTY; without even the implied warranty of 85 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 86 | GNU General Public License for more details. 87 | 88 | Unlock 89 | Enter your PIN 90 | Try again 91 | PIN 92 | Leave empty if you don\'t need this 93 | Settings 94 | Settings 95 | Unlocked. Tap to lock. 96 | Time 97 | 98 | -------------------------------------------------------------------------------- /pictures/ic_launcher_hires.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 23 | 26 | 27 | 28 | 46 | 48 | 49 | 51 | image/svg+xml 52 | 54 | 55 | 56 | 57 | 58 | 63 | 68 | 71 | 77 | 82 | 89 | 96 | 103 | 109 | 115 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /res/values-nl/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | Budget 23 | Verwijderd 24 | Ongedaan maken 25 | Envelop 26 | Saldo 27 | Nieuwe envelop 28 | Kleur wijzigen 29 | Envelopnaam 30 | Verdiensten 31 | Verdiensten 32 | Uitgegeven 33 | Salarisstrook 34 | Doe iets goeds ↑ met je verdiensten ↓ 35 | Verdiensten 36 | Verdiensten 37 | Uitgaven 38 | Uitgaven 39 | Bewerken 40 | Verplaatsen 41 | Verplaatsen 42 | naar 43 | Rekeningen 44 | Eten en drinken 45 | Kleding 46 | Oké 47 | Omschrijving 48 | 00,00 49 | × 50 | Bezig met laden... 51 | Grafiek 52 | Grafiek 53 | Alle transacties 54 | Alle transacties 55 | Navigatie openen 56 | Navigatie sluiten 57 | Bezig met exporteren...… 58 | Exporteren 59 | Financiële gegevens back-uppen 60 | Bezig met impoteren...… 61 | Importeren 62 | Financiële gegevens back-uppen 63 | Uitstellen 64 | Herhalen 65 | 66 | Iedere dag 67 | Iedere week 68 | Iedere twee weken 69 | Iedere maand 70 | Ieder kwartaal 71 | Ieder jaar 72 | 73 | Over 74 | Over Budget met vnveloppen 75 | Doneren aan Michael 76 | Budget, versie %s\n© 2013 Michael Howell <michael@notriddle.com>\n\n 77 | 78 | Budget is free software: you can redistribute it and/or modify 79 | it under the terms of the GNU General Public License as published by 80 | the Free Software Foundation, either version 3 of the License, or 81 | (at your option) any later version.\n\n 82 | 83 | Budget is distributed in the hope that it will be useful, 84 | but WITHOUT ANY WARRANTY; without even the implied warranty of 85 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 86 | GNU General Public License for more details. 87 | 88 | Ontgrendelen 89 | Voer je pincode in 90 | Opnieuw proberen 91 | Pincode 92 | Laat leeg om dit niet te gebruiken 93 | Instellingen 94 | Instellingen 95 | Ontgrendeld; raak aan om te vergrendelen. 96 | Tijd 97 | 98 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/WidgetService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.appwidget.AppWidgetManager; 22 | import android.appwidget.AppWidgetProvider; 23 | import android.content.Context; 24 | import android.content.Intent; 25 | import android.database.ContentObserver; 26 | import android.database.Cursor; 27 | import android.database.sqlite.SQLiteDatabase; 28 | import android.net.Uri; 29 | import android.os.Bundle; 30 | import android.os.Handler; 31 | import android.os.Looper; 32 | import android.util.Log; 33 | import android.widget.RemoteViews; 34 | import android.widget.RemoteViewsService; 35 | 36 | public class WidgetService extends RemoteViewsService { 37 | @Override public RemoteViewsFactory onGetViewFactory(Intent i) { 38 | final int widgetId = i.getIntExtra( 39 | AppWidgetManager.EXTRA_APPWIDGET_ID, 40 | -1 41 | ); 42 | return new RemoteViewsFactory() { 43 | Cursor csr; 44 | SQLiteDatabase db; 45 | ContentObserver obs; 46 | public void onCreate() { 47 | Log.d("Budget", "WidgetService.onCreate()"); 48 | db = (new EnvelopesOpenHelper(WidgetService.this)) 49 | .getReadableDatabase(); 50 | csr = db.rawQuery("SELECT name, cents, _id, color FROM envelopes ORDER BY name", null); 51 | csr.setNotificationUri( 52 | getContentResolver(), 53 | EnvelopesOpenHelper.URI 54 | ); 55 | obs = new ContentObserver(new Handler(Looper.getMainLooper())) { 56 | public void onChange(boolean selfChange, Uri uri) { 57 | onChange(selfChange); 58 | } 59 | public void onChange(boolean selfChange) { 60 | Log.d("Budget", "WidgetService.obs.onChange()"); 61 | AppWidgetManager 62 | .getInstance(WidgetService.this) 63 | .notifyAppWidgetViewDataChanged(widgetId, R.id.grid); 64 | } 65 | }; 66 | csr.registerContentObserver(obs); 67 | } 68 | public void onDestroy() { 69 | Log.d("Budget", "WidgetService.onDestroy()"); 70 | csr.unregisterContentObserver(obs); 71 | csr.close(); 72 | csr = null; 73 | db.close(); 74 | db = null; 75 | } 76 | public boolean hasStableIds() { 77 | return true; 78 | } 79 | public long getItemId(int pos) { 80 | csr.moveToPosition(pos); 81 | return csr.getLong(2); 82 | } 83 | public int getCount() { 84 | int count = csr.getCount(); 85 | Log.d("Budget", "WidgetService.getCount(): "+count); 86 | return count; 87 | } 88 | public RemoteViews getLoadingView() { 89 | return new RemoteViews(getPackageName(), R.layout.card_widget); 90 | } 91 | public RemoteViews getViewAt(int pos) { 92 | Log.d("Budget", "WidgetService.getViewAt("+pos+")"); 93 | RemoteViews views = new RemoteViews( 94 | getPackageName(), R.layout.card_widget 95 | ); 96 | csr.moveToPosition(pos); 97 | views.setTextViewText(R.id.name, csr.getString(0)); 98 | views.setTextViewText(R.id.value, 99 | EditMoney.toMoney(csr.getLong(1))); 100 | Intent act = new Intent(); 101 | act.putExtra("com.notriddle.budget.envelope", 102 | (int)getItemId(pos)); 103 | views.setOnClickFillInIntent(R.id.card, act); 104 | int color = csr.getInt(3); 105 | views.setInt(R.id.name, "setBackgroundColor", color); 106 | 107 | return views; 108 | } 109 | public int getViewTypeCount() { 110 | return 1; 111 | } 112 | public void onDataSetChanged() { 113 | Log.d("Budget", "WidgetService.onDataSetChanged()"); 114 | onDestroy(); 115 | onCreate(); 116 | } 117 | }; 118 | } 119 | } 120 | 121 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/LogAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.content.Context; 22 | import android.content.res.Resources; 23 | import android.database.Cursor; 24 | import android.view.LayoutInflater; 25 | import android.view.View; 26 | import android.view.ViewGroup; 27 | import android.widget.CursorAdapter; 28 | import android.widget.TextView; 29 | import java.text.DateFormat; 30 | import java.util.Date; 31 | 32 | public class LogAdapter extends CursorAdapter { 33 | LayoutInflater mInflater; 34 | DateFormat mDate; 35 | 36 | public LogAdapter(Context cntx, Cursor csr) { 37 | super(cntx, csr, 0); 38 | mInflater = LayoutInflater.from(cntx); 39 | mDate = android.text.format.DateFormat.getLongDateFormat(cntx); 40 | } 41 | 42 | private static class CardContents { 43 | public CardContents(View v) { 44 | name = (TextView) v.findViewById(R.id.name); 45 | value = (TextView) v.findViewById(R.id.value); 46 | time = (TextView) v.findViewById(R.id.time); 47 | envelope = (TextView) v.findViewById(R.id.envelope); 48 | money = new StringBuilder(6); 49 | parent = v; 50 | } 51 | public View parent; 52 | public TextView name; 53 | public TextView value; 54 | public TextView time; 55 | public TextView envelope; 56 | public StringBuilder money; 57 | }; 58 | 59 | @Override public String convertToString(Cursor csr) { 60 | return csr.getString( 61 | csr.getColumnIndexOrThrow("description") 62 | ); 63 | } 64 | 65 | @Override public void bindView(View v, Context cntx, Cursor csr) { 66 | CardContents contents = (CardContents) v.getTag(); 67 | fillCardContents(cntx, contents, csr); 68 | } 69 | 70 | @Override public View newView(Context cntx, Cursor csr, ViewGroup par) { 71 | View retVal; 72 | if (csr.getColumnIndex("envelope") != -1) { 73 | retVal = mInflater.inflate(R.layout.logentry_envelope, par, false); 74 | } else { 75 | retVal = mInflater.inflate(R.layout.logentry, par, false); 76 | } 77 | CardContents contents = new CardContents(retVal); 78 | retVal.setTag(contents); 79 | fillCardContents(cntx, contents, csr); 80 | return retVal; 81 | } 82 | 83 | private void fillCardContents(Context cntx, CardContents contents, Cursor csr) { 84 | long time = csr.getLong(csr.getColumnIndexOrThrow("time")); 85 | int color = cntx.getResources().getColor( 86 | time > System.currentTimeMillis() 87 | ? android.R.color.holo_blue_dark 88 | : android.R.color.black 89 | ); 90 | contents.name.setText(csr.getString( 91 | csr.getColumnIndexOrThrow("description") 92 | )); 93 | contents.name.setTextColor(color); 94 | long cents = csr.getLong(csr.getColumnIndexOrThrow("cents")); 95 | StringBuilder money = contents.money; 96 | money.delete(0, money.length()); 97 | if (cents > 0) { 98 | money.append("+"); 99 | } 100 | contents.value.setText( 101 | EditMoney.toMoneyBuilder(cents, money).toString() 102 | ); 103 | contents.value.setTextColor(color); 104 | Date timeD = new Date(time); 105 | String formattedDate = mDate.format(timeD); 106 | contents.time.setText(formattedDate); 107 | contents.time.setTextColor(color); 108 | if (csr.getColumnIndex("envelope") != -1) { 109 | String previousEnvelope; 110 | if (csr.getPosition() != 0) { 111 | csr.moveToPrevious(); 112 | previousEnvelope = csr.getString(csr.getColumnIndexOrThrow("envelope")); 113 | csr.moveToNext(); 114 | } else { 115 | previousEnvelope = ""; 116 | } 117 | String currentEnvelope = csr.getString(csr.getColumnIndexOrThrow("envelope")); 118 | if (currentEnvelope.equals(previousEnvelope)) { 119 | contents.envelope.setVisibility(View.GONE); 120 | } else { 121 | contents.envelope.setVisibility(View.VISIBLE); 122 | contents.envelope.setText(currentEnvelope); 123 | contents.envelope.setBackgroundColor(csr.getInt(csr.getColumnIndexOrThrow("color"))); 124 | } 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/PaycheckEnvelopesAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.content.Context; 22 | import android.database.Cursor; 23 | import android.text.Editable; 24 | import android.text.TextWatcher; 25 | import android.util.Log; 26 | import android.util.SparseArray; 27 | import android.view.LayoutInflater; 28 | import android.view.View; 29 | import android.view.ViewGroup; 30 | import android.widget.CursorAdapter; 31 | import android.widget.TextView; 32 | 33 | public class PaycheckEnvelopesAdapter extends CursorAdapter { 34 | public static interface DepositesChangeListener { 35 | public void onDepositesChange(SparseArray deposites); 36 | }; 37 | 38 | LayoutInflater mInflater; 39 | SparseArray mDeposites; 40 | DepositesChangeListener mListener; 41 | 42 | public PaycheckEnvelopesAdapter(Context cntx, Cursor csr, 43 | SparseArray deposites) { 44 | super(cntx, csr, 0); 45 | mInflater = LayoutInflater.from(cntx); 46 | mDeposites = deposites; 47 | } 48 | 49 | public void setDeposits(SparseArray deposites) { 50 | mDeposites = deposites; 51 | notifyDataSetChanged(); 52 | } 53 | 54 | @Override public boolean areAllItemsEnabled() { 55 | return false; 56 | } 57 | @Override public boolean isEnabled(int pos) { 58 | return false; 59 | } 60 | 61 | public SparseArray getDeposites() { 62 | return mDeposites; 63 | } 64 | 65 | public void setDepositesChangeListener(DepositesChangeListener listener) { 66 | mListener = listener; 67 | } 68 | 69 | private static class CardContents { 70 | public CardContents(View v) { 71 | parent = v; 72 | name = (TextView) v.findViewById(R.id.name); 73 | value = (EditMoney) v.findViewById(R.id.value); 74 | } 75 | public View parent; 76 | public TextView name; 77 | public EditMoney value; 78 | }; 79 | 80 | @Override public void bindView(View v, Context cntx, Cursor csr) { 81 | CardContents contents = (CardContents) v.getTag(); 82 | fillCardContents(contents, csr); 83 | } 84 | 85 | @Override public View newView(Context cntx, Cursor csr, ViewGroup par) { 86 | final View retVal = mInflater.inflate(R.layout.card_edit, par, false); 87 | final CardContents contents = new CardContents(retVal); 88 | final EditMoney value = contents.value; 89 | retVal.setTag(contents); 90 | fillCardContents(contents, csr); 91 | value.addTextChangedListener(new TextWatcher() { 92 | @Override public void afterTextChanged(Editable s) { 93 | // Do nothing. 94 | } 95 | 96 | @Override public void beforeTextChanged(CharSequence s, int start, 97 | int count, int end) { 98 | // Do nothing. 99 | } 100 | 101 | @Override public void onTextChanged(CharSequence s, int start, 102 | int count, int end) { 103 | if (value.getTag() == null) return; 104 | long cents = value.getCents(); 105 | int id = (Integer) value.getTag(); 106 | Log.d("PaycheckEnvelopesAdapter.TextWatcher.onTextChanged", 107 | "id="+id+", cents="+cents); 108 | mDeposites.put(id, Long.valueOf(cents)); 109 | if (mListener != null) { 110 | mListener.onDepositesChange(mDeposites); 111 | } 112 | } 113 | }); 114 | return retVal; 115 | } 116 | 117 | private void fillCardContents(CardContents contents, Cursor csr) { 118 | contents.name.setText(csr.getString(csr.getColumnIndexOrThrow("name"))); 119 | int id = csr.getInt(csr.getColumnIndexOrThrow("_id")); 120 | long cents = mDeposites.get( 121 | id, 122 | csr.getLong(csr.getColumnIndexOrThrow("lastPaycheckCents")) 123 | ); 124 | Log.d("PaycheckEnvelopesAdapter.fillCardContents", 125 | "id="+id+", cents="+cents); 126 | contents.value.setTag(null); 127 | contents.value.setCents(cents); 128 | contents.value.setTag(id); 129 | mDeposites.put(id, Long.valueOf(cents)); 130 | int color = csr.getInt(csr.getColumnIndexOrThrow("color")); 131 | if (color == 0) { 132 | contents.name.setBackgroundDrawable(null); 133 | } else { 134 | contents.name.setBackgroundColor(color); 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /src/com/notriddle/budget/EditTransactionFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is a part of Budget with Envelopes. 3 | * Copyright 2013 Michael Howell 4 | * 5 | * Budget is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * Budget is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Budget. If not, see . 17 | */ 18 | 19 | package com.notriddle.budget; 20 | 21 | import android.app.Activity; 22 | import android.app.AlertDialog; 23 | import android.app.DialogFragment; 24 | import android.content.ContentValues; 25 | import android.content.DialogInterface; 26 | import android.content.Intent; 27 | import android.database.Cursor; 28 | import android.database.sqlite.SQLiteDatabase; 29 | import android.os.Bundle; 30 | import android.text.Editable; 31 | import android.text.InputType; 32 | import android.text.TextWatcher; 33 | import android.view.KeyEvent; 34 | import android.view.LayoutInflater; 35 | import android.view.View; 36 | import android.view.ViewGroup; 37 | import android.view.WindowManager; 38 | import android.widget.AdapterView; 39 | import android.widget.AutoCompleteTextView; 40 | import android.widget.EditText; 41 | import android.widget.FilterQueryProvider; 42 | import android.widget.PopupMenu; 43 | import android.widget.TextView; 44 | 45 | public class EditTransactionFragment extends OkFragment 46 | implements TextWatcher { 47 | int mId; 48 | EditText mDescription; 49 | EditMoney mAmount; 50 | 51 | public static EditTransactionFragment newInstance(int id, String desc, long cents) { 52 | EditTransactionFragment retVal = new EditTransactionFragment(); 53 | 54 | Bundle args = new Bundle(); 55 | args.putInt("com.notriddle.budget.log", id); 56 | args.putString("com.notriddle.budget.log.description", desc); 57 | args.putLong("com.notriddle.bugdget.log.cents", cents); 58 | retVal.setArguments(args); 59 | 60 | return retVal; 61 | } 62 | 63 | @Override public void onActivityCreated(Bundle state) { 64 | super.onActivityCreated(state); 65 | mAmount.setOnEditorActionListener(this); 66 | mAmount.addTextChangedListener(this); 67 | 68 | Bundle args = getArguments(); 69 | mId = args.getInt("com.notriddle.budget.log"); 70 | mDescription.setText( 71 | args.getString("com.notriddle.budget.log.description") 72 | ); 73 | mAmount.setCents(args.getLong("com.notriddle.bugdget.log.cents")); 74 | } 75 | 76 | @Override public View onCreateInternalView(LayoutInflater inflater, 77 | ViewGroup cont, Bundle state) { 78 | View retVal = inflater.inflate(R.layout.spendfragment, cont, false); 79 | mAmount = (EditMoney) retVal.findViewById(R.id.amount); 80 | mAmount.setInputType(InputType.TYPE_CLASS_NUMBER|InputType.TYPE_NUMBER_FLAG_DECIMAL|InputType.TYPE_NUMBER_FLAG_SIGNED); 81 | mDescription = (EditText) retVal.findViewById(R.id.description); 82 | retVal.findViewById(R.id.delayed).setVisibility(View.GONE); 83 | retVal.findViewById(R.id.delay).setVisibility(View.GONE); 84 | retVal.findViewById(R.id.repeat).setVisibility(View.GONE); 85 | retVal.findViewById(R.id.frequency).setVisibility(View.GONE); 86 | return retVal; 87 | } 88 | 89 | @Override public boolean isOk() { 90 | return mAmount != null && mAmount.getCents() != 0; 91 | } 92 | 93 | @Override public void beforeTextChanged(CharSequence s, int start, 94 | int count, int after) { 95 | // Do nothing. 96 | } 97 | @Override public void onTextChanged(CharSequence s, int start, 98 | int before, int count) { 99 | // Do nothing. 100 | } 101 | @Override public void afterTextChanged(Editable s) { 102 | refreshOkButton(); 103 | } 104 | 105 | @Override public String getTitle() { 106 | return getActivity().getString(R.string.edit_name); 107 | } 108 | 109 | @Override public void ok() { 110 | SQLiteDatabase db = (new EnvelopesOpenHelper(getActivity())) 111 | .getWritableDatabase(); 112 | db.beginTransaction(); 113 | try { 114 | db.execSQL( 115 | "UPDATE log SET cents = ?, description = ? WHERE _id = ?", 116 | new String[] { 117 | Long.toString(mAmount.getCents()), 118 | mDescription.getText().toString(), 119 | Integer.toString(mId) 120 | } 121 | ); 122 | EnvelopesOpenHelper.playLog(db); 123 | db.setTransactionSuccessful(); 124 | getActivity().getContentResolver() 125 | .notifyChange(EnvelopesOpenHelper.URI, null); 126 | } finally { 127 | db.endTransaction(); 128 | db.close(); 129 | } 130 | } 131 | }; 132 | 133 | --------------------------------------------------------------------------------