master
Luobaijun123456@ 2 years ago
parent aa6c2e3d2e
commit f74b846334

@ -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,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1,116 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
</component>
</project>

@ -0,0 +1,414 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DBNavigator.Project.DataEditorManager">
<record-view-column-sorting-type value="BY_INDEX" />
<value-preview-text-wrapping value="true" />
<value-preview-pinned value="false" />
</component>
<component name="DBNavigator.Project.DatabaseEditorStateManager">
<last-used-providers />
</component>
<component name="DBNavigator.Project.DatabaseFileManager">
<open-files />
</component>
<component name="DBNavigator.Project.Settings">
<connections />
<browser-settings>
<general>
<display-mode value="TABBED" />
<navigation-history-size value="100" />
<show-object-details value="false" />
</general>
<filters>
<object-type-filter>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="true" />
<object-type name="ROLE" enabled="true" />
<object-type name="PRIVILEGE" enabled="true" />
<object-type name="CHARSET" enabled="true" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED_VIEW" enabled="true" />
<object-type name="NESTED_TABLE" enabled="true" />
<object-type name="COLUMN" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET_TRIGGER" enabled="true" />
<object-type name="DATABASE_TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="true" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="TYPE_ATTRIBUTE" enabled="true" />
<object-type name="ARGUMENT" enabled="true" />
<object-type name="DIMENSION" enabled="true" />
<object-type name="CLUSTER" enabled="true" />
<object-type name="DBLINK" enabled="true" />
</object-type-filter>
</filters>
<sorting>
<object-type name="COLUMN" sorting-type="NAME" />
<object-type name="FUNCTION" sorting-type="NAME" />
<object-type name="PROCEDURE" sorting-type="NAME" />
<object-type name="ARGUMENT" sorting-type="POSITION" />
<object-type name="TYPE ATTRIBUTE" sorting-type="POSITION" />
</sorting>
<default-editors>
<object-type name="VIEW" editor-type="SELECTION" />
<object-type name="PACKAGE" editor-type="SELECTION" />
<object-type name="TYPE" editor-type="SELECTION" />
</default-editors>
</browser-settings>
<navigation-settings>
<lookup-filters>
<lookup-objects>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="false" />
<object-type name="ROLE" enabled="false" />
<object-type name="PRIVILEGE" enabled="false" />
<object-type name="CHARSET" enabled="false" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED VIEW" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET TRIGGER" enabled="true" />
<object-type name="DATABASE TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="false" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="DIMENSION" enabled="false" />
<object-type name="CLUSTER" enabled="false" />
<object-type name="DBLINK" enabled="true" />
</lookup-objects>
<force-database-load value="false" />
<prompt-connection-selection value="true" />
<prompt-schema-selection value="true" />
</lookup-filters>
</navigation-settings>
<dataset-grid-settings>
<general>
<enable-zooming value="true" />
<enable-column-tooltip value="true" />
</general>
<sorting>
<nulls-first value="true" />
<max-sorting-columns value="4" />
</sorting>
<audit-columns>
<column-names value="" />
<visible value="true" />
<editable value="false" />
</audit-columns>
</dataset-grid-settings>
<dataset-editor-settings>
<text-editor-popup>
<active value="false" />
<active-if-empty value="false" />
<data-length-threshold value="100" />
<popup-delay value="1000" />
</text-editor-popup>
<values-actions-popup>
<show-popup-button value="true" />
<element-count-threshold value="1000" />
<data-length-threshold value="250" />
</values-actions-popup>
<general>
<fetch-block-size value="100" />
<fetch-timeout value="30" />
<trim-whitespaces value="true" />
<convert-empty-strings-to-null value="true" />
<select-content-on-cell-edit value="true" />
<large-value-preview-active value="true" />
</general>
<filters>
<prompt-filter-dialog value="true" />
<default-filter-type value="BASIC" />
</filters>
<qualified-text-editor text-length-threshold="300">
<content-types>
<content-type name="Text" enabled="true" />
<content-type name="Properties" enabled="true" />
<content-type name="XML" enabled="true" />
<content-type name="DTD" enabled="true" />
<content-type name="HTML" enabled="true" />
<content-type name="XHTML" enabled="true" />
<content-type name="Java" enabled="true" />
<content-type name="SQL" enabled="true" />
<content-type name="PL/SQL" enabled="true" />
<content-type name="JSON" enabled="true" />
<content-type name="JSON5" enabled="true" />
<content-type name="Groovy" enabled="true" />
<content-type name="AIDL" enabled="true" />
<content-type name="YAML" enabled="true" />
<content-type name="Manifest" enabled="true" />
</content-types>
</qualified-text-editor>
<record-navigation>
<navigation-target value="VIEWER" />
</record-navigation>
</dataset-editor-settings>
<code-editor-settings>
<general>
<show-object-navigation-gutter value="false" />
<show-spec-declaration-navigation-gutter value="true" />
<enable-spellchecking value="true" />
<enable-reference-spellchecking value="false" />
</general>
<confirmations>
<save-changes value="false" />
<revert-changes value="true" />
</confirmations>
</code-editor-settings>
<code-completion-settings>
<filters>
<basic-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="false" />
<filter-element type="OBJECT" id="view" selected="false" />
<filter-element type="OBJECT" id="materialized view" selected="false" />
<filter-element type="OBJECT" id="index" selected="false" />
<filter-element type="OBJECT" id="constraint" selected="false" />
<filter-element type="OBJECT" id="trigger" selected="false" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="false" />
<filter-element type="OBJECT" id="procedure" selected="false" />
<filter-element type="OBJECT" id="function" selected="false" />
<filter-element type="OBJECT" id="package" selected="false" />
<filter-element type="OBJECT" id="type" selected="false" />
<filter-element type="OBJECT" id="dimension" selected="false" />
<filter-element type="OBJECT" id="cluster" selected="false" />
<filter-element type="OBJECT" id="dblink" selected="false" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</basic-filter>
<extended-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</extended-filter>
</filters>
<sorting enabled="true">
<sorting-element type="RESERVED_WORD" id="keyword" />
<sorting-element type="RESERVED_WORD" id="datatype" />
<sorting-element type="OBJECT" id="column" />
<sorting-element type="OBJECT" id="table" />
<sorting-element type="OBJECT" id="view" />
<sorting-element type="OBJECT" id="materialized view" />
<sorting-element type="OBJECT" id="index" />
<sorting-element type="OBJECT" id="constraint" />
<sorting-element type="OBJECT" id="trigger" />
<sorting-element type="OBJECT" id="synonym" />
<sorting-element type="OBJECT" id="sequence" />
<sorting-element type="OBJECT" id="procedure" />
<sorting-element type="OBJECT" id="function" />
<sorting-element type="OBJECT" id="package" />
<sorting-element type="OBJECT" id="type" />
<sorting-element type="OBJECT" id="dimension" />
<sorting-element type="OBJECT" id="cluster" />
<sorting-element type="OBJECT" id="dblink" />
<sorting-element type="OBJECT" id="schema" />
<sorting-element type="OBJECT" id="role" />
<sorting-element type="OBJECT" id="user" />
<sorting-element type="RESERVED_WORD" id="function" />
<sorting-element type="RESERVED_WORD" id="parameter" />
</sorting>
<format>
<enforce-code-style-case value="true" />
</format>
</code-completion-settings>
<execution-engine-settings>
<statement-execution>
<fetch-block-size value="100" />
<execution-timeout value="20" />
<debug-execution-timeout value="600" />
<focus-result value="false" />
<prompt-execution value="false" />
</statement-execution>
<script-execution>
<command-line-interfaces />
<execution-timeout value="300" />
</script-execution>
<method-execution>
<execution-timeout value="30" />
<debug-execution-timeout value="600" />
<parameter-history-size value="10" />
</method-execution>
</execution-engine-settings>
<operation-settings>
<transactions>
<uncommitted-changes>
<on-project-close value="ASK" />
<on-disconnect value="ASK" />
<on-autocommit-toggle value="ASK" />
</uncommitted-changes>
<multiple-uncommitted-changes>
<on-commit value="ASK" />
<on-rollback value="ASK" />
</multiple-uncommitted-changes>
</transactions>
<session-browser>
<disconnect-session value="ASK" />
<kill-session value="ASK" />
<reload-on-filter-change value="false" />
</session-browser>
<compiler>
<compile-type value="KEEP" />
<compile-dependencies value="ASK" />
<always-show-controls value="false" />
</compiler>
<debugger>
<debugger-type value="ASK" />
<use-generic-runners value="true" />
</debugger>
</operation-settings>
<ddl-file-settings>
<extensions>
<mapping file-type-id="VIEW" extensions="vw" />
<mapping file-type-id="TRIGGER" extensions="trg" />
<mapping file-type-id="PROCEDURE" extensions="prc" />
<mapping file-type-id="FUNCTION" extensions="fnc" />
<mapping file-type-id="PACKAGE" extensions="pkg" />
<mapping file-type-id="PACKAGE_SPEC" extensions="pks" />
<mapping file-type-id="PACKAGE_BODY" extensions="pkb" />
<mapping file-type-id="TYPE" extensions="tpe" />
<mapping file-type-id="TYPE_SPEC" extensions="tps" />
<mapping file-type-id="TYPE_BODY" extensions="tpb" />
</extensions>
<general>
<lookup-ddl-files value="true" />
<create-ddl-files value="false" />
<synchronize-ddl-files value="true" />
<use-qualified-names value="false" />
<make-scripts-rerunnable value="true" />
</general>
</ddl-file-settings>
<general-settings>
<regional-settings>
<date-format value="MEDIUM" />
<number-format value="UNGROUPED" />
<locale value="SYSTEM_DEFAULT" />
<use-custom-formats value="false" />
</regional-settings>
<environment>
<environment-types>
<environment-type id="development" name="Development" description="Development environment" color="-2430209/-12296320" readonly-code="false" readonly-data="false" />
<environment-type id="integration" name="Integration" description="Integration environment" color="-2621494/-12163514" readonly-code="true" readonly-data="false" />
<environment-type id="production" name="Production" description="Productive environment" color="-11574/-10271420" readonly-code="true" readonly-data="true" />
<environment-type id="other" name="Other" description="" color="-1576/-10724543" readonly-code="false" readonly-data="false" />
</environment-types>
<visibility-settings>
<connection-tabs value="true" />
<dialog-headers value="true" />
<object-editor-tabs value="true" />
<script-editor-tabs value="false" />
<execution-result-tabs value="true" />
</visibility-settings>
</environment>
</general-settings>
</component>
</project>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="" />
</component>
</project>

@ -0,0 +1,23 @@
# 简约记账
#### 介绍
项目名称: 简约记账
项目描述:基于安卓基础知识点开发的个人记账工具,其中包括记录当天收支情况,计算当天以及当月共收支总钱数,能查看历史账单,能对于每月收支情况进行图标分析,百分比分析,
能够搜索用户关于某种记录的全部收支情况等功能。基本上能够解决个人记账的所有问题,界面简约美观,滑动流畅。
项目重要技术点:
1-绘制布局掌握android基本view控件的属性和使用
2-熟练掌握Activity页面展示跳转和传值
3-使用碎片加载界面,滑动视图切换页面
4-自定义对话框
5-自定义软键盘绘制和使用
6-列表视图以及网格视图的适配器使用和页面加载
7-使用Android自带数据库熟练创建表并进行增删改查
8-定义drawable文件设定布局以及控件样式
9-使用MPAndroidChart第三方框架绘制柱状图

@ -0,0 +1,32 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.hui.tally"
minSdkVersion 21
targetSdkVersion 29
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.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.google.android.material:material:1.2.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
}

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

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hui.tally">
<application
android:name=".UniteApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MonthChartActivity"></activity>
<activity android:name=".SettingActivity" />
<activity android:name=".HistoryActivity" />
<activity android:name=".AboutActivity" />
<activity android:name=".SearchActivity" />
<activity android:name=".RecordActivity" />
<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,17 @@
项目名称: 简约记账
开发工具Android Studio
项目描述:基于安卓基础知识点开发的个人记账工具,其中包括记录当天收支情况,计算当天以及当月共收支总钱数,能查看历史账单,能对于每月收支情况进行图标分析,百分比分析,
能够搜索用户关于某种记录的全部收支情况等功能。基本上能够解决个人记账的所有问题,界面简约美观,滑动流畅。
项目重要技术点:
1-绘制布局掌握android基本view控件的属性和使用
2-熟练掌握Activity页面展示跳转和传值
3-使用碎片加载界面,滑动视图切换页面
4-自定义对话框
5-自定义软键盘绘制和使用
6-列表视图以及网格视图的适配器使用和页面加载
7-使用Android自带数据库熟练创建表并进行增删改查
8-定义drawable文件设定布局以及控件样式
9-使用MPAndroidChart第三方框架绘制柱状图

@ -0,0 +1,19 @@
package com.hui.tally;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class AboutActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
}
public void onClick(View view) {
finish();
}
}

