7 |
--------------------------------------------------------------------------------
/res/menu/undo.xml:
--------------------------------------------------------------------------------
1 |
2 |
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 |
16 |
--------------------------------------------------------------------------------
/res/xml/settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
14 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/res/menu/envelopesactivity.xml:
--------------------------------------------------------------------------------
1 |
2 |
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