Add files via upload
@@ -0,0 +1,26 @@
|
||||
package com.pulipakaa24.budgeteer;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.pulipakaa24.budgeteer", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
30
src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.pulipakaa24.budgeteer"
|
||||
android:versionCode="1"
|
||||
android:versionName="grape">
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="false" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Budgeteer">
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".BudgetActivity"/>
|
||||
<activity android:name=".TransactionActivity"/>
|
||||
<activity android:name=".BudgetcreateActivity"/>
|
||||
<activity android:name=".ResetConfirmActivity"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
130
src/main/java/com/pulipakaa24/budgeteer/BudgetActivity.java
Normal file
@@ -0,0 +1,130 @@
|
||||
package com.pulipakaa24.budgeteer;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.pulipakaa24.budgeteer.MainActivity.database;
|
||||
import static com.pulipakaa24.budgeteer.MainActivity.shared_prefs;
|
||||
import static com.pulipakaa24.budgeteer.TransactionActivity.decimalFormat;
|
||||
|
||||
public class BudgetActivity extends AppCompatActivity {
|
||||
public static BudgetAdapter adapter;
|
||||
public static String category;
|
||||
Context context;
|
||||
private List<Transaction> transactions;
|
||||
private TextView categoryTotal;
|
||||
private TextView budgetAmount;
|
||||
private float total;
|
||||
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_budget);
|
||||
|
||||
TextView categoryName = findViewById(R.id.category_name);
|
||||
categoryTotal = findViewById(R.id.category_amount);
|
||||
RecyclerView recyclerView = findViewById(R.id.category_recyclerView);
|
||||
budgetAmount = findViewById(R.id.budget_amount);
|
||||
|
||||
context = this;
|
||||
|
||||
Intent intent = getIntent();
|
||||
category = intent.getStringExtra("category");
|
||||
categoryName.setText(category);
|
||||
|
||||
transactions = database.transactionDao().getAll(category);
|
||||
total = 0;
|
||||
|
||||
for (int i = 0; i < transactions.size(); i++) {
|
||||
total += transactions.get(i).amount;
|
||||
}
|
||||
|
||||
categoryTotal.setText("$" + decimalFormat.format(total));
|
||||
budgetButton();
|
||||
|
||||
adapter = new BudgetAdapter();
|
||||
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
FloatingActionButton addTransac = findViewById(R.id.add_transac_button);
|
||||
addTransac.setOnClickListener(v -> {
|
||||
int id = (int) database.transactionDao().create(intent.getStringExtra("category"));
|
||||
adapter.reload();
|
||||
|
||||
Context context = v.getContext();
|
||||
Intent intent1 = new Intent(context, TransactionActivity.class);
|
||||
intent1.putExtra("id", id);
|
||||
context.startActivity(intent1);
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void budgetButton () {
|
||||
SharedPreferences sharedPreferences = getSharedPreferences(shared_prefs, MODE_PRIVATE);
|
||||
float f = sharedPreferences.getFloat(category, 0.00f);
|
||||
if (f != 0) {
|
||||
budgetAmount.setText("Budget $" + decimalFormat.format(f));
|
||||
if (total > f) {
|
||||
categoryTotal.setTextColor(Color.RED);
|
||||
}
|
||||
|
||||
else {
|
||||
categoryTotal.setTextColor(Color.GREEN);
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
budgetAmount.setText("Add Budget");
|
||||
categoryTotal.setTextColor(Color.GREEN);
|
||||
}
|
||||
|
||||
budgetAmount.setOnClickListener(v -> {
|
||||
Context context = v.getContext();
|
||||
Intent intent1 = new Intent(context, BudgetcreateActivity.class);
|
||||
intent1.putExtra("category", category);
|
||||
intent1.putExtra("amount", f);
|
||||
context.startActivity(intent1);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
adapter.reload();
|
||||
|
||||
transactions = database.transactionDao().getAll(category);
|
||||
total = 0;
|
||||
|
||||
for (int i = 0; i < transactions.size(); i++) {
|
||||
total += transactions.get(i).amount;
|
||||
}
|
||||
|
||||
final String total1 = "$" + decimalFormat.format(total);
|
||||
|
||||
categoryTotal.setText(total1);
|
||||
|
||||
budgetButton();
|
||||
}
|
||||
|
||||
public void back(View view) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
79
src/main/java/com/pulipakaa24/budgeteer/BudgetAdapter.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package com.pulipakaa24.budgeteer;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.pulipakaa24.budgeteer.BudgetActivity.category;
|
||||
import static com.pulipakaa24.budgeteer.MainActivity.database;
|
||||
import static com.pulipakaa24.budgeteer.TransactionActivity.decimalFormat;
|
||||
|
||||
public class BudgetAdapter extends RecyclerView.Adapter<BudgetAdapter.TransactionViewHolder> {
|
||||
|
||||
public static class TransactionViewHolder extends RecyclerView.ViewHolder {
|
||||
public RelativeLayout containerView;
|
||||
public TextView transacNameView;
|
||||
public TextView transacAmountView;
|
||||
|
||||
public TransactionViewHolder(@NonNull View view) {
|
||||
super(view);
|
||||
this.containerView = view.findViewById(R.id.transaction_row);
|
||||
this.transacAmountView = view.findViewById(R.id.transacAmountView);
|
||||
this.transacNameView = view.findViewById(R.id.transacNameView);
|
||||
|
||||
this.containerView.setOnClickListener(v -> {
|
||||
Context context = v.getContext();
|
||||
Transaction transaction = (Transaction) containerView.getTag();
|
||||
Intent intent = new Intent(v.getContext(), TransactionActivity.class);
|
||||
intent.putExtra("id", transaction.id);
|
||||
intent.putExtra("name", transaction.transacName);
|
||||
intent.putExtra("amount", transaction.amount);
|
||||
|
||||
context.startActivity(intent);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Transaction> transactions = new ArrayList<>();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public TransactionViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.transaction_row, parent, false);
|
||||
|
||||
return new TransactionViewHolder(view);
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull BudgetAdapter.TransactionViewHolder holder, int position) {
|
||||
Transaction current = transactions.get(position);
|
||||
holder.containerView.setTag(current);
|
||||
holder.transacNameView.setText(current.transacName);
|
||||
holder.transacAmountView.setText("$" + decimalFormat.format(current.amount));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return transactions.size();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
notifyDataSetChanged();
|
||||
transactions = database.transactionDao().getAll(category);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.pulipakaa24.budgeteer;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import static com.pulipakaa24.budgeteer.MainActivity.shared_prefs;
|
||||
import static com.pulipakaa24.budgeteer.TransactionActivity.decimalFormat;
|
||||
|
||||
public class BudgetcreateActivity extends AppCompatActivity {
|
||||
private EditText budgetEdit;
|
||||
private View v;
|
||||
private String category;
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_budgetcreate);
|
||||
budgetEdit = findViewById(R.id.budgetEdit);
|
||||
|
||||
Intent intent = getIntent();
|
||||
category = intent.getStringExtra("category");
|
||||
float f = intent.getFloatExtra("amount", 0.00f);
|
||||
if (f != 0) {
|
||||
budgetEdit.setText(decimalFormat.format(f));
|
||||
}
|
||||
}
|
||||
|
||||
public void back(View view) {
|
||||
v = view;
|
||||
SharedPreferences sharedPreferences = getSharedPreferences(shared_prefs, MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
if (!budgetEdit.getText().toString().equals("")) {
|
||||
editor.putFloat(category, Float.parseFloat(budgetEdit.getText().toString().replaceAll("\\$", "")));
|
||||
}
|
||||
else {
|
||||
editor.putFloat(category, 0.00f);
|
||||
}
|
||||
editor.apply();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
back(v);
|
||||
}
|
||||
}
|
||||
192
src/main/java/com/pulipakaa24/budgeteer/MainActivity.java
Normal file
@@ -0,0 +1,192 @@
|
||||
package com.pulipakaa24.budgeteer;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.room.Room;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.pulipakaa24.budgeteer.TransactionActivity.decimalFormat;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
public static TransactionDatabase database;
|
||||
public static final String shared_prefs = "SHARED_PREFS";
|
||||
public static final String total_budget = "TOTAL_BUDGET";
|
||||
public static final String fbudget = "Food and Drink";
|
||||
public static final String gbudget = "Grocery";
|
||||
public static final String ebudget = "Entertainment";
|
||||
public static final String tbudget = "Travel";
|
||||
public static final String hebudget = "Health";
|
||||
public static final String cbudget = "Clothing";
|
||||
public static final String ubudget = "Utilities";
|
||||
public static final String hobudget = "Home";
|
||||
public static final String obudget = "Other";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
|
||||
|
||||
database = Room
|
||||
.databaseBuilder(getApplicationContext(), TransactionDatabase.class, "transactions")
|
||||
.allowMainThreadQueries()
|
||||
.build();
|
||||
|
||||
init();
|
||||
budgetButton();
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void budgetButton() {
|
||||
SharedPreferences sharedPreferences = getSharedPreferences(shared_prefs, MODE_PRIVATE);
|
||||
TextView totalBudget = findViewById(R.id.budgetText);
|
||||
|
||||
if (sharedPreferences.getFloat(total_budget, 0.00f) == 0.0) {
|
||||
totalBudget.setText("Add Total Budget");
|
||||
}
|
||||
|
||||
else {
|
||||
totalBudget.setText("Budget $" + decimalFormat.format(
|
||||
sharedPreferences.getFloat(total_budget, 0.00f)));
|
||||
}
|
||||
|
||||
totalBudget.setOnClickListener(v -> {
|
||||
Context context = v.getContext();
|
||||
Intent intent = new Intent(context, BudgetcreateActivity.class);
|
||||
intent.putExtra("category", total_budget);
|
||||
intent.putExtra("amount", sharedPreferences.getFloat(total_budget, 0.00f));
|
||||
context.startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
||||
private void init () {
|
||||
List<Transaction> transactions = database.transactionDao().getEverything();
|
||||
TextView totalView = findViewById(R.id.totalAmountText);
|
||||
SharedPreferences sharedPreferences = getSharedPreferences(shared_prefs, MODE_PRIVATE);
|
||||
float f = sharedPreferences.getFloat(total_budget, 0.00f);
|
||||
checkBudget(totalView, setTotalString(transactions, totalView), f);
|
||||
TextView food = findViewById(R.id.foodAmountView);
|
||||
TextView entert = findViewById(R.id.entertAmountView);
|
||||
TextView trav = findViewById(R.id.TravelAmountView);
|
||||
TextView health = findViewById(R.id.HealthAmountView);
|
||||
TextView cloth = findViewById(R.id.clothingAmountView);
|
||||
TextView util = findViewById(R.id.utilAmountView);
|
||||
TextView home = findViewById(R.id.homeAmountView);
|
||||
TextView other = findViewById(R.id.otherAmountView);
|
||||
TextView groc = findViewById(R.id.GroceriesAmountView);
|
||||
|
||||
float foodDrink = sharedPreferences.getFloat(fbudget, 0.00f);
|
||||
float entertBud = sharedPreferences.getFloat(ebudget, 0.00f);
|
||||
float travelBud = sharedPreferences.getFloat(tbudget, 0.00f);
|
||||
float healthBud = sharedPreferences.getFloat(hebudget, 0.00f);
|
||||
float clothBud = sharedPreferences.getFloat(cbudget, 0.00f);
|
||||
float utilBud = sharedPreferences.getFloat(ubudget, 0.00f);
|
||||
float homeBud = sharedPreferences.getFloat(hobudget, 0.00f);
|
||||
float otherBud = sharedPreferences.getFloat(obudget, 0.00f);
|
||||
float grocBud = sharedPreferences.getFloat(gbudget, 0.00f);
|
||||
|
||||
List<Transaction> foodDrinkTransac = database.transactionDao().getAll("Food and Drink");
|
||||
checkBudget(food, setTotalString(foodDrinkTransac, food), foodDrink);
|
||||
List<Transaction> entertTransac = database.transactionDao().getAll("Entertainment");
|
||||
checkBudget(entert, setTotalString(entertTransac, entert), entertBud);
|
||||
List<Transaction> travelTransac = database.transactionDao().getAll("Travel");
|
||||
checkBudget(trav, setTotalString(travelTransac, trav), travelBud);
|
||||
List<Transaction> healthTransac = database.transactionDao().getAll("Health");
|
||||
checkBudget(health, setTotalString(healthTransac, health), healthBud);
|
||||
List<Transaction> clothingTransac = database.transactionDao().getAll("Clothing");
|
||||
checkBudget(cloth, setTotalString(clothingTransac, cloth), clothBud);
|
||||
List<Transaction> utilityTransac = database.transactionDao().getAll("Utilities");
|
||||
checkBudget(util, setTotalString(utilityTransac, util), utilBud);
|
||||
List<Transaction> homeTransac = database.transactionDao().getAll("Home");
|
||||
checkBudget(home, setTotalString(homeTransac, home), homeBud);
|
||||
List<Transaction> otherTransac = database.transactionDao().getAll("Other");
|
||||
checkBudget(other, setTotalString(otherTransac, other), otherBud);
|
||||
List<Transaction> groceryTransac = database.transactionDao().getAll("Grocery");
|
||||
checkBudget(groc, setTotalString(groceryTransac, groc), grocBud);
|
||||
}
|
||||
|
||||
public static void checkBudget (TextView t, float f, float y) {
|
||||
if (f > y & y != 0) {
|
||||
t.setTextColor(Color.RED);
|
||||
}
|
||||
|
||||
else {
|
||||
t.setTextColor(Color.GREEN);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private float setTotalString (List<Transaction> transactions, TextView textView) {
|
||||
float total = 0;
|
||||
for (int i = 0; i < transactions.size(); i++) {
|
||||
total += transactions.get(i).amount;
|
||||
}
|
||||
textView.setText("$" + decimalFormat.format(total));
|
||||
return total;
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
init();
|
||||
budgetButton();
|
||||
}
|
||||
|
||||
private void open(Context context, String category) {
|
||||
Intent intent = new Intent(context, BudgetActivity.class);
|
||||
intent.putExtra("category", category);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public void openFoodDrink(View view) {
|
||||
open(view.getContext(), fbudget);
|
||||
}
|
||||
|
||||
public void openEntertainment(View view) {
|
||||
open(view.getContext(), ebudget);
|
||||
}
|
||||
|
||||
public void openGrocery(View view) {
|
||||
open(view.getContext(), gbudget);
|
||||
}
|
||||
|
||||
public void openTravel(View view) {
|
||||
open(view.getContext(), tbudget);
|
||||
}
|
||||
|
||||
public void openHealth(View view) {
|
||||
open(view.getContext(), hebudget);
|
||||
}
|
||||
|
||||
public void openClothing(View view) {
|
||||
open(view.getContext(), cbudget);
|
||||
}
|
||||
|
||||
public void openUtilities(View view) {
|
||||
open(view.getContext(), ubudget);
|
||||
}
|
||||
|
||||
public void openHome(View view) {
|
||||
open(view.getContext(), hobudget);
|
||||
}
|
||||
|
||||
public void openOther(View view) {
|
||||
open(view.getContext(), obudget);
|
||||
}
|
||||
|
||||
public void openReset(View view) {
|
||||
Context context = view.getContext();
|
||||
context.startActivity(new Intent(context, ResetConfirmActivity.class));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.pulipakaa24.budgeteer;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import static com.pulipakaa24.budgeteer.MainActivity.database;
|
||||
|
||||
public class ResetConfirmActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_resetconfirm);
|
||||
TextView sure = findViewById(R.id.sure);
|
||||
sure.setTextColor(Color.RED);
|
||||
}
|
||||
|
||||
public void yes(View view) {
|
||||
database.transactionDao().deleteAll();
|
||||
finish();
|
||||
}
|
||||
|
||||
public void no(View view) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
20
src/main/java/com/pulipakaa24/budgeteer/Transaction.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.pulipakaa24.budgeteer;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
@Entity(tableName = "transactions")
|
||||
public class Transaction {
|
||||
@PrimaryKey
|
||||
public int id;
|
||||
|
||||
@ColumnInfo(name = "category")
|
||||
public String category;
|
||||
|
||||
@ColumnInfo(name = "transacName")
|
||||
public String transacName;
|
||||
|
||||
@ColumnInfo(name = "amount")
|
||||
public float amount;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.pulipakaa24.budgeteer;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import static com.pulipakaa24.budgeteer.BudgetActivity.adapter;
|
||||
import static com.pulipakaa24.budgeteer.MainActivity.database;
|
||||
|
||||
public class TransactionActivity extends AppCompatActivity {
|
||||
private EditText nameEdit;
|
||||
private EditText amountEdit;
|
||||
public static DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_transaction);
|
||||
nameEdit = findViewById(R.id.transacNameEdit);
|
||||
amountEdit = findViewById(R.id.transacAmountEdit);
|
||||
|
||||
Intent intent = getIntent();
|
||||
nameEdit.setText(intent.getStringExtra("name"));
|
||||
float amount = intent.getFloatExtra("amount", 0.00f);
|
||||
if (amount != 0) {
|
||||
amountEdit.setText(decimalFormat.format(amount));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
Intent intent = getIntent();
|
||||
int id = intent.getIntExtra("id", 0);
|
||||
|
||||
String s = amountEdit.getText().toString();
|
||||
float f;
|
||||
|
||||
if (!s.equals("")) {
|
||||
f = Float.parseFloat(s);
|
||||
}
|
||||
|
||||
else {
|
||||
f = 0.00f;
|
||||
}
|
||||
|
||||
database.transactionDao().save(nameEdit.getText().toString(), f, id);
|
||||
adapter.reload();
|
||||
}
|
||||
|
||||
public void delete(View view) {
|
||||
database.transactionDao().delete(getIntent().getIntExtra("id", 0));
|
||||
finish();
|
||||
}
|
||||
|
||||
public void back(View view) {
|
||||
onPause();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
27
src/main/java/com/pulipakaa24/budgeteer/TransactionDao.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.pulipakaa24.budgeteer;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface TransactionDao {
|
||||
@Query("Insert into transactions (category, transacName, amount) values (:category, '', 0)")
|
||||
long create(String category);
|
||||
|
||||
@Query("select * from transactions where category = :category")
|
||||
List<Transaction> getAll(String category);
|
||||
|
||||
@Query("update transactions set transacName = :transacName, amount = :amount where id = :id")
|
||||
void save(String transacName, float amount, int id);
|
||||
|
||||
@Query("delete from transactions where id = :id")
|
||||
void delete(int id);
|
||||
|
||||
@Query("select * from transactions")
|
||||
List<Transaction> getEverything();
|
||||
|
||||
@Query("delete from transactions")
|
||||
void deleteAll();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.pulipakaa24.budgeteer;
|
||||
|
||||
|
||||
import androidx.room.Database;
|
||||
import androidx.room.RoomDatabase;
|
||||
|
||||
@Database(entities = {Transaction.class}, version = 1)
|
||||
public abstract class TransactionDatabase extends RoomDatabase {
|
||||
public abstract TransactionDao transactionDao();
|
||||
}
|
||||
30
src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
5
src/main/res/drawable/border.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<stroke android:color="@color/purple_200" android:width="2sp"/>
|
||||
<corners android:radius="3sp"/>
|
||||
</shape>
|
||||
170
src/main/res/drawable/ic_launcher_background.xml
Normal file
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
78
src/main/res/layout/activity_budget.xml
Normal file
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".BudgetActivity">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:id="@+id/backButton"
|
||||
android:text="Back"
|
||||
android:onClick="back"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/category_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:textSize="35sp"
|
||||
android:paddingTop="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/backButton" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/category_amount"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/category_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/budget_amount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="10sp"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/category_amount" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/category_recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:clipToPadding="false"
|
||||
android:scrollbars="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@+id/budget_amount"
|
||||
tools:layout_editor_absoluteX="16dp"/>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/add_transac_button"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_margin="20sp"
|
||||
android:layout_marginStart="339sp"
|
||||
android:layout_marginEnd="335sp"
|
||||
android:layout_marginBottom="16sp"
|
||||
android:contentDescription="plus"
|
||||
android:tint="@color/cardview_light_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:srcCompat="@android:drawable/ic_input_add"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
69
src/main/res/layout/activity_budgetcreate.xml
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".BudgetcreateActivity"
|
||||
tools:ignore="HardcodedText">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="7sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:onClick="back"
|
||||
android:text="Done"
|
||||
android:textSize="15sp"
|
||||
android:id="@+id/donebutton"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@+id/donebutton"
|
||||
android:id="@+id/budgetintro"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginTop="40sp"
|
||||
android:text="Budget Editor"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<TextView
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Set to 0 to Remove Budget"
|
||||
android:textSize="15sp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="$"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toStartOf="@id/budgetEdit"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<EditText
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:autofillHints="Amount"
|
||||
android:inputType="numberDecimal"
|
||||
android:hint="Amount ($)"
|
||||
android:id="@+id/budgetEdit"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
327
src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,327 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity"
|
||||
tools:ignore="UnusedAttribute">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="HardcodedText">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:text="Reset"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginStart="7sp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:onClick="openReset"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textSize="40sp"
|
||||
android:id="@+id/totalAmountText"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:textSize="20sp"
|
||||
android:paddingBottom="20sp"
|
||||
android:id="@+id/budgetText"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10sp"
|
||||
android:paddingTop="20sp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:onClick="openFoodDrink"
|
||||
android:id="@+id/FoodDrink">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="20sp"
|
||||
android:paddingStart="10sp"
|
||||
android:text="Food and Drink"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingEnd="10sp"
|
||||
android:textSize="20sp"
|
||||
android:id="@+id/foodAmountView"
|
||||
tools:ignore="RelativeOverlap,RtlSymmetry" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10sp"
|
||||
android:paddingTop="20sp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:onClick="openGrocery"
|
||||
android:id="@+id/Groceries">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="20sp"
|
||||
android:paddingStart="10sp"
|
||||
android:text="Groceries"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingEnd="10sp"
|
||||
android:id="@+id/GroceriesAmountView"
|
||||
android:text="$0.00"
|
||||
android:textSize="20sp"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10sp"
|
||||
android:paddingTop="20sp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:onClick="openEntertainment"
|
||||
android:id="@+id/Entertainment">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="20sp"
|
||||
android:paddingStart="10sp"
|
||||
android:text="Entertainment"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingEnd="10sp"
|
||||
android:id="@+id/entertAmountView"
|
||||
android:text="$0.00"
|
||||
android:textSize="20sp"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10sp"
|
||||
android:paddingTop="20sp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:onClick="openTravel"
|
||||
android:id="@+id/Travel">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="20sp"
|
||||
android:paddingStart="10sp"
|
||||
android:text="Travel"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingEnd="10sp"
|
||||
android:id="@+id/TravelAmountView"
|
||||
android:text="$0.00"
|
||||
android:textSize="20sp"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10sp"
|
||||
android:paddingTop="20sp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:onClick="openHealth"
|
||||
android:id="@+id/Health">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="20sp"
|
||||
android:paddingStart="10sp"
|
||||
android:text="Health"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingEnd="10sp"
|
||||
android:id="@+id/HealthAmountView"
|
||||
android:text="$0.00"
|
||||
android:textSize="20sp"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10sp"
|
||||
android:paddingTop="20sp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:onClick="openClothing"
|
||||
android:id="@+id/Clothing">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="20sp"
|
||||
android:paddingStart="10sp"
|
||||
android:text="Clothing"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingEnd="10sp"
|
||||
android:id="@+id/clothingAmountView"
|
||||
android:text="$0.00"
|
||||
android:textSize="20sp"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10sp"
|
||||
android:paddingTop="20sp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:onClick="openUtilities"
|
||||
android:id="@+id/Utilities">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="20sp"
|
||||
android:paddingStart="10sp"
|
||||
android:text="Utilities"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingEnd="10sp"
|
||||
android:id="@+id/utilAmountView"
|
||||
android:text="$0.00"
|
||||
android:textSize="20sp"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10sp"
|
||||
android:paddingTop="20sp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:onClick="openHome"
|
||||
android:id="@+id/Home">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="20sp"
|
||||
android:paddingStart="10sp"
|
||||
android:text="Home"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingEnd="10sp"
|
||||
android:id="@+id/homeAmountView"
|
||||
android:text="$0.00"
|
||||
android:textSize="20sp"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10sp"
|
||||
android:paddingTop="20sp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:onClick="openOther"
|
||||
android:id="@+id/Other"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:textSize="20sp"
|
||||
android:paddingStart="10sp"
|
||||
android:text="Other"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:paddingEnd="10sp"
|
||||
android:id="@+id/otherAmountView"
|
||||
android:text="$0.00"
|
||||
android:textSize="20sp"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
50
src/main/res/layout/activity_resetconfirm.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".ResetConfirmActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="HardcodedText"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:paddingTop="40sp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="ARE YOU SURE YOU WANT TO RESET? \n ALL TRANSACTIONS WILL BE DELETED"
|
||||
android:textSize="20sp"
|
||||
android:id="@+id/sure"
|
||||
android:paddingBottom="80sp"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="Yes"
|
||||
android:textSize="20sp"
|
||||
android:onClick="yes"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="No"
|
||||
android:textSize="20sp"
|
||||
android:onClick="no"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
82
src/main/res/layout/activity_transaction.xml
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
tools:context=".TransactionActivity"
|
||||
tools:ignore="HardcodedText" >
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16sp"
|
||||
android:layout_marginTop="16sp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:onClick="delete"
|
||||
android:text="Delete"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16sp"
|
||||
android:layout_marginEnd="16sp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:onClick="back"
|
||||
android:text="Done"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/transacNameEdit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="32sp"
|
||||
android:autofillHints="Transaction Name"
|
||||
android:hint="Transaction Name"
|
||||
android:inputType="text"
|
||||
android:paddingStart="20sp"
|
||||
android:textSize="30sp"
|
||||
android:translationY="-90sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/transacAmountEdit"
|
||||
tools:ignore="RelativeOverlap,RtlSymmetry"
|
||||
tools:layout_editor_absoluteX="70sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dollar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="$"
|
||||
app:layout_constraintEnd_toStartOf="@+id/transacAmountEdit"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginTop="100sp"
|
||||
android:textSize="30sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/transacAmountEdit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginTop="100sp"
|
||||
android:autofillHints="Transaction Amount"
|
||||
android:hint="Amount ($)"
|
||||
android:inputType="numberDecimal"
|
||||
android:paddingEnd="20sp"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RelativeOverlap,RtlSymmetry" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
35
src/main/res/layout/transaction_row.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:padding="15sp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:id="@+id/transaction_row"
|
||||
android:foreground="?android:attr/selectableItemBackground"
|
||||
android:backgroundTint="@color/purple_200"
|
||||
android:background="@drawable/border">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:paddingEnd="80sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:paddingStart="10sp"
|
||||
tools:ignore="RtlSymmetry"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_alignParentStart="true"
|
||||
android:id="@+id/transacNameView"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:paddingEnd="10sp"
|
||||
tools:ignore="RtlSymmetry"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:id="@+id/transacAmountView"/>
|
||||
|
||||
</RelativeLayout>
|
||||
5
src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
5
src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
BIN
src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
16
src/main/res/values-night/themes.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Budgeteer" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
||||
10
src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
||||
3
src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">Budgeteer</string>
|
||||
</resources>
|
||||
16
src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Budgeteer" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
||||
17
src/test/java/com/pulipakaa24/budgeteer/ExampleUnitTest.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.pulipakaa24.budgeteer;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||