@ -0,0 +1,109 @@
package com.hui.tally;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import com.hui.tally.adapter.AccountAdapter;
import com.hui.tally.db.AccountBean;
import com.hui.tally.db.DBManager;
import com.hui.tally.utils.CalendarDialog;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class HistoryActivity extends AppCompatActivity {
ListView historyLv;
TextView timeTv;
List<AccountBean>mDatas;
AccountAdapter adapter;
int year,month;
int dialogSelPos = -1;
int dialogSelMonth = -1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_history);
historyLv = findViewById(R.id.history_lv);
timeTv = findViewById(R.id.history_tv_time);
mDatas = new ArrayList<>();
// 设置适配器
adapter = new AccountAdapter(this,mDatas);
historyLv.setAdapter(adapter);
initTime();
timeTv.setText(year+"年"+month+"月");
loadData(year,month);
setLVClickListener();
}
/*设置ListView每一个item的长按事件*/
private void setLVClickListener() {
historyLv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
AccountBean accountBean = mDatas.get(position);
deleteItem(accountBean);
return false;
}
});
}
private void deleteItem(final AccountBean accountBean) {
final int delId = accountBean.getId();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("提示信息").setMessage("您确定要删除这条记录么?")
.setNegativeButton("取消",null)
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
DBManager.deleteItemFromAccounttbById(delId);
mDatas.remove(accountBean); //实时刷新,从数据源删除
adapter.notifyDataSetChanged();
}
});
builder.create().show();
}
/* 获取指定年份月份收支情况的列表*/
private void loadData(int year,int month) {
List<AccountBean> list = DBManager.getAccountListOneMonthFromAccounttb(year, month);
mDatas.clear();
mDatas.addAll(list);
adapter.notifyDataSetChanged();
}
private void initTime() {
Calendar calendar = Calendar.getInstance();
year = calendar.get(Calendar.YEAR);
month = calendar.get(Calendar.MONTH)+1;
}
public void onClick(View view) {
switch (view.getId()) {
case R.id.history_iv_back:
finish();
break;
case R.id.history_iv_rili:
CalendarDialog dialog = new CalendarDialog(this,dialogSelPos,dialogSelMonth);
dialog.show();
dialog.setDialogSize();
dialog.setOnRefreshListener(new CalendarDialog.OnRefreshListener() {
@Override
public void onRefresh(int selPos, int year, int month) {
timeTv.setText(year+"年"+month+"月");
loadData(year,month);
dialogSelPos = selPos;
dialogSelMonth = month;
}
});
break;
}
}
}

@ -0,0 +1,243 @@
package com.hui.tally;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.hui.tally.adapter.AccountAdapter;
import com.hui.tally.db.AccountBean;
import com.hui.tally.db.DBManager;
import com.hui.tally.utils.BudgetDialog;
import com.hui.tally.utils.MoreDialog;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Set;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
ListView todayLv; //展示今日收支情况的ListView
ImageView searchIv;
Button editBtn;
ImageButton moreBtn;
//声明数据源
List<AccountBean>mDatas;
AccountAdapter adapter;
int year,month,day;
//头布局相关控件
View headerView;
TextView topOutTv,topInTv,topbudgetTv,topConTv;
ImageView topShowIv;
SharedPreferences preferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initTime();
initView();
preferences = getSharedPreferences("budget", Context.MODE_PRIVATE);
//添加ListView的头布局
addLVHeaderView();
mDatas = new ArrayList<>();
//设置适配器:加载每一行数据到列表当中
adapter = new AccountAdapter(this, mDatas);
todayLv.setAdapter(adapter);
}
/** 初始化自带的View的方法*/
private void initView() {
todayLv = findViewById(R.id.main_lv);
editBtn = findViewById(R.id.main_btn_edit);
moreBtn = findViewById(R.id.main_btn_more);
searchIv = findViewById(R.id.main_iv_search);
editBtn.setOnClickListener(this);
moreBtn.setOnClickListener(this);
searchIv.setOnClickListener(this);
setLVLongClickListener();
}
/** 设置ListView的长按事件*/
private void setLVLongClickListener() {
todayLv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
if (position == 0) { //点击了头布局
return false;
}
int pos = position-1;
AccountBean clickBean = mDatas.get(pos); //获取正在被点击的这条信息
//弹出提示用户是否删除的对话框
showDeleteItemDialog(clickBean);
return false;
}
});
}
/* 弹出是否删除某一条记录的对话框*/
private void showDeleteItemDialog(final AccountBean clickBean) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("提示信息").setMessage("您确定要删除这条记录么?")
.setNegativeButton("取消",null)
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
int click_id = clickBean.getId();
//执行删除的操作
DBManager.deleteItemFromAccounttbById(click_id);
mDatas.remove(clickBean); //实时刷新,移除集合当中的对象
adapter.notifyDataSetChanged(); //提示适配器更新数据
setTopTvShow(); //改变头布局TextView显示的内容
}
});
builder.create().show(); //显示对话框
}
/** 给ListView添加头布局的方法*/
private void addLVHeaderView() {
//将布局转换成View对象
headerView = getLayoutInflater().inflate(R.layout.item_mainlv_top, null);
todayLv.addHeaderView(headerView);
//查找头布局可用控件
topOutTv = headerView.findViewById(R.id.item_mainlv_top_tv_out);
topInTv = headerView.findViewById(R.id.item_mainlv_top_tv_in);
topbudgetTv = headerView.findViewById(R.id.item_mainlv_top_tv_budget);
topConTv = headerView.findViewById(R.id.item_mainlv_top_tv_day);
topShowIv = headerView.findViewById(R.id.item_mainlv_top_iv_hide);
topbudgetTv.setOnClickListener(this);
headerView.setOnClickListener(this);
topShowIv.setOnClickListener(this);
}
/* 获取今日的具体时间*/
private void initTime() {
Calendar calendar = Calendar.getInstance();
year = calendar.get(Calendar.YEAR);
month = calendar.get(Calendar.MONTH)+1;
day = calendar.get(Calendar.DAY_OF_MONTH);
}
// 当activity获取焦点时会调用的方法
@Override
protected void onResume() {
super.onResume();
loadDBData();
setTopTvShow();
}
/* 设置头布局当中文本内容的显示*/
private void setTopTvShow() {
//获取今日支出和收入总金额显示在view当中
float incomeOneDay = DBManager.getSumMoneyOneDay(year, month, day, 1);
float outcomeOneDay = DBManager.getSumMoneyOneDay(year, month, day, 0);
String infoOneDay = "今日支出 ¥"+outcomeOneDay+" 收入 ¥"+incomeOneDay;
topConTv.setText(infoOneDay);
// 获取本月收入和支出总金额
float incomeOneMonth = DBManager.getSumMoneyOneMonth(year, month, 1);
float outcomeOneMonth = DBManager.getSumMoneyOneMonth(year, month, 0);
topInTv.setText("¥"+incomeOneMonth);
topOutTv.setText("¥"+outcomeOneMonth);
// 设置显示运算剩余
float bmoney = preferences.getFloat("bmoney", 0);//预算
if (bmoney == 0) {
topbudgetTv.setText("¥ 0");
}else{
float syMoney = bmoney-outcomeOneMonth;
topbudgetTv.setText("¥"+syMoney);
}
}
// 加载数据库数据
private void loadDBData() {
List<AccountBean> list = DBManager.getAccountListOneDayFromAccounttb(year, month, day);
mDatas.clear();
mDatas.addAll(list);
adapter.notifyDataSetChanged();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.main_iv_search:
Intent it = new Intent(this, SearchActivity.class); //跳转界面
startActivity(it);
break;
case R.id.main_btn_edit:
Intent it1 = new Intent(this, RecordActivity.class); //跳转界面
startActivity(it1);
break;
case R.id.main_btn_more:
MoreDialog moreDialog = new MoreDialog(this);
moreDialog.show();
moreDialog.setDialogSize();
break;
case R.id.item_mainlv_top_tv_budget:
showBudgetDialog();
break;
case R.id.item_mainlv_top_iv_hide:
// 切换TextView明文和密文
toggleShow();
break;
}
if (v == headerView) {
//头布局被点击了
Intent intent = new Intent();
intent.setClass(this, MonthChartActivity.class);
startActivity(intent);
}
}
/** 显示运算设置对话框*/
private void showBudgetDialog() {
BudgetDialog dialog = new BudgetDialog(this);
dialog.show();
dialog.setDialogSize();
dialog.setOnEnsureListener(new BudgetDialog.OnEnsureListener() {
@Override
public void onEnsure(float money) {
//将预算金额写入到共享参数当中,进行存储
SharedPreferences.Editor editor = preferences.edit();
editor.putFloat("bmoney",money);
editor.commit();
//计算剩余金额
float outcomeOneMonth = DBManager.getSumMoneyOneMonth(year, month, 0);
float syMoney = money-outcomeOneMonth;//预算剩余 = 预算-支出
topbudgetTv.setText("¥"+syMoney);
}
});
}
boolean isShow = true;
/**
*
* */
private void toggleShow() {
if (isShow) { //明文====》密文
PasswordTransformationMethod passwordMethod = PasswordTransformationMethod.getInstance();
topInTv.setTransformationMethod(passwordMethod); //设置隐藏
topOutTv.setTransformationMethod(passwordMethod); //设置隐藏
topbudgetTv.setTransformationMethod(passwordMethod); //设置隐藏
topShowIv.setImageResource(R.mipmap.ih_hide);
isShow = false; //设置标志位为隐藏状态
}else{ //密文---》明文
HideReturnsTransformationMethod hideMethod = HideReturnsTransformationMethod.getInstance();
topInTv.setTransformationMethod(hideMethod); //设置隐藏
topOutTv.setTransformationMethod(hideMethod); //设置隐藏
topbudgetTv.setTransformationMethod(hideMethod); //设置隐藏
topShowIv.setImageResource(R.mipmap.ih_show);
isShow = true; //设置标志位为隐藏状态
}
}
}

@ -0,0 +1,153 @@
package com.hui.tally;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.hui.tally.adapter.ChartVPAdapter;
import com.hui.tally.db.DBManager;
import com.hui.tally.frag_chart.IncomChartFragment;
import com.hui.tally.frag_chart.OutcomChartFragment;
import com.hui.tally.utils.CalendarDialog;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class MonthChartActivity extends AppCompatActivity {
Button inBtn,outBtn;
TextView dateTv,inTv,outTv;
ViewPager chartVp;
int year;
int month;
int selectPos = -1,selectMonth =-1;
List<Fragment>chartFragList;
private IncomChartFragment incomChartFragment;
private OutcomChartFragment outcomChartFragment;
private ChartVPAdapter chartVPAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_month_chart);
initView();
initTime();
initStatistics(year,month);
initFrag();
setVPSelectListener();
}
private void setVPSelectListener() {
chartVp.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
@Override
public void onPageSelected(int position) {
setButtonStyle(position);
}
});
}
private void initFrag() {
chartFragList = new ArrayList<>();
// 添加Fragment的对象
incomChartFragment = new IncomChartFragment();
outcomChartFragment = new OutcomChartFragment();
// 添加数据到Fragment当中
Bundle bundle = new Bundle();
bundle.putInt("year",year);
bundle.putInt("month",month);
incomChartFragment.setArguments(bundle);
outcomChartFragment.setArguments(bundle);
// 将Fragment添加到数据源当中
chartFragList.add(outcomChartFragment);
chartFragList.add(incomChartFragment);
// 使用适配器
chartVPAdapter = new ChartVPAdapter(getSupportFragmentManager(), chartFragList);
chartVp.setAdapter(chartVPAdapter);
// 将Fragment加载到Acitivy当中
}
/* 统计某年某月的收支情况数据*/
private void initStatistics(int year, int month) {
float inMoneyOneMonth = DBManager.getSumMoneyOneMonth(year, month, 1); //收入总钱数
float outMoneyOneMonth = DBManager.getSumMoneyOneMonth(year, month, 0); //支出总钱数
int incountItemOneMonth = DBManager.getCountItemOneMonth(year, month, 1); //收入多少笔
int outcountItemOneMonth = DBManager.getCountItemOneMonth(year, month, 0); //支出多少笔
dateTv.setText(year+"年"+month+"月账单");
inTv.setText("共"+incountItemOneMonth+"笔收入, ¥ "+inMoneyOneMonth);
outTv.setText("共"+outcountItemOneMonth+"笔支出, ¥ "+outMoneyOneMonth);
}
/** 初始化时间的方法*/
private void initTime() {
Calendar calendar = Calendar.getInstance();
year = calendar.get(Calendar.YEAR);
month = calendar.get(Calendar.MONTH)+1;
}
/** 初始化控件*/
private void initView() {
inBtn = findViewById(R.id.chart_btn_in);
outBtn = findViewById(R.id.chart_btn_out);
dateTv = findViewById(R.id.chart_tv_date);
inTv = findViewById(R.id.chart_tv_in);
outTv = findViewById(R.id.chart_tv_out);
chartVp = findViewById(R.id.chart_vp);
}
public void onClick(View view) {
switch (view.getId()) {
case R.id.chart_iv_back:
finish();
break;
case R.id.chart_iv_rili:
showCalendarDialog();
break;
case R.id.chart_btn_in:
setButtonStyle(1);
chartVp.setCurrentItem(1);
break;
case R.id.chart_btn_out:
setButtonStyle(0);
chartVp.setCurrentItem(0);
break;
}
}
/* 显示日历对话框*/
private void showCalendarDialog() {
CalendarDialog dialog = new CalendarDialog(this, selectPos, selectMonth);
dialog.show();
dialog.setDialogSize();
dialog.setOnRefreshListener(new CalendarDialog.OnRefreshListener() {
@Override
public void onRefresh(int selPos, int year, int month) {
MonthChartActivity.this.selectPos = selPos;
MonthChartActivity.this.selectMonth = month;
initStatistics(year,month);
incomChartFragment.setDate(year,month);
outcomChartFragment.setDate(year,month);
}
});
}
/* 设置按钮样式的改变 支出-0 收入-1*/
private void setButtonStyle(int kind){
if (kind == 0) {
outBtn.setBackgroundResource(R.drawable.main_recordbtn_bg);
outBtn.setTextColor(Color.WHITE);
inBtn.setBackgroundResource(R.drawable.dialog_btn_bg);
inBtn.setTextColor(Color.BLACK);
}else if (kind == 1){
inBtn.setBackgroundResource(R.drawable.main_recordbtn_bg);
inBtn.setTextColor(Color.WHITE);
outBtn.setBackgroundResource(R.drawable.dialog_btn_bg);
outBtn.setTextColor(Color.BLACK);
}
}
}

