master
chenjunda 2 years ago
parent fad8a2b031
commit f717ee0520

@ -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

@ -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'
}

@ -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

@ -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 <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.bazu.accountbook", appContext.getPackageName());
}
}

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bazu.accountbook">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="我的记账本"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<receiver
android:name=".MyReceiver"
android:enabled="true"
android:exported="true"></receiver>
<activity android:name=".RecordActivityOut"></activity>
<activity android:name=".ShowAllRecords"></activity>
<activity android:name=".RecordActivityIn"></activity>
<activity android:name=".ShowOneRecord"></activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

@ -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;
}
}

@ -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<MyRecords> recordsList = new ArrayList<MyRecords>();
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<MyRecords>();
//新建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<MyRecords>();
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);
}
}
}
}

@ -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 + '\'' +
'}';
}
}

@ -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);
}
}
}

@ -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 +
'}';
}
}

@ -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);
}
}

@ -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);
}
}

@ -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<MyRecords> recordsList = new ArrayList<MyRecords>();
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<MyRecords>();
// 创建数据库操作对象
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<MyRecords>();
// 封装
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);
}
}
}
}

@ -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);
}
}

@ -0,0 +1,34 @@
<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:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
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="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

@ -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="#FFFAA0"
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>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--设置 记一笔按钮-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFAA0"/>
<!-- 表示四个角的弧度 -->
<corners android:radius="20dp" />
</shape>

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFAA0"
>
<!-- 列表 -->
<LinearLayout
android:id="@+id/main_vi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#D5D7D6"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="#FFFAA0"
android:padding="20dp">
<!-- app名 -->
<TextView
android:layout_width="342dp"
android:layout_height="130dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="19dp"
android:gravity="center"
android:padding="10dp"
android:text="我的记账本"
android:textColor="@color/black"
android:textSize="28sp"
android:textStyle="bold" />
<Button
android:id="@+id/all_record_btn"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginEnd="3dp"
android:layout_marginRight="60dp"
android:background="#FFFAA0"
android:text="所有记录"
android:textColor="@color/black"
android:textStyle="bold" />
<TextView
android:id="@+id/item_mainlv_top_tv1"
android:layout_width="67dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginTop="86dp"
android:gravity="center"
android:text="本月支出" />
<TextView
android:id="@+id/item_mainlv_top_tv_out"
android:layout_width="wrap_content"
android:layout_height="72dp"
android:layout_alignParentTop="true"
android:layout_marginTop="107dp"
android:text="¥ 0"
android:textColor="@color/black"
android:textSize="36sp"
android:textStyle="bold" />
<TextView
android:id="@+id/item_mainlv_top_tv2"
android:layout_width="66dp"
android:layout_height="wrap_content"
android:layout_below="@id/item_mainlv_top_tv_out"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="87dp"
android:layout_marginEnd="33dp"
android:gravity="center"
android:text="本月收入" />
<TextView
android:id="@+id/item_mainlv_top_tv_in"
android:layout_width="175dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="-175dp"
android:layout_marginBottom="0dp"
android:layout_toRightOf="@id/item_mainlv_top_tv2"
android:gravity="center"
android:text="¥ 0"
android:textColor="@color/black"
android:textSize="36sp"
android:textStyle="bold" />
</RelativeLayout>
<TextView
android:id="@+id/item_mainlv_top_tv_day"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="10dp"
android:text="今日支出 ¥0 收入 ¥0"
android:textStyle="bold" />
</LinearLayout>
<ListView
android:id="@+id/main_lv"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_below="@+id/main_vi"
android:padding="10dp"
android:divider="@null"
android:dividerHeight="6dp"
android:scrollbars="none"
android:background="@color/grey_f3f3f3"
/>
<!-- 记一笔按钮 -->
<Button
android:id="@+id/main_btn_edit"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_alignBottom="@+id/main_lv"
android:background="#FFFAA0"
android:layout_alignParentRight="true"
android:layout_margin="20dp"
android:text="记一笔..."
android:textStyle="bold"
android:textColor="@color/black"
/>
</RelativeLayout>

