├── app ├── .gitignore ├── libs │ ├── armeabi │ │ └── libbspatch.so │ └── umeng-update-v2.6.0.1.jar ├── src │ ├── beta │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ └── strings.xml │ │ │ └── menu │ │ │ └── menu_main.xml │ └── main │ │ ├── res │ │ ├── drawable-xhdpi │ │ │ ├── splash_5.jpg │ │ │ └── bg_card.9.png │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── ids.xml │ │ │ ├── tb_munion_strings.xml │ │ │ ├── colors.xml │ │ │ ├── styles.xml │ │ │ ├── dimens.xml │ │ │ ├── umeng_update_string.xml │ │ │ ├── umeng_common_strings.xml │ │ │ └── strings.xml │ │ ├── drawable │ │ │ ├── umeng_update_wifi_disable.png │ │ │ ├── umeng_update_button_ok_bg_tap.xml │ │ │ ├── umeng_update_button_cancel_bg_tap.xml │ │ │ ├── umeng_update_dialog_bg.xml │ │ │ ├── umeng_update_button_ok_bg_focused.xml │ │ │ ├── umeng_update_button_cancel_bg_focused.xml │ │ │ ├── shape_material_button_press.xml │ │ │ ├── umeng_update_button_cancel_bg_normal.xml │ │ │ ├── umeng_update_button_ok_bg_normal.xml │ │ │ ├── umeng_common_gradient_red.xml │ │ │ ├── tb_munion_item_selector.xml │ │ │ ├── umeng_common_gradient_green.xml │ │ │ ├── umeng_common_gradient_orange.xml │ │ │ ├── tb_munion_icon.xml │ │ │ ├── umeng_update_title_bg.xml │ │ │ ├── ic_star_filled.xml │ │ │ ├── ic_email.xml │ │ │ ├── umeng_update_button_ok_bg_selector.xml │ │ │ ├── ic_issues.xml │ │ │ ├── ic_issues_white.xml │ │ │ ├── umeng_update_button_close_bg_selector.xml │ │ │ ├── umeng_update_button_cancel_bg_selector.xml │ │ │ ├── ic_profile.xml │ │ │ ├── ic_brower.xml │ │ │ ├── ic_describe.xml │ │ │ ├── ic_bug.xml │ │ │ ├── ic_github.xml │ │ │ └── umeng_update_button_check_selector.xml │ │ ├── drawable-hdpi │ │ │ ├── umeng_update_close_bg_tap.png │ │ │ ├── umeng_update_close_bg_normal.png │ │ │ ├── umeng_update_btn_check_on_holo_light.png │ │ │ ├── umeng_update_btn_check_off_holo_light.png │ │ │ ├── umeng_update_btn_check_on_focused_holo_light.png │ │ │ ├── umeng_update_btn_check_on_pressed_holo_light.png │ │ │ ├── umeng_update_btn_check_off_focused_holo_light.png │ │ │ └── umeng_update_btn_check_off_pressed_holo_light.png │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ ├── menu │ │ │ ├── menu_girl_detail.xml │ │ │ ├── menu_gank.xml │ │ │ ├── menu_web.xml │ │ │ └── menu_main.xml │ │ ├── layout │ │ │ ├── dialog_webview.xml │ │ │ ├── gank_item_category.xml │ │ │ ├── tb_munion_aditem.xml │ │ │ ├── activity_girl_detail.xml │ │ │ ├── activity_web.xml │ │ │ ├── model_toolbar.xml │ │ │ ├── activity_main.xml │ │ │ ├── activity_view_list.xml │ │ │ ├── gank_item_girl.xml │ │ │ ├── gank_item_normal.xml │ │ │ ├── index_item.xml │ │ │ ├── tb_munion_adview.xml │ │ │ ├── umeng_common_download_notification.xml │ │ │ └── umeng_update_dialog.xml │ │ ├── values-zh │ │ │ ├── umeng_update_string.xml │ │ │ └── umeng_common_strings.xml │ │ └── layout-v9 │ │ │ └── umeng_common_download_notification.xml │ │ ├── java │ │ └── com │ │ │ └── gudong │ │ │ └── gankio │ │ │ ├── core │ │ │ ├── GankCategory.java │ │ │ ├── MainFactory.java │ │ │ ├── GuDong.java │ │ │ └── MainRetrofit.java │ │ │ ├── data │ │ │ ├── BaseData.java │ │ │ ├── entity │ │ │ │ ├── Soul.java │ │ │ │ ├── Girl.java │ │ │ │ └── Gank.java │ │ │ ├── RestData.java │ │ │ ├── PrettyGirlData.java │ │ │ └── GankData.java │ │ │ ├── ui │ │ │ ├── view │ │ │ │ ├── ICustomDialog.java │ │ │ │ ├── IBaseView.java │ │ │ │ ├── IWebView.java │ │ │ │ ├── IGirlFaceView.java │ │ │ │ ├── ISwipeRefreshView.java │ │ │ │ ├── IViewListView.java │ │ │ │ └── IMainView.java │ │ │ ├── widget │ │ │ │ └── RatioImageView.java │ │ │ ├── fragment │ │ │ │ └── CustomWebViewDialog.java │ │ │ ├── activity │ │ │ │ ├── BaseSwipeRefreshActivity.java │ │ │ │ ├── BaseActivity.java │ │ │ │ ├── AboutActivity.java │ │ │ │ ├── WebActivity.java │ │ │ │ ├── ViewListActivity.java │ │ │ │ ├── GirlFaceActivity.java │ │ │ │ └── MainActivity.java │ │ │ └── adapter │ │ │ │ └── ViewListAdapter.java │ │ │ ├── util │ │ │ ├── TaskUtils.java │ │ │ ├── StringStyleUtils.java │ │ │ ├── DateUtil.java │ │ │ ├── DialogUtil.java │ │ │ ├── ToastUtils.java │ │ │ └── AndroidUtils.java │ │ │ ├── GankApp.java │ │ │ └── presenter │ │ │ ├── BasePresenter.java │ │ │ ├── WebPresenter.java │ │ │ ├── GirlFacePresenter.java │ │ │ ├── CustomDialogPresenter.java │ │ │ └── ViewListPresenter.java │ │ ├── assets │ │ ├── about_gank_site.html │ │ ├── changelog.html │ │ └── about_gank_app.html │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── art ├── download.png └── gank_introduce.png ├── .gitignore ├── GankDaily.iml ├── gradle.properties ├── gradlew.bat ├── readme.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /art/download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/art/download.png -------------------------------------------------------------------------------- /art/gank_introduce.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/art/gank_introduce.png -------------------------------------------------------------------------------- /app/libs/armeabi/libbspatch.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/libs/armeabi/libbspatch.so -------------------------------------------------------------------------------- /app/libs/umeng-update-v2.6.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/libs/umeng-update-v2.6.0.1.jar -------------------------------------------------------------------------------- /app/src/beta/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/beta/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/beta/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/beta/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/splash_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/drawable-xhdpi/splash_5.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/beta/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/beta/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/beta/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/beta/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/bg_card.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/drawable-xhdpi/bg_card.9.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/beta/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/beta/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_wifi_disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/drawable/umeng_update_wifi_disable.png -------------------------------------------------------------------------------- /app/src/beta/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GankDailyBeta 3 | 意见反馈 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_update_close_bg_tap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/drawable-hdpi/umeng_update_close_bg_tap.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_update_close_bg_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/drawable-hdpi/umeng_update_close_bg_normal.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_update_btn_check_on_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/drawable-hdpi/umeng_update_btn_check_on_holo_light.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_update_btn_check_off_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/drawable-hdpi/umeng_update_btn_check_off_holo_light.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_update_btn_check_on_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/drawable-hdpi/umeng_update_btn_check_on_focused_holo_light.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_update_btn_check_on_pressed_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/drawable-hdpi/umeng_update_btn_check_on_pressed_holo_light.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_update_btn_check_off_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/drawable-hdpi/umeng_update_btn_check_off_focused_holo_light.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_update_btn_check_off_pressed_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maoruibin/GankDaily/HEAD/app/src/main/res/drawable-hdpi/umeng_update_btn_check_off_pressed_holo_light.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /gradle.properties 4 | /.idea 5 | /.idea/workspace.xml 6 | /.idea/gradle.xml 7 | /.idea/libraries 8 | /app/app.iml 9 | .DS_Store 10 | /build 11 | /captures 12 | /picture 13 | /GankIO.iml -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_ok_bg_tap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_cancel_bg_tap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/tb_munion_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #e3e3e3 5 | 正在下载: 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_dialog_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_ok_bg_focused.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_cancel_bg_focused.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_material_button_press.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_cancel_bg_normal.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_ok_bg_normal.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_common_gradient_red.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/tb_munion_item_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_common_gradient_green.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_common_gradient_orange.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/tb_munion_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_title_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #000000 4 | #ffffff 5 | #212121 6 | 7 | #130c0e 8 | #130c0e 9 | #130c0e 10 | #64000000 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_star_filled.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_girl_detail.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_email.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_gank.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_ok_bg_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_issues.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_issues_white.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_close_bg_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_webview.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_cancel_bg_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/gank_item_category.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_profile.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/tb_munion_aditem.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_girl_detail.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_brower.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_web.xml: -------------------------------------------------------------------------------- 1 | 5 | 9 | 13 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_describe.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh/umeng_update_string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 未联网 4 | 发现新版本 5 | 最新版本: 6 | 更新内容 7 | 仅需要下载: 8 | 新版本大小: 9 | (提示:非WIFI环境) 10 | 立即更新 11 | 应用更新 12 | 以后再说 13 | 忽略该版 14 | 正在更新中.... 15 | 最新版本已下载,是否安装? 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_bug.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_web.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 14 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 13 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/model_toolbar.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 16dp 7 | 8dp 8 | 9 | 10dp 10 | 14dp 11 | 16dp 12 | 24dp 13 | 60dp 14 | 72dp 15 | 16 | 14dp 17 | 16dp 18 | 24dp 19 | 16dp 20 | 21 | 96dp 22 | 18 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 11 | 12 | 17 | 18 | 23 | 24 | -------------------------------------------------------------------------------- /GankDaily.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/values/umeng_update_string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Please make sure you are connected to internet,update failed 5 | New version found 6 | Latest version: 7 | Update Content 8 | Update size: 9 | Target size: 10 | (Warning: Not WIFI Condition) 11 | Update now 12 | App updating 13 | Not now 14 | Ingore this 15 | Updating.... 16 | The lastest version has been downloaded, install now ? 17 | 2.6.0.1.20150312 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 16 | 17 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/core/GankCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.core; 21 | 22 | public enum GankCategory { 23 | 福利, 24 | iOS, 25 | Android, 26 | App, 27 | 拓展资源, 28 | 瞎推荐, 29 | 休息视频; 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_github.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | -------------------------------------------------------------------------------- /app/src/beta/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 10 | 11 | 16 | 17 | 21 | 22 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/data/BaseData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.data; 21 | 22 | /** 23 | * Created by GuDong on 9/28/15. 24 | * Contact with gudong.name@gmail.com 25 | */ 26 | public class BaseData { 27 | public boolean error; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/ui/view/ICustomDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.ui.view; 21 | 22 | /** 23 | * Created by GuDong on 11/6/15 15:59. 24 | * Contact with gudong.name@gmail.com. 25 | */ 26 | public interface ICustomDialog extends IBaseView { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/ui/view/IBaseView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.ui.view; 21 | 22 | /** 23 | * 所有项目View的基类 恩,目前是这么想的 24 | * Created by GuDong on 10/29/15 14:23. 25 | * Contact with gudong.name@gmail.com. 26 | */ 27 | public interface IBaseView { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh/umeng_common_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 正在下载中... 4 | 下载出错啦,请检查网络后继续。 5 | 暂停 6 | 继续 7 | 取消 8 | 正在下载: 9 | 暂停: 10 | 正在下载应用 11 | 正在更新安装包 12 | 请连接网络后再尝试! 13 | 下载失败 14 | 下载完成,请点击安装 15 | 更新完成,请点击安装 16 | 新版本已经准备好,请点击安装 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/data/entity/Soul.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.data.entity; 21 | 22 | /** 23 | * Created by GuDong on 15/10/8. 24 | * Contact with gudong.name@gmail.com 25 | */ 26 | public class Soul { 27 | protected long id; 28 | public String objectId; 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/ui/view/IWebView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.ui.view; 21 | 22 | /** 23 | * Created by GuDong on 11/2/15 17:04. 24 | * Contact with gudong.name@gmail.com. 25 | */ 26 | public interface IWebView extends ISwipeRefreshView { 27 | void showLoadErrorMessage(String message); 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/assets/about_gank_site.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 23 | 24 | 25 | 26 |