@ -0,0 +1,58 @@
package com.hui.tally;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import android.os.Bundle;
import android.view.View;
import com.google.android.material.tabs.TabLayout;
import com.hui.tally.adapter.RecordPagerAdapter;
import com.hui.tally.frag_record.IncomeFragment;
import com.hui.tally.frag_record.BaseRecordFragment;
import com.hui.tally.frag_record.OutcomeFragment;
import java.util.ArrayList;
import java.util.List;
public class RecordActivity extends AppCompatActivity {
TabLayout tabLayout;
ViewPager viewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_record);
//1.查找控件
tabLayout = findViewById(R.id.record_tabs);
viewPager = findViewById(R.id.record_vp);
//2.设置ViewPager加载页面
initPager();
}
private void initPager() {
// 初始化ViewPager页面的集合
List<Fragment>fragmentList = new ArrayList<>();
// 创建收入和支出页面放置在Fragment当中
OutcomeFragment outFrag = new OutcomeFragment(); //支出
IncomeFragment inFrag = new IncomeFragment(); //收入
fragmentList.add(outFrag);
fragmentList.add(inFrag);
// 创建适配器
RecordPagerAdapter pagerAdapter = new RecordPagerAdapter(getSupportFragmentManager(), fragmentList);
// 设置适配器
viewPager.setAdapter(pagerAdapter);
//将TabLayout和ViwePager进行关联
tabLayout.setupWithViewPager(viewPager);
}
/* 点击事件*/
public void onClick(View view) {
switch (view.getId()) {
case R.id.record_iv_back:
finish();
break;
}
}
}

@ -0,0 +1,63 @@
package com.hui.tally;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.hui.tally.adapter.AccountAdapter;
import com.hui.tally.db.AccountBean;
import com.hui.tally.db.DBManager;
import java.util.ArrayList;
import java.util.List;
public class SearchActivity extends AppCompatActivity {
ListView searchLv;
EditText searchEt;
TextView emptyTv;
List<AccountBean>mDatas; //数据源
AccountAdapter adapter; //适配器对象
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);
initView();
mDatas = new ArrayList<>();
adapter = new AccountAdapter(this,mDatas);
searchLv.setAdapter(adapter);
searchLv.setEmptyView(emptyTv); //设置无数局时,显示的控件
}
private void initView() {
searchEt = findViewById(R.id.search_et);
searchLv = findViewById(R.id.search_lv);
emptyTv = findViewById(R.id.search_tv_empty);
}
public void onClick(View view) {
switch (view.getId()) {
case R.id.search_iv_back:
finish();
break;
case R.id.search_iv_sh: //执行搜索的操作
String msg = searchEt.getText().toString().trim();
// 判断输入内容是否为空,如果为空,就提示不能搜索
if (TextUtils.isEmpty(msg)) {
Toast.makeText(this,"输入内容不能为空!",Toast.LENGTH_SHORT).show();
return;
}
//开始搜索
List<AccountBean> list = DBManager.getAccountListByRemarkFromAccounttb(msg);
mDatas.clear();
mDatas.addAll(list);
adapter.notifyDataSetChanged();
break;
}
}
}

@ -0,0 +1,46 @@
package com.hui.tally;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.hui.tally.db.DBManager;
public class SettingActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting);
}
public void onClick(View view) {
switch (view.getId()) {
case R.id.setting_iv_back:
finish();
break;
case R.id.setting_tv_clear:
showDeleteDialog();
break;
}
}
private void showDeleteDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("删除提示")
.setMessage("您确定要删除所有记录么?\n注意删除后无法恢复请慎重选择")
.setPositiveButton("取消",null)
.setNegativeButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
DBManager.deleteAllAccount();
Toast.makeText(SettingActivity.this,"删除成功!",Toast.LENGTH_SHORT).show();
}
});
builder.create().show();
}
}

@ -0,0 +1,15 @@
package com.hui.tally;
import android.app.Application;
import com.hui.tally.db.DBManager;
/* 表示全局应用的类*/
public class UniteApp extends Application {
@Override
public void onCreate() {
super.onCreate();
// 初始化数据库
DBManager.initDB(getApplicationContext());
}
}

@ -0,0 +1,83 @@
package com.hui.tally.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.hui.tally.R;
import com.hui.tally.db.AccountBean;
import java.util.Calendar;
import java.util.List;
public class AccountAdapter extends BaseAdapter {
Context context;
List<AccountBean>mDatas;
LayoutInflater inflater;
int year,month,day;
public AccountAdapter(Context context, List<AccountBean> mDatas) {
this.context = context;
this.mDatas = mDatas;
inflater = LayoutInflater.from(context);
Calendar calendar = Calendar.getInstance();
year = calendar.get(Calendar.YEAR);
month = calendar.get(Calendar.MONTH)+1;
day = calendar.get(Calendar.DAY_OF_MONTH);
}
@Override
public int getCount() {
return mDatas.size();
}
@Override
public Object getItem(int position) {
return mDatas.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_mainlv,parent,false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
AccountBean bean = mDatas.get(position);
holder.typeIv.setImageResource(bean.getsImageId());
holder.typeTv.setText(bean.getTypename());
holder.beizhuTv.setText(bean.getBeizhu());
holder.moneyTv.setText("¥ "+bean.getMoney());
if (bean.getYear()==year&&bean.getMonth()==month&&bean.getDay()==day) {
String time = bean.getTime().split(" ")[1];
holder.timeTv.setText("今天 "+time);
}else {
holder.timeTv.setText(bean.getTime());
}
return convertView;
}
class ViewHolder{
ImageView typeIv;
TextView typeTv,beizhuTv,timeTv,moneyTv;
public ViewHolder(View view){
typeIv = view.findViewById(R.id.item_mainlv_iv);
typeTv = view.findViewById(R.id.item_mainlv_tv_title);
timeTv = view.findViewById(R.id.item_mainlv_tv_time);
beizhuTv = view.findViewById(R.id.item_mainlv_tv_beizhu);
moneyTv = view.findViewById(R.id.item_mainlv_tv_money);
}
}
}

@ -0,0 +1,76 @@
package com.hui.tally.adapter;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.hui.tally.R;
import java.util.ArrayList;
import java.util.List;
/*
* GridView
* */
public class CalendarAdapter extends BaseAdapter {
Context context;
List<String>mDatas;
public int year;
public int selPos = -1;
public void setYear(int year) {
this.year = year;
mDatas.clear();
loadDatas(year);
notifyDataSetChanged();
}
public CalendarAdapter(Context context, int year) {
this.context = context;
this.year = year;
mDatas = new ArrayList<>();
loadDatas(year);
}
private void loadDatas(int year) {
for (int i = 1; i < 13; i++) {
String data = year+"/"+i;
mDatas.add(data);
}
}
@Override
public int getCount() {
return mDatas.size();
}
@Override
public Object getItem(int position) {
return mDatas.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = LayoutInflater.from(context).inflate(R.layout.item_dialogcal_gv,parent,false);
TextView tv = convertView.findViewById(R.id.item_dialogcal_gv_tv);
tv.setText(mDatas.get(position));
tv.setBackgroundResource(R.color.grey_f3f3f3);
tv.setTextColor(Color.BLACK);
if (position == selPos) {
tv.setBackgroundResource(R.color.green_006400);
tv.setTextColor(Color.WHITE);
}
return convertView;
}
}

@ -0,0 +1,78 @@
package com.hui.tally.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.hui.tally.R;
import com.hui.tally.db.ChartItemBean;
import com.hui.tally.utils.FloatUtils;
import java.util.List;
/*
* listview
* */
public class ChartItemAdapter extends BaseAdapter {
Context context;
List<ChartItemBean> mDatas;
LayoutInflater inflater;
public ChartItemAdapter(Context context, List<ChartItemBean> mDatas) {
this.context = context;
this.mDatas = mDatas;
inflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return mDatas.size();
}
@Override
public Object getItem(int position) {
return mDatas.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_chartfrag_lv,parent,false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
// 获取显示内容
ChartItemBean bean = mDatas.get(position);
holder.iv.setImageResource(bean.getsImageId());
holder.typeTv.setText(bean.getType());
float ratio = bean.getRatio();
String pert = FloatUtils.ratioToPercent(ratio);
holder.ratioTv.setText(pert);
holder.totalTv.setText("¥ "+bean.getTotalMoney());
return convertView;
}
class ViewHolder{
TextView typeTv,ratioTv,totalTv;
ImageView iv;
public ViewHolder(View view){
typeTv = view.findViewById(R.id.item_chartfrag_tv_type);
ratioTv = view.findViewById(R.id.item_chartfrag_tv_pert);
totalTv = view.findViewById(R.id.item_chartfrag_tv_sum);
iv = view.findViewById(R.id.item_chartfrag_iv);
}
}
}

@ -0,0 +1,27 @@
package com.hui.tally.adapter;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import java.util.List;
public class ChartVPAdapter extends FragmentPagerAdapter {
List<Fragment>fragmentList;
public ChartVPAdapter(@NonNull FragmentManager fm, List<Fragment>fragmentList) {
super(fm);
this.fragmentList = fragmentList;
}
@NonNull
@Override
public Fragment getItem(int position) {
return fragmentList.get(position);
}
@Override
public int getCount() {
return fragmentList.size();
}
}

@ -0,0 +1,35 @@
package com.hui.tally.adapter;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import java.util.List;
public class RecordPagerAdapter extends FragmentPagerAdapter {
List<Fragment>fragmentList;
String[]titles = {"支出","收入"};
public RecordPagerAdapter(@NonNull FragmentManager fm,List<Fragment>fragmentList) {
super(fm);
this.fragmentList = fragmentList;
}
@NonNull
@Override
public Fragment getItem(int position) {
return fragmentList.get(position);
}
@Override
public int getCount() {
return fragmentList.size();
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return titles[position];
}
}

