├── app ├── .gitignore ├── libs │ ├── lite-orm-1.7.0.jar │ ├── armeabi │ │ └── libbspatch.so │ └── umeng-update-v2.6.0.1.jar ├── src │ └── main │ │ ├── res │ │ ├── drawable │ │ │ ├── icon.png │ │ │ ├── list_activated_holo.9.png │ │ │ ├── actionbar_back_indicator.png │ │ │ ├── umeng_update_wifi_disable.png │ │ │ ├── umeng_update_button_cancel_bg_tap.xml │ │ │ ├── umeng_update_button_ok_bg_tap.xml │ │ │ ├── umeng_update_dialog_bg.xml │ │ │ ├── umeng_update_button_ok_bg_focused.xml │ │ │ ├── umeng_update_button_cancel_bg_focused.xml │ │ │ ├── umeng_update_button_cancel_bg_normal.xml │ │ │ ├── umeng_update_button_ok_bg_normal.xml │ │ │ ├── activated_background_holo_light.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 │ │ │ ├── shape_type.xml │ │ │ ├── shape_type_ios.xml │ │ │ ├── shape_type_relax.xml │ │ │ ├── shape_type_android.xml │ │ │ ├── shape_type_extend.xml │ │ │ ├── umeng_update_title_bg.xml │ │ │ ├── umeng_update_button_close_bg_selector.xml │ │ │ ├── umeng_update_button_ok_bg_selector.xml │ │ │ ├── umeng_update_button_cancel_bg_selector.xml │ │ │ ├── actionbar_background.xml │ │ │ ├── actionbar_btn_normal.xml │ │ │ ├── actionbar_btn_pressed.xml │ │ │ ├── actionbar_compat_button.xml │ │ │ ├── umeng_update_button_check_selector.xml │ │ │ └── actionbar_btn.xml │ │ ├── drawable-hdpi │ │ │ ├── icon.jpg │ │ │ ├── ic_about.png │ │ │ ├── ic_back.png │ │ │ ├── ic_close.png │ │ │ ├── ic_menu.png │ │ │ ├── ic_drawer.png │ │ │ ├── ic_github.png │ │ │ ├── ic_trending.png │ │ │ ├── drawer_shadow.9.png │ │ │ ├── umeng_logo_big.png │ │ │ ├── btn_bg_pressed.9.png │ │ │ ├── btn_bg_selected.9.png │ │ │ ├── ic_home_black_48dp.png │ │ │ ├── actionbar_compat_logo.png │ │ │ ├── ic_android_black_48dp.png │ │ │ ├── ic_title_home_default.png │ │ │ ├── ic_title_share_default.png │ │ │ ├── umeng_example_banner_bg.png │ │ │ ├── umeng_example_handler.png │ │ │ ├── umeng_logo_big_subtitle.png │ │ │ ├── actionbar_back_indicator.png │ │ │ ├── ic_face_unlock_black_48dp.png │ │ │ ├── ic_title_refresh_default.png │ │ │ ├── umeng_update_close_bg_tap.png │ │ │ ├── actionbar_compat_separator.9.png │ │ │ ├── umeng_example_two_tab_left.png │ │ │ ├── umeng_example_two_tab_right.png │ │ │ ├── umeng_update_close_bg_normal.png │ │ │ ├── actionbar_compat_background.9.png │ │ │ ├── ic_perm_device_info_black_48dp.png │ │ │ ├── umeng_example_common_banner_promotion.png │ │ │ ├── umeng_update_btn_check_off_holo_light.png │ │ │ ├── umeng_update_btn_check_on_holo_light.png │ │ │ ├── umeng_update_btn_check_off_focused_holo_light.png │ │ │ ├── umeng_update_btn_check_off_pressed_holo_light.png │ │ │ ├── umeng_update_btn_check_on_focused_holo_light.png │ │ │ └── umeng_update_btn_check_on_pressed_holo_light.png │ │ ├── drawable-xxhdpi │ │ │ └── meizhi.png │ │ ├── drawable-xxxhdpi │ │ │ ├── ic_back.png │ │ │ ├── ic_done.png │ │ │ ├── ic_home.png │ │ │ ├── ic_ios.png │ │ │ ├── ic_menu.png │ │ │ ├── ic_save.png │ │ │ ├── ic_android.png │ │ │ ├── ic_close.png │ │ │ ├── ic_github.png │ │ │ ├── ic_meizhi.png │ │ │ ├── ic_share.png │ │ │ ├── ic_favorite.png │ │ │ ├── ic_launcher.png │ │ │ ├── ic_thumb_up.png │ │ │ └── ic_trending.png │ │ ├── values │ │ │ ├── tb_munion_strings.xml │ │ │ ├── colors_actionbar.xml │ │ │ ├── dimens.xml │ │ │ ├── colors.xml │ │ │ ├── colors_umeng.xml │ │ │ ├── strings.xml │ │ │ ├── attrs_umeng.xml │ │ │ ├── styles.xml │ │ │ ├── umeng_update_string.xml │ │ │ ├── umeng_common_strings.xml │ │ │ ├── dimens_umeng.xml │ │ │ ├── strings_umeng.xml │ │ │ ├── styles_umeng.xml │ │ │ └── update_example_strings.xml │ │ ├── values-v21 │ │ │ └── styles.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ ├── values-v11 │ │ │ └── styles.xml │ │ ├── layout │ │ │ ├── umeng_example_tab_indicator.xml │ │ │ ├── fragment_article_list.xml │ │ │ ├── umeng_example_auto_update.xml │ │ │ ├── umeng_example_about_update.xml │ │ │ ├── umeng_example_silent_update.xml │ │ │ ├── activity_main.xml │ │ │ ├── item_meizhi.xml │ │ │ ├── umeng_example_manual_update.xml │ │ │ ├── umeng_example_home_dashboard_fragment.xml │ │ │ ├── nav_header.xml │ │ │ ├── activity_about.xml │ │ │ ├── home_viewpager.xml │ │ │ ├── umeng_example_update_main.xml │ │ │ ├── activity_webview.xml │ │ │ ├── activity_show_img.xml │ │ │ ├── item_article.xml │ │ │ ├── umeng_common_download_notification.xml │ │ │ └── umeng_update_dialog.xml │ │ ├── menu │ │ │ ├── menu_about.xml │ │ │ ├── menu_actions.xml │ │ │ └── drawer_actions.xml │ │ ├── values-zh │ │ │ ├── umeng_update_string.xml │ │ │ ├── umeng_common_strings.xml │ │ │ └── strings.xml │ │ └── layout-v9 │ │ │ └── umeng_common_download_notification.xml │ │ ├── java │ │ └── cn │ │ │ └── chenyuanming │ │ │ └── gankmeizhi │ │ │ ├── constants │ │ │ └── Constants.java │ │ │ ├── beans │ │ │ ├── db │ │ │ │ ├── FavoriteBean.java │ │ │ │ ├── ReadArticles.java │ │ │ │ └── DbGoodsBean.java │ │ │ └── CommonGoodsBean.java │ │ │ ├── application │ │ │ └── GankApplication.java │ │ │ ├── utils │ │ │ ├── ToastUtil.java │ │ │ ├── ClipboardHelper.java │ │ │ ├── ShareUtils.java │ │ │ ├── DbHelper.java │ │ │ ├── TimeHelper.java │ │ │ ├── RecyclerViewLoadHelper.java │ │ │ ├── RxMeizhi.java │ │ │ └── PreferenceUtil.java │ │ │ ├── fragment │ │ │ ├── BaseFragment.java │ │ │ └── GankFragment.java │ │ │ ├── decoration │ │ │ └── SpacesItemDecoration.java │ │ │ ├── activity │ │ │ ├── BaseActivity.java │ │ │ ├── AboutActivity.java │ │ │ ├── ShowBigImageActivity.java │ │ │ ├── MainActivity.java │ │ │ └── WebViewActivity.java │ │ │ ├── adapter │ │ │ ├── MeizhiAdapter.java │ │ │ └── ArticleViewAdapter.java │ │ │ ├── service │ │ │ └── PrefetchService.java │ │ │ └── api │ │ │ └── GankApi.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── screenshot ├── meizhi.jpg ├── Screenshot_1.png ├── Screenshot_2.png ├── Screenshot_3.png ├── Screenshot_4.png └── Screenshot_5.png ├── .gitignore ├── gradle.properties ├── README.md ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /screenshot/meizhi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/screenshot/meizhi.jpg -------------------------------------------------------------------------------- /app/libs/lite-orm-1.7.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/libs/lite-orm-1.7.0.jar -------------------------------------------------------------------------------- /screenshot/Screenshot_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/screenshot/Screenshot_1.png -------------------------------------------------------------------------------- /screenshot/Screenshot_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/screenshot/Screenshot_2.png -------------------------------------------------------------------------------- /screenshot/Screenshot_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/screenshot/Screenshot_3.png -------------------------------------------------------------------------------- /screenshot/Screenshot_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/screenshot/Screenshot_4.png -------------------------------------------------------------------------------- /screenshot/Screenshot_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/screenshot/Screenshot_5.png -------------------------------------------------------------------------------- /app/libs/armeabi/libbspatch.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/libs/armeabi/libbspatch.so -------------------------------------------------------------------------------- /app/libs/umeng-update-v2.6.0.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/libs/umeng-update-v2.6.0.1.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable/icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/icon.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_about.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_close.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/meizhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxhdpi/meizhi.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_github.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_home.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_ios.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_save.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_trending.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_trending.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_android.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_close.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_github.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_meizhi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_meizhi.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_share.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_logo_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/umeng_logo_big.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_favorite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_favorite.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_thumb_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_thumb_up.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_trending.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-xxxhdpi/ic_trending.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/btn_bg_pressed.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/btn_bg_pressed.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/btn_bg_selected.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/btn_bg_selected.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_home_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_home_black_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/list_activated_holo.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable/list_activated_holo.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/actionbar_back_indicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable/actionbar_back_indicator.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_wifi_disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable/umeng_update_wifi_disable.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/actionbar_compat_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/actionbar_compat_logo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_android_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_android_black_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_title_home_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_title_home_default.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_title_share_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_title_share_default.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_example_banner_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/umeng_example_banner_bg.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_example_handler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/umeng_example_handler.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_logo_big_subtitle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/umeng_logo_big_subtitle.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/actionbar_back_indicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/actionbar_back_indicator.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_face_unlock_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_face_unlock_black_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_title_refresh_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_title_refresh_default.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_update_close_bg_tap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/umeng_update_close_bg_tap.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/actionbar_compat_separator.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/actionbar_compat_separator.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_example_two_tab_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/umeng_example_two_tab_left.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_example_two_tab_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/umeng_example_two_tab_right.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_update_close_bg_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/umeng_update_close_bg_normal.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/actionbar_compat_background.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/actionbar_compat_background.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_perm_device_info_black_48dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/ic_perm_device_info_black_48dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_example_common_banner_promotion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/umeng_example_common_banner_promotion.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_update_btn_check_off_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/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_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/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_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/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/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/umeng_update_btn_check_off_pressed_holo_light.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/umeng_update_btn_check_on_focused_holo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cym4u/GankMeizhi/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/cym4u/GankMeizhi/HEAD/app/src/main/res/drawable-hdpi/umeng_update_btn_check_on_pressed_holo_light.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_cancel_bg_tap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_ok_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/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/java/cn/chenyuanming/gankmeizhi/constants/Constants.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.constants; 2 | 3 | /** 4 | * Created by Chen Yuanming on 2016/1/25. 5 | */ 6 | public interface Constants { 7 | int LIMIT = 50; 8 | int START = 1; 9 | String ENDPOINT = "http://gank.avosapps.com/api"; 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/activated_background_holo_light.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /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/drawable/shape_type.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_type_ios.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_type_relax.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_type_android.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_type_extend.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_title_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors_actionbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3A5FCD 4 | #3A5FCD 5 | #27408B 6 | #FFFFFF 7 | #FF7F00 8 | #EE7600 9 | -------------------------------------------------------------------------------- /app/src/main/java/cn/chenyuanming/gankmeizhi/beans/db/FavoriteBean.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.beans.db; 2 | 3 | import com.litesuits.orm.db.annotation.PrimaryKey; 4 | import com.litesuits.orm.db.enums.AssignType; 5 | 6 | import java.util.TreeSet; 7 | 8 | /** 9 | * Created by Chen Yuanming on 2016/1/30. 10 | */ 11 | public class FavoriteBean { 12 | 13 | @PrimaryKey(AssignType.BY_MYSELF) 14 | public int id; 15 | public TreeSet favorites = new TreeSet<>(); 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 256dp 7 | 16dp 8 | 40dp 9 | 10 | 12dp 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_close_bg_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #4000 7 | #000 8 | #2397fc 9 | #00bf96 10 | #fcb43f 11 | #fc765b 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/umeng_example_tab_indicator.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_ok_bg_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/cn/chenyuanming/gankmeizhi/application/GankApplication.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.application; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | 6 | /** 7 | * Created by Chen Yuanming on 2016/1/25. 8 | */ 9 | public class GankApplication extends Application { 10 | static GankApplication instance; 11 | 12 | @Override 13 | public void onCreate() { 14 | super.onCreate(); 15 | instance = this; 16 | } 17 | 18 | public static Context getContext() { 19 | return instance; 20 | } 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/umeng_update_button_cancel_bg_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/cn/chenyuanming/gankmeizhi/beans/db/ReadArticles.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.beans.db; 2 | 3 | import com.litesuits.orm.db.annotation.PrimaryKey; 4 | import com.litesuits.orm.db.annotation.Table; 5 | import com.litesuits.orm.db.enums.AssignType; 6 | 7 | import java.io.Serializable; 8 | import java.util.TreeSet; 9 | 10 | /** 11 | * Created by Chen Yuanming on 2016/1/28. 12 | */ 13 | @Table("ReadArticles") 14 | public class ReadArticles implements Serializable { 15 | @PrimaryKey(AssignType.BY_MYSELF) 16 | public int id; 17 | public TreeSet articles = new TreeSet<>(); 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_article_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/cn/chenyuanming/gankmeizhi/utils/ToastUtil.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.utils; 2 | 3 | import android.widget.Toast; 4 | 5 | import cn.chenyuanming.gankmeizhi.application.GankApplication; 6 | 7 | /** 8 | * Created by Chen Yuanming on 2016/1/30. 9 | */ 10 | public class ToastUtil { 11 | public static void showShortToast(String msg) { 12 | Toast.makeText(GankApplication.getContext(), msg, Toast.LENGTH_SHORT).show(); 13 | } 14 | 15 | public static void showLongToast(String msg) { 16 | Toast.makeText(GankApplication.getContext(), msg, Toast.LENGTH_LONG).show(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/cn/chenyuanming/gankmeizhi/fragment/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.fragment; 2 | 3 | import android.support.v4.app.Fragment; 4 | 5 | import com.umeng.analytics.MobclickAgent; 6 | 7 | /** 8 | * Created by Administrator on 2016/2/2. 9 | */ 10 | public class BaseFragment extends Fragment { 11 | public void onResume() { 12 | super.onResume(); 13 | MobclickAgent.onPageStart(getClass().getSimpleName()); //统计页面,"MainScreen"为页面名称,可自定义 14 | } 15 | 16 | public void onPause() { 17 | super.onPause(); 18 | MobclickAgent.onPageEnd(getClass().getSimpleName()); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 18 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\dev\as_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 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_actions.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 12 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/java/cn/chenyuanming/gankmeizhi/utils/ClipboardHelper.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.utils; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | import android.text.ClipboardManager; 6 | 7 | /** 8 | * Created by Chen Yuanming on 2016/2/2. 9 | */ 10 | public class ClipboardHelper { 11 | 12 | /** 13 | * 实现文本复制功能 14 | * 15 | * @param content 16 | */ 17 | @SuppressWarnings("deprecation") 18 | public static void copy(Context context, @NonNull String content) { 19 | // 得到剪贴板管理器 20 | ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); 21 | cmb.setText(content.trim()); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/umeng_example_auto_update.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | 20 | -------------------------------------------------------------------------------- /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/layout/umeng_example_about_update.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/umeng_example_silent_update.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors_umeng.xml: -------------------------------------------------------------------------------- 1 | 2 | #ff000000 3 | #99000000 4 | #66000000 5 | #ffffffff 6 | #99ffffff 7 | #ff29549f 8 | #ffff549f 9 | #ffffffff 10 | #4d000000 11 | #ff222222 12 | #ff0fabff 13 | #ffdf1831 14 | #ff009939 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/java/cn/chenyuanming/gankmeizhi/decoration/SpacesItemDecoration.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.decoration; 2 | 3 | import android.graphics.Rect; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.View; 6 | 7 | /** 8 | * Created by Chen Yuanming on 2016/1/28. 9 | */ 10 | public class SpacesItemDecoration extends RecyclerView.ItemDecoration { 11 | 12 | private int space; 13 | 14 | public SpacesItemDecoration(int space) { 15 | this.space = space; 16 | } 17 | 18 | @Override 19 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { 20 | outRect.left = space; 21 | outRect.right = space; 22 | outRect.bottom = space; 23 | if (parent.getChildAdapterPosition(view) == 0) { 24 | outRect.top = space; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 干货·萌妹纸 3 | 干货·萌妹纸Debug 4 | 56b04542e0f55aecb9000f69 5 | 所有 6 | 妹纸 7 | Android 8 | iOS 9 | GitHub 10 | Trending 11 | 关于 12 | 发现了一款非常美观的App「干货·萌妹纸」,每天一张精选妹纸图、一个精选小视频(视频源地址播放),一篇程序猿干货,完全开源不收费,太赞了! 推荐~:http://fir.im/gankmeizhi 13 | 分享 14 | http://weibo.com/123466678 15 | https://github.com/enjoycodes/GankMeiZhi 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /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 -------------------------------------------------------------------------------- /app/src/main/res/values/attrs_umeng.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 18 | 19 | 31 | 32 | 38 | 44 | 48 | 52 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'me.tatarka.retrolambda' 3 | 4 | android { 5 | compileSdkVersion 23 6 | buildToolsVersion "23.0.2" 7 | dexOptions { 8 | // jumboMode = true 9 | incremental true//--incremental is not supported with --multi-dex 10 | javaMaxHeapSize "4g" 11 | } 12 | defaultConfig { 13 | applicationId "cn.chenyuanming.gankmeizhi" 14 | minSdkVersion 14 15 | targetSdkVersion 23 16 | versionCode 1 17 | versionName "1.0" 18 | 19 | } 20 | buildTypes { 21 | debug { 22 | applicationIdSuffix ".debug" 23 | manifestPlaceholders = [APP_NAME: "@string/app_name_debug",UMENG_APP_KEY: "@string/umeng_app_key"] 24 | 25 | } 26 | release { 27 | manifestPlaceholders = [APP_NAME: "@string/app_name",UMENG_APP_KEY: "@string/umeng_app_key"] 28 | minifyEnabled false 29 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 30 | } 31 | 32 | 33 | } 34 | compileOptions { 35 | targetCompatibility 1.8 36 | sourceCompatibility 1.8 37 | } 38 | lintOptions { 39 | checkReleaseBuilds false 40 | // Or, if you prefer, you can continue to check for errors in release builds, 41 | // but continue the build even when errors are found: 42 | abortOnError false 43 | } 44 | } 45 | 46 | dependencies { 47 | compile fileTree(dir: 'libs', include: ['*.jar']) 48 | compile 'com.android.support:appcompat-v7:23.1.1' 49 | compile 'com.android.support:design:23.1.1' 50 | compile 'com.android.support:cardview-v7:23.1.1' 51 | compile 'com.android.support:recyclerview-v7:23.1.1' 52 | compile 'com.android.support:palette-v7:23.1.1' 53 | compile 'com.android.support:percent:23.1.1' 54 | compile 'com.github.bumptech.glide:glide:3.6.0' 55 | compile 'de.hdodenhof:circleimageview:1.3.0' 56 | compile 'com.squareup.okio:okio:1.2.0' 57 | compile 'com.squareup.okhttp:okhttp:2.2.0' 58 | compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0' 59 | compile 'com.squareup.retrofit:retrofit:1.9.0' 60 | compile 'io.reactivex:rxandroid:0.24.0' 61 | compile 'com.jakewharton:butterknife:7.0.1' 62 | compile 'com.github.zzz40500:android-shapeLoadingView:1.0.3.2' 63 | compile 'de.hdodenhof:circleimageview:2.0.0' 64 | compile 'com.github.orangegangsters:swipy:1.1.0@aar' 65 | compile 'com.jude:swipebackhelper:2.1.5' 66 | compile('com.mikepenz:aboutlibraries:5.2.1@aar') { transitive = true; } 67 | compile 'com.umeng.analytics:analytics:latest.integration' 68 | } 69 | -------------------------------------------------------------------------------- /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/cn/chenyuanming/gankmeizhi/adapter/MeizhiAdapter.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.adapter; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.ImageView; 10 | 11 | import com.bumptech.glide.Glide; 12 | import com.bumptech.glide.load.engine.DiskCacheStrategy; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | import butterknife.Bind; 18 | import butterknife.ButterKnife; 19 | import cn.chenyuanming.gankmeizhi.R; 20 | import cn.chenyuanming.gankmeizhi.activity.ShowBigImageActivity; 21 | import cn.chenyuanming.gankmeizhi.beans.CommonGoodsBean; 22 | 23 | /** 24 | * Created by Chen Yuanming on 2016/1/28. 25 | */ 26 | public class MeizhiAdapter extends RecyclerView.Adapter { 27 | private List mDatas = new ArrayList<>(); 28 | private Context context; 29 | 30 | public MeizhiAdapter(Context context, List list) { 31 | this.context = context; 32 | if (list != null) { 33 | mDatas.addAll(list); 34 | } 35 | } 36 | 37 | @Override 38 | public MeizhiViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { 39 | View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_meizhi, viewGroup, false); 40 | return new MeizhiViewHolder(view); 41 | } 42 | 43 | @Override 44 | public void onBindViewHolder(MeizhiViewHolder meizhiViewHolder, int position) { 45 | // meizhiViewHolder.imageView.setImageResource(mDatas.get(position).getImg()); 46 | Glide.with(context).load(mDatas.get(position).url).diskCacheStrategy(DiskCacheStrategy.ALL).into(meizhiViewHolder.imageView); 47 | // meizhiViewHolder.textView.setText(mDatas.get(position).desc); 48 | meizhiViewHolder.mainView.setOnClickListener((v) -> { 49 | Intent intent = new Intent(context, ShowBigImageActivity.class); 50 | intent.putExtra("data", mDatas.get(position)); 51 | context.startActivity(intent); 52 | }); 53 | } 54 | 55 | @Override 56 | public int getItemCount() { 57 | return mDatas.size(); 58 | } 59 | 60 | public static class MeizhiViewHolder extends RecyclerView.ViewHolder { 61 | @Bind(R.id.imageView) 62 | ImageView imageView; 63 | // @Bind(R.id.textView) 64 | // TextView textView; 65 | View mainView; 66 | 67 | public MeizhiViewHolder(View itemView) { 68 | super(itemView); 69 | ButterKnife.bind(this, itemView); 70 | mainView = itemView; 71 | } 72 | 73 | } 74 | 75 | public List getDatas() { 76 | return mDatas; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_webview.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 37 | 42 | 43 | 44 | 49 | 50 | 54 | 55 | 56 | 64 | 65 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_show_img.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 21 | 22 | 23 | 24 | 27 | 28 | 35 | 36 | 41 | 42 | 43 | 50 | 51 | 55 | 56 | 63 | 64 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /app/src/main/java/cn/chenyuanming/gankmeizhi/utils/RecyclerViewLoadHelper.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.utils; 2 | 3 | import android.support.v7.widget.GridLayoutManager; 4 | import android.support.v7.widget.LinearLayoutManager; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.support.v7.widget.StaggeredGridLayoutManager; 7 | 8 | /** 9 | * Created by Chen Yuanming on 2016/1/28. 10 | */ 11 | public class RecyclerViewLoadHelper { 12 | 13 | 14 | public static boolean isToBottom(RecyclerView recyclerView) { 15 | int lastVisibleItemPosition = -1; 16 | int[] lastPositions; 17 | RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); 18 | if (null != layoutManager) { 19 | LAYOUT_MANAGER_TYPE layoutManagerType; 20 | if (layoutManager instanceof LinearLayoutManager) { 21 | layoutManagerType = LAYOUT_MANAGER_TYPE.LINEAR; 22 | } else if (layoutManager instanceof GridLayoutManager) { 23 | layoutManagerType = LAYOUT_MANAGER_TYPE.GRID; 24 | } else if (layoutManager instanceof StaggeredGridLayoutManager) { 25 | layoutManagerType = LAYOUT_MANAGER_TYPE.STAGGERED_GRID; 26 | } else { 27 | throw new ClassCastException( 28 | "Unsupported LayoutManager used. Valid ones are LinearLayoutManager, GridLayoutManager and StaggeredGridLayoutManager"); 29 | } 30 | 31 | switch (layoutManagerType) { 32 | case LINEAR: 33 | lastVisibleItemPosition = ((LinearLayoutManager) layoutManager).findLastVisibleItemPosition(); 34 | break; 35 | case GRID: 36 | lastVisibleItemPosition = ((GridLayoutManager) layoutManager).findLastVisibleItemPosition(); 37 | break; 38 | case STAGGERED_GRID: 39 | StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager; 40 | lastPositions = new int[staggeredGridLayoutManager.getSpanCount()]; 41 | staggeredGridLayoutManager.findLastVisibleItemPositions(lastPositions); 42 | lastVisibleItemPosition = findMax(lastPositions); 43 | 44 | break; 45 | } 46 | 47 | int visibleItemCount = layoutManager.getChildCount(); 48 | int totalItemCount = layoutManager.getItemCount(); 49 | if ((visibleItemCount > 0 && (lastVisibleItemPosition) >= totalItemCount - 1)) { 50 | //到达最后 51 | return true; 52 | } 53 | 54 | } 55 | return false; 56 | } 57 | 58 | private static int findMax(int[] lastPositions) { 59 | int max = lastPositions[0]; 60 | for (int value : lastPositions) { 61 | if (value > max) { 62 | max = value; 63 | } 64 | } 65 | return max; 66 | } 67 | 68 | public enum LAYOUT_MANAGER_TYPE { 69 | LINEAR, 70 | GRID, 71 | STAGGERED_GRID 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/cn/chenyuanming/gankmeizhi/service/PrefetchService.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.service; 2 | 3 | import android.app.Service; 4 | import android.content.Intent; 5 | import android.os.IBinder; 6 | import android.support.annotation.Nullable; 7 | import android.support.annotation.UiThread; 8 | import android.util.Log; 9 | import android.webkit.WebChromeClient; 10 | import android.webkit.WebSettings; 11 | import android.webkit.WebView; 12 | import android.webkit.WebViewClient; 13 | 14 | import java.text.ParseException; 15 | import java.text.SimpleDateFormat; 16 | import java.util.Date; 17 | 18 | import cn.chenyuanming.gankmeizhi.api.GankApi; 19 | import cn.chenyuanming.gankmeizhi.constants.Constants; 20 | import rx.Observable; 21 | import rx.android.schedulers.AndroidSchedulers; 22 | 23 | /** 24 | * Created by Chen Yuanming on 2016/1/28. 25 | */ 26 | public class PrefetchService extends Service { 27 | private static final String TAG = "PrefetchService"; 28 | 29 | @Nullable 30 | @Override 31 | public IBinder onBind(Intent intent) { 32 | return null; 33 | } 34 | 35 | int limit = Constants.LIMIT; 36 | int pageIndex = Constants.START; 37 | 38 | @Override 39 | public void onCreate() { 40 | super.onCreate(); 41 | GankApi.getInstance().getBenefitsGoods(limit, pageIndex).subscribe(goodsBean -> { 42 | Observable.from(goodsBean.results).observeOn(AndroidSchedulers.mainThread()).subscribe(results -> { 43 | //每天的结果 44 | try { 45 | Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(results.updatedAt); 46 | } catch (ParseException e) { 47 | e.printStackTrace(); 48 | } 49 | load(results.url); 50 | }); 51 | }); 52 | } 53 | 54 | @UiThread 55 | private void load(String url) { 56 | WebView webView = new WebView(this); 57 | webView.setWebChromeClient(new WebChromeClient() { 58 | @Override 59 | public void onProgressChanged(WebView view, int newProgress) { 60 | super.onProgressChanged(view, newProgress); 61 | if (newProgress == 100) { 62 | Log.d(TAG, "onProgressChanged: " + view.getUrl()); 63 | } 64 | } 65 | }); 66 | webView.setWebViewClient(new WebViewClient()); 67 | webView.getSettings().setBuiltInZoomControls(true); 68 | webView.getSettings().setJavaScriptEnabled(true); 69 | webView.getSettings().setDomStorageEnabled(true); 70 | webView.getSettings().setDatabaseEnabled(true); 71 | webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); 72 | String cacheDirPath = getFilesDir().getAbsolutePath() + "/webviewcache"; 73 | webView.getSettings().setDatabasePath(cacheDirPath); 74 | webView.getSettings().setAppCachePath(cacheDirPath); 75 | webView.getSettings().setAppCacheEnabled(true); 76 | 77 | webView.requestFocus(); 78 | webView.getSettings().getAllowFileAccess(); 79 | 80 | webView.loadUrl(url); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/java/cn/chenyuanming/gankmeizhi/utils/RxMeizhi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Drakeet 3 | * 4 | * This file is part of Meizhi 5 | * 6 | * Meizhi is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Meizhi is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Meizhi. If not, see . 18 | */ 19 | 20 | package cn.chenyuanming.gankmeizhi.utils; 21 | 22 | import android.content.Context; 23 | import android.content.Intent; 24 | import android.graphics.Bitmap; 25 | import android.net.Uri; 26 | import android.os.Environment; 27 | 28 | import com.bumptech.glide.Glide; 29 | 30 | import java.io.File; 31 | import java.io.FileOutputStream; 32 | import java.io.IOException; 33 | import java.util.concurrent.ExecutionException; 34 | 35 | import rx.Observable; 36 | import rx.Subscriber; 37 | import rx.schedulers.Schedulers; 38 | 39 | /** 40 | * 简单重构了下,并且修复了重复插入图片问题 41 | * Created by drakeet on 8/10/15. 42 | */ 43 | public class RxMeizhi { 44 | 45 | public static Observable saveImageAndGetPathObservable(Context context, String url, String title) { 46 | return Observable.create(new Observable.OnSubscribe() { 47 | @Override 48 | public void call(Subscriber subscriber) { 49 | Bitmap bitmap = null; 50 | try { 51 | bitmap = Glide.with(context).load(url).asBitmap().into(-1, -1).get(); 52 | } catch (InterruptedException e) { 53 | e.printStackTrace(); 54 | } catch (ExecutionException e) { 55 | e.printStackTrace(); 56 | } 57 | if (bitmap == null) { 58 | subscriber.onError(new Exception("无法下载到图片")); 59 | } 60 | subscriber.onNext(bitmap); 61 | subscriber.onCompleted(); 62 | } 63 | }).flatMap(bitmap -> { 64 | File appDir = new File(Environment.getExternalStorageDirectory(), "Meizhi"); 65 | if (!appDir.exists()) { 66 | appDir.mkdir(); 67 | } 68 | String fileName = title.replace('/', '-') + ".jpg"; 69 | File file = new File(appDir, fileName); 70 | try { 71 | FileOutputStream fos = new FileOutputStream(file); 72 | assert bitmap != null; 73 | bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos); 74 | fos.flush(); 75 | fos.close(); 76 | } catch (IOException e) { 77 | e.printStackTrace(); 78 | } 79 | 80 | Uri uri = Uri.fromFile(file); 81 | // 通知图库更新 82 | Intent scannerIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri); 83 | context.sendBroadcast(scannerIntent); 84 | return Observable.just(uri); 85 | }).subscribeOn(Schedulers.io()); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 44 | 47 | 50 | 51 | 52 | 53 | 54 | 55 | 58 | 59 | 62 | 63 | 66 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /app/src/main/java/cn/chenyuanming/gankmeizhi/activity/AboutActivity.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.activity; 2 | 3 | import android.annotation.TargetApi; 4 | import android.content.Intent; 5 | import android.graphics.Color; 6 | import android.graphics.PorterDuff; 7 | import android.graphics.drawable.Drawable; 8 | import android.os.Build; 9 | import android.os.Bundle; 10 | import android.view.Menu; 11 | import android.view.MenuInflater; 12 | import android.view.MenuItem; 13 | 14 | import com.mikepenz.aboutlibraries.Libs; 15 | import com.mikepenz.aboutlibraries.LibsBuilder; 16 | import com.mikepenz.aboutlibraries.ui.LibsActivity; 17 | 18 | import cn.chenyuanming.gankmeizhi.R; 19 | import cn.chenyuanming.gankmeizhi.utils.PreferenceUtil; 20 | import cn.chenyuanming.gankmeizhi.utils.ShareUtils; 21 | 22 | /** 23 | * Created by Chen Yuanming on 2016/2/2. 24 | */ 25 | public class AboutActivity extends LibsActivity { 26 | 27 | @Override 28 | public void onCreate(Bundle savedInstanceState) { 29 | setIntent(new LibsBuilder() 30 | .withActivityTitle(getResources().getString(R.string.nav_about)) 31 | .withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR) 32 | .withAboutAppName(getResources().getString(R.string.app_name)) 33 | .withAboutDescription("http://chenyuanming.cn @KeepCoding") 34 | .withAboutVersionShown(true) 35 | .withAboutIconShown(true) 36 | .withAboutVersionShownCode(true) 37 | .withAboutVersionShownName(true) 38 | .withLicenseShown(true) 39 | .intent(this)); 40 | 41 | super.onCreate(savedInstanceState); 42 | } 43 | 44 | @Override 45 | public void onBackPressed() { 46 | super.onBackPressed(); 47 | overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_right); 48 | } 49 | 50 | 51 | @Override 52 | public boolean onCreateOptionsMenu(Menu menu) { 53 | MenuInflater inflater = getMenuInflater(); 54 | inflater.inflate(R.menu.menu_about, menu); 55 | return super.onCreateOptionsMenu(menu); 56 | } 57 | 58 | @Override 59 | public boolean onPrepareOptionsMenu(Menu menu) { 60 | MenuItem item; 61 | for (int i = 0; i < menu.size(); i++) { 62 | item = menu.getItem(i); 63 | Drawable drawable = item.getIcon(); 64 | drawable.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN); 65 | if (item.getItemId() == R.id.action_like && PreferenceUtil.getInstance().getBooleanDefaultFalse("like")) { 66 | drawable.setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN); 67 | } 68 | item.setIcon(drawable); 69 | } 70 | return super.onPrepareOptionsMenu(menu); 71 | } 72 | 73 | 74 | @TargetApi(Build.VERSION_CODES.HONEYCOMB) 75 | @Override 76 | public boolean onOptionsItemSelected(MenuItem item) { 77 | switch (item.getItemId()) { 78 | case android.R.id.home: 79 | finish(); 80 | break; 81 | case R.id.action_share: 82 | ShareUtils.share(this); 83 | break; 84 | case R.id.action_like: 85 | Drawable drawable = item.getIcon(); 86 | boolean isLiked = PreferenceUtil.getInstance().getBooleanDefaultFalse("like"); 87 | if (!isLiked) { 88 | drawable.setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN); 89 | go2StarPage(); 90 | 91 | } else { 92 | drawable.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN); 93 | } 94 | PreferenceUtil.getInstance().putBoolean("like", !isLiked); 95 | item.setIcon(drawable); 96 | 97 | break; 98 | 99 | } 100 | return super.onOptionsItemSelected(item); 101 | } 102 | 103 | private void go2StarPage() { 104 | Intent intent = new Intent(this, WebViewActivity.class); 105 | intent.putExtra("url", getString(R.string.project_url)); 106 | intent.putExtra("objectId", ""); 107 | intent.putExtra("useCache", false); 108 | startActivity(intent); 109 | } 110 | } -------------------------------------------------------------------------------- /app/src/main/java/cn/chenyuanming/gankmeizhi/utils/PreferenceUtil.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.utils; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.content.SharedPreferences.Editor; 6 | 7 | import java.util.Map; 8 | 9 | import cn.chenyuanming.gankmeizhi.application.GankApplication; 10 | 11 | /** 12 | * Created by Chen Yuanming on 2016/2/2. 13 | */ 14 | public class PreferenceUtil { 15 | 16 | private Context mContext = GankApplication.getContext(); 17 | private String mName = "default"; 18 | 19 | public PreferenceUtil(Context context, String name) { 20 | this.mContext = context; 21 | this.mName = name; 22 | } 23 | 24 | private SharedPreferences getSharedPreferences() { 25 | return mContext.getSharedPreferences(mName, Context.MODE_APPEND); 26 | } 27 | 28 | static PreferenceUtil instance = new PreferenceUtil(GankApplication.getContext(),"default"); 29 | 30 | public static PreferenceUtil getInstance() { 31 | return instance; 32 | } 33 | 34 | public void putString(String key, String value) { 35 | SharedPreferences sharedPreferences = getSharedPreferences(); 36 | Editor editor = sharedPreferences.edit(); 37 | editor.putString(key, value); 38 | editor.commit(); 39 | } 40 | 41 | public void putInt(String key, int value) { 42 | SharedPreferences sharedPreferences = getSharedPreferences(); 43 | Editor editor = sharedPreferences.edit(); 44 | editor.putInt(key, value); 45 | editor.commit(); 46 | } 47 | 48 | public void putBoolean(String key, Boolean value) { 49 | SharedPreferences sharedPreferences = getSharedPreferences(); 50 | Editor editor = sharedPreferences.edit(); 51 | editor.putBoolean(key, value); 52 | editor.commit(); 53 | } 54 | 55 | public void putLong(String key, long value) { 56 | SharedPreferences sharedPreferences = getSharedPreferences(); 57 | Editor editor = sharedPreferences.edit(); 58 | editor.putLong(key, value); 59 | editor.commit(); 60 | } 61 | 62 | public String getString(String key) { 63 | SharedPreferences sharedPreferences = getSharedPreferences(); 64 | return sharedPreferences.getString(key, ""); 65 | } 66 | 67 | public String getString(String key, String aDefault) { 68 | SharedPreferences sharedPreferences = getSharedPreferences(); 69 | return sharedPreferences.getString(key, aDefault); 70 | } 71 | 72 | public int getInt(String key) { 73 | SharedPreferences sharedPreferences = getSharedPreferences(); 74 | return sharedPreferences.getInt(key, 0); 75 | } 76 | 77 | public int getInt(String key, int defValue) { 78 | SharedPreferences sharedPreferences = getSharedPreferences(); 79 | return sharedPreferences.getInt(key, defValue); 80 | } 81 | 82 | public boolean getBoolean(String key) { 83 | SharedPreferences sharedPreferences = getSharedPreferences(); 84 | return sharedPreferences.getBoolean(key, true); 85 | } 86 | 87 | public boolean getBooleanDefaultFalse(String key) { 88 | SharedPreferences sharedPreferences = getSharedPreferences(); 89 | return sharedPreferences.getBoolean(key, false); 90 | } 91 | 92 | public long getLong(String key) { 93 | SharedPreferences sharedPreferences = getSharedPreferences(); 94 | return sharedPreferences.getLong(key, 0); 95 | } 96 | 97 | public long getLongDefault(String key, long defValue) { 98 | SharedPreferences sharedPreferences = getSharedPreferences(); 99 | return sharedPreferences.getLong(key, defValue); 100 | } 101 | 102 | public Object getValue(String key) { 103 | SharedPreferences sharedPreferences = getSharedPreferences(); 104 | Map map = sharedPreferences.getAll(); 105 | if (map != null && !map.isEmpty()) { 106 | return map.get(key); 107 | } 108 | return null; 109 | } 110 | 111 | public Map getAll() { 112 | SharedPreferences sharedPreferences = getSharedPreferences(); 113 | Map map = sharedPreferences.getAll(); 114 | return map; 115 | } 116 | 117 | public void clearData() { 118 | SharedPreferences sharedPreferences = getSharedPreferences(); 119 | sharedPreferences.edit().clear().commit(); 120 | } 121 | } -------------------------------------------------------------------------------- /app/src/main/java/cn/chenyuanming/gankmeizhi/api/GankApi.java: -------------------------------------------------------------------------------- 1 | package cn.chenyuanming.gankmeizhi.api; 2 | 3 | import com.google.gson.Gson; 4 | import com.squareup.okhttp.Cache; 5 | import com.squareup.okhttp.OkHttpClient; 6 | 7 | import java.io.File; 8 | 9 | import cn.chenyuanming.gankmeizhi.application.GankApplication; 10 | import cn.chenyuanming.gankmeizhi.beans.DayGoodsBean; 11 | import cn.chenyuanming.gankmeizhi.beans.CommonGoodsBean; 12 | import cn.chenyuanming.gankmeizhi.constants.Constants; 13 | import retrofit.RestAdapter; 14 | import retrofit.client.OkClient; 15 | import retrofit.converter.GsonConverter; 16 | import retrofit.http.GET; 17 | import retrofit.http.Path; 18 | import rx.Observable; 19 | 20 | /** 21 | * Created by Chen Yuanming on 2016/1/25. 22 | */ 23 | public class GankApi { 24 | private static GankApi instance; 25 | 26 | private final GankService gankService; 27 | private GankApi(){ 28 | Cache cache; 29 | OkHttpClient okHttpClient = null; 30 | try { 31 | File cacheDir = new File(GankApplication.getContext().getCacheDir().getPath(), "gank_cache.json"); 32 | cache = new Cache(cacheDir, 10 * 1024 * 1024); 33 | okHttpClient = new OkHttpClient(); 34 | okHttpClient.setCache(cache); 35 | } catch (Exception e) { 36 | e.printStackTrace(); 37 | } 38 | 39 | RestAdapter restAdapter = new RestAdapter.Builder() 40 | .setEndpoint(Constants.ENDPOINT) 41 | .setClient(new OkClient(okHttpClient)) 42 | .setConverter(new GsonConverter(new Gson())) 43 | // .setRequestInterceptor(mRequestInterceptor) 44 | .build(); 45 | gankService = restAdapter.create(GankService.class); 46 | } 47 | 48 | public static GankApi getInstance() { 49 | if(instance==null){ 50 | synchronized (GankApi.class){ 51 | if(instance==null){ 52 | instance = new GankApi(); 53 | } 54 | } 55 | } 56 | return instance; 57 | } 58 | 59 | public interface GankService { 60 | 61 | @GET("/data/Android/{limit}/{page}") 62 | Observable getAndroidGoods( 63 | @Path("limit") int limit, 64 | @Path("page") int page 65 | ); 66 | 67 | @GET("/data/iOS/{limit}/{page}") 68 | Observable getIosGoods( 69 | @Path("limit") int limit, 70 | @Path("page") int page 71 | ); 72 | 73 | @GET("/data/all/{limit}/{page}") 74 | Observable getAllGoods( 75 | @Path("limit") int limit, 76 | @Path("page") int page 77 | ); 78 | 79 | @GET("/data/福利/{limit}/{page}") 80 | Observable getBenefitsGoods( 81 | @Path("limit") int limit, 82 | @Path("page") int page 83 | ); 84 | 85 | @GET("/day/{year}/{month}/{day}") 86 | Observable getGoodsByDay( 87 | @Path("year") int year, 88 | @Path("month") int month, 89 | @Path("day") int day 90 | ); 91 | } 92 | 93 | public Observable getCommonGoods(String type, int limit, int page) { 94 | if("Android".equalsIgnoreCase(type)){ 95 | return gankService.getAndroidGoods(limit, page); 96 | } 97 | if("IOS".equalsIgnoreCase(type)){ 98 | return gankService.getIosGoods(limit, page); 99 | } 100 | return gankService.getAndroidGoods(limit, page); 101 | } 102 | 103 | public Observable getAndroidGoods(int limit, int page) { 104 | return gankService.getAndroidGoods(limit, page); 105 | } 106 | 107 | public Observable getIosGoods(int limit, int page) { 108 | return gankService.getIosGoods(limit, page); 109 | } 110 | 111 | public Observable getAllGoods(int limit, int page) { 112 | return gankService.getAllGoods(limit, page); 113 | } 114 | 115 | public Observable getBenefitsGoods(int limit, int page) { 116 | return gankService.getBenefitsGoods(limit, page); 117 | } 118 | 119 | public Observable getGoodsByDay(int year,int month,int day) { 120 | return gankService.getGoodsByDay(year, month,day); 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /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 |