27 | 干货集中营是一个技术干货共享平台。 28 |

29 |
30 | 每个工作日,网站都会分享一些技术干货信息,包括Android、iOS、App等技术干货,除此之外还有福利和休息视频可供你享用。 31 | 如果你是移动开发者,这个App一定很适合你。当然,如果你是一个宅男,也许你会对每天的福利更感兴趣。Enjoy it。 32 |
33 |

34 | 作者  代码家
35 |

    36 |
  1. Github  
  2. 37 |
  3. 微博  
  4. 38 |
39 |

40 |

41 | 干货集中营:http://gank.io/ 42 |

43 | -------------------------------------------------------------------------------- /app/src/main/assets/changelog.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 23 | 28 | 29 | 30 | 31 |

Version 1.3

32 |

33 | GankDaily,每日提供技术干货的App。 34 |

35 |
    36 |
  1. 优化:更新了主题色
  2. 37 |
  3. 新增:关于页面
  4. 38 |
  5. 删除:纯妹子页面
  6. 39 |
  7. 优化:妹子大图页面
  8. 40 |
41 |

获取最新GankDaily的动态,可通过以下方式

42 | 微博  @大侠咕咚
43 |

44 | 关于GankDaily 45 | -------------------------------------------------------------------------------- /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 | 20 | # if you want build a release type,please set value 21 | 22 | 23 | SIGN_FILE=/Users/mao/Documents/private/key/gudong.jks 24 | SIGN_KEYSTORE_PASS=228560 25 | SIGN_KEYSTORE_ALIAS=desert 26 | SIGN_KEYSTORE_ALIAS_PASS=228560 -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/data/RestData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.data; 21 | 22 | import com.gudong.gankio.data.entity.Gank; 23 | 24 | import java.util.List; 25 | 26 | /** 27 | * Created by GuDong on 15/10/8. 28 | * Contact with gudong.name@gmail.com 29 | */ 30 | public class RestData extends BaseData { 31 | public Listresults; 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/ui/view/IGirlFaceView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.ui.view; 21 | 22 | /** 23 | * Created by GuDong on 11/2/15 18:21. 24 | * Contact with gudong.name@gmail.com. 25 | */ 26 | public interface IGirlFaceView extends IBaseView { 27 | 28 | void saveSuccess(String message); 29 | void showFailInfo(String error); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/data/PrettyGirlData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.data; 21 | 22 | import com.gudong.gankio.data.entity.Girl; 23 | 24 | import java.util.List; 25 | 26 | /** 27 | * 妹子数据集合对象 28 | * Created by GuDong on 9/28/15. 29 | * Contact with gudong.name@gmail.com 30 | */ 31 | public class PrettyGirlData extends BaseData { 32 | public Listresults; 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_view_list.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 14 | 15 | 21 | 22 | 26 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/ui/view/ISwipeRefreshView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.ui.view; 21 | 22 | /** 23 | * if you implement ISwipeRefreshView , you view should be a list view 24 | * Created by GuDong on 10/29/15 18:08. 25 | * Contact with gudong.name@gmail.com. 26 | */ 27 | public interface ISwipeRefreshView extends IBaseView { 28 | 29 | 30 | void getDataFinish(); 31 | 32 | void showEmptyView(); 33 | 34 | void showErrorView(Throwable throwable); 35 | 36 | void showRefresh(); 37 | 38 | void hideRefresh(); 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/res/values/umeng_common_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | The app is already in downloading list. 4 | dowload interrupted. 5 | Pause 6 | Continue 7 | Cancel 8 | Downloading: 9 | Pause: 10 | Download start. 11 | Patch start. 12 | Please make sure you are connected to internet, download failed 13 | Download Failed! 14 | Download finished,click to install it. 15 | Patch finished,click to install it. 16 | New version is ready,click to install it. 17 | icon 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/util/TaskUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.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/com/gudong/gankio/core/MainFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.core; 21 | 22 | /** 23 | * Created by GuDong on 15/10/8. 24 | * Contact with gudong.name@gmail.com 25 | */ 26 | public class MainFactory { 27 | /** 28 | * 数据主机地址 29 | */ 30 | public static final String HOST = "http://gank.io/api"; 31 | 32 | private static GuDong mGuDong; 33 | 34 | protected static final Object monitor = new Object(); 35 | 36 | public static GuDong getGuDongInstance(){ 37 | synchronized (monitor){ 38 | if(mGuDong==null){ 39 | mGuDong = new MainRetrofit().getService(); 40 | } 41 | return mGuDong; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/ui/view/IViewListView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.ui.view; 21 | 22 | import com.gudong.gankio.data.entity.Soul; 23 | 24 | import java.util.List; 25 | 26 | /** 27 | * index view 28 | * Created by GuDong on 10/29/15 14:10. 29 | * Contact with gudong.name@gmail.com. 30 | */ 31 | public interface IViewListView extends ISwipeRefreshView{ 32 | /** 33 | * load data successfully 34 | * @param data 35 | */ 36 | void fillData(List data); 37 | 38 | /** 39 | * append data to history list(load more) 40 | * @param data 41 | */ 42 | void appendMoreDataToView(List data); 43 | 44 | /** 45 | * no more data 46 | */ 47 | void hasNoMoreData(); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/GankApp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio; 21 | 22 | import android.app.Application; 23 | import android.content.Context; 24 | 25 | import com.orhanobut.logger.LogLevel; 26 | import com.orhanobut.logger.Logger; 27 | 28 | /** 29 | * Created by GuDong on 10/14/15 23:42. 30 | * Contact with gudong.name@gmail.com. 31 | */ 32 | public class GankApp extends Application { 33 | public static Context sContext; 34 | @Override 35 | public void onCreate() { 36 | super.onCreate(); 37 | sContext = this; 38 | //只有调试模式下 才启用日志输出 39 | if(BuildConfig.DEBUG){ 40 | Logger.init("Gank").hideThreadInfo().setMethodCount(0); 41 | }else{ 42 | Logger.init("Gank").setLogLevel(LogLevel.NONE); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/presenter/BasePresenter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.presenter; 21 | 22 | import android.app.Activity; 23 | 24 | import com.gudong.gankio.core.GuDong; 25 | import com.gudong.gankio.core.MainFactory; 26 | import com.gudong.gankio.ui.view.IBaseView; 27 | 28 | /** 29 | * Created by GuDong on 10/29/15 14:08. 30 | * Contact with gudong.name@gmail.com. 31 | */ 32 | public class BasePresenter { 33 | 34 | protected GV mView; 35 | /** 36 | * TODO 这里用是否用Activity待考证 37 | */ 38 | protected Activity mContext; 39 | 40 | public static final GuDong mGuDong = MainFactory.getGuDongInstance(); 41 | 42 | public BasePresenter(Activity context, GV view) { 43 | mContext = context; 44 | mView = view; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/gank_item_girl.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 14 | 15 | 25 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/assets/about_gank_app.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 23 | 28 | 29 | 30 | 31 |