@ -0,0 +1,110 @@
package com.hui.tally.db;
/** 描述记录一条数据的相关内容类*/
public class AccountBean {
int id;
String typename; //类型
int sImageId; //被选中类型图片
String beizhu; //备注
float money; //价格
String time ; //保存时间字符串
int year;
int month;
int day;
int kind; //类型 收入---1 支出---0
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTypename() {
return typename;
}
public void setTypename(String typename) {
this.typename = typename;
}
public int getsImageId() {
return sImageId;
}
public void setsImageId(int sImageId) {
this.sImageId = sImageId;
}
public String getBeizhu() {
return beizhu;
}
public void setBeizhu(String beizhu) {
this.beizhu = beizhu;
}
public float getMoney() {
return money;
}
public void setMoney(float money) {
this.money = money;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public int getKind() {
return kind;
}
public void setKind(int kind) {
this.kind = kind;
}
public AccountBean() {
}
public AccountBean(int id, String typename, int sImageId, String beizhu, float money, String time, int year, int month, int day, int kind) {
this.id = id;
this.typename = typename;
this.sImageId = sImageId;
this.beizhu = beizhu;
this.money = money;
this.time = time;
this.year = year;
this.month = month;
this.day = day;
this.kind = kind;
}
}

@ -0,0 +1,50 @@
package com.hui.tally.db;
/* 用于描述绘制柱状图时,每一个柱子表示的对象*/
public class BarChartItemBean {
int year;
int month;
int day;
float summoney;
public BarChartItemBean() {
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public float getSummoney() {
return summoney;
}
public void setSummoney(float summoney) {
this.summoney = summoney;
}
public BarChartItemBean(int year, int month, int day, float summoney) {
this.year = year;
this.month = month;
this.day = day;
this.summoney = summoney;
}
}

@ -0,0 +1,50 @@
package com.hui.tally.db;
public class ChartItemBean {
int sImageId;
String type;
float ratio; //所占比例
float totalMoney; //此项的总钱数
public ChartItemBean() {
}
public void setsImageId(int sImageId) {
this.sImageId = sImageId;
}
public void setType(String type) {
this.type = type;
}
public void setRatio(float ratio) {
this.ratio = ratio;
}
public void setTotalMoney(float totalMoney) {
this.totalMoney = totalMoney;
}
public int getsImageId() {
return sImageId;
}
public String getType() {
return type;
}
public float getRatio() {
return ratio;
}
public float getTotalMoney() {
return totalMoney;
}
public ChartItemBean(int sImageId, String type, float ratio, float totalMoney) {
this.sImageId = sImageId;
this.type = type;
this.ratio = ratio;
this.totalMoney = totalMoney;
}
}

@ -0,0 +1,265 @@
package com.hui.tally.db;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import com.hui.tally.utils.FloatUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/*
*
*
* */
public class DBManager {
private static SQLiteDatabase db;
/* 初始化数据库对象*/
public static void initDB(Context context){
DBOpenHelper helper = new DBOpenHelper(context); //得到帮助类对象
db = helper.getWritableDatabase(); //得到数据库对象
}
/**
*
* kind :
* */
public static List<TypeBean>getTypeList(int kind){
List<TypeBean>list = new ArrayList<>();
//读取typetb表当中的数据
String sql = "select * from typetb where kind = "+kind;
Cursor cursor = db.rawQuery(sql, null);
// 循环读取游标内容,存储到对象当中
while (cursor.moveToNext()) {
String typename = cursor.getString(cursor.getColumnIndex("typename"));
int imageId = cursor.getInt(cursor.getColumnIndex("imageId"));
int sImageId = cursor.getInt(cursor.getColumnIndex("sImageId"));
int kind1 = cursor.getInt(cursor.getColumnIndex("kind"));
int id = cursor.getInt(cursor.getColumnIndex("id"));
TypeBean typeBean = new TypeBean(id, typename, imageId, sImageId, kind);
list.add(typeBean);
}
return list;
}
/*
*
* */
public static void insertItemToAccounttb(AccountBean bean){
ContentValues values = new ContentValues();
values.put("typename",bean.getTypename());
values.put("sImageId",bean.getsImageId());
values.put("beizhu",bean.getBeizhu());
values.put("money",bean.getMoney());
values.put("time",bean.getTime());
values.put("year",bean.getYear());
values.put("month",bean.getMonth());
values.put("day",bean.getDay());
values.put("kind",bean.getKind());
db.insert("accounttb",null,values);
}
/*
*
* */
public static List<AccountBean>getAccountListOneDayFromAccounttb(int year,int month,int day){
List<AccountBean>list = new ArrayList<>();
String sql = "select * from accounttb where year=? and month=? and day=? order by id desc";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", day + ""});
//遍历符合要求的每一行数据
while (cursor.moveToNext()) {
int id = cursor.getInt(cursor.getColumnIndex("id"));
String typename = cursor.getString(cursor.getColumnIndex("typename"));
String beizhu = cursor.getString(cursor.getColumnIndex("beizhu"));
String time = cursor.getString(cursor.getColumnIndex("time"));
int sImageId = cursor.getInt(cursor.getColumnIndex("sImageId"));
int kind = cursor.getInt(cursor.getColumnIndex("kind"));
float money = cursor.getFloat(cursor.getColumnIndex("money"));
AccountBean accountBean = new AccountBean(id, typename, sImageId, beizhu, money, time, year, month, day, kind);
list.add(accountBean);
}
return list;
}
/*
*
* */
public static List<AccountBean>getAccountListOneMonthFromAccounttb(int year,int month){
List<AccountBean>list = new ArrayList<>();
String sql = "select * from accounttb where year=? and month=? order by id desc";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + ""});
//遍历符合要求的每一行数据
while (cursor.moveToNext()) {
int id = cursor.getInt(cursor.getColumnIndex("id"));
String typename = cursor.getString(cursor.getColumnIndex("typename"));
String beizhu = cursor.getString(cursor.getColumnIndex("beizhu"));
String time = cursor.getString(cursor.getColumnIndex("time"));
int sImageId = cursor.getInt(cursor.getColumnIndex("sImageId"));
int kind = cursor.getInt(cursor.getColumnIndex("kind"));
float money = cursor.getFloat(cursor.getColumnIndex("money"));
int day = cursor.getInt(cursor.getColumnIndex("day"));
AccountBean accountBean = new AccountBean(id, typename, sImageId, beizhu, money, time, year, month, day, kind);
list.add(accountBean);
}
return list;
}
/**
* kind==0 ===1
* */
public static float getSumMoneyOneDay(int year,int month,int day,int kind){
float total = 0.0f;
String sql = "select sum(money) from accounttb where year=? and month=? and day=? and kind=?";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", day + "", kind + ""});
// 遍历
if (cursor.moveToFirst()) {
float money = cursor.getFloat(cursor.getColumnIndex("sum(money)"));
total = money;
}
return total;
}
/**
* kind==0 ===1
* */
public static float getSumMoneyOneMonth(int year,int month,int kind){
float total = 0.0f;
String sql = "select sum(money) from accounttb where year=? and month=? and kind=?";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", kind + ""});
// 遍历
if (cursor.moveToFirst()) {
float money = cursor.getFloat(cursor.getColumnIndex("sum(money)"));
total = money;
}
return total;
}
/** 统计某月份支出或者收入情况有多少条 收入-1 支出-0*/
public static int getCountItemOneMonth(int year,int month,int kind){
int total = 0;
String sql = "select count(money) from accounttb where year=? and month=? and kind=?";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", kind + ""});
if (cursor.moveToFirst()) {
int count = cursor.getInt(cursor.getColumnIndex("count(money)"));
total = count;
}
return total;
}
/**
* kind==0 ===1
* */
public static float getSumMoneyOneYear(int year,int kind){
float total = 0.0f;
String sql = "select sum(money) from accounttb where year=? and kind=?";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", kind + ""});
// 遍历
if (cursor.moveToFirst()) {
float money = cursor.getFloat(cursor.getColumnIndex("sum(money)"));
total = money;
}
return total;
}
/*
* idaccounttb
* */
public static int deleteItemFromAccounttbById(int id){
int i = db.delete("accounttb", "id=?", new String[]{id + ""});
return i;
}
/**
*
* */
public static List<AccountBean>getAccountListByRemarkFromAccounttb(String beizhu){
List<AccountBean>list = new ArrayList<>();
String sql = "select * from accounttb where beizhu like '%"+beizhu+"%'";
Cursor cursor = db.rawQuery(sql, null);
while (cursor.moveToNext()) {
int id = cursor.getInt(cursor.getColumnIndex("id"));
String typename = cursor.getString(cursor.getColumnIndex("typename"));
String bz = cursor.getString(cursor.getColumnIndex("beizhu"));
String time = cursor.getString(cursor.getColumnIndex("time"));
int sImageId = cursor.getInt(cursor.getColumnIndex("sImageId"));
int kind = cursor.getInt(cursor.getColumnIndex("kind"));
float money = cursor.getFloat(cursor.getColumnIndex("money"));
int year = cursor.getInt(cursor.getColumnIndex("year"));
int month = cursor.getInt(cursor.getColumnIndex("month"));
int day = cursor.getInt(cursor.getColumnIndex("day"));
AccountBean accountBean = new AccountBean(id, typename, sImageId, bz, money, time, year, month, day, kind);
list.add(accountBean);
}
return list;
}
/**
*
* */
public static List<Integer>getYearListFromAccounttb(){
List<Integer>list = new ArrayList<>();
String sql = "select distinct(year) from accounttb order by year asc";
Cursor cursor = db.rawQuery(sql, null);
while (cursor.moveToNext()) {
int year = cursor.getInt(cursor.getColumnIndex("year"));
list.add(year);
}
return list;
}
/*
* accounttb
* */
public static void deleteAllAccount(){
String sql = "delete from accounttb";
db.execSQL(sql);
}
/**
*
* */
public static List<ChartItemBean>getChartListFromAccounttb(int year,int month,int kind){
List<ChartItemBean>list = new ArrayList<>();
float sumMoneyOneMonth = getSumMoneyOneMonth(year, month, kind); //求出支出或者收入总钱数
String sql = "select typename,sImageId,sum(money)as total from accounttb where year=? and month=? and kind=? group by typename " +
"order by total desc";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", kind + ""});
while (cursor.moveToNext()) {
int sImageId = cursor.getInt(cursor.getColumnIndex("sImageId"));
String typename = cursor.getString(cursor.getColumnIndex("typename"));
float total = cursor.getFloat(cursor.getColumnIndex("total"));
//计算所占百分比 total /sumMonth
float ratio = FloatUtils.div(total,sumMoneyOneMonth);
ChartItemBean bean = new ChartItemBean(sImageId, typename, ratio, total);
list.add(bean);
}
return list;
}
/**
*
* */
public static float getMaxMoneyOneDayInMonth(int year,int month,int kind){
String sql = "select sum(money) from accounttb where year=? and month=? and kind=? group by day order by sum(money) desc";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", kind + ""});
if (cursor.moveToFirst()) {
float money = cursor.getFloat(cursor.getColumnIndex("sum(money)"));
return money;
}
return 0;
}
/** 根据指定月份每一日收入或者支出的总钱数的集合*/
public static List<BarChartItemBean>getSumMoneyOneDayInMonth(int year,int month,int kind){
String sql = "select day,sum(money) from accounttb where year=? and month=? and kind=? group by day";
Cursor cursor = db.rawQuery(sql, new String[]{year + "", month + "", kind + ""});
List<BarChartItemBean>list = new ArrayList<>();
while (cursor.moveToNext()) {
int day = cursor.getInt(cursor.getColumnIndex("day"));
float smoney = cursor.getFloat(cursor.getColumnIndex("sum(money)"));
BarChartItemBean itemBean = new BarChartItemBean(year, month, day, smoney);
list.add(itemBean);
}
return list;
}
}

@ -0,0 +1,64 @@
package com.hui.tally.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.Nullable;
import com.hui.tally.R;
public class DBOpenHelper extends SQLiteOpenHelper {
public DBOpenHelper(@Nullable Context context) {
super(context,"tally.db" , null, 1);
}
// 创建数据库的方法,只有项目第一次运行时,会被调用
@Override
public void onCreate(SQLiteDatabase db) {
// 创建表示类型的表
String sql = "create table typetb(id integer primary key autoincrement,typename varchar(10),imageId integer,sImageId integer,kind integer)";
db.execSQL(sql);
insertType(db);
//创建记账表
sql = "create table accounttb(id integer primary key autoincrement,typename varchar(10),sImageId integer,beizhu varchar(80),money float," +
"time varchar(60),year integer,month integer,day integer,kind integer)";
db.execSQL(sql);
}
private void insertType(SQLiteDatabase db) {
// 向typetb表当中插入元素
String sql = "insert into typetb (typename,imageId,sImageId,kind) values (?,?,?,?)";
db.execSQL(sql,new Object[]{"其他", R.mipmap.ic_qita,R.mipmap.ic_qita_fs,0});
db.execSQL(sql,new Object[]{"餐饮", R.mipmap.ic_canyin,R.mipmap.ic_canyin_fs,0});
db.execSQL(sql,new Object[]{"交通", R.mipmap.ic_jiaotong,R.mipmap.ic_jiaotong_fs,0});
db.execSQL(sql,new Object[]{"购物", R.mipmap.ic_gouwu,R.mipmap.ic_gouwu_fs,0});
db.execSQL(sql,new Object[]{"服饰", R.mipmap.ic_fushi,R.mipmap.ic_fushi_fs,0});
db.execSQL(sql,new Object[]{"日用品", R.mipmap.ic_riyongpin,R.mipmap.ic_riyongpin_fs,0});
db.execSQL(sql,new Object[]{"娱乐", R.mipmap.ic_yule,R.mipmap.ic_yule_fs,0});
db.execSQL(sql,new Object[]{"零食", R.mipmap.ic_lingshi,R.mipmap.ic_lingshi_fs,0});
db.execSQL(sql,new Object[]{"烟酒茶", R.mipmap.ic_yanjiu,R.mipmap.ic_yanjiu_fs,0});
db.execSQL(sql,new Object[]{"学习", R.mipmap.ic_xuexi,R.mipmap.ic_xuexi_fs,0});
db.execSQL(sql,new Object[]{"医疗", R.mipmap.ic_yiliao,R.mipmap.ic_yiliao_fs,0});
db.execSQL(sql,new Object[]{"住宅", R.mipmap.ic_zhufang,R.mipmap.ic_zhufang_fs,0});
db.execSQL(sql,new Object[]{"水电煤", R.mipmap.ic_shuidianfei,R.mipmap.ic_shuidianfei_fs,0});
db.execSQL(sql,new Object[]{"通讯", R.mipmap.ic_tongxun,R.mipmap.ic_tongxun_fs,0});
db.execSQL(sql,new Object[]{"人情往来", R.mipmap.ic_renqingwanglai,R.mipmap.ic_renqingwanglai_fs,0});
db.execSQL(sql,new Object[]{"其他", R.mipmap.in_qt,R.mipmap.in_qt_fs,1});
db.execSQL(sql,new Object[]{"薪资", R.mipmap.in_xinzi,R.mipmap.in_xinzi_fs,1});
db.execSQL(sql,new Object[]{"奖金", R.mipmap.in_jiangjin,R.mipmap.in_jiangjin_fs,1});
db.execSQL(sql,new Object[]{"借入", R.mipmap.in_jieru,R.mipmap.in_jieru_fs,1});
db.execSQL(sql,new Object[]{"收债", R.mipmap.in_shouzhai,R.mipmap.in_shouzhai_fs,1});
db.execSQL(sql,new Object[]{"利息收入", R.mipmap.in_lixifuji,R.mipmap.in_lixifuji_fs,1});
db.execSQL(sql,new Object[]{"投资回报", R.mipmap.in_touzi,R.mipmap.in_touzi_fs,1});
db.execSQL(sql,new Object[]{"二手交易", R.mipmap.in_ershoushebei,R.mipmap.in_ershoushebei_fs,1});
db.execSQL(sql,new Object[]{"意外所得", R.mipmap.in_yiwai,R.mipmap.in_yiwai_fs,1});
}
// 数据库版本在更新时发生改变,会调用此方法
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}

