├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_back.png
│ │ │ │ ├── arrow_right.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── type_canyin.png
│ │ │ │ ├── type_haizi.png
│ │ │ │ ├── type_jiaxi.png
│ │ │ │ ├── type_jujia.png
│ │ │ │ ├── type_lijin.png
│ │ │ │ ├── type_liwu.png
│ │ │ │ ├── type_lixi.png
│ │ │ │ ├── type_lvxing.png
│ │ │ │ ├── type_qita.png
│ │ │ │ ├── type_shuma.png
│ │ │ │ ├── type_weixiu.png
│ │ │ │ ├── type_xuexi.png
│ │ │ │ ├── type_yiliao.png
│ │ │ │ ├── type_yule.png
│ │ │ │ ├── type_bangong.png
│ │ │ │ ├── type_chongwu.png
│ │ │ │ ├── type_fanxian.png
│ │ │ │ ├── type_fuzhuang.png
│ │ │ │ ├── type_jianzhi.png
│ │ │ │ ├── type_jiaotong.png
│ │ │ │ ├── type_juanzeng.png
│ │ │ │ ├── type_lingshi.png
│ │ │ │ ├── type_meirong.png
│ │ │ │ ├── type_shuiguo.png
│ │ │ │ ├── type_tongxun.png
│ │ │ │ ├── type_yundong.png
│ │ │ │ ├── type_zaxiang.png
│ │ │ │ ├── type_zhangbei.png
│ │ │ │ ├── type_zhufang.png
│ │ │ │ ├── ic_tb_calc_del.png
│ │ │ │ ├── tabbar_icon1_0.png
│ │ │ │ ├── tabbar_icon1_1.png
│ │ │ │ ├── tabbar_icon2_0.png
│ │ │ │ ├── tabbar_icon2_1.png
│ │ │ │ ├── tabbar_icon3_0.png
│ │ │ │ ├── tabbar_icon3_1.png
│ │ │ │ ├── tabbar_icon4_0.png
│ │ │ │ ├── tabbar_icon4_1.png
│ │ │ │ ├── tally_pie_center.png
│ │ │ │ ├── tallybook_down.png
│ │ │ │ ├── tallybook_input.png
│ │ │ │ ├── tallybook_note.png
│ │ │ │ ├── tallybook_other.png
│ │ │ │ ├── tallybook_output.png
│ │ │ │ ├── type_ewaishouyi.png
│ │ │ │ ├── type_shouxufei.png
│ │ │ │ ├── type_tianjiade.png
│ │ │ │ ├── type_weiyuejin.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ ├── ic_tb_note_delete.png
│ │ │ │ ├── ic_tb_note_remark.png
│ │ │ │ ├── tallybook_manager.png
│ │ │ │ ├── type_zijinbuchang.png
│ │ │ │ ├── type_changhuanfeiyong.png
│ │ │ │ ├── type_jiushuiyinliao.png
│ │ │ │ ├── type_yongjinjiangli.png
│ │ │ │ └── type_shangchengxiaofei.png
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── drawable-xhdpi
│ │ │ │ ├── icon_banner_point1.png
│ │ │ │ └── icon_banner_point2.png
│ │ │ ├── values
│ │ │ │ ├── ids.xml
│ │ │ │ ├── attrs.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── strings.xml
│ │ │ ├── drawable
│ │ │ │ ├── shape_tb_calc.xml
│ │ │ │ ├── tabbar_text_color.xml
│ │ │ │ ├── shape_tb_cash.xml
│ │ │ │ ├── tb_text_selector.xml
│ │ │ │ ├── rb_main_first_selector.xml
│ │ │ │ ├── rb_main_second_selector.xml
│ │ │ │ ├── rb_main_third_selector.xml
│ │ │ │ ├── rb_main_four_selector.xml
│ │ │ │ ├── bg_click.xml
│ │ │ │ ├── bg_radius_click.xml
│ │ │ │ ├── tb_income_selector.xml
│ │ │ │ └── tb_outcome_selector.xml
│ │ │ ├── anim
│ │ │ │ ├── slide_in_left.xml
│ │ │ │ ├── slide_out_right.xml
│ │ │ │ ├── slide_in_right.xml
│ │ │ │ └── slide_out_left.xml
│ │ │ └── layout
│ │ │ │ ├── pager_item_tb_type.xml
│ │ │ │ ├── item_tb_type.xml
│ │ │ │ ├── fragment_menu_my.xml
│ │ │ │ ├── item_recycler_header.xml
│ │ │ │ ├── fragment_menu_first.xml
│ │ │ │ ├── item_tallytype_rank.xml
│ │ │ │ ├── item_tally_account.xml
│ │ │ │ ├── item_recycler_item.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── top_date.xml
│ │ │ │ ├── fragment_menu_type.xml
│ │ │ │ └── activity_tallybook_note.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── cocoon
│ │ │ │ └── jay
│ │ │ │ └── tallybook
│ │ │ │ ├── MyApplication.java
│ │ │ │ ├── bean
│ │ │ │ ├── BaseBean.java
│ │ │ │ ├── TallyTypeBean.java
│ │ │ │ ├── TallyAccountBean.java
│ │ │ │ ├── TallyNoteBean.java
│ │ │ │ └── TallyDetailBean.java
│ │ │ │ ├── adapter
│ │ │ │ ├── MyPagerAdapter.java
│ │ │ │ ├── TallyTypeRankAdapter.java
│ │ │ │ ├── TallyAccountAdapter.java
│ │ │ │ ├── TallyBookNoteAdapter.java
│ │ │ │ └── TallyDetailAdapter.java
│ │ │ │ ├── activity
│ │ │ │ ├── BaseActivity.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── TallyBookNoteActivity.java
│ │ │ │ ├── utils
│ │ │ │ ├── ActivityManagerUtil.java
│ │ │ │ ├── FormatUtils.java
│ │ │ │ └── PieChartUtil.java
│ │ │ │ ├── fragment
│ │ │ │ ├── BaseFragment.java
│ │ │ │ ├── MenuMyFragment.java
│ │ │ │ ├── MenuFirstFragment.java
│ │ │ │ └── MenuTypeFragment.java
│ │ │ │ └── view
│ │ │ │ ├── BaseBottomBar.java
│ │ │ │ └── CircleImageView.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── cocoon
│ │ │ └── jay
│ │ │ └── tallybook
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── cocoon
│ │ └── jay
│ │ └── tallybook
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── gif
├── GIF1.gif
├── GIF2.gif
└── GIF3.gif
├── .idea
├── copyright
│ └── profiles_settings.xml
├── modules.xml
├── runConfigurations.xml
├── gradle.xml
├── compiler.xml
└── misc.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── README.md
├── gradle.properties
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/gif/GIF1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/gif/GIF1.gif
--------------------------------------------------------------------------------
/gif/GIF2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/gif/GIF2.gif
--------------------------------------------------------------------------------
/gif/GIF3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/gif/GIF3.gif
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/ic_back.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/arrow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/arrow_right.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_canyin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_canyin.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_haizi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_haizi.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_jiaxi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_jiaxi.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_jujia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_jujia.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_lijin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_lijin.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_liwu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_liwu.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_lixi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_lixi.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_lvxing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_lvxing.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_qita.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_qita.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_shuma.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_shuma.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_weixiu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_weixiu.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_xuexi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_xuexi.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_yiliao.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_yiliao.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_yule.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_yule.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_bangong.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_bangong.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_chongwu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_chongwu.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_fanxian.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_fanxian.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_fuzhuang.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_fuzhuang.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_jianzhi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_jianzhi.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_jiaotong.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_jiaotong.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_juanzeng.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_juanzeng.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_lingshi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_lingshi.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_meirong.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_meirong.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_shuiguo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_shuiguo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_tongxun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_tongxun.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_yundong.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_yundong.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_zaxiang.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_zaxiang.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_zhangbei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_zhangbei.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_zhufang.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_zhufang.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_tb_calc_del.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/ic_tb_calc_del.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tabbar_icon1_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tabbar_icon1_0.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tabbar_icon1_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tabbar_icon1_1.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tabbar_icon2_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tabbar_icon2_0.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tabbar_icon2_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tabbar_icon2_1.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tabbar_icon3_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tabbar_icon3_0.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tabbar_icon3_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tabbar_icon3_1.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tabbar_icon4_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tabbar_icon4_0.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tabbar_icon4_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tabbar_icon4_1.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tally_pie_center.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tally_pie_center.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tallybook_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tallybook_down.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tallybook_input.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tallybook_input.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tallybook_note.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tallybook_note.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tallybook_other.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tallybook_other.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tallybook_output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tallybook_output.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_ewaishouyi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_ewaishouyi.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_shouxufei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_shouxufei.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_tianjiade.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_tianjiade.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_weiyuejin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_weiyuejin.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_tb_note_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/ic_tb_note_delete.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_tb_note_remark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/ic_tb_note_remark.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tallybook_manager.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/tallybook_manager.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_zijinbuchang.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_zijinbuchang.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/icon_banner_point1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/drawable-xhdpi/icon_banner_point1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/icon_banner_point2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/drawable-xhdpi/icon_banner_point2.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_changhuanfeiyong.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_changhuanfeiyong.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_jiushuiyinliao.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_jiushuiyinliao.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_yongjinjiangli.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_yongjinjiangli.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/type_shangchengxiaofei.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wangjjj/TallyBook/HEAD/app/src/main/res/mipmap-xhdpi/type_shangchengxiaofei.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_tb_calc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tabbar_text_color.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_tb_cash.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_in_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_out_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_in_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_out_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Oct 10 15:17:20 GMT+08:00 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tb_text_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TallyBook
2 | 仿支付宝记账本功能,饼状图;数字键盘;轻量级recycleview头部悬浮侧滑删除等;
3 |
4 | 
5 | 
6 | 
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rb_main_first_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rb_main_second_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rb_main_third_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rb_main_four_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/test/java/com/cocoon/jay/tallybook/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/pager_item_tb_type.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/MyApplication.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 |
6 | /**
7 | * Created by Administrator on 2017/10/23 0023.
8 | */
9 |
10 | public class MyApplication extends Application {
11 |
12 | public static MyApplication application;
13 | private static Context context;
14 |
15 | @Override
16 | public void onCreate() {
17 | super.onCreate();
18 | application = this;
19 | context = getApplicationContext();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_click.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | -
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | -
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_tb_type.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
11 |
18 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/bean/BaseBean.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.bean;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by Administrator on 2017/10/16 0016.
7 | */
8 |
9 | public class BaseBean implements Serializable {
10 |
11 |
12 | private static final long serialVersionUID = 1L;
13 | /**
14 | * status : 1
15 | * message : 成功!
16 | */
17 |
18 | private int status;
19 | private String message;
20 |
21 | public int getStatus() {
22 | return status;
23 | }
24 |
25 | public void setStatus(int status) {
26 | this.status = status;
27 | }
28 |
29 | public String getMessage() {
30 | return message;
31 | }
32 |
33 | public void setMessage(String message) {
34 | this.message = message;
35 | }
36 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_radius_click.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | -
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | -
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | #FF5050
8 | #FA3232
9 | #FF5050
10 |
11 | #f7f7f7
12 | #00000000
13 | #ffffff
14 | #000000
15 | #333333
16 | #666666
17 | #999999
18 |
19 | #FF5050
20 | #ff0000
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/cocoon/jay/tallybook/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.cocoon.jay.tallybook", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_menu_my.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
17 |
18 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\Administrator\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tb_income_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | -
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tb_outcome_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | -
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
15 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/adapter/MyPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.adapter;
2 |
3 | import android.support.v4.view.PagerAdapter;
4 | import android.view.View;
5 | import android.view.ViewGroup;
6 |
7 | import java.util.List;
8 |
9 | public class MyPagerAdapter extends PagerAdapter {
10 | private List imageViews ;
11 | private String[] mTitles ;
12 | public MyPagerAdapter(List imageViews){
13 | this.imageViews = imageViews;
14 | }
15 | public MyPagerAdapter(List imageViews, String[] mTitles){
16 | this.imageViews = imageViews;
17 | this.mTitles= mTitles;
18 | }
19 | @Override
20 | public int getCount() {
21 | return imageViews.size();
22 | }
23 |
24 | @Override
25 | public CharSequence getPageTitle(int position) {
26 | return mTitles[position];
27 | }
28 | @Override
29 | public Object instantiateItem(ViewGroup container, int position) {
30 | container.addView(imageViews.get(position));
31 | return imageViews.get(position);
32 | }
33 | @Override
34 | public void destroyItem(ViewGroup container, int position, Object object) {
35 | container.removeView(imageViews.get(position));
36 | }
37 | @Override
38 | public boolean isViewFromObject(View arg0, Object arg1) {
39 | return arg0==arg1;
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_recycler_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
15 |
25 |
26 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/activity/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.activity;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.FragmentActivity;
7 |
8 |
9 | import com.cocoon.jay.tallybook.R;
10 | import com.cocoon.jay.tallybook.utils.ActivityManagerUtil;
11 | import com.cocoon.jay.tallybook.utils.StatusBarUtil;
12 |
13 | import butterknife.ButterKnife;
14 | import butterknife.Unbinder;
15 |
16 |
17 | public abstract class BaseActivity extends FragmentActivity {
18 |
19 | protected Activity mContext;
20 | private Unbinder mUnBinder;
21 |
22 | @Override
23 | protected void onCreate(@Nullable Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(getLayout());
26 | ActivityManagerUtil.mActivities.add(this);
27 | mUnBinder = ButterKnife.bind(this);
28 | mContext = this;
29 | initEventAndData();
30 | setStatusBar();
31 | }
32 |
33 | protected void setStatusBar() {
34 | StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimary));
35 | }
36 |
37 |
38 | @Override
39 | protected void onDestroy() {
40 | super.onDestroy();
41 | mUnBinder.unbind();
42 | ActivityManagerUtil.mActivities.remove(this);
43 | }
44 |
45 | protected abstract int getLayout();
46 | protected abstract void initEventAndData();
47 | }
48 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'android-apt'
3 |
4 | android {
5 | compileSdkVersion 25
6 | buildToolsVersion "26.0.1"
7 | defaultConfig {
8 | applicationId "com.cocoon.jay.tallybook"
9 | minSdkVersion 15
10 | targetSdkVersion 25
11 | versionCode 1
12 | versionName "1.0"
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | }
22 |
23 | dependencies {
24 | compile fileTree(dir: 'libs', include: ['*.jar'])
25 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
26 | exclude group: 'com.android.support', module: 'support-annotations'
27 | })
28 | compile 'com.android.support:appcompat-v7:25.3.1'
29 | compile 'com.android.support.constraint:constraint-layout:1.0.1'
30 | testCompile 'junit:junit:4.12'
31 |
32 | compile 'com.android.support:design:25.3.1'
33 |
34 | compile 'com.jakewharton:butterknife:8.2.1'
35 | apt 'com.jakewharton:butterknife-compiler:8.2.1'
36 |
37 | compile 'com.google.code.gson:gson:2.8.0'
38 | compile 'com.github.bumptech.glide:glide:3.7.0'
39 |
40 | compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
41 | compile 'com.contrarywind:Android-PickerView:3.2.5'
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_menu_first.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
13 |
14 |
21 |
22 |
28 |
29 |
30 |
31 |
32 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
13 |
23 |
24 |
25 |
26 |
31 |
32 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TallyBook
3 |
4 |
5 |
6 | 明细
7 | 记一笔
8 | 类别报表
9 | 账户
10 |
11 |
12 |
13 | {
14 | "status": 1,
15 | "total": 8882.4,
16 | "surplus": "-1,590.60",
17 | "scale": "-",
18 | "t_money": [
19 | {
20 | "affect_money": 4616.86,
21 | "type": 28,
22 | "typename": "投标成功待收利息",
23 | "back_color": "#6783fd"
24 | },
25 | {
26 | "affect_money": 1481.89,
27 | "type": "331",
28 | "typename": "额外收益",
29 | "back_color": "#8da3fd"
30 | },
31 | {
32 | "affect_money": 830,
33 | "type": "335",
34 | "typename": "兼职",
35 | "back_color": "#6884f9"
36 | },
37 | {
38 | "affect_money": 800,
39 | "type": "332",
40 | "typename": "资金补偿",
41 | "back_color": "#8096f5"
42 | },
43 | {
44 | "affect_money": 600,
45 | "type": "328",
46 | "typename": "礼金",
47 | "back_color": "#6e82db"
48 | },
49 | {
50 | "affect_money": 553.65,
51 | "type": "0",
52 | "typename": "杂项",
53 | "back_color": "#6783fd"
54 | }
55 | ]
56 | }
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_tallytype_rank.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
18 |
27 |
28 |
38 |
39 |
40 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/utils/ActivityManagerUtil.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.utils;
2 |
3 | import android.app.Activity;
4 |
5 | import java.util.ArrayList;
6 | import java.util.LinkedList;
7 | import java.util.List;
8 |
9 | public class ActivityManagerUtil {
10 |
11 | /** 记录处于前台的Activity */
12 | public static Activity mForegroundActivity = null;
13 | /** 记录所有活动的Activity */
14 | public static final List mActivities = new LinkedList();
15 |
16 |
17 | /** 获取当前处于栈顶的activity,无论其是否处于前台 */
18 | public static Activity getCurrentActivity() {
19 | List copy;
20 | synchronized (mActivities) {
21 | copy = new ArrayList(mActivities);
22 | }
23 | if (copy.size() > 0) {
24 | return copy.get(copy.size() - 1);
25 | }
26 | return null;
27 | }
28 |
29 | /** 是否有启动的Activity */
30 | public static boolean hasActivity() {
31 | return mActivities.size() > 0;
32 | }
33 |
34 | /** 获取当前处于前台的activity */
35 | public static Activity getForegroundActivity() {
36 | return mForegroundActivity;
37 | }
38 |
39 | /** 关闭所有Activity,除了参数传递的Activity */
40 | public static void finishAll(Class except) {
41 | List copy;
42 | synchronized (mActivities) {
43 | copy = new ArrayList(mActivities);
44 | }
45 | for (Activity activity : copy) {
46 | if (activity.getClass() != except)
47 | activity.finish();
48 | }
49 | }
50 |
51 | /** 关闭所有Activity */
52 | public static void finishAll() {
53 | List copy;
54 | synchronized (mActivities) {
55 | copy = new ArrayList(mActivities);
56 | }
57 | for (Activity activity : copy) {
58 | activity.finish();
59 | }
60 | }
61 |
62 |
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/fragment/BaseFragment.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.fragment;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.os.Bundle;
6 | import android.support.annotation.Nullable;
7 | import android.support.v4.app.Fragment;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 |
12 | import butterknife.ButterKnife;
13 | import butterknife.Unbinder;
14 |
15 |
16 | /**
17 | * Created by codeest on 16/8/11.
18 | * 无MVP的Fragment基类
19 | */
20 |
21 | public abstract class BaseFragment extends Fragment {
22 |
23 | protected View mView;
24 | protected Activity mActivity;
25 | protected Context mContext;
26 | private Unbinder mUnBinder;
27 |
28 | @Override
29 | public void onAttach(Context context) {
30 | mActivity = (Activity) context;
31 | mContext = context;
32 | super.onAttach(context);
33 | }
34 |
35 | @Nullable
36 | @Override
37 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
38 | mView = inflater.inflate(getLayoutId(), null);
39 | return mView;
40 | }
41 |
42 | @Override
43 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
44 | super.onViewCreated(view, savedInstanceState);
45 | mUnBinder = ButterKnife.bind(this, view);
46 | initEventAndData();
47 | }
48 |
49 | @Override
50 | public void onDestroyView() {
51 | super.onDestroyView();
52 | mUnBinder.unbind();
53 | }
54 |
55 | protected abstract int getLayoutId();
56 | protected abstract void initEventAndData();
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/adapter/TallyTypeRankAdapter.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.TextView;
9 |
10 | import com.cocoon.jay.tallybook.R;
11 |
12 | import java.util.List;
13 |
14 |
15 | public class TallyTypeRankAdapter extends RecyclerView.Adapter{
16 |
17 | private Context mContext;
18 | private LayoutInflater mInflater;
19 | private List mDatas;
20 |
21 | public void setmDatas(List mDatas) {
22 | this.mDatas = mDatas;
23 | }
24 |
25 | public TallyTypeRankAdapter(Context context, List datas){
26 | this.mContext = context;
27 | this.mInflater = LayoutInflater.from(context);
28 | this. mDatas = datas;
29 | }
30 |
31 |
32 | @Override
33 | public int getItemCount() {
34 | return (mDatas== null) ? 0 : mDatas.size();
35 | }
36 |
37 |
38 |
39 | @Override
40 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
41 | View view = mInflater.inflate(R.layout.item_tallytype_rank, parent, false);
42 | return new ViewHolder(view);
43 | }
44 |
45 |
46 | @Override
47 | public void onBindViewHolder(ViewHolder holder, final int position) {
48 | holder.rank.setText(position+1+"");
49 | holder.title.setText(mDatas.get(position).toString());
50 | holder.money.setText(String.valueOf(Math.ceil(Math.random() * 100)));
51 |
52 | }
53 |
54 | class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
55 |
56 | private TextView title;
57 | private TextView money;
58 | private TextView rank;
59 |
60 | public ViewHolder(View view){
61 | super(view);
62 |
63 | title = (TextView) view.findViewById(R.id.title);
64 | money = (TextView) view.findViewById(R.id.money);
65 | rank = (TextView) view.findViewById(R.id.rank);
66 |
67 | }
68 |
69 |
70 | @Override
71 | public void onClick(View view) {
72 | switch (view.getId()) {
73 | }
74 | }
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/utils/FormatUtils.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.utils;
2 |
3 | import java.text.DecimalFormat;
4 | import java.text.SimpleDateFormat;
5 | import java.util.Date;
6 | import java.util.Locale;
7 |
8 | /**
9 | * Created by 42147 on 2017/2/22.
10 | */
11 |
12 | public class FormatUtils {
13 |
14 | /**
15 | * @param money
16 | * @return
17 | * @Method : moneyFormat
18 | * @Description: 对金额的格式调整到分
19 | */
20 | public static String moneyFormat(String money) {// 23->23.00
21 | StringBuffer sb = new StringBuffer();
22 | if (money == null) {
23 | return "0.00";
24 | }
25 | while (money.startsWith("0")) {
26 | money = money.substring(1);
27 | }
28 |
29 | int index = money.indexOf(".");
30 | if (index == -1) {
31 | return money + ".00";
32 | } else {
33 | String s0 = money.substring(0, index);// 整数部分
34 | String s1 = money.substring(index + 1);// 小数部分
35 | if (s1.length() == 1) {// 小数点后一位
36 | s1 = s1 + "0";
37 | } else if (s1.length() > 2) {// 如果超过3位小数,截取2位就可以了
38 | s1 = s1.substring(0, 2);
39 | }
40 | sb.append(s0);
41 | sb.append(".");
42 | sb.append(s1);
43 | }
44 | return sb.toString();
45 | }
46 |
47 | public static String MyDecimalFormat(String pattern, double value) {
48 | DecimalFormat myFormat = new DecimalFormat();
49 | myFormat.applyPattern(pattern);
50 | String str = myFormat.format(value);
51 | return str;
52 | }
53 |
54 | public static String getMoneyStr(double money) {
55 | return MyDecimalFormat("##,###,###.##", money);
56 | }
57 |
58 |
59 | /**
60 | * 时间格式转换
61 | * @param timestamp
62 | * @return
63 | */
64 | public static String format1(long timestamp) {
65 | SimpleDateFormat formate = new SimpleDateFormat("y-M-d", Locale.CHINA);
66 | return formate.format(new Date(timestamp* 1000));
67 | }
68 |
69 | public static String format2(long timestamp) {
70 | SimpleDateFormat formate = new SimpleDateFormat("y-M-d HH:mm", Locale.CHINA);
71 | return formate.format(new Date(timestamp* 1000));
72 | }
73 |
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | C:\Users\Administrator\AppData\Roaming\Subversion
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/bean/TallyTypeBean.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.bean;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by Administrator on 2017/10/17 0017.
7 | */
8 |
9 | public class TallyTypeBean extends BaseBean {
10 |
11 |
12 | /**
13 | * total : 4.31
14 | * surplus : +2.31
15 | * scale : -99.90%
16 | * t_money : [{"affect_money":4.31,"type":"78","typename":"vip额外收益","back_color":"#6783fd"}]
17 | */
18 |
19 | private float total;
20 | private String surplus;
21 | private String scale;
22 | private List t_money;
23 |
24 | public float getTotal() {
25 | return total;
26 | }
27 |
28 | public void setTotal(float total) {
29 | this.total = total;
30 | }
31 |
32 | public String getSurplus() {
33 | return surplus;
34 | }
35 |
36 | public void setSurplus(String surplus) {
37 | this.surplus = surplus;
38 | }
39 |
40 | public String getScale() {
41 | return scale;
42 | }
43 |
44 | public void setScale(String scale) {
45 | this.scale = scale;
46 | }
47 |
48 | public List getT_money() {
49 | return t_money;
50 | }
51 |
52 | public void setT_money(List t_money) {
53 | this.t_money = t_money;
54 | }
55 |
56 | public static class TMoneyBean {
57 | /**
58 | * affect_money : 4.31
59 | * type : 78
60 | * typename : vip额外收益
61 | * back_color : #6783fd
62 | */
63 |
64 | private float affect_money;
65 | private int type;
66 | private String typename;
67 | private String back_color;
68 |
69 | public float getAffect_money() {
70 | return affect_money;
71 | }
72 |
73 | public void setAffect_money(float affect_money) {
74 | this.affect_money = affect_money;
75 | }
76 |
77 | public int getType() {
78 | return type;
79 | }
80 |
81 | public void setType(int type) {
82 | this.type = type;
83 | }
84 |
85 | public String getTypename() {
86 | return typename;
87 | }
88 |
89 | public void setTypename(String typename) {
90 | this.typename = typename;
91 | }
92 |
93 | public String getBack_color() {
94 | return back_color;
95 | }
96 |
97 | public void setBack_color(String back_color) {
98 | this.back_color = back_color;
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_tally_account.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
17 |
18 |
19 |
27 |
28 |
35 |
36 |
45 |
46 |
47 |
48 |
49 |
57 |
58 |
64 |
65 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/fragment/MenuMyFragment.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.fragment;
2 |
3 | import android.support.v4.widget.SwipeRefreshLayout;
4 | import android.support.v7.widget.LinearLayoutManager;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.widget.LinearLayout;
7 | import android.widget.TextView;
8 |
9 | import com.cocoon.jay.tallybook.R;
10 | import com.cocoon.jay.tallybook.adapter.TallyAccountAdapter;
11 | import com.cocoon.jay.tallybook.bean.TallyAccountBean;
12 | import com.cocoon.jay.tallybook.utils.DateUtils;
13 | import com.cocoon.jay.tallybook.utils.TestDataUtil;
14 |
15 | import java.util.Date;
16 | import java.util.List;
17 |
18 | import butterknife.BindView;
19 |
20 | /**
21 | * 记账本--我的账户
22 | */
23 | public class MenuMyFragment extends BaseFragment {
24 |
25 |
26 | @BindView(R.id.data_year)
27 | TextView dataYear;
28 | @BindView(R.id.data_month)
29 | TextView dataMonth;
30 | @BindView(R.id.layout_data)
31 | LinearLayout layoutData;
32 | @BindView(R.id.cash_surplus)
33 | TextView cashSurplus;
34 | @BindView(R.id.cash_compared)
35 | TextView cashCompared;
36 | @BindView(R.id.rv_list)
37 | RecyclerView rvList;
38 | @BindView(R.id.swipe)
39 | SwipeRefreshLayout swipe;
40 |
41 |
42 | private TallyAccountAdapter adapter;
43 | private List list;
44 |
45 |
46 | @Override
47 | protected int getLayoutId() {
48 | return R.layout.fragment_menu_my;
49 | }
50 |
51 |
52 | @Override
53 | protected void initEventAndData() {
54 |
55 | dataYear.setText(DateUtils.getCurYear("yyyy 年"));
56 | dataMonth.setText(DateUtils.date2Str(new Date(), "MM"));
57 | //改变加载显示的颜色
58 | swipe.setColorSchemeColors(getResources().getColor(R.color.text_red), getResources().getColor(R.color.text_red));
59 | //设置向下拉多少出现刷新
60 | swipe.setDistanceToTriggerSync(200);
61 | //设置刷新出现的位置
62 | swipe.setProgressViewEndTarget(false, 200);
63 | swipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
64 | @Override
65 | public void onRefresh() {
66 | swipe.setRefreshing(false);
67 | }
68 | });
69 |
70 | rvList.setLayoutManager(new LinearLayoutManager(getActivity()));
71 | adapter = new TallyAccountAdapter(getActivity(), list);
72 | adapter.setmListener(new TallyAccountAdapter.OnItemClickListener() {
73 | @Override
74 | public void onItemClick(int position) {
75 | }
76 | });
77 | rvList.setAdapter(adapter);
78 | //test data---------------
79 | setTestData();
80 | }
81 |
82 |
83 | private void setTestData() {
84 | TallyAccountBean data = TestDataUtil.getTallyAccountBean();
85 | list = data.getList();
86 | adapter.setmDatas(list);
87 | adapter.notifyDataSetChanged();
88 | }
89 |
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/bean/TallyAccountBean.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.bean;
2 |
3 | import java.io.Serializable;
4 | import java.util.List;
5 |
6 | /**
7 | * Created by Administrator on 2017/10/16 0016.
8 | */
9 |
10 | public class TallyAccountBean extends BaseBean{
11 |
12 |
13 | /**
14 | * total_in : 0.00
15 | * total_out : .00
16 | * list : [{"type":"1","img":"/UF/Uploads/Noteimg/cash@2x.png","name":"现金","num":"","income":"+0.00","outcome":"-0.00"},{"type":"3_17","img":"/UF/Uploads/Noteimg/bank@2x.png","name":"银行卡","num":"尾号3333","income":"+0.00","outcome":"-0.00"},{"type":"4","img":"/UF/Uploads/Noteimg/other@2x.png","name":"未分类","num":"","income":"+0.00","outcome":"-0.00"}]
17 | */
18 |
19 | private String total_in;
20 | private String total_out;
21 | private List list;
22 |
23 | public String getTotal_in() {
24 | return total_in;
25 | }
26 |
27 | public void setTotal_in(String total_in) {
28 | this.total_in = total_in;
29 | }
30 |
31 | public String getTotal_out() {
32 | return total_out;
33 | }
34 |
35 | public void setTotal_out(String total_out) {
36 | this.total_out = total_out;
37 | }
38 |
39 | public List getList() {
40 | return list;
41 | }
42 |
43 | public void setList(List list) {
44 | this.list = list;
45 | }
46 |
47 | public static class ListBean implements Serializable{
48 | /**
49 | * type : 1
50 | * img : /UF/Uploads/Noteimg/cash@2x.png
51 | * name : 现金
52 | * num :
53 | * income : +0.00
54 | * outcome : -0.00
55 | */
56 |
57 | private String type;
58 | private String img;
59 | private String name;
60 | private String num;
61 | private String income;
62 | private String outcome;
63 |
64 | public String getType() {
65 | return type;
66 | }
67 |
68 | public void setType(String type) {
69 | this.type = type;
70 | }
71 |
72 | public String getImg() {
73 | return img;
74 | }
75 |
76 | public void setImg(String img) {
77 | this.img = img;
78 | }
79 |
80 | public String getName() {
81 | return name;
82 | }
83 |
84 | public void setName(String name) {
85 | this.name = name;
86 | }
87 |
88 | public String getNum() {
89 | return num;
90 | }
91 |
92 | public void setNum(String num) {
93 | this.num = num;
94 | }
95 |
96 | public String getIncome() {
97 | return income;
98 | }
99 |
100 | public void setIncome(String income) {
101 | this.income = income;
102 | }
103 |
104 | public String getOutcome() {
105 | return outcome;
106 | }
107 |
108 | public void setOutcome(String outcome) {
109 | this.outcome = outcome;
110 | }
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/view/BaseBottomBar.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.View;
6 | import android.widget.LinearLayout;
7 |
8 | /**
9 | * 封装的底部导航栏。
10 | * n个tab按钮
11 | */
12 | public class BaseBottomBar extends LinearLayout implements
13 | View.OnClickListener {
14 |
15 | private static final String TAG = BaseBottomBar.class.getSimpleName();
16 |
17 | private View currentView;
18 |
19 | private View[] views;
20 |
21 | private OnBottomBarListener onBottomBarListener;
22 |
23 | public BaseBottomBar(Context context) {
24 | super(context);
25 | }
26 |
27 | public BaseBottomBar(Context context, AttributeSet attrs) {
28 | super(context, attrs);
29 | }
30 |
31 | @Override
32 | protected void onFinishInflate() {
33 | super.onFinishInflate();
34 | views = new View[getChildCount()];
35 | for (int i = 0; i < views.length; i++) {
36 | views[i] = getChildAt(i);
37 | views[i].setOnClickListener(this);
38 | views[i].setTag(i);
39 | }
40 | }
41 |
42 | /**
43 | * 显示某一个tab
44 | *
45 | * @param index
46 | */
47 | public void showTab(int index) {
48 | if (index < 0)
49 | return;
50 | if (views != null && views.length > 0 && views.length > index) {
51 | for (int i = 0; i < views.length; i++) {
52 | if (i != index) {
53 | onBottomBarListener.hideFragment(i, index);
54 | } else {
55 | setCurrentView(views[index]);
56 | }
57 | }
58 | }
59 |
60 | }
61 |
62 | public void setCurrentView(View view) {
63 | if (view == null) {
64 | return;
65 | }
66 |
67 | if (onBottomBarListener == null) {
68 | return;
69 | }
70 |
71 |
72 | // 当前view = 点击view则调用刷新接口
73 | if (view == currentView) {
74 | onBottomBarListener.refreshView((Integer)currentView.getTag());
75 | return;
76 | }
77 |
78 | // 将之前的tab置灰 隐藏fragment
79 | if (currentView != null) {
80 | currentView.setSelected(false);
81 | onBottomBarListener.hideFragment((Integer)currentView.getTag(), (Integer)view.getTag());
82 | }
83 |
84 | // 刷新当前view引用 显示当前fragment
85 | currentView = view;
86 | currentView.setSelected(true);
87 | onBottomBarListener.showFragment((Integer)view.getTag());
88 | }
89 |
90 | @Override
91 | public void onClick(View view) {
92 | if (onBottomBarListener != null) {
93 | onBottomBarListener.onTabClick(view);
94 | }
95 | }
96 |
97 | public void setOnBottomBarListener(OnBottomBarListener listener) {
98 | this.onBottomBarListener = listener;
99 | }
100 |
101 | public int getCount() {
102 | return views.length;
103 | }
104 |
105 | public static interface OnBottomBarListener {
106 |
107 | /**
108 | * 显示新tab页
109 | *
110 | * @param
111 | */
112 | public void showFragment(int index);
113 |
114 | /**
115 | * 隐藏新tab页
116 | *
117 | * @param
118 | */
119 | public void hideFragment(int lastIndex, int curIndex);
120 |
121 | /**
122 | * 刷新当前tab页
123 | */
124 | public void refreshView(int index);
125 |
126 | /**
127 | * tab点击
128 | *
129 | * @param view
130 | */
131 | public void onTabClick(View view);
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_recycler_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
49 |
50 |
51 |
61 |
62 |
72 |
73 |
74 |
80 |
81 |
82 |
83 |
86 |
87 |
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/adapter/TallyAccountAdapter.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.text.TextUtils;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.ImageView;
10 | import android.widget.TextView;
11 |
12 | import com.bumptech.glide.Glide;
13 | import com.cocoon.jay.tallybook.R;
14 | import com.cocoon.jay.tallybook.bean.TallyAccountBean;
15 |
16 | import java.util.List;
17 |
18 |
19 | public class TallyAccountAdapter extends RecyclerView.Adapter{
20 |
21 | private Context mContext;
22 | private LayoutInflater mInflater;
23 | private List mDatas;
24 |
25 |
26 | private OnItemClickListener mListener;
27 | public interface OnItemClickListener {
28 | void onItemClick(int position);
29 | }
30 |
31 | public void setmListener(OnItemClickListener mListener) {
32 | this.mListener = mListener;
33 | }
34 |
35 |
36 |
37 | public void setmDatas(List mDatas) {
38 | this.mDatas = mDatas;
39 | }
40 |
41 | public TallyAccountAdapter(Context context, List datas){
42 | this.mContext = context;
43 | this.mInflater = LayoutInflater.from(context);
44 | this. mDatas = datas;
45 |
46 | }
47 |
48 |
49 | @Override
50 | public int getItemCount() {
51 | return (mDatas== null) ? 0 : mDatas.size();
52 | }
53 |
54 |
55 |
56 | @Override
57 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
58 | View view = mInflater.inflate(R.layout.item_tally_account, parent, false);
59 | return new ViewHolder(view);
60 | }
61 |
62 |
63 | @Override
64 | public void onBindViewHolder(ViewHolder holder, final int position) {
65 | holder.money_out.setText(mDatas.get(position).getOutcome());
66 | holder.money_in.setText(mDatas.get(position).getIncome());
67 | holder.title.setText(mDatas.get(position).getName());
68 | Glide.with(mContext)
69 | .load("http://test.huishangsuo.cn" + mDatas.get(position).getImg())
70 | .into(holder.img);
71 |
72 | if(mDatas.get(position).getType().contains("3_") && !TextUtils.isEmpty(mDatas.get(position).getNum())){
73 | holder.code.setVisibility(View.VISIBLE);
74 | holder.code.setText(mDatas.get(position).getNum());
75 | }else{
76 | holder.code.setVisibility(View.GONE);
77 | }
78 | }
79 |
80 | class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
81 |
82 | private TextView title;
83 | private TextView code;
84 | private TextView money_out;
85 | private TextView money_in;
86 | private ImageView img;
87 |
88 | public ViewHolder(View view){
89 | super(view);
90 |
91 | title = (TextView) view.findViewById(R.id.title);
92 | code = (TextView) view.findViewById(R.id.code);
93 | money_out = (TextView) view.findViewById(R.id.money_out);
94 | money_in = (TextView) view.findViewById(R.id.money_in);
95 | img = (ImageView) view.findViewById(R.id.img);
96 | itemView.setOnClickListener(this);
97 | }
98 |
99 |
100 | @Override
101 | public void onClick(View view) {
102 | if(mListener != null){
103 | mListener.onItemClick(getAdapterPosition());
104 | }
105 | }
106 |
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
12 |
13 |
14 |
22 |
23 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
56 |
57 |
58 |
61 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
80 |
90 |
91 |
92 |
93 |
94 |
95 |
99 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/adapter/TallyBookNoteAdapter.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.adapter;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.ImageView;
8 | import android.widget.TextView;
9 | import android.widget.Toast;
10 |
11 | import com.bumptech.glide.Glide;
12 | import com.cocoon.jay.tallybook.R;
13 | import com.cocoon.jay.tallybook.activity.TallyBookNoteActivity;
14 | import com.cocoon.jay.tallybook.bean.TallyNoteBean;
15 |
16 | import java.util.List;
17 |
18 |
19 | public class TallyBookNoteAdapter extends RecyclerView.Adapter{
20 |
21 | private TallyBookNoteActivity mContext;
22 | private LayoutInflater mInflater;
23 | private List mDatas;
24 |
25 | private String baseUrl = "http://test.huishangsuo.cn";
26 |
27 | public void setmDatas(List mDatas) {
28 | this.mDatas = mDatas;
29 | }
30 |
31 | public TallyBookNoteAdapter(TallyBookNoteActivity context, List datas){
32 | this.mContext = context;
33 | this.mInflater = LayoutInflater.from(context);
34 | this. mDatas = datas;
35 |
36 | }
37 |
38 |
39 | @Override
40 | public int getItemCount() {
41 | return (mDatas== null) ? 0 : mDatas.size();
42 | }
43 |
44 |
45 |
46 | @Override
47 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
48 | View view = mInflater.inflate(R.layout.item_tb_type, parent, false);
49 | return new ViewHolder(view);
50 | }
51 |
52 |
53 | @Override
54 | public void onBindViewHolder(ViewHolder holder, final int position) {
55 | holder.title.setText(mDatas.get(position).getSort_name());
56 | if (mContext.lastBean.equals(mDatas.get(position))) {
57 | mDatas.get(position).setSelected(true);
58 | mContext.lastImg = holder.img;
59 | }
60 | String imgUrl = mDatas.get(position).getSort_img();
61 | String selectUrl = imgUrl.replace("blacksort","checksort");
62 | Glide.with(mContext).load(baseUrl+ (mDatas.get(position).isSelected() ? selectUrl : imgUrl)).into(holder.img);
63 | }
64 |
65 | class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener{
66 |
67 | private TextView title;
68 | private ImageView img;
69 |
70 | public ViewHolder(View view){
71 | super(view);
72 |
73 | title = (TextView) view.findViewById(R.id.item_tb_type_tv);
74 | img = (ImageView) view.findViewById(R.id.item_tb_type_img);
75 | itemView.setOnClickListener(this);
76 | itemView.setOnLongClickListener(this);
77 | }
78 |
79 |
80 | @Override
81 | public void onClick(View view) {
82 |
83 | if (mDatas.get(getAdapterPosition()).getSort_id().equals("0")){//添加按钮
84 | Toast.makeText(mContext, "点击添加", Toast.LENGTH_SHORT).show();
85 |
86 | }else if (!mContext.lastBean.equals(mDatas.get(getAdapterPosition()))){
87 | mDatas.get(getAdapterPosition()).setSelected(true);
88 | String imgUrl = mDatas.get(getAdapterPosition()).getSort_img();
89 | String selectUrl = imgUrl.replace("blacksort","checksort");
90 | Glide.with(mContext).load(baseUrl + selectUrl).into(img);
91 | mContext.lastBean.setSelected(false);
92 | Glide.with(mContext).load(baseUrl + mContext.lastBean.getSort_img()).into(mContext.lastImg);
93 | mContext.lastImg = img;
94 | mContext.lastBean = mDatas.get(getAdapterPosition());
95 | }
96 | }
97 |
98 | @Override
99 | public boolean onLongClick(View view) {
100 | //根据自己需求进行判断
101 | if (Integer.parseInt(mDatas.get(getAdapterPosition()).getUid()) > 0 ){
102 | Toast.makeText(mContext, "长按编辑", Toast.LENGTH_SHORT).show();
103 | }
104 | return false;
105 | }
106 | }
107 |
108 | }
109 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/fragment/MenuFirstFragment.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.fragment;
2 |
3 | import android.content.Intent;
4 | import android.support.design.widget.FloatingActionButton;
5 | import android.support.v4.widget.SwipeRefreshLayout;
6 | import android.support.v7.widget.DefaultItemAnimator;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.widget.LinearLayout;
9 | import android.widget.TextView;
10 |
11 | import com.cocoon.jay.tallybook.R;
12 | import com.cocoon.jay.tallybook.activity.TallyBookNoteActivity;
13 | import com.cocoon.jay.tallybook.adapter.TallyDetailAdapter;
14 | import com.cocoon.jay.tallybook.bean.TallyDetailBean;
15 | import com.cocoon.jay.tallybook.stickyheader.StickyHeaderGridLayoutManager;
16 | import com.cocoon.jay.tallybook.utils.DateUtils;
17 | import com.cocoon.jay.tallybook.utils.TestDataUtil;
18 |
19 | import java.util.Date;
20 | import java.util.List;
21 |
22 | import butterknife.BindView;
23 | import butterknife.OnClick;
24 | import butterknife.Unbinder;
25 |
26 | /**
27 | * 记账本--明细
28 | */
29 | public class MenuFirstFragment extends BaseFragment {
30 |
31 |
32 | @BindView(R.id.data_year)
33 | TextView dataYear;
34 | @BindView(R.id.data_month)
35 | TextView dataMonth;
36 | @BindView(R.id.layout_data)
37 | LinearLayout layoutData;
38 | @BindView(R.id.cash_surplus)
39 | TextView cashSurplus;
40 | @BindView(R.id.cash_compared)
41 | TextView cashCompared;
42 | @BindView(R.id.rv_list)
43 | RecyclerView rvList;
44 | @BindView(R.id.swipe)
45 | SwipeRefreshLayout swipe;
46 | @BindView(R.id.float_btn)
47 | FloatingActionButton floatBtn;
48 | Unbinder unbinder;
49 |
50 |
51 | private static final int SPAN_SIZE = 1;
52 | private StickyHeaderGridLayoutManager mLayoutManager;
53 | private TallyDetailAdapter adapter;
54 | private List list;
55 |
56 |
57 | @Override
58 | protected int getLayoutId() {
59 | return R.layout.fragment_menu_first;
60 | }
61 |
62 |
63 | @Override
64 | protected void initEventAndData() {
65 |
66 | dataYear.setText(DateUtils.getCurYear("yyyy 年"));
67 | dataMonth.setText(DateUtils.date2Str(new Date(), "MM"));
68 | //改变加载显示的颜色
69 | swipe.setColorSchemeColors(getResources().getColor(R.color.text_red), getResources().getColor(R.color.text_red));
70 | //设置向下拉多少出现刷新
71 | swipe.setDistanceToTriggerSync(200);
72 | //设置刷新出现的位置
73 | swipe.setProgressViewEndTarget(false, 200);
74 | swipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
75 | @Override
76 | public void onRefresh() {
77 | swipe.setRefreshing(false);
78 | setTestData();//恢复了假数据
79 | }
80 | });
81 |
82 | mLayoutManager = new StickyHeaderGridLayoutManager(SPAN_SIZE);
83 | mLayoutManager.setHeaderBottomOverlapMargin(5);
84 |
85 | // Workaround RecyclerView limitation when playing remove animations. RecyclerView always
86 | // puts the removed item on the top of other views and it will be drawn above sticky header.
87 | // The only way to fix this, abandon remove animations :(
88 | rvList.setItemAnimator(new DefaultItemAnimator() {
89 | @Override
90 | public boolean animateRemove(RecyclerView.ViewHolder holder) {
91 | dispatchRemoveFinished(holder);
92 | return false;
93 | }
94 | });
95 | rvList.setLayoutManager(mLayoutManager);
96 | adapter = new TallyDetailAdapter(mContext, list);
97 | rvList.setAdapter(adapter);
98 | //test data---------------
99 | setTestData();
100 | }
101 |
102 |
103 | private void setTestData() {
104 | TallyDetailBean data = TestDataUtil.getTallyDetailBean();
105 | list = data.getDaylist();
106 | adapter.setmDatas(list);
107 | adapter.notifyAllSectionsDataSetChanged();//需调用此方法刷新
108 | }
109 |
110 |
111 | @OnClick(R.id.float_btn)
112 | public void onViewClicked() {
113 | Intent intent = new Intent(getContext(),TallyBookNoteActivity.class);
114 | startActivity(intent);
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/top_date.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
27 |
28 |
33 |
34 |
42 |
51 |
52 |
53 |
54 |
55 |
56 |
61 |
68 |
69 |
76 |
85 |
86 |
87 |
94 |
101 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/activity/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.activity;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.os.Handler;
5 | import android.os.Message;
6 | import android.support.v4.app.Fragment;
7 | import android.support.v4.app.FragmentManager;
8 | import android.support.v4.app.FragmentTransaction;
9 | import android.view.View;
10 | import android.widget.FrameLayout;
11 | import android.widget.ImageView;
12 | import android.widget.TextView;
13 |
14 | import com.cocoon.jay.tallybook.R;
15 | import com.cocoon.jay.tallybook.fragment.MenuFirstFragment;
16 | import com.cocoon.jay.tallybook.fragment.MenuMyFragment;
17 | import com.cocoon.jay.tallybook.fragment.MenuTypeFragment;
18 | import com.cocoon.jay.tallybook.view.BaseBottomBar;
19 |
20 | import butterknife.BindView;
21 | import butterknife.OnClick;
22 |
23 | public class MainActivity extends BaseActivity implements
24 | BaseBottomBar.OnBottomBarListener {
25 |
26 |
27 | @BindView(R.id.title_tv)
28 | TextView titleTv;
29 | @BindView(R.id.right_btn)
30 | ImageView rightBtn;
31 | @BindView(R.id.Container)
32 | FrameLayout Container;
33 | @BindView(R.id.main_bottom_bar)
34 | BaseBottomBar mBottomBar;
35 | // 当前选中的tab位置
36 | private int index = 0;
37 | private FragmentManager mFragmentManager;
38 |
39 | private static final int MSG_CLICK = 20151009;
40 | private Boolean mCanClickBoolean = true;
41 | private int MSG_CLICK_DURATION = 200;//能够响应点击事件的时间间隔为0.2s
42 | @SuppressLint("HandlerLeak")
43 | private Handler mHandler = new Handler() {
44 |
45 | @Override
46 | public void handleMessage(Message msg) {
47 | if (mHandler == null) {
48 | return;
49 | }
50 | int msgNum = msg.what;
51 | switch (msgNum) {
52 | case MSG_CLICK:
53 | mCanClickBoolean = true;
54 | break;
55 | }
56 | }
57 | };
58 |
59 |
60 |
61 | @Override
62 | protected int getLayout() {
63 | return R.layout.activity_main;
64 | }
65 |
66 | @Override
67 | protected void initEventAndData() {
68 | mFragmentManager = getSupportFragmentManager();
69 | mBottomBar.setOnBottomBarListener(this);
70 | mBottomBar.showTab(0);
71 | }
72 |
73 |
74 |
75 | @Override
76 | public void showFragment(int index) {
77 | Fragment fragment = getSupportFragmentManager().findFragmentByTag(String.valueOf(index));
78 | if (fragment == null) {
79 | if (index == 0) {
80 | fragment = new MenuFirstFragment();
81 | } else if (index == 1) {
82 | fragment = new MenuTypeFragment();
83 | } else if (index == 2) {
84 | fragment = new MenuMyFragment();
85 | }
86 |
87 | if (!fragment.isAdded()) {
88 | obtainFragmentTransaction(index).add(R.id.Container, fragment, String.valueOf(index)).commitAllowingStateLoss();
89 | }
90 | }
91 | if (fragment != null) {
92 | obtainFragmentTransaction(index).show(fragment).commitAllowingStateLoss();
93 | }
94 | this.index = index;
95 | }
96 |
97 | @Override
98 | public void hideFragment(int lastIndex, int curIndex) {
99 | Fragment fragment = getSupportFragmentManager().findFragmentByTag(String.valueOf(index));
100 | if (fragment != null) {
101 | obtainFragmentTransaction(curIndex).hide(fragment).commitAllowingStateLoss();
102 | }
103 | }
104 |
105 | @Override
106 | public void refreshView(int index) {
107 | if (index == 0) {
108 | } else if (index == 1) {
109 | } else if (index == 2) {
110 | }
111 | }
112 |
113 | @Override
114 | public void onTabClick(View view) {
115 | if (!mCanClickBoolean) {
116 | return;
117 | }
118 | mCanClickBoolean = false;
119 | mHandler.removeMessages(MSG_CLICK);
120 | mHandler.sendEmptyMessageDelayed(MSG_CLICK,
121 | MSG_CLICK_DURATION);
122 |
123 | mBottomBar.setCurrentView(view);
124 |
125 | if (index == 0) {
126 | titleTv.setText("记账");
127 | } else if (index == 1) {
128 | titleTv.setText("类别报表");
129 | } else if (index == 2) {
130 | titleTv.setText("账户");
131 | }
132 |
133 | }
134 |
135 |
136 | /**
137 | * 获取一个带动画的FragmentTransaction
138 | *
139 | * @param index
140 | * @return
141 | */
142 | private FragmentTransaction obtainFragmentTransaction(int index) {
143 | FragmentTransaction ft = mFragmentManager.beginTransaction();
144 | // 设置切换动画
145 | if (index > this.index) {
146 | ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left);
147 | } else {
148 | ft.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_right);
149 | }
150 | return ft;
151 | }
152 |
153 |
154 | @OnClick(R.id.right_btn)
155 | public void onViewClicked() {
156 | }
157 | }
158 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/adapter/TallyDetailAdapter.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.adapter;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.Button;
8 | import android.widget.ImageView;
9 | import android.widget.RelativeLayout;
10 | import android.widget.TextView;
11 | import android.widget.Toast;
12 |
13 | import com.bumptech.glide.Glide;
14 | import com.cocoon.jay.tallybook.R;
15 | import com.cocoon.jay.tallybook.bean.TallyDetailBean;
16 | import com.cocoon.jay.tallybook.stickyheader.StickyHeaderGridAdapter;
17 | import com.cocoon.jay.tallybook.view.SwipeMenuView;
18 |
19 | import java.util.List;
20 |
21 | /**
22 | * 悬浮头部项
23 | * 可侧滑删除
24 | */
25 |
26 | public class TallyDetailAdapter extends StickyHeaderGridAdapter {
27 |
28 | private Context mContext;
29 |
30 | private String baseUrl = "http://test.huishangsuo.cn";
31 |
32 | private List mDatas;
33 |
34 | public void setmDatas(List mDatas) {
35 | this.mDatas = mDatas;
36 | }
37 |
38 | public TallyDetailAdapter(Context context, List datas){
39 | this.mContext = context;
40 | this. mDatas = datas;
41 | }
42 |
43 |
44 | @Override
45 | public int getSectionCount() {
46 | return mDatas == null ? 0 : mDatas.size();
47 | }
48 |
49 | @Override
50 | public int getSectionItemCount(int section) {
51 | return (mDatas == null || mDatas.get(section).getList() == null) ? 0 : mDatas.get(section).getList().size();
52 | }
53 |
54 | @Override
55 | public StickyHeaderGridAdapter.HeaderViewHolder onCreateHeaderViewHolder(ViewGroup parent, int headerType) {
56 | final View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_recycler_header, parent, false);
57 | return new MyHeaderViewHolder(view);
58 | }
59 |
60 | @Override
61 | public ItemViewHolder onCreateItemViewHolder(ViewGroup parent, int itemType) {
62 | final View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_recycler_item, parent, false);
63 | return new MyItemViewHolder(view);
64 | }
65 |
66 | @Override
67 | public void onBindHeaderViewHolder(HeaderViewHolder viewHolder, int section) {
68 | final MyHeaderViewHolder holder = (MyHeaderViewHolder)viewHolder;
69 | holder.header_date.setText(mDatas.get(section).getTime());
70 | holder.header_money.setText(mDatas.get(section).getMoney());
71 | }
72 |
73 | @Override
74 | public void onBindItemViewHolder(ItemViewHolder viewHolder, final int section, final int position) {
75 | final MyItemViewHolder holder = (MyItemViewHolder)viewHolder;
76 | final String label = mDatas.get(section).getList().get(position).getTypename();
77 | holder.item_title.setText(label);
78 | Glide.with(mContext).load(baseUrl + mDatas.get(section).getList().get(position).getImg()).into( holder.item_img);
79 | holder.item_money.setText(mDatas.get(section).getList().get(position).getAffect_money());
80 | if (mDatas.get(section).getList().get(position).getId().startsWith("sys")){
81 | holder.mSwipeMenuView.setSwipeEnable(false);//sys系统的不做删除
82 | }else {
83 | holder.mSwipeMenuView.setSwipeEnable(true);
84 | }
85 | holder.item_delete.setOnClickListener(new View.OnClickListener() {
86 | @Override
87 | public void onClick(View v) {
88 | final int section = getAdapterPositionSection(holder.getAdapterPosition());
89 | final int offset = getItemSectionOffset(section, holder.getAdapterPosition());
90 |
91 | mDatas.get(section).getList().remove(offset);
92 | notifySectionItemRemoved(section, offset);
93 | Toast.makeText(holder.item_delete.getContext(), "删除--"+label, Toast.LENGTH_SHORT).show();
94 | }
95 | });
96 | holder.item_layout.setOnClickListener(new View.OnClickListener() {
97 | @Override
98 | public void onClick(View view) {
99 | Toast.makeText(holder.item_layout.getContext(), "点击--"+label, Toast.LENGTH_SHORT).show();
100 | }
101 | });
102 | }
103 |
104 | public static class MyHeaderViewHolder extends HeaderViewHolder {
105 | TextView header_date;
106 | TextView header_money;
107 |
108 | MyHeaderViewHolder(View itemView) {
109 | super(itemView);
110 | header_date = (TextView) itemView.findViewById(R.id.header_date);
111 | header_money = (TextView) itemView.findViewById(R.id.header_money);
112 | }
113 | }
114 |
115 | public static class MyItemViewHolder extends ItemViewHolder {
116 | TextView item_title;
117 | TextView item_money;
118 | Button item_delete;
119 | ImageView item_img;
120 | RelativeLayout item_layout;
121 | SwipeMenuView mSwipeMenuView;
122 |
123 | MyItemViewHolder(View itemView) {
124 | super(itemView);
125 | item_title = (TextView) itemView.findViewById(R.id.item_title);
126 | item_money = (TextView) itemView.findViewById(R.id.item_money);
127 | item_delete = (Button) itemView.findViewById(R.id.item_delete);
128 | item_img = (ImageView) itemView.findViewById(R.id.item_img);
129 | item_layout = (RelativeLayout) itemView.findViewById(R.id.item_layout);
130 | mSwipeMenuView = (SwipeMenuView) itemView.findViewById(R.id.swipe_menu);
131 | }
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/bean/TallyNoteBean.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.bean;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * 记一笔 --- 多个小类别的model
7 | */
8 |
9 | public class TallyNoteBean extends BaseBean{
10 |
11 | /**
12 | * sortlist : [{"sort_id":"301","uid":"0","sort_name":"偿还费用","sort_img":"/UF/Uploads/Noteimg/blacksort/changhuanfeiyong@2x.png"},{"sort_id":"302","uid":"0","sort_name":"手续费","sort_img":"/UF/Uploads/Noteimg/blacksort/shouxufei@2x.png"},{"sort_id":"303","uid":"0","sort_name":"商城消费","sort_img":"/UF/Uploads/Noteimg/blacksort/shangchengxiaofei@2x.png"},{"sort_id":"304","uid":"0","sort_name":"违约金","sort_img":"/UF/Uploads/Noteimg/blacksort/weiyuejin@2x.png"},{"sort_id":"305","uid":"0","sort_name":"住房","sort_img":"/UF/Uploads/Noteimg/blacksort/zhufang@2x.png"},{"sort_id":"306","uid":"0","sort_name":"办公","sort_img":"/UF/Uploads/Noteimg/blacksort/bangong@2x.png"},{"sort_id":"307","uid":"0","sort_name":"餐饮","sort_img":"/UF/Uploads/Noteimg/blacksort/canyin@2x.png"},{"sort_id":"308","uid":"0","sort_name":"医疗","sort_img":"/UF/Uploads/Noteimg/blacksort/yiliao@2x.png"},{"sort_id":"309","uid":"0","sort_name":"通讯","sort_img":"/UF/Uploads/Noteimg/blacksort/tongxun@2x.png"},{"sort_id":"310","uid":"0","sort_name":"运动","sort_img":"/UF/Uploads/Noteimg/blacksort/yundong@2x.png"},{"sort_id":"311","uid":"0","sort_name":"娱乐","sort_img":"/UF/Uploads/Noteimg/blacksort/yule@2x.png"},{"sort_id":"312","uid":"0","sort_name":"居家","sort_img":"/UF/Uploads/Noteimg/blacksort/jujia@2x.png"},{"sort_id":"313","uid":"0","sort_name":"宠物","sort_img":"/UF/Uploads/Noteimg/blacksort/chongwu@2x.png"},{"sort_id":"314","uid":"0","sort_name":"数码","sort_img":"/UF/Uploads/Noteimg/blacksort/shuma@2x.png"},{"sort_id":"315","uid":"0","sort_name":"捐赠","sort_img":"/UF/Uploads/Noteimg/blacksort/juanzeng@2x.png"},{"sort_id":"316","uid":"0","sort_name":"零食","sort_img":"/UF/Uploads/Noteimg/blacksort/lingshi@2x.png"},{"sort_id":"317","uid":"0","sort_name":"孩子","sort_img":"/UF/Uploads/Noteimg/blacksort/haizi@2x.png"},{"sort_id":"318","uid":"0","sort_name":"长辈","sort_img":"/UF/Uploads/Noteimg/blacksort/zhangbei@2x.png"},{"sort_id":"319","uid":"0","sort_name":"礼物","sort_img":"/UF/Uploads/Noteimg/blacksort/liwu@2x.png"},{"sort_id":"320","uid":"0","sort_name":"学习","sort_img":"/UF/Uploads/Noteimg/blacksort/xuexi@2x.png"},{"sort_id":"321","uid":"0","sort_name":"水果","sort_img":"/UF/Uploads/Noteimg/blacksort/shuiguo@2x.png"},{"sort_id":"322","uid":"0","sort_name":"美容","sort_img":"/UF/Uploads/Noteimg/blacksort/meirong@2x.png"},{"sort_id":"323","uid":"0","sort_name":"维修","sort_img":"/UF/Uploads/Noteimg/blacksort/weixiu@2x.png"},{"sort_id":"324","uid":"0","sort_name":"旅行","sort_img":"/UF/Uploads/Noteimg/blacksort/lvxing@2x.png"},{"sort_id":"325","uid":"0","sort_name":"交通","sort_img":"/UF/Uploads/Noteimg/blacksort/jiaotong@2x.png"},{"sort_id":"326","uid":"0","sort_name":"饮料","sort_img":"/UF/Uploads/Noteimg/blacksort/jiushuiyinliao@2x.png"},{"sort_id":"327","uid":"0","sort_name":"礼金","sort_img":"/UF/Uploads/Noteimg/blacksort/lijin@2x.png"},{"sort_id":"340","uid":"262","sort_name":"添加4","sort_img":"/UF/Uploads/Noteimg/blacksort/tianjiade@2x.png"},{"sort_id":"341","uid":"262","sort_name":"添加5","sort_img":"/UF/Uploads/Noteimg/blacksort/tianjiade@2x.png"},{"sort_id":"342","uid":"262","sort_name":"添加6","sort_img":"/UF/Uploads/Noteimg/blacksort/tianjiade@2x.png"},{"sort_id":"343","uid":"262","sort_name":"卖大米","sort_img":"/UF/Uploads/Noteimg/blacksort/tianjiade@2x.png"}]
13 | * payinfo : [{"pay_type":"1","pay_name":"现金"},{"pay_type":"3_10","pay_name":"银行卡-尾号4565"},{"pay_type":"3_9","pay_name":"银行卡-尾号4565"},{"pay_type":"3_8","pay_name":"银行卡-尾号4565"},{"pay_type":"3_7","pay_name":"银行卡-尾号4565"},{"pay_type":"3_4","pay_name":"银行卡-尾号5467"},{"pay_type":"3_1","pay_name":"银行卡-尾号7899"},{"pay_type":"4","pay_name":"未分类"}]
14 | */
15 |
16 | private List sortlist;
17 | private List payinfo;
18 |
19 |
20 | public List getSortlist() {
21 | return sortlist;
22 | }
23 |
24 | public void setSortlist(List sortlist) {
25 | this.sortlist = sortlist;
26 | }
27 |
28 | public List getPayinfo() {
29 | return payinfo;
30 | }
31 |
32 | public void setPayinfo(List payinfo) {
33 | this.payinfo = payinfo;
34 | }
35 |
36 |
37 | public static class SortlistBean {
38 | /**
39 | * sort_id : 301
40 | * uid : 0
41 | * sort_name : 偿还费用
42 | * sort_img : /UF/Uploads/Noteimg/blacksort/changhuanfeiyong@2x.png
43 | */
44 |
45 | private String sort_id;
46 | private String uid;
47 | private String sort_name;
48 | private String sort_img;
49 | private boolean selected;
50 |
51 | public boolean isSelected() {
52 | return selected;
53 | }
54 |
55 | public void setSelected(boolean select) {
56 | this.selected = select;
57 | }
58 |
59 | public String getSort_id() {
60 | return sort_id;
61 | }
62 |
63 | public void setSort_id(String sort_id) {
64 | this.sort_id = sort_id;
65 | }
66 |
67 | public String getUid() {
68 | return uid;
69 | }
70 |
71 | public void setUid(String uid) {
72 | this.uid = uid;
73 | }
74 |
75 | public String getSort_name() {
76 | return sort_name;
77 | }
78 |
79 | public void setSort_name(String sort_name) {
80 | this.sort_name = sort_name;
81 | }
82 |
83 | public String getSort_img() {
84 | return sort_img;
85 | }
86 |
87 | public void setSort_img(String sort_img) {
88 | this.sort_img = sort_img;
89 | }
90 | }
91 |
92 | public static class PayinfoBean {
93 | /**
94 | * pay_type : 1
95 | * pay_name : 现金
96 | */
97 |
98 | private String pay_type;
99 | private String pay_name;
100 |
101 | public String getPay_type() {
102 | return pay_type;
103 | }
104 |
105 | public void setPay_type(String pay_type) {
106 | this.pay_type = pay_type;
107 | }
108 |
109 | public String getPay_name() {
110 | return pay_name;
111 | }
112 |
113 | public void setPay_name(String pay_name) {
114 | this.pay_name = pay_name;
115 | }
116 | }
117 |
118 | }
119 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/bean/TallyDetailBean.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.bean;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by Administrator on 2017/10/23 0023.
7 | */
8 |
9 | public class TallyDetailBean extends BaseBean {
10 |
11 |
12 | /**
13 | * t_income : 41.42
14 | * t_outcome : 212.36
15 | * daylist : [{"time":"23日-星期一","money":"支出:210.00 收入:0.00","list":[{"id":"80","affect_money":"-69.00","typename":"嗯嗯","img":"/UF/Uploads/Noteimg/listout/shangchengxiaofei@2x.png"},{"id":"78","affect_money":"-6.00","typename":"不不back","img":"/UF/Uploads/Noteimg/listout/canyin@2x.png"},{"id":"76","affect_money":"-3.00","typename":"偿还费用","img":"/UF/Uploads/Noteimg/listout/changhuanfeiyong@2x.png"},{"id":"81","affect_money":"-66.00","typename":"长辈","img":"/UF/Uploads/Noteimg/listout/zhangbei@2x.png"},{"id":"79","affect_money":"-3.00","typename":"餐饮","img":"/UF/Uploads/Noteimg/listout/canyin@2x.png"},{"id":"77","affect_money":"-63.00","typename":"偿还费用","img":"/UF/Uploads/Noteimg/listout/changhuanfeiyong@2x.png"}]},{"time":"20日-星期五","money":"支出:0.00 收入:37.11","list":[{"id":"sys_17701","affect_money":"+0.03","typename":"vip额外收益","img":"/UF/Uploads/Noteimg/listin/ewaishouyi@2x.png"},{"id":"sys_17699","affect_money":"+0.15","typename":"vip额外收益","img":"/UF/Uploads/Noteimg/listin/ewaishouyi@2x.png"},{"id":"sys_17683","affect_money":"+0.03","typename":"vip额外收益","img":"/UF/Uploads/Noteimg/listin/ewaishouyi@2x.png"},{"id":"sys_17681","affect_money":"+0.15","typename":"vip额外收益","img":"/UF/Uploads/Noteimg/listin/ewaishouyi@2x.png"},{"id":"sys_17660","affect_money":"+0.18","typename":"vip额外收益","img":"/UF/Uploads/Noteimg/listin/ewaishouyi@2x.png"},{"id":"sys_17662","affect_money":"+0.03","typename":"vip额外收益","img":"/UF/Uploads/Noteimg/listin/ewaishouyi@2x.png"},{"id":"sys_17479","affect_money":"+0.18","typename":"vip待收利息","img":"/UF/Uploads/Noteimg/listin/lixi@2x.png"},{"id":"sys_17475","affect_money":"+20.40","typename":"投标成功待收利息","img":"/UF/Uploads/Noteimg/listin/lixi@2x.png"},{"id":"sys_17476","affect_money":"+0.90","typename":"vip待收利息","img":"/UF/Uploads/Noteimg/listin/lixi@2x.png"},{"id":"sys_17478","affect_money":"+3.42","typename":"投标成功待收利息","img":"/UF/Uploads/Noteimg/listin/lixi@2x.png"},{"id":"sys_17465","affect_money":"+1.38","typename":"投标成功待收利息","img":"/UF/Uploads/Noteimg/listin/lixi@2x.png"},{"id":"sys_17466","affect_money":"+0.09","typename":"vip待收利息","img":"/UF/Uploads/Noteimg/listin/lixi@2x.png"},{"id":"sys_17462","affect_money":"+9.63","typename":"投标成功待收利息","img":"/UF/Uploads/Noteimg/listin/lixi@2x.png"},{"id":"sys_17463","affect_money":"+0.54","typename":"vip待收利息","img":"/UF/Uploads/Noteimg/listin/lixi@2x.png"}]},{"time":"16日-星期一","money":"支出:0.00 收入:0.60","list":[{"id":"sys_17437","affect_money":"+0.15","typename":"vip额外收益","img":"/UF/Uploads/Noteimg/listin/ewaishouyi@2x.png"},{"id":"sys_17428","affect_money":"+0.20","typename":"vip额外收益","img":"/UF/Uploads/Noteimg/listin/ewaishouyi@2x.png"},{"id":"sys_17416","affect_money":"+0.20","typename":"vip额外收益","img":"/UF/Uploads/Noteimg/listin/ewaishouyi@2x.png"},{"id":"sys_17418","affect_money":"+0.05","typename":"vip额外收益","img":"/UF/Uploads/Noteimg/listin/ewaishouyi@2x.png"}]},{"time":"13日-星期五","money":"支出:0.00 收入:0.43","list":[{"id":"sys_17400","affect_money":"+0.18","typename":"vip额外收益","img":"/UF/Uploads/Noteimg/listin/ewaishouyi@2x.png"},{"id":"sys_17402","affect_money":"+0.05","typename":"vip额外收益","img":"/UF/Uploads/Noteimg/listin/ewaishouyi@2x.png"},{"id":"sys_17391","affect_money":"+0.20","typename":"vip额外收益","img":"/UF/Uploads/Noteimg/listin/ewaishouyi@2x.png"}]}]
16 | */
17 |
18 | private String t_income;
19 | private String t_outcome;
20 | private List daylist;
21 |
22 | public String getT_income() {
23 | return t_income;
24 | }
25 |
26 | public void setT_income(String t_income) {
27 | this.t_income = t_income;
28 | }
29 |
30 | public String getT_outcome() {
31 | return t_outcome;
32 | }
33 |
34 | public void setT_outcome(String t_outcome) {
35 | this.t_outcome = t_outcome;
36 | }
37 |
38 | public List getDaylist() {
39 | return daylist;
40 | }
41 |
42 | public void setDaylist(List daylist) {
43 | this.daylist = daylist;
44 | }
45 |
46 | public static class DaylistBean {
47 | /**
48 | * time : 23日-星期一
49 | * money : 支出:210.00 收入:0.00
50 | * list : [{"id":"80","affect_money":"-69.00","typename":"嗯嗯","img":"/UF/Uploads/Noteimg/listout/shangchengxiaofei@2x.png"},{"id":"78","affect_money":"-6.00","typename":"不不back","img":"/UF/Uploads/Noteimg/listout/canyin@2x.png"},{"id":"76","affect_money":"-3.00","typename":"偿还费用","img":"/UF/Uploads/Noteimg/listout/changhuanfeiyong@2x.png"},{"id":"81","affect_money":"-66.00","typename":"长辈","img":"/UF/Uploads/Noteimg/listout/zhangbei@2x.png"},{"id":"79","affect_money":"-3.00","typename":"餐饮","img":"/UF/Uploads/Noteimg/listout/canyin@2x.png"},{"id":"77","affect_money":"-63.00","typename":"偿还费用","img":"/UF/Uploads/Noteimg/listout/changhuanfeiyong@2x.png"}]
51 | */
52 |
53 | private String time;
54 | private String money;
55 | private List list;
56 |
57 | public String getTime() {
58 | return time;
59 | }
60 |
61 | public void setTime(String time) {
62 | this.time = time;
63 | }
64 |
65 | public String getMoney() {
66 | return money;
67 | }
68 |
69 | public void setMoney(String money) {
70 | this.money = money;
71 | }
72 |
73 | public List getList() {
74 | return list;
75 | }
76 |
77 | public void setList(List list) {
78 | this.list = list;
79 | }
80 |
81 | public static class ListBean {
82 | /**
83 | * id : 80
84 | * affect_money : -69.00
85 | * typename : 嗯嗯
86 | * img : /UF/Uploads/Noteimg/listout/shangchengxiaofei@2x.png
87 | */
88 |
89 | private String id;
90 | private String affect_money;
91 | private String typename;
92 | private String img;
93 |
94 | public String getId() {
95 | return id;
96 | }
97 |
98 | public void setId(String id) {
99 | this.id = id;
100 | }
101 |
102 | public String getAffect_money() {
103 | return affect_money;
104 | }
105 |
106 | public void setAffect_money(String affect_money) {
107 | this.affect_money = affect_money;
108 | }
109 |
110 | public String getTypename() {
111 | return typename;
112 | }
113 |
114 | public void setTypename(String typename) {
115 | this.typename = typename;
116 | }
117 |
118 | public String getImg() {
119 | return img;
120 | }
121 |
122 | public void setImg(String img) {
123 | this.img = img;
124 | }
125 | }
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/view/CircleImageView.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.view;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Bitmap;
6 | import android.graphics.BitmapShader;
7 | import android.graphics.Canvas;
8 | import android.graphics.Color;
9 | import android.graphics.ColorFilter;
10 | import android.graphics.Matrix;
11 | import android.graphics.Paint;
12 | import android.graphics.RectF;
13 | import android.graphics.Shader;
14 | import android.graphics.drawable.BitmapDrawable;
15 | import android.graphics.drawable.ColorDrawable;
16 | import android.graphics.drawable.Drawable;
17 | import android.net.Uri;
18 | import android.support.v7.widget.AppCompatImageView;
19 | import android.util.AttributeSet;
20 |
21 | import com.cocoon.jay.tallybook.R;
22 |
23 |
24 | public class CircleImageView extends AppCompatImageView {
25 |
26 | private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP;
27 |
28 | private static final Bitmap.Config BITMAP_CONFIG = Bitmap.Config.ARGB_8888;
29 | private static final int COLORDRAWABLE_DIMENSION = 2;
30 |
31 | private static final int DEFAULT_BORDER_WIDTH = 0;
32 | private static final int DEFAULT_BORDER_COLOR = Color.BLACK;
33 |
34 | private final RectF mDrawableRect = new RectF();
35 | private final RectF mBorderRect = new RectF();
36 |
37 | private final Matrix mShaderMatrix = new Matrix();
38 | private final Paint mBitmapPaint = new Paint();
39 | private final Paint mBorderPaint = new Paint();
40 |
41 | private int mBorderColor = DEFAULT_BORDER_COLOR;
42 | private int mBorderWidth = DEFAULT_BORDER_WIDTH;
43 |
44 | private Bitmap mBitmap;
45 | private BitmapShader mBitmapShader;
46 | private int mBitmapWidth;
47 | private int mBitmapHeight;
48 |
49 | private float mDrawableRadius;
50 | private float mBorderRadius;
51 |
52 | private ColorFilter mColorFilter;
53 |
54 | private boolean mReady;
55 | private boolean mSetupPending;
56 |
57 | public CircleImageView(Context context) {
58 | super(context);
59 |
60 | init();
61 | }
62 |
63 | public CircleImageView(Context context, AttributeSet attrs) {
64 | this(context, attrs, 0);
65 | }
66 |
67 | public CircleImageView(Context context, AttributeSet attrs, int defStyle) {
68 | super(context, attrs, defStyle);
69 |
70 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyle, 0);
71 |
72 | mBorderWidth = a.getDimensionPixelSize(R.styleable.CircleImageView_border_width, DEFAULT_BORDER_WIDTH);
73 | mBorderColor = a.getColor(R.styleable.CircleImageView_border_color, DEFAULT_BORDER_COLOR);
74 |
75 | a.recycle();
76 |
77 | init();
78 | }
79 |
80 | private void init() {
81 | super.setScaleType(SCALE_TYPE);
82 | mReady = true;
83 |
84 | if (mSetupPending) {
85 | setup();
86 | mSetupPending = false;
87 | }
88 | }
89 |
90 | @Override
91 | public ScaleType getScaleType() {
92 | return SCALE_TYPE;
93 | }
94 |
95 | @Override
96 | public void setScaleType(ScaleType scaleType) {
97 | if (scaleType != SCALE_TYPE) {
98 | throw new IllegalArgumentException(String.format("ScaleType %s not supported.", scaleType));
99 | }
100 | }
101 |
102 | @Override
103 | public void setAdjustViewBounds(boolean adjustViewBounds) {
104 | if (adjustViewBounds) {
105 | throw new IllegalArgumentException("adjustViewBounds not supported.");
106 | }
107 | }
108 |
109 | @Override
110 | protected void onDraw(Canvas canvas) {
111 | if (getDrawable() == null) {
112 | return;
113 | }
114 |
115 | canvas.drawCircle(getWidth() / 2, getHeight() / 2, mDrawableRadius, mBitmapPaint);
116 | if (mBorderWidth != 0) {
117 | canvas.drawCircle(getWidth() / 2, getHeight() / 2, mBorderRadius, mBorderPaint);
118 | }
119 | }
120 |
121 | @Override
122 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
123 | super.onSizeChanged(w, h, oldw, oldh);
124 | setup();
125 | }
126 |
127 | public int getBorderColor() {
128 | return mBorderColor;
129 | }
130 |
131 | public void setBorderColor(int borderColor) {
132 | if (borderColor == mBorderColor) {
133 | return;
134 | }
135 |
136 | mBorderColor = borderColor;
137 | mBorderPaint.setColor(mBorderColor);
138 | invalidate();
139 | }
140 |
141 | public void setBorderColorResource(int borderColorRes) {
142 | setBorderColor(getContext().getResources().getColor(borderColorRes));
143 | }
144 |
145 | public int getBorderWidth() {
146 | return mBorderWidth;
147 | }
148 |
149 | public void setBorderWidth(int borderWidth) {
150 | if (borderWidth == mBorderWidth) {
151 | return;
152 | }
153 |
154 | mBorderWidth = borderWidth;
155 | setup();
156 | }
157 |
158 | @Override
159 | public void setImageBitmap(Bitmap bm) {
160 | super.setImageBitmap(bm);
161 | mBitmap = bm;
162 | setup();
163 | }
164 |
165 | @Override
166 | public void setImageDrawable(Drawable drawable) {
167 | super.setImageDrawable(drawable);
168 | mBitmap = getBitmapFromDrawable(drawable);
169 | setup();
170 | }
171 |
172 | @Override
173 | public void setImageResource(int resId) {
174 | super.setImageResource(resId);
175 | mBitmap = getBitmapFromDrawable(getDrawable());
176 | setup();
177 | }
178 |
179 | @Override
180 | public void setImageURI(Uri uri) {
181 | super.setImageURI(uri);
182 | mBitmap = getBitmapFromDrawable(getDrawable());
183 | setup();
184 | }
185 |
186 | @Override
187 | public void setColorFilter(ColorFilter cf) {
188 | if (cf == mColorFilter) {
189 | return;
190 | }
191 |
192 | mColorFilter = cf;
193 | mBitmapPaint.setColorFilter(mColorFilter);
194 | invalidate();
195 | }
196 |
197 | private Bitmap getBitmapFromDrawable(Drawable drawable) {
198 | if (drawable == null) {
199 | return null;
200 | }
201 |
202 | if (drawable instanceof BitmapDrawable) {
203 | return ((BitmapDrawable) drawable).getBitmap();
204 | }
205 |
206 | try {
207 | Bitmap bitmap;
208 |
209 | if (drawable instanceof ColorDrawable) {
210 | bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG);
211 | } else {
212 | bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), BITMAP_CONFIG);
213 | }
214 |
215 | Canvas canvas = new Canvas(bitmap);
216 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
217 | drawable.draw(canvas);
218 | return bitmap;
219 | } catch (OutOfMemoryError e) {
220 | return null;
221 | }
222 | }
223 |
224 | private void setup() {
225 | if (!mReady) {
226 | mSetupPending = true;
227 | return;
228 | }
229 |
230 | if (mBitmap == null) {
231 | return;
232 | }
233 |
234 | mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
235 |
236 | mBitmapPaint.setAntiAlias(true);
237 | mBitmapPaint.setShader(mBitmapShader);
238 |
239 | mBorderPaint.setStyle(Paint.Style.STROKE);
240 | mBorderPaint.setAntiAlias(true);
241 | mBorderPaint.setColor(mBorderColor);
242 | mBorderPaint.setStrokeWidth(mBorderWidth);
243 |
244 | mBitmapHeight = mBitmap.getHeight();
245 | mBitmapWidth = mBitmap.getWidth();
246 |
247 | mBorderRect.set(0, 0, getWidth(), getHeight());
248 | mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2);
249 |
250 | mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth);
251 | mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2);
252 |
253 | updateShaderMatrix();
254 | invalidate();
255 | }
256 |
257 | private void updateShaderMatrix() {
258 | float scale;
259 | float dx = 0;
260 | float dy = 0;
261 |
262 | mShaderMatrix.set(null);
263 |
264 | if (mBitmapWidth * mDrawableRect.height() > mDrawableRect.width() * mBitmapHeight) {
265 | scale = mDrawableRect.height() / (float) mBitmapHeight;
266 | dx = (mDrawableRect.width() - mBitmapWidth * scale) * 0.5f;
267 | } else {
268 | scale = mDrawableRect.width() / (float) mBitmapWidth;
269 | dy = (mDrawableRect.height() - mBitmapHeight * scale) * 0.5f;
270 | }
271 |
272 | mShaderMatrix.setScale(scale, scale);
273 | mShaderMatrix.postTranslate((int) (dx + 0.5f) + mBorderWidth, (int) (dy + 0.5f) + mBorderWidth);
274 |
275 | mBitmapShader.setLocalMatrix(mShaderMatrix);
276 | }
277 |
278 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/fragment/MenuTypeFragment.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.fragment;
2 |
3 | import android.graphics.Color;
4 | import android.graphics.drawable.ColorDrawable;
5 | import android.support.v4.widget.SwipeRefreshLayout;
6 | import android.support.v7.widget.LinearLayoutManager;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.util.Log;
9 | import android.view.View;
10 | import android.widget.ImageView;
11 | import android.widget.LinearLayout;
12 | import android.widget.RelativeLayout;
13 | import android.widget.TextView;
14 |
15 | import com.bigkoo.pickerview.TimePickerView;
16 | import com.cocoon.jay.tallybook.R;
17 | import com.cocoon.jay.tallybook.adapter.TallyTypeRankAdapter;
18 | import com.cocoon.jay.tallybook.bean.TallyTypeBean;
19 | import com.cocoon.jay.tallybook.utils.DateUtils;
20 | import com.cocoon.jay.tallybook.utils.FormatUtils;
21 | import com.cocoon.jay.tallybook.utils.PieChartUtil;
22 | import com.cocoon.jay.tallybook.utils.TestDataUtil;
23 | import com.cocoon.jay.tallybook.view.CircleImageView;
24 | import com.github.mikephil.charting.animation.Easing;
25 | import com.github.mikephil.charting.charts.PieChart;
26 | import com.github.mikephil.charting.data.Entry;
27 | import com.github.mikephil.charting.data.PieEntry;
28 | import com.github.mikephil.charting.highlight.Highlight;
29 | import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
30 |
31 | import java.util.ArrayList;
32 | import java.util.Calendar;
33 | import java.util.Date;
34 | import java.util.List;
35 |
36 | import butterknife.BindView;
37 | import butterknife.OnClick;
38 |
39 | /**
40 | * 记账本--类别报表
41 | */
42 | public class MenuTypeFragment extends BaseFragment
43 | implements OnChartValueSelectedListener {
44 |
45 |
46 | @BindView(R.id.chart)
47 | PieChart mChart;
48 | @BindView(R.id.center_title)
49 | TextView centerTitle;
50 | @BindView(R.id.center_money)
51 | TextView centerMoney;
52 | @BindView(R.id.layout_center)
53 | LinearLayout layoutCenter;
54 | @BindView(R.id.center_img)
55 | ImageView centerImg;
56 | @BindView(R.id.data_year)
57 | TextView dataYear;
58 | @BindView(R.id.data_month)
59 | TextView dataMonth;
60 | @BindView(R.id.layout_data)
61 | LinearLayout layoutData;
62 | @BindView(R.id.cash_surplus)
63 | TextView cashSurplus;
64 | @BindView(R.id.cash_compared)
65 | TextView cashCompared;
66 | @BindView(R.id.circle_bg)
67 | CircleImageView circleBg;
68 | @BindView(R.id.circle_img)
69 | ImageView circleImg;
70 | @BindView(R.id.layout_circle)
71 | RelativeLayout layoutCircle;
72 | @BindView(R.id.title)
73 | TextView title;
74 | @BindView(R.id.money)
75 | TextView money;
76 | @BindView(R.id.rank_title)
77 | TextView rankTitle;
78 | @BindView(R.id.layout_other)
79 | RelativeLayout layoutOther;
80 | @BindView(R.id.other_money)
81 | TextView otherMoney;
82 | @BindView(R.id.swipe)
83 | SwipeRefreshLayout swipe;
84 | @BindView(R.id.item_type)
85 | RelativeLayout itemType;
86 | @BindView(R.id.item_other)
87 | RelativeLayout itemOther;
88 | @BindView(R.id.rv_list)
89 | RecyclerView rvList;
90 | @BindView(R.id.layout_typedata)
91 | LinearLayout layoutTypedata;
92 |
93 | private boolean TYPE = true;//默认总收入true
94 | private List tMoneyBeanList;
95 | private int report_type = 0;//饼状图与之相对应的类型
96 | private String type_name;
97 | private String back_color;
98 |
99 | private TallyTypeRankAdapter adapter;
100 | private List list;
101 |
102 |
103 |
104 | @Override
105 | protected int getLayoutId() {
106 | return R.layout.fragment_menu_type;
107 | }
108 |
109 |
110 | @Override
111 | protected void initEventAndData() {
112 |
113 | PieChartUtil.initPieChart(mChart);
114 | mChart.setOnChartValueSelectedListener(this);
115 |
116 | dataYear.setText(DateUtils.getCurYear("yyyy 年"));
117 | dataMonth.setText(DateUtils.date2Str(new Date(), "MM"));
118 | //改变加载显示的颜色
119 | swipe.setColorSchemeColors(getResources().getColor(R.color.text_red), getResources().getColor(R.color.text_red));
120 | //设置向下拉多少出现刷新
121 | swipe.setDistanceToTriggerSync(200);
122 | //设置刷新出现的位置
123 | swipe.setProgressViewEndTarget(false, 200);
124 | swipe.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
125 | @Override
126 | public void onRefresh() {
127 | swipe.setRefreshing(false);
128 | PieChartUtil.setAnimate(mChart);
129 | }
130 | });
131 |
132 |
133 | rvList.setLayoutManager(new LinearLayoutManager(getActivity()));
134 | list = new ArrayList<>();
135 | adapter = new TallyTypeRankAdapter(getActivity(), list);
136 | rvList.setAdapter(adapter);
137 |
138 | setReportData();
139 | }
140 |
141 |
142 |
143 |
144 | private void setReportData() {
145 | TallyTypeBean typeModel = null;
146 | if (TYPE) {
147 | centerTitle.setText("总支出");
148 | centerImg.setImageResource(R.mipmap.tallybook_output);
149 | typeModel = TestDataUtil.getTallyTypeBeanOut();
150 | } else {
151 | centerTitle.setText("总收入");
152 | centerImg.setImageResource(R.mipmap.tallybook_input);
153 | typeModel = TestDataUtil.getTallyTypeBeanIn();
154 | }
155 | if (typeModel == null) {
156 | return;
157 | }
158 |
159 | cashSurplus.setText(typeModel.getSurplus());
160 | cashCompared.setText(typeModel.getScale());
161 | centerMoney.setText(getMoneyStr(typeModel.getTotal()));
162 | tMoneyBeanList = typeModel.getT_money();
163 |
164 | ArrayList entries = new ArrayList();
165 | ArrayList colors = new ArrayList();
166 |
167 | if (tMoneyBeanList != null && tMoneyBeanList.size() > 0) {
168 | layoutTypedata.setVisibility(View.VISIBLE);
169 | for (int i = 0; i < tMoneyBeanList.size(); i++) {
170 | float scale = tMoneyBeanList.get(i).getAffect_money() / typeModel.getTotal();
171 | float value = (scale < 0.06f) ? 0.06f : scale;
172 | entries.add(new PieEntry(value, PieChartUtil.getTypeDrawable(tMoneyBeanList.get(i).getType())));
173 | colors.add(Color.parseColor(tMoneyBeanList.get(i).getBack_color()));
174 | }
175 | setNoteData(0);
176 | } else {//无数据时的显示
177 | layoutTypedata.setVisibility(View.GONE);
178 | entries.add(new PieEntry(1f));
179 | colors.add(0xffAAAAAA);
180 | }
181 |
182 | PieChartUtil.setPieChartData(mChart, entries, colors);
183 | }
184 |
185 | /**
186 | * 点击饼状图上区域后相应的数据设置
187 | * @param index
188 | */
189 | private void setNoteData(int index){
190 | report_type = tMoneyBeanList.get(index).getType();
191 | type_name = tMoneyBeanList.get(index).getTypename();
192 | back_color = tMoneyBeanList.get(index).getBack_color();
193 | if (TYPE) {
194 | money.setText("-"+ getMoneyStr(tMoneyBeanList.get(index).getAffect_money()));
195 | }else {
196 | money.setText("+"+ getMoneyStr(tMoneyBeanList.get(index).getAffect_money()));
197 | }
198 | title.setText(type_name);
199 | rankTitle.setText(type_name + "排行榜");
200 | circleBg.setImageDrawable(new ColorDrawable(Color.parseColor(back_color)));
201 | circleImg.setImageDrawable(PieChartUtil.getTypeDrawable(report_type));
202 |
203 | list.clear();
204 | for(int i = 0; i < 3; i++){
205 | list.add(type_name + i);
206 | }
207 | adapter.setmDatas(list);
208 | adapter.notifyDataSetChanged();
209 | }
210 |
211 |
212 |
213 | @Override
214 | public void onValueSelected(Entry e, Highlight h) {
215 | if (e == null)
216 | return;
217 | int entryIndex = (int) h.getX();
218 | PieChartUtil.setRotationAngle(mChart, entryIndex);
219 | setNoteData(entryIndex);
220 | }
221 |
222 |
223 | @Override
224 | public void onNothingSelected() {
225 | Log.i("PieChart", "nothing selected");
226 | }
227 |
228 |
229 | @OnClick({R.id.layout_center, R.id.layout_data, R.id.item_type, R.id.item_other})
230 | public void onViewClicked(View view) {
231 | switch (view.getId()) {
232 | case R.id.layout_center:
233 |
234 | if(TYPE){
235 | TYPE = false;
236 | }else{
237 | TYPE = true;
238 | }
239 | setReportData();
240 |
241 | break;
242 | case R.id.layout_data:
243 | //时间选择器
244 | new TimePickerView.Builder(getActivity(), new TimePickerView.OnTimeSelectListener() {
245 | @Override
246 | public void onTimeSelect(Date date, View v) {//选中事件回调
247 | dataYear.setText(DateUtils.date2Str(date, "yyyy 年"));
248 | dataMonth.setText(DateUtils.date2Str(date, "MM"));
249 |
250 | PieChartUtil.setAnimate(mChart);
251 | }
252 | })
253 | .setRangDate(null, Calendar.getInstance())
254 | .setType(new boolean[]{true, true, false, false, false, false})
255 | .build()
256 | .show();
257 | break;
258 | case R.id.item_type:
259 | break;
260 | case R.id.item_other:
261 | break;
262 | }
263 | }
264 |
265 |
266 | private String getMoneyStr(double money) {
267 | return FormatUtils.MyDecimalFormat("##,###,###.##", money);
268 | }
269 |
270 | }
271 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_menu_type.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
16 |
17 |
22 |
23 |
24 |
29 |
30 |
31 |
36 |
37 |
42 |
43 |
51 |
52 |
53 |
60 |
61 |
68 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
94 |
95 |
102 |
103 |
104 |
110 |
117 |
124 |
125 |
126 |
127 |
137 |
138 |
150 |
151 |
152 |
153 |
157 |
158 |
169 |
170 |
171 |
175 |
176 |
177 |
178 |
187 |
188 |
189 |
195 |
201 |
207 |
208 |
209 |
210 |
219 |
220 |
227 |
228 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/activity/TallyBookNoteActivity.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.activity;
2 |
3 | import android.support.v4.view.ViewPager;
4 | import android.support.v7.widget.GridLayoutManager;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.ImageView;
10 | import android.widget.LinearLayout;
11 | import android.widget.TextView;
12 | import android.widget.Toast;
13 |
14 | import com.bigkoo.pickerview.OptionsPickerView;
15 | import com.bigkoo.pickerview.TimePickerView;
16 | import com.cocoon.jay.tallybook.R;
17 | import com.cocoon.jay.tallybook.adapter.MyPagerAdapter;
18 | import com.cocoon.jay.tallybook.adapter.TallyBookNoteAdapter;
19 | import com.cocoon.jay.tallybook.bean.TallyNoteBean;
20 | import com.cocoon.jay.tallybook.utils.DateUtils;
21 | import com.cocoon.jay.tallybook.utils.TestDataUtil;
22 |
23 | import java.text.SimpleDateFormat;
24 | import java.util.ArrayList;
25 | import java.util.Date;
26 | import java.util.List;
27 |
28 | import butterknife.BindView;
29 | import butterknife.OnClick;
30 |
31 | /**
32 | * 记账本 --- 记一笔
33 | */
34 | public class TallyBookNoteActivity extends BaseActivity {
35 |
36 | @BindView(R.id.tb_note_income)
37 | TextView incomeTv;
38 | @BindView(R.id.tb_note_outcome)
39 | TextView outcomeTv;
40 | @BindView(R.id.tb_note_remark)
41 | ImageView remarkTv;
42 | @BindView(R.id.tb_note_money)
43 | TextView moneyTv;
44 | @BindView(R.id.tb_note_date)
45 | TextView dateTv;
46 | @BindView(R.id.tb_note_cash)
47 | TextView cashTv;
48 | @BindView(R.id.viewpager_item)
49 | ViewPager viewpagerItem;
50 | @BindView(R.id.layout_icon)
51 | LinearLayout layoutIcon;
52 |
53 | public String type = "1";//1支出2收入
54 | //计算器
55 | private boolean isDot;
56 | private String num = "0";
57 | private String dotNum = ".00";
58 | private final int MAX_NUM = 9999999;
59 | private final int DOT_NUM = 2;
60 | private int count = 0;
61 | //选择器
62 | private OptionsPickerView pvCustomOptions;
63 | private List cardItem;
64 | //viewpager数据
65 | private int page ;
66 | private boolean isTotalPage;
67 | private int sortPage = -1;
68 | private List mDatas;
69 | private List tempList;
70 | //记录上一次点击后的imageview
71 | public TallyNoteBean.SortlistBean lastBean;
72 | public ImageView lastImg;
73 |
74 |
75 |
76 | @Override
77 | protected int getLayout() {
78 | return R.layout.activity_tallybook_note;
79 | }
80 |
81 | @Override
82 | protected void initEventAndData() {
83 |
84 | dateTv.setText(DateUtils.getCurDateStr("yyyy-MM-dd"));
85 | setTitleStatus();
86 |
87 | }
88 |
89 |
90 |
91 | /**
92 | * 设置状态
93 | */
94 | private void setTitleStatus() {
95 |
96 | TallyNoteBean tallyNoteBean = null;
97 | if (type.equals("1")){
98 | outcomeTv.setSelected(true);
99 | incomeTv.setSelected(false);
100 | tallyNoteBean = TestDataUtil.getTallyNoteBeanOut();
101 | }
102 | if (type.equals("2")){
103 | incomeTv.setSelected(true);
104 | outcomeTv.setSelected(false);
105 | tallyNoteBean = TestDataUtil.getTallyNoteBeanIn();
106 | }
107 |
108 | mDatas = tallyNoteBean.getSortlist();
109 |
110 | lastBean = mDatas.get(0);
111 | lastImg = new ImageView(this);
112 |
113 | cardItem = new ArrayList<>();
114 | for (int i = 0; i < tallyNoteBean.getPayinfo().size(); i++) {
115 | cardItem.add(tallyNoteBean.getPayinfo().get(i).getPay_name());
116 | }
117 |
118 | initViewPager();
119 | }
120 |
121 |
122 |
123 |
124 | private void initViewPager() {
125 | LayoutInflater inflater = this.getLayoutInflater();// 获得一个视图管理器LayoutInflater
126 | viewList = new ArrayList<>();// 创建一个View的集合对象
127 | if (mDatas.size() % 10 == 0)
128 | isTotalPage = true;
129 | page = (int) Math.ceil(mDatas.size() * 1.0 / 10);
130 | for (int i = 0; i < page; i++) {
131 | tempList = new ArrayList<>();
132 | View view = inflater.inflate(R.layout.pager_item_tb_type, null);
133 | RecyclerView recycle = (RecyclerView) view.findViewById(R.id.pager_type_recycle);
134 | if (i != page - 1 || (i == page -1 && isTotalPage)){
135 | for (int j = 0; j < 10; j++) {
136 | if (i != 0 ){
137 | tempList.add(mDatas.get(i * 10 + j));
138 | }else {
139 | tempList.add(mDatas.get(i + j));
140 | }
141 | }
142 | }else {
143 | for (int j = 0; j < mDatas.size() % 10; j++) {
144 | tempList.add(mDatas.get(i * 10 + j));
145 | }
146 | }
147 |
148 | TallyBookNoteAdapter mAdapter = new TallyBookNoteAdapter(this, tempList);
149 | GridLayoutManager layoutManager = new GridLayoutManager(this, 5);
150 | recycle.setLayoutManager(layoutManager);
151 | recycle.setAdapter(mAdapter);
152 | viewList.add(view);
153 | }
154 |
155 | viewpagerItem.setAdapter(new MyPagerAdapter(viewList));
156 | viewpagerItem.setOverScrollMode(View.OVER_SCROLL_NEVER);
157 | viewpagerItem.setOffscreenPageLimit(1);//预加载数据页
158 | viewpagerItem.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
159 | @Override
160 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
161 |
162 | }
163 |
164 | @Override
165 | public void onPageSelected(int position) {
166 | try {
167 | for (int i = 0; i < viewList.size(); i++) {
168 | icons[i].setImageResource(R.drawable.icon_banner_point2);
169 | }
170 | icons[position].setImageResource(R.drawable.icon_banner_point1);
171 | }catch (Exception e){
172 | e.printStackTrace();
173 | }
174 | }
175 |
176 | @Override
177 | public void onPageScrollStateChanged(int state) {
178 |
179 | }
180 | });
181 | initIcon();
182 | }
183 | private List viewList;
184 | private ImageView[] icons;
185 | private void initIcon() {
186 | icons = new ImageView[viewList.size()];
187 | layoutIcon.removeAllViews();
188 | for (int i = 0; i < icons.length; i++) {
189 | icons[i] = new ImageView(this);
190 | icons[i].setLayoutParams(new ViewGroup.LayoutParams(
191 | ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
192 | icons[i].setImageResource(R.drawable.icon_banner_point2);
193 | if(viewpagerItem.getCurrentItem() == i){
194 | icons[i].setImageResource(R.drawable.icon_banner_point1);
195 | }
196 | icons[i].setPadding(5, 0, 5, 0);
197 | icons[i].setAdjustViewBounds(true);
198 | layoutIcon.addView(icons[i]);
199 | }
200 | if (sortPage != -1)
201 | viewpagerItem.setCurrentItem(sortPage);
202 | }
203 |
204 |
205 |
206 |
207 | @OnClick({R.id.tb_note_income, R.id.tb_note_outcome, R.id.tb_note_cash, R.id.tb_note_date,
208 | R.id.tb_note_remark, R.id.tb_calc_num_done, R.id.tb_calc_num_del, R.id.tb_calc_num_1,
209 | R.id.tb_calc_num_2, R.id.tb_calc_num_3, R.id.tb_calc_num_4, R.id.tb_calc_num_5,
210 | R.id.tb_calc_num_6, R.id.tb_calc_num_7, R.id.tb_calc_num_8, R.id.tb_calc_num_9,
211 | R.id.tb_calc_num_0, R.id.tb_calc_num_dot, R.id.tb_note_clear, R.id.back_btn})
212 | protected void onClick(View view){
213 | switch (view.getId()){
214 | case R.id.back_btn:
215 | finish();
216 | break;
217 | case R.id.tb_note_income://收入
218 | type = "2";
219 | setTitleStatus();
220 | break;
221 | case R.id.tb_note_outcome://支出
222 | type = "1";
223 | setTitleStatus();
224 | break;
225 | case R.id.tb_note_cash://现金
226 | pvCustomOptions = new OptionsPickerView.Builder(this, new OptionsPickerView.OnOptionsSelectListener() {
227 | @Override
228 | public void onOptionsSelect(int options1, int option2, int options3, View v) {
229 | cashTv.setText(cardItem.get(options1));
230 | }
231 | })
232 | .build();
233 | pvCustomOptions.setPicker(cardItem);
234 | pvCustomOptions.show();
235 | break;
236 | case R.id.tb_note_date://日期
237 | final TimePickerView startTimePicker = new TimePickerView.Builder(this, new TimePickerView.OnTimeSelectListener() {
238 | @Override
239 | public void onTimeSelect(Date date, View v) {//选中事件回调
240 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
241 | dateTv.setText(sdf.format(date));
242 | }
243 | })
244 | .setRange(2017,2050)
245 | .setType(new boolean[]{true,true,true,false,false,false})
246 | .build();
247 | startTimePicker.show();
248 | break;
249 | case R.id.tb_note_remark://备注
250 | Toast.makeText(mContext, "点击备注", Toast.LENGTH_SHORT).show();
251 | break;
252 | case R.id.tb_calc_num_done://确定
253 | Toast.makeText(mContext, "点击确定", Toast.LENGTH_SHORT).show();
254 | break;
255 | case R.id.tb_calc_num_1:
256 | calcMoney(1);
257 | break;
258 | case R.id.tb_calc_num_2:
259 | calcMoney(2);
260 | break;
261 | case R.id.tb_calc_num_3:
262 | calcMoney(3);
263 | break;
264 | case R.id.tb_calc_num_4:
265 | calcMoney(4);
266 | break;
267 | case R.id.tb_calc_num_5:
268 | calcMoney(5);
269 | break;
270 | case R.id.tb_calc_num_6:
271 | calcMoney(6);
272 | break;
273 | case R.id.tb_calc_num_7:
274 | calcMoney(7);
275 | break;
276 | case R.id.tb_calc_num_8:
277 | calcMoney(8);
278 | break;
279 | case R.id.tb_calc_num_9:
280 | calcMoney(9);
281 | break;
282 | case R.id.tb_calc_num_0:
283 | calcMoney(0);
284 | break;
285 | case R.id.tb_calc_num_dot:
286 | if (dotNum.equals(".00")){
287 | isDot = true;
288 | dotNum = ".";
289 | }
290 | moneyTv.setText(num + dotNum);
291 | break;
292 | case R.id.tb_note_clear://清空
293 | num = "0";
294 | count = 0;
295 | dotNum = ".00";
296 | isDot = false;
297 | moneyTv.setText("0.00");
298 | break;
299 | case R.id.tb_calc_num_del://删除
300 | if (isDot){
301 | if (count > 0){
302 | dotNum = dotNum.substring(0, dotNum.length() - 1);
303 | count--;
304 | }
305 | if (count == 0){
306 | isDot = false;
307 | dotNum = ".00";
308 | }
309 | moneyTv.setText(num + dotNum);
310 | }else {
311 | if (num.length() > 0)
312 | num = num.substring(0, num.length() - 1);
313 | if (num.length() == 0)
314 | num = "0";
315 | moneyTv.setText(num + dotNum);
316 | }
317 | break;
318 | }
319 | }
320 |
321 |
322 |
323 |
324 |
325 | private void calcMoney(int money) {
326 | if (num.equals("0") && money == 0)
327 | return;
328 | if (isDot) {
329 | if (count < DOT_NUM) {
330 | count++;
331 | dotNum += money;
332 | moneyTv.setText(num + dotNum);
333 | }
334 | }else if (Integer.parseInt(num) < MAX_NUM) {
335 | if (num.equals("0"))
336 | num = "";
337 | num += money;
338 | moneyTv.setText(num + dotNum);
339 | }
340 | }
341 |
342 | }
343 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cocoon/jay/tallybook/utils/PieChartUtil.java:
--------------------------------------------------------------------------------
1 | package com.cocoon.jay.tallybook.utils;
2 |
3 | import android.graphics.Color;
4 | import android.graphics.drawable.Drawable;
5 | import android.util.Log;
6 |
7 | import com.cocoon.jay.tallybook.MyApplication;
8 | import com.cocoon.jay.tallybook.R;
9 | import com.github.mikephil.charting.animation.Easing;
10 | import com.github.mikephil.charting.charts.PieChart;
11 | import com.github.mikephil.charting.components.Legend;
12 | import com.github.mikephil.charting.data.PieData;
13 | import com.github.mikephil.charting.data.PieDataSet;
14 | import com.github.mikephil.charting.data.PieEntry;
15 | import com.github.mikephil.charting.formatter.PercentFormatter;
16 | import com.github.mikephil.charting.utils.MPPointF;
17 |
18 | import java.util.ArrayList;
19 |
20 | /**
21 | * 记账本饼状图
22 | */
23 |
24 | public class PieChartUtil {
25 |
26 | /**
27 | * 初始化饼状图
28 | * @param mChart
29 | */
30 | public static void initPieChart(PieChart mChart){
31 | mChart.setUsePercentValues(true);
32 | mChart.getDescription().setEnabled(false);
33 | mChart.setExtraOffsets(5, 10, 5, 5);
34 | mChart.setDragDecelerationFrictionCoef(0.95f);
35 | mChart.setDrawHoleEnabled(true);
36 | mChart.setHoleColor(Color.WHITE);
37 | mChart.setTransparentCircleColor(Color.WHITE);
38 | mChart.setTransparentCircleAlpha(110);
39 | mChart.setHoleRadius(58f);
40 | mChart.setTransparentCircleRadius(61f);
41 | mChart.setDrawCenterText(true);
42 | // mChart.setRotationAngle(0);
43 | // enable rotation of the chart by touch
44 | mChart.setRotationEnabled(false);
45 | mChart.setHighlightPerTapEnabled(true);
46 | // add a selection listener
47 | // mChart.spin(2000, 0, 360);
48 | Legend l = mChart.getLegend();
49 | l.setEnabled(false);
50 | }
51 |
52 |
53 |
54 |
55 |
56 | /**
57 | * 设置饼状图数据
58 | * @param mChart
59 | * @param entries
60 | * @param colors
61 | */
62 | public static void setPieChartData(PieChart mChart, ArrayList entries, ArrayList colors){
63 |
64 | PieDataSet dataSet = new PieDataSet(entries, "Election Results");
65 |
66 | dataSet.setDrawIcons(true);
67 | dataSet.setSliceSpace(3f);
68 | dataSet.setIconsOffset(new MPPointF(0, 1));
69 | dataSet.setSelectionShift(5f);
70 |
71 | dataSet.setColors(colors);
72 | //dataSet.setSelectionShift(0f);
73 | PieData data = new PieData(dataSet);
74 | data.setValueFormatter(new PercentFormatter());
75 | data.setValueTextSize(11f);
76 | data.setValueTextColor(Color.TRANSPARENT);
77 | // data.setValueTypeface(mTfLight);
78 | mChart.setData(data);
79 | // undo all highlights
80 | mChart.highlightValues(null);
81 |
82 |
83 | setStartAngle(mChart);
84 | setAnimate(mChart);
85 | }
86 |
87 |
88 |
89 | /**
90 | * 设置初始角度
91 | * @param mChart
92 | */
93 | public static void setStartAngle(PieChart mChart){
94 | //--------------设置初始角度----------------------
95 | float[] mDrawAngles = mChart.getDrawAngles();
96 | float offset = mDrawAngles[0] / 2;
97 | mChart.setRotationAngle(90 - offset);
98 | }
99 |
100 |
101 |
102 | /**
103 | * 设置初始旋转动画
104 | * @param mChart
105 | */
106 | public static void setAnimate(PieChart mChart){
107 | //--------------设置动画----------------------
108 | mChart.animateY(1000, Easing.EasingOption.EaseInOutQuad);
109 | mChart.invalidate();
110 | }
111 |
112 |
113 |
114 |
115 | /**
116 | * 设置点击相应区域旋转角度
117 | * @param mChart
118 | * @param entryIndex
119 | */
120 | public static void setRotationAngle(PieChart mChart, int entryIndex){
121 |
122 | float[] mDrawAngles = mChart.getDrawAngles();
123 |
124 | // float offset = mDrawAngles[entryIndex] / 2;
125 | // Log.e("TAG",
126 | // "offset=============" + offset);
127 | Log.e("TAG",
128 | "rotationAngle==========" + mChart.getRotationAngle());
129 |
130 | //--------------初始角度----------------------
131 | float inAngle = 90 - mDrawAngles[0] / 2;
132 |
133 | switch (entryIndex){
134 | case 0:
135 | mChart.setRotationAngle(inAngle);
136 | break;
137 | case 1:
138 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] / 2));
139 | break;
140 | case 2:
141 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] / 2));
142 | break;
143 | case 3:
144 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] + mDrawAngles[3] / 2));
145 | break;
146 | case 4:
147 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] + mDrawAngles[3] + mDrawAngles[4] / 2));
148 | break;
149 | case 5:
150 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] + mDrawAngles[3] + mDrawAngles[4] + mDrawAngles[5] / 2));
151 | break;
152 | case 6:
153 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] + mDrawAngles[3] + mDrawAngles[4] + mDrawAngles[5] + mDrawAngles[6] / 2));
154 | break;
155 | case 7:
156 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] + mDrawAngles[3] + mDrawAngles[4] + mDrawAngles[5] + mDrawAngles[6] + mDrawAngles[7] / 2));
157 | break;
158 | case 8:
159 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] + mDrawAngles[3] + mDrawAngles[4] + mDrawAngles[5] + mDrawAngles[6] + mDrawAngles[7] + mDrawAngles[8] / 2));
160 | break;
161 | case 9:
162 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] + mDrawAngles[3] + mDrawAngles[4] + mDrawAngles[5] + mDrawAngles[6] + mDrawAngles[7] + mDrawAngles[8] + mDrawAngles[9] / 2));
163 | break;
164 | case 10:
165 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] + mDrawAngles[3] + mDrawAngles[4] + mDrawAngles[5] + mDrawAngles[6] + mDrawAngles[7] + mDrawAngles[8] + mDrawAngles[9] + mDrawAngles[10] / 2));
166 | break;
167 | case 11:
168 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] + mDrawAngles[3] + mDrawAngles[4] + mDrawAngles[5] + mDrawAngles[6] + mDrawAngles[7] + mDrawAngles[8] + mDrawAngles[9] + mDrawAngles[10] + mDrawAngles[11] / 2));
169 | break;
170 | case 12:
171 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] + mDrawAngles[3] + mDrawAngles[4] + mDrawAngles[5] + mDrawAngles[6] + mDrawAngles[7] + mDrawAngles[8] + mDrawAngles[9] + mDrawAngles[10] + mDrawAngles[11] + mDrawAngles[12] / 2));
172 | break;
173 | case 13:
174 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] + mDrawAngles[3] + mDrawAngles[4] + mDrawAngles[5] + mDrawAngles[6] + mDrawAngles[7] + mDrawAngles[8] + mDrawAngles[9] + mDrawAngles[10] + mDrawAngles[11] + mDrawAngles[12] + mDrawAngles[13] / 2));
175 | break;
176 | case 14:
177 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] + mDrawAngles[3] + mDrawAngles[4] + mDrawAngles[5] + mDrawAngles[6] + mDrawAngles[7] + mDrawAngles[8] + mDrawAngles[9] + mDrawAngles[10] + mDrawAngles[11] + mDrawAngles[12] + mDrawAngles[13] + mDrawAngles[14] / 2));
178 | break;
179 | case 15:
180 | mChart.setRotationAngle(inAngle - (mDrawAngles[0] / 2 + mDrawAngles[1] + mDrawAngles[2] + mDrawAngles[3] + mDrawAngles[4] + mDrawAngles[5] + mDrawAngles[6] + mDrawAngles[7] + mDrawAngles[8] + mDrawAngles[9] + mDrawAngles[10] + mDrawAngles[11] + mDrawAngles[12] + mDrawAngles[13] + mDrawAngles[14] + mDrawAngles[15] / 2));
181 | break;
182 | default:
183 | break;
184 | }
185 |
186 | mChart.invalidate();
187 | }
188 |
189 |
190 | /**
191 | * 根据服务器返回的type设置与之相对应的本地图片
192 | * @param type
193 | * @return
194 | */
195 | public static Drawable getTypeDrawable(int type){
196 | Drawable drawable = null;
197 | switch (type){
198 | case 18: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_shouxufei);break;
199 | case 30: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_changhuanfeiyong);break;
200 | case 241: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_shangchengxiaofei);break;
201 | case 235: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_weiyuejin);break;
202 | //收入
203 | case 94: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_fanxian);break;
204 | case 95: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_fanxian);break;
205 | case 246:drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_yongjinjiangli);break;
206 | case 78: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_ewaishouyi);break;
207 | case 98: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_zijinbuchang);break;
208 | case 28: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_lixi);break;
209 | //支出:301偿还费用 302手续费 303商城消费 304违约金 305住房 306办公 307餐饮 308医疗 309通讯 310运动
210 | //311娱乐 312居家 313宠物 314数码 315捐赠 316零食 317孩子 318长辈 319 礼物
211 | //320学习 321水果 322美容 323维修 324旅行 325交通 326饮料 327礼金
212 | case 301: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_changhuanfeiyong);break;
213 | case 302: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_shouxufei);break;
214 | case 303: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_shangchengxiaofei);break;
215 | case 304: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_weiyuejin);break;
216 | case 305: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_zhufang);break;
217 | case 306: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_bangong);break;
218 | case 307: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_canyin);break;
219 | case 308: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_yiliao);break;
220 | case 309: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_tongxun);break;
221 | case 310: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_yundong);break;
222 | case 311: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_yule);break;
223 | case 312: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_jujia);break;
224 | case 313: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_chongwu);break;
225 | case 314: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_shuma);break;
226 | case 315: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_juanzeng);break;
227 | case 316: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_lingshi);break;
228 | case 317: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_haizi);break;
229 | case 318: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_zhangbei);break;
230 | case 319: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_liwu);break;
231 | case 320: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_xuexi);break;
232 | case 321: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_shuiguo);break;
233 | case 322: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_meirong);break;
234 | case 323: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_weixiu);break;
235 | case 324: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_lvxing);break;
236 | case 325: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_jiaotong);break;
237 | case 326: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_jiushuiyinliao);break;
238 | case 327: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_lijin);break;
239 | // 收入 328礼金 329加息 330佣金奖励 331额外收益 332资金补偿 333利息 334返现 335兼职 336其他
240 | case 328: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_lijin);break;
241 | case 329: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_jiaxi);break;
242 | case 330: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_yongjinjiangli);break;
243 | case 331: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_ewaishouyi);break;
244 | case 332: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_zijinbuchang);break;
245 | case 333: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_lixi);break;
246 | case 334: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_fanxian);break;
247 | case 335: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_jianzhi);break;
248 | case 336: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_qita);break;
249 | default: drawable = MyApplication.application.getResources().getDrawable(R.mipmap.type_qita);break;
250 | }
251 | return drawable;
252 | }
253 |
254 |
255 | }
256 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_tallybook_note.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
17 |
24 |
37 |
38 |
42 |
50 |
59 |
60 |
61 |
62 |
69 |
70 |
75 |
76 |
82 |
83 |
89 |
90 |
91 |
92 |
93 |
98 |
107 |
116 |
117 |
118 |
128 |
144 |
156 |
161 |
172 |
173 |
174 |
175 |
176 |
181 |
182 |
188 |
193 |
203 |
206 |
216 |
219 |
229 |
232 |
242 |
243 |
247 |
252 |
257 |
267 |
271 |
281 |
282 |
285 |
290 |
300 |
304 |
314 |
315 |
318 |
323 |
333 |
337 |
347 |
348 |
351 |
356 |
366 |
367 |
368 |
372 |
373 |
377 |
382 |
387 |
393 |
394 |
404 |
405 |
406 |
407 |
408 |
--------------------------------------------------------------------------------