@ -0,0 +1,262 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#FFFAA0">
<ImageView
android:id="@+id/record_out_top_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/cuowu"
android:onClick="onClick"
android:layout_marginLeft="10dp" />
<Button
android:id="@+id/record_out_top_out"
android:layout_width="80dp"
android:layout_height="45dp"
android:text="支出"
android:textColor="@color/black"
android:onClick="onClick"
android:layout_marginTop="0dp"
android:background="#FFFAA0"
android:layout_toRightOf="@id/record_out_top_back"
android:textSize="20dp"
android:layout_marginLeft="60dp"/>
<Button
android:id="@+id/record_out_top_in"
android:layout_width="80dp"
android:layout_height="45dp"
android:text="收入"
android:textColor="@color/black"
android:onClick="onClick"
android:layout_marginTop="0dp"
android:background="#FFFAA0"
android:layout_toRightOf="@id/record_out_top_out"
android:textSize="20dp"
android:layout_marginLeft="20dp"/>
<RelativeLayout
android:id="@+id/record_moderate"
android:layout_below="@+id/record_out_top_back"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_f3f3f3">
<RelativeLayout
android:id="@+id/frag_record_r1_top"
android:layout_width="match_parent"
android:layout_height="69dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="239dp"
android:background="@color/white"
android:padding="10dp">
<ImageView
android:id="@+id/frag_record_iv"
android:layout_width="51dp"
android:layout_height="33dp"
android:src="@mipmap/other" />
<TextView
android:id="@+id/frag_record_tv_type"
android:layout_width="46dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/frag_record_iv"
android:text="其他"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/frag_record_input_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_toRightOf="@id/frag_record_tv_type"
android:text="输入金额:"
android:textSize="16sp"
android:textStyle="bold" />
<EditText
android:id="@+id/frag_record_out_money"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/frag_record_input_money"
android:inputType="number" />
</RelativeLayout>
<View
android:id="@+id/frag_record_linel"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="@id/frag_record_r1_top"
android:background="@color/grey_f3f3f3" />
<RelativeLayout
android:id="@+id/recotd_tishi"
android:layout_width="match_parent"
android:layout_height="65dp"
android:layout_below="@id/frag_record_linel"
android:layout_alignParentTop="true"
android:layout_marginTop="439dp"
android:background="@color/white">
<TextView
android:id="@+id/frag_record_out_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:padding="10dp"
android:text="2021年05月22日 18:49" />
<EditText
android:id="@+id/frag_record_out_beizhu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="-2dp"
android:layout_toLeftOf="@id/frag_record_out_time"
android:background="@color/white"
android:hint="添加备注"
android:padding="10dp" />
</RelativeLayout>
<View
android:id="@+id/frag_record_line2"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="@id/recotd_tishi"
android:background="@color/grey_f3f3f3" />
<RelativeLayout
android:id="@+id/recotd_type"
android:layout_width="match_parent"
android:layout_height="341dp"
android:layout_alignParentTop="true"
android:layout_marginTop="1dp"
android:background="@color/white"
android:paddingLeft="20dp">
<TextView
android:id="@+id/canyin_text"
android:layout_width="50dp"
android:layout_height="20dp"
android:layout_below="@id/canyin"
android:layout_marginLeft="30dp"
android:text="餐饮" />
<TextView
android:layout_width="60dp"
android:layout_height="20dp"
android:layout_below="@id/shenghuo"
android:layout_marginLeft="105dp"
android:text="生活用品" />
<TextView
android:layout_width="50dp"
android:layout_height="20dp"
android:layout_below="@id/yiliao"
android:layout_marginLeft="210dp"
android:text="医疗" />
<TextView
android:layout_width="60dp"
android:layout_height="20dp"
android:layout_below="@id/yule"
android:layout_marginLeft="300dp"
android:text="娱乐" />
<TextView
android:layout_width="60dp"
android:layout_height="20dp"
android:layout_below="@id/bangong"
android:layout_marginLeft="25dp"
android:text="办公文具" />
<TextView
android:layout_width="60dp"
android:layout_height="20dp"
android:layout_below="@id/hongbao"
android:layout_marginLeft="110dp"
android:text="人情往来" />
<ImageView
android:id="@+id/canyin"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="20dp"
android:onClick="onClick"
android:src="@mipmap/canyin" />
<ImageView
android:id="@+id/shenghuo"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="20dp"
android:layout_toRightOf="@id/canyin"
android:onClick="onClick"
android:src="@mipmap/shenghuo" />
<ImageView
android:id="@+id/yiliao"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="20dp"
android:layout_toRightOf="@id/shenghuo"
android:onClick="onClick"
android:src="@mipmap/yiliao" />
<ImageView
android:id="@+id/yule"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="20dp"
android:layout_toRightOf="@id/yiliao"
android:onClick="onClick"
android:src="@mipmap/yule" />
<ImageView
android:id="@+id/bangong"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_below="@id/canyin_text"
android:layout_margin="20dp"
android:onClick="onClick"
android:src="@mipmap/bangong" />
<ImageView
android:id="@+id/hongbao"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_below="@id/canyin_text"
android:layout_margin="20dp"
android:layout_toRightOf="@id/bangong"
android:onClick="onClick"
android:src="@mipmap/hongbao" />
</RelativeLayout>
<Button
android:id="@+id/out_tijiao"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="47dp"
android:background="#FFFAA0"
android:text="提交"
android:textColor="@color/black"
android:textSize="25dp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>