@ -0,0 +1,62 @@
package com.hui.tally.db;
/*
*
* */
public class TypeBean {
int id;
String typename; //类型名称
int imageId; //未被选中图片id
int simageId; //被选中图片id
int kind; //收入-1 支出-0
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTypename() {
return typename;
}
public void setTypename(String typename) {
this.typename = typename;
}
public int getImageId() {
return imageId;
}
public void setImageId(int imageId) {
this.imageId = imageId;
}
public int getSimageId() {
return simageId;
}
public void setSimageId(int simageId) {
this.simageId = simageId;
}
public int getKind() {
return kind;
}
public void setKind(int kind) {
this.kind = kind;
}
public TypeBean() {
}
public TypeBean(int id, String typename, int imageId, int simageId, int kind) {
this.id = id;
this.typename = typename;
this.imageId = imageId;
this.simageId = simageId;
this.kind = kind;
}
}

@ -0,0 +1,138 @@
package com.hui.tally.frag_chart;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.components.AxisBase;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.formatter.IAxisValueFormatter;
import com.hui.tally.R;
import com.hui.tally.adapter.ChartItemAdapter;
import com.hui.tally.db.ChartItemBean;
import com.hui.tally.db.DBManager;
import java.util.ArrayList;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
*/
abstract public class BaseChartFragment extends Fragment {
ListView chartLv;
int year;
int month;
List<ChartItemBean>mDatas; //数据源
private ChartItemAdapter itemAdapter;
BarChart barChart; //代表柱状图的控件
TextView chartTv; //如果没有收支情况显示的TextView
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_incom_chart, container, false);
chartLv = view.findViewById(R.id.frag_chart_lv);
//获取Activity传递的数据
Bundle bundle = getArguments();
year = bundle.getInt("year");
month = bundle.getInt("month");
//设置数据源
mDatas = new ArrayList<>();
// 设置适配器
itemAdapter = new ChartItemAdapter(getContext(), mDatas);
chartLv.setAdapter(itemAdapter);
// 添加头布局
addLVHeaderView();
return view;
}
protected void addLVHeaderView(){
// 将布局转换成View对象
View headerView = getLayoutInflater().inflate(R.layout.item_chartfrag_top,null);
// 将View添加到ListView的头布局上
chartLv.addHeaderView(headerView);
// 查找头布局当中包含的控件
barChart = headerView.findViewById(R.id.item_chartfrag_chart);
chartTv = headerView.findViewById(R.id.item_chartfrag_top_tv);
// 设定柱状图不显示描述
barChart.getDescription().setEnabled(false);
// 设置柱状图的内边距
barChart.setExtraOffsets(20, 20, 20, 20);
setAxis(year,month); // 设置坐标轴
// 设置坐标轴显示的数据
setAxisData(year,month);
}
/** 设置坐标轴显示的数据*/
protected abstract void setAxisData(int year, int month);
/** 设置柱状图坐标轴的显示 方法必须重新*/
protected void setAxis(int year, final int month){
// 设置X轴
XAxis xAxis = barChart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); //设置x轴显示在下方
xAxis.setDrawGridLines(true); //设置绘制该轴的网格线
// 设置x轴标签的个数
xAxis.setLabelCount(31);
xAxis.setTextSize(12f); //x轴标签的大小
// 设置X轴显示的值的格式
xAxis.setValueFormatter(new IAxisValueFormatter() {
@Override
public String getFormattedValue(float value, AxisBase axis) {
int val = (int) value;
if (val == 0) {
return month+"-1";
}
if (val==14) {
return month+"-15";
}
// 根据不同的月份,显示最后一天的位置
if (month==2) {
if (val == 27) {
return month+"-28";
}
}else if(month==1||month==3||month==5||month==7||month==8||month==10||month==12){
if (val == 30) {
return month+"-31";
}
}else if(month==4||month==6||month==9||month==11){
if (val==29) {
return month+"-30";
}
}
return "";
}
});
xAxis.setYOffset(10); // 设置标签对x轴的偏移量垂直方向
// y轴在子类的设置
setYAxis(year,month);
}
/* 设置y轴因为最高的坐标不确定所以在子类当中设置*/
protected abstract void setYAxis(int year,int month);
public void setDate(int year,int month){
this.year = year;
this.month = month;
// 清空柱状图当中的数据
barChart.clear();
barChart.invalidate(); //重新绘制柱状图
setAxis(year,month);
setAxisData(year,month);
}
public void loadData(int year,int month,int kind) {
List<ChartItemBean> list = DBManager.getChartListFromAccounttb(year, month, kind);
mDatas.clear();
mDatas.addAll(list);
itemAdapter.notifyDataSetChanged();
}
}

@ -0,0 +1,120 @@
package com.hui.tally.frag_chart;
import android.graphics.Color;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.formatter.IValueFormatter;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import com.github.mikephil.charting.utils.ViewPortHandler;
import com.hui.tally.R;
import com.hui.tally.adapter.ChartItemAdapter;
import com.hui.tally.db.BarChartItemBean;
import com.hui.tally.db.ChartItemBean;
import com.hui.tally.db.DBManager;
import java.util.ArrayList;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
*/
public class IncomChartFragment extends BaseChartFragment {
int kind = 1;
@Override
public void onResume() {
super.onResume();
loadData(year,month,kind);
}
@Override
protected void setAxisData(int year, int month) {
List<IBarDataSet> sets = new ArrayList<>();
// 获取这个月每天的支出总金额,
List<BarChartItemBean> list = DBManager.getSumMoneyOneDayInMonth(year, month, kind);
if (list.size() == 0) {
barChart.setVisibility(View.GONE);
chartTv.setVisibility(View.VISIBLE);
}else{
barChart.setVisibility(View.VISIBLE);
chartTv.setVisibility(View.GONE);
// 设置有多少根柱子
List<BarEntry> barEntries1 = new ArrayList<>();
for (int i = 0; i < 31; i++) {
// 初始化每一根柱子,添加到柱状图当中
BarEntry entry = new BarEntry(i, 0.0f);
barEntries1.add(entry);
}
for (int i = 0; i < list.size(); i++) {
BarChartItemBean itemBean = list.get(i);
int day = itemBean.getDay(); //获取日期
// 根据天数获取x轴的位置
int xIndex = day-1;
BarEntry barEntry = barEntries1.get(xIndex);
barEntry.setY(itemBean.getSummoney());
}
BarDataSet barDataSet1 = new BarDataSet(barEntries1, "");
barDataSet1.setValueTextColor(Color.BLACK); // 值的颜色
barDataSet1.setValueTextSize(8f); // 值的大小
barDataSet1.setColor(Color.parseColor("#006400")); // 柱子的颜色
// 设置柱子上数据显示的格式
barDataSet1.setValueFormatter(new IValueFormatter() {
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
// 此处的value默认保存一位小数
if (value==0) {
return "";
}
return value + "";
}
});
sets.add(barDataSet1);
BarData barData = new BarData(sets);
barData.setBarWidth(0.2f); // 设置柱子的宽度
barChart.setData(barData);
}
}
@Override
protected void setYAxis(int year, int month) {
// 获取本月收入最高的一天为多少将他设定为y轴的最大值
float maxMoney = DBManager.getMaxMoneyOneDayInMonth(year, month, kind);
float max = (float) Math.ceil(maxMoney); // 将最大金额向上取整
// 设置y轴
YAxis yAxis_right = barChart.getAxisRight();
yAxis_right.setAxisMaximum(max); // 设置y轴的最大值
yAxis_right.setAxisMinimum(0f); // 设置y轴的最小值
yAxis_right.setEnabled(false); // 不显示右边的y轴
YAxis yAxis_left = barChart.getAxisLeft();
yAxis_left.setAxisMaximum(max);
yAxis_left.setAxisMinimum(0f);
yAxis_left.setEnabled(false);
// 设置不显示图例
Legend legend = barChart.getLegend();
legend.setEnabled(false);
}
@Override
public void setDate(int year, int month) {
super.setDate(year, month);
loadData(year,month,kind);
}
}

@ -0,0 +1,116 @@
package com.hui.tally.frag_chart;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.formatter.IValueFormatter;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import com.github.mikephil.charting.utils.ViewPortHandler;
import com.hui.tally.R;
import com.hui.tally.db.BarChartItemBean;
import com.hui.tally.db.DBManager;
import java.util.ArrayList;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
*/
public class OutcomChartFragment extends BaseChartFragment {
int kind = 0;
@Override
public void onResume() {
super.onResume();
loadData(year,month,kind);
}
@Override
protected void setAxisData(int year, int month) {
List<IBarDataSet> sets = new ArrayList<>();
// 获取这个月每天的支出总金额,
List<BarChartItemBean> list = DBManager.getSumMoneyOneDayInMonth(year, month, kind);
if (list.size() == 0) {
barChart.setVisibility(View.GONE);
chartTv.setVisibility(View.VISIBLE);
}else{
barChart.setVisibility(View.VISIBLE);
chartTv.setVisibility(View.GONE);
// 设置有多少根柱子
List<BarEntry> barEntries1 = new ArrayList<>();
for (int i = 0; i < 31; i++) {
// 初始化每一根柱子,添加到柱状图当中
BarEntry entry = new BarEntry(i, 0.0f);
barEntries1.add(entry);
}
for (int i = 0; i < list.size(); i++) {
BarChartItemBean itemBean = list.get(i);
int day = itemBean.getDay(); //获取日期
// 根据天数获取x轴的位置
int xIndex = day-1;
BarEntry barEntry = barEntries1.get(xIndex);
barEntry.setY(itemBean.getSummoney());
}
BarDataSet barDataSet1 = new BarDataSet(barEntries1, "");
barDataSet1.setValueTextColor(Color.BLACK); // 值的颜色
barDataSet1.setValueTextSize(8f); // 值的大小
barDataSet1.setColor(Color.RED); // 柱子的颜色
// 设置柱子上数据显示的格式
barDataSet1.setValueFormatter(new IValueFormatter() {
@Override
public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
// 此处的value默认保存一位小数
if (value==0) {
return "";
}
return value + "";
}
});
sets.add(barDataSet1);
BarData barData = new BarData(sets);
barData.setBarWidth(0.2f); // 设置柱子的宽度
barChart.setData(barData);
}
}
@Override
protected void setYAxis(int year, int month) {
// 获取本月收入最高的一天为多少将他设定为y轴的最大值
float maxMoney = DBManager.getMaxMoneyOneDayInMonth(year, month, kind);
float max = (float) Math.ceil(maxMoney); // 将最大金额向上取整
// 设置y轴
YAxis yAxis_right = barChart.getAxisRight();
yAxis_right.setAxisMaximum(max); // 设置y轴的最大值
yAxis_right.setAxisMinimum(0f); // 设置y轴的最小值
yAxis_right.setEnabled(false); // 不显示右边的y轴
YAxis yAxis_left = barChart.getAxisLeft();
yAxis_left.setAxisMaximum(max);
yAxis_left.setAxisMinimum(0f);
yAxis_left.setEnabled(false);
// 设置不显示图例
Legend legend = barChart.getLegend();
legend.setEnabled(false);
}
@Override
public void setDate(int year, int month) {
super.setDate(year, month);
loadData(year,month,kind);
}
}

@ -0,0 +1,188 @@
package com.hui.tally.frag_record;
import android.inputmethodservice.KeyboardView;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
import com.hui.tally.R;
import com.hui.tally.db.AccountBean;
import com.hui.tally.db.DBManager;
import com.hui.tally.db.TypeBean;
import com.hui.tally.utils.BeiZhuDialog;
import com.hui.tally.utils.KeyBoardUtils;
import com.hui.tally.utils.SelectTimeDialog;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
*
*/
public abstract class BaseRecordFragment extends Fragment implements View.OnClickListener {
KeyboardView keyboardView;
EditText moneyEt;
ImageView typeIv;
TextView typeTv,beizhuTv,timeTv;
GridView typeGv;
List<TypeBean>typeList;
TypeBaseAdapter adapter;
AccountBean accountBean; //将需要插入到记账本当中的数据保存成对象的形式
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
accountBean = new AccountBean(); //创建对象
accountBean.setTypename("其他");
accountBean.setsImageId(R.mipmap.ic_qita_fs);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_outcome, container, false);
initView(view);
setInitTime();
//给GridView填充数据的方法
loadDataToGV();
setGVListener(); //设置GridView每一项的点击事件
return view;
}
/* 获取当前时间显示在timeTv上*/
private void setInitTime() {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
String time = sdf.format(date);
timeTv.setText(time);
accountBean.setTime(time);
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH)+1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
accountBean.setYear(year);
accountBean.setMonth(month);
accountBean.setDay(day);
}
/* 设置GridView每一项的点击事件*/
private void setGVListener() {
typeGv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
adapter.selectPos = position;
adapter.notifyDataSetInvalidated(); //提示绘制发生变化了
TypeBean typeBean = typeList.get(position);
String typename = typeBean.getTypename();
typeTv.setText(typename);
accountBean.setTypename(typename);
int simageId = typeBean.getSimageId();
typeIv.setImageResource(simageId);
accountBean.setsImageId(simageId);
}
});
}
/* 给GridView填出数据的方法*/
public void loadDataToGV() {
typeList = new ArrayList<>();
adapter = new TypeBaseAdapter(getContext(), typeList);
typeGv.setAdapter(adapter);
}
private void initView(View view) {
keyboardView = view.findViewById(R.id.frag_record_keyboard);
moneyEt = view.findViewById(R.id.frag_record_et_money);
typeIv = view.findViewById(R.id.frag_record_iv);
typeGv = view.findViewById(R.id.frag_record_gv);
typeTv = view.findViewById(R.id.frag_record_tv_type);
beizhuTv = view.findViewById(R.id.frag_record_tv_beizhu);
timeTv = view.findViewById(R.id.frag_record_tv_time);
beizhuTv.setOnClickListener(this);
timeTv.setOnClickListener(this);
//让自定义软键盘显示出来
KeyBoardUtils boardUtils = new KeyBoardUtils(keyboardView, moneyEt);
boardUtils.showKeyboard();
//设置接口,监听确定按钮按钮被点击了
boardUtils.setOnEnsureListener(new KeyBoardUtils.OnEnsureListener() {
@Override
public void onEnsure() {
//获取输入钱数
String moneyStr = moneyEt.getText().toString();
if (TextUtils.isEmpty(moneyStr)||moneyStr.equals("0")) {
getActivity().finish();
return;
}
float money = Float.parseFloat(moneyStr);
accountBean.setMoney(money);
//获取记录的信息,保存在数据库当中
saveAccountToDB();
// 返回上一级页面
getActivity().finish();
}
});
}
/* 让子类一定要重写这个方法*/
public abstract void saveAccountToDB();
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.frag_record_tv_time:
showTimeDialog();
break;
case R.id.frag_record_tv_beizhu:
showBZDialog();
break;
}
}
/* 弹出显示时间的对话框*/
private void showTimeDialog() {
SelectTimeDialog dialog = new SelectTimeDialog(getContext());
dialog.show();
//设定确定按钮被点击了的监听器
dialog.setOnEnsureListener(new SelectTimeDialog.OnEnsureListener() {
@Override
public void onEnsure(String time, int year, int month, int day) {
timeTv.setText(time);
accountBean.setTime(time);
accountBean.setYear(year);
accountBean.setMonth(month);
accountBean.setDay(day);
}
});
}
/* 弹出备注对话框*/
public void showBZDialog(){
final BeiZhuDialog dialog = new BeiZhuDialog(getContext());
dialog.show();
dialog.setDialogSize();
dialog.setOnEnsureListener(new BeiZhuDialog.OnEnsureListener() {
@Override
public void onEnsure() {
String msg = dialog.getEditText();
if (!TextUtils.isEmpty(msg)) {
beizhuTv.setText(msg);
accountBean.setBeizhu(msg);
}
dialog.cancel();
}
});
}
}

