diff --git a/AccountBook/AccountBook/.gitignore b/AccountBook/AccountBook/.gitignore
new file mode 100644
index 0000000..ebdd23d
--- /dev/null
+++ b/AccountBook/AccountBook/.gitignore
@@ -0,0 +1,14 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
diff --git a/AccountBook/AccountBook/app/.gitignore b/AccountBook/AccountBook/app/.gitignore
new file mode 100644
index 0000000..3543521
--- /dev/null
+++ b/AccountBook/AccountBook/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/AccountBook/AccountBook/app/build.gradle b/AccountBook/AccountBook/app/build.gradle
new file mode 100644
index 0000000..554fcc9
--- /dev/null
+++ b/AccountBook/AccountBook/app/build.gradle
@@ -0,0 +1,31 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 30
+ buildToolsVersion "30.0.3"
+ defaultConfig {
+ applicationId "com.bazu.accountbook"
+ minSdkVersion 21
+ targetSdkVersion 30
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
+ implementation 'com.google.android.material:material:1.0.0'
+}
diff --git a/AccountBook/AccountBook/app/proguard-rules.pro b/AccountBook/AccountBook/app/proguard-rules.pro
new file mode 100644
index 0000000..6e7ffa9
--- /dev/null
+++ b/AccountBook/AccountBook/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/AccountBook/AccountBook/app/src/androidTest/java/com/bazu/accountbook/ExampleInstrumentedTest.java b/AccountBook/AccountBook/app/src/androidTest/java/com/bazu/accountbook/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..0166e03
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/androidTest/java/com/bazu/accountbook/ExampleInstrumentedTest.java
@@ -0,0 +1,27 @@
+package com.bazu.accountbook;
+
+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 Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+
+ assertEquals("com.bazu.accountbook", appContext.getPackageName());
+ }
+}
diff --git a/AccountBook/AccountBook/app/src/main/AndroidManifest.xml b/AccountBook/AccountBook/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..6e628e5
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/AndroidManifest.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/DatabaseHelper.java b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/DatabaseHelper.java
new file mode 100644
index 0000000..27291b2
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/DatabaseHelper.java
@@ -0,0 +1,91 @@
+package com.bazu.accountbook;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+
+import androidx.annotation.Nullable;
+
+public class DatabaseHelper extends SQLiteOpenHelper {
+ private static final String DB_NAME="MyAccount.db";
+ // 所有记录表
+ private static final String TABLE_NAME1="allrecord";
+ private static final String CREATE_TABLE1="create table if not exists allrecord(_id integer primary key autoincrement,money integer,remark text,type text,img integer,time text,io integer)";
+
+
+ private static final String CREATE_TABLE2="create table if not exists budgets(_id integer primary key autoincrement,budget integer,time text)";
+ private SQLiteDatabase db;
+
+ public DatabaseHelper(@Nullable Context context) {
+ super(context,DB_NAME,null,1);
+ }
+
+ // 创建两个表
+ @Override
+ public void onCreate(SQLiteDatabase db) {
+ db.execSQL(CREATE_TABLE1);
+ db.execSQL(CREATE_TABLE2);
+ }
+
+ //如果原来存在这个表则删除
+ @Override
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+ db.execSQL("drop table if exists "+TABLE_NAME1);
+
+ onCreate(db);
+ }
+
+ // 插入记录
+ public void insert(String tablename, ContentValues values){
+ SQLiteDatabase db = getWritableDatabase();
+ db.insert(tablename,null,values);
+ }
+
+ // 删除满足id值的记录
+ public void delete(String tablename,int id){
+ SQLiteDatabase db = getWritableDatabase();
+ db.delete(tablename,"_id=?",new String[]{String.valueOf(id)});
+ }
+
+ // 查询所有记录
+ public Cursor queryAll(String tablename){
+ SQLiteDatabase db = getWritableDatabase();
+ Cursor cursor = db.query(tablename, null, null, null, null, null, null);
+
+ return cursor;
+ }
+
+ // 根据时间查询
+ public Cursor queryByTime(String time){
+ String[] times = {time};
+ SQLiteDatabase db = getWritableDatabase();
+ String sql = "select * from budgets where time=?";
+ Cursor cursor = db.rawQuery(sql, times);
+ return cursor;
+ }
+
+ // 根据时间修改数据库的预算值
+ public void updateBudget(String time,Integer budget){
+ SQLiteDatabase db = getWritableDatabase();
+ db.execSQL("update budgets set budget=? where time=?",
+ new Object[]{budget,time});
+ }
+
+ // 根据id修改数据库中的备注和金额
+ public void updateById(Integer id,String beizhu,Integer money){
+ SQLiteDatabase db = getWritableDatabase();
+ db.execSQL("update allrecord set remark=?,money=? where _id=?",
+ new Object[]{beizhu,money,id});
+ }
+
+ // 根据类型模糊查询结果
+ public Cursor queryByType(String type){
+ String sql = "select * from allrecord where type like ?";
+ SQLiteDatabase db = getWritableDatabase();
+ Cursor cursor = db.rawQuery(sql, new String[]{"%"+type+"%"});
+ return cursor;
+ }
+
+}
diff --git a/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/MainActivity.java b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/MainActivity.java
new file mode 100644
index 0000000..f1b5966
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/MainActivity.java
@@ -0,0 +1,365 @@
+package com.bazu.accountbook;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.app.NotificationManager;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.BaseAdapter;
+import android.widget.Button;
+
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.ListView;
+
+import android.widget.TextView;
+import android.widget.Toast;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+public class MainActivity extends AppCompatActivity {
+ private EditText mainSearchEdit,mainBudgetEdit;
+ private ImageView mainSearch;
+ private Button allRecordBtn,notDownBtn,settingBudget;
+ private TextView monthOut,monthIn,monthBalance,monthBudget,monthWarning,dayOutIn;
+ private ListView mainRecordList;
+ private List recordsList = new ArrayList();
+ private Integer dayOut,dayIn,monthOutSum=0;
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+
+
+ monthOut = findViewById(R.id.item_mainlv_top_tv_out);
+ monthIn = findViewById(R.id.item_mainlv_top_tv_in);
+
+
+
+ dayOutIn = findViewById(R.id.item_mainlv_top_tv_day);
+ allRecordBtn = findViewById(R.id.all_record_btn);
+ notDownBtn = findViewById(R.id.main_btn_edit);
+ mainRecordList = findViewById(R.id.main_lv);
+
+
+ // 调用查询数据库显示记录
+ this.getRecordFromDB();
+
+ // 调用设置本月支出收入方法
+ getMonthOutIn();
+
+
+
+
+
+
+ // 跳转全部记录页面
+ allRecordBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(MainActivity.this,ShowAllRecords.class);
+ startActivity(intent);
+ }
+ });
+
+ // 为ListView中每个item设置单机事件并监听
+ mainRecordList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ Intent intent = new Intent(MainActivity.this, ShowOneRecord.class);
+ TextView imgSrc = view.findViewById(R.id.item_imgSrc);
+ intent.putExtra("imgSrc",imgSrc.getText());
+ TextView itemId = view.findViewById(R.id.item_id);
+ intent.putExtra("itemId",itemId.getText());
+ TextView szType = view.findViewById(R.id.item_mainLv_tv_title);
+ intent.putExtra("szType",szType.getText());
+ TextView szBeizhu = view.findViewById(R.id.item_mainLv_tv_beizhu);
+ intent.putExtra("szBeizhu",szBeizhu.getText());
+ TextView szMoney = view.findViewById(R.id.item_mainLv_tv_money);
+ intent.putExtra("szMoney",szMoney.getText());
+ startActivity(intent);
+ }
+ });
+
+ // 接收广播
+ MyReceiver myReceiver = new MyReceiver();
+ if (getIntent().getStringExtra("trans")!=null) {
+ myReceiver.onReceive(MainActivity.this,getIntent());
+ }
+
+ notDownBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent it1 = new Intent(MainActivity.this,RecordActivityOut.class);
+ startActivity(it1);
+ }
+ });
+
+ }
+
+
+
+ // 获取设置本月支出 收入
+ public void getMonthOutIn(){
+ Integer monthInSum = 0;
+ monthOutSum = 0;
+ //新建SQLiteOpenHelper子类的对象,并调用query方法查询数据库中的信息
+ final DatabaseHelper dbHelper=new DatabaseHelper(MainActivity.this);
+ final Cursor allRecord=dbHelper.queryAll("allrecord");
+ // 将游标设置到第一行
+// allRecord.moveToFirst();
+ while (allRecord.moveToNext()){
+ int money = allRecord.getInt(1);
+ String time = allRecord.getString(5);
+ int io = allRecord.getInt(6);
+ // 判断是否是本月的记录
+ String[] times = time.split(" ");
+ Date date = new Date();
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
+ String format = simpleDateFormat.format(date);
+ String[] yearMonth = times[0].split("-");
+ if (format.equals(yearMonth[0]+"-"+yearMonth[1])){
+ if (io==0){
+ monthOutSum+=money;
+ }else {
+ monthInSum+=money;
+ }
+ }
+ }
+
+ // 将本月支出和收入及本月剩余设置在页面上
+ monthOut.setText("¥"+monthOutSum);
+ monthIn.setText("¥"+monthInSum);
+ Integer balance = monthInSum-monthOutSum;
+
+ }
+
+
+ private void getRecordFromDB() {
+ // 初始化今日支出 收入
+ dayOut = 0;
+ dayIn = 0;
+ // 格式化金额显示
+ String formatMoney;
+ // 初始化集合
+ recordsList = new ArrayList();
+ //新建SQLiteOpenHelper子类的对象,并调用query方法查询数据库中的信息
+ final DatabaseHelper dbHelper=new DatabaseHelper(MainActivity.this);
+ final Cursor allRecord=dbHelper.queryAll("allrecord");
+// // 封装数据库数据到List
+// allRecord.moveToFirst();
+ // _id integer primary key autoincrement,money integer,remark text,type text,img integer,time text,io integer
+ while (allRecord.moveToNext()){
+ int id = allRecord.getInt(0);
+ int money = allRecord.getInt(1);
+ String remark = allRecord.getString(2);
+ String type = allRecord.getString(3);
+ int img = allRecord.getInt(4);
+ String time = allRecord.getString(5);
+ int io = allRecord.getInt(6);
+
+ // 判断是否是今天的记录
+ String[] times = time.split(" ");
+ Date date = new Date();
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ String format = simpleDateFormat.format(date);
+ if (format.equals(times[0])){
+ String showTime = "今天 "+times[1];
+ if (io==0){
+ dayOut+=money;
+ formatMoney = "支出: ¥"+money;
+ }else {
+ dayIn+=money;
+ formatMoney = "收入: ¥"+money;
+ }
+ MyRecords record = new MyRecords(id, formatMoney, remark, type, img, showTime, io);
+ recordsList.add(record);
+ }
+ }
+
+ // 设置今日支出 收入
+ dayOutIn.setText("今日支出 ¥"+dayOut+" 今日收入 ¥"+dayIn);
+
+ //自定义集合数据适配器,将查询显示在主页面
+ class MyListDataAdapater extends BaseAdapter{
+
+ @Override
+ public int getCount() {
+ return recordsList.size();
+ }
+
+ @Override
+ public Object getItem(int position) {
+ return recordsList.get(position);
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ MyListViewHolder holder; // 声明viewHolder
+
+ if (convertView==null){
+ convertView = View.inflate(MainActivity.this,R.layout.item_mainlv,null);
+ holder = new MyListViewHolder();
+ holder.item_id = convertView.findViewById(R.id.item_id);
+ holder.item_type = convertView.findViewById(R.id.item_mainLv_tv_title);
+ holder.item_beizhu = convertView.findViewById(R.id.item_mainLv_tv_beizhu);
+ holder.item_time = convertView.findViewById(R.id.item_mainLv_tv_time);
+ holder.item_money = convertView.findViewById(R.id.item_mainLv_tv_money);
+ holder.item_img = convertView.findViewById(R.id.item_mainlv_iv);
+ holder.item_imgSrc=convertView.findViewById(R.id.item_imgSrc);
+
+ holder.item_id.setText(recordsList.get(position).get_id().toString());
+ holder.item_type.setText(recordsList.get(position).getType());
+ holder.item_beizhu.setText(recordsList.get(position).getRemark());
+ holder.item_time.setText(recordsList.get(position).getTime());
+ holder.item_money.setText(recordsList.get(position).getMoney());
+ holder.item_img.setImageResource(recordsList.get(position).getImg());
+ holder.item_imgSrc.setText(recordsList.get(position).getImg().toString());
+ convertView.setTag(holder);
+ }else {
+ holder = (MyListViewHolder)convertView.getTag();
+ }
+
+ return convertView;
+ }
+
+ class MyListViewHolder{
+ TextView item_id,item_type,item_beizhu,item_money,item_time,item_imgSrc;
+ ImageView item_img;
+ }
+ }
+
+ MyListDataAdapater adapater = new MyListDataAdapater();
+ mainRecordList.setAdapter(adapater);
+ }
+
+ // 点击搜索
+
+
+ private void showSearchResult() {
+ String type = mainSearchEdit.getText().toString();
+ if ("".equals(type)) {
+ Toast.makeText(MainActivity.this, "请输入查询类型", Toast.LENGTH_LONG).show();
+ } else {
+ DatabaseHelper db = new DatabaseHelper(MainActivity.this);
+ Cursor result = db.queryByType(type);
+ if (result.getCount() == 0) {
+ Toast.makeText(this, "没有查询到该类型!", Toast.LENGTH_LONG).show();
+ } else {
+ // 初始化总收入支出
+ dayOut = 0;
+ dayIn = 0;
+ // 格式化金额显示
+ String formatMoney;
+ // 初始化集合
+ recordsList = new ArrayList();
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ // 封装
+ while (result.moveToNext()) {
+ if ((result.getString(5).split(" "))[0].equals(simpleDateFormat.format(new Date()))) {
+ int id = result.getInt(0);
+ int money = result.getInt(1);
+ String remark = result.getString(2);
+ String typeResult = result.getString(3);
+ int img = result.getInt(4);
+ String time = result.getString(5);
+ int io = result.getInt(6);
+ if (io == 0) {
+ dayOut += money;
+ formatMoney = "支出: ¥" + money;
+ } else {
+ dayIn += money;
+ formatMoney = "收入: ¥" + money;
+ }
+ String formatTime = "今天"+time.split(" ")[1];
+ // 把查询到的数据按照格式放入ListView
+ MyRecords record = new MyRecords(id, formatMoney, remark, typeResult, img, formatTime, io);
+ recordsList.add(record);
+ }
+ }
+
+ // 设置今日支出 收入
+ dayOutIn.setText("今日支出 ¥"+dayOut+" 今日收入 ¥"+dayIn);
+
+ //将集合中元素反转,时间最近的显示在最上面
+ Collections.reverse(recordsList);
+
+ //自定义集合数据适配器,将查询显示在主页面
+ class MyListDataAdapater extends BaseAdapter {
+
+ @Override
+ public int getCount() {
+ return recordsList.size();
+ }
+
+ @Override
+ public Object getItem(int position) {
+ return recordsList.get(position);
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ MyListViewHolder holder; // 声明viewHolder
+
+ if (convertView == null) {
+ convertView = View.inflate(MainActivity.this, R.layout.item_mainlv, null);
+ holder = new MyListViewHolder();
+ holder.item_id = convertView.findViewById(R.id.item_id);
+ holder.item_type = convertView.findViewById(R.id.item_mainLv_tv_title);
+ holder.item_beizhu = convertView.findViewById(R.id.item_mainLv_tv_beizhu);
+ holder.item_time = convertView.findViewById(R.id.item_mainLv_tv_time);
+ holder.item_money = convertView.findViewById(R.id.item_mainLv_tv_money);
+ holder.item_img = convertView.findViewById(R.id.item_mainlv_iv);
+ holder.item_imgSrc = convertView.findViewById(R.id.item_imgSrc);
+
+ holder.item_imgSrc.setText(recordsList.get(position).getImg().toString());
+ holder.item_id.setText(recordsList.get(position).get_id().toString());
+ holder.item_type.setText(recordsList.get(position).getType());
+ holder.item_beizhu.setText(recordsList.get(position).getRemark());
+ holder.item_time.setText(recordsList.get(position).getTime());
+ holder.item_money.setText(recordsList.get(position).getMoney());
+ holder.item_img.setImageResource(recordsList.get(position).getImg());
+ convertView.setTag(holder);
+ } else {
+ holder = (MyListViewHolder) convertView.getTag();
+ }
+
+ return convertView;
+ }
+
+ class MyListViewHolder {
+ TextView item_id, item_type, item_beizhu, item_money, item_time,item_imgSrc;
+ ImageView item_img;
+ }
+ }
+
+ MyListDataAdapater adapater = new MyListDataAdapater();
+ mainRecordList.setAdapter(adapater);
+ }
+ }
+ }
+}
diff --git a/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/MyBudgets.java b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/MyBudgets.java
new file mode 100644
index 0000000..6e49aac
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/MyBudgets.java
@@ -0,0 +1,50 @@
+package com.bazu.accountbook;
+
+// _id integer primary key autoincrement,budget integer,time text
+public class MyBudgets {
+ private Integer _id;
+ private Integer budget;
+ private String time;
+
+ public MyBudgets() {
+ }
+
+ public MyBudgets(Integer _id, Integer budget, String time) {
+ this._id = _id;
+ this.budget = budget;
+ this.time = time;
+ }
+
+ public Integer get_id() {
+ return _id;
+ }
+
+ public void set_id(Integer _id) {
+ this._id = _id;
+ }
+
+ public Integer getBudget() {
+ return budget;
+ }
+
+ public void setBudget(Integer budget) {
+ this.budget = budget;
+ }
+
+ public String getTime() {
+ return time;
+ }
+
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ @Override
+ public String toString() {
+ return "MyBudgets{" +
+ "_id=" + _id +
+ ", budget=" + budget +
+ ", time='" + time + '\'' +
+ '}';
+ }
+}
diff --git a/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/MyReceiver.java b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/MyReceiver.java
new file mode 100644
index 0000000..2376d02
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/MyReceiver.java
@@ -0,0 +1,30 @@
+package com.bazu.accountbook;
+
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.widget.Toast;
+
+import androidx.core.app.NotificationCompat;
+
+public class MyReceiver extends BroadcastReceiver {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getStringExtra("trans")!=null) {
+ Toast.makeText(context, intent.getStringExtra("trans"), Toast.LENGTH_LONG).show();
+ }
+ if("1".equals(intent.getStringExtra("chaochu"))) {
+ NotificationManager notificationManager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
+ builder.setSmallIcon(R.mipmap.jinggao);
+ builder.setContentTitle("预算警告");
+ builder.setContentText("您本月支出已超出预算!");
+ builder.setNumber(1);
+ Notification notification = builder.build();
+ notificationManager.notify(1, notification);
+ }
+ }
+}
diff --git a/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/MyRecords.java b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/MyRecords.java
new file mode 100644
index 0000000..2047a07
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/MyRecords.java
@@ -0,0 +1,97 @@
+package com.bazu.accountbook;
+
+/**
+ * 账单实体
+ */
+
+public class MyRecords {
+ private Integer _id; // 账单id
+ private String money; // 账单金额
+ private String remark; // 账单备注
+ private String type; // 收支类型
+ private Integer img; // 账单图片名
+ private String time; // 账单时间
+ private Integer io; // 支出还是收入 0 是支出 1是收入
+
+ public MyRecords() {
+ }
+
+ public MyRecords(Integer _id, String money, String remark, String type, Integer img, String time, Integer io) {
+ this._id = _id;
+ this.money=money;
+ this.remark = remark;
+ this.type = type;
+ this.img = img;
+ this.time = time;
+ this.io = io;
+ }
+
+ public Integer get_id() {
+ return _id;
+ }
+
+ public void set_id(Integer _id) {
+ this._id = _id;
+ }
+
+ public String getMoney() {
+ return money;
+ }
+
+ public void setMoney(String money) {
+ this.money = money;
+ }
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public Integer getImg() {
+ return img;
+ }
+
+ public void setImg(Integer img) {
+ this.img = img;
+ }
+
+ public String getTime() {
+ return time;
+ }
+
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ public Integer getIo() {
+ return io;
+ }
+
+ public void setIo(Integer io) {
+ this.io = io;
+ }
+
+ @Override
+ public String toString() {
+ return "MyRecords{" +
+ "_id=" + _id +
+ ", money=" + money +
+ ", remark='" + remark + '\'' +
+ ", type='" + type + '\'' +
+ ", img=" + img +
+ ", time='" + time + '\'' +
+ ", io=" + io +
+ '}';
+ }
+}
diff --git a/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/RecordActivityIn.java b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/RecordActivityIn.java
new file mode 100644
index 0000000..1601281
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/RecordActivityIn.java
@@ -0,0 +1,162 @@
+package com.bazu.accountbook;
+
+import android.annotation.SuppressLint;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class RecordActivityIn extends AppCompatActivity {
+ private String inType="其他";
+ private Integer inTypeImg=R.mipmap.other;
+ private EditText inMoney,inBeizhu;
+ private TextView inTime;
+ private Button submit_btn;
+ MyReceiver myReceiver;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_record_in);
+ inMoney = findViewById(R.id.frag_record_in_money);
+ inBeizhu = findViewById(R.id.frag_record_in_beizhu);
+ inTime = findViewById(R.id.frag_record_in_time);
+ submit_btn = findViewById(R.id.in_tijiao);
+
+ //调用registerRecv()完成广播接收者的动态注册
+ registerRecv();
+
+ Date date = new Date();
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ String currentDate = simpleDateFormat.format(date);
+
+ inTime.setText(currentDate);
+ submit_btn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String iMoney = inMoney.getText().toString();
+ String iBeizhu = inBeizhu.getText().toString();
+ String time = inTime.getText().toString();
+
+ if ("".equals(iMoney)){
+ Toast.makeText(RecordActivityIn.this,"请输入金额再提交!",Toast.LENGTH_LONG).show();
+ }else {
+ Integer money = Integer.parseInt(iMoney);
+ DatabaseHelper databaseHelper = new DatabaseHelper(RecordActivityIn.this);
+ ContentValues contentValues = new ContentValues();
+ contentValues.put("money",money);
+ contentValues.put("remark",iBeizhu);
+ contentValues.put("type",inType);
+ contentValues.put("img",inTypeImg);
+ contentValues.put("time",time);
+ contentValues.put("io",1);
+ databaseHelper.insert("allrecord",contentValues);
+
+ //创建Intent对象,设置action属性并发送自定义广播
+ Intent intent = new Intent(RecordActivityIn.this,MainActivity.class);
+ intent.setAction("transfer");
+ intent.putExtra("trans",inType+"收入"+money+"元!");
+ sendBroadcast(intent);
+ startActivity(intent);
+ }
+ }
+ });
+ }
+
+
+ public void registerRecv(){
+ //实例化广播接收者
+ myReceiver = new MyReceiver();
+ //创建IntentFilter对象并设置其action属性
+ IntentFilter filter = new IntentFilter("transfer");
+ //注册广播
+ registerReceiver(myReceiver,filter);
+ }
+
+ public void cleanStyle(Integer id){
+ int[] ids = {
+ R.id.gongzi,
+ R.id.gupiao,
+ R.id.baoxian,
+ R.id.huanqian,
+ R.id.caipiao,
+ R.id.lixi
+ };
+ for (int i : ids) {
+ if (id!=i){
+ findViewById(i).setBackgroundColor(Color.parseColor("#ffffff"));
+ }
+ }
+ }
+
+
+ public void onClick(View view) {
+ switch (view.getId()){
+ case R.id.record_in_top_back:
+ Intent it1 = new Intent(RecordActivityIn.this, MainActivity.class);
+ startActivity(it1);
+ break;
+
+ case R.id.record_in_top_out:
+ Intent it2 = new Intent(RecordActivityIn.this,RecordActivityOut.class);
+ startActivity(it2);
+ break;
+
+ case R.id.gongzi:
+ cleanStyle(view.getId());
+ inType = "工资";
+ inTypeImg=R.mipmap.gongzi;
+ view.setBackgroundColor(Color.parseColor("#F3F3F3"));
+ break;
+ case R.id.gupiao:
+ cleanStyle(view.getId());
+ inType="股票基金";
+ inTypeImg=R.mipmap.gupiao;
+ view.setBackgroundColor(Color.parseColor("#F3F3F3"));
+ break;
+ case R.id.baoxian:
+ cleanStyle(view.getId());
+ inType="保险";
+ inTypeImg=R.mipmap.baoxian;
+ view.setBackgroundColor(Color.parseColor("#F3F3F3"));
+ break;
+ case R.id.huanqian:
+ cleanStyle(view.getId());
+ inType="还账";
+ inTypeImg=R.mipmap.huanqian;
+ view.setBackgroundColor(Color.parseColor("#F3F3F3"));
+ break;
+ case R.id.caipiao:
+ cleanStyle(view.getId());
+ inType="彩票中奖";
+ inTypeImg=R.mipmap.caipiao;
+ view.setBackgroundColor(Color.parseColor("#F3F3F3"));
+ break;
+ case R.id.lixi:
+ cleanStyle(view.getId());
+ inType="银行利息";
+ inTypeImg=R.mipmap.lixi;
+ view.setBackgroundColor(Color.parseColor("#F3F3F3"));
+ break;
+ }
+ }
+
+ // 销毁周期中注销广播发送者
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ unregisterReceiver(myReceiver);
+ }
+}
diff --git a/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/RecordActivityOut.java b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/RecordActivityOut.java
new file mode 100644
index 0000000..4f7573f
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/RecordActivityOut.java
@@ -0,0 +1,163 @@
+package com.bazu.accountbook;
+
+import android.content.ContentValues;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.text.Editable;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class RecordActivityOut extends AppCompatActivity{
+ private String outType="其他";
+ private Integer outTypeImg=R.mipmap.other;
+ private EditText outMoney,outBeizhu;
+ private TextView outTime;
+ private Button submit_btn;
+ MyReceiver myReceiver;
+
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_record);
+ outMoney = findViewById(R.id.frag_record_out_money);
+ outBeizhu = findViewById(R.id.frag_record_out_beizhu);
+ outTime = findViewById(R.id.frag_record_out_time);
+ submit_btn = findViewById(R.id.out_tijiao);
+
+ //调用registerRecv()完成广播接收者的动态注册
+ registerRecv();
+
+ Date date = new Date();
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ String currentDate = simpleDateFormat.format(date);
+
+ outTime.setText(currentDate);
+ submit_btn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String oMoney = outMoney.getText().toString();
+ String oBeizhu = outBeizhu.getText().toString();
+ String time = outTime.getText().toString();
+
+ if ("".equals(oMoney)){
+ Toast.makeText(RecordActivityOut.this,"请输入金额再提交!",Toast.LENGTH_LONG).show();
+ }else {
+ Integer money = Integer.parseInt(oMoney);
+ DatabaseHelper databaseHelper = new DatabaseHelper(RecordActivityOut.this);
+ ContentValues contentValues = new ContentValues();
+ contentValues.put("money",money);
+ contentValues.put("remark",oBeizhu);
+ contentValues.put("type",outType);
+ contentValues.put("img",outTypeImg);
+ contentValues.put("time",time);
+ contentValues.put("io",0);
+ databaseHelper.insert("allrecord",contentValues);
+
+ //创建Intent对象,设置action属性并发送自定义广播
+ Intent intent = new Intent(RecordActivityOut.this,MainActivity.class);
+ intent.setAction("transfer");
+ intent.putExtra("trans",outType+"支出"+money+"元!");
+ sendBroadcast(intent);
+ startActivity(intent);
+ }
+ }
+ });
+
+
+
+ }
+
+ public void registerRecv(){
+ //实例化广播接收者
+ myReceiver = new MyReceiver();
+ //创建IntentFilter对象并设置其action属性
+ IntentFilter filter = new IntentFilter("transfer");
+ //注册广播
+ registerReceiver(myReceiver,filter);
+ }
+
+ public void cleanStyle(Integer id){
+ int[] ids = {
+ R.id.canyin,
+ R.id.shenghuo,
+ R.id.yiliao,
+ R.id.yule,
+ R.id.bangong,
+ R.id.hongbao
+ };
+ for (int i : ids) {
+ if (id!=i){
+ findViewById(i).setBackgroundColor(Color.parseColor("#ffffff"));
+ }
+ }
+ }
+
+ public void onClick(View view) {
+ switch (view.getId()){
+ case R.id.record_out_top_back:
+ Intent it1 = new Intent(RecordActivityOut.this, MainActivity.class);
+ startActivity(it1);
+ break;
+
+ case R.id.record_out_top_in:
+ Intent it2 = new Intent(RecordActivityOut.this,RecordActivityIn.class);
+ startActivity(it2);
+ break;
+
+ case R.id.canyin:
+ cleanStyle(view.getId());
+ outType = "餐饮";
+ outTypeImg=R.mipmap.canyin;
+ view.setBackgroundColor(Color.parseColor("#F3F3F3"));
+ break;
+ case R.id.shenghuo:
+ cleanStyle(view.getId());
+ outType="生活用品";
+ outTypeImg=R.mipmap.shenghuo;
+ view.setBackgroundColor(Color.parseColor("#F3F3F3"));
+ break;
+ case R.id.yiliao:
+ cleanStyle(view.getId());
+ outType="医疗";
+ outTypeImg=R.mipmap.yiliao;
+ view.setBackgroundColor(Color.parseColor("#F3F3F3"));
+ break;
+ case R.id.yule:
+ cleanStyle(view.getId());
+ outType="娱乐";
+ outTypeImg=R.mipmap.yiliao;
+ view.setBackgroundColor(Color.parseColor("#F3F3F3"));
+ break;
+ case R.id.bangong:
+ cleanStyle(view.getId());
+ outType="办公文具";
+ outTypeImg=R.mipmap.bangong;
+ view.setBackgroundColor(Color.parseColor("#F3F3F3"));
+ break;
+ case R.id.hongbao:
+ cleanStyle(view.getId());
+ outType="人情往来";
+ outTypeImg=R.mipmap.hongbao;
+ view.setBackgroundColor(Color.parseColor("#F3F3F3"));
+ break;
+ }
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ unregisterReceiver(myReceiver);
+ }
+}
diff --git a/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/ShowAllRecords.java b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/ShowAllRecords.java
new file mode 100644
index 0000000..ab2ca4f
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/ShowAllRecords.java
@@ -0,0 +1,280 @@
+package com.bazu.accountbook;
+
+import android.content.Intent;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.BaseAdapter;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class ShowAllRecords extends AppCompatActivity {
+ private EditText allSearchEdit;
+ private TextView allInOut;
+ private ListView allRecord;
+ private List recordsList = new ArrayList();
+ private Integer allOut=0,allIn=0;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.all_record);
+ allSearchEdit=findViewById(R.id.all_search_edit);
+ allInOut=findViewById(R.id.all_xianshi);
+ allRecord=findViewById(R.id.all_lv);
+
+
+ //调用显示所有记录的方法
+ showAllRecord();
+
+ // 为ListView中每个item设置单机事件并监听
+ allRecord.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ Intent intent = new Intent(ShowAllRecords.this, ShowOneRecord.class);
+ TextView imgSrc = (TextView)view.findViewById(R.id.item_imgSrc);
+ intent.putExtra("imgSrc",imgSrc.getText());
+ TextView itemId = view.findViewById(R.id.item_id);
+ intent.putExtra("itemId",itemId.getText());
+ TextView szType = view.findViewById(R.id.item_mainLv_tv_title);
+ intent.putExtra("szType",szType.getText());
+ TextView szBeizhu = view.findViewById(R.id.item_mainLv_tv_beizhu);
+ intent.putExtra("szBeizhu",szBeizhu.getText());
+ TextView szMoney = view.findViewById(R.id.item_mainLv_tv_money);
+ intent.putExtra("szMoney",szMoney.getText());
+ startActivity(intent);
+ }
+ });
+
+ }
+
+ // 显示所有记录
+ private void showAllRecord() {
+ // 初始化总收入支出
+ allOut=0;
+ allIn=0;
+ // 格式化金额显示
+ String formatMoney;
+ // 初始化集合
+ recordsList = new ArrayList();
+ // 创建数据库操作对象
+ DatabaseHelper databaseHelper = new DatabaseHelper(ShowAllRecords.this);
+ Cursor all = databaseHelper.queryAll("allrecord");
+// all.moveToFirst();
+ // 把数据封装到集合 _id integer,money integer,remark text,type text,img integer,time text,io integer
+ while (all.moveToNext()) {
+ int id = all.getInt(0);
+ int money = all.getInt(1);
+ String remark = all.getString(2);
+ String type = all.getString(3);
+ int img = all.getInt(4);
+ String time = all.getString(5);
+ int io = all.getInt(6);
+ if (io==0){
+ allOut+=money;
+ formatMoney = "支出: ¥"+money;
+ }else {
+ allIn += money;
+ formatMoney = "收入: ¥" + money;
+ }
+ // 把查询到的数据按照格式放入ListView
+ MyRecords record = new MyRecords(id, formatMoney, remark, type, img, time, io);
+ recordsList.add(record);
+ }
+
+ // 将查询到的支出和收入显示
+ allInOut.setText("所有支出 ¥"+allOut+" 所有收入 ¥"+allIn);
+
+ //将集合中元素反转,时间最近的显示在最上面
+ Collections.reverse(recordsList);
+
+ //自定义集合数据适配器,将查询显示在主页面
+ class MyListDataAdapater extends BaseAdapter {
+
+ @Override
+ public int getCount() {
+ return recordsList.size();
+ }
+
+ @Override
+ public Object getItem(int position) {
+ return recordsList.get(position);
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ MyListViewHolder holder; // 声明viewHolder
+
+ if (convertView==null){
+ convertView = View.inflate(ShowAllRecords.this,R.layout.item_mainlv,null);
+ holder = new MyListViewHolder();
+ holder.item_id = convertView.findViewById(R.id.item_id);
+ holder.item_type = convertView.findViewById(R.id.item_mainLv_tv_title);
+ holder.item_beizhu = convertView.findViewById(R.id.item_mainLv_tv_beizhu);
+ holder.item_time = convertView.findViewById(R.id.item_mainLv_tv_time);
+ holder.item_money = convertView.findViewById(R.id.item_mainLv_tv_money);
+ holder.item_img = convertView.findViewById(R.id.item_mainlv_iv);
+ holder.item_imgSrc = convertView.findViewById(R.id.item_imgSrc);
+
+ holder.item_id.setText(recordsList.get(position).get_id().toString());
+ holder.item_type.setText(recordsList.get(position).getType());
+ holder.item_beizhu.setText(recordsList.get(position).getRemark());
+ holder.item_time.setText(recordsList.get(position).getTime());
+ holder.item_money.setText(recordsList.get(position).getMoney());
+ holder.item_imgSrc.setText(recordsList.get(position).getImg().toString());
+ holder.item_img.setImageResource(recordsList.get(position).getImg());
+ convertView.setTag(holder);
+ }else {
+ holder = (MyListViewHolder)convertView.getTag();
+ }
+
+ return convertView;
+ }
+
+ class MyListViewHolder{
+ TextView item_id,item_type,item_beizhu,item_money,item_time,item_imgSrc;
+ ImageView item_img;
+ }
+ }
+
+ MyListDataAdapater adapater = new MyListDataAdapater();
+ allRecord.setAdapter(adapater);
+
+ }
+
+ // 设置单机事件
+ public void onClick(View view) {
+ switch (view.getId()){
+ case R.id.all_back:
+ Intent intent = new Intent(ShowAllRecords.this, MainActivity.class);
+ startActivity(intent);
+ break;
+ case R.id.all_search:
+ showSearchResult();
+ break;
+ }
+ }
+
+ // 模糊查询记录
+ private void showSearchResult() {
+ String type = allSearchEdit.getText().toString();
+ if ("".equals(type)) {
+ Toast.makeText(ShowAllRecords.this, "请输入查询类型", Toast.LENGTH_LONG).show();
+ } else {
+ DatabaseHelper db = new DatabaseHelper(ShowAllRecords.this);
+ Cursor result = db.queryByType(type);
+ if (result.getCount() == 0) {
+ Toast.makeText(this, "没有查询到该类型!", Toast.LENGTH_LONG).show();
+ } else {
+ // 初始化总收入支出
+ allOut = 0;
+ allIn = 0;
+ // 格式化金额显示
+ String formatMoney;
+ // 初始化集合
+ recordsList = new ArrayList();
+ // 封装
+ while (result.moveToNext()) {
+ int id = result.getInt(0);
+ int money = result.getInt(1);
+ String remark = result.getString(2);
+ String typeResult = result.getString(3);
+ int img = result.getInt(4);
+ String time = result.getString(5);
+ int io = result.getInt(6);
+ if (io == 0) {
+ allOut += money;
+ formatMoney = "支出: ¥" + money;
+ } else {
+ allIn += money;
+ formatMoney = "收入: ¥" + money;
+ }
+ // 把查询到的数据按照格式放入ListView
+ MyRecords record = new MyRecords(id, formatMoney, remark, typeResult, img, time, io);
+ recordsList.add(record);
+ }
+ // 将查询到的支出和收入显示
+ allInOut.setText("所有支出 ¥" + allOut + " 所有收入 ¥" + allIn);
+
+ //将集合中元素反转,时间最近的显示在最上面
+ Collections.reverse(recordsList);
+
+ //自定义集合数据适配器,将查询显示在主页面
+ class MyListDataAdapater extends BaseAdapter {
+
+ @Override
+ public int getCount() {
+ return recordsList.size();
+ }
+
+ @Override
+ public Object getItem(int position) {
+ return recordsList.get(position);
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ MyListViewHolder holder; // 声明viewHolder
+
+ if (convertView == null) {
+ convertView = View.inflate(ShowAllRecords.this, R.layout.item_mainlv, null);
+ holder = new MyListViewHolder();
+ holder.item_id = convertView.findViewById(R.id.item_id);
+ holder.item_type = convertView.findViewById(R.id.item_mainLv_tv_title);
+ holder.item_beizhu = convertView.findViewById(R.id.item_mainLv_tv_beizhu);
+ holder.item_time = convertView.findViewById(R.id.item_mainLv_tv_time);
+ holder.item_money = convertView.findViewById(R.id.item_mainLv_tv_money);
+ holder.item_img = convertView.findViewById(R.id.item_mainlv_iv);
+ holder.item_imgSrc = convertView.findViewById(R.id.item_imgSrc);
+
+ holder.item_imgSrc.setText(recordsList.get(position).getImg().toString());
+ holder.item_id.setText(recordsList.get(position).get_id().toString());
+ holder.item_type.setText(recordsList.get(position).getType());
+ holder.item_beizhu.setText(recordsList.get(position).getRemark());
+ holder.item_time.setText(recordsList.get(position).getTime());
+ holder.item_money.setText(recordsList.get(position).getMoney());
+ holder.item_img.setImageResource(recordsList.get(position).getImg());
+ convertView.setTag(holder);
+ } else {
+ holder = (MyListViewHolder) convertView.getTag();
+ }
+
+ return convertView;
+ }
+
+ class MyListViewHolder {
+ TextView item_id, item_type, item_beizhu, item_money, item_time,item_imgSrc;
+ ImageView item_img;
+ }
+ }
+
+ MyListDataAdapater adapater = new MyListDataAdapater();
+ allRecord.setAdapter(adapater);
+ }
+ }
+
+ }
+}
diff --git a/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/ShowOneRecord.java b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/ShowOneRecord.java
new file mode 100644
index 0000000..5f5f9fe
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/java/com/bazu/accountbook/ShowOneRecord.java
@@ -0,0 +1,146 @@
+package com.bazu.accountbook;
+
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+
+public class ShowOneRecord extends AppCompatActivity {
+ private ImageView oneImg;
+ private TextView szType,szId;
+ private EditText szBeizhu,szMoney;
+ private Button szUpdate,szDelete;
+ MyReceiver myReceiver;
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.one_record);
+ oneImg=findViewById(R.id.one_img);
+ szType=findViewById(R.id.sztype_edit);
+ szBeizhu=findViewById(R.id.szbeizhu_edit);
+ szMoney=findViewById(R.id.szjine_edit);
+ szUpdate=findViewById(R.id.one_update);
+ szDelete=findViewById(R.id.one_delete);
+ szId=findViewById(R.id.one_id);
+
+ // 将单个记录的内容显示在页面上
+ showOneRecord();
+
+ // 注册为广播发送者
+ registerRecv();
+
+ // 修改内容
+ szUpdate.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ updateOneRecord();
+ }
+ });
+
+ // 删除内容
+ szDelete.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ deleteOneRecord();
+ }
+ });
+ }
+
+ private void deleteOneRecord() {
+
+ // 创建数据库操作对象
+ final DatabaseHelper db = new DatabaseHelper(ShowOneRecord.this);
+ AlertDialog.Builder builder=new AlertDialog.Builder(ShowOneRecord.this);
+ builder.setMessage("确认删除该记录吗?");
+ builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface arg0, int arg1) {
+ db.delete("allrecord",Integer.parseInt(szId.getText().toString()));
+ //创建Intent对象,设置action属性并发送自定义广播
+ Intent intent = new Intent(ShowOneRecord.this,MainActivity.class);
+ intent.setAction("transfer");
+ intent.putExtra("trans","删除成功");
+ sendBroadcast(intent);
+ startActivity(intent);
+ }
+ });
+ builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface arg0, int arg1) {
+ // TODO Auto-generated method stub
+ }
+ });
+ //将对话框显示出来
+ builder.create().show();
+ }
+
+
+ private void showOneRecord() {
+ // 获取intent对象中传来的数据
+ Intent intent = getIntent();
+ String imgSrc = intent.getStringExtra("imgSrc");
+ String itemId = intent.getStringExtra("itemId");
+ String type = intent.getStringExtra("szType");
+ String beizhu = intent.getStringExtra("szBeizhu");
+ String money = intent.getStringExtra("szMoney");
+ // 将数据显示在页面
+ oneImg.setImageResource(Integer.parseInt(imgSrc));
+ szId.setText(itemId);
+ szType.setText(type);
+ szBeizhu.setText(beizhu);
+ szMoney.setText(money.split("¥")[1]);
+ }
+
+
+ private void updateOneRecord() {
+ Integer id = Integer.parseInt(szId.getText().toString());
+ String beizhu = szBeizhu.getText().toString();
+ Integer money = Integer.parseInt(szMoney.getText().toString());
+ // 创建数据库操作对象
+ DatabaseHelper db = new DatabaseHelper(ShowOneRecord.this);
+ // 修改信息
+ db.updateById(id,beizhu,money);
+ //创建Intent对象,设置action属性并发送自定义广播
+ Intent intent = new Intent(ShowOneRecord.this,MainActivity.class);
+ intent.setAction("transfer");
+ intent.putExtra("trans","修改成功");
+ sendBroadcast(intent);
+ startActivity(intent);
+ }
+
+ public void onClick(View view) {
+ switch (view.getId()){
+ case R.id.one_back:
+ Intent intent = new Intent(ShowOneRecord.this, MainActivity.class);
+ startActivity(intent);
+ }
+ }
+
+
+ // 注册广播发送者
+ public void registerRecv(){
+ //实例化广播接收者
+ myReceiver = new MyReceiver();
+ //创建IntentFilter对象并设置其action属性
+ IntentFilter filter = new IntentFilter("transfer");
+ //注册广播
+ registerReceiver(myReceiver,filter);
+ }
+
+ // 销毁周期中注销广播发送者
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ unregisterReceiver(myReceiver);
+ }
+}
diff --git a/AccountBook/AccountBook/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/AccountBook/AccountBook/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 0000000..971add5
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AccountBook/AccountBook/app/src/main/res/drawable/ic_launcher_background.xml b/AccountBook/AccountBook/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..30b7feb
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AccountBook/AccountBook/app/src/main/res/drawable/main_recordbtn_bg.xml b/AccountBook/AccountBook/app/src/main/res/drawable/main_recordbtn_bg.xml
new file mode 100644
index 0000000..8e426de
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/drawable/main_recordbtn_bg.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AccountBook/AccountBook/app/src/main/res/layout/activity_main.xml b/AccountBook/AccountBook/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..1401821
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,142 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AccountBook/AccountBook/app/src/main/res/layout/activity_record.xml b/AccountBook/AccountBook/app/src/main/res/layout/activity_record.xml
new file mode 100644
index 0000000..a0a6415
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/layout/activity_record.xml
@@ -0,0 +1,262 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AccountBook/AccountBook/app/src/main/res/layout/activity_record_in.xml b/AccountBook/AccountBook/app/src/main/res/layout/activity_record_in.xml
new file mode 100644
index 0000000..01f1484
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/layout/activity_record_in.xml
@@ -0,0 +1,256 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AccountBook/AccountBook/app/src/main/res/layout/all_record.xml b/AccountBook/AccountBook/app/src/main/res/layout/all_record.xml
new file mode 100644
index 0000000..665f76d
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/layout/all_record.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AccountBook/AccountBook/app/src/main/res/layout/item_mainlv.xml b/AccountBook/AccountBook/app/src/main/res/layout/item_mainlv.xml
new file mode 100644
index 0000000..b42e0e9
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/layout/item_mainlv.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AccountBook/AccountBook/app/src/main/res/layout/one_record.xml b/AccountBook/AccountBook/app/src/main/res/layout/one_record.xml
new file mode 100644
index 0000000..a947896
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/layout/one_record.xml
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/AccountBook/AccountBook/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..a26f6fb
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/AccountBook/AccountBook/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..a26f6fb
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/baoxian.png b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/baoxian.png
new file mode 100644
index 0000000..1f999c9
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/baoxian.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/caipiao.png b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/caipiao.png
new file mode 100644
index 0000000..0fca80d
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/caipiao.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/gongzi.png b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/gongzi.png
new file mode 100644
index 0000000..7465a60
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/gongzi.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/gupiao.png b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/gupiao.png
new file mode 100644
index 0000000..2df2e84
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/gupiao.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/huanqian.png b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/huanqian.png
new file mode 100644
index 0000000..3c98c67
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/huanqian.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/ic_launcher.png b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..898f3ed
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..dffca36
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/lixi.png b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/lixi.png
new file mode 100644
index 0000000..99215c6
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-hdpi/lixi.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/bangong.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/bangong.png
new file mode 100644
index 0000000..125f69b
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/bangong.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/biyan.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/biyan.png
new file mode 100644
index 0000000..d3a56a7
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/biyan.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/canyin.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/canyin.png
new file mode 100644
index 0000000..e0add53
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/canyin.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/cuowu.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/cuowu.png
new file mode 100644
index 0000000..0595a51
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/cuowu.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/hongbao.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/hongbao.png
new file mode 100644
index 0000000..f52332e
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/hongbao.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/ic_launcher.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..64ba76f
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..dae5e08
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/jinggao.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/jinggao.png
new file mode 100644
index 0000000..22549df
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/jinggao.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/other.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/other.png
new file mode 100644
index 0000000..983bb93
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/other.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/search.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/search.png
new file mode 100644
index 0000000..b838cf0
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/search.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/shenghuo.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/shenghuo.png
new file mode 100644
index 0000000..e96fb7f
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/shenghuo.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/yiliao.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/yiliao.png
new file mode 100644
index 0000000..66e0f53
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/yiliao.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/yule.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/yule.png
new file mode 100644
index 0000000..eb146e5
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/yule.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/yusuan.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/yusuan.png
new file mode 100644
index 0000000..96131ab
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/yusuan.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/zhengyan.png b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/zhengyan.png
new file mode 100644
index 0000000..19f18e8
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-mdpi/zhengyan.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/AccountBook/AccountBook/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..e5ed465
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/AccountBook/AccountBook/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..14ed0af
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/AccountBook/AccountBook/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..b0907ca
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/AccountBook/AccountBook/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..d8ae031
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/AccountBook/AccountBook/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..2c18de9
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/AccountBook/AccountBook/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..beed3cd
Binary files /dev/null and b/AccountBook/AccountBook/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/AccountBook/AccountBook/app/src/main/res/values/colors.xml b/AccountBook/AccountBook/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..18c2dcd
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/values/colors.xml
@@ -0,0 +1,11 @@
+
+
+ #FFFAA0
+ #00574B
+ #AA4A44
+ #000000
+ #F3F3F3
+ #7d7d7d
+ #ffffff
+ #FDDA0D
+
diff --git a/AccountBook/AccountBook/app/src/main/res/values/strings.xml b/AccountBook/AccountBook/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..c0ad42a
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/values/strings.xml
@@ -0,0 +1,6 @@
+
+ 我的记账本
+
+
+ Hello blank fragment
+
diff --git a/AccountBook/AccountBook/app/src/main/res/values/styles.xml b/AccountBook/AccountBook/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..6f19b47
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/AccountBook/AccountBook/app/src/main/res/xml/key.xml b/AccountBook/AccountBook/app/src/main/res/xml/key.xml
new file mode 100644
index 0000000..30df4e6
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/main/res/xml/key.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AccountBook/AccountBook/app/src/test/java/com/bazu/accountbook/ExampleUnitTest.java b/AccountBook/AccountBook/app/src/test/java/com/bazu/accountbook/ExampleUnitTest.java
new file mode 100644
index 0000000..8b3d60f
--- /dev/null
+++ b/AccountBook/AccountBook/app/src/test/java/com/bazu/accountbook/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.bazu.accountbook;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/AccountBook/AccountBook/build.gradle b/AccountBook/AccountBook/build.gradle
new file mode 100644
index 0000000..69cab14
--- /dev/null
+++ b/AccountBook/AccountBook/build.gradle
@@ -0,0 +1,27 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ google()
+ jcenter()
+
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.5.2'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/AccountBook/AccountBook/gradle.properties b/AccountBook/AccountBook/gradle.properties
new file mode 100644
index 0000000..55f37b3
--- /dev/null
+++ b/AccountBook/AccountBook/gradle.properties
@@ -0,0 +1,20 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
+
diff --git a/AccountBook/AccountBook/gradle/wrapper/gradle-wrapper.jar b/AccountBook/AccountBook/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..f6b961f
Binary files /dev/null and b/AccountBook/AccountBook/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/AccountBook/AccountBook/gradle/wrapper/gradle-wrapper.properties b/AccountBook/AccountBook/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..863209b
--- /dev/null
+++ b/AccountBook/AccountBook/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed May 19 20:52:47 CST 2021
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
diff --git a/AccountBook/AccountBook/gradlew b/AccountBook/AccountBook/gradlew
new file mode 100644
index 0000000..cccdd3d
--- /dev/null
+++ b/AccountBook/AccountBook/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/AccountBook/AccountBook/gradlew.bat b/AccountBook/AccountBook/gradlew.bat
new file mode 100644
index 0000000..e95643d
--- /dev/null
+++ b/AccountBook/AccountBook/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/AccountBook/AccountBook/settings.gradle b/AccountBook/AccountBook/settings.gradle
new file mode 100644
index 0000000..16f9089
--- /dev/null
+++ b/AccountBook/AccountBook/settings.gradle
@@ -0,0 +1,2 @@
+include ':app'
+rootProject.name='AccountBook'
diff --git a/AccountBook/数据库.db b/AccountBook/数据库.db
new file mode 100644
index 0000000..e69de29