@ -0,0 +1,256 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#FFFAA0">
<ImageView
android:id="@+id/record_in_top_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/cuowu"
android:onClick="onClick"
android:layout_marginLeft="10dp" />
<Button
android:id="@+id/record_in_top_out"
android:layout_width="80dp"
android:layout_height="45dp"
android:text="支出"
android:textColor="@color/black"
android:layout_marginTop="0dp"
android:onClick="onClick"
android:layout_toRightOf="@id/record_in_top_back"
android:background="#FFFAA0"
android:textSize="20dp"
android:layout_marginLeft="60dp"/>
<Button
android:id="@+id/record_in_top_in"
android:layout_width="80dp"
android:layout_height="45dp"
android:text="收入"
android:textColor="@color/black"
android:layout_marginTop="0dp"
android:background="#FFFAA0"
android:layout_toRightOf="@id/record_in_top_out"
android:textSize="20dp"
android:layout_marginLeft="20dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/record_in_top_back"
android:background="@color/grey_f3f3f3">
<View
android:id="@+id/frag_record_linel"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="@id/frag_record_r1_top"
android:background="@color/grey_f3f3f3" />
<RelativeLayout
android:id="@+id/recotd_tishi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="439dp"
android:background="@color/white">
<TextView
android:id="@+id/frag_record_in_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:padding="10dp"
android:text="2021年05月22日" />
<EditText
android:id="@+id/frag_record_in_beizhu"
android:layout_width="match_parent"
android:layout_height="65dp"
android:layout_toLeftOf="@id/frag_record_in_time"
android:background="@color/white"
android:hint="添加备注"
android:padding="10dp" />
</RelativeLayout>
<View
android:id="@+id/frag_record_line2"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="@id/recotd_tishi"
android:background="@color/grey_f3f3f3" />
<RelativeLayout
android:id="@+id/recotd_type"
android:layout_width="match_parent"
android:layout_height="341dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="354dp"
android:background="@color/white"
android:paddingLeft="20dp">
<ImageView
android:id="@+id/gongzi"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="20dp"
android:onClick="onClick"
android:src="@mipmap/gongzi" />
<TextView
android:id="@+id/gongzi_text"
android:layout_width="50dp"
android:layout_height="20dp"
android:layout_below="@id/gongzi"
android:layout_marginLeft="30dp"
android:text="工资" />
<ImageView
android:id="@+id/gupiao"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="20dp"
android:layout_toRightOf="@id/gongzi"
android:onClick="onClick"
android:src="@mipmap/gupiao" />
<TextView
android:layout_width="60dp"
android:layout_height="20dp"
android:layout_below="@id/gupiao"
android:layout_marginLeft="105dp"
android:text="股票基金" />
<ImageView
android:id="@+id/baoxian"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="20dp"
android:layout_toRightOf="@id/gupiao"
android:onClick="onClick"
android:src="@mipmap/baoxian" />
<TextView
android:layout_width="50dp"
android:layout_height="20dp"
android:layout_below="@id/baoxian"
android:layout_marginLeft="210dp"
android:text="保险" />
<ImageView
android:id="@+id/huanqian"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="20dp"
android:layout_toRightOf="@id/baoxian"
android:onClick="onClick"
android:src="@mipmap/huanqian" />
<TextView
android:layout_width="60dp"
android:layout_height="20dp"
android:layout_below="@id/huanqian"
android:layout_marginLeft="300dp"
android:text="还账" />
<ImageView
android:id="@+id/caipiao"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_below="@id/gongzi_text"
android:layout_margin="20dp"
android:onClick="onClick"
android:src="@mipmap/caipiao" />
<TextView
android:layout_width="60dp"
android:layout_height="20dp"
android:layout_below="@id/caipiao"
android:layout_marginLeft="25dp"
android:text="彩票中奖" />
<ImageView
android:id="@+id/lixi"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_below="@id/gongzi_text"
android:layout_margin="20dp"
android:layout_toRightOf="@id/caipiao"
android:onClick="onClick"
android:src="@mipmap/lixi" />
<TextView
android:layout_width="60dp"
android:layout_height="20dp"
android:layout_below="@id/lixi"
android:layout_marginLeft="110dp"
android:text="银行利息" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/frag_record_r1_top"
android:layout_width="match_parent"
android:layout_height="69dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="239dp"
android:background="@color/white"
android:padding="10dp">
<ImageView
android:id="@+id/frag_record_iv"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@mipmap/other" />
<TextView
android:id="@+id/frag_record_tv_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/frag_record_iv"
android:text="其他"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/frag_record_input_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_toRightOf="@id/frag_record_tv_type"
android:text="输入金额:"
android:textSize="16sp"
android:textStyle="bold" />
<EditText
android:id="@+id/frag_record_in_money"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/frag_record_input_money"
android:inputType="number" />
</RelativeLayout>
<Button
android:id="@+id/in_tijiao"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="47dp"
android:background="#FFFAA0"
android:text="提交"
android:textColor="@color/black"
android:textSize="25dp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_f3f3f3">
<!-- 页面头部 -->
<RelativeLayout
android:id="@+id/all_top"
android:layout_width="match_parent"
android:layout_height="50dp">
<!-- 点击返回 -->
<ImageView
android:id="@+id/all_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/cuowu"
android:onClick="onClick"
android:layout_marginLeft="10dp" />
<EditText
android:id="@+id/all_search_edit"
android:layout_width="130dp"
android:layout_height="40dp"
android:layout_marginTop="10dp"
android:layout_toLeftOf="@id/all_search"
android:hint="收支类型搜索" />
<!-- 搜索图片 -->
<ImageView
android:id="@+id/all_search"
android:layout_width="80dp"
android:layout_height="match_parent"
android:src="@mipmap/search"
android:onClick="onClick"
android:layout_alignParentRight="true"
android:padding="10dp"
/>
</RelativeLayout>
<TextView
android:id="@+id/all_xianshi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/all_top"
android:text="所有支出 ¥0 所有收入 ¥0"
android:textStyle="bold"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp" />
<!-- 列表 -->
<ListView
android:id="@+id/all_lv"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_below="@+id/all_xianshi"
android:padding="10dp"
android:divider="@null"
android:dividerHeight="6dp"
android:scrollbars="none"
android:background="@color/grey_f3f3f3"
/>
</RelativeLayout>

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"
android:background="@color/white">
<ImageView
android:id="@+id/item_mainlv_iv"
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@mipmap/canyin"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/item_mainlv_iv"
android:layout_marginLeft="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/item_mainLv_tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="16sp"/>
<TextView
android:id="@+id/item_mainLv_tv_beizhu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textSize="12sp"/>
</LinearLayout>
<!-- 每条对应的id -->
<TextView
android:id="@+id/item_id"
android:layout_marginLeft="100dp"
android:layout_width="30dp"
android:layout_height="30dp"
android:textColor="@color/white"/>
<TextView
android:id="@+id/item_imgSrc"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_marginLeft="150dp"
android:textSize="5dp"
android:textColor="@color/white"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:orientation="vertical">
<TextView
android:id="@+id/item_mainLv_tv_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold" />
<TextView
android:id="@+id/item_mainLv_tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp" />
</LinearLayout>
</RelativeLayout>

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_f3f3f3">
<!-- 页面头部 -->
<RelativeLayout
android:id="@+id/one_top"
android:layout_width="match_parent"
android:layout_height="50dp"
>
<!-- 点击返回 -->
<ImageView
android:id="@+id/one_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/cuowu"
android:onClick="onClick"
android:layout_marginLeft="10dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/one_moderate"
android:layout_below="@id/one_top"
android:layout_width="match_parent"
android:layout_height="420dp"
android:background="@color/white">
<ImageView
android:id="@+id/one_img"
android:layout_width="130dp"
android:layout_height="130dp"
android:src="@mipmap/other"
android:layout_margin="20dp"
android:layout_centerHorizontal="true"/>
<TextView
android:id="@+id/sztype"
android:layout_width="120dp"
android:layout_height="60dp"
android:layout_below="@id/one_img"
android:textStyle="bold"
android:layout_marginTop="20dp"
android:textSize="20dp"
android:text="收支类型:"
android:layout_marginLeft="40dp"
/>
<TextView
android:id="@+id/sztype_edit"
android:layout_width="180dp"
android:layout_height="60dp"
android:layout_toRightOf="@id/sztype"
android:layout_marginTop="20dp"
android:text="办公文件"
android:textStyle="bold"
android:textSize="20dp"
android:layout_below="@id/one_img" />
<TextView
android:id="@+id/szbeizhu"
android:layout_width="120dp"
android:layout_height="60dp"
android:layout_below="@id/sztype"
android:layout_marginTop="20dp"
android:textStyle="bold"
android:textSize="20dp"
android:text="收支备注:"
android:layout_marginLeft="40dp"
/>
<EditText
android:id="@+id/szbeizhu_edit"
android:layout_width="180dp"
android:layout_height="60dp"
android:layout_toRightOf="@id/szbeizhu"
android:layout_below="@id/sztype_edit"
android:layout_marginTop="5dp"
android:text="办公文件"
android:textStyle="bold"
android:textSize="18dp" />
<TextView
android:id="@+id/szjine"
android:layout_width="120dp"
android:layout_height="60dp"
android:layout_below="@id/szbeizhu"
android:layout_marginTop="20dp"
android:textStyle="bold"
android:textSize="20dp"
android:text="收支金额:"
android:layout_marginLeft="40dp"
/>
<EditText
android:id="@+id/szjine_edit"
android:layout_width="180dp"
android:layout_height="60dp"
android:layout_toRightOf="@id/szjine"
android:layout_below="@id/szbeizhu_edit"
android:layout_marginTop="8dp"
android:text="25"
android:textStyle="bold"
android:textSize="18dp" />
</RelativeLayout>
<RelativeLayout
android:layout_below="@id/one_moderate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<Button
android:id="@+id/one_update"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:text="修改"
android:textStyle="bold"
android:textSize="20sp"
android:background="@color/green_8BC14A"
android:textColor="@color/white"/>
<Button
android:id="@+id/one_delete"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginLeft="200dp"
android:text="删除"
android:textStyle="bold"
android:textSize="20sp"
android:background="@color/colorAccent"
android:textColor="@color/black"/>
<TextView
android:id="@+id/one_id"
android:layout_width="30dp"
android:layout_height="30dp"
android:textColor="@color/white"
/>
</RelativeLayout>
</RelativeLayout>