@ -0,0 +1,28 @@
package com.hui.tally.frag_record;
import com.hui.tally.R;
import com.hui.tally.db.DBManager;
import com.hui.tally.db.TypeBean;
import java.util.List;
/**
*
*/
public class IncomeFragment extends BaseRecordFragment {
@Override
public void loadDataToGV() {
super.loadDataToGV();
//获取数据库当中的数据源
List<TypeBean> inlist = DBManager.getTypeList(1);
typeList.addAll(inlist);
adapter.notifyDataSetChanged();
typeTv.setText("其他");
typeIv.setImageResource(R.mipmap.in_qt_fs);
}
@Override
public void saveAccountToDB() {
accountBean.setKind(1);
DBManager.insertItemToAccounttb(accountBean);
}
}

@ -0,0 +1,30 @@
package com.hui.tally.frag_record;
import androidx.fragment.app.Fragment;
import com.hui.tally.R;
import com.hui.tally.db.DBManager;
import com.hui.tally.db.TypeBean;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
*/
public class OutcomeFragment extends BaseRecordFragment {
// 重写
@Override
public void loadDataToGV() {
super.loadDataToGV();
//获取数据库当中的数据源
List<TypeBean> outlist = DBManager.getTypeList(0);
typeList.addAll(outlist);
adapter.notifyDataSetChanged();
typeTv.setText("其他");
typeIv.setImageResource(R.mipmap.ic_qita_fs);
}
@Override
public void saveAccountToDB() {
accountBean.setKind(0);
DBManager.insertItemToAccounttb(accountBean);
}
}

@ -0,0 +1,54 @@
package com.hui.tally.frag_record;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.hui.tally.R;
import com.hui.tally.db.TypeBean;
import java.util.List;
public class TypeBaseAdapter extends BaseAdapter {
Context context;
List<TypeBean>mDatas;
int selectPos = 0; //选中位置
public TypeBaseAdapter(Context context, List<TypeBean> mDatas) {
this.context = context;
this.mDatas = mDatas;
}
@Override
public int getCount() {
return mDatas.size();
}
@Override
public Object getItem(int position) {
return mDatas.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
// 此适配器不考虑复用问题因为所有的item都显示在界面上不会因为滑动就消失所有没有剩余的convertView所以不用复写
@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = LayoutInflater.from(context).inflate(R.layout.item_recordfrag_gv,parent,false);
//查找布局当中的控件
ImageView iv = convertView.findViewById(R.id.item_recordfrag_iv);
TextView tv = convertView.findViewById(R.id.item_recordfrag_tv);
//获取指定位置的数据源
TypeBean typeBean = mDatas.get(position);
tv.setText(typeBean.getTypename());
// 判断当前位置是否为选中位置,如果是选中位置,就设置为带颜色的图片,否则为灰色图片
if (selectPos == position) {
iv.setImageResource(typeBean.getSimageId());
}else{
iv.setImageResource(typeBean.getImageId());
}
return convertView;
}
}

@ -0,0 +1,89 @@
package com.hui.tally.utils;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import androidx.annotation.NonNull;
import com.hui.tally.R;
public class BeiZhuDialog extends Dialog implements View.OnClickListener {
EditText et;
Button cancelBtn,ensureBtn;
OnEnsureListener onEnsureListener;
// 设定回调接口的方法
public void setOnEnsureListener(OnEnsureListener onEnsureListener) {
this.onEnsureListener = onEnsureListener;
}
public BeiZhuDialog(@NonNull Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_beizhu);//设置对话框显示布局
et = findViewById(R.id.dialog_beizhu_et);
cancelBtn = findViewById(R.id.dialog_beizhu_btn_cancel);
ensureBtn = findViewById(R.id.dialog_beizhu_btn_ensure);
cancelBtn.setOnClickListener(this);
ensureBtn.setOnClickListener(this);
}
public interface OnEnsureListener{
public void onEnsure();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.dialog_beizhu_btn_cancel:
cancel();
break;
case R.id.dialog_beizhu_btn_ensure:
if (onEnsureListener!=null) {
onEnsureListener.onEnsure();
}
break;
}
}
// 获取输入数据的方法
public String getEditText(){
return et.getText().toString().trim();
}
/* 设置Dialog的尺寸和屏幕尺寸一致*/
public void setDialogSize(){
// 获取当前窗口对象
Window window = getWindow();
// 获取窗口对象的参数
WindowManager.LayoutParams wlp = window.getAttributes();
// 获取屏幕宽度
Display d = window.getWindowManager().getDefaultDisplay();
wlp.width = (int)(d.getWidth()); //对话框窗口为屏幕窗口
wlp.gravity = Gravity.BOTTOM;
window.setBackgroundDrawableResource(android.R.color.transparent);
window.setAttributes(wlp);
handler.sendEmptyMessageDelayed(1,100);
}
Handler handler = new Handler(){
@Override
public void handleMessage(@NonNull Message msg) {
//自动弹出软键盘的方法
InputMethodManager inputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInput(0,InputMethodManager.HIDE_NOT_ALWAYS);
}
};
}

@ -0,0 +1,101 @@
package com.hui.tally.utils;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import com.hui.tally.R;
public class BudgetDialog extends Dialog implements View.OnClickListener {
ImageView cancelIv;
Button ensureBtn;
EditText moneyEt;
public interface OnEnsureListener{
public void onEnsure(float money);
}
OnEnsureListener onEnsureListener;
public void setOnEnsureListener(OnEnsureListener onEnsureListener) {
this.onEnsureListener = onEnsureListener;
}
public BudgetDialog(@NonNull Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_budget);
cancelIv = findViewById(R.id.dialog_budget_iv_error);
ensureBtn = findViewById(R.id.dialog_budget_btn_ensure);
moneyEt = findViewById(R.id.dialog_budget_et);
cancelIv.setOnClickListener(this);
ensureBtn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.dialog_budget_iv_error:
cancel(); //取消对话框
break;
case R.id.dialog_budget_btn_ensure:
//获取输入数据数值
String data = moneyEt.getText().toString();
if (TextUtils.isEmpty(data)) {
Toast.makeText(getContext(),"输入数据不能为空!",Toast.LENGTH_SHORT).show();
return;
}
float money = Float.parseFloat(data);
if (money<=0) {
Toast.makeText(getContext(),"预算金额必须大于0",Toast.LENGTH_SHORT).show();
return;
}
if (onEnsureListener!=null) {
onEnsureListener.onEnsure(money);
}
cancel();
break;
}
}
/* 设置Dialog的尺寸和屏幕尺寸一致*/
public void setDialogSize(){
// 获取当前窗口对象
Window window = getWindow();
// 获取窗口对象的参数
WindowManager.LayoutParams wlp = window.getAttributes();
// 获取屏幕宽度
Display d = window.getWindowManager().getDefaultDisplay();
wlp.width = (int)(d.getWidth()); //对话框窗口为屏幕窗口
wlp.gravity = Gravity.BOTTOM;
window.setBackgroundDrawableResource(android.R.color.transparent);
window.setAttributes(wlp);
handler.sendEmptyMessageDelayed(1,100);
}
Handler handler = new Handler(){
@Override
public void handleMessage(@NonNull Message msg) {
//自动弹出软键盘的方法
InputMethodManager inputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInput(0,InputMethodManager.HIDE_NOT_ALWAYS);
}
};
}

@ -0,0 +1,174 @@
package com.hui.tally.utils;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.hui.tally.R;
import com.hui.tally.adapter.CalendarAdapter;
import com.hui.tally.db.DBManager;
import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class CalendarDialog extends Dialog implements View.OnClickListener {
ImageView errorIv;
GridView gv;
LinearLayout hsvLayout;
List<TextView>hsvViewList;
List<Integer>yearList;
int selectPos = -1; //表示正在被点击的年份的位置
private CalendarAdapter adapter;
int selectMonth = -1;
public interface OnRefreshListener{
public void onRefresh(int selPos,int year,int month);
}
OnRefreshListener onRefreshListener;
public void setOnRefreshListener(OnRefreshListener onRefreshListener) {
this.onRefreshListener = onRefreshListener;
}
public CalendarDialog(@NonNull Context context,int selectPos,int selectMonth) {
super(context);
this.selectPos = selectPos;
this.selectMonth = selectMonth;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_calendar);
gv = findViewById(R.id.dialog_calendar_gv);
errorIv = findViewById(R.id.dialog_calendar_iv);
hsvLayout = findViewById(R.id.dialog_calendar_layout);
errorIv.setOnClickListener(this);
// 向横向的ScrollView当中添加View的方法
addViewToLayout();
initGridView();
//设置GridView当中每一个item的点击事件
setGVListener();
}
private void setGVListener() {
gv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
adapter.selPos = position;
adapter.notifyDataSetInvalidated();
int month = position + 1;
int year = adapter.year;
// 获取到被选中的年份和月份
onRefreshListener.onRefresh(selectPos,year,month);
cancel();
}
});
}
private void initGridView() {
int selYear = yearList.get(selectPos);
adapter = new CalendarAdapter(getContext(), selYear);
if (selectMonth == -1) {
int month = Calendar.getInstance().get(Calendar.MONTH);
adapter.selPos = month;
}else {
adapter.selPos = selectMonth-1;
}
gv.setAdapter(adapter);
}
private void addViewToLayout() {
hsvViewList = new ArrayList<>(); //将添加进入线性布局当中的TextView进行统一管理的集合
yearList = DBManager.getYearListFromAccounttb(); //获取数据库当中存储了多少个年份
//如果数据库当中没有记录,就添加今年的记录
if (yearList.size() == 0) {
int year = Calendar.getInstance().get(Calendar.YEAR);
yearList.add(year);
}
//遍历年份有几年就向ScrollView当中添加几个view
for (int i = 0; i < yearList.size(); i++) {
int year = yearList.get(i);
View view = getLayoutInflater().inflate(R.layout.item_dialogcal_hsv, null);
hsvLayout.addView(view); //将view添加到布局当中
TextView hsvTv = view.findViewById(R.id.item_dialogcal_hsv_tv);
hsvTv.setText(year+"");
hsvViewList.add(hsvTv);
}
if (selectPos == -1) {
selectPos = hsvViewList.size()-1; //设置当前被选中的是最近的年份
}
changeTvbg(selectPos); //将最后一个设置为选中状态
setHSVClickListener(); //设置每一个View的监听事件
}
/** 给横向的ScrollView当中每一个TextView设置点击事件*/
private void setHSVClickListener() {
for (int i = 0; i < hsvViewList.size(); i++) {
TextView view = hsvViewList.get(i);
final int pos = i;
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
changeTvbg(pos);
selectPos = pos;
// 获取被选中的年份然后下面的GridView显示数据源会发生变化
int year = yearList.get(selectPos);
adapter.setYear(year);
}
});
}
}
/** 传入被选中的位置,改变此位置上的背景和文字颜色*/
private void changeTvbg(int selectPos) {
for (int i = 0; i < hsvViewList.size(); i++) {
TextView tv = hsvViewList.get(i);
tv.setBackgroundResource(R.drawable.dialog_btn_bg);
tv.setTextColor(Color.BLACK);
}
TextView selView = hsvViewList.get(selectPos);
selView.setBackgroundResource(R.drawable.main_recordbtn_bg);
selView.setTextColor(Color.WHITE);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.dialog_calendar_iv:
cancel();
break;
}
}
/* 设置Dialog的尺寸和屏幕尺寸一致*/
public void setDialogSize(){
// 获取当前窗口对象
Window window = getWindow();
// 获取窗口对象的参数
WindowManager.LayoutParams wlp = window.getAttributes();
// 获取屏幕宽度
Display d = window.getWindowManager().getDefaultDisplay();
wlp.width = (int)(d.getWidth()); //对话框窗口为屏幕窗口
wlp.gravity = Gravity.TOP;
window.setBackgroundDrawableResource(android.R.color.transparent);
window.setAttributes(wlp);
}
}

