├── .gitignore
├── LICENSE
├── README.md
├── README_old.md
├── app
├── .gitignore
├── build.gradle
├── gradle.properties
├── libs
│ ├── lite-orm-1.5.1.jar
│ └── umeng-update-v2.6.0.1.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── me
│ │ └── drakeet
│ │ └── meiniu
│ │ └── ApplicationTest.java
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ ├── miaopai.css
│ ├── vmovier.css
│ └── weibo.css
│ ├── java
│ └── me
│ │ └── drakeet
│ │ └── meiniu
│ │ ├── ApiKey.java
│ │ ├── App.java
│ │ ├── Drakeet.java
│ │ ├── DrakeetFactory.java
│ │ ├── DrakeetRetrofit.java
│ │ ├── LoveBus.java
│ │ ├── data
│ │ ├── BaseData.java
│ │ ├── DDaniuData.java
│ │ ├── DaniuData.java
│ │ ├── MeizhiData.java
│ │ └── 休息视频Data.java
│ │ ├── event
│ │ ├── OnKeyBackClickEvent.java
│ │ └── OnMeizhiTouchListener.java
│ │ ├── model
│ │ ├── DDaniu.java
│ │ ├── Daniu.java
│ │ ├── Meizhi.java
│ │ └── Soul.java
│ │ ├── other
│ │ └── ActiveAndroidStrategy.java
│ │ ├── service
│ │ ├── AlarmReceiver.java
│ │ └── KeepAlarmLiveReceiver.java
│ │ ├── ui
│ │ ├── AboutActivity.java
│ │ ├── DaniuActivity.java
│ │ ├── DaniuFragment.java
│ │ ├── MainActivity.java
│ │ ├── PictureActivity.java
│ │ ├── WebActivity.java
│ │ ├── adapter
│ │ │ ├── AnimRecyclerViewAdapter.java
│ │ │ ├── DaniuListAdapter.java
│ │ │ ├── DaniuPagerAdapter.java
│ │ │ └── MeizhiListAdapter.java
│ │ └── base
│ │ │ ├── BaseActivity.java
│ │ │ ├── SwipeRefreshBaseActivity.java
│ │ │ ├── SwipeRefreshFragment.java
│ │ │ └── ToolbarActivity.java
│ │ ├── util
│ │ ├── AlarmManagerUtils.java
│ │ ├── AndroidUtils.java
│ │ ├── DateUtils.java
│ │ ├── HeadsUpUtils.java
│ │ ├── HttpUtils.java
│ │ ├── LoveStringUtils.java
│ │ ├── Once.java
│ │ ├── RxMeizhi.java
│ │ ├── ShareUtils.java
│ │ ├── StringStyleUtils.java
│ │ ├── TaskUtils.java
│ │ └── ToastUtils.java
│ │ └── widget
│ │ ├── GoodAppBarLayout.java
│ │ ├── LoveVideoView.java
│ │ ├── MultiSwipeRefreshLayout.java
│ │ ├── RatioImageView.java
│ │ ├── ScrollAwareFABBehavior.java
│ │ └── VideoImageView.java
│ └── res
│ ├── anim
│ └── slide_in_right.xml
│ ├── drawable-hdpi
│ ├── umeng_update_close_bg_normal.png
│ └── umeng_update_close_bg_tap.png
│ ├── drawable
│ ├── abc_menu_dropdown_panel_holo_light.9.png
│ ├── bg_card.9.png
│ ├── bg_card_nopic.xml
│ ├── bg_material_button_lite_blue.xml
│ ├── tb_munion_icon.xml
│ ├── tb_munion_item_selector.xml
│ ├── umeng_common_gradient_orange.xml
│ ├── umeng_common_gradient_red.xml
│ ├── umeng_update_button_cancel_bg_focused.xml
│ ├── umeng_update_button_cancel_bg_normal.xml
│ ├── umeng_update_button_cancel_bg_selector.xml
│ ├── umeng_update_button_cancel_bg_tap.xml
│ ├── umeng_update_button_close_bg_selector.xml
│ ├── umeng_update_button_ok_bg_focused.xml
│ ├── umeng_update_button_ok_bg_normal.xml
│ ├── umeng_update_dialog_bg.xml
│ └── umeng_update_title_bg.xml
│ ├── layout-v9
│ └── umeng_common_download_notification.xml
│ ├── layout
│ ├── activity_about.xml
│ ├── activity_daniu.xml
│ ├── activity_main.xml
│ ├── activity_picture.xml
│ ├── activity_web.xml
│ ├── fragment_daniu.xml
│ ├── item_daniu.xml
│ ├── item_meizhi.xml
│ ├── tb_munion_aditem.xml
│ ├── tb_munion_adview.xml
│ ├── umeng_common_download_notification.xml
│ ├── umeng_update_dialog.xml
│ ├── view_empty.xml
│ ├── view_toolbar.xml
│ ├── view_toolbar_with_indicator.xml
│ ├── view_toolbar_with_title_view.xml
│ └── view_video.xml
│ ├── menu
│ ├── menu_about.xml
│ ├── menu_daniu.xml
│ ├── menu_main.xml
│ ├── menu_picture.xml
│ └── menu_web.xml
│ ├── mipmap-xhdpi
│ ├── avatar_daimajia.png
│ ├── avatar_drakeet.png
│ ├── avatar_zddhub.png
│ ├── emoji_see_no_evil.png
│ ├── heheh.png
│ ├── ic_daniu_io.png
│ ├── ic_female.png
│ ├── ic_github.png
│ ├── ic_play.png
│ ├── ic_save_white_24dp.png
│ └── ic_share_white_24dp.png
│ ├── values-v21
│ └── dimens.xml
│ ├── values-zh
│ ├── umeng_common_strings.xml
│ └── umeng_update_string.xml
│ └── values
│ ├── android_material_design_colours.xml
│ ├── attrs.xml
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ ├── styles.xml
│ ├── tb_munion_strings.xml
│ ├── umeng_common_strings.xml
│ └── umeng_update_string.xml
├── build.gradle
├── config.gradle
├── daniu.mp4
├── download.jpg
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── libraries
├── headsupcompat
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── administrator
│ │ │ └── ll
│ │ │ └── ApplicationTest.java
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── mingle
│ │ │ └── headsUp
│ │ │ ├── Distance.java
│ │ │ ├── FloatView.java
│ │ │ ├── HeadsUp.java
│ │ │ ├── HeadsUpManager.java
│ │ │ └── widget
│ │ │ └── CircleImageView.java
│ │ └── res
│ │ ├── drawable-hdpi
│ │ ├── bg_transparency_to_grey.xml
│ │ ├── notification_bg.xml
│ │ ├── notification_bg2.9.png
│ │ └── notification_bg3.9.png
│ │ ├── layout
│ │ ├── notification.xml
│ │ └── notification_bg.xml
│ │ ├── menu
│ │ └── my.xml
│ │ └── values
│ │ ├── circle_imageview_attrs.xml
│ │ ├── defualt.xml
│ │ ├── dimens.xml
│ │ └── strings.xml
└── smooth-app-bar-layout
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── me
│ │ └── henrytao
│ │ └── smoothappbarlayout
│ │ ├── BaseBehavior.java
│ │ ├── OnOffsetSyncedListener.java
│ │ ├── PagerAdapter.java
│ │ ├── ScrollFlag.java
│ │ ├── ScrollState.java
│ │ ├── SmoothAppBarLayout.java
│ │ ├── SmoothCollapsingToolbarLayout.java
│ │ └── widget
│ │ └── NestedScrollView.java
│ └── res
│ └── values
│ ├── attrs_smooth_app_bar_layout.xml
│ ├── attrs_smooth_collapsing_toolbar_layout.xml
│ ├── ids.xml
│ └── strings.xml
├── screenshots
├── daniu.gif
├── s0.jpg
├── s1.jpg
├── s2.jpg
├── s3.jpg
├── s4.jpg
└── s5.jpg
├── settings.gradle
└── sketch
└── ic_meizhi.sketch
/.gitignore:
--------------------------------------------------------------------------------
1 | # built application files
2 | *.ap_
3 |
4 | # files for the dex VM
5 | *.dex
6 |
7 | # Java class files
8 | *.class
9 |
10 | # generated files
11 | bin/
12 | gen/
13 |
14 | # Local configuration file (sdk path, etc)
15 | local.properties
16 |
17 | # Proguard folder generated by Eclipse
18 | proguard/
19 |
20 | # Ignore gradle files
21 | .gradle/
22 | build/
23 |
24 | # Eclipse project files
25 | .classpath
26 | .project
27 | .settings/
28 |
29 | # Intellij project files
30 | *.iml
31 | *.ipr
32 | *.iws
33 | .idea/
34 |
35 | # Mac system files
36 | .DS_Store
37 |
38 | *.keystore
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #美妞&[daniu.io](http://daniu.io/)
2 |
3 |
4 |
5 | **每天自动更新一张精选美妞图、一个小视频、一系列精选程序猿干货, 以 Go 和 Swift 为主,让你站在巨人的肩上,看的更远。数据来自大牛俱乐部网站:http://daniu.io**
6 |
7 | 10月11日无聊, fork 了一份 drakeet 的妹纸应用,替换数据源后,便成了现在的美妞应用, 为了保证代码的可读性,更改了部分类名。
8 |
9 | ### Demo
10 |
11 | 
12 |
13 | ### 截图
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | ### 下载
22 |
23 | 点击[这里](http://fir.im/dfa7)或扫描以下二维码下载应用:
24 |
25 |
26 |
27 |
28 | ### 特别感谢
29 |
30 | [drakeet](https://github.com/drakeet)
31 |
32 | ### LICENSE
33 |
34 | GPL v3 协议
35 |
--------------------------------------------------------------------------------
/README_old.md:
--------------------------------------------------------------------------------
1 | #源代码在 GPL v3 协议下发布, 使用前, 请确保你了解这个协议!
2 |
3 | [LICENSE](/LICENSE)
4 |
5 | 如有特殊协议方面的请求, 可以与我沟通: drakeet.me@gmail.com
6 |
7 | ------
8 |
9 |
10 |
11 | **每天自动更新一张精选妹纸图、一个小视频、一系列精选程序猿干货(周末不更新)。数据来自代码家的干货网站:http://gank.io**
12 |
13 | 8月9号开始重构,开发2.0,18号完成,至今可谓完成了个完整的干货客户端,不仅仅是看妹纸了,开源又好用,绝对是程序猿必备良心项目… 做得匆忙,但代码自认为还是写得很不错的,用了很多注解和
14 | lambda 表达式,用了 RxJava & Retrofit。UI 交互上,细节和动画效果也不少... 如果喜欢,请帮忙给个 Google Play 好评或者分享给朋友们~谢谢~~
15 |
16 | 相关文章:http://drakeet.me/2015-08-20
17 |
18 | Google Play: https://play.google.com/store/apps/details?id=me.drakeet.meizhi
19 |
20 | 直接下载:https://fir.im/mengmeizhi (请尽量 Google Play 下载,如果喜欢,去给个五星好评,非常感谢!)
21 |
22 | v2.2.8
23 |
24 | * 新增 妹纸图页面直接分享图片功能;
25 | * 新增 妹纸图页面直接保存图片菜单按钮;
26 | * 更改 主页浮动按钮的图标为 GitHub 小猫;
27 | * 新增 主页浮动按钮打开最新的干货页面;
28 |
29 | v2.1(1.82MB 极力追求精减安装包大小)
30 |
31 | * 修复 视频播放切换问题;
32 | * 优化 视频播放体验;
33 | * 新增 可爱的初次使用指引;
34 | * 新增 自动收缩浮动刷新按钮;
35 | * 新增 点击主页卡片的文字打开干货页面;
36 | * 新增 干货视频自动横屏播放;
37 | * 新增 打开 Android 等干货条目页面;
38 | * 新增 web 页面标题跑马灯、渐变切换动画效果;
39 | * 新增 登录和缓存 GitHub 帐号功能;
40 | * 特别 照顾魅族用户没有返回键退出视频播放的尴尬状况;
41 |
42 | * 大幅优化 主页流畅度和稳定性;
43 | * 大量重构 开源代码,更加优雅和规整;
44 | * 未来:增加 收藏、搜索功能;
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | ###Contributors
53 |
54 | [drakeet](https://github.com/drakeet)
55 |
56 | [junyuecao](https://github.com/junyuecao)
57 |
58 | [echodjb](https://github.com/echodjb)
59 |
60 | [iamwent](https://github.com/iamwent)
61 |
62 | [代码家](https://github.com/daimajia)
63 |
64 | [linroid](https://github.com/linroid)
65 |
66 | [SharerMax](https://github.com/SharerMax)
67 |
68 | [XieQingShan](https://github.com/XieQingShan)
69 |
70 | [tankcong](https://github.com/tankcong)
71 |
72 | [zeng1990](https://github.com/zeng1990)
73 |
74 | ###特别鸣谢
75 |
76 | [XiNGRZ](https://github.com/xingrz)
77 |
78 | [fython](https://github.com/fython)
79 |
80 | ## About me
81 |
82 | I am a student in China, I love reading pure literature, love Japanese culture and Hongkong music. At the same time, I am also obsessed with writing code. If you have any questions or want to make friends with me, you can write to me: drakeet.me@gmail.com
83 |
84 | In addition, my blog: http://drakeet.me
85 |
86 | If you like my open source projects, you can follow me: https://github.com/drakeet
87 |
88 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | .DS_Store
5 | /build
6 | # built application files
7 | *.apk
8 | *.ap_
9 |
10 | # files for the dex VM
11 | *.dex
12 |
13 | # Java class files
14 | *.class
15 | .DS_Store
16 |
17 | # generated files
18 | bin/
19 | gen/
20 | Wiki/
21 |
22 | # Local configuration file (sdk path, etc)
23 | local.properties
24 |
25 | # Eclipse project files
26 | .classpath
27 | .project
28 | .settings/
29 |
30 | # Proguard folder generated by Eclipse
31 | proguard/
32 |
33 | #Android Studio
34 | build/
35 |
36 | # Intellij project files
37 | *.iml
38 | *.ipr
39 | *.iws
40 | .idea/
41 |
42 | #gradle
43 | .gradle/
44 | captures
--------------------------------------------------------------------------------
/app/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (C) 2015 Drakeet
3 | #
4 | # This file is part of Meizhi
5 | #
6 | # Meizhi is free software: you can redistribute it and/or modify
7 | # it under the terms of the GNU General Public License as published by
8 | # the Free Software Foundation, either version 3 of the License, or
9 | # (at your option) any later version.
10 | #
11 | # Meizhi is distributed in the hope that it will be useful,
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | # GNU General Public License for more details.
15 | #
16 | # You should have received a copy of the GNU General Public License
17 | # along with Meizhi. If not, see .
18 | #
19 |
20 | # Project-wide Gradle settings.
21 |
22 | # IDE (e.g. Android Studio) users:
23 | # Gradle settings configured through the IDE *will override*
24 | # any settings specified in this file.
25 |
26 | # For more details on how to configure your build environment visit
27 | # http://www.gradle.org/docs/current/userguide/build_environment.html
28 |
29 | # Specifies the JVM arguments used for the daemon process.
30 | # The setting is particularly useful for tweaking memory settings.
31 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
32 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
33 |
34 | # When configured, Gradle will run in incubating parallel mode.
35 | # This option should only be used with decoupled projects. More details, visit
36 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
37 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/app/libs/lite-orm-1.5.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/libs/lite-orm-1.5.1.jar
--------------------------------------------------------------------------------
/app/libs/umeng-update-v2.6.0.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/libs/umeng-update-v2.6.0.1.jar
--------------------------------------------------------------------------------
/app/src/androidTest/java/me/drakeet/meiniu/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu;
21 |
22 | import android.app.Application;
23 | import android.test.ApplicationTestCase;
24 |
25 | /**
26 | * Testing Fundamentals
27 | */
28 | public class ApplicationTest extends ApplicationTestCase {
29 | public ApplicationTest() {
30 | super(Application.class);
31 | }
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
37 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
52 |
53 |
57 |
58 |
61 |
62 |
70 |
71 |
74 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
93 |
96 |
99 |
102 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/app/src/main/assets/miaopai.css:
--------------------------------------------------------------------------------
1 | html,body, .video_wrap, .vid, .vid_img, .video {
2 | width: 100%!important;
3 | height: 100%!important;
4 | }
5 | .detail_head_padding {
6 | padding:0;
7 | }
8 | .video_wrap {
9 | top: 0;
10 | left: 0;
11 | position: fixed;
12 | z-index: 10000;
13 | }
14 | .video_img {
15 | margin: 0px auto;
16 | height: 100%!important;
17 | width:auto;
18 | z-index: 0;
19 | }
20 | #video {
21 | height:auto!important;
22 | }
--------------------------------------------------------------------------------
/app/src/main/assets/vmovier.css:
--------------------------------------------------------------------------------
1 | #x-player {
2 | position: fixed;
3 | top:0;
4 | left:0;
5 | width:100%;
6 | height:100%;
7 | z-index: 10000000;
8 | }
9 | #main-container {
10 | position: relative;
11 | z-index:10000000;
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/assets/weibo.css:
--------------------------------------------------------------------------------
1 | html, body, .video_wrap, .video_inner, .poster_wrap {
2 | width:100%!important;
3 | height:100%!important;
4 | margin: 0!important;
5 | padding: 0!important;
6 | }
7 | .video_wrap .poster_wrap img.poster {
8 | max-height: 100%;
9 | max-width: 100%;
10 | height: auto;
11 | width: auto;
12 | }
13 | .cover_ad {
14 | display: none;
15 | }
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/ApiKey.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu;
21 |
22 | /**
23 | * Created by drakeet(http://drakeet.me)
24 | * Date: 15/9/29 10:56
25 | */
26 | public class ApiKey {
27 |
28 | public static final String X_LC_Id = "0azfScvBLCC9tAGRAwIhcC40";
29 | public static final String X_LC_Key = "gAuE93qAusvP8gk1VW8DtOUb";
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/App.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu;
21 |
22 | import android.app.Application;
23 | import android.content.Context;
24 | import com.litesuits.orm.LiteOrm;
25 |
26 | /**
27 | * Created by drakeet on 6/21/15.
28 | */
29 | public class App extends Application {
30 |
31 | private static final String DB_NAME = "daniu.db";
32 | public static Context sContext;
33 | public static LiteOrm sDb;
34 |
35 |
36 | @Override public void onCreate() {
37 | super.onCreate();
38 | sContext = this;
39 | sDb = LiteOrm.newSingleInstance(this, DB_NAME);
40 | if (BuildConfig.DEBUG) {
41 | sDb.setDebugged(true);
42 | }
43 | }
44 |
45 |
46 | @Override public void onTerminate() {
47 | super.onTerminate();
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/Drakeet.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu;
21 |
22 | import me.drakeet.meiniu.data.DDaniuData;
23 | import me.drakeet.meiniu.data.DaniuData;
24 | import me.drakeet.meiniu.data.MeizhiData;
25 | import me.drakeet.meiniu.data.休息视频Data;
26 | import retrofit.http.GET;
27 | import retrofit.http.Headers;
28 | import retrofit.http.Path;
29 | import rx.Observable;
30 |
31 | /**
32 | * Created by drakeet on 8/9/15.
33 | */
34 | public interface Drakeet {
35 |
36 | @GET("/data/请您欣赏/{page}/" + DrakeetFactory.meizhiSize) Observable getMeizhiData(
37 | @Path("page") int page);
38 |
39 | @GET("/day/{year}/{month}/{day}") Observable getGankData(@Path("year") int year,
40 | @Path("month") int month, @Path("day") int day);
41 |
42 | @GET("/data/休息视频/{page}/" + DrakeetFactory.meizhiSize) Observable<休息视频Data> get休息视频Data(
43 | @Path("page") int page);
44 |
45 | @Headers({
46 | // "X-LC-Id: 0azfScvBLCC9tAGRAwIhcC40", "X-LC-Key: gAuE93qAusvP8gk1VW8DtOUb",
47 | "Content-Type: application/json"
48 | })
49 | @GET("/day/{year}/{month}/{day}")
50 | Observable getDGankData(@Path("year") int year, @Path("month") int month,
51 | @Path("day") int day);
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/DrakeetFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu;
21 |
22 | /**
23 | * Created by drakeet on 8/9/15.
24 | */
25 | public class DrakeetFactory {
26 |
27 | protected static final Object monitor = new Object();
28 | static Drakeet sSingleton = null;
29 | public static final int meizhiSize = 10;
30 | public static final int gankSize = 5;
31 |
32 |
33 | public static Drakeet getSingleton() {
34 | synchronized (monitor) {
35 | if (sSingleton == null) {
36 | sSingleton = new DrakeetRetrofit().getService();
37 | }
38 | return sSingleton;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/DrakeetRetrofit.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu;
21 |
22 | import com.google.gson.Gson;
23 | import com.google.gson.GsonBuilder;
24 | import com.squareup.okhttp.OkHttpClient;
25 | import java.util.concurrent.TimeUnit;
26 | import retrofit.RestAdapter;
27 | import retrofit.client.OkClient;
28 | import retrofit.converter.GsonConverter;
29 |
30 | /**
31 | * 2015-08-07T03:57:47.229Z
32 | * Created by drakeet on 8/9/15.
33 | */
34 | public class DrakeetRetrofit {
35 |
36 | final Drakeet service;
37 |
38 | final static Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
39 | .serializeNulls()
40 | .create();
41 |
42 |
43 | DrakeetRetrofit() {
44 | OkHttpClient client = new OkHttpClient();
45 | client.setReadTimeout(12, TimeUnit.SECONDS);
46 |
47 | RestAdapter restAdapter = new RestAdapter.Builder().setClient(new OkClient(client))
48 | .setEndpoint("http://daniu.io/api/v1")
49 | .setConverter(new GsonConverter(gson))
50 | .build();
51 | service = restAdapter.create(Drakeet.class);
52 | }
53 |
54 |
55 | public Drakeet getService() {
56 | return service;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/LoveBus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu;
21 |
22 | import com.squareup.otto.Bus;
23 |
24 | /**
25 | * 爱之车~,爱之座位~~
26 | * Created by drakeet on 8/13/15.
27 | */
28 | public class LoveBus {
29 |
30 | private static final Bus BUS = new Bus();
31 |
32 |
33 | public static Bus getLovelySeat() {return BUS;}
34 |
35 |
36 | private LoveBus() {}
37 | }
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/data/BaseData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.data;
21 |
22 | /**
23 | * Created by drakeet on 8/9/15.
24 | */
25 | public class BaseData {
26 | public boolean error;
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/data/DDaniuData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.data;
21 |
22 | import com.google.gson.annotations.Expose;
23 | import java.util.ArrayList;
24 | import java.util.List;
25 | import me.drakeet.meiniu.model.DDaniu;
26 |
27 | /**
28 | * Created by drakeet(http://drakeet.me)
29 | * Date: 9/9/15 10:51
30 | */
31 | public class DDaniuData {
32 |
33 | @Expose public List results = new ArrayList();
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/data/DaniuData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.data;
21 |
22 | import com.google.gson.annotations.SerializedName;
23 |
24 | import java.util.List;
25 |
26 | import me.drakeet.meiniu.model.Daniu;
27 |
28 | /**
29 | * Created by drakeet on 8/11/15.
30 | */
31 | public class DaniuData extends BaseData {
32 |
33 | public Result results;
34 | public List category;
35 |
36 | public class Result {
37 | @SerializedName("Go") public List goList;
38 | @SerializedName("搞笑视频") public List 搞笑视频List;
39 | @SerializedName("今日视频") public List 今日视频List;
40 | @SerializedName("Swift") public List swiftList;
41 | @SerializedName("请您欣赏") public List 妹纸List;
42 | @SerializedName("拓展资源") public List 拓展资源List;
43 | @SerializedName("实用工具") public List 实用工具List;
44 | @SerializedName("牛人设计") public List 牛人设计List;
45 | @SerializedName("牛人轶事") public List 牛人轶事List;
46 | @SerializedName("网络安全") public List 网络安全List;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/data/MeizhiData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.data;
21 |
22 | import java.util.List;
23 |
24 | import me.drakeet.meiniu.model.Meizhi;
25 |
26 | /**
27 | * Created by drakeet on 8/9/15.
28 | */
29 | public class MeizhiData extends BaseData {
30 | public List results;
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/data/休息视频Data.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.data;
21 |
22 | import java.util.List;
23 |
24 | import me.drakeet.meiniu.model.Daniu;
25 |
26 | /**
27 | * Created by drakeet on 8/15/15.
28 | */
29 | public class 休息视频Data extends BaseData {
30 | public List results;
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/event/OnKeyBackClickEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.event;
21 |
22 | /**
23 | * Created by drakeet on 8/13/15.
24 | */
25 | public class OnKeyBackClickEvent {}
26 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/event/OnMeizhiTouchListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.event;
21 |
22 | import android.view.View;
23 |
24 | import me.drakeet.meiniu.model.Meizhi;
25 |
26 | /**
27 | * 邪恶的 class 名。。。。
28 | * Created by drakeet on 7/1/15.
29 | */
30 | public interface OnMeizhiTouchListener {
31 | void onTouch(View v, View meizhiView, View card, Meizhi meizhi);
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/model/DDaniu.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.model;
21 |
22 | import com.google.gson.annotations.Expose;
23 |
24 | /**
25 | * Created by drakeet(http://drakeet.me)
26 | * Date: 9/9/15 11:00
27 | */
28 | public class DDaniu {
29 | @Expose public String preview;
30 | @Expose public String tag;
31 | @Expose public String createdAt;
32 | @Expose public String updatedAt;
33 | @Expose public String objectId;
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/model/Daniu.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.model;
21 |
22 | import com.litesuits.orm.db.annotation.Column;
23 | import com.litesuits.orm.db.annotation.Table;
24 | import java.util.Date;
25 |
26 | /**
27 | * Created by drakeet on 8/11/15.
28 | */
29 | @Table("ganks") public class Daniu extends Soul {
30 |
31 | @Column("url") public String url;
32 | @Column("type") public String type;
33 | @Column("desc") public String desc;
34 | @Column("who") public String who;
35 | // @Column("used") public boolean used;
36 | @Column("createdAt") public Date createdAt;
37 | @Column("updatedAt") public Date updatedAt;
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/model/Meizhi.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.model;
21 |
22 | import com.litesuits.orm.db.annotation.Column;
23 | import com.litesuits.orm.db.annotation.Table;
24 | import java.util.Date;
25 |
26 | /**
27 | * Created by drakeet on 6/20/15.
28 | */
29 | @Table("meizhis") public class Meizhi extends Soul {
30 |
31 | @Column("url") public String url;
32 | @Column("type") public String type;
33 | @Column("desc") public String desc;
34 | @Column("who") public String who;
35 | // @Column("used") public boolean used;
36 | @Column("createdAt") public Date createdAt;
37 | @Column("updatedAt") public Date updatedAt;
38 | @Column("publishedAt") public Date publishedAt;
39 | @Column("imageWidth") public int imageWidth;
40 | @Column("imageHeight") public int imageHeight;
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/model/Soul.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.model;
21 |
22 | import com.litesuits.orm.db.annotation.Column;
23 | import com.litesuits.orm.db.annotation.NotNull;
24 | import com.litesuits.orm.db.annotation.PrimaryKey;
25 | import com.litesuits.orm.db.annotation.Unique;
26 | import java.io.Serializable;
27 |
28 | /**
29 | * Created by drakeet(http://drakeet.me)
30 | * Date: 8/18/15 13:55
31 | */
32 | public class Soul implements Serializable {
33 |
34 | @PrimaryKey(PrimaryKey.AssignType.AUTO_INCREMENT) @Column("_pid") protected long pid;
35 | @NotNull @Unique @Column("id") public String id;
36 | }
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/other/ActiveAndroidStrategy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.other;
21 |
22 | import com.google.gson.ExclusionStrategy;
23 | import com.google.gson.FieldAttributes;
24 |
25 | /**
26 | * Created by drakeet(http://drakeet.me)
27 | * Date: 8/17/15 22:01
28 | */
29 | public class ActiveAndroidStrategy implements ExclusionStrategy {
30 |
31 | private Class> excludedThisClass;
32 | private Class> excludedThisClassFields;
33 |
34 |
35 | public ActiveAndroidStrategy(Class> excludedThisClass, Class> excludedThisClassFields) {
36 | this.excludedThisClass = excludedThisClass;
37 | this.excludedThisClassFields = excludedThisClassFields;
38 | }
39 |
40 |
41 | @Override public boolean shouldSkipField(FieldAttributes attributes) {
42 | return attributes.getDeclaringClass().equals(excludedThisClassFields);
43 | }
44 |
45 |
46 | @Override public boolean shouldSkipClass(Class> clazz) {
47 | return clazz != null && (clazz.equals(excludedThisClass) || shouldSkipClass(
48 | clazz.getSuperclass()));
49 | }
50 | }
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/service/AlarmReceiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.service;
21 |
22 | import android.content.BroadcastReceiver;
23 | import android.content.Context;
24 | import android.content.Intent;
25 |
26 | import me.drakeet.meiniu.ui.MainActivity;
27 | import me.drakeet.meiniu.R;
28 | import me.drakeet.meiniu.util.HeadsUpUtils;
29 |
30 | /**
31 | * Created by drakeet on 7/1/15.
32 | */
33 | public class AlarmReceiver extends BroadcastReceiver {
34 |
35 | @Override public void onReceive(Context context, Intent intent) {
36 | HeadsUpUtils.show(context, MainActivity.class, context.getString(R.string.headsup_title),
37 | context.getString(R.string.headsup_content), R.mipmap.ic_daniu_io,
38 | R.mipmap.ic_female, 123123);
39 | }
40 | }
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/service/KeepAlarmLiveReceiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.service;
21 |
22 | import android.content.BroadcastReceiver;
23 | import android.content.Context;
24 | import android.content.Intent;
25 | import me.drakeet.meiniu.util.AlarmManagerUtils;
26 |
27 | /**
28 | * Created by drakeet(http://drakeet.me)
29 | * Date: 15/10/10 10:50
30 | */
31 | public class KeepAlarmLiveReceiver extends BroadcastReceiver {
32 |
33 | @Override public void onReceive(Context context, Intent intent) {
34 | if (intent != null && Intent.ACTION_USER_PRESENT.equals(intent.getAction())) {
35 | AlarmManagerUtils.register(context);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/ui/AboutActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.ui;
21 |
22 | import android.os.Bundle;
23 | import android.support.design.widget.CollapsingToolbarLayout;
24 | import android.support.v7.widget.Toolbar;
25 | import android.view.Menu;
26 | import android.view.MenuItem;
27 | import android.widget.TextView;
28 | import butterknife.Bind;
29 | import butterknife.ButterKnife;
30 | import com.umeng.analytics.MobclickAgent;
31 | import me.drakeet.meiniu.BuildConfig;
32 | import me.drakeet.meiniu.R;
33 | import me.drakeet.meiniu.ui.base.BaseActivity;
34 | import me.drakeet.meiniu.util.ShareUtils;
35 |
36 | /**
37 | * Created by drakeet on 15/8/15.
38 | */
39 | public class AboutActivity extends BaseActivity {
40 |
41 | @Bind(R.id.toolbar) Toolbar mToolbar;
42 | @Bind(R.id.tv_version) TextView mVersionTextView;
43 | @Bind(R.id.collapsing_toolbar) CollapsingToolbarLayout mCollapsingToolbarLayout;
44 |
45 |
46 | @Override protected void onCreate(Bundle savedInstanceState) {
47 | super.onCreate(savedInstanceState);
48 | setContentView(R.layout.activity_about);
49 | ButterKnife.bind(this);
50 |
51 | setUpVersionName();
52 |
53 | mCollapsingToolbarLayout.setTitle(getString(R.string.app_name));
54 |
55 | setSupportActionBar(mToolbar);
56 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
57 | mToolbar.setNavigationOnClickListener(v -> AboutActivity.this.onBackPressed());
58 | }
59 |
60 |
61 | private void setUpVersionName() {
62 | mVersionTextView.setText("Version " + BuildConfig.VERSION_NAME);
63 | }
64 |
65 |
66 | @Override public boolean onCreateOptionsMenu(Menu menu) {
67 | getMenuInflater().inflate(R.menu.menu_about, menu);
68 | return true;
69 | }
70 |
71 |
72 | @Override public boolean onOptionsItemSelected(MenuItem item) {
73 | switch (item.getItemId()) {
74 | case android.R.id.home:
75 | this.finish();
76 | return true;
77 | case R.id.menu_share:
78 | ShareUtils.share(this);
79 | return true;
80 | }
81 | return super.onOptionsItemSelected(item);
82 | }
83 |
84 |
85 | public void onResume() {
86 | super.onResume();
87 | MobclickAgent.onResume(this);
88 | }
89 |
90 |
91 | public void onPause() {
92 | super.onPause();
93 | MobclickAgent.onPause(this);
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/ui/adapter/AnimRecyclerViewAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.ui.adapter;
21 |
22 | import android.content.Context;
23 | import android.support.v7.widget.RecyclerView;
24 | import android.view.View;
25 | import android.view.ViewGroup;
26 | import android.view.animation.Animation;
27 | import android.view.animation.AnimationUtils;
28 | import me.drakeet.meiniu.R;
29 |
30 | /**
31 | * 参考了 fython/ExpressHelper @{https://github.com/PaperAirplane-Dev-Team/ExpressHelper/blob/master/app%2Fsrc%2Fmain%2Fjava%2Finfo%2Fpapdt%2Fexpress%2Fhelper%2Fui%2Fcommon%2FMyRecyclerViewAdapter.java}
32 | */
33 | public class AnimRecyclerViewAdapter
34 | extends RecyclerView.Adapter {
35 |
36 | private static final int DELAY = 138;
37 | private int mLastPosition = -1;
38 |
39 |
40 | @Override public T onCreateViewHolder(ViewGroup parent, int viewType) {
41 | return null;
42 | }
43 |
44 |
45 | @Override public void onBindViewHolder(T holder, int position) {}
46 |
47 |
48 | @Override public int getItemCount() {return 0;}
49 |
50 |
51 | public void showItemAnim(final View view, final int position) {
52 | Context context = view.getContext();
53 | if (position > mLastPosition) {
54 | view.setAlpha(0);
55 | view.postDelayed(() -> {
56 | Animation animation = AnimationUtils.loadAnimation(context, R.anim.slide_in_right);
57 | animation.setAnimationListener(new Animation.AnimationListener() {
58 | @Override public void onAnimationStart(Animation animation) {
59 | view.setAlpha(1);
60 | }
61 |
62 |
63 | @Override public void onAnimationEnd(Animation animation) {}
64 |
65 |
66 | @Override public void onAnimationRepeat(Animation animation) {}
67 | });
68 | view.startAnimation(animation);
69 | }, DELAY * position);
70 | mLastPosition = position;
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/ui/adapter/DaniuPagerAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.ui.adapter;
21 |
22 | import android.support.v4.app.Fragment;
23 | import android.support.v4.app.FragmentManager;
24 | import android.support.v4.app.FragmentPagerAdapter;
25 | import java.util.Calendar;
26 | import java.util.Date;
27 |
28 | import me.drakeet.meiniu.DrakeetFactory;
29 | import me.drakeet.meiniu.ui.DaniuFragment;
30 |
31 | /**
32 | * Created by drakeet on 8/11/15.
33 | */
34 | public class DaniuPagerAdapter extends FragmentPagerAdapter {
35 |
36 | Date mDate;
37 |
38 |
39 | public DaniuPagerAdapter(FragmentManager fm, Date date) {
40 | super(fm);
41 | mDate = date;
42 | }
43 |
44 |
45 | @Override public Fragment getItem(int position) {
46 | Calendar calendar = Calendar.getInstance();
47 | calendar.setTime(mDate);
48 | calendar.add(Calendar.DATE, -position);
49 | return DaniuFragment.newInstance(calendar.get(Calendar.YEAR),
50 | calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH));
51 | }
52 |
53 |
54 | @Override public int getCount() {
55 | return DrakeetFactory.gankSize;
56 | }
57 | }
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/ui/base/BaseActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.ui.base;
21 |
22 | import android.content.Intent;
23 | import android.support.v7.app.AppCompatActivity;
24 | import android.view.MenuItem;
25 |
26 | import me.drakeet.meiniu.DrakeetFactory;
27 | import me.drakeet.meiniu.ui.AboutActivity;
28 | import me.drakeet.meiniu.ui.WebActivity;
29 | import me.drakeet.meiniu.Drakeet;
30 | import me.drakeet.meiniu.R;
31 | import me.drakeet.meiniu.util.Once;
32 | import me.drakeet.meiniu.util.ToastUtils;
33 | import rx.Subscription;
34 | import rx.subscriptions.CompositeSubscription;
35 |
36 | /**
37 | * Created by drakeet on 8/9/15.
38 | */
39 | public class BaseActivity extends AppCompatActivity {
40 |
41 | public static final Drakeet sDrakeet = DrakeetFactory.getSingleton();
42 |
43 | private CompositeSubscription mCompositeSubscription;
44 |
45 |
46 | public CompositeSubscription getCompositeSubscription() {
47 | if (this.mCompositeSubscription == null) {
48 | this.mCompositeSubscription = new CompositeSubscription();
49 | }
50 |
51 | return this.mCompositeSubscription;
52 | }
53 |
54 |
55 | public void addSubscription(Subscription s) {
56 | if (this.mCompositeSubscription == null) {
57 | this.mCompositeSubscription = new CompositeSubscription();
58 | }
59 |
60 | this.mCompositeSubscription.add(s);
61 | }
62 |
63 |
64 | @Override public boolean onOptionsItemSelected(MenuItem item) {
65 | int id = item.getItemId();
66 | switch (id) {
67 | case R.id.action_about:
68 | startActivity(new Intent(this, AboutActivity.class));
69 | return true;
70 | case R.id.action_login:
71 | loginGitHub();
72 | return true;
73 | }
74 | return super.onOptionsItemSelected(item);
75 | }
76 |
77 |
78 | protected void loginGitHub() {
79 | new Once(this).show(R.string.action_github_login, () -> {
80 | ToastUtils.showLongLong(getString(R.string.tip_login_github));
81 | });
82 | String url = getString(R.string.url_login_github);
83 | Intent intent = WebActivity.newIntent(this, url, getString(R.string.action_github_login));
84 | startActivity(intent);
85 | }
86 |
87 |
88 | @Override protected void onDestroy() {
89 | super.onDestroy();
90 | if (this.mCompositeSubscription != null) {
91 | this.mCompositeSubscription.unsubscribe();
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/ui/base/SwipeRefreshBaseActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.ui.base;
21 |
22 | import android.os.Bundle;
23 |
24 | import android.os.PersistableBundle;
25 | import android.support.v4.widget.SwipeRefreshLayout;
26 | import butterknife.Bind;
27 | import butterknife.ButterKnife;
28 | import me.drakeet.meiniu.widget.MultiSwipeRefreshLayout;
29 | import me.drakeet.meiniu.R;
30 |
31 | /**
32 | * Created by drakeet on 1/3/15.
33 | */
34 | public abstract class SwipeRefreshBaseActivity extends ToolbarActivity {
35 |
36 | @Bind(R.id.swipe_refresh_layout) public MultiSwipeRefreshLayout mSwipeRefreshLayout;
37 | private boolean mIsRequestDataRefresh = false;
38 |
39 | @Override public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
40 | super.onCreate(savedInstanceState, persistentState);
41 | ButterKnife.bind(this);
42 | }
43 |
44 |
45 | @Override protected void onPostCreate(Bundle savedInstanceState) {
46 | super.onPostCreate(savedInstanceState);
47 | trySetupSwipeRefresh();
48 | }
49 |
50 |
51 | void trySetupSwipeRefresh() {
52 | if (mSwipeRefreshLayout != null) {
53 | mSwipeRefreshLayout.setColorSchemeResources(R.color.refresh_progress_3,
54 | R.color.refresh_progress_2, R.color.refresh_progress_1);
55 | // do not use lambda!!
56 | mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
57 | @Override public void onRefresh() {
58 | requestDataRefresh();
59 | }
60 | });
61 | }
62 | }
63 |
64 |
65 | public void requestDataRefresh() {
66 | mIsRequestDataRefresh = true;
67 | }
68 |
69 | public boolean isRequestDataRefresh() {
70 | return mIsRequestDataRefresh;
71 | }
72 |
73 | public void setRequestDataRefresh(boolean requestDataRefresh) {
74 | if (mSwipeRefreshLayout == null) {
75 | return;
76 | }
77 | if (!requestDataRefresh) {
78 | mIsRequestDataRefresh = false;
79 | // 防止刷新消失太快,让子弹飞一会儿.
80 | mSwipeRefreshLayout.postDelayed(new Runnable() {
81 | @Override public void run() {
82 | if (mSwipeRefreshLayout != null) {
83 | mSwipeRefreshLayout.setRefreshing(false);
84 | }
85 | }
86 | }, 1000);
87 | }
88 | else {
89 | mSwipeRefreshLayout.setRefreshing(true);
90 | }
91 | }
92 |
93 |
94 | public void setProgressViewOffset(boolean scale, int start, int end) {
95 | mSwipeRefreshLayout.setProgressViewOffset(scale, start, end);
96 | }
97 |
98 |
99 | public void setSwipeableChildren(
100 | MultiSwipeRefreshLayout.CanChildScrollUpCallback canChildScrollUpCallback) {
101 | mSwipeRefreshLayout.setCanChildScrollUpCallback(canChildScrollUpCallback);
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/ui/base/SwipeRefreshFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.ui.base;
21 |
22 | import android.os.Bundle;
23 | import android.support.v4.app.Fragment;
24 | import android.view.View;
25 |
26 | import me.drakeet.meiniu.widget.MultiSwipeRefreshLayout;
27 | import me.drakeet.meiniu.R;
28 |
29 | /**
30 | * Created by drakeet on 8/11/15.
31 | */
32 | public class SwipeRefreshFragment extends Fragment {
33 |
34 | public MultiSwipeRefreshLayout mSwipeRefreshLayout;
35 |
36 |
37 | @Override public void onViewCreated(View view, Bundle savedInstanceState) {
38 | super.onViewCreated(view, savedInstanceState);
39 | trySetupSwipeRefresh(view);
40 | }
41 |
42 |
43 | void trySetupSwipeRefresh(View root) {
44 | mSwipeRefreshLayout =
45 | (MultiSwipeRefreshLayout) root.findViewById(R.id.swipe_refresh_layout);
46 | if (mSwipeRefreshLayout != null) {
47 | mSwipeRefreshLayout.setColorSchemeResources(R.color.refresh_progress_3,
48 | R.color.refresh_progress_2, R.color.refresh_progress_1);
49 | mSwipeRefreshLayout.setOnRefreshListener(() -> requestDataRefresh());
50 | }
51 | }
52 |
53 |
54 | public void requestDataRefresh() {
55 | }
56 |
57 |
58 | public void setRefreshing(boolean refreshing) {
59 | if (mSwipeRefreshLayout == null) {
60 | return;
61 | }
62 | if (!refreshing) {
63 | // 防止刷新消失太快,让子弹飞一会儿
64 | mSwipeRefreshLayout.postDelayed(() -> mSwipeRefreshLayout.setRefreshing(false), 1000);
65 | }
66 | else {
67 | mSwipeRefreshLayout.setRefreshing(true);
68 | }
69 | }
70 |
71 |
72 | public void setProgressViewOffset(boolean scale, int start, int end) {
73 | mSwipeRefreshLayout.setProgressViewOffset(scale, start, end);
74 | }
75 |
76 |
77 | public void setSwipeableChildren(
78 | MultiSwipeRefreshLayout.CanChildScrollUpCallback canChildScrollUpCallback) {
79 | mSwipeRefreshLayout.setCanChildScrollUpCallback(canChildScrollUpCallback);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/ui/base/ToolbarActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.ui.base;
21 |
22 | import android.os.Build;
23 | import android.os.Bundle;
24 | import android.support.design.widget.AppBarLayout;
25 | import android.support.v7.app.ActionBar;
26 | import android.support.v7.widget.Toolbar;
27 | import android.view.MenuItem;
28 | import android.view.animation.DecelerateInterpolator;
29 |
30 | import me.drakeet.meiniu.R;
31 |
32 | public abstract class ToolbarActivity extends BaseActivity {
33 |
34 | abstract protected int provideContentViewId();
35 |
36 |
37 | public void onToolbarClick() {}
38 |
39 |
40 | protected AppBarLayout mAppBar;
41 | protected Toolbar mToolbar;
42 | protected boolean mIsHidden = false;
43 |
44 |
45 | @Override protected void onCreate(Bundle savedInstanceState) {
46 | super.onCreate(savedInstanceState);
47 | setContentView(provideContentViewId());
48 |
49 | mAppBar = (AppBarLayout) findViewById(R.id.app_bar_layout);
50 | mToolbar = (Toolbar) findViewById(R.id.toolbar);
51 |
52 | if (mToolbar == null || mAppBar == null) {
53 | throw new IllegalStateException("No toolbar");
54 | }
55 |
56 | mToolbar.setOnClickListener(v -> onToolbarClick());
57 |
58 | setSupportActionBar(mToolbar);
59 |
60 | if (canBack()) {
61 | ActionBar actionBar = getSupportActionBar();
62 | if (actionBar != null) actionBar.setDisplayHomeAsUpEnabled(true);
63 | }
64 |
65 | if (Build.VERSION.SDK_INT >= 21) {
66 | mAppBar.setElevation(10.6f);
67 | }
68 | }
69 |
70 |
71 | public boolean canBack() {
72 | return false;
73 | }
74 |
75 |
76 | @Override public boolean onOptionsItemSelected(MenuItem item) {
77 | if (item.getItemId() == android.R.id.home) {
78 | onBackPressed();
79 | return true;
80 | }
81 | else {
82 | return super.onOptionsItemSelected(item);
83 | }
84 | }
85 |
86 |
87 | protected void setAppBarAlpha(float alpha) {
88 | mAppBar.setAlpha(alpha);
89 | }
90 |
91 |
92 | protected void hideOrShowToolbar() {
93 | mAppBar.animate()
94 | .translationY(mIsHidden ? 0 : -mAppBar.getHeight())
95 | .setInterpolator(new DecelerateInterpolator(2))
96 | .start();
97 |
98 | mIsHidden = !mIsHidden;
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/util/AlarmManagerUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.util;
21 |
22 | import android.app.AlarmManager;
23 | import android.app.PendingIntent;
24 | import android.content.Context;
25 | import android.content.Intent;
26 | import java.util.Calendar;
27 |
28 | import me.drakeet.meiniu.service.AlarmReceiver;
29 |
30 | /**
31 | * Created by drakeet on 7/1/15.
32 | */
33 | public class AlarmManagerUtils {
34 |
35 | public static void register(Context context) {
36 |
37 | Calendar today = Calendar.getInstance();
38 | Calendar now = Calendar.getInstance();
39 |
40 | today.set(Calendar.HOUR_OF_DAY, 12);
41 | today.set(Calendar.MINUTE, 38);
42 | today.set(Calendar.SECOND, 0);
43 |
44 | if (now.after(today)) {
45 | return;
46 | }
47 |
48 | Intent intent = new Intent("me.drakeet.meizhi.alarm");
49 | intent.setClass(context, AlarmReceiver.class);
50 |
51 | PendingIntent pi =
52 | PendingIntent.getBroadcast(context, 520, intent, PendingIntent.FLAG_UPDATE_CURRENT);
53 | AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
54 |
55 | am.set(AlarmManager.RTC_WAKEUP, today.getTimeInMillis(), pi);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/util/AndroidUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.util;
21 |
22 | import android.content.ClipData;
23 | import android.content.ClipboardManager;
24 | import android.content.Context;
25 | import android.widget.Toast;
26 |
27 | /**
28 | * Created by drakeet(http://drakeet.me)
29 | * Date: 8/23/15 18:01
30 | */
31 | public class AndroidUtils {
32 |
33 | public static void copyToClipBoard(Context context, String text, String success) {
34 | ClipData clipData = ClipData.newPlainText("meizhi_copy", text);
35 | ClipboardManager manager =
36 | (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
37 | manager.setPrimaryClip(clipData);
38 | Toast.makeText(context, success, Toast.LENGTH_SHORT).show();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/util/DateUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.util;
21 |
22 | import java.text.DateFormat;
23 | import java.text.SimpleDateFormat;
24 | import java.util.Calendar;
25 | import java.util.Date;
26 |
27 | /**
28 | * Created by drakeet on 6/20/15.
29 | */
30 | public class DateUtils {
31 |
32 | public static String toDate(Date date) {
33 | DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
34 | return dateFormat.format(date);
35 | }
36 |
37 |
38 | public static String toDate(Date date, int add) {
39 | Calendar calendar = Calendar.getInstance();
40 | calendar.setTime(date);
41 | calendar.add(Calendar.DATE, add);
42 | return toDate(calendar.getTime());
43 | }
44 |
45 |
46 | public static Date getLastdayDate(Date date) {
47 | Calendar calendar = Calendar.getInstance();
48 | calendar.setTime(date);
49 | calendar.add(Calendar.DATE, -1);
50 | return calendar.getTime();
51 | }
52 |
53 |
54 | public static Date getNextdayDate(Date date) {
55 | Calendar calendar = Calendar.getInstance();
56 | calendar.setTime(date);
57 | calendar.add(Calendar.DATE, 1);
58 | return calendar.getTime();
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/util/HeadsUpUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.util;
21 |
22 | import android.app.Notification;
23 | import android.app.PendingIntent;
24 | import android.content.Context;
25 | import android.content.Intent;
26 | import android.graphics.BitmapFactory;
27 | import android.os.Build;
28 |
29 | import com.mingle.headsUp.HeadsUp;
30 | import com.mingle.headsUp.HeadsUpManager;
31 |
32 | /**
33 | * Created by drakeet on 7/1/15.
34 | */
35 | public class HeadsUpUtils {
36 |
37 | public static void show(Context context, Class> targetActivity, String title, String content,
38 | int largeIcon, int smallIcon, int code) {
39 | PendingIntent pendingIntent =
40 | PendingIntent.getActivity(context, 11, new Intent(context, targetActivity),
41 | PendingIntent.FLAG_UPDATE_CURRENT);
42 | HeadsUpManager manage = HeadsUpManager.getInstant(context);
43 | HeadsUp.Builder builder = new HeadsUp.Builder(context);
44 | builder.setContentTitle(title)
45 | .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_LIGHTS)
46 | .setContentIntent(pendingIntent)
47 | .setFullScreenIntent(pendingIntent, false)
48 | .setAutoCancel(true)
49 | .setContentText(content);
50 |
51 | if (Build.VERSION.SDK_INT >= 21) {
52 | builder.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), largeIcon))
53 | .setSmallIcon(smallIcon);
54 | }
55 | else {
56 | builder.setSmallIcon(largeIcon);
57 | }
58 |
59 | HeadsUp headsUp = builder.buildHeadUp();
60 | headsUp.setSticky(true);
61 | manage.notify(code, headsUp);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/util/HttpUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.util;
21 |
22 | import java.io.BufferedReader;
23 | import java.io.InputStreamReader;
24 | import java.net.HttpURLConnection;
25 | import java.net.URL;
26 |
27 | /**
28 | * Created by drak11t on 8/16/14.
29 | */
30 | public class HttpUtils {
31 |
32 | private URL url = null;
33 |
34 |
35 | public String download(String urlStr) {
36 | StringBuffer sb = new StringBuffer();
37 | String line = null;
38 | BufferedReader buffer = null;
39 | try {
40 | url = new URL(urlStr);
41 | HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
42 | buffer = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
43 | while ((line = buffer.readLine()) != null) {
44 | sb.append(line);
45 | }
46 | } catch (Exception e) {
47 | e.printStackTrace();
48 | } finally {
49 | try {
50 | if (buffer != null) {
51 | buffer.close();
52 | }
53 | } catch (Exception e) {
54 | e.printStackTrace();
55 | }
56 | }
57 | return sb.toString();
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/util/LoveStringUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.util;
21 |
22 | /**
23 | * Created by drakeet on 8/14/15.
24 | */
25 | public class LoveStringUtils {
26 |
27 | public static String getVideoPreviewImageUrl(String resp) {
28 | int s0 = resp.indexOf("今日视频
");
29 | if (s0 == -1) {
30 | int s = resp.indexOf("搞笑视频
");
31 | if (s == -1) {
32 | return null;
33 | } else {
34 | s0 = s;
35 | }
36 | }
37 | int s1 = resp.indexOf("
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.util;
21 |
22 | import android.content.Context;
23 | import android.content.SharedPreferences;
24 |
25 | /**
26 | * Created by drakeet on 8/16/15.
27 | */
28 | public class Once {
29 |
30 | SharedPreferences mSharedPreferences;
31 | Context mContext;
32 |
33 |
34 | public Once(Context context) {
35 | mSharedPreferences = context.getSharedPreferences("once", Context.MODE_PRIVATE);
36 | mContext = context;
37 | }
38 |
39 |
40 | public void show(String tagKey, OnceCallback callback) {
41 | boolean isSecondTime = mSharedPreferences.getBoolean(tagKey, false);
42 | if (!isSecondTime) {
43 | callback.onOnce();
44 | SharedPreferences.Editor editor = mSharedPreferences.edit();
45 | editor.putBoolean(tagKey, true);
46 | editor.apply();
47 | }
48 | }
49 |
50 |
51 | public void show(int tagKeyResId, OnceCallback callback) {
52 | show(mContext.getString(tagKeyResId), callback);
53 | }
54 |
55 |
56 | public interface OnceCallback {
57 | void onOnce();
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/util/RxMeizhi.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.util;
21 |
22 | import android.content.Context;
23 | import android.content.Intent;
24 | import android.graphics.Bitmap;
25 | import android.net.Uri;
26 | import android.os.Environment;
27 | import com.squareup.picasso.Picasso;
28 | import java.io.File;
29 | import java.io.FileOutputStream;
30 | import java.io.IOException;
31 | import rx.Observable;
32 | import rx.Subscriber;
33 | import rx.schedulers.Schedulers;
34 |
35 | /**
36 | * 简单重构了下,并且修复了重复插入图片问题
37 | * Created by drakeet on 8/10/15.
38 | */
39 | public class RxMeizhi {
40 |
41 | public static Observable saveImageAndGetPathObservable(Context context, String url,
42 | String title) {
43 | return Observable.create(new Observable.OnSubscribe() {
44 | @Override public void call(Subscriber super Bitmap> subscriber) {
45 | Bitmap bitmap = null;
46 | try {
47 | bitmap = Picasso.with(context).load(url).get();
48 | } catch (IOException e) {
49 | subscriber.onError(e);
50 | }
51 | if (bitmap == null) {
52 | subscriber.onError(new Exception("无法下载到图片"));
53 | }
54 | subscriber.onNext(bitmap);
55 | subscriber.onCompleted();
56 | }
57 | }).flatMap(bitmap -> {
58 | File appDir = new File(Environment.getExternalStorageDirectory(), "Meizhi");
59 | if (!appDir.exists()) {
60 | appDir.mkdir();
61 | }
62 | String fileName = title.replace('/', '-') + ".jpg";
63 | File file = new File(appDir, fileName);
64 | try {
65 | FileOutputStream fos = new FileOutputStream(file);
66 | assert bitmap != null;
67 | bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
68 | fos.flush();
69 | fos.close();
70 | } catch (IOException e) {
71 | e.printStackTrace();
72 | }
73 |
74 | Uri uri = Uri.fromFile(file);
75 | // 通知图库更新
76 | Intent scannerIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri);
77 | context.sendBroadcast(scannerIntent);
78 | return Observable.just(uri);
79 | }).subscribeOn(Schedulers.io());
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/util/ShareUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.util;
21 |
22 | import android.content.Context;
23 | import android.content.Intent;
24 | import android.net.Uri;
25 | import me.drakeet.meiniu.R;
26 |
27 | /**
28 | * Created by drakeet on 8/17/15.
29 | */
30 | public class ShareUtils {
31 |
32 | public static void share(Context context) {
33 | share(context, context.getString(R.string.share_text));
34 | }
35 |
36 |
37 | public static void shareImage(Context context, Uri uri, String title) {
38 | Intent shareIntent = new Intent();
39 | shareIntent.setAction(Intent.ACTION_SEND);
40 | shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
41 | shareIntent.setType("image/jpeg");
42 | context.startActivity(Intent.createChooser(shareIntent, title));
43 | }
44 |
45 |
46 | public static void share(Context context, String extraText) {
47 | Intent intent = new Intent(Intent.ACTION_SEND);
48 | intent.setType("text/plain");
49 | intent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.action_share));
50 | intent.putExtra(Intent.EXTRA_TEXT, extraText);
51 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
52 | context.startActivity(
53 | Intent.createChooser(intent, context.getString(R.string.action_share)));
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/util/StringStyleUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.util;
21 |
22 | import android.content.Context;
23 | import android.text.SpannableString;
24 | import android.text.style.TextAppearanceSpan;
25 |
26 | /**
27 | * Created by drakeet on 8/11/15.
28 | */
29 | public class StringStyleUtils {
30 |
31 | public static SpannableString format(Context context, String text, int style) {
32 | SpannableString spannableString = new SpannableString(text);
33 | spannableString.setSpan(new TextAppearanceSpan(context, style), 0, text.length(), 0);
34 | return spannableString;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/util/TaskUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.util;
21 |
22 | import android.os.AsyncTask;
23 | import android.os.Build;
24 |
25 | /**
26 | * Created by drak11t on 8/16/14.
27 | */
28 | public class TaskUtils {
29 |
30 | @SafeVarargs public static void executeAsyncTask(
31 | AsyncTask task, Params... params) {
32 | if (Build.VERSION.SDK_INT >= 11) {
33 | task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
34 | }
35 | else {
36 | task.execute(params);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/util/ToastUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.util;
21 |
22 | import android.content.Context;
23 | import android.widget.Toast;
24 |
25 | import me.drakeet.meiniu.App;
26 |
27 | /**
28 | * Created by drakeet on 9/27/14.
29 | */
30 | public class ToastUtils {
31 |
32 | Context mContext;
33 |
34 |
35 | private ToastUtils() {
36 | }
37 |
38 |
39 | private static void show(Context context, int resId, int duration) {
40 | Toast.makeText(context, resId, duration).show();
41 | }
42 |
43 |
44 | private static void show(Context context, String message, int duration) {
45 | Toast.makeText(context, message, duration).show();
46 | }
47 |
48 |
49 | public static void showShort(int resId) {
50 | Toast.makeText(App.sContext, resId, Toast.LENGTH_SHORT).show();
51 | }
52 |
53 |
54 | public static void showShort(String message) {
55 | Toast.makeText(App.sContext, message, Toast.LENGTH_SHORT).show();
56 | }
57 |
58 |
59 | public static void showLong(int resId) {
60 | Toast.makeText(App.sContext, resId, Toast.LENGTH_LONG).show();
61 | }
62 |
63 |
64 | public static void showLong(String message) {
65 | Toast.makeText(App.sContext, message, Toast.LENGTH_LONG).show();
66 | }
67 |
68 |
69 | public static void showLongLong(String message) {
70 | showLong(message);
71 | showLong(message);
72 | }
73 |
74 |
75 | public static void showLongLong(int resId) {
76 | showLong(resId);
77 | showLong(resId);
78 | }
79 |
80 |
81 | public static void showLongLongLong(int resId) {
82 | showLong(resId);
83 | showLong(resId);
84 | showShort(resId);
85 | }
86 |
87 |
88 | public static void showLongLongLong(String message) {
89 | showLong(message);
90 | showLong(message);
91 | showShort(message);
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/widget/GoodAppBarLayout.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.widget;
21 |
22 | import android.content.Context;
23 | import android.support.design.widget.AppBarLayout;
24 | import android.util.AttributeSet;
25 |
26 | /**
27 | * A good boy! AppBarLayout is bad boy!
28 | * Created by drakeet on 8/11/15.
29 | */
30 | public class GoodAppBarLayout extends AppBarLayout {
31 |
32 | public int offset;
33 | OnOffsetChangedListener mOnOffsetChangedListener;
34 |
35 |
36 | public GoodAppBarLayout(Context context) {
37 | this(context, null);
38 | }
39 |
40 |
41 | public GoodAppBarLayout(Context context, AttributeSet attrs) {
42 | super(context, attrs);
43 | }
44 |
45 |
46 | public void notifyRemoveOffsetListener() {
47 | this.removeOnOffsetChangedListener(mOnOffsetChangedListener);
48 | }
49 |
50 |
51 | public void notifyAddOffsetListener() {
52 | this.addOnOffsetChangedListener(mOnOffsetChangedListener);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/widget/MultiSwipeRefreshLayout.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.widget;
21 |
22 | import android.content.Context;
23 | import android.content.res.TypedArray;
24 | import android.graphics.drawable.Drawable;
25 | import android.support.v4.widget.SwipeRefreshLayout;
26 | import android.util.AttributeSet;
27 |
28 | import me.drakeet.meiniu.R;
29 |
30 | /**
31 | * Pick from Google io 2014
32 | * Created by drakeet on 1/3/15.
33 | */
34 | public class MultiSwipeRefreshLayout extends SwipeRefreshLayout {
35 |
36 | private CanChildScrollUpCallback mCanChildScrollUpCallback;
37 | private Drawable mForegroundDrawable;
38 |
39 |
40 | public MultiSwipeRefreshLayout(Context context) {
41 | this(context, null);
42 | }
43 |
44 |
45 | public MultiSwipeRefreshLayout(Context context, AttributeSet attrs) {
46 | super(context, attrs);
47 | final TypedArray a =
48 | context.obtainStyledAttributes(attrs, R.styleable.MultiSwipeRefreshLayout, 0, 0);
49 |
50 | mForegroundDrawable = a.getDrawable(R.styleable.MultiSwipeRefreshLayout_foreground);
51 | if (mForegroundDrawable != null) {
52 | mForegroundDrawable.setCallback(this);
53 | setWillNotDraw(false);
54 | }
55 | a.recycle();
56 | }
57 |
58 |
59 | @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) {
60 | super.onSizeChanged(w, h, oldw, oldh);
61 | if (mForegroundDrawable != null) {
62 | mForegroundDrawable.setBounds(0, 0, w, h);
63 | }
64 | }
65 |
66 |
67 | public void setCanChildScrollUpCallback(CanChildScrollUpCallback canChildScrollUpCallback) {
68 | mCanChildScrollUpCallback = canChildScrollUpCallback;
69 | }
70 |
71 |
72 | public interface CanChildScrollUpCallback {
73 | boolean canSwipeRefreshChildScrollUp();
74 | }
75 |
76 |
77 | @Override public boolean canChildScrollUp() {
78 | if (mCanChildScrollUpCallback != null) {
79 | return mCanChildScrollUpCallback.canSwipeRefreshChildScrollUp();
80 | }
81 | return super.canChildScrollUp();
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/widget/RatioImageView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.widget;
21 |
22 | import android.content.Context;
23 | import android.util.AttributeSet;
24 | import android.widget.ImageView;
25 |
26 | public class RatioImageView extends ImageView {
27 |
28 | private int originalWidth;
29 | private int originalHeight;
30 |
31 |
32 | public RatioImageView(Context context) {
33 | super(context);
34 | }
35 |
36 |
37 | public RatioImageView(Context context, AttributeSet attrs) {
38 | super(context, attrs);
39 | }
40 |
41 |
42 | public RatioImageView(Context context, AttributeSet attrs, int defStyleAttr) {
43 | super(context, attrs, defStyleAttr);
44 | }
45 |
46 |
47 | public void setOriginalSize(int originalWidth, int originalHeight) {
48 | this.originalWidth = originalWidth;
49 | this.originalHeight = originalHeight;
50 | }
51 |
52 |
53 | @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
54 | if (originalWidth > 0 && originalHeight > 0) {
55 | float ratio = (float) originalWidth / (float) originalHeight;
56 |
57 | int width = MeasureSpec.getSize(widthMeasureSpec);
58 | int height = MeasureSpec.getSize(heightMeasureSpec);
59 |
60 | // TODO: 现在只支持固定宽度
61 | if (width > 0) {
62 | height = (int) ((float) width / ratio);
63 | }
64 |
65 | setMeasuredDimension(width, height);
66 | }
67 | else {
68 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/app/src/main/java/me/drakeet/meiniu/widget/VideoImageView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package me.drakeet.meiniu.widget;
21 |
22 | import android.content.Context;
23 | import android.util.AttributeSet;
24 | import android.widget.ImageView;
25 |
26 | import com.nineoldandroids.animation.Animator;
27 | import com.nineoldandroids.animation.AnimatorSet;
28 | import com.nineoldandroids.animation.ObjectAnimator;
29 |
30 | /**
31 | * 让图片看起来像是动的视频一样
32 | * Created by drakeet on 8/11/15.
33 | */
34 | public class VideoImageView extends ImageView implements Animator.AnimatorListener {
35 |
36 | private boolean scale = false;
37 |
38 |
39 | public VideoImageView(Context context) {
40 | this(context, null);
41 | }
42 |
43 |
44 | public VideoImageView(Context context, AttributeSet attrs) {
45 | this(context, attrs, 0);
46 | }
47 |
48 |
49 | public VideoImageView(Context context, AttributeSet attrs, int defStyleAttr) {
50 | super(context, attrs, defStyleAttr);
51 | nextAnimation();
52 | }
53 |
54 |
55 | private void nextAnimation() {
56 | // TODO: remove 9 old android.
57 | AnimatorSet anim = new AnimatorSet();
58 | if (scale) {
59 | anim.playTogether(ObjectAnimator.ofFloat(this, "scaleX", 1.5f, 1f),
60 | ObjectAnimator.ofFloat(this, "scaleY", 1.5f, 1f));
61 | }
62 | else {
63 | anim.playTogether(ObjectAnimator.ofFloat(this, "scaleX", 1, 1.5f),
64 | ObjectAnimator.ofFloat(this, "scaleY", 1, 1.5f));
65 | }
66 |
67 | anim.setDuration(10987);
68 | anim.addListener(this);
69 | anim.start();
70 | scale = !scale;
71 | }
72 |
73 |
74 | @Override public void onAnimationCancel(Animator arg0) {
75 | }
76 |
77 |
78 | @Override public void onAnimationEnd(Animator animator) {
79 | nextAnimation();
80 | }
81 |
82 |
83 | @Override public void onAnimationRepeat(Animator arg0) {
84 | }
85 |
86 |
87 | @Override public void onAnimationStart(Animator arg0) {
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_in_right.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
26 |
30 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/umeng_update_close_bg_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/drawable-hdpi/umeng_update_close_bg_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/umeng_update_close_bg_tap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/drawable-hdpi/umeng_update_close_bg_tap.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/abc_menu_dropdown_panel_holo_light.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/drawable/abc_menu_dropdown_panel_holo_light.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_card.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/drawable/bg_card.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_card_nopic.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
22 |
23 |
24 | -
25 |
26 |
27 |
28 |
29 |
30 |
31 | -
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_material_button_lite_blue.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tb_munion_icon.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
23 |
26 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tb_munion_item_selector.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
23 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/umeng_common_gradient_orange.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/umeng_common_gradient_red.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/umeng_update_button_cancel_bg_focused.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/umeng_update_button_cancel_bg_normal.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/umeng_update_button_cancel_bg_selector.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
24 |
26 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/umeng_update_button_cancel_bg_tap.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/umeng_update_button_close_bg_selector.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
24 |
26 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/umeng_update_button_ok_bg_focused.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/umeng_update_button_ok_bg_normal.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/umeng_update_dialog_bg.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/umeng_update_title_bg.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
27 |
28 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_daniu.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
26 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
24 |
25 |
26 |
27 |
32 |
33 |
39 |
40 |
41 |
42 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_picture.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_web.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
26 |
27 |
28 |
36 |
37 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_daniu.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
26 |
27 |
32 |
33 |
40 |
41 |
45 |
46 |
53 |
54 |
58 |
59 |
65 |
66 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
86 |
87 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_daniu.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
26 |
38 |
39 |
49 |
50 |
55 |
56 |
59 |
60 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_meizhi.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
33 |
34 |
40 |
41 |
50 |
51 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tb_munion_aditem.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
26 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tb_munion_adview.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
21 |
22 |
27 |
28 |
32 |
33 |
40 |
41 |
44 |
45 |
52 |
53 |
59 |
60 |
67 |
68 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_empty.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
24 |
25 |
32 |
33 |
41 |
42 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_toolbar.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
27 |
28 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_toolbar_with_indicator.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
26 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_toolbar_with_title_view.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
27 |
28 |
36 |
37 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_video.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_about.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_daniu.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
43 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
43 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_picture.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_web.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/avatar_daimajia.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/mipmap-xhdpi/avatar_daimajia.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/avatar_drakeet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/mipmap-xhdpi/avatar_drakeet.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/avatar_zddhub.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/mipmap-xhdpi/avatar_zddhub.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/emoji_see_no_evil.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/mipmap-xhdpi/emoji_see_no_evil.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/heheh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/mipmap-xhdpi/heheh.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_daniu_io.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/mipmap-xhdpi/ic_daniu_io.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_female.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/mipmap-xhdpi/ic_female.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/mipmap-xhdpi/ic_github.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/mipmap-xhdpi/ic_play.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_save_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/mipmap-xhdpi/ic_save_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_share_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/app/src/main/res/mipmap-xhdpi/ic_share_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/dimens.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 | 16dp
22 | 16dp
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/values-zh/umeng_common_strings.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 | 正在下载中.
22 | 下载出错啦,请检查网络后继续。
23 | 暂停
24 | 继续
25 | 取消
26 | 正在下载:
27 | 暂停:
28 | 正在下载应用
29 | 正在更新安装包
30 | 请连接网络后再尝试!
31 | 下载失败
32 | 下载完成,请点击安装
33 | 更新完成,请点击安装
34 | 新版本已经准备好,请点击安装
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/values-zh/umeng_update_string.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 | 未联网
22 | 发现新版本
23 | 最新版本:
24 | 更新内容
25 | 仅需要下载:
26 | 新版本大小:
27 | (提示:非WIFI环境)
28 | 立即更新
29 | 应用更新
30 | 以后再说
31 | 忽略该版
32 | 正在更新中....
33 | 最新版本已下载,是否安装?
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 | #E22B28
22 | #f36c60
23 | #231714
24 | #e91e63
25 | #00b0ff
26 | @color/theme_primary
27 | @color/white
28 | @color/theme_primary_darker
29 |
30 | #ff359ff2
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 | 16dp
23 | 16dp
24 | 56dp
25 | 224dp
26 | 230dp
27 | 14sp
28 |
29 | 16dp
30 | 8dp
31 |
32 | 18sp
33 | 38dp
34 | 13sp
35 | 8dp
36 |
37 | 0dp
38 | 0dp
39 |
40 | 34dp
41 | 13dp
42 | 48dp
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
28 |
29 |
33 |
34 |
38 |
39 |
43 |
44 |
49 |
50 |
59 |
60 |
67 |
68 |
--------------------------------------------------------------------------------
/app/src/main/res/values/tb_munion_strings.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 | #e3e3e3
23 | 正在下载:
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/values/umeng_common_strings.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 | The app is already in downloading list.
22 | dowload interrupted.
23 | Pause
24 | Continue
25 | Cancel
26 | Downloading:
27 | Pause:
28 | Download start.
29 | Patch start.
30 | Please make sure you are connected to internet, download failed
31 | Download Failed!
32 | Download finished,click to install it.
33 | Patch finished,click to install it.
34 | New version is ready,click to install it.
35 | icon
36 |
--------------------------------------------------------------------------------
/app/src/main/res/values/umeng_update_string.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 | Please make sure you are connected to internet,update failed
23 | New version found
24 | Latest version:
25 | Update Content
26 | Update size:
27 | Target size:
28 | (Warning: Not WIFI Condition)
29 | Update now
30 | App updating
31 | Not now
32 | Ingore this
33 | Updating....
34 | The lastest version has been downloaded, install now ?
35 | 2.6.0.1.20150312
36 |
37 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | apply from: "config.gradle"
3 |
4 | buildscript {
5 | repositories {
6 | mavenCentral()
7 | jcenter()
8 | maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
9 | }
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:1.3.0'
12 | classpath 'me.tatarka:gradle-retrolambda:3.2.0'
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | mavenCentral()
21 | jcenter()
22 | maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/config.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | ext {
21 |
22 | android = [compileSdkVersion: 22,
23 | buildToolsVersion: "22.0.1",
24 | applicationId : "me.drakeet.meiniu",
25 | minSdkVersion : 14,
26 | targetSdkVersion : 22,
27 | versionCode : 406,
28 | versionName : "2.4.5"]
29 |
30 | dependencies = ["appcompat-v7" : "com.android.support:appcompat-v7:22.2.1",
31 | "design" : "com.android.support:design:22.2.1",
32 | "recyclerview-v7" : "com.android.support:recyclerview-v7:22.2.1",
33 | "nineoldandroids" : "com.nineoldandroids:library:2.4.0",
34 | "picasso" : "com.squareup.picasso:picasso:2.5.2",
35 | "photoview" : "com.github.chrisbanes.photoview:library:1.2.3",
36 | "numberprogressbar" : "com.daimajia.numberprogressbar:library:1.2@aar",
37 | "umeng-analytics" : "com.umeng.analytics:analytics:latest.integration",
38 | "retrofit" : "com.squareup.retrofit:retrofit:1.9.0",
39 | "rxandroid" : "io.reactivex:rxandroid:1.0.0",
40 | "okhttp-urlconnection": "com.squareup.okhttp:okhttp-urlconnection:2.0.0",
41 | "okhttp" : "com.squareup.okhttp:okhttp:2.0.0",
42 | "butterknife" : "com.jakewharton:butterknife:7.0.1",
43 | "otto" : "com.squareup:otto:1.3.8",
44 | "glide" : "com.github.bumptech.glide:glide:3.6.1"]
45 | }
46 |
--------------------------------------------------------------------------------
/daniu.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/daniu.mp4
--------------------------------------------------------------------------------
/download.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/download.jpg
--------------------------------------------------------------------------------
/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 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Jun 20 21:27:50 CST 2015
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-2.4-all.zip
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/libraries/headsupcompat/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/libraries/headsupcompat/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.android.compileSdkVersion
5 | buildToolsVersion rootProject.ext.android.buildToolsVersion
6 |
7 | defaultConfig {
8 | minSdkVersion rootProject.ext.android.minSdkVersion
9 | targetSdkVersion rootProject.ext.android.targetSdkVersion
10 | versionCode rootProject.ext.android.versionCode
11 | versionName rootProject.ext.android.versionName
12 | }
13 |
14 | buildTypes {
15 | release {
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile rootProject.ext.dependencies["appcompat-v7"]
23 | compile rootProject.ext.dependencies["nineoldandroids"]
24 | }
25 |
--------------------------------------------------------------------------------
/libraries/headsupcompat/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 D:/Program Files (x86)/Android/android-studio/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 |
--------------------------------------------------------------------------------
/libraries/headsupcompat/src/androidTest/java/com/example/administrator/ll/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.example.administrator.ll;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/libraries/headsupcompat/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/libraries/headsupcompat/src/main/java/com/mingle/headsUp/Distance.java:
--------------------------------------------------------------------------------
1 | package com.mingle.headsUp;
2 |
3 | import android.content.Context;
4 | import android.hardware.SensorManager;
5 | import android.view.ViewConfiguration;
6 |
7 | /**
8 | * Created by zzz40500 on 15/1/29.
9 | */
10 | public class Distance {
11 | private float mFlingFriction = ViewConfiguration.getScrollFriction();
12 |
13 | private static float DECELERATION_RATE = (float) (Math.log(0.78) / Math.log(0.9));
14 | private static final float INFLEXION = 0.35f;
15 | private float mPhysicalCoeff;
16 |
17 |
18 | public Distance(Context context){
19 |
20 | final float ppi = context.getResources().getDisplayMetrics().density * 160.0f;
21 | mPhysicalCoeff = SensorManager.GRAVITY_EARTH // g (m/s^2)
22 | * 39.37f // inch/meter
23 | * ppi
24 | * 0.84f; // look and feel tuning
25 | }
26 | public double getSplineFlingDistance(int velocity) {
27 | final double l = getSplineDeceleration(velocity);
28 | final double decelMinusOne = DECELERATION_RATE - 1.0;
29 | return mFlingFriction * mPhysicalCoeff * Math.exp(DECELERATION_RATE / decelMinusOne * l);
30 | }
31 |
32 | private double getSplineDeceleration(int velocity) {
33 | return Math.log(INFLEXION * Math.abs(velocity) / (mFlingFriction * mPhysicalCoeff));
34 | }
35 |
36 | /* Returns the duration, expressed in milliseconds */
37 | public int getSplineFlingDuration(int velocity) {
38 | final double l = getSplineDeceleration(velocity);
39 | final double decelMinusOne = DECELERATION_RATE - 1.0;
40 | return (int) (1000.0 * Math.exp(l / decelMinusOne));
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/libraries/headsupcompat/src/main/res/drawable-hdpi/bg_transparency_to_grey.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/libraries/headsupcompat/src/main/res/drawable-hdpi/notification_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
7 |
8 |
13 |
14 |
18 |
19 |
20 |
21 |
22 | -
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/libraries/headsupcompat/src/main/res/drawable-hdpi/notification_bg2.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/libraries/headsupcompat/src/main/res/drawable-hdpi/notification_bg2.9.png
--------------------------------------------------------------------------------
/libraries/headsupcompat/src/main/res/drawable-hdpi/notification_bg3.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/libraries/headsupcompat/src/main/res/drawable-hdpi/notification_bg3.9.png
--------------------------------------------------------------------------------
/libraries/headsupcompat/src/main/res/layout/notification_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
--------------------------------------------------------------------------------
/libraries/headsupcompat/src/main/res/menu/my.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/libraries/headsupcompat/src/main/res/values/circle_imageview_attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/libraries/headsupcompat/src/main/res/values/defualt.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #808080
4 | #e0e0e0
5 | #00000000
6 | #ffffff
7 |
--------------------------------------------------------------------------------
/libraries/headsupcompat/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/libraries/headsupcompat/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Ll
5 | Hello world!
6 | Settings
7 | app icon
8 |
9 |
10 |
--------------------------------------------------------------------------------
/libraries/smooth-app-bar-layout/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/libraries/smooth-app-bar-layout/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.library"
2 |
3 | android {
4 | compileSdkVersion rootProject.ext.android.compileSdkVersion
5 | buildToolsVersion rootProject.ext.android.buildToolsVersion
6 |
7 | defaultConfig {
8 | minSdkVersion rootProject.ext.android.minSdkVersion
9 | targetSdkVersion rootProject.ext.android.targetSdkVersion
10 | versionCode rootProject.ext.android.versionCode
11 | versionName rootProject.ext.android.versionName
12 | }
13 |
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: "libs", include: ["*.jar"])
24 | compile rootProject.ext.dependencies["design"]
25 | compile rootProject.ext.dependencies["appcompat-v7"]
26 | compile rootProject.ext.dependencies["recyclerview-v7"]
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/libraries/smooth-app-bar-layout/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 /Volumes/iMac/workspace/android/bundle/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 | -keep class me.henrytao.smoothappbarlayout.** { *; }
--------------------------------------------------------------------------------
/libraries/smooth-app-bar-layout/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
19 |
20 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/libraries/smooth-app-bar-layout/src/main/java/me/henrytao/smoothappbarlayout/OnOffsetSyncedListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 "Henry Tao "
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package me.henrytao.smoothappbarlayout;
18 |
19 | import android.support.design.widget.AppBarLayout;
20 |
21 | /**
22 | * Created by henrytao on 10/4/15.
23 | */
24 | public interface OnOffsetSyncedListener {
25 |
26 | void onOffsetSynced(AppBarLayout appBarLayout);
27 | }
28 |
--------------------------------------------------------------------------------
/libraries/smooth-app-bar-layout/src/main/java/me/henrytao/smoothappbarlayout/PagerAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 "Henry Tao "
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package me.henrytao.smoothappbarlayout;
18 |
19 | import android.view.View;
20 |
21 | /**
22 | * Created by henrytao on 10/3/15.
23 | */
24 | public interface PagerAdapter {
25 |
26 | View getScrollView(int position);
27 |
28 | int onViewPagerSelected(int position, int offset);
29 | }
30 |
--------------------------------------------------------------------------------
/libraries/smooth-app-bar-layout/src/main/java/me/henrytao/smoothappbarlayout/ScrollFlag.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 "Henry Tao "
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package me.henrytao.smoothappbarlayout;
18 |
19 | import android.support.design.widget.AppBarLayout;
20 | import android.view.View;
21 | import android.view.ViewGroup;
22 |
23 | /**
24 | * Created by henrytao on 10/4/15.
25 | */
26 | public class ScrollFlag {
27 |
28 | private int mFlags;
29 |
30 | private View vView;
31 |
32 | public ScrollFlag(AppBarLayout layout) {
33 | if (layout != null) {
34 | int i = 0;
35 | for (int z = layout.getChildCount(); i < z; ++i) {
36 | View child = layout.getChildAt(i);
37 | ViewGroup.LayoutParams layoutParams = child.getLayoutParams();
38 | if (layoutParams instanceof AppBarLayout.LayoutParams) {
39 | AppBarLayout.LayoutParams childLp = (AppBarLayout.LayoutParams) layoutParams;
40 | int flags = childLp.getScrollFlags();
41 | if ((flags & AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL) != 0) {
42 | vView = child;
43 | mFlags = flags;
44 | break;
45 | }
46 | }
47 | }
48 | }
49 | }
50 |
51 | public View getView() {
52 | return vView;
53 | }
54 |
55 | public boolean isFlagEnterAlwaysCollapsedEnabled() {
56 | if (vView != null && (mFlags & AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS) != 0) {
57 | return true;
58 | }
59 | return false;
60 | }
61 |
62 | public boolean isFlagEnterAlwaysEnabled() {
63 | if (vView != null && (mFlags & AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED) != 0) {
64 | return true;
65 | }
66 | return false;
67 | }
68 |
69 | public boolean isFlagExitUntilCollapsedEnabled() {
70 | if (vView != null && (mFlags & AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED) != 0) {
71 | return true;
72 | }
73 | return false;
74 | }
75 |
76 | public boolean isFlagScrollEnabled() {
77 | if (vView != null && (mFlags & AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL) != 0) {
78 | return true;
79 | }
80 | return false;
81 | }
82 |
83 | public boolean isQuickReturnEnabled() {
84 | return isFlagEnterAlwaysEnabled() && isFlagEnterAlwaysCollapsedEnabled();
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/libraries/smooth-app-bar-layout/src/main/java/me/henrytao/smoothappbarlayout/ScrollState.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 "Henry Tao "
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package me.henrytao.smoothappbarlayout;
18 |
19 | /**
20 | * Created by henrytao on 10/5/15.
21 | */
22 | public class ScrollState {
23 |
24 | private int mIdealOffset;
25 |
26 | private int mOffset = 0;
27 |
28 | private State mState = State.DEFAULT;
29 |
30 | public ScrollState() {
31 | }
32 |
33 | public int getOffset() {
34 | if (mState == State.DEFAULT) {
35 | return mIdealOffset;
36 | }
37 | return Math.max(mOffset, mIdealOffset);
38 | }
39 |
40 | public void setOffset(int offset, int idealOffset) {
41 | mOffset = mState == State.SCROLLED ? Math.max(mOffset, offset) : offset;
42 | mIdealOffset = idealOffset;
43 | }
44 |
45 | public void setState(State state) {
46 | mState = state;
47 | if (mState == State.DEFAULT) {
48 | mOffset = 0;
49 | }
50 | }
51 |
52 | public enum State {
53 | DEFAULT, SCROLLED
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/libraries/smooth-app-bar-layout/src/main/java/me/henrytao/smoothappbarlayout/widget/NestedScrollView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 "Henry Tao "
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package me.henrytao.smoothappbarlayout.widget;
18 |
19 | import android.content.Context;
20 | import android.util.AttributeSet;
21 |
22 | import java.util.ArrayList;
23 | import java.util.List;
24 |
25 | /**
26 | * Created by henrytao on 10/1/15.
27 | */
28 | public class NestedScrollView extends android.support.v4.widget.NestedScrollView {
29 |
30 | protected List mOnScrollListeners;
31 |
32 | public NestedScrollView(Context context) {
33 | super(context);
34 | }
35 |
36 | public NestedScrollView(Context context, AttributeSet attrs) {
37 | super(context, attrs);
38 | }
39 |
40 | public NestedScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
41 | super(context, attrs, defStyleAttr);
42 | }
43 |
44 | @Override
45 | protected void onScrollChanged(int l, int t, int oldl, int oldt) {
46 | super.onScrollChanged(l, t, oldl, oldt);
47 | if (mOnScrollListeners != null) {
48 | int i = 0;
49 | for (int n = mOnScrollListeners.size(); i < n; i++) {
50 | mOnScrollListeners.get(i).onScrolled(this, l - oldl, t - oldt);
51 | }
52 | }
53 | }
54 |
55 | public void addOnScrollListener(OnScrollListener onScrollListener) {
56 | if (mOnScrollListeners == null) {
57 | mOnScrollListeners = new ArrayList<>();
58 | }
59 | mOnScrollListeners.add(onScrollListener);
60 | }
61 |
62 | public interface OnScrollListener {
63 |
64 | void onScrolled(android.support.v4.widget.NestedScrollView nestedScrollView, int dx, int dy);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/libraries/smooth-app-bar-layout/src/main/res/values/attrs_smooth_app_bar_layout.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/libraries/smooth-app-bar-layout/src/main/res/values/attrs_smooth_collapsing_toolbar_layout.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/libraries/smooth-app-bar-layout/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/libraries/smooth-app-bar-layout/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | SmoothAppBarLayout
19 |
--------------------------------------------------------------------------------
/screenshots/daniu.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/screenshots/daniu.gif
--------------------------------------------------------------------------------
/screenshots/s0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/screenshots/s0.jpg
--------------------------------------------------------------------------------
/screenshots/s1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/screenshots/s1.jpg
--------------------------------------------------------------------------------
/screenshots/s2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/screenshots/s2.jpg
--------------------------------------------------------------------------------
/screenshots/s3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/screenshots/s3.jpg
--------------------------------------------------------------------------------
/screenshots/s4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/screenshots/s4.jpg
--------------------------------------------------------------------------------
/screenshots/s5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/screenshots/s5.jpg
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':libraries:headsupcompat', ':libraries:smooth-app-bar-layout'
2 |
--------------------------------------------------------------------------------
/sketch/ic_meizhi.sketch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zddhub/Meiniu/f773e70024f2bd45286be2690dac87c9063eb067/sketch/ic_meizhi.sketch
--------------------------------------------------------------------------------