@ -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>

@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#FFFAA0</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#AA4A44</color>
<color name="black">#000000</color>
<color name="grey_f3f3f3">#F3F3F3</color>
<color name="grey_7d7d7d">#7d7d7d</color>
<color name="white">#ffffff</color>
<color name="green_8BC14A">#FDDA0D</color>
</resources>

@ -0,0 +1,6 @@
<resources>
<string name="app_name" >我的记账本</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment" >Hello blank fragment</string>
</resources>

@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!--keyHeight:每个按键的高度 keyWidth:每个按键的宽度-->
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyHeight="50dp"
android:keyWidth="25%p"
android:horizontalGap="1px"
android:verticalGap="1px">
<Row>
<Key android:codes="49" android:keyLabel="1" />
<Key android:codes="50" android:keyLabel="2" />
<Key android:codes="51" android:keyLabel="3" />
<Key android:codes="-5" android:keyLabel="删除" />
</Row>
<Row>
<Key android:codes="52" android:keyLabel="4" />
<Key android:codes="53" android:keyLabel="5" />
<Key android:codes="54" android:keyLabel="6" />
<Key android:codes="-4" android:keyHeight="150dp" android:keyLabel="确认" />
</Row>
<Row>
<Key android:codes="55" android:keyLabel="7" />
<Key android:codes="56" android:keyLabel="8" />
<Key android:codes="57" android:keyLabel="9" />
</Row>
<Row>
<Key android:codes="-3" android:keyLabel="清零" />
<Key android:codes="48" android:keyLabel="0" />
<Key android:codes="46" android:keyLabel="." />
</Row>
</Keyboard>

@ -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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

@ -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
}

@ -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

@ -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

@ -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" "$@"

@ -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

@ -0,0 +1,2 @@
include ':app'
rootProject.name='AccountBook'
Loading…
Cancel
Save