@ -0,0 +1,23 @@
package com.hui.tally.utils;
import java.math.BigDecimal;
public class FloatUtils {
/* 进行除法运算保留4位小数*/
public static float div(float v1,float v2){
float v3 = v1/v2;
BigDecimal b1 = new BigDecimal(v3);
float val = b1.setScale(4, 4).floatValue();
return val;
}
// 将浮点数类型,转换成百分比显示形式
public static String ratioToPercent(float val){
float v = val*100;
BigDecimal b1 = new BigDecimal(v);
float v1 = b1.setScale(2, 4).floatValue();
String per = v1+"%";
return per;
}
}

@ -0,0 +1,100 @@
package com.hui.tally.utils;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.KeyboardView;
import android.text.Editable;
import android.text.InputType;
import android.view.View;
import android.widget.EditText;
import com.hui.tally.R;
public class KeyBoardUtils {
private final Keyboard k1; //自定义键盘
private KeyboardView keyboardView;
private EditText editText;
public interface OnEnsureListener{
public void onEnsure();
}
OnEnsureListener onEnsureListener;
public void setOnEnsureListener(OnEnsureListener onEnsureListener) {
this.onEnsureListener = onEnsureListener;
}
public KeyBoardUtils(KeyboardView keyboardView, EditText editText) {
this.keyboardView = keyboardView;
this.editText = editText;
this.editText.setInputType(InputType.TYPE_NULL); //取消弹出系统键盘
k1 = new Keyboard(this.editText.getContext(), R.xml.key);
this.keyboardView.setKeyboard(k1); //设置要显示键盘的样式
this.keyboardView.setEnabled(true);
this.keyboardView.setPreviewEnabled(false);
this.keyboardView.setOnKeyboardActionListener(listener); //设置键盘按钮被点击了的监听
}
KeyboardView.OnKeyboardActionListener listener = new KeyboardView.OnKeyboardActionListener() {
@Override
public void onPress(int primaryCode) {
}
@Override
public void onRelease(int primaryCode) {
}
@Override
public void onKey(int primaryCode, int[] keyCodes) {
Editable editable = editText.getText();
int start = editText.getSelectionStart();
switch (primaryCode) {
case Keyboard.KEYCODE_DELETE: //点击了删除键
if (editable!=null &&editable.length()>0) {
if (start>0) {
editable.delete(start-1,start);
}
}
break;
case Keyboard.KEYCODE_CANCEL: //点击了清零
editable.clear();
break;
case Keyboard.KEYCODE_DONE: //点击了完成
onEnsureListener.onEnsure(); //通过接口回调的方法,当点击确定时,可以调用这个方法
break;
default: //其他数字直接插入
editable.insert(start,Character.toString((char)primaryCode));
break;
}
}
@Override
public void onText(CharSequence text) {
}
@Override
public void swipeLeft() {
}
@Override
public void swipeRight() {
}
@Override
public void swipeDown() {
}
@Override
public void swipeUp() {
}
};
// 显示键盘
public void showKeyboard(){
int visibility = keyboardView.getVisibility();
if (visibility == View.INVISIBLE ||visibility==View.GONE) {
keyboardView.setVisibility(View.VISIBLE);
}
}
// 隐藏键盘
public void hideKeyboard(){
int visibility = keyboardView.getVisibility();
if (visibility== View.VISIBLE||visibility==View.INVISIBLE) {
keyboardView.setVisibility(View.GONE);
}
}
}

@ -0,0 +1,82 @@
package com.hui.tally.utils;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import com.hui.tally.AboutActivity;
import com.hui.tally.HistoryActivity;
import com.hui.tally.MonthChartActivity;
import com.hui.tally.R;
import com.hui.tally.SettingActivity;
public class MoreDialog extends Dialog implements View.OnClickListener {
Button aboutBtn,settingBtn,historyBtn,infoBtn;
ImageView errorIv;
public MoreDialog(@NonNull Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_more);
aboutBtn = findViewById(R.id.dialog_more_btn_about);
settingBtn = findViewById(R.id.dialog_more_btn_setting);
historyBtn = findViewById(R.id.dialog_more_btn_record);
infoBtn = findViewById(R.id.dialog_more_btn_info);
errorIv = findViewById(R.id.dialog_more_iv);
aboutBtn.setOnClickListener(this);
settingBtn.setOnClickListener(this);
historyBtn.setOnClickListener(this);
infoBtn.setOnClickListener(this);
errorIv.setOnClickListener(this);
}
@Override
public void onClick(View v) {
Intent intent = new Intent();
switch (v.getId()) {
case R.id.dialog_more_btn_about:
intent.setClass(getContext(), AboutActivity.class);
getContext().startActivity(intent);
break;
case R.id.dialog_more_btn_setting:
intent.setClass(getContext(), SettingActivity.class);
getContext().startActivity(intent);
break;
case R.id.dialog_more_btn_record:
intent.setClass(getContext(), HistoryActivity.class);
getContext().startActivity(intent);
break;
case R.id.dialog_more_btn_info:
intent.setClass(getContext(), MonthChartActivity.class);
getContext().startActivity(intent);
break;
case R.id.dialog_more_iv:
break;
}
cancel();
}
/* 设置Dialog的尺寸和屏幕尺寸一致*/
public void setDialogSize(){
// 获取当前窗口对象
Window window = getWindow();
// 获取窗口对象的参数
WindowManager.LayoutParams wlp = window.getAttributes();
// 获取屏幕宽度
Display d = window.getWindowManager().getDefaultDisplay();
wlp.width = (int)(d.getWidth()); //对话框窗口为屏幕窗口
wlp.gravity = Gravity.BOTTOM;
window.setBackgroundDrawableResource(android.R.color.transparent);
window.setAttributes(wlp);
}
}

@ -0,0 +1,136 @@
package com.hui.tally.utils;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import androidx.annotation.NonNull;
import com.hui.tally.R;
/*
*
* */
public class SelectTimeDialog extends Dialog implements View.OnClickListener {
EditText hourEt,minuteEt;
DatePicker datePicker;
Button ensureBtn,cancelBtn;
public interface OnEnsureListener{
public void onEnsure(String time,int year,int month,int day);
}
OnEnsureListener onEnsureListener;
public void setOnEnsureListener(OnEnsureListener onEnsureListener) {
this.onEnsureListener = onEnsureListener;
}
public SelectTimeDialog(@NonNull Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_time);
hourEt = findViewById(R.id.dialog_time_et_hour);
minuteEt = findViewById(R.id.dialog_time_et_minute);
datePicker = findViewById(R.id.dialog_time_dp);
ensureBtn = findViewById(R.id.dialog_time_btn_ensure);
cancelBtn = findViewById(R.id.dialog_time_btn_cancel);
ensureBtn.setOnClickListener(this); //添加点击监听事件
cancelBtn.setOnClickListener(this);
hideDatePickerHeader();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.dialog_time_btn_cancel:
cancel();
break;
case R.id.dialog_time_btn_ensure:
int year = datePicker.getYear(); //选择年份
int month = datePicker.getMonth()+1;
int dayOfMonth = datePicker.getDayOfMonth();
String monthStr = String.valueOf(month);
if (month<10){
monthStr = "0"+month;
}
String dayStr = String.valueOf(dayOfMonth);
if (dayOfMonth<10){
dayStr="0"+dayOfMonth;
}
// 获取输入的小时和分钟
String hourStr = hourEt.getText().toString();
String minuteStr = minuteEt.getText().toString();
int hour = 0;
if (!TextUtils.isEmpty(hourStr)) {
hour = Integer.parseInt(hourStr);
hour=hour%24;
}
int minute = 0;
if (!TextUtils.isEmpty(minuteStr)) {
minute = Integer.parseInt(minuteStr);
minute=minute%60;
}
hourStr=String.valueOf(hour);
minuteStr=String.valueOf(minute);
if (hour<10){
hourStr="0"+hour;
}
if (minute<10){
minuteStr="0"+minute;
}
String timeFormat = year+"年"+monthStr+"月"+dayStr+"日 "+hourStr+":"+minuteStr;
if (onEnsureListener!=null) {
onEnsureListener.onEnsure(timeFormat,year,month,dayOfMonth);
}
cancel();
break;
}
}
//隐藏DatePicker头布局
private void hideDatePickerHeader(){
ViewGroup rootView = (ViewGroup) datePicker.getChildAt(0);
if (rootView == null) {
return;
}
View headerView = rootView.getChildAt(0);
if (headerView == null) {
return;
}
//5.0+
int headerId = getContext().getResources().getIdentifier("day_picker_selector_layout", "id", "android");
if (headerId == headerView.getId()) {
headerView.setVisibility(View.GONE);
ViewGroup.LayoutParams layoutParamsRoot = rootView.getLayoutParams();
layoutParamsRoot.width = ViewGroup.LayoutParams.WRAP_CONTENT;
rootView.setLayoutParams(layoutParamsRoot);
ViewGroup animator = (ViewGroup) rootView.getChildAt(1);
ViewGroup.LayoutParams layoutParamsAnimator = animator.getLayoutParams();
layoutParamsAnimator.width = ViewGroup.LayoutParams.WRAP_CONTENT;
animator.setLayoutParams(layoutParamsAnimator);
View child = animator.getChildAt(0);
ViewGroup.LayoutParams layoutParamsChild = child.getLayoutParams();
layoutParamsChild.width = ViewGroup.LayoutParams.WRAP_CONTENT;
child.setLayoutParams(layoutParamsChild);
return;
}
// 6.0+
headerId = getContext().getResources().getIdentifier("date_picker_header","id","android");
if (headerId == headerView.getId()) {
headerView.setVisibility(View.GONE);
}
}
}

@ -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,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 四个角设定弧度-->
<corners android:radius="20dp"/>
<!-- 填充颜色-->
<solid android:color="@color/white"/>
<stroke android:color="@color/green_006400" android:width="3dp"/>
</shape>

@ -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="#008577"
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,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<!-- 填充颜色-->
<solid android:color="@color/green_006400"/>
</shape>

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

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/grey_f3f3f3">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp">
<ImageView
android:id="@+id/about_iv_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/it_back"
android:onClick="onClick"
android:layout_marginLeft="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/about"
android:textSize="18sp"
android:textStyle="bold"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_appinfo"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_version"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textSize="16sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/about_1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textSize="16sp"
android:text="@string/about_app"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/about_balabala"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/about_developer"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textSize="16sp"
android:text="@string/about_me"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/about_loc"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textSize="16sp"
android:text="@string/about_email"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/about_email2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textSize="16sp"
android:text="@string/about_code"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/about_codeinfo"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textStyle="bold"
android:textSize="16sp"
android:text="@string/about_B"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/about_B2"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/grey_f3f3f3">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp">
<ImageView
android:id="@+id/history_iv_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/it_back"
android:layout_marginLeft="10dp"
android:onClick="onClick"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/history_record"
android:textStyle="bold"
android:textSize="18sp"
android:layout_centerInParent="true"/>
<ImageView
android:id="@+id/history_iv_rili"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:src="@mipmap/it_rili"
android:layout_alignParentRight="true"
android:onClick="onClick"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<TextView
android:id="@+id/history_tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2020年11月"/>
<TextView
android:id="@+id/history_tv_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:textColor="@color/green_006400"
android:text="@string/history_info"/>
</RelativeLayout>
<ListView
android:id="@+id/history_lv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:divider="@null"
android:dividerHeight="5dp"/>
</LinearLayout>

@ -0,0 +1,61 @@
<?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="@color/grey_f3f3f3">
<RelativeLayout
android:id="@+id/main_top_layout"
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:text="@string/app_name"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:padding="10dp"
android:textStyle="bold"
android:textSize="18sp"
android:textColor="@color/black"/>
<ImageView
android:id="@+id/main_iv_search"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/search"
android:layout_alignParentRight="true"
android:padding="10dp"/>
</RelativeLayout>
<ListView
android:id="@+id/main_lv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/main_top_layout"
android:padding="10dp"
android:divider="@null"
android:dividerHeight="6dp"
android:scrollbars="none"
android:background="@color/grey_f3f3f3"/>
<ImageButton
android:id="@+id/main_btn_more"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@mipmap/more"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_margin="20dp"
android:background="@drawable/main_morebtn_bg"/>
<Button
android:id="@+id/main_btn_edit"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_alignBottom="@id/main_btn_more"
android:background="@drawable/main_recordbtn_bg"
android:layout_toLeftOf="@id/main_btn_more"
android:text="@string/editone"
android:textStyle="bold"
android:textColor="@color/white"
android:drawableLeft="@mipmap/edit"
android:gravity="center_vertical"/>
</RelativeLayout>

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_f3f3f3"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp">
<ImageView
android:id="@+id/chart_iv_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/it_back"
android:layout_marginLeft="10dp"
android:onClick="onClick"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/chart_info"
android:textSize="18sp"
android:textStyle="bold"/>
<ImageView
android:id="@+id/chart_iv_rili"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/it_rili"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:onClick="onClick"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/white"
android:padding="10dp"
android:layout_marginTop="20dp">
<TextView
android:id="@+id/chart_tv_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2020年11月账单"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="16sp"/>
<TextView
android:id="@+id/chart_tv_out"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="共1笔支出, ¥23.0"
android:textColor="@color/black"
android:textSize="14sp"
android:layout_marginTop="10dp"/>
<TextView
android:id="@+id/chart_tv_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="共2笔收入, ¥113.0"
android:textColor="@color/black"
android:textSize="14sp"
android:layout_marginTop="10dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_margin="10dp"
android:gravity="center">
<Button
android:id="@+id/chart_btn_out"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:text="@string/out"
android:background="@drawable/main_recordbtn_bg"
android:textColor="@color/white"
android:textStyle="bold"
android:onClick="onClick"
android:layout_marginRight="10dp"/>
<Button
android:id="@+id/chart_btn_in"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:text="@string/in"
android:background="@drawable/dialog_btn_bg"
android:textColor="@color/black"
android:textStyle="bold"
android:onClick="onClick"
android:layout_marginLeft="10dp"/>
</LinearLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/chart_vp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/grey_f3f3f3">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp">
<ImageView
android:id="@+id/record_iv_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/ih_error"
android:onClick="onClick"
android:layout_marginLeft="10dp"/>
<com.google.android.material.tabs.TabLayout
android:id="@+id/record_tabs"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
app:tabGravity="center"
app:tabMode="fixed"
app:tabTextColor="@color/grey_7D7D7D"
app:tabSelectedTextColor="@color/black"
app:tabIndicatorColor="@color/black"/>
</RelativeLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/record_vp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/grey_f3f3f3">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp">
<ImageView
android:id="@+id/search_iv_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:onClick="onClick"
android:layout_marginLeft="10dp"
android:src="@mipmap/it_back"/>
<EditText
android:id="@+id/search_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/search_iv_back"
android:background="@drawable/dialog_btn_bg"
android:layout_centerVertical="true"
android:textSize="16sp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:layout_marginLeft="10dp"
android:hint="@string/please_search_info">
<requestFocus/>
</EditText>
<ImageView
android:id="@+id/search_iv_sh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/search"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:onClick="onClick"/>
</RelativeLayout>
<ListView
android:id="@+id/search_lv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:dividerHeight="6dp"
android:divider="@color/grey_f3f3f3"
/>
<TextView
android:id="@+id/search_tv_empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/date_empty"
android:gravity="center"
android:textSize="20sp"
android:drawableTop="@mipmap/it_searchtext"
android:layout_marginTop="250dp"/>
</LinearLayout>

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/grey_f3f3f3">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp">
<ImageView
android:id="@+id/setting_iv_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/it_back"
android:layout_marginLeft="10dp"
android:onClick="onClick"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/setting"
android:textStyle="bold"
android:textSize="18sp"
android:layout_centerInParent="true"/>
</RelativeLayout>
<TextView
android:id="@+id/setting_tv_clear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/clear_all"
android:onClick="onClick"
android:textSize="16sp"
android:textStyle="bold"
android:padding="15dp"
android:background="@color/white"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/grey_7D7D7D"/>
</LinearLayout>

@ -0,0 +1,52 @@
<?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:padding="10dp"
android:background="@color/white">
<TextView
android:id="@+id/dialog_beizhu_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/add_remark"
android:textSize="16sp"
android:textColor="@color/black"/>
<EditText
android:id="@+id/dialog_beizhu_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/dialog_beizhu_tv"
android:hint="@string/remark"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:textSize="14sp"
android:background="@color/white">
<requestFocus/>
</EditText>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@id/dialog_beizhu_et"
android:padding="10dp">
<Button
android:id="@+id/dialog_beizhu_btn_cancel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/cancel"
android:background="@drawable/dialog_btn_bg"
android:textStyle="bold"
android:textColor="@color/green_006400"
android:layout_marginRight="5dp"/>
<Button
android:id="@+id/dialog_beizhu_btn_ensure"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/ensure"
android:background="@drawable/main_recordbtn_bg"
android:textStyle="bold"
android:textColor="@color/white"
android:layout_marginRight="5dp"/>
</LinearLayout>
</RelativeLayout>

@ -0,0 +1,50 @@
<?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:padding="10dp"
android:background="@color/white">
<TextView
android:id="@+id/dialog_budget_tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/set_budget"
android:layout_centerHorizontal="true"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="@color/black"/>
<ImageView
android:id="@+id/dialog_budget_iv_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ih_error"
android:layout_alignParentRight="true"/>
<TextView
android:id="@+id/dialog_budget_tv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¥"
android:layout_below="@id/dialog_budget_tv1"
android:textSize="20sp"
android:layout_marginTop="10dp"/>
<EditText
android:id="@+id/dialog_budget_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/dialog_budget_tv2"
android:layout_alignBaseline="@id/dialog_budget_tv2"
android:inputType="numberDecimal"
android:background="@color/white">
<requestFocus/>
</EditText>
<Button
android:id="@+id/dialog_budget_btn_ensure"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/dialog_budget_tv2"
android:layout_marginTop="20dp"
android:text="@string/ensure"
android:textStyle="bold"
android:textSize="18sp"
android:background="@drawable/main_recordbtn_bg"
android:textColor="@color/white"/>
</RelativeLayout>

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white">
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/dialog_calendar_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
</LinearLayout>
</HorizontalScrollView>
<GridView
android:id="@+id/dialog_calendar_gv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="4"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/dialog_calendar_iv"
android:src="@mipmap/ih_error"
android:padding="20dp"/>
</LinearLayout>

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:background="@color/grey_f3f3f3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/dialog_more_btn_about"
style="@style/dialogmoreStyle"
android:drawableTop="@mipmap/it_guanyu"
android:text="@string/about"/>
<Button
android:id="@+id/dialog_more_btn_setting"
style="@style/dialogmoreStyle"
android:drawableTop="@mipmap/it_shezhi"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:text="@string/setting"/>
<Button
android:id="@+id/dialog_more_btn_record"
style="@style/dialogmoreStyle"
android:drawableTop="@mipmap/it_jilu"
android:text="@string/history_record"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:weightSum="3">
<Button
android:id="@+id/dialog_more_btn_info"
style="@style/dialogmoreStyle"
android:drawableTop="@mipmap/it_xiqing"
android:text="@string/account_info"
android:layout_marginRight="30dp"/>
</LinearLayout>
<ImageView
android:id="@+id/dialog_more_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ih_error"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"/>
</LinearLayout>

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/white">
<DatePicker
android:id="@+id/dialog_time_dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/please_input_time"
android:padding="10dp"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<EditText
android:id="@+id/dialog_time_et_hour"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" : "
android:textSize="20dp"
android:textStyle="bold"/>
<EditText
android:id="@+id/dialog_time_et_minute"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="2"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:orientation="horizontal">
<Button
android:id="@+id/dialog_time_btn_cancel"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:text="@string/cancel"
android:textColor="@color/green_006400"
android:background="@null"
android:layout_marginRight="20dp"/>
<Button
android:id="@+id/dialog_time_btn_ensure"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:text="@string/ensure"
android:textColor="@color/green_006400"
android:background="@null"
android:layout_marginRight="20dp"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_f3f3f3">
<!-- TODO: Update blank fragment layout -->
<ListView
android:id="@+id/frag_chart_lv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:dividerHeight="1dp"
android:divider="@color/grey_f3f3f3"/>
</FrameLayout>

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_f3f3f3">
<RelativeLayout
android:id="@+id/frag_record_rl_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
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/ic_qita_fs"/>
<TextView
android:id="@+id/frag_record_tv_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="其他"
android:layout_toRightOf="@id/frag_record_iv"
android:layout_centerVertical="true"
android:textSize="16sp"
android:textStyle="bold"
android:layout_marginLeft="10dp"/>
<EditText
android:id="@+id/frag_record_et_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:inputType="number"
android:background="@color/white"/>
</RelativeLayout>
<View
android:id="@+id/frag_record_line1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/frag_record_rl_top"
android:background="@color/grey_f3f3f3"/>
<GridView
android:id="@+id/frag_record_gv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/frag_record_line1"
android:background="@color/white"
android:numColumns="5"
android:paddingTop="5dp"
android:paddingBottom="5dp"/>
<!-- 自定义软键盘-->
<android.inputmethodservice.KeyboardView
android:id="@+id/frag_record_keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:keyBackground="@color/grey_f3f3f3"
android:keyTextColor="@color/black"
android:focusable="true"
android:focusableInTouchMode="true"
android:paddingTop="1dp"
android:layout_alignParentBottom="true"
android:shadowColor="@color/white"
android:shadowRadius="0.0"/>
<RelativeLayout
android:layout_above="@id/frag_record_keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white">
<TextView
android:id="@+id/frag_record_tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2020年10月30日 18:49"
android:layout_alignParentRight="true"
android:padding="10dp"/>
<TextView
android:id="@+id/frag_record_tv_beizhu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="添加备注"
android:layout_toLeftOf="@id/frag_record_tv_time"
android:padding="10dp"/>
</RelativeLayout>
</RelativeLayout>

@ -0,0 +1,36 @@
<?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:padding="10dp"
android:background="@color/white">
<ImageView
android:id="@+id/item_chartfrag_iv"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="@mipmap/ic_yanjiu_fs"/>
<TextView
android:id="@+id/item_chartfrag_tv_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="烟酒茶"
android:textSize="16sp"
android:layout_toRightOf="@id/item_chartfrag_iv"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:textStyle="bold"/>
<TextView
android:id="@+id/item_chartfrag_tv_pert"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="22.3%"
android:textSize="16sp"
android:layout_centerInParent="true"/>
<TextView
android:id="@+id/item_chartfrag_tv_sum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¥123.3"
android:textSize="16sp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"/>
</RelativeLayout>

@ -0,0 +1,17 @@
<?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">
<com.github.mikephil.charting.charts.BarChart
android:id="@+id/item_chartfrag_chart"
android:layout_width="match_parent"
android:layout_height="300dp" />
<TextView
android:id="@+id/item_chartfrag_top_tv"
android:layout_width="match_parent"
android:layout_height="300dp"
android:text="@string/not_data"
android:textStyle="bold"
android:textSize="20sp"
android:gravity="center"
android:visibility="gone"/>
</RelativeLayout>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<TextView
android:id="@+id/item_dialogcal_gv_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="2020/1"
android:padding="8dp"
android:gravity="center"
android:background="@color/grey_f3f3f3"
android:textColor="@color/black"/>
</LinearLayout>

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/item_dialogcal_hsv_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2020"
android:background="@drawable/dialog_btn_bg"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:layout_margin="5dp"/>
</LinearLayout>

@ -0,0 +1,52 @@
<?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/ic_yanjiu_fs"/>
<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:text="烟酒茶"
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:text="华子一盒"
android:layout_marginTop="5dp"
android:textSize="12sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:gravity="right"
android:orientation="vertical">
<TextView
android:id="@+id/item_mainlv_tv_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¥25.0"
android:textStyle="bold"/>
<TextView
android:id="@+id/item_mainlv_tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="今天 18:10"
android:layout_marginTop="5dp" />
</LinearLayout>
</RelativeLayout>

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:padding="20dp">
<TextView
android:id="@+id/item_mainlv_top_tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/month_out"/>
<TextView
android:id="@+id/item_mainlv_top_tv_out"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¥ 0"
android:layout_below="@id/item_mainlv_top_tv1"
android:textSize="26sp"
android:textStyle="bold"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:textColor="@color/black"/>
<ImageView
android:id="@+id/item_mainlv_top_iv_hide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@mipmap/ih_show"
android:layout_alignTop="@id/item_mainlv_top_tv_out"/>
<TextView
android:id="@+id/item_mainlv_top_tv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/month_in"
android:layout_below="@id/item_mainlv_top_tv_out"/>
<TextView
android:id="@+id/item_mainlv_top_tv_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:text="¥ 0"
android:layout_below="@id/item_mainlv_top_tv_out"
android:layout_toRightOf="@id/item_mainlv_top_tv2"
android:layout_marginLeft="5dp"/>
<TextView
android:id="@+id/item_mainlv_top_tv_budget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¥ 0"
android:textColor="@color/black"
android:layout_alignParentRight="true"
android:layout_alignBottom="@id/item_mainlv_top_tv2"
android:layout_marginLeft="5dp"/>
<TextView
android:id="@+id/item_mainlv_top_tv3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/budget"
android:layout_toLeftOf="@id/item_mainlv_top_tv_budget"
android:layout_alignBottom="@id/item_mainlv_top_tv2"/>
<TextView
android:id="@+id/item_mainlv_top_tv4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@mipmap/ih_biaoge"
android:layout_below="@id/item_mainlv_top_tv2"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="@string/see_excel"
android:textColor="@color/green_006400"
android:drawablePadding="10dp"/>
</RelativeLayout>
<TextView
android:id="@+id/item_mainlv_top_tv_day"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="今日支出 ¥0 收入 ¥0"
android:textStyle="bold"
android:layout_marginTop="20dp"
android:layout_marginBottom="10dp"/>
</LinearLayout>

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<ImageView
android:id="@+id/item_recordfrag_iv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@mipmap/ic_qita_fs"/>
<TextView
android:id="@+id/item_recordfrag_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="其他"
android:layout_marginTop="5dp"
android:textSize="12sp"
android:textColor="@color/grey_7D7D7D"
android:gravity="center"/>
</LinearLayout>

@ -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: 420 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.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: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 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: 1.0 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save