32 | GankDaily,每日提供技术干货的App。 33 |

34 |
35 | 本App中所有数据均来自 干货集中营 。 36 |
37 |

38 | 作者  咕咚
39 | 个人主页   40 | 微博   41 | 知乎   42 | Github   43 |
44 |

45 |

46 | 项目开源地址:https://github.com/maoruibin/GankDaily 47 |

48 |

49 | 报告错误或提出需求:https://github.com/maoruibin/GankDaily/issues 50 |

51 |

52 | 感谢  @代码家  @drakeet 53 |

54 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/data/entity/Girl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.data.entity; 21 | 22 | 23 | import java.util.Date; 24 | 25 | /** 26 | * Created by GuDong on 15/10/8. 27 | * Contact with gudong.name@gmail.com 28 | */ 29 | public class Girl extends Soul { 30 | 31 | /** 32 | * createdAt : 2015-10-07T05:42:23.910Z 33 | * publishedAt : 2015-10-08T01:29:48.812Z 34 | * used : true 35 | * type : 福利 36 | * url : http://ww4.sinaimg.cn/large/7a8aed7bgw1ewsip9thfoj20hs0qo774.jpg 37 | * who : 张涵宇 38 | * desc : 10.8 39 | * updatedAt : 2015-10-08T01:29:49.400Z 40 | */ 41 | 42 | public boolean used; 43 | public String type; 44 | public String url; 45 | public String who; 46 | public String desc; 47 | public Date createdAt; 48 | public Date publishedAt; 49 | public Date updatedAt; 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/core/GuDong.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.core; 21 | 22 | import com.gudong.gankio.data.GankData; 23 | import com.gudong.gankio.data.PrettyGirlData; 24 | import com.gudong.gankio.data.RestData; 25 | 26 | import retrofit.http.GET; 27 | import retrofit.http.Path; 28 | import rx.Observable; 29 | 30 | /** 31 | * Created by GuDong on 9/27/15. 32 | * Contact with gudong.name@gmail.com 33 | */ 34 | public interface GuDong { 35 | 36 | @GET("/data/福利/{pagesize}/{page}") 37 | Observable getPrettyGirlData(@Path("pagesize") int pagesize,@Path("page") int page); 38 | 39 | @GET("/data/休息视频/{pagesize}/{page}") 40 | Observable get休息视频Data(@Path("pagesize") int pagesize, @Path("page")int page); 41 | 42 | @GET("/day/{year}/{month}/{day}") 43 | Observable getGankData(@Path("year")int year,@Path("month")int month,@Path("day")int day); 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/data/GankData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.data; 21 | 22 | import com.gudong.gankio.data.entity.Gank; 23 | import com.google.gson.annotations.SerializedName; 24 | 25 | import java.util.List; 26 | 27 | /** 28 | * Created by GuDong on 10/9/15 22:20. 29 | * Contact with gudong.name@gmail.com. 30 | */ 31 | public class GankData extends BaseData { 32 | 33 | public List category; 34 | public Result results; 35 | 36 | public class Result { 37 | @SerializedName("Android") public List androidList; 38 | @SerializedName("休息视频") public List 休息视频List; 39 | @SerializedName("iOS") public List iOSList; 40 | @SerializedName("福利") public List 妹纸List; 41 | @SerializedName("拓展资源") public List 拓展资源List; 42 | @SerializedName("瞎推荐") public List 瞎推荐List; 43 | @SerializedName("App") public List appList; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_check_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 10 | 13 | 16 | 17 | 20 | 23 | 24 | 27 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/util/StringStyleUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.util; 21 | 22 | import android.content.Context; 23 | import android.text.SpannableString; 24 | import android.text.SpannableStringBuilder; 25 | import android.text.style.TextAppearanceSpan; 26 | 27 | import com.gudong.gankio.R; 28 | import com.gudong.gankio.data.entity.Gank; 29 | 30 | public class StringStyleUtils { 31 | 32 | public static SpannableString format(Context context, String text, int style) { 33 | SpannableString spannableString = new SpannableString(text); 34 | spannableString.setSpan(new TextAppearanceSpan(context, style), 0, text.length(), 0); 35 | return spannableString; 36 | } 37 | 38 | public static CharSequence getGankInfoSequence(Context context,Gank mGank) { 39 | SpannableStringBuilder builder = new SpannableStringBuilder(mGank.desc).append( 40 | StringStyleUtils.format(context, " (via. " + mGank.who + ")", R.style.ViaTextAppearance)); 41 | return builder.subSequence(0, builder.length()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/ui/view/IMainView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.ui.view; 21 | 22 | import com.gudong.gankio.data.entity.Soul; 23 | 24 | import java.util.List; 25 | 26 | /** 27 | * Created by GuDong on 11/2/15 14:39. 28 | * Contact with gudong.name@gmail.com. 29 | */ 30 | public interface IMainView extends ISwipeRefreshView { 31 | /** 32 | * load data successfully 33 | * @param data 34 | */ 35 | void fillData(List data); 36 | 37 | /** 38 | * append data to history list(load more) 39 | * @param data 40 | */ 41 | void appendMoreDataToView(List data); 42 | 43 | /** 44 | * no more data for show and this condition is hard to appear,it need you scroll main view long time 45 | * I think it has no body do it like this ,even though,I deal this condition also, In case someone does it. 46 | */ 47 | void hasNoMoreData(); 48 | 49 | /** 50 | * show change log info in a dialog 51 | * @param assetFileName the name of local html file like "changelog.html" 52 | */ 53 | void showChangeLogInfo(String assetFileName); 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/res/layout/gank_item_normal.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 26 | 27 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/index_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 16 | 17 | 23 | 24 | 25 | 34 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/core/MainRetrofit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.core; 21 | 22 | import com.google.gson.Gson; 23 | import com.google.gson.GsonBuilder; 24 | import com.squareup.okhttp.OkHttpClient; 25 | 26 | import java.util.concurrent.TimeUnit; 27 | 28 | import retrofit.RestAdapter; 29 | import retrofit.client.OkClient; 30 | import retrofit.converter.GsonConverter; 31 | 32 | /** 33 | * Created by GuDong on 15/10/8. 34 | * Contact with gudong.name@gmail.com 35 | */ 36 | public class MainRetrofit { 37 | 38 | final GuDong mService; 39 | 40 | final Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").serializeNulls().create(); 41 | 42 | MainRetrofit() { 43 | OkHttpClient client = new OkHttpClient(); 44 | client.setReadTimeout(21, TimeUnit.SECONDS); 45 | RestAdapter restAdapter = new RestAdapter.Builder() 46 | .setClient(new OkClient(client)) 47 | .setEndpoint(MainFactory.HOST) 48 | .setConverter(new GsonConverter(gson)) 49 | .setLogLevel(RestAdapter.LogLevel.FULL) 50 | .build(); 51 | mService = restAdapter.create(GuDong.class); 52 | } 53 | 54 | public GuDong getService(){ 55 | return mService; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/util/DateUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.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 GuDong on 10/9/15 22:06. 29 | * Contact with gudong.name@gmail.com. 30 | */ 31 | public class DateUtil { 32 | 33 | public static String toDate(Date date) { 34 | DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); 35 | return dateFormat.format(date); 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 | public static Date getLastdayDate(Date date) { 46 | Calendar calendar = Calendar.getInstance(); 47 | calendar.setTime(date); 48 | calendar.add(Calendar.DATE, -1); 49 | return calendar.getTime(); 50 | } 51 | 52 | public static Date getNextdayDate(Date date) { 53 | Calendar calendar = Calendar.getInstance(); 54 | calendar.setTime(date); 55 | calendar.add(Calendar.DATE, 1); 56 | return calendar.getTime(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/res/layout/tb_munion_adview.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 12 | 13 | 20 | 21 | 24 | 25 | 32 | 33 | 39 | 40 | 47 | 48 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/util/DialogUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.util; 21 | 22 | import android.content.Context; 23 | import android.support.v4.app.FragmentManager; 24 | import android.support.v7.app.AlertDialog; 25 | 26 | import com.gudong.gankio.R; 27 | import com.gudong.gankio.presenter.CustomDialogPresenter; 28 | 29 | 30 | /** 31 | * tool for dialog 32 | * Created by mao on 7/19/15. 33 | */ 34 | public class DialogUtil { 35 | /** 36 | * show a dialog which it contain one point message only 37 | * @param context context 38 | */ 39 | public static void showSinglePointDialog(Context context, String message){ 40 | new AlertDialog.Builder(context) 41 | .setTitle(R.string.title_point) 42 | .setMessage(message) 43 | .setPositiveButton(R.string.dialog_confirm, null) 44 | .show(); 45 | } 46 | 47 | 48 | /** 49 | * show a custom dialog use a local html file 50 | * @param context 51 | * @param fragmentManager 52 | * @param dialogTitle title 53 | * @param htmlFileName file name 54 | * @param tag 55 | */ 56 | public static void showCustomDialog(Context context, FragmentManager fragmentManager, String dialogTitle, String htmlFileName, String tag) { 57 | int accentColor = AndroidUtils.getAccentColor(context); 58 | CustomDialogPresenter.create(dialogTitle, htmlFileName, accentColor) 59 | .show(fragmentManager, tag); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/data/entity/Gank.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.data.entity; 21 | 22 | import com.gudong.gankio.core.GankCategory; 23 | 24 | import java.io.Serializable; 25 | import java.util.Date; 26 | 27 | /** 28 | * Created by GuDong on 15/10/8. 29 | * Contact with gudong.name@gmail.com 30 | */ 31 | public class Gank extends Soul implements Cloneable,Serializable{ 32 | 33 | /** 34 | * createdAt : 2015-10-06T08:23:35.565Z 35 | * publishedAt : 2015-10-08T01:29:48.811Z 36 | * used : true 37 | * type : 休息视频 38 | * url : http://v.youku.com/v_show/id_XMTY4OTE3OTQ4.html 39 | * who : lxxself 40 | * desc : 耐克还有这广告,我良辰服气 41 | * updatedAt : 2015-10-08T01:29:49.219Z 42 | */ 43 | 44 | public boolean used; 45 | public String type; 46 | public String url; 47 | public String who; 48 | public String desc; 49 | public Date updatedAt; 50 | public Date createdAt; 51 | public Date publishedAt; 52 | 53 | /** 54 | * this item is header type of gank or not,if true, this item will show category name 55 | */ 56 | public boolean isHeader; 57 | 58 | public boolean is妹子(){ 59 | return type.equals(GankCategory.福利.name()); 60 | } 61 | 62 | @Override 63 | public Gank clone() { 64 | Gank gank = null; 65 | try{ 66 | gank = (Gank)super.clone(); 67 | }catch(CloneNotSupportedException e) { 68 | e.printStackTrace(); 69 | } 70 | return gank; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | 22 | 25 | 28 | 29 | 32 | 33 | 34 | 35 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 47 | 48 | 51 | 52 | 55 | 56 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/ui/widget/RatioImageView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.ui.widget; 21 | 22 | import android.content.Context; 23 | import android.util.AttributeSet; 24 | import android.widget.ImageView; 25 | 26 | /** 27 | * Created by GuDong on 10/29/15 21:05. 28 | * Contact with gudong.name@gmail.com. 29 | */ 30 | public class RatioImageView extends ImageView { 31 | private int originalWidth; 32 | private int originalHeight; 33 | 34 | 35 | private int measureWidth; 36 | private int measureHeight; 37 | 38 | public RatioImageView(Context context) { 39 | this(context, null); 40 | } 41 | 42 | public RatioImageView(Context context, AttributeSet attrs) { 43 | this(context, attrs, 0); 44 | } 45 | 46 | public RatioImageView(Context context, AttributeSet attrs, int defStyleAttr) { 47 | super(context, attrs, defStyleAttr); 48 | initView(); 49 | } 50 | 51 | private void initView() { 52 | } 53 | 54 | public void setOriginalSize(int originalWidth, int originalHeight) { 55 | this.originalWidth = originalWidth; 56 | this.originalHeight = originalHeight; 57 | } 58 | 59 | 60 | @Override 61 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 62 | if(originalHeight>0 && originalWidth>0){ 63 | float radio = (float)originalWidth/(float)originalHeight; 64 | 65 | measureWidth = MeasureSpec.getSize(widthMeasureSpec); 66 | measureHeight = MeasureSpec.getSize(heightMeasureSpec); 67 | 68 | if(measureWidth>0){ 69 | measureHeight = (int) ((float)measureWidth/radio); 70 | } 71 | setMeasuredDimension(measureWidth,measureHeight); 72 | }else{ 73 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/util/ToastUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.util; 21 | 22 | import android.content.Context; 23 | import android.widget.Toast; 24 | 25 | import com.gudong.gankio.GankApp; 26 | 27 | /** 28 | * Created by drakeet on 9/27/14. 29 | */ 30 | public class ToastUtils { 31 | 32 | Context mContext; 33 | 34 | private ToastUtils() { 35 | } 36 | 37 | private static void show(Context context, int resId, int duration) { 38 | Toast.makeText(context, resId, duration).show(); 39 | } 40 | 41 | private static void show(Context context, String message, int duration) { 42 | Toast.makeText(context, message, duration).show(); 43 | } 44 | 45 | public static void showShort(int resId) { 46 | Toast.makeText(GankApp.sContext, resId, Toast.LENGTH_SHORT).show(); 47 | } 48 | 49 | public static void showShort(String message) { 50 | Toast.makeText(GankApp.sContext, message, Toast.LENGTH_SHORT).show(); 51 | } 52 | 53 | public static void showLong(int resId) { 54 | Toast.makeText(GankApp.sContext, resId, Toast.LENGTH_LONG).show(); 55 | } 56 | 57 | public static void showLong(String message) { 58 | Toast.makeText(GankApp.sContext, message, Toast.LENGTH_LONG).show(); 59 | } 60 | 61 | public static void showLongLong(String message) { 62 | showLong(message); 63 | showLong(message); 64 | } 65 | 66 | public static void showLongLong(int resId) { 67 | showLong(resId); 68 | showLong(resId); 69 | } 70 | 71 | public static void showLongLongLong(int resId) { 72 | showLong(resId); 73 | showLong(resId); 74 | showShort(resId); 75 | } 76 | 77 | public static void showLongLongLong(String message) { 78 | showLong(message); 79 | showLong(message); 80 | showShort(message); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GankDaily 3 | 4 | Settings 5 | 关于GankDaily 6 | 关于干货集中营 7 | Github Tending 8 | 保存 9 | GirlDetailActivity 10 | 妹子们 11 | WebActivity 12 | 刷新 13 | 分享 14 | 复制链接 15 | 从浏览器打开链接 16 | 复制成功 17 | 打开链接失败 18 | 妹子还没有准备好 19 | 无法加载数据,请检查网络连接。点击可重试。 20 | 妹子见底了,没有更多啦。 21 | 没有更多干货啦(这个提示很难出现哦,看到这个不容易~) 22 | 返回顶部 23 | 图片保存失败,请再次尝试保存! 24 | 图片已保存至 %s 文件夹 25 | 26 | GitHub Trending 27 | Opinion 28 | https://github.com/trending/java 29 | https://github.com/maoruibin/GankDaily/issues 30 | 31 | 提示 32 | 知道了 33 | 确定 34 | 纯 • 妹子 35 | 未知 36 | 更新日志 37 | Version 38 | Rate this app 39 | Report an issue 40 | Having ab issue? Report it here 41 | Author 42 | Fork on Github 43 | Send an email 44 | Social 45 | Twitter 46 | Website 47 | gudong.name@gmail.com 48 | 给 GankDaily 的反馈 49 | Google+ 50 | Weibo 51 | Zhihu 52 | Jianshu 53 | Github 54 | 咕咚 55 | 大侠咕咚 56 | maoruibin 57 | Describe 58 | 59 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # GankDaily 2 | ![icon](/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png "") 3 | 4 | 每日提供技术干货的 App 5 | 6 | ## 下载 7 | [fir](http://fir.im/gankdaily) 8 | 9 | [酷安](http://www.coolapk.com/apk/com.gudong.gankio) 10 | 11 | 12 | 13 | ## 干货数据源 14 | 应用中的所有干货数据均来自[干货集中营](http://gank.io/)。 15 | 16 | ` 干货集中营是一个技术干货共享平台。每个工作日,网站都会分享一些技术干货信息,包括Android、iOS、App等技术干货,除此之外还有福利和休息视频可供你享用。 17 | 如果你是移动开发者,这个App一定很适合你。当然,如果你是一个宅男,也许你会对每天的福利更感兴趣。Enjoy it。` 18 | 19 | ## App设计 20 | 整个项目借鉴自 @drakeet 的[妹纸](https://github.com/drakeet/Meizhi)。但是在原项目基础上, 21 | 自己在代码层面和UI层面上做了自己的修改。 22 | 23 | ### UI设计 24 | 放弃使用瀑布式的妹子流做主页,转而让首页展示当天干货信息,更加注重干货内容(Content)的呈现, 25 | 如下所示,相比原妹纸项目,现在首屏只有一张`福利`图,如果觉得看的不过瘾,应用也提供了纯妹子视图入口,点击首页 26 | 右上角按钮,选择纯妹子,就可以看到所有的妹子们了,更加纯粹的妹子流。 27 | 28 | ![gank_daily_introduce](/art/gank_introduce.png "") 29 | 30 | ### 代码设计 31 | 原项目使用 Retrofit+RxJava 的组合获取网络数据,再加上使用Lambda表达式,代码已经变得很精简,所以把获取数据的代码放在 Activity 中也不显得混乱, 32 | 但是作为一个有追求的程序员,既然已经知道有 MVP 这种架构模式可以解决项目分层的问题, 33 | 那为什么不试着使用 MVP 去对代码进行进一步的优化呢,所以整个项目使用了 MVP 架构,将所有的数据请求、业务逻辑都提取到 Presenter 层中。 34 | 使用 MVP 后需要为每一个 Activity 编写一个对应一个 Presenter(控制器)类,让 Activity 担当纯粹的 View 角色, 35 | 这样 Activity 就主要负责一些界面更新操作,具体的业务逻辑都交托给 Presenter 层处理,代码结构因此也变得更加清晰。 36 | 37 | 更多关于项目中对 MVP 模式的实践,这里自己整理了一篇博客进行详细介绍。 38 | 39 | [MVP 模式在 GankDaily 中的应用](http://gudong.name/advanced/2015/11/23/gank_mvp_introduce.html) 40 | 41 | ## 依赖库 42 | * [RxJava](https://github.com/ReactiveX/RxJava) 43 | * [OkHttp](https://github.com/square/okhttp) 44 | * [Picasso](https://github.com/square/picasso) 45 | * [Retrofit](https://github.com/square/retrofit) 46 | * [Butterknife](https://github.com/JakeWharton/butterknife) 47 | * [Logger](https://github.com/orhanobut/logger) 48 | 49 | ## 参考资料 50 | * [drakeet/Meizhi](https://github.com/drakeet/Meizhi) 51 | * [浅谈 MVP in Android](http://blog.csdn.net/lmj623565791/article/details/46596109) 52 | * [Effective Android UI](https://github.com/pedrovgs/EffectiveAndroidUI) 53 | 54 | ## Author 55 | * [http://gudong.name](http://gudong.name) 56 | * [https://github.com/maoruibin](https://github.com/maoruibin) 57 | * [http://weibo.com/maoruibin](http://weibo.com/maoruibin) 58 | 59 | ## License 60 | 61 | /* 62 | * 63 | * Copyright (C) 2015 Drakeet 64 | * Copyright (C) 2015 GuDong 65 | * 66 | * Meizhi is free software: you can redistribute it and/or modify 67 | * it under the terms of the GNU General Public License as published by 68 | * the Free Software Foundation, either version 3 of the License, or 69 | * (at your option) any later version. 70 | * 71 | * Meizhi is distributed in the hope that it will be useful, 72 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 73 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 74 | * GNU General Public License for more details. 75 | * 76 | * You should have received a copy of the GNU General Public License 77 | * along with Meizhi. If not, see . 78 | */ 79 | 80 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/presenter/WebPresenter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.presenter; 21 | 22 | import android.app.Activity; 23 | import android.graphics.Bitmap; 24 | import android.net.Uri; 25 | import android.text.TextUtils; 26 | import android.webkit.WebSettings; 27 | import android.webkit.WebView; 28 | import android.webkit.WebViewClient; 29 | 30 | import com.gudong.gankio.ui.view.IWebView; 31 | 32 | /** 33 | * Created by GuDong on 11/2/15 17:05. 34 | * Contact with gudong.name@gmail.com. 35 | */ 36 | public class WebPresenter extends BasePresenter { 37 | public WebPresenter(Activity context, IWebView view) { 38 | super(context, view); 39 | } 40 | 41 | public void setUpWebView(WebView webView){ 42 | WebSettings settings = webView.getSettings(); 43 | settings.setJavaScriptEnabled(true); 44 | settings.setLoadWithOverviewMode(true); 45 | settings.setAppCacheEnabled(true); 46 | settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); 47 | settings.setSupportZoom(true); 48 | webView.setWebViewClient(new LoveClient()); 49 | } 50 | 51 | public void loadUrl(WebView webView,String url){ 52 | webView.loadUrl(url); 53 | } 54 | 55 | private class LoveClient extends WebViewClient { 56 | 57 | public boolean shouldOverrideUrlLoading(WebView view, String url) { 58 | if (TextUtils.isEmpty(url)){ 59 | return true; 60 | } 61 | if(Uri.parse(url).getHost().equals("github.com")){ 62 | return false; 63 | } 64 | view.loadUrl(url); 65 | return true; 66 | } 67 | 68 | @Override 69 | public void onPageStarted(WebView view, String url, Bitmap favicon) { 70 | super.onPageStarted(view, url, favicon); 71 | mView.showRefresh(); 72 | } 73 | 74 | @Override 75 | public void onPageFinished(WebView view, String url) { 76 | super.onPageFinished(view, url); 77 | mView.hideRefresh(); 78 | } 79 | 80 | @Override 81 | public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { 82 | super.onReceivedError(view, errorCode, description, failingUrl); 83 | mView.hideRefresh(); 84 | mView.showLoadErrorMessage(description); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/ui/fragment/CustomWebViewDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.ui.fragment; 21 | 22 | import android.app.Dialog; 23 | import android.content.Context; 24 | import android.os.Bundle; 25 | import android.support.annotation.NonNull; 26 | import android.support.v4.app.DialogFragment; 27 | import android.view.InflateException; 28 | import android.view.LayoutInflater; 29 | import android.view.View; 30 | import android.webkit.JavascriptInterface; 31 | import android.webkit.WebView; 32 | import android.widget.Toast; 33 | 34 | import com.gudong.gankio.R; 35 | import com.gudong.gankio.presenter.CustomDialogPresenter; 36 | import com.gudong.gankio.ui.view.ICustomDialog; 37 | import com.gudong.gankio.util.DialogUtil; 38 | 39 | /** 40 | * CustomWebViewDialog 41 | * @author mao 42 | */ 43 | public class CustomWebViewDialog extends DialogFragment implements ICustomDialog { 44 | private CustomDialogPresenter mPresenter; 45 | private WebView mWebView; 46 | @Override 47 | public void onCreate(Bundle savedInstanceState) { 48 | super.onCreate(savedInstanceState); 49 | mPresenter = new CustomDialogPresenter(getActivity(),this); 50 | } 51 | 52 | @NonNull 53 | @Override 54 | public Dialog onCreateDialog(Bundle savedInstanceState) { 55 | final View customView; 56 | try { 57 | customView = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_webview, null); 58 | mWebView = (WebView) customView.findViewById(R.id.webview); 59 | mWebView.addJavascriptInterface(new WebAppInterface(customView.getContext()),"Android"); 60 | } catch (InflateException e) { 61 | throw new IllegalStateException("This device does not support Web Views."); 62 | } 63 | return mPresenter.makeOkDialog(this,customView); 64 | } 65 | 66 | public class WebAppInterface { 67 | Context mContext; 68 | 69 | /** Instantiate the interface and set the context */ 70 | WebAppInterface(Context c) { 71 | mContext = c; 72 | } 73 | 74 | /** Show a toast from the web page */ 75 | @JavascriptInterface 76 | public void showToast(String toast) { 77 | Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show(); 78 | } 79 | 80 | /** Show a dialog about app **/ 81 | @JavascriptInterface 82 | public void showAbout(){ 83 | DialogUtil.showCustomDialog(getActivity(), getFragmentManager(), getString(R.string.action_about), "about_gank_app.html", "app"); 84 | } 85 | 86 | /** Show a dialog about gank site **/ 87 | @JavascriptInterface 88 | public void showAboutGank(){ 89 | DialogUtil.showCustomDialog(getActivity(), getFragmentManager(), getString(R.string.action_about_gank), "about_gank_site.html", "site"); 90 | } 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/ui/activity/BaseSwipeRefreshActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.ui.activity; 21 | 22 | import android.os.Bundle; 23 | import android.support.annotation.CheckResult; 24 | import android.support.v4.widget.SwipeRefreshLayout; 25 | 26 | import com.gudong.gankio.R; 27 | import com.gudong.gankio.presenter.BasePresenter; 28 | import com.gudong.gankio.ui.view.ISwipeRefreshView; 29 | 30 | import butterknife.Bind; 31 | 32 | /** 33 | * base activity for that have a function with swipe refresh 34 | * Created by GuDong on 10/29/15 18:06. 35 | * Contact with gudong.name@gmail.com. 36 | */ 37 | public abstract class BaseSwipeRefreshActivity

extends BaseActivity

implements ISwipeRefreshView { 38 | 39 | @Bind(R.id.swipe_refresh_layout) 40 | protected SwipeRefreshLayout mSwipeRefreshLayout; 41 | 42 | @Override 43 | protected void onCreate(Bundle savedInstanceState) { 44 | super.onCreate(savedInstanceState); 45 | initSwipeLayout(); 46 | } 47 | 48 | private void initSwipeLayout(){ 49 | mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorPrimaryDark, R.color.colorAccent); 50 | mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { 51 | @Override 52 | public void onRefresh() { 53 | if (prepareRefresh()) { 54 | onRefreshStarted(); 55 | } else { 56 | //产生一个加载数据的假象 57 | hideRefresh(); 58 | } 59 | } 60 | }); 61 | } 62 | 63 | /** 64 | * check data status 65 | * @return return true indicate it should load data really else indicate don't refresh 66 | */ 67 | protected boolean prepareRefresh(){ 68 | return true; 69 | } 70 | 71 | /** 72 | * the method of get data 73 | */ 74 | protected abstract void onRefreshStarted(); 75 | 76 | @Override 77 | public void hideRefresh() { 78 | // 防止刷新消失太快,让子弹飞一会儿. do not use lambda!! 79 | mSwipeRefreshLayout.postDelayed(new Runnable() { 80 | @Override 81 | public void run() { 82 | if(mSwipeRefreshLayout != null){ 83 | mSwipeRefreshLayout.setRefreshing(false); 84 | } 85 | } 86 | },1000); 87 | } 88 | 89 | @Override 90 | public void showRefresh() { 91 | mSwipeRefreshLayout.setRefreshing(true); 92 | } 93 | 94 | /** 95 | * check refresh layout is refreshing 96 | * @return if the refresh layout is refreshing return true else return false 97 | */ 98 | @CheckResult 99 | protected boolean isRefreshing(){ 100 | return mSwipeRefreshLayout.isRefreshing(); 101 | } 102 | 103 | @Override 104 | public void getDataFinish() { 105 | hideRefresh(); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /app/src/main/java/com/gudong/gankio/ui/activity/BaseActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) 2015 Drakeet 4 | * Copyright (C) 2015 GuDong 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 com.gudong.gankio.ui.activity; 21 | 22 | import android.os.Bundle; 23 | import android.support.v7.app.AppCompatActivity; 24 | import android.support.v7.widget.Toolbar; 25 | import android.view.Menu; 26 | import android.view.MenuItem; 27 | 28 | import com.gudong.gankio.R; 29 | import com.gudong.gankio.presenter.BasePresenter; 30 | import com.umeng.analytics.MobclickAgent; 31 | 32 | import butterknife.Bind; 33 | import butterknife.ButterKnife; 34 | 35 | /** 36 | * Created by GuDong on 10/14/15 23:05. 37 | * Contact with gudong.name@gmail.com. 38 | */ 39 | public abstract class BaseActivity

extends AppCompatActivity { 40 | @Bind(R.id.toolbar) 41 | protected Toolbar mToolbar; 42 | /** 43 | * the presenter of this Activity 44 | */ 45 | protected P mPresenter; 46 | 47 | /** 48 | * TODO use Dagger2 instance Presenter 49 | */ 50 | protected abstract void initPresenter(); 51 | 52 | /** 53 | * set layout of this activity 54 | * 55 | * @return the id of layout 56 | */ 57 | protected abstract int getLayout(); 58 | 59 | @Override 60 | protected void onCreate(Bundle savedInstanceState) { 61 | super.onCreate(savedInstanceState); 62 | setContentView(getLayout()); 63 | ButterKnife.bind(this); 64 | initPresenter(); 65 | checkPresenterIsNull(); 66 | initToolBar(); 67 | } 68 | 69 | @Override 70 | protected void onResume() { 71 | super.onResume(); 72 | MobclickAgent.onResume(this); 73 | } 74 | 75 | @Override 76 | protected void onPause() { 77 | super.onPause(); 78 | MobclickAgent.onPause(this); 79 | } 80 | 81 | private void checkPresenterIsNull() { 82 | if (mPresenter == null) { 83 | throw new IllegalStateException("please init mPresenter in initPresenter() method "); 84 | } 85 | } 86 | 87 | /** 88 | * set the id of menu 89 | * 90 | * @return if values is less then zero ,and the activity will not show menu 91 | */ 92 | protected int getMenuRes() { 93 | return -1; 94 | } 95 | 96 | ; 97 | 98 | @Override 99 | public boolean onCreateOptionsMenu(Menu menu) { 100 | if (getMenuRes() < 0) return true; 101 | getMenuInflater().inflate(getMenuRes(), menu); 102 | return true; 103 | } 104 | 105 | @Override 106 | public boolean onOptionsItemSelected(MenuItem item) { 107 | switch (item.getItemId()) { 108 | case android.R.id.home: 109 | //don't use finish() and use onBackPressed() will be a good practice , trust me ! 110 | onBackPressed(); 111 | break; 112 | } 113 | return super.onOptionsItemSelected(item); 114 | } 115 | 116 | final private void initToolBar() { 117 | if (mToolbar == null) { 118 | throw new NullPointerException("please add a Toolbar in your layout."); 119 | } 120 | setSupportActionBar(mToolbar); 121 | } 122 | 123 | public void setTitle(String strTitle, boolean showHome) { 124 | setTitle(strTitle); 125 | getSupportActionBar().setDisplayShowHomeEnabled(showHome); 126 | getSupportActionBar().setDisplayHomeAsUpEnabled(showHome); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/drakeet/Applications/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | -dontwarn com.squareup.okhttp.** 20 | 21 | -keep class butterknife.** { *; } 22 | -dontwarn butterknife.internal.** 23 | -keep class **$$ViewBinder { *; } 24 | 25 | -keepclasseswithmembernames class * { 26 | @butterknife.* ; 27 | } 28 | 29 | -keepclasseswithmembernames class * { 30 | @butterknife.* ; 31 | } 32 | 33 | -keepattributes *Annotation* 34 | -keepclassmembers class ** { 35 | @com.squareup.otto.Subscribe public *; 36 | @com.squareup.otto.Produce public *; 37 | } 38 | 39 | 40 | -keep public class com.gudong.gankio.R$*{ 41 | public static final int *; 42 | } 43 | 44 | -keep public class com.umeng.fb.ui.ThreadView {} 45 | 46 | -keep class com.gudong.gankio.BuildConfig { *; } 47 | -keep public class * extends android.os.Binder 48 | 49 | # Keep the support library 50 | -keep class android.support.** { *; } 51 | -keep interface android.support.** { *; } 52 | 53 | # For using GSON @Expose annotation 54 | -keepattributes *Annotation* 55 | 56 | -keepattributes EnclosingMethod 57 | 58 | # Gson specific classes 59 | -keep class sun.misc.Unsafe { *; } 60 | -keep class com.google.gson.stream.** { *; } 61 | 62 | -keepclassmembers enum * { 63 | public static **[] values(); 64 | public static ** valueOf(java.lang.String); 65 | } 66 | 67 | -keep class * implements android.os.Parcelable { 68 | public static final android.os.Parcelable$Creator *; 69 | } 70 | 71 | -keepattributes Signature 72 | -keep class **.R$* {*;} 73 | -ignorewarnings 74 | 75 | -verbose 76 | -keepclasseswithmembernames class * { 77 | native ; 78 | } 79 | 80 | -keep class com.gudong.gankio.** { *;} 81 | 82 | -keepclasseswithmembernames class * { 83 | native ; 84 | } 85 | 86 | -keep class android.support.v8.renderscript.** { *; } 87 | 88 | # ActiveAndroid 89 | -keep class com.activeandroid.** { *; } 90 | -keep class com.activeandroid.**.** { *; } 91 | -keep class * extends com.activeandroid.Model 92 | -keep class * extends com.activeandroid.serializer.TypeSerializer 93 | 94 | 95 | # Remove logging calls 96 | -assumenosideeffects class android.util.Log { 97 | public static boolean isLoggable(java.lang.String, int); 98 | public static int v(...); 99 | public static int i(...); 100 | public static int w(...); 101 | public static int d(...); 102 | public static int e(...); 103 | } 104 | 105 | # For Guava: 106 | -dontwarn javax.annotation.** 107 | -dontwarn javax.inject.** 108 | -dontwarn sun.misc.Unsafe 109 | 110 | # For RxJava: 111 | -dontwarn org.mockito.** 112 | -dontwarn org.junit.** 113 | -dontwarn org.robolectric.** 114 | 115 | 116 | -keepattributes Signature 117 | -keepattributes *Annotation* 118 | -keep class com.squareup.okhttp.** { *; } 119 | -keep interface com.squareup.okhttp.** { *; } 120 | -dontwarn com.squareup.okhttp.** 121 | 122 | -dontwarn rx.** 123 | -dontwarn retrofit.** 124 | -keep class retrofit.** { *; } 125 | -keepclasseswithmembers class * { 126 | @retrofit.http.* ; 127 | } 128 | 129 | -keep class sun.misc.Unsafe { *; } 130 | 131 | -dontwarn java.lang.invoke.* 132 | 133 | # 使用注解 134 | -keepattributes *Annotation*,Signature 135 | 136 | # 保持混淆时类的实名及行号(——————— 调试时打开 ———————) 137 | -keepattributes SourceFile,LineNumberTable 138 | 139 | # 枚举需要keep see http://proguard.sourceforge.net/manual/examples.html#enumerations 140 | -keepclassmembers enum * { 141 | **[] $VALUES; 142 | public *; 143 | } 144 | 145 | #glide 146 | -keep public class * implements com.bumptech.glide.module.GlideModule 147 | -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** { 148 | **[] $VALUES; 149 | public *; 150 | } -------------------------------------------------------------------------------- /app/src/main/res/layout-v9/umeng_common_download_notification.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 19 | 20 | 27 | 28 | 29 | 35 | 36 | 46 | 47 |