├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── libraries │ ├── adapter_rxjava_2_0_2.xml │ ├── analytics_6_0_9.xml │ ├── animated_vector_drawable_24_2_0.xml │ ├── appcompat_v7_24_2_0.xml │ ├── autolayout_1_4_3.xml │ ├── butterknife_7_0_1.xml │ ├── cardview_v7_24_2_1.xml │ ├── clog_1_0_2.xml │ ├── clog_1_0_2_sources.xml │ ├── converter_gson_2_0_2.xml │ ├── design_24_2_0.xml │ ├── eventbus_3_0_0_beta1.xml │ ├── glide_3_7_0.xml │ ├── gson_2_6_1.xml │ ├── haha_2_0_2.xml │ ├── hamcrest_core_1_3.xml │ ├── junit_4_12.xml │ ├── leakcanary_analyzer_1_4_beta2.xml │ ├── leakcanary_android_1_4_beta2.xml │ ├── leakcanary_android_no_op_1_4_beta2.xml │ ├── leakcanary_watcher_1_4_beta2.xml │ ├── logging_interceptor_3_0_1.xml │ ├── multiline_collapsingtoolbar_1_2_2.xml │ ├── okhttp_3_3_1.xml │ ├── okhttputils_2_6_2.xml │ ├── okio_1_8_0.xml │ ├── recyclerview_v7_24_2_0.xml │ ├── retrofit_2_0_2.xml │ ├── rxandroid_1_2_0.xml │ ├── rxbinding_0_4_0.xml │ ├── rxjava_1_1_5.xml │ ├── support_annotations_24_1_1.xml │ ├── support_annotations_24_2_0.xml │ ├── support_annotations_24_2_1.xml │ ├── support_compat_24_2_0.xml │ ├── support_core_ui_24_2_0.xml │ ├── support_core_utils_24_2_0.xml │ ├── support_fragment_24_2_0.xml │ ├── support_media_compat_24_2_0.xml │ ├── support_v4_24_1_1.xml │ ├── support_v4_24_2_0.xml │ ├── support_vector_drawable_24_2_0.xml │ ├── systembartint_1_0_3.xml │ ├── tbs_sdk_thirdapp_v2_2_0_1096_36549_sharewithdownload_withoutGame_obfs_20160830_211645.xml │ └── tbs_sdk_thirdapp_v2_4_0_1073_36840_sharewithdownload_obfs_20161011_194834.xml ├── misc.xml ├── modules.xml └── runConfigurations.xml ├── Lib_Myrecyclerview ├── .gitignore ├── build.gradle ├── libs │ ├── clog-1.0.2-sources.jar │ └── clog-1.0.2.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── android │ │ └── dalong │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── android │ │ │ └── dalong │ │ │ ├── MyRecyclerView.java │ │ │ ├── MyRefLayout.java │ │ │ ├── loadview │ │ │ ├── EndlessRecyclerOnScrollListener.java │ │ │ ├── ExStaggeredGridLayoutManager.java │ │ │ ├── HeaderAndFooterRecyclerViewAdapter.java │ │ │ ├── HeaderSpanSizeLookup.java │ │ │ ├── LoadView.java │ │ │ ├── LoadingFooter.java │ │ │ ├── OnListLoadNextPageListener.java │ │ │ ├── RecyclerViewStateUtils.java │ │ │ └── RecyclerViewUtils.java │ │ │ └── ptr │ │ │ ├── PtrClassicDefaultHeader.java │ │ │ ├── PtrClassicFrameLayout.java │ │ │ ├── PtrDefaultHandler.java │ │ │ ├── PtrFrameLayout.java │ │ │ ├── PtrHandler.java │ │ │ ├── PtrUIHandler.java │ │ │ ├── PtrUIHandlerHolder.java │ │ │ ├── PtrUIHandlerHook.java │ │ │ ├── header │ │ │ ├── DpHeader.java │ │ │ ├── MaterialHeader.java │ │ │ ├── MaterialProgressDrawable.java │ │ │ ├── RocketHeader.java │ │ │ ├── RocketPtrUIHandler.java │ │ │ ├── StoreHouseBarItem.java │ │ │ ├── StoreHouseHeader.java │ │ │ └── StoreHousePath.java │ │ │ ├── indicator │ │ │ ├── PtrIndicator.java │ │ │ └── PtrTensionIndicator.java │ │ │ ├── util │ │ │ ├── PtrCLog.java │ │ │ └── PtrLocalDisplay.java │ │ │ └── view │ │ │ └── ProgressWheel.java │ └── res │ │ ├── drawable-xhdpi │ │ ├── loading_01.png │ │ ├── loading_02.png │ │ ├── loading_03.png │ │ ├── loading_04.png │ │ ├── loading_05.png │ │ ├── loading_06.png │ │ ├── loading_07.png │ │ ├── loading_08.png │ │ ├── ptr_rotate_arrow.png │ │ ├── refresh_img.gif │ │ ├── sample_footer_error.png │ │ ├── sample_footer_loading.png │ │ ├── sdk_ijk_progress_bar_logo.png │ │ └── venvy_sdk_progress_bar_anim_bg.png │ │ ├── drawable │ │ ├── cube_loging.xml │ │ ├── loading2.xml │ │ ├── sample_footer_loading_progress.xml │ │ └── venvy_video_sdk_ijk_progress_bar_bg.xml │ │ ├── layout │ │ ├── cube_ptr_classic_default_header.xml │ │ ├── cube_ptr_simple_loading.xml │ │ ├── dp_header.xml │ │ ├── rocket_header.xml │ │ ├── sample_common_list_footer.xml │ │ ├── sample_common_list_footer_end.xml │ │ ├── sample_common_list_footer_loading.xml │ │ └── sample_common_list_footer_network_error.xml │ │ ├── values-zh │ │ └── cube_ptr_string.xml │ │ └── values │ │ ├── colors.xml │ │ ├── cube_ptr_attrs.xml │ │ ├── cube_ptr_string.xml │ │ ├── dimens.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── android │ └── dalong │ └── ExampleUnitTest.java ├── Photo_View ├── LICENSE ├── build.gradle ├── gradle.properties └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── uk │ └── co │ └── senab │ └── photoview │ ├── Compat.java │ ├── DefaultOnDoubleTapListener.java │ ├── IPhotoView.java │ ├── PhotoView.java │ ├── PhotoViewAttacher.java │ ├── gestures │ ├── CupcakeGestureDetector.java │ ├── EclairGestureDetector.java │ ├── FroyoGestureDetector.java │ ├── GestureDetector.java │ ├── OnGestureListener.java │ └── VersionedGestureDetector.java │ ├── log │ ├── LogManager.java │ ├── Logger.java │ └── LoggerDefault.java │ └── scrollerproxy │ ├── GingerScroller.java │ ├── IcsScroller.java │ ├── PreGingerScroller.java │ └── ScrollerProxy.java ├── README.md ├── app ├── .gitignore ├── build.gradle ├── libs │ └── tbs_sdk_thirdapp_v2.4.0.1073_36840_sharewithdownload_obfs_20161011_194834.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── android │ │ └── mvp │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── fonts │ │ │ ├── Oswald-Stencbab.ttf │ │ │ ├── Roboto-Bold.ttf │ │ │ ├── Roboto-ThinItalic.ttf │ │ │ ├── RobotoCondensed-Regular.ttf │ │ │ ├── ac.ttf │ │ │ ├── gtw.ttf │ │ │ └── tae_sdk_login.ttf │ ├── java │ │ └── com │ │ │ └── android │ │ │ └── mvp │ │ │ ├── base │ │ │ ├── BaseActivity.java │ │ │ ├── BaseFragment.java │ │ │ ├── BaseFragmentLazy.java │ │ │ ├── BaseModel.java │ │ │ ├── BasePresenter.java │ │ │ ├── BasePresenterI.java │ │ │ ├── BaseViewI.java │ │ │ ├── DemoActivity.java │ │ │ └── DemoFragment.java │ │ │ ├── bean │ │ │ ├── BrandBean.java │ │ │ ├── GankHttpResponse.java │ │ │ ├── GankItemBean.java │ │ │ ├── HomeBanner.java │ │ │ ├── HomePost.java │ │ │ ├── HomeSpecial.java │ │ │ ├── M_Base.java │ │ │ ├── MyUrl.java │ │ │ ├── NewTabs.java │ │ │ ├── WXHttpResponse.java │ │ │ ├── WXItemBean.java │ │ │ ├── WYDetial.java │ │ │ ├── WYNewsBean.java │ │ │ └── WYVideosBean.java │ │ │ ├── db │ │ │ ├── DbHelper.java │ │ │ ├── DbModel.java │ │ │ └── DbUtils.java │ │ │ ├── event │ │ │ ├── DaLongEvent.java │ │ │ ├── TabEvent.java │ │ │ └── WxSearchEvent.java │ │ │ ├── http │ │ │ ├── ConstantValues.java │ │ │ ├── DPService.java │ │ │ ├── GankApis.java │ │ │ ├── Http.java │ │ │ ├── ResultTag.java │ │ │ ├── WYApis.java │ │ │ ├── WeChatApis.java │ │ │ └── WyConstantValues.java │ │ │ ├── model │ │ │ ├── GankModel.java │ │ │ ├── HomeModel.java │ │ │ ├── NewModel.java │ │ │ └── WXModel.java │ │ │ ├── presenter │ │ │ ├── GankPresenter.java │ │ │ ├── HomePresenter.java │ │ │ ├── NewByIdPresenter.java │ │ │ ├── NewDetialPresenter.java │ │ │ ├── NewPresenter.java │ │ │ ├── NewTabPresenter.java │ │ │ ├── WxPresenter.java │ │ │ └── contract │ │ │ │ ├── GankContract.java │ │ │ │ ├── HomeContract.java │ │ │ │ ├── NewDetialContract.java │ │ │ │ ├── NewsContract.java │ │ │ │ └── WxContract.java │ │ │ ├── ui │ │ │ ├── MyApplication.java │ │ │ ├── MyPagerAdapter.java │ │ │ ├── gank │ │ │ │ ├── activity │ │ │ │ │ └── GankGirlDetialActivity.java │ │ │ │ ├── adapter │ │ │ │ │ ├── GankAndroidAdapter.java │ │ │ │ │ ├── GankGirlAdapter.java │ │ │ │ │ └── GankPagerAdapter.java │ │ │ │ └── fragment │ │ │ │ │ ├── FragmentGank.java │ │ │ │ │ ├── FragmentGankAndroid.java │ │ │ │ │ └── FragmentGankGirl.java │ │ │ ├── main │ │ │ │ ├── FragmentController.java │ │ │ │ ├── FragmentFactory.java │ │ │ │ ├── MainActivity.java │ │ │ │ └── fragment │ │ │ │ │ └── FragmentMain.java │ │ │ ├── news │ │ │ │ ├── activity │ │ │ │ │ ├── NewsDetialActivity.java │ │ │ │ │ └── NewsTabActivity.java │ │ │ │ ├── adapter │ │ │ │ │ ├── NewsAdapter.java │ │ │ │ │ └── TabsAdapter.java │ │ │ │ └── fragment │ │ │ │ │ ├── FragmentNew.java │ │ │ │ │ └── FragmentNewById.java │ │ │ ├── sayd │ │ │ │ ├── adapter │ │ │ │ │ ├── HomeBannerAdapter.java │ │ │ │ │ ├── HomeBarandAdapter.java │ │ │ │ │ ├── HomePostAdapter.java │ │ │ │ │ └── HomeSpecialAdapter.java │ │ │ │ └── fragment │ │ │ │ │ └── FragmentSAYDHome.java │ │ │ ├── video │ │ │ │ └── FragmentVideo.java │ │ │ ├── wx │ │ │ │ ├── activity │ │ │ │ │ └── WxWebActivity.java │ │ │ │ ├── adapter │ │ │ │ │ └── WxAdapter.java │ │ │ │ └── fragment │ │ │ │ │ └── FragmentWx.java │ │ │ └── zhihu │ │ │ │ └── fragment │ │ │ │ └── FragmentZhihu.java │ │ │ ├── util │ │ │ ├── BuildConfig.java │ │ │ ├── DateUtil.java │ │ │ ├── DimenUtil.java │ │ │ ├── FileUtil.java │ │ │ ├── FullyGridLayoutManager.java │ │ │ ├── FullyLinearLayoutManager.java │ │ │ ├── GeneralUtil.java │ │ │ ├── ImageLoader.java │ │ │ ├── KeyBoardUtils.java │ │ │ ├── MD5Util.java │ │ │ ├── MLog.java │ │ │ ├── MyConfig.java │ │ │ ├── MyItemTouchHelper.java │ │ │ ├── MyOkhttpUtils.java │ │ │ ├── NetUtil.java │ │ │ ├── RxBus.java │ │ │ ├── RxUtil.java │ │ │ ├── StatusBarUtil.java │ │ │ ├── SystemUiVisibilityUtil.java │ │ │ └── ToastShow.java │ │ │ └── widget │ │ │ ├── dialog │ │ │ ├── LoadingActivityDialog.java │ │ │ └── LoadingFragmentDialog.java │ │ │ ├── loading │ │ │ ├── IVaryViewHelper.java │ │ │ ├── VaryViewHelper.java │ │ │ └── VaryViewHelperController.java │ │ │ └── view │ │ │ ├── AutoPlayViewPager.java │ │ │ ├── MyCardView.java │ │ │ ├── MyToolbar.java │ │ │ ├── ProgressWheel.java │ │ │ └── RatioImageView.java │ └── res │ │ ├── anim │ │ ├── poplayout_down.xml │ │ └── poplayout_up.xml │ │ ├── drawable │ │ ├── borad_label_bg.xml │ │ ├── drawer_item_bg.xml │ │ ├── ic_bg_card.9.png │ │ ├── loading_bg.xml │ │ ├── net_error_loading_selector.xml │ │ ├── sel_btn_reload.xml │ │ └── selector_toolbar_like.xml │ │ ├── layout-xlarge │ │ └── fragment_gank.xml │ │ ├── layout │ │ ├── activity_gank_girl.xml │ │ ├── activity_main.xml │ │ ├── activity_new_detial.xml │ │ ├── activity_news_tab.xml │ │ ├── activity_wx_web.xml │ │ ├── dialog_loadding.xml │ │ ├── dialog_loadding_f.xml │ │ ├── fragment_gank.xml │ │ ├── fragment_gank_android.xml │ │ ├── fragment_gank_girl.xml │ │ ├── fragment_home.xml │ │ ├── fragment_main.xml │ │ ├── fragment_new_id.xml │ │ ├── fragment_news.xml │ │ ├── fragment_wx.xml │ │ ├── fragment_zhihu.xml │ │ ├── item_gank_tech.xml │ │ ├── item_girl.xml │ │ ├── item_home_barand.xml │ │ ├── item_home_borad.xml │ │ ├── item_home_special.xml │ │ ├── item_news.xml │ │ ├── item_news_photo.xml │ │ ├── item_newstab.xml │ │ ├── item_wx.xml │ │ ├── lazy_progress_layout.xml │ │ ├── toolbar.xml │ │ ├── view_drawer_header.xml │ │ ├── view_fragment_home_banner_img.xml │ │ ├── view_home_banner.xml │ │ ├── view_home_heard.xml │ │ ├── view_loadding_error.xml │ │ ├── view_loadding_no_data.xml │ │ └── view_loading_loading.xml │ │ ├── menu │ │ ├── drawer_menu.xml │ │ └── main_menu.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_reload_normal.png │ │ └── ic_reload_press.png │ │ ├── mipmap-xxhdpi │ │ ├── bg_drawer.jpg │ │ ├── classify_title_left.png │ │ ├── classify_title_right.png │ │ ├── defalt_img.png │ │ ├── home_banner_default.png │ │ ├── home_board_default.png │ │ ├── home_special_default.png │ │ ├── home_viewpage_bottom_bg.png │ │ ├── home_viewpage_default.png │ │ ├── ic_add.png │ │ ├── ic_android.png │ │ ├── ic_arrow_back.png │ │ ├── ic_author.png │ │ ├── ic_drawer_about.png │ │ ├── ic_drawer_gank.png │ │ ├── ic_drawer_like.png │ │ ├── ic_drawer_setting.png │ │ ├── ic_drawer_wechat.png │ │ ├── ic_drawer_zhihu.png │ │ ├── ic_launcher.png │ │ ├── ic_menu_news.png │ │ ├── ic_menu_photo.png │ │ ├── ic_menu_video.png │ │ ├── ic_time.png │ │ ├── ic_toolbar_copy.png │ │ ├── ic_toolbar_like_n.png │ │ ├── ic_toolbar_like_p.png │ │ ├── ic_toolbar_save.png │ │ ├── ic_toolbar_share.png │ │ ├── msg_ic_data.png │ │ ├── msg_ic_loading.png │ │ ├── msg_ic_loading_sel.png │ │ ├── msg_network.png │ │ ├── viewpage_noselected.png │ │ └── viewpage_selected.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-v19 │ │ ├── dimens.xml │ │ └── styles.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── array_news_channel.xml │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ ├── styles.xml │ │ └── styles_layout.xml │ └── test │ └── java │ └── com │ └── android │ └── mvp │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── pic ├── 01.png ├── 02.png ├── 03.png ├── 04.png ├── 05.png ├── 06.png ├── 07.png ├── gif01.gif └── gif02.gif └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/workspace.xml 38 | 39 | # Keystore files 40 | *.jks 41 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/libraries/adapter_rxjava_2_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/analytics_6_0_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/animated_vector_drawable_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/appcompat_v7_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/autolayout_1_4_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/butterknife_7_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/cardview_v7_24_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/clog_1_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/clog_1_0_2_sources.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/converter_gson_2_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/design_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/eventbus_3_0_0_beta1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/glide_3_7_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/gson_2_6_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/haha_2_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/leakcanary_analyzer_1_4_beta2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/leakcanary_android_1_4_beta2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/leakcanary_android_no_op_1_4_beta2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/leakcanary_watcher_1_4_beta2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/logging_interceptor_3_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/multiline_collapsingtoolbar_1_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/okhttp_3_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/okhttputils_2_6_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/okio_1_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/recyclerview_v7_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/retrofit_2_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/rxandroid_1_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/rxbinding_0_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/rxjava_1_1_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_annotations_24_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_annotations_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_annotations_24_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_compat_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/support_core_ui_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/support_core_utils_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/support_fragment_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/support_media_compat_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_24_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/support_vector_drawable_24_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/systembartint_1_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/tbs_sdk_thirdapp_v2_2_0_1096_36549_sharewithdownload_withoutGame_obfs_20160830_211645.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/tbs_sdk_thirdapp_v2_4_0_1073_36840_sharewithdownload_obfs_20161011_194834.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 24 5 | buildToolsVersion '25.0.0' 6 | 7 | defaultConfig { 8 | minSdkVersion 14 9 | targetSdkVersion 24 10 | versionCode 1 11 | versionName "1.0" 12 | 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | } 23 | 24 | dependencies { 25 | compile fileTree(include: ['*.jar'], dir: 'libs') 26 | compile 'com.android.support:appcompat-v7:24.2.0' 27 | compile 'com.android.support:recyclerview-v7:24.2.0' 28 | testCompile 'junit:junit:4.12' 29 | compile files('libs/clog-1.0.2.jar') 30 | compile files('libs/clog-1.0.2-sources.jar') 31 | } 32 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/libs/clog-1.0.2-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/libs/clog-1.0.2-sources.jar -------------------------------------------------------------------------------- /Lib_Myrecyclerview/libs/clog-1.0.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/libs/clog-1.0.2.jar -------------------------------------------------------------------------------- /Lib_Myrecyclerview/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 F:\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/androidTest/java/com/android/dalong/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.android.dalong; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.android.dalong.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/java/com/android/dalong/MyRefLayout.java: -------------------------------------------------------------------------------- 1 | package com.android.dalong; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | 7 | import com.android.dalong.ptr.PtrClassicFrameLayout; 8 | import com.android.dalong.ptr.PtrDefaultHandler; 9 | import com.android.dalong.ptr.PtrFrameLayout; 10 | import com.android.dalong.ptr.PtrHandler; 11 | 12 | /** 13 | * Created by Administrator on 2016/12/8 0008. 14 | */ 15 | 16 | public class MyRefLayout extends PtrClassicFrameLayout{ 17 | 18 | 19 | public MyRefLayout(Context context) { 20 | super(context); 21 | } 22 | 23 | public MyRefLayout(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | } 26 | 27 | 28 | 29 | 30 | public void initDefRefresh(){ 31 | this.setLoadingMinTime(500); 32 | this.setPullToRefresh(false); 33 | this.setKeepHeaderWhenRefresh(true); 34 | // this.autoRefresh(false);第一次下拉是否自动刷新 35 | this.disableWhenHorizontalMove(true); 36 | // this.setEnabledNextPtrAtOnce(true); 37 | } 38 | 39 | 40 | public void setRefresh(final PtrRefresh ptrRefresh){ 41 | this.setPtrHandler(new PtrHandler() { 42 | @Override 43 | public boolean checkCanDoRefresh(PtrFrameLayout frame, View content, View header) { 44 | return PtrDefaultHandler.checkContentCanBePulledDown(frame, content, header); 45 | } 46 | 47 | @Override 48 | public void onRefreshBegin(PtrFrameLayout frame) { 49 | ptrRefresh.ptrrefresh(frame); 50 | } 51 | }); 52 | } 53 | 54 | 55 | 56 | 57 | 58 | public interface PtrRefresh{ 59 | public void ptrrefresh(PtrFrameLayout frame); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/java/com/android/dalong/loadview/HeaderSpanSizeLookup.java: -------------------------------------------------------------------------------- 1 | package com.android.dalong.loadview; 2 | 3 | import android.support.v7.widget.GridLayoutManager; 4 | 5 | /** 6 | * Created by cundong on 2015/10/23. 7 | *

8 | * RecyclerView为GridLayoutManager时,设置了HeaderView,就会用到这个SpanSizeLookup 9 | */ 10 | public class HeaderSpanSizeLookup extends GridLayoutManager.SpanSizeLookup { 11 | 12 | private HeaderAndFooterRecyclerViewAdapter adapter; 13 | private int mSpanSize = 1; 14 | 15 | public HeaderSpanSizeLookup(HeaderAndFooterRecyclerViewAdapter adapter, int spanSize) { 16 | this.adapter = adapter; 17 | this.mSpanSize = spanSize; 18 | } 19 | 20 | @Override 21 | public int getSpanSize(int position) { 22 | boolean isHeaderOrFooter = adapter.isHeader(position) || adapter.isFooter(position); 23 | return isHeaderOrFooter ? mSpanSize : 1; 24 | } 25 | } -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/java/com/android/dalong/loadview/OnListLoadNextPageListener.java: -------------------------------------------------------------------------------- 1 | package com.android.dalong.loadview; 2 | 3 | import android.view.View; 4 | 5 | /** 6 | * Created by cundong on 2015/10/9. 7 | * RecyclerView/ListView/GridView 滑动加载下一页时的回调接口 8 | */ 9 | public interface OnListLoadNextPageListener { 10 | 11 | /** 12 | * 开始加载下一页 13 | * 14 | * @param view 当前RecyclerView/ListView/GridView 15 | */ 16 | public void onLoadNextPage(View view); 17 | } 18 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/java/com/android/dalong/ptr/PtrClassicFrameLayout.java: -------------------------------------------------------------------------------- 1 | package com.android.dalong.ptr; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | public class PtrClassicFrameLayout extends PtrFrameLayout { 7 | 8 | private PtrClassicDefaultHeader mPtrClassicHeader; 9 | 10 | public PtrClassicFrameLayout(Context context) { 11 | super(context); 12 | initViews(); 13 | } 14 | 15 | public PtrClassicFrameLayout(Context context, AttributeSet attrs) { 16 | super(context, attrs); 17 | initViews(); 18 | } 19 | 20 | public PtrClassicFrameLayout(Context context, AttributeSet attrs, int defStyle) { 21 | super(context, attrs, defStyle); 22 | initViews(); 23 | } 24 | 25 | private void initViews() { 26 | mPtrClassicHeader = new PtrClassicDefaultHeader(getContext()); 27 | setHeaderView(mPtrClassicHeader); 28 | addPtrUIHandler(mPtrClassicHeader); 29 | } 30 | 31 | public PtrClassicDefaultHeader getHeader() { 32 | return mPtrClassicHeader; 33 | } 34 | 35 | /** 36 | * Specify the last update time by this key string 37 | * 38 | * @param key 39 | */ 40 | public void setLastUpdateTimeKey(String key) { 41 | if (mPtrClassicHeader != null) { 42 | mPtrClassicHeader.setLastUpdateTimeKey(key); 43 | } 44 | } 45 | 46 | /** 47 | * Using an object to specify the last update time. 48 | * 49 | * @param object 50 | */ 51 | public void setLastUpdateTimeRelateObject(Object object) { 52 | if (mPtrClassicHeader != null) { 53 | mPtrClassicHeader.setLastUpdateTimeRelateObject(object); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/java/com/android/dalong/ptr/PtrDefaultHandler.java: -------------------------------------------------------------------------------- 1 | package com.android.dalong.ptr; 2 | 3 | import android.view.View; 4 | import android.widget.AbsListView; 5 | 6 | public abstract class PtrDefaultHandler implements PtrHandler { 7 | 8 | public static boolean canChildScrollUp(View view) { 9 | if (android.os.Build.VERSION.SDK_INT < 14) { 10 | if (view instanceof AbsListView) { 11 | final AbsListView absListView = (AbsListView) view; 12 | return absListView.getChildCount() > 0 13 | && (absListView.getFirstVisiblePosition() > 0 || absListView.getChildAt(0) 14 | .getTop() < absListView.getPaddingTop()); 15 | } else { 16 | return view.getScrollY() > 0; 17 | } 18 | } else { 19 | return view.canScrollVertically(-1); 20 | } 21 | } 22 | 23 | /** 24 | * Default implement for check can perform pull to refresh 25 | * 26 | * @param frame 27 | * @param content 28 | * @param header 29 | * @return 30 | */ 31 | public static boolean checkContentCanBePulledDown(PtrFrameLayout frame, View content, View header) { 32 | return !canChildScrollUp(content); 33 | } 34 | 35 | @Override 36 | public boolean checkCanDoRefresh(PtrFrameLayout frame, View content, View header) { 37 | return checkContentCanBePulledDown(frame, content, header); 38 | } 39 | } -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/java/com/android/dalong/ptr/PtrHandler.java: -------------------------------------------------------------------------------- 1 | package com.android.dalong.ptr; 2 | 3 | import android.view.View; 4 | 5 | public interface PtrHandler { 6 | 7 | /** 8 | * Check can do refresh or not. For example the content is empty or the first child is in view. 9 | *

10 | * {@link PtrDefaultHandler#checkContentCanBePulledDown} 11 | */ 12 | public boolean checkCanDoRefresh(final PtrFrameLayout frame, final View content, final View header); 13 | 14 | /** 15 | * When refresh begin 16 | * 17 | * @param frame 18 | */ 19 | public void onRefreshBegin(final PtrFrameLayout frame); 20 | } -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/java/com/android/dalong/ptr/PtrUIHandler.java: -------------------------------------------------------------------------------- 1 | package com.android.dalong.ptr; 2 | 3 | import com.android.dalong.ptr.indicator.PtrIndicator; 4 | 5 | /** 6 | * 7 | */ 8 | public interface PtrUIHandler { 9 | 10 | /** 11 | * When the content view has reached top and refresh has been completed, view will be reset. 12 | * 13 | * @param frame 14 | */ 15 | public void onUIReset(PtrFrameLayout frame); 16 | 17 | /** 18 | * prepare for loading 19 | * 20 | * @param frame 21 | */ 22 | public void onUIRefreshPrepare(PtrFrameLayout frame); 23 | 24 | /** 25 | * perform refreshing UI 26 | */ 27 | public void onUIRefreshBegin(PtrFrameLayout frame); 28 | 29 | /** 30 | * perform UI after refresh 31 | */ 32 | public void onUIRefreshComplete(PtrFrameLayout frame); 33 | 34 | public void onUIPositionChange(PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator); 35 | } 36 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/java/com/android/dalong/ptr/PtrUIHandlerHook.java: -------------------------------------------------------------------------------- 1 | package com.android.dalong.ptr; 2 | 3 | /** 4 | * Run a hook runnable, the runnable will run only once. 5 | * After the runnable is done, call resume to resume. 6 | * Once run, call takeover will directory call the resume action 7 | */ 8 | public abstract class PtrUIHandlerHook implements Runnable { 9 | 10 | private Runnable mResumeAction; 11 | private static final byte STATUS_PREPARE = 0; 12 | private static final byte STATUS_IN_HOOK = 1; 13 | private static final byte STATUS_RESUMED = 2; 14 | private byte mStatus = STATUS_PREPARE; 15 | 16 | public void takeOver() { 17 | takeOver(null); 18 | } 19 | 20 | public void takeOver(Runnable resumeAction) { 21 | if (resumeAction != null) { 22 | mResumeAction = resumeAction; 23 | } 24 | switch (mStatus) { 25 | case STATUS_PREPARE: 26 | mStatus = STATUS_IN_HOOK; 27 | run(); 28 | break; 29 | case STATUS_IN_HOOK: 30 | break; 31 | case STATUS_RESUMED: 32 | resume(); 33 | break; 34 | } 35 | } 36 | 37 | public void reset() { 38 | mStatus = STATUS_PREPARE; 39 | } 40 | 41 | public void resume() { 42 | if (mResumeAction != null) { 43 | mResumeAction.run(); 44 | } 45 | mStatus = STATUS_RESUMED; 46 | } 47 | 48 | /** 49 | * Hook should always have a resume action, which is hooked by this hook. 50 | * 51 | * @param runnable 52 | */ 53 | public void setResumeAction(Runnable runnable) { 54 | mResumeAction = runnable; 55 | } 56 | } -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/java/com/android/dalong/ptr/header/DpHeader.java: -------------------------------------------------------------------------------- 1 | package com.android.dalong.ptr.header; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.widget.LinearLayout; 8 | 9 | import com.android.dalong.R; 10 | import com.android.dalong.ptr.PtrFrameLayout; 11 | import com.android.dalong.ptr.PtrUIHandler; 12 | import com.android.dalong.ptr.indicator.PtrIndicator; 13 | 14 | /** 15 | * Created by mushuai on 2016/8/1. 16 | */ 17 | public class DpHeader extends LinearLayout implements PtrUIHandler { 18 | public DpHeader(Context context) { 19 | super(context); 20 | initView(); 21 | } 22 | 23 | public DpHeader(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | initView(); 26 | } 27 | 28 | 29 | private void initView(){ 30 | 31 | View view = LayoutInflater.from(getContext()).inflate( 32 | R.layout.dp_header, this); 33 | 34 | } 35 | 36 | 37 | @Override 38 | public void onUIReset(PtrFrameLayout frame) { 39 | 40 | } 41 | 42 | @Override 43 | public void onUIRefreshPrepare(PtrFrameLayout frame) { 44 | 45 | } 46 | 47 | @Override 48 | public void onUIRefreshBegin(PtrFrameLayout frame) { 49 | 50 | } 51 | 52 | @Override 53 | public void onUIRefreshComplete(PtrFrameLayout frame) { 54 | 55 | } 56 | 57 | @Override 58 | public void onUIPositionChange(PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator) { 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/java/com/android/dalong/ptr/util/PtrLocalDisplay.java: -------------------------------------------------------------------------------- 1 | package com.android.dalong.ptr.util; 2 | 3 | import android.content.Context; 4 | import android.util.DisplayMetrics; 5 | import android.view.View; 6 | import android.view.WindowManager; 7 | 8 | public class PtrLocalDisplay { 9 | 10 | public static int SCREEN_WIDTH_PIXELS; 11 | public static int SCREEN_HEIGHT_PIXELS; 12 | public static float SCREEN_DENSITY; 13 | public static int SCREEN_WIDTH_DP; 14 | public static int SCREEN_HEIGHT_DP; 15 | 16 | public static void init(Context context) { 17 | if (context == null) { 18 | return; 19 | } 20 | DisplayMetrics dm = new DisplayMetrics(); 21 | WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); 22 | wm.getDefaultDisplay().getMetrics(dm); 23 | SCREEN_WIDTH_PIXELS = dm.widthPixels; 24 | SCREEN_HEIGHT_PIXELS = dm.heightPixels; 25 | SCREEN_DENSITY = dm.density; 26 | SCREEN_WIDTH_DP = (int) (SCREEN_WIDTH_PIXELS / dm.density); 27 | SCREEN_HEIGHT_DP = (int) (SCREEN_HEIGHT_PIXELS / dm.density); 28 | } 29 | 30 | public static int dp2px(float dp) { 31 | final float scale = SCREEN_DENSITY; 32 | return (int) (dp * scale + 0.5f); 33 | } 34 | 35 | public static int designedDP2px(float designedDp) { 36 | if (SCREEN_WIDTH_DP != 320) { 37 | designedDp = designedDp * SCREEN_WIDTH_DP / 320f; 38 | } 39 | return dp2px(designedDp); 40 | } 41 | 42 | public static void setPadding(final View view, float left, float top, float right, float bottom) { 43 | view.setPadding(designedDP2px(left), dp2px(top), designedDP2px(right), dp2px(bottom)); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_01.png -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_02.png -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_03.png -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_04.png -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_05.png -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_06.png -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_07.png -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/loading_08.png -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/ptr_rotate_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/ptr_rotate_arrow.png -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/refresh_img.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/refresh_img.gif -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/sample_footer_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/sample_footer_error.png -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/sample_footer_loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/sample_footer_loading.png -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/sdk_ijk_progress_bar_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/sdk_ijk_progress_bar_logo.png -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable-xhdpi/venvy_sdk_progress_bar_anim_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/Lib_Myrecyclerview/src/main/res/drawable-xhdpi/venvy_sdk_progress_bar_anim_bg.png -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable/cube_loging.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable/loading2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 27 | 30 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable/sample_footer_loading_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/drawable/venvy_video_sdk_ijk_progress_bar_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/layout/cube_ptr_simple_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/layout/dp_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/layout/rocket_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 17 | 27 | 28 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/layout/sample_common_list_footer.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 21 | 22 | 27 | 28 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/layout/sample_common_list_footer_end.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/layout/sample_common_list_footer_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 24 | 25 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/layout/sample_common_list_footer_network_error.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 22 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/values-zh/cube_ptr_string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 下拉刷新 5 | 下拉刷新 6 | 释放更新 7 | 正在刷新数据中... 8 | 更新完成. 9 | 10 | 上次更新:  11 |  秒之前 12 |  分钟之前 13 |  小时之前 14 | 15 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #99c937 4 | #99c937 5 | #FF4081 6 | 7 | #F0F0F0 8 | #8A000000 9 | 10 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/values/cube_ptr_attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/values/cube_ptr_string.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Pull Down 5 | Pull Down to Refresh 6 | Release To Refresh 7 | Updating... 8 | Updated. 9 | 10 | last update:  11 |  seconds ago 12 |  minutes ago 13 |  hours ago 14 | 15 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 0.66dp 7 | 4dp 8 | 10dp 9 | 14dp 10 | 22dp 11 | 36dp 12 | 40dp 13 | 60dp 14 | 72dp 15 | 16 | 12sp 17 | 14sp 18 | 16sp 19 | 20 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RecyclerView 3 | 4 | The Header 5 | The Footer 6 | 7 | 8 | 正在加载中… 9 | 点击重新加载 10 | 已经到底了 11 | 12 | 13 | -------------------------------------------------------------------------------- /Lib_Myrecyclerview/src/test/java/com/android/dalong/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.android.dalong; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /Photo_View/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 24 5 | buildToolsVersion '25.0.0' 6 | 7 | defaultConfig { 8 | minSdkVersion 4 9 | targetSdkVersion 24 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | } 14 | 15 | dependencies { 16 | compile "com.android.support:support-v4:24.1.1" 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Photo_View/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=PhotoView Library 2 | POM_ARTIFACT_ID=library 3 | POM_PACKAGING=jar 4 | -------------------------------------------------------------------------------- /Photo_View/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Photo_View/src/main/java/uk/co/senab/photoview/gestures/GestureDetector.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package uk.co.senab.photoview.gestures; 17 | 18 | import android.view.MotionEvent; 19 | 20 | public interface GestureDetector { 21 | 22 | boolean onTouchEvent(MotionEvent ev); 23 | 24 | boolean isScaling(); 25 | 26 | boolean isDragging(); 27 | 28 | void setOnGestureListener(OnGestureListener listener); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Photo_View/src/main/java/uk/co/senab/photoview/gestures/OnGestureListener.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package uk.co.senab.photoview.gestures; 17 | 18 | public interface OnGestureListener { 19 | 20 | void onDrag(float dx, float dy); 21 | 22 | void onFling(float startX, float startY, float velocityX, 23 | float velocityY); 24 | 25 | void onScale(float scaleFactor, float focusX, float focusY); 26 | 27 | } -------------------------------------------------------------------------------- /Photo_View/src/main/java/uk/co/senab/photoview/gestures/VersionedGestureDetector.java: -------------------------------------------------------------------------------- 1 | package uk.co.senab.photoview.gestures; 2 | 3 | /******************************************************************************* 4 | * Copyright 2011, 2012 Chris Banes. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | *******************************************************************************/ 18 | 19 | import android.content.Context; 20 | import android.os.Build; 21 | 22 | public final class VersionedGestureDetector { 23 | 24 | public static GestureDetector newInstance(Context context, 25 | OnGestureListener listener) { 26 | final int sdkVersion = Build.VERSION.SDK_INT; 27 | GestureDetector detector; 28 | 29 | if (sdkVersion < Build.VERSION_CODES.ECLAIR) { 30 | detector = new CupcakeGestureDetector(context); 31 | } else if (sdkVersion < Build.VERSION_CODES.FROYO) { 32 | detector = new EclairGestureDetector(context); 33 | } else { 34 | detector = new FroyoGestureDetector(context); 35 | } 36 | 37 | detector.setOnGestureListener(listener); 38 | 39 | return detector; 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /Photo_View/src/main/java/uk/co/senab/photoview/log/LogManager.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package uk.co.senab.photoview.log; 17 | 18 | import android.util.Log; 19 | 20 | /** 21 | * class that holds the {@link Logger} for this library, defaults to {@link LoggerDefault} to send logs to android {@link Log} 22 | */ 23 | public final class LogManager { 24 | 25 | private static Logger logger = new LoggerDefault(); 26 | 27 | public static void setLogger(Logger newLogger) { 28 | logger = newLogger; 29 | } 30 | 31 | public static Logger getLogger() { 32 | return logger; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Photo_View/src/main/java/uk/co/senab/photoview/log/Logger.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package uk.co.senab.photoview.log; 17 | 18 | /** 19 | * interface for a logger class to replace the static calls to {@link android.util.Log} 20 | */ 21 | public interface Logger { 22 | 23 | int v(String tag, String msg); 24 | 25 | int v(String tag, String msg, Throwable tr); 26 | 27 | int d(String tag, String msg); 28 | 29 | int d(String tag, String msg, Throwable tr); 30 | 31 | int i(String tag, String msg); 32 | 33 | int i(String tag, String msg, Throwable tr); 34 | 35 | int w(String tag, String msg); 36 | 37 | int w(String tag, String msg, Throwable tr); 38 | 39 | int e(String tag, String msg); 40 | 41 | int e(String tag, String msg, Throwable tr); 42 | } 43 | -------------------------------------------------------------------------------- /Photo_View/src/main/java/uk/co/senab/photoview/scrollerproxy/IcsScroller.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package uk.co.senab.photoview.scrollerproxy; 17 | 18 | import android.annotation.TargetApi; 19 | import android.content.Context; 20 | 21 | @TargetApi(14) 22 | public class IcsScroller extends GingerScroller { 23 | 24 | public IcsScroller(Context context) { 25 | super(context); 26 | } 27 | 28 | @Override 29 | public boolean computeScrollOffset() { 30 | return mScroller.computeScrollOffset(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Photo_View/src/main/java/uk/co/senab/photoview/scrollerproxy/ScrollerProxy.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright 2011, 2012 Chris Banes. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *******************************************************************************/ 16 | package uk.co.senab.photoview.scrollerproxy; 17 | 18 | import android.content.Context; 19 | import android.os.Build.VERSION; 20 | import android.os.Build.VERSION_CODES; 21 | 22 | public abstract class ScrollerProxy { 23 | 24 | public static ScrollerProxy getScroller(Context context) { 25 | if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) { 26 | return new PreGingerScroller(context); 27 | } else if (VERSION.SDK_INT < VERSION_CODES.ICE_CREAM_SANDWICH) { 28 | return new GingerScroller(context); 29 | } else { 30 | return new IcsScroller(context); 31 | } 32 | } 33 | 34 | public abstract boolean computeScrollOffset(); 35 | 36 | public abstract void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, 37 | int maxY, int overX, int overY); 38 | 39 | public abstract void forceFinished(boolean finished); 40 | 41 | public abstract boolean isFinished(); 42 | 43 | public abstract int getCurrX(); 44 | 45 | public abstract int getCurrY(); 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MyMVPDemo 2 | #####学习mvp实现的小demo,逻辑简单,便于理解,帮助刚接触mvp+rxjava的人。 3 | 基于Ultra Pull To Refresh 实现了下拉刷新,并且修复了Upt和viewpager的事件冲突问题,也封装了加载更多,很适合新人使用。 4 | 5 | ##项目截图: 6 | ![image](https://github.com/xu649526275/MyMVPDemo/blob/master/pic/gif01.gif) 7 | ![image](https://github.com/xu649526275/MyMVPDemo/blob/master/pic/gif02.gif) 8 | 9 | ##用到的库 10 | - [leakcanary](https://github.com/square/leakcanary) 11 | :检测应用内存泄漏问题,这个都知道吧 12 | - [butterknife](https://github.com/JakeWharton/butterknife) 13 | :帮助Android控件和回调的进行依赖注入,JakeWharton大神的力作 14 | 15 | - [rxjava](https://github.com/ReactiveX/RxJava) 16 | :一个实现异步操作的库,现在非常火 17 | - [RxAndroid](https://github.com/ReactiveX/RxAndroid) 18 | :用于Android的Rxjava绑定库 19 | 20 | - [EventBus](https://github.com/greenrobot/EventBus) 21 | :订阅事件总线 22 | - [retrofit](https://github.com/square/retrofit) 23 | :目前最好用的网络通讯库,应该都用过吧 24 | - [okhttp](https://github.com/square/okhttp) 25 | :okhttp和retrofit做网络通讯是绝配 26 | - [glide](https://github.com/bumptech/glide) 27 | :Google出品的图片加载库,这里有非常好的指导文档:https://mrfu.me/2016/02/27/Glide_Getting_Started/ 28 | 29 | - [PhotoView](https://github.com/chrisbanes/PhotoView) 30 | :可根据手势进行缩放的图像库,这个也很常见 31 | - [gson](https://github.com/google/gson) 32 | :帮助Json和Object转换,这个也常用 33 | - [android-Ultra-Pull-To-Refresh](https://github.com/liaohuqiu/android-Ultra-Pull-To-Refresh) 34 |  :非常强大的下拉刷新 35 | 36 |   37 | 38 |  以及,友盟和鸿洋的auto自适应布局和腾讯x5内核web浏览器等等。 39 | 40 | - 感谢所有优秀的开源项目 41 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/libs/tbs_sdk_thirdapp_v2.4.0.1073_36840_sharewithdownload_obfs_20161011_194834.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/app/libs/tbs_sdk_thirdapp_v2.4.0.1073_36840_sharewithdownload_obfs_20161011_194834.jar -------------------------------------------------------------------------------- /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 D:\DalLong\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/android/mvp/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 36 | 37 | 39 | 40 | 41 | 42 | 43 | 44 | 47 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /app/src/main/assets/fonts/Oswald-Stencbab.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/app/src/main/assets/fonts/Oswald-Stencbab.ttf -------------------------------------------------------------------------------- /app/src/main/assets/fonts/Roboto-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/app/src/main/assets/fonts/Roboto-Bold.ttf -------------------------------------------------------------------------------- /app/src/main/assets/fonts/Roboto-ThinItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/app/src/main/assets/fonts/Roboto-ThinItalic.ttf -------------------------------------------------------------------------------- /app/src/main/assets/fonts/RobotoCondensed-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/app/src/main/assets/fonts/RobotoCondensed-Regular.ttf -------------------------------------------------------------------------------- /app/src/main/assets/fonts/ac.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/app/src/main/assets/fonts/ac.ttf -------------------------------------------------------------------------------- /app/src/main/assets/fonts/gtw.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/app/src/main/assets/fonts/gtw.ttf -------------------------------------------------------------------------------- /app/src/main/assets/fonts/tae_sdk_login.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/app/src/main/assets/fonts/tae_sdk_login.ttf -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/base/BaseModel.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.base; 2 | 3 | import com.android.mvp.http.Http; 4 | import com.android.mvp.util.NetUtil; 5 | 6 | /** 7 | * Created by Administrator on 2016/9/7 0007. 8 | */ 9 | public class BaseModel { 10 | 11 | 12 | public String getCache() { 13 | return NetUtil.isNetworkAvailable() ? Http.CACHE_CONTROL_AGE : Http.CACHE_CONTROL_CACHE; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/base/BasePresenter.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.base; 2 | 3 | import android.content.Context; 4 | 5 | import com.android.mvp.util.NetUtil; 6 | import com.android.mvp.util.ToastShow; 7 | 8 | import rx.Subscription; 9 | import rx.subscriptions.CompositeSubscription; 10 | 11 | /** 12 | * desc 13 | * 14 | * @autor 徐文龙 15 | * @time 2016/9/8 10:20 16 | */ 17 | public class BasePresenter implements BasePresenterI { 18 | 19 | 20 | 21 | public V mView; 22 | public Context context; 23 | private CompositeSubscription mCompositeSubscription; 24 | 25 | @Override 26 | public boolean checkNetWork(Context context) { 27 | if(!NetUtil.isNetworkAvailable()) { 28 | ToastShow.getInstance(context).toastShow("网络不给力"); 29 | } 30 | return NetUtil.isNetworkAvailable(); 31 | } 32 | 33 | 34 | public void attachView(V view,Context context) { 35 | this.mView = view; 36 | this.context=context; 37 | } 38 | 39 | 40 | /** 41 | * 事件订阅 42 | * */ 43 | public void addSubscription(Subscription s) { 44 | if (this.mCompositeSubscription == null) { 45 | this.mCompositeSubscription = new CompositeSubscription(); 46 | } 47 | this.mCompositeSubscription.add(s); 48 | } 49 | 50 | 51 | @Override 52 | public void unsubcrible() { 53 | if (this.mCompositeSubscription != null) { 54 | this.mCompositeSubscription.unsubscribe(); 55 | } 56 | mView=null; 57 | context=null; 58 | this.mCompositeSubscription=null; 59 | } 60 | 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/base/BasePresenterI.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.base; 2 | 3 | import android.content.Context; 4 | 5 | import rx.Subscription; 6 | 7 | /** 8 | * Created by Administrator on 2016/9/7 0007. 9 | */ 10 | public interface BasePresenterI { 11 | 12 | 13 | /** 14 | * 判断网络连接 15 | * */ 16 | boolean checkNetWork(Context context); 17 | 18 | void unsubcrible(); 19 | 20 | 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/base/BaseViewI.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.base; 2 | 3 | /** 4 | * Created by Administrator on 2016/9/7 0007. 5 | */ 6 | public interface BaseViewI { 7 | 8 | 9 | 10 | /** 11 | * 数据加载失败 12 | * tag==1,正常错误,可以只显示toast 13 | * tag=0,非正常错误,需要考虑显示错误界面 14 | * */ 15 | void showDataError(String errorMessage, int tag); 16 | 17 | /** 18 | *数据加载成功 19 | * */ 20 | void showDataSuccess(V datas); 21 | 22 | 23 | /** 24 | * 显示加载进度 25 | * */ 26 | void showProgress(); 27 | 28 | /** 29 | * 显示加载进度 30 | * */ 31 | void hideProgress(); 32 | 33 | /** 34 | * 点击重新加载 35 | * */ 36 | void onReload(); 37 | 38 | 39 | 40 | /** 41 | * 显示加载中视图 42 | * */ 43 | void showLoadingView(); 44 | 45 | 46 | /** 47 | * 显示无网络视图 48 | * */ 49 | void showNetErrorView(); 50 | 51 | /** 52 | * 没有加载到内容 53 | * */ 54 | void showEmptyView(String msg); 55 | 56 | 57 | /** 58 | * 显示内容View 59 | * */ 60 | void showContent(); 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/bean/GankHttpResponse.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.bean; 2 | 3 | /** 4 | * Created by codeest on 2016/8/3. 5 | */ 6 | public class GankHttpResponse { 7 | 8 | private boolean error; 9 | private T results; 10 | 11 | public T getResults() { 12 | return results; 13 | } 14 | 15 | public void setResults(T results) { 16 | this.results = results; 17 | } 18 | 19 | public boolean getError() { 20 | return error; 21 | } 22 | 23 | public void setError(boolean error) { 24 | this.error = error; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/bean/HomeBanner.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.bean; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * desc 7 | * 8 | * @autor 徐文龙 9 | * @time 2016/7/15 15:41 10 | */ 11 | public class HomeBanner implements Serializable { 12 | /** 13 | * Url : http://shianyun-oss.oss-cn-beijing.aliyuncs.com/uploads/AppBanner/dpbanner2.2-3.png 14 | * PageUrl : http://www.baidu.com 15 | * PageTitle : null 16 | * PageDescribe : 3 17 | */ 18 | 19 | private String Url; 20 | private String PageUrl; 21 | private String PageTitle; 22 | private String PageDescribe; 23 | 24 | public String getUrl() { 25 | return Url; 26 | } 27 | 28 | public void setUrl(String Url) { 29 | this.Url = Url; 30 | } 31 | 32 | public String getPageUrl() { 33 | return PageUrl; 34 | } 35 | 36 | public void setPageUrl(String PageUrl) { 37 | this.PageUrl = PageUrl; 38 | } 39 | 40 | public String getPageTitle() { 41 | return PageTitle; 42 | } 43 | 44 | public void setPageTitle(String PageTitle) { 45 | this.PageTitle = PageTitle; 46 | } 47 | 48 | public String getPageDescribe() { 49 | return PageDescribe; 50 | } 51 | 52 | public void setPageDescribe(String PageDescribe) { 53 | this.PageDescribe = PageDescribe; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/bean/HomePost.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.bean; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 首页热帖 7 | * 8 | * @autor 徐文龙 9 | * @time 2016/7/18 13:42 10 | */ 11 | public class HomePost implements Serializable { 12 | 13 | 14 | /** 15 | * CoverImg : http://shianyun-oss.oss-cn-beijing.aliyuncs.com/uploads/DianPing3.0CommunityFile/57190DF71BE15B7049EE439A1C8B2AE8.jpg 16 | * BoardName : 饮食养生 17 | * Title : 《饮食养生》全本_图文精排版_在线阅读-百度阅读 18 | * Id : 22 19 | */ 20 | 21 | private String CoverImg; 22 | private String BoardName; 23 | private String Title; 24 | private String Id; 25 | 26 | public String getCoverImg() { 27 | return CoverImg; 28 | } 29 | 30 | public void setCoverImg(String CoverImg) { 31 | this.CoverImg = CoverImg; 32 | } 33 | 34 | public String getBoardName() { 35 | return BoardName; 36 | } 37 | 38 | public void setBoardName(String BoardName) { 39 | this.BoardName = BoardName; 40 | } 41 | 42 | public String getTitle() { 43 | return Title; 44 | } 45 | 46 | public void setTitle(String Title) { 47 | this.Title = Title; 48 | } 49 | 50 | public String getId() { 51 | return Id; 52 | } 53 | 54 | public void setId(String Id) { 55 | this.Id = Id; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/bean/HomeSpecial.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.bean; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 热门专题 7 | * 8 | * @autor 徐文龙 9 | * @time 2016/7/18 13:59 10 | */ 11 | public class HomeSpecial implements Serializable{ 12 | 13 | /** 14 | * CoverUrl : http://shianyun-oss.oss-cn-beijing.aliyuncs.com/uploads/Community_STCover/546BE9255D455C3A3EE4DD57B8E1B06B.png 15 | * ShortDesc : 烦烦烦烦烦福福福福福福福福福 16 | * Title : 我测测测测 17 | * Id : 21 18 | */ 19 | 20 | private String CoverUrl; 21 | private String ShortDesc; 22 | private String Title; 23 | private String Id; 24 | 25 | public String getCoverUrl() { 26 | return CoverUrl; 27 | } 28 | 29 | public void setCoverUrl(String CoverUrl) { 30 | this.CoverUrl = CoverUrl; 31 | } 32 | 33 | public String getShortDesc() { 34 | return ShortDesc; 35 | } 36 | 37 | public void setShortDesc(String ShortDesc) { 38 | this.ShortDesc = ShortDesc; 39 | } 40 | 41 | public String getTitle() { 42 | return Title; 43 | } 44 | 45 | public void setTitle(String Title) { 46 | this.Title = Title; 47 | } 48 | 49 | public String getId() { 50 | return Id; 51 | } 52 | 53 | public void setId(String Id) { 54 | this.Id = Id; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/bean/M_Base.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.bean; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by 徐文龙 on 2015/11/26. 7 | */ 8 | public class M_Base implements Serializable { 9 | 10 | 11 | /** 12 | * Data : {"cardname":"1","memo":"区域改为703409[2015/2/2 14:06:48]","idcard":"440301111111111111","addr":"深圳市罗湖区发展中心","cardnumber":"1","postcode":"123456","weixin":"","token":"af3eb809-76ea-45c6-b033-860f9b7d2ae2","CloudID":"00000000","email":"12345@qq.com","QQ":"","name":"食安互智社群","gender":"男","branch":"河北省","bank":"中国建设银行","mobile":"13631622222","weibo":""} 13 | * Status : 1 14 | * RealTime : 2015-11-26 10:46:21 15 | * Mssage : 成功 16 | */ 17 | private T Data; 18 | private int Status; 19 | private String RealTime; 20 | private String Mssage; 21 | 22 | 23 | public void setData(T Data) { 24 | this.Data = Data; 25 | } 26 | 27 | public void setStatus(int Status) { 28 | this.Status = Status; 29 | } 30 | 31 | public void setRealTime(String RealTime) { 32 | this.RealTime = RealTime; 33 | } 34 | 35 | public void setMssage(String Mssage) { 36 | this.Mssage = Mssage; 37 | } 38 | 39 | public T getData() { 40 | return Data; 41 | } 42 | 43 | public int getStatus() { 44 | return Status; 45 | } 46 | 47 | public String getRealTime() { 48 | return RealTime; 49 | } 50 | 51 | public String getMssage() { 52 | return Mssage; 53 | } 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/bean/MyUrl.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.bean; 2 | 3 | /** 4 | * desc 5 | * 6 | * @autor 徐文龙 7 | * @time 2016/9/9 14:22 8 | */ 9 | public class MyUrl { 10 | private String webUrl; 11 | private String webTitle; 12 | 13 | public MyUrl(String webUrl, String webTitle) { 14 | this.webUrl = webUrl; 15 | this.webTitle = webTitle; 16 | } 17 | 18 | public String getWebUrl() { 19 | return webUrl; 20 | } 21 | 22 | public void setWebUrl(String webUrl) { 23 | this.webUrl = webUrl; 24 | } 25 | 26 | public String getWebTitle() { 27 | return webTitle; 28 | } 29 | 30 | public void setWebTitle(String webTitle) { 31 | this.webTitle = webTitle; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/bean/NewTabs.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.bean; 2 | 3 | /** 4 | * Created by Administrator on 2016/9/25 0025. 5 | */ 6 | 7 | public class NewTabs{ 8 | 9 | private String NewTabId; 10 | private String NewTabName; 11 | private String NewTabType; 12 | private boolean newsChannelSelect;//默认选中的 13 | private int newsChannelIndex;//索引 14 | private Boolean newsChannelFixed;//选中的 15 | 16 | public String getNewTabId() { 17 | return NewTabId; 18 | } 19 | 20 | public void setNewTabId(String newTabId) { 21 | NewTabId = newTabId; 22 | } 23 | 24 | public String getNewTabName() { 25 | return NewTabName; 26 | } 27 | 28 | public void setNewTabName(String newTabName) { 29 | NewTabName = newTabName; 30 | } 31 | 32 | public String getNewTabType() { 33 | return NewTabType; 34 | } 35 | 36 | public void setNewTabType(String newTabType) { 37 | NewTabType = newTabType; 38 | } 39 | 40 | public boolean isNewsChannelSelect() { 41 | return newsChannelSelect; 42 | } 43 | 44 | public void setNewsChannelSelect(boolean newsChannelSelect) { 45 | this.newsChannelSelect = newsChannelSelect; 46 | } 47 | 48 | public int getNewsChannelIndex() { 49 | return newsChannelIndex; 50 | } 51 | 52 | public void setNewsChannelIndex(int newsChannelIndex) { 53 | this.newsChannelIndex = newsChannelIndex; 54 | } 55 | 56 | public Boolean getNewsChannelFixed() { 57 | return newsChannelFixed; 58 | } 59 | 60 | public void setNewsChannelFixed(Boolean newsChannelFixed) { 61 | this.newsChannelFixed = newsChannelFixed; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/bean/WXHttpResponse.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.bean; 2 | 3 | /** 4 | * Created by codeest on 16/8/28. 5 | */ 6 | 7 | public class WXHttpResponse { 8 | 9 | private int code; 10 | private String msg; 11 | private T newslist; 12 | 13 | public int getCode() { 14 | return code; 15 | } 16 | 17 | public void setCode(int code) { 18 | this.code = code; 19 | } 20 | 21 | public String getMsg() { 22 | return msg; 23 | } 24 | 25 | public void setMsg(String msg) { 26 | this.msg = msg; 27 | } 28 | 29 | public T getNewslist() { 30 | return newslist; 31 | } 32 | 33 | public void setNewslist(T newslist) { 34 | this.newslist = newslist; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/bean/WXItemBean.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.bean; 2 | 3 | /** 4 | * Created by codeest on 16/8/28. 5 | */ 6 | 7 | public class WXItemBean { 8 | 9 | /** 10 | * ctime : 2016-03-31 11 | * title : 小本生意做什么挣钱十七大小本生意推荐 12 | * description : 创业最前线 13 | * picUrl : http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225297.jpg/640 14 | * url : http://mp.weixin.qq.com/s?__biz=MzA3NjgzNDUwMQ==&idx=2&mid=401864059&sn=cfa082e38ba38c7e673b1ce0a075faee 15 | */ 16 | 17 | private String ctime; 18 | private String title; 19 | private String description; 20 | private String picUrl; 21 | private String url; 22 | 23 | public String getCtime() { 24 | return ctime; 25 | } 26 | 27 | public void setCtime(String ctime) { 28 | this.ctime = ctime; 29 | } 30 | 31 | public String getTitle() { 32 | return title; 33 | } 34 | 35 | public void setTitle(String title) { 36 | this.title = title; 37 | } 38 | 39 | public String getDescription() { 40 | return description; 41 | } 42 | 43 | public void setDescription(String description) { 44 | this.description = description; 45 | } 46 | 47 | public String getPicUrl() { 48 | return picUrl; 49 | } 50 | 51 | public void setPicUrl(String picUrl) { 52 | this.picUrl = picUrl; 53 | } 54 | 55 | public String getUrl() { 56 | return url; 57 | } 58 | 59 | public void setUrl(String url) { 60 | this.url = url; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/db/DbHelper.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.db; 2 | 3 | import android.content.Context; 4 | import android.database.sqlite.SQLiteDatabase; 5 | import android.database.sqlite.SQLiteOpenHelper; 6 | 7 | /** 8 | * Created by Administrator on 2016/9/27 0027. 9 | */ 10 | 11 | public class DbHelper extends SQLiteOpenHelper { 12 | 13 | private Context context; 14 | private static final String DB_NAME = "dalong.db"; 15 | private static final int DB_VERSION = 1; // 添加环信用户信息表 16 | 17 | 18 | public DbHelper(Context context){ 19 | super(context,DB_NAME,null,DB_VERSION); 20 | this.context=context; 21 | 22 | } 23 | 24 | 25 | @Override 26 | public void onCreate(SQLiteDatabase db) { 27 | db.execSQL("create table "+DbModel.NewTable+"(_id INTEGER PRIMARY KEY AUTOINCREMENT" + 28 | ","+DbModel.NewId+" text," + 29 | DbModel.NewName+" text," + 30 | DbModel.NewType+" text," + 31 | DbModel.NewSelect+" text," + 32 | DbModel.NewIndex+" text," + 33 | DbModel.NewFixed+" text)"); 34 | } 35 | 36 | 37 | @Override 38 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/db/DbModel.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.db; 2 | 3 | /** 4 | * Created by Administrator on 2016/9/27 0027. 5 | */ 6 | 7 | public class DbModel { 8 | public static final String NewTable="db_new"; 9 | public static final String NewId="NewTabId"; 10 | public static final String NewName="NewTabName"; 11 | public static final String NewType="NewTabType"; 12 | public static final String NewSelect="newsChannelSelect"; 13 | public static final String NewIndex="newsChannelIndex"; 14 | public static final String NewFixed="newsChannelFixed"; 15 | 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/event/DaLongEvent.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.event; 2 | 3 | /** 4 | * Created by Administrator on 2017/3/16 0016. 5 | */ 6 | 7 | public class DaLongEvent { 8 | 9 | String name; 10 | 11 | public DaLongEvent(String name) { 12 | this.name = name; 13 | } 14 | 15 | public String getName() { 16 | return name; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/event/TabEvent.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.event; 2 | 3 | import com.android.mvp.bean.NewTabs; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by Administrator on 2016/10/17. 9 | */ 10 | 11 | public class TabEvent { 12 | 13 | public List tabs; 14 | 15 | public TabEvent(List tabs) { 16 | this.tabs = tabs; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/event/WxSearchEvent.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.event; 2 | 3 | /** 4 | * desc 5 | * 6 | * @autor 徐文龙 7 | * @time 2016/9/20 14:56 8 | */ 9 | public class WxSearchEvent { 10 | 11 | public String searchStr; 12 | 13 | public WxSearchEvent(String searchStr) { 14 | this.searchStr = searchStr; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/http/ConstantValues.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.http; 2 | 3 | /** 4 | * 点屏app Service 5 | * 6 | * @autor 徐文龙 7 | * @time 2016/7/14 15:10 8 | */ 9 | public class ConstantValues { 10 | 11 | public static boolean ISUPLOAD = false; 12 | public static final String packageName = "com.android.mvp"; 13 | public static final String MAIN_HTML = "http://www.shiandianping.com"; 14 | 15 | 16 | 17 | 18 | // 正式服务器 19 | public static final String URL_HEAD = "http://api.shiandianping.com"; 20 | 21 | /** 22 | * 请求来源 23 | */ 24 | public static final String URL_SOURCE = "sourceAndroidDianPing"; 25 | 26 | /** 27 | * URL 28 | */ 29 | public static final String BASE_URL = "/api/" + URL_SOURCE + "/v1.0/"; 30 | 31 | 32 | /** 33 | * 首页 34 | * */ 35 | 36 | //首页轮播图 37 | public static final String Home_Banner=BASE_URL+"Banner"; 38 | 39 | //首页产品类别 40 | public static final String Home_ProductBrand=BASE_URL+"ProductBrand"; 41 | 42 | //首页社区 43 | public static final String HOME_Posts=BASE_URL+"posts/GetHeatPost"; 44 | 45 | //首页专题 46 | public static final String Home_SpecialTopic=BASE_URL+"SpecialTopic"; 47 | //专题详情 48 | public static final String SpecialInfo=BASE_URL+"SpecialTopic"; 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/http/DPService.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.http; 2 | 3 | 4 | import com.android.mvp.bean.BrandBean; 5 | import com.android.mvp.bean.HomeBanner; 6 | import com.android.mvp.bean.HomePost; 7 | import com.android.mvp.bean.HomeSpecial; 8 | import com.android.mvp.bean.M_Base; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | import retrofit2.http.GET; 14 | import retrofit2.http.Header; 15 | import retrofit2.http.QueryMap; 16 | import rx.Observable; 17 | 18 | 19 | /** 20 | * Created by dalong on 2016/3/16. 21 | */ 22 | public interface DPService { 23 | 24 | 25 | /** 26 | * 首页Banner 27 | * */ 28 | @GET(ConstantValues.Home_Banner) 29 | Observable>> homeBanner(); 30 | 31 | 32 | /** 33 | * 首页 34 | * */ 35 | @GET(ConstantValues.Home_ProductBrand) 36 | Observable>> homeBrand(); 37 | 38 | /** 39 | * 热帖 40 | * */ 41 | @GET(ConstantValues.HOME_Posts) 42 | Observable>> homePost(); 43 | 44 | 45 | /** 46 | * 专题热门 47 | * */ 48 | @GET(ConstantValues.Home_SpecialTopic) 49 | Observable>> homeSpecial(@QueryMap Map map); 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/http/GankApis.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.http; 2 | 3 | 4 | import com.android.mvp.bean.GankHttpResponse; 5 | import com.android.mvp.bean.GankItemBean; 6 | 7 | import java.util.List; 8 | 9 | import retrofit2.http.GET; 10 | import retrofit2.http.Path; 11 | import rx.Observable; 12 | 13 | /** 14 | * Created by codeest on 16/8/19. 15 | */ 16 | 17 | public interface GankApis { 18 | // 19 | String HOST = "http://gank.io/api/"; 20 | // 21 | /** 22 | * 技术文章列表 23 | */ 24 | 25 | @GET("data/{tech}/{num}/{page}") 26 | Observable>> getTechList(@Path("tech") String tech, @Path("num") int num, @Path("page") int page); 27 | // 28 | /** 29 | * 妹纸列表 30 | */ 31 | @GET("data/福利/{num}/{page}") 32 | Observable>> getGirlList(@Path("num") int num, @Path("page") int page); 33 | // 34 | // /** 35 | // * 随机妹纸图 36 | // */ 37 | // @GET("random/data/福利/{num}") 38 | // Observable>> getRandomGirl(@Path("num") int num); 39 | // 40 | // /** 41 | // * 搜索 42 | // */ 43 | // @GET("search/query/{query}/category/{type}/count/{count}/page/{page}") 44 | // Observable>> getSearchList(@Path("query") String query, @Path("type") String type, @Path("count") int num, @Path("page") int page); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/http/ResultTag.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.http; 2 | 3 | /** 4 | * Created by Administrator on 2016/3/30. 5 | */ 6 | public class ResultTag { 7 | 8 | public static final int SUCCESS = 1; 9 | public static final int ERROR = 0; 10 | public static final int MISSING_PARAMETERS = 2; 11 | public static final int SOUCE_ERROR = 3; 12 | public static final int USERINFO_ERROR = 4; 13 | public static final int LOGINSTTUS_ERROR = 5; 14 | public static final int PARAMETER_FORMAT_ERROR = 6; 15 | public static final int NO_DATA = 7; 16 | public static final int CONDITION_ERROR = 8; 17 | public static final int REPETITIVE_OPERATION = 9; 18 | public static final int SIGNATURE = 10; 19 | public static final int TIMESTAMP_ERROR = 11; 20 | public static final int TIMEOUT = 12; 21 | public static final int UPLOAD_FAIL = 13; 22 | public static final int NOT_ZYXK_ERROR = 14; 23 | public static final int VERIFICATION_CODE_NONENTITY = 16; 24 | public static final int VERIFICATION_CODE_ERROR = 17; 25 | public static final int NO_LOGIN = 18; 26 | public static final int USER_REPETION = 27; 27 | public static final int SHOPCAR_ADD_RESULT = 31; 28 | public static final int BOARD_DELETE= 32; 29 | 30 | public static final int VERSION=30; 31 | 32 | 33 | 34 | 35 | 36 | /**0:服务器繁忙,操作失败 37 | * 1:成功 38 | *2:缺少必要参数 39 | *3:请求来源不正确 40 | *4:云码或密码错误 41 | *5:登录状态不正确,您的登录状态可能已丢失,请重新登录 42 | *6:参数格式不正确 43 | * 7:没有数据 44 | *8:条件不符合 45 | * 9:重复操作 46 | *10:签名验证不正确 47 | *11:签名时间戳不正确 48 | * 12:请求超时 49 | * 13:上传失败 50 | *14:对不起,您不是智云小库手机用户 51 | *16:验证码不存在 52 | *17:验证码错误 53 | * 18:没有登录 54 | * 19:已经申请过端码狂,还没有付款 55 | * 20:对不起,您既不是中国创客伙伴也不是中国食养家庭VIP 21:您的端码狂不符合条件,你需要在真美食安卫士网站租赁行头包之后,才能申请智云小库抢租资格 22:推送失败 23:发送短信失败 24:对不起,您已经获得了一个狂码,不能再次获取 25:对不起,狂码号段已经发放完毕 26:该用户不存在 56 | * 27:用户重复 57 | * 30:提示版本更新 58 | * 31:如果单个商品添加的数量大于99会返回Status=31,Mssage="该商品购买数量最多为99" 59 | * 32:帖子已删除 60 | **/ 61 | 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/http/WYApis.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.http; 2 | 3 | import com.android.mvp.bean.WYDetial; 4 | import com.android.mvp.bean.WYNewsBean; 5 | import com.android.mvp.bean.WYVideosBean; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | import retrofit2.http.GET; 11 | import retrofit2.http.Header; 12 | import retrofit2.http.Path; 13 | import rx.Observable; 14 | 15 | /** 16 | * desc 17 | * 18 | * @autor 徐文龙 19 | * @time 2016/9/22 15:52 20 | */ 21 | public interface WYApis { 22 | 23 | /** 24 | * 请求新闻列表 例子:http://c.m.163.com/nc/article/headline/T1348647909107/0-20.html 25 | * 26 | * @param type 新闻类别:headline为头条,local为北京本地,fangchan为房产,list为其他 27 | * @param id 新闻类别id 28 | * @param startPage 开始的页码 29 | * @return 被观察对象 30 | */ 31 | @GET(WyConstantValues.HEAD+"{type}/{id}/{pageIndex}-20.html") 32 | Observable>> getNewsList( 33 | @Path("type") String type, @Path("id") String id,@Path("pageIndex") int pageIndex); 34 | 35 | /** 36 | * 新闻详情:例子:http://c.m.163.com/nc/article/BFNFMVO800034JAU/full.html 37 | * 38 | * @param postId 新闻详情的id 39 | * @return 被观察对象 40 | * @Header("Cache-Control") String cacheControl, 41 | */ 42 | @GET("nc/article/{postId}/full.html") 43 | Observable> getNewsDetail(@Path("postId") String postId); 44 | 45 | 46 | /** 47 | * 网易视频列表 例子:http://c.m.163.com/nc/video/list/V9LG4B3A0/n/0-10.html 48 | * 49 | * @param id 视频类别id 50 | * @param startPage 开始的页码 51 | * @return 被观察者 52 | */ 53 | @GET("nc/video/list/{id}/n/{pageIndex}-10.html") 54 | Observable>> getVideoList( 55 | @Path("id") String id,@Path("pageIndex") int pageIndex); 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/http/WeChatApis.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.http; 2 | 3 | import com.android.mvp.bean.WXHttpResponse; 4 | import com.android.mvp.bean.WXItemBean; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import retrofit2.http.GET; 10 | import retrofit2.http.Query; 11 | import retrofit2.http.QueryMap; 12 | import rx.Observable; 13 | 14 | /** 15 | * Created by codeest on 16/8/28. 16 | */ 17 | 18 | public interface WeChatApis { 19 | 20 | String HOST = "http://api.tianapi.com/"; 21 | String MYKEY="a168a48492d240fae6fd2c6b6ea4e7b4"; 22 | // 23 | /** 24 | * 微信精选列表 25 | */ 26 | @GET("wxnew") 27 | Observable>> getWXHot(@Query("key") String key, @Query("num") int num, @Query("page") int page); 28 | @GET("wxnew") 29 | Observable>> getWXHot(@QueryMap Map map); 30 | /** 31 | * 微信精选列表 32 | */ 33 | @GET("wxnew") 34 | Observable>> getWXHotSearch(@Query("key") String key, @Query("num") int num, @Query("page") int page, @Query("word") String word); 35 | @GET("wxnew") 36 | Observable>> getWXHotSearch(@QueryMap Map map); 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/model/GankModel.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.model; 2 | 3 | import com.android.mvp.bean.GankHttpResponse; 4 | import com.android.mvp.bean.GankItemBean; 5 | import com.android.mvp.http.Http; 6 | 7 | import java.util.List; 8 | 9 | import rx.Observable; 10 | import rx.android.schedulers.AndroidSchedulers; 11 | import rx.schedulers.Schedulers; 12 | 13 | /** 14 | * desc 15 | * 16 | * @autor 徐文龙 17 | * @time 2016/9/21 14:37 18 | */ 19 | public class GankModel { 20 | 21 | 22 | /** 23 | * 获取妹子图片 24 | * */ 25 | public Observable>> getGirlList( int num,int page){ 26 | return Http.getInstance().getGankService().getGirlList(num,page).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()); 27 | } 28 | 29 | /** 30 | * 获取技术文章 31 | * */ 32 | public Observable>> getTechList(String tech, int num,int page){ 33 | return Http.getInstance().getGankService().getTechList(tech,num,page); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/model/HomeModel.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.model; 2 | 3 | import com.android.mvp.base.BaseModel; 4 | import com.android.mvp.bean.BrandBean; 5 | import com.android.mvp.bean.HomeBanner; 6 | import com.android.mvp.bean.HomePost; 7 | import com.android.mvp.bean.HomeSpecial; 8 | import com.android.mvp.bean.M_Base; 9 | import com.android.mvp.http.Http; 10 | 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | import rx.Observable; 15 | import rx.android.schedulers.AndroidSchedulers; 16 | import rx.schedulers.Schedulers; 17 | 18 | /** 19 | * Created by Administrator on 2016/9/7 0007. 20 | */ 21 | public class HomeModel extends BaseModel { 22 | 23 | 24 | 25 | 26 | public Observable>> getHomeBanner() { 27 | return Http.getInstance().getSAYDService().homeBanner().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()); 28 | } 29 | 30 | 31 | 32 | /** 33 | * 首页 34 | * */ 35 | public Observable>> homeBrand(){ 36 | 37 | return Http.getInstance().getSAYDService().homeBrand(); 38 | } 39 | 40 | 41 | /** 42 | * 热帖 43 | * */ 44 | public Observable>> homePost(){ 45 | return Http.getInstance().getSAYDService().homePost(); 46 | } 47 | 48 | public Observable>> homeSpecial(Map map){ 49 | return Http.getInstance().getSAYDService().homeSpecial(map); 50 | } 51 | 52 | 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/model/NewModel.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.model; 2 | 3 | import com.android.mvp.bean.WYDetial; 4 | import com.android.mvp.bean.WYNewsBean; 5 | import com.android.mvp.http.Http; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | import rx.Observable; 11 | import rx.android.schedulers.AndroidSchedulers; 12 | import rx.schedulers.Schedulers; 13 | 14 | /** 15 | * desc 16 | * 17 | * @autor 徐文龙 18 | * @time 2016/10/10 14:58 19 | */ 20 | public class NewModel { 21 | 22 | 23 | /** 24 | * 获取新闻List列表 25 | * */ 26 | public Observable>> getNewsList(String type, String id, int pageIndex){ 27 | return Http.getInstance().getNewService().getNewsList(type,id,pageIndex ).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()); 28 | } 29 | 30 | 31 | public Observable> getNewsDetail(String id){ 32 | 33 | return Http.getInstance().getNewService().getNewsDetail(id).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/model/WXModel.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.model; 2 | 3 | import com.android.mvp.base.BaseModel; 4 | import com.android.mvp.bean.WXHttpResponse; 5 | import com.android.mvp.bean.WXItemBean; 6 | import com.android.mvp.http.Http; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | import rx.Observable; 12 | import rx.android.schedulers.AndroidSchedulers; 13 | import rx.schedulers.Schedulers; 14 | 15 | /** 16 | * desc 17 | * 18 | * @autor 徐文龙 19 | * @time 2016/9/20 13:24 20 | */ 21 | public class WXModel extends BaseModel{ 22 | 23 | 24 | /** 25 | * 微信精选 26 | * */ 27 | public Observable>> getWXHot(Map map){ 28 | return Http.getInstance().getWXService().getWXHot(map).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()); 29 | } 30 | 31 | 32 | /** 33 | * 微信精选搜索 34 | * */ 35 | public Observable>> getWXHotSearch(Map map){ 36 | return Http.getInstance().getWXService().getWXHotSearch(map).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/presenter/NewDetialPresenter.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.presenter; 2 | 3 | import com.android.mvp.base.BasePresenter; 4 | import com.android.mvp.bean.WYDetial; 5 | import com.android.mvp.model.NewModel; 6 | import com.android.mvp.presenter.contract.NewDetialContract; 7 | 8 | import java.util.Map; 9 | 10 | import rx.Subscriber; 11 | 12 | /** 13 | * Created by Administrator on 2016/10/31. 14 | */ 15 | 16 | public class NewDetialPresenter extends BasePresenter implements NewDetialContract.Presenter { 17 | 18 | 19 | private NewModel model; 20 | 21 | 22 | public NewDetialPresenter() { 23 | 24 | this.model = new NewModel(); 25 | } 26 | 27 | @Override 28 | public void getNewById(String id) { 29 | 30 | model.getNewsDetail(id).subscribe(new Subscriber>() { 31 | @Override 32 | public void onCompleted() { 33 | 34 | } 35 | 36 | @Override 37 | public void onError(Throwable e) { 38 | mView.showDataError("网络异常",0); 39 | } 40 | 41 | @Override 42 | public void onNext(Map stringWYDetialMap) { 43 | WYDetial newsDetail = stringWYDetialMap.get(id); 44 | mView.showDataSuccess(newsDetail); 45 | } 46 | }); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/presenter/contract/GankContract.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.presenter.contract; 2 | 3 | import com.android.mvp.base.BaseViewI; 4 | import com.android.mvp.bean.GankItemBean; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * desc 10 | * 11 | * @autor 徐文龙 12 | * @time 2016/9/21 14:34 13 | */ 14 | public interface GankContract { 15 | 16 | interface View extends BaseViewI>{ 17 | 18 | }; 19 | 20 | 21 | interface Presenter{ 22 | public void getGankGirl(int pageSize,int pageIndex); 23 | 24 | public void getGankTech(String tech,int pageSize,int pageIndex); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/presenter/contract/HomeContract.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.presenter.contract; 2 | 3 | import com.android.mvp.base.BaseViewI; 4 | import com.android.mvp.bean.BrandBean; 5 | import com.android.mvp.bean.HomeBanner; 6 | import com.android.mvp.bean.HomePost; 7 | import com.android.mvp.bean.HomeSpecial; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | * desc 14 | * 15 | * @autor 徐文龙 16 | * @time 2016/9/18 11:08 17 | */ 18 | public interface HomeContract { 19 | 20 | 21 | 22 | interface View extends BaseViewI> { 23 | 24 | 25 | public void onPostSuccess(List homePosts); 26 | 27 | public void onBannerSuccess(List homeBanner); 28 | 29 | public void onSpecialSuccess(List homeSpecial); 30 | 31 | public void onSpecialError(String Message,int errorTag); 32 | 33 | } 34 | 35 | interface Presenter{ 36 | /** 37 | * 首页Banner界面 38 | * */ 39 | public void getHomeBanner(); 40 | public void getBrand(); 41 | public void getPost(); 42 | public void getSpecial(Map map); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/presenter/contract/NewDetialContract.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.presenter.contract; 2 | 3 | import com.android.mvp.base.BaseViewI; 4 | import com.android.mvp.bean.WYDetial; 5 | 6 | /** 7 | * Created by Administrator on 2016/10/31. 8 | */ 9 | 10 | public interface NewDetialContract { 11 | 12 | 13 | public interface View extends BaseViewI{} 14 | 15 | public interface Presenter{ 16 | 17 | public void getNewById(String id); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/presenter/contract/NewsContract.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.presenter.contract; 2 | 3 | import com.android.mvp.base.BaseViewI; 4 | import com.android.mvp.bean.NewTabs; 5 | import com.android.mvp.bean.WYNewsBean; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by Administrator on 2016/9/29 0029. 11 | */ 12 | 13 | public interface NewsContract { 14 | /** 15 | * 新闻总界面的视图View 16 | * 主要负责初始化tab数据库和查询tab 17 | * */ 18 | public interface View extends BaseViewI>{ 19 | 20 | }; 21 | 22 | /** 23 | * 新闻总界面的视图Presenter 24 | * 主要负责初始化tab数据库和查询tab 25 | * */ 26 | public interface Presenter{ 27 | public void initTabs(); 28 | public void queryTabs(); 29 | } 30 | 31 | 32 | /** 33 | * tab编辑界面的 Presenter 34 | * */ 35 | public interface TAbView extends BaseViewI>{ 36 | 37 | public void showMoreTabSuccess(List moreTabs); 38 | public void onMyItemClick(NewTabs tabs,int position); 39 | public void onMoreItemClick(NewTabs tabs,int position); 40 | }; 41 | 42 | 43 | 44 | /** 45 | * tab编辑界面的 Presenter 46 | * */ 47 | public interface TabPresenter{ 48 | public void getMyTabs(); 49 | public void getMoreTabs(); 50 | public void updateMyItemClick(NewTabs tabs, int position); 51 | public void updateMoreItemClick(NewTabs tabs, int position); 52 | } 53 | 54 | 55 | 56 | /** 57 | * 新闻内容列表Fragmment的View 58 | * */ 59 | public interface NewsView extends BaseViewI>{ 60 | 61 | }; 62 | /** 63 | * 新闻内容列表Fragmment的Presenter 64 | * */ 65 | public interface NewByIdPresenterI{ 66 | public void getNewById(String type,String id,int pageIndex); 67 | 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/presenter/contract/WxContract.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.presenter.contract; 2 | 3 | import com.android.mvp.base.BaseViewI; 4 | import com.android.mvp.bean.WXItemBean; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | /** 10 | * desc 11 | * 12 | * @autor 徐文龙 13 | * @time 2016/9/20 13:30 14 | */ 15 | public interface WxContract { 16 | 17 | 18 | public interface View extends BaseViewI>{ 19 | 20 | } 21 | 22 | public interface Presenter{ 23 | 24 | public void getWxHost(Map map); 25 | 26 | public void getWxHostSearch(Map map); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/ui/MyPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.ui; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * desc 11 | * 12 | * @autor 徐文龙 13 | * @time 2016/9/21 16:22 14 | */ 15 | public class MyPagerAdapter extends FragmentPagerAdapter { 16 | 17 | private List mFragmentList; 18 | private List mTitles; 19 | 20 | 21 | public void setData(List fragmentList, List titles){ 22 | mFragmentList = fragmentList; 23 | mTitles = titles; 24 | this.notifyDataSetChanged(); 25 | } 26 | 27 | 28 | public MyPagerAdapter(FragmentManager fm, List fragmentList, List titles) { 29 | super(fm); 30 | mFragmentList = fragmentList; 31 | mTitles = titles; 32 | } 33 | 34 | @Override 35 | public Fragment getItem(int position) { 36 | return mFragmentList.get(position); 37 | } 38 | 39 | @Override 40 | public int getCount() { 41 | return mFragmentList.size(); 42 | } 43 | 44 | @Override 45 | public CharSequence getPageTitle(int position) { 46 | return mTitles.get(position); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/ui/gank/adapter/GankPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.ui.gank.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * desc 11 | * 12 | * @autor 徐文龙 13 | * @time 2016/9/21 16:22 14 | */ 15 | public class GankPagerAdapter extends FragmentPagerAdapter { 16 | 17 | private List mFragmentList; 18 | private List mTitles; 19 | 20 | 21 | public GankPagerAdapter(FragmentManager fm, List fragmentList, List titles) { 22 | super(fm); 23 | mFragmentList = fragmentList; 24 | mTitles = titles; 25 | } 26 | 27 | @Override 28 | public Fragment getItem(int position) { 29 | return mFragmentList.get(position); 30 | } 31 | 32 | @Override 33 | public int getCount() { 34 | return mFragmentList.size(); 35 | } 36 | 37 | @Override 38 | public CharSequence getPageTitle(int position) { 39 | return mTitles.get(position); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/ui/main/FragmentFactory.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.ui.main; 2 | 3 | import android.content.Context; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.app.FragmentManager; 6 | import android.support.v4.app.FragmentPagerAdapter; 7 | 8 | import com.android.mvp.R; 9 | import com.android.mvp.ui.gank.fragment.FragmentGank; 10 | import com.android.mvp.ui.news.fragment.FragmentNew; 11 | import com.android.mvp.ui.sayd.fragment.FragmentSAYDHome; 12 | import com.android.mvp.ui.video.FragmentVideo; 13 | import com.android.mvp.ui.wx.fragment.FragmentWx; 14 | import com.android.mvp.ui.zhihu.fragment.FragmentZhihu; 15 | 16 | 17 | public class FragmentFactory extends FragmentPagerAdapter { 18 | 19 | protected Context context; 20 | 21 | public FragmentFactory(FragmentManager fm, Context context) { 22 | super(fm); 23 | this.context = context; 24 | } 25 | 26 | 27 | @Override 28 | public Fragment getItem(int res) { 29 | Fragment fragment = null; 30 | switch (res) { 31 | // case R.id.drawer_dp: 32 | // fragment=new FragmentSAYDHome(); 33 | // break; 34 | // case R.id.drawer_zhihu: 35 | // fragment=new FragmentZhihu(); 36 | // break; 37 | case R.id.drawer_gank: 38 | fragment=new FragmentGank(); 39 | break; 40 | case R.id.drawer_wechat: 41 | fragment=new FragmentWx(); 42 | break; 43 | case R.id.drawer_news: 44 | fragment=new FragmentNew(); 45 | break; 46 | case R.id.drawer_video: 47 | fragment=new FragmentVideo(); 48 | break; 49 | default: 50 | break; 51 | } 52 | return fragment; 53 | } 54 | 55 | @Override 56 | public int getCount() { 57 | return 4; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/ui/sayd/adapter/HomeBannerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.ui.sayd.adapter; 2 | 3 | import android.support.v4.view.PagerAdapter; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | import android.view.ViewParent; 7 | import android.widget.ImageView; 8 | 9 | import java.util.ArrayList; 10 | 11 | /** 12 | * 首页banneradapter 13 | * */ 14 | public class HomeBannerAdapter extends PagerAdapter { 15 | 16 | private static final String TAG=HomeBannerAdapter.class.getSimpleName(); 17 | 18 | private ArrayList viewlist; 19 | 20 | public HomeBannerAdapter(ArrayList viewlist) { 21 | this.viewlist = viewlist; 22 | } 23 | 24 | @Override 25 | public int getCount() { 26 | // 设置成最大,使用户看不到边界 27 | return Integer.MAX_VALUE; 28 | } 29 | 30 | @Override 31 | public boolean isViewFromObject(View arg0, Object arg1) { 32 | return arg0 == arg1; 33 | } 34 | 35 | @Override 36 | public void destroyItem(ViewGroup container, int position, Object object) { 37 | // Warning:不要在这里调用removeView 38 | //container.removeView(viewlist.get(position%3)); 39 | // Log.v(TAG, "destroyItem" + position % 3); 40 | } 41 | 42 | @Override 43 | public Object instantiateItem(ViewGroup container, int position) { 44 | // 对ViewPager页号求模取出View列表中要显示的项 45 | position %= viewlist.size(); 46 | if (position < 0) { 47 | position = viewlist.size() + position%3; 48 | } 49 | ImageView view = viewlist.get(position%3 ); 50 | 51 | 52 | // 如果View已经在之前添加到了一个父组件,则必须先remove,否则会抛出IllegalStateException。 53 | ViewParent vp = view.getParent(); 54 | if (vp != null) { 55 | ViewGroup parent = (ViewGroup) vp; 56 | parent.removeView(view); 57 | } 58 | container.addView(view); 59 | // add listeners here if necessary 60 | return view; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/ui/video/FragmentVideo.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.ui.video; 2 | 3 | import android.view.View; 4 | 5 | import com.android.mvp.base.BaseFragment; 6 | 7 | /** 8 | * Created by Administrator on 2016/9/29 0029. 9 | */ 10 | 11 | public class FragmentVideo extends BaseFragment { 12 | @Override 13 | protected void initData() { 14 | 15 | } 16 | 17 | @Override 18 | protected void initView(View RootView) { 19 | 20 | } 21 | 22 | @Override 23 | protected void initToolbar() { 24 | 25 | } 26 | 27 | @Override 28 | protected int getContentLayout() { 29 | return 0; 30 | } 31 | 32 | 33 | @Override 34 | public void setMenuVisibility(boolean menuVisible) { 35 | super.setMenuVisibility(menuVisible); 36 | if (this.getView() != null) 37 | this.getView() 38 | .setVisibility(menuVisible ? View.VISIBLE : View.GONE); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/ui/zhihu/fragment/FragmentZhihu.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.ui.zhihu.fragment; 2 | 3 | import android.view.View; 4 | 5 | import com.android.mvp.R; 6 | import com.android.mvp.base.BaseFragment; 7 | 8 | /** 9 | * desc 10 | * 11 | * @autor 徐文龙 12 | * @time 2016/9/19 16:11 13 | */ 14 | public class FragmentZhihu extends BaseFragment { 15 | 16 | 17 | @Override 18 | protected void initData() { 19 | 20 | } 21 | 22 | @Override 23 | protected void initView(View RootView) { 24 | 25 | } 26 | 27 | @Override 28 | protected void initToolbar() { 29 | 30 | } 31 | 32 | @Override 33 | protected int getContentLayout() { 34 | return R.layout.fragment_zhihu; 35 | } 36 | 37 | @Override 38 | public void setMenuVisibility(boolean menuVisible) { 39 | super.setMenuVisibility(menuVisible); 40 | if (this.getView() != null) 41 | this.getView() 42 | .setVisibility(menuVisible ? View.VISIBLE : View.GONE); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/util/BuildConfig.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.util; 2 | 3 | /** 4 | * Created by Administrator on 2016/9/7 0007. 5 | */ 6 | public class BuildConfig { 7 | public static final boolean DEBUG = Boolean.parseBoolean("true"); 8 | public static final String APPLICATION_ID = "com.android.mvp"; 9 | public static final String BUILD_TYPE = "debug"; 10 | public static final String FLAVOR = ""; 11 | public static final int VERSION_CODE = 1; 12 | public static final String VERSION_NAME = "1.0"; 13 | // Fields from build type: debug 14 | public static final boolean LOG_DEBUG = true; 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/util/DimenUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 咖枯 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package com.android.mvp.util; 18 | 19 | 20 | import android.content.Context; 21 | 22 | /** 23 | * @author 咖枯 24 | * @version 1.0 2016/7/7 25 | */ 26 | public class DimenUtil { 27 | public static float dp2px(Context context, float dp) { 28 | final float scale = context.getResources().getDisplayMetrics().density; 29 | return dp * scale + 0.5f; 30 | } 31 | 32 | public static float sp2px(Context context,float sp) { 33 | final float scale = context.getResources().getDisplayMetrics().scaledDensity; 34 | return sp * scale; 35 | } 36 | 37 | public static int getScreenSize(Context context) { 38 | return context.getResources().getDisplayMetrics().widthPixels; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/util/KeyBoardUtils.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.util; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.os.IBinder; 6 | import android.view.inputmethod.InputMethodManager; 7 | 8 | /** 9 | * Created by 徐文龙 on 2015/11/16. 10 | */ 11 | public class KeyBoardUtils { 12 | /** 13 | * 关闭键盘 14 | * 15 | * @param context 16 | */ 17 | public static void closeSoftInputKeyboard(Context context) { 18 | InputMethodManager imm = (InputMethodManager) context 19 | .getSystemService(Context.INPUT_METHOD_SERVICE); 20 | imm.hideSoftInputFromWindow(((Activity) context).getCurrentFocus() 21 | .getApplicationWindowToken(), 22 | InputMethodManager.HIDE_NOT_ALWAYS); 23 | } 24 | 25 | /** 26 | * 显示键盘 27 | */ 28 | public static void openSoftInputKeyboard(Context context) { 29 | InputMethodManager imm = (InputMethodManager) context 30 | .getSystemService(Context.INPUT_METHOD_SERVICE); 31 | imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); 32 | } 33 | 34 | /** 35 | * 隐藏软键盘 36 | * */ 37 | public static void HideSoftInput(IBinder token, Context context) { 38 | 39 | if (token != null) { 40 | 41 | InputMethodManager manager = (InputMethodManager) context 42 | .getSystemService(Context.INPUT_METHOD_SERVICE); 43 | 44 | manager.hideSoftInputFromWindow(token, 45 | 46 | InputMethodManager.HIDE_NOT_ALWAYS); 47 | 48 | } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/util/MD5Util.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.util; 2 | 3 | import java.security.NoSuchAlgorithmException; 4 | 5 | public class MD5Util { 6 | 7 | /** 8 | * 字符串转化MD5 9 | * */ 10 | public static String ToMD5(String string) { 11 | java.security.MessageDigest alga; 12 | try { 13 | alga = java.security.MessageDigest.getInstance("MD5"); 14 | alga.update(string.getBytes()); 15 | byte[] digesta = alga.digest(); 16 | String str = bytes2Hex(digesta); // to HexString 17 | return str; 18 | } catch (NoSuchAlgorithmException e) { 19 | e.printStackTrace(); 20 | } 21 | return ""; 22 | 23 | } 24 | 25 | /** 26 | * 字节转MD5 27 | * */ 28 | private static String bytes2Hex(byte[] bts) { 29 | String des = ""; 30 | String tmp = null; 31 | for (int i = 0; i < bts.length; i++) { 32 | tmp = (Integer.toHexString(bts[i] & 0xFF)); 33 | if (tmp.length() == 1) { 34 | des += "0"; 35 | } 36 | des += tmp; 37 | } 38 | return des.toUpperCase(); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/util/MyConfig.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.util; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | 6 | /** 7 | * Created by Administrator on 2016/9/25 0025. 8 | */ 9 | 10 | public class MyConfig { 11 | 12 | public static final String ConfigName="dalong"; 13 | 14 | 15 | private DaLongSharePreferences sharedPreferences; 16 | 17 | private static MyConfig config; 18 | private Context context; 19 | 20 | 21 | public static MyConfig getInstance(Context context){ 22 | if(config==null){ 23 | config=new MyConfig(context); 24 | } 25 | return config; 26 | } 27 | 28 | public void setNewTab(boolean flag) { 29 | sharedPreferences.setNewTab(flag); 30 | } 31 | 32 | public boolean isNewTab() { 33 | return sharedPreferences.isNewTab(); 34 | } 35 | 36 | 37 | 38 | 39 | public MyConfig(Context context) { 40 | this.context = context; 41 | sharedPreferences=new DaLongSharePreferences(context); 42 | } 43 | 44 | public class DaLongSharePreferences{ 45 | 46 | 47 | public static final String IS_NewTab= "isNewTab"; 48 | 49 | private SharedPreferences sharedPreferences; 50 | 51 | public DaLongSharePreferences(Context context) { 52 | this.sharedPreferences =context.getSharedPreferences(ConfigName,Context.MODE_APPEND); 53 | } 54 | 55 | 56 | 57 | public void setNewTab(boolean flag) { 58 | sharedPreferences.edit().putBoolean(IS_NewTab, flag).commit(); 59 | } 60 | 61 | public boolean isNewTab() { 62 | return sharedPreferences.getBoolean(IS_NewTab, false); 63 | } 64 | 65 | 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/util/MyItemTouchHelper.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.util; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.support.v7.widget.helper.ItemTouchHelper; 5 | import android.util.Log; 6 | 7 | /** 8 | * Created by 徐文龙 on 2015/12/11. 9 | */ 10 | public class MyItemTouchHelper extends ItemTouchHelper.Callback { 11 | 12 | private OnRecyclerItemMoveLinestener onRecyclerItemMoveLinestener; 13 | 14 | public MyItemTouchHelper(OnRecyclerItemMoveLinestener onRecyclerItemMoveLinestener) { 15 | this.onRecyclerItemMoveLinestener = onRecyclerItemMoveLinestener; 16 | } 17 | 18 | @Override 19 | public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { 20 | int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN|ItemTouchHelper.LEFT |ItemTouchHelper.RIGHT; 21 | 22 | int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; 23 | 24 | return makeMovementFlags(dragFlags, swipeFlags); 25 | 26 | } 27 | 28 | @Override 29 | public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { 30 | Log.v("dalong", "进行移动"); 31 | onRecyclerItemMoveLinestener.onMoveYidong(viewHolder.getAdapterPosition(),target.getAdapterPosition()); 32 | return false; 33 | } 34 | 35 | 36 | 37 | 38 | private boolean isDifferentItemViewType(RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { 39 | return viewHolder.getItemViewType() != target.getItemViewType(); 40 | } 41 | 42 | @Override 43 | public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { 44 | Log.v("dalong","进行删除"); 45 | // onRecyclerItemMoveLinestener.onMoceDelete(viewHolder.getAdapterPosition()); 46 | } 47 | 48 | 49 | 50 | public interface OnRecyclerItemMoveLinestener{ 51 | public void onMoveYidong(int position1, int position2); 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/util/RxBus.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.util; 2 | 3 | import rx.Observable; 4 | import rx.subjects.PublishSubject; 5 | import rx.subjects.SerializedSubject; 6 | import rx.subjects.Subject; 7 | 8 | /** 9 | * Created by Administrator on 2017/3/16 0016. 10 | */ 11 | 12 | public class RxBus { 13 | private static volatile RxBus defaultInstance; 14 | 15 | private final Subject bus; 16 | // PublishSubject只会把在订阅发生的时间点之后来自原始Observable的数据发射给观察者 17 | public RxBus() { 18 | bus = new SerializedSubject<>(PublishSubject.create()); 19 | } 20 | 21 | 22 | // 单例RxBus 23 | public static RxBus getDefault() { 24 | if (defaultInstance == null) { 25 | synchronized (RxBus.class) { 26 | if (defaultInstance == null) { 27 | defaultInstance = new RxBus(); 28 | } 29 | } 30 | } 31 | return defaultInstance ; 32 | } 33 | 34 | // 发送一个新的事件 35 | public void post (Object o) { 36 | bus.onNext(o); 37 | } 38 | // 根据传递的 eventType 类型返回特定类型(eventType)的 被观察者 39 | public Observable toObservable (Class eventType) { 40 | return bus.ofType(eventType); 41 | // 这里感谢小鄧子的提醒: ofType = filter + cast 42 | // return bus.filter(new Func1() { 43 | // @Override 44 | // public Boolean call(Object o) { 45 | // return eventType.isInstance(o); 46 | // } 47 | // }) .cast(eventType); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/util/ToastShow.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.util; 2 | 3 | import android.content.Context; 4 | import android.widget.Toast; 5 | 6 | public class ToastShow { 7 | 8 | 9 | private Context context; 10 | public static Toast toast = null; 11 | 12 | public static ToastShow mToastShow; 13 | 14 | public ToastShow() { 15 | } 16 | 17 | public static ToastShow getInstance(Context context) { 18 | if (mToastShow == null) { 19 | toast = Toast.makeText(context, "", Toast.LENGTH_SHORT); 20 | mToastShow = new ToastShow(); 21 | } 22 | return mToastShow; 23 | } 24 | 25 | public void toastShow(String text) { 26 | if (toast == null) { 27 | toast = Toast.makeText(context, text, Toast.LENGTH_SHORT); 28 | } else { 29 | toast.setText(text); 30 | } 31 | toast.show(); 32 | } 33 | } -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/widget/dialog/LoadingActivityDialog.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.widget.dialog; 2 | 3 | import android.app.Dialog; 4 | import android.content.Context; 5 | import android.view.Gravity; 6 | 7 | import com.android.mvp.R; 8 | 9 | 10 | public class LoadingActivityDialog extends Dialog { 11 | 12 | private Context context = null; 13 | 14 | private static LoadingActivityDialog customProgressDialog = null; 15 | 16 | public LoadingActivityDialog(Context context) { 17 | 18 | super(context); 19 | 20 | this.context = context; 21 | 22 | } 23 | 24 | public LoadingActivityDialog(Context context, int theme) { 25 | 26 | super(context, theme); 27 | 28 | } 29 | 30 | public static LoadingActivityDialog createDialog(Context context) { 31 | 32 | customProgressDialog = new LoadingActivityDialog(context, 33 | R.style.CustomProgressDialog); 34 | 35 | customProgressDialog.setContentView(R.layout.dialog_loadding); 36 | 37 | customProgressDialog.getWindow().getAttributes().gravity = Gravity.CENTER; 38 | 39 | customProgressDialog.setCanceledOnTouchOutside(false); 40 | // 41 | // customProgressDialog.setCancelable(false);//返回键 42 | 43 | return customProgressDialog; 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/widget/dialog/LoadingFragmentDialog.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.widget.dialog; 2 | 3 | import android.app.Dialog; 4 | import android.content.Context; 5 | import android.view.Gravity; 6 | 7 | import com.android.mvp.R; 8 | 9 | 10 | public class LoadingFragmentDialog extends Dialog { 11 | 12 | private Context context = null; 13 | 14 | private static LoadingFragmentDialog customProgressDialog = null; 15 | 16 | public LoadingFragmentDialog(Context context) { 17 | 18 | super(context); 19 | 20 | this.context = context; 21 | 22 | } 23 | 24 | public LoadingFragmentDialog(Context context, int theme) { 25 | 26 | super(context, theme); 27 | 28 | } 29 | 30 | public static LoadingFragmentDialog createDialog(Context context) { 31 | 32 | customProgressDialog = new LoadingFragmentDialog(context, 33 | R.style.CustomProgressDialog); 34 | 35 | customProgressDialog.setContentView(R.layout.dialog_loadding_f); 36 | 37 | customProgressDialog.getWindow().getAttributes().gravity = Gravity.CENTER; 38 | 39 | customProgressDialog.setCanceledOnTouchOutside(false); 40 | // 41 | // customProgressDialog.setCancelable(false);//返回键 42 | 43 | return customProgressDialog; 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/widget/loading/IVaryViewHelper.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.widget.loading; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | 6 | public interface IVaryViewHelper { 7 | 8 | public abstract View getCurrentLayout(); 9 | 10 | public abstract void restoreView(); 11 | 12 | public abstract void showLayout(View view); 13 | 14 | public abstract View inflate(int layoutId); 15 | 16 | public abstract Context getContext(); 17 | 18 | public abstract View getView(); 19 | 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/widget/loading/VaryViewHelper.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.widget.loading; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | 8 | 9 | public class VaryViewHelper implements IVaryViewHelper { 10 | private View view; 11 | private ViewGroup parentView; 12 | private int viewIndex; 13 | private ViewGroup.LayoutParams params; 14 | private View currentView; 15 | 16 | public VaryViewHelper(View view) { 17 | super(); 18 | this.view = view; 19 | } 20 | 21 | private void init() { 22 | params = view.getLayoutParams(); 23 | if (view.getParent() != null) { 24 | parentView = (ViewGroup) view.getParent(); 25 | } else { 26 | parentView = (ViewGroup) view.getRootView().findViewById(android.R.id.content); 27 | } 28 | int count = parentView.getChildCount(); 29 | for (int index = 0; index < count; index++) { 30 | if (view == parentView.getChildAt(index)) { 31 | viewIndex = index; 32 | break; 33 | } 34 | } 35 | currentView = view; 36 | } 37 | 38 | @Override 39 | public View getCurrentLayout() { 40 | return currentView; 41 | } 42 | 43 | @Override 44 | public void restoreView() { 45 | showLayout(view); 46 | } 47 | 48 | @Override 49 | public void showLayout(View view) { 50 | if (parentView == null) { 51 | init(); 52 | } 53 | this.currentView = view; 54 | if (parentView.getChildAt(viewIndex) != view) { 55 | ViewGroup parent = (ViewGroup) view.getParent(); 56 | if (parent != null) { 57 | parent.removeView(view); 58 | } 59 | parentView.removeViewAt(viewIndex); 60 | parentView.addView(view, viewIndex, params); 61 | } 62 | } 63 | 64 | @Override 65 | public View inflate(int layoutId) { 66 | return LayoutInflater.from(view.getContext()).inflate(layoutId, null); 67 | } 68 | 69 | @Override 70 | public Context getContext() { 71 | return view.getContext(); 72 | } 73 | 74 | @Override 75 | public View getView() { 76 | return view; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/widget/loading/VaryViewHelperController.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.widget.loading; 2 | 3 | 4 | import android.graphics.drawable.AnimationDrawable; 5 | import android.text.TextUtils; 6 | import android.view.View; 7 | import android.widget.Button; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import com.android.mvp.R; 12 | 13 | 14 | public class VaryViewHelperController { 15 | 16 | private IVaryViewHelper helper; 17 | 18 | private AnimationDrawable mDrawableAnim; 19 | 20 | private ImageView mImageView; 21 | 22 | public VaryViewHelperController(View view) { 23 | 24 | this(new VaryViewHelper(view)); 25 | } 26 | 27 | public VaryViewHelperController(IVaryViewHelper helper) { 28 | super(); 29 | this.helper = helper; 30 | } 31 | 32 | public void showNetworkError(View.OnClickListener onClickListener) { 33 | View layout = helper.inflate(R.layout.view_loadding_error); 34 | Button againBtn = (Button) layout.findViewById(R.id.pager_error_loadingAgain); 35 | if (null != onClickListener) { 36 | againBtn.setOnClickListener(onClickListener); 37 | } 38 | helper.showLayout(layout); 39 | } 40 | 41 | public void showEmpty(String emptyMsg) { 42 | View layout = helper.inflate(R.layout.view_loadding_no_data); 43 | TextView textView = (TextView) layout.findViewById(R.id.tv_no_data); 44 | if (!TextUtils.isEmpty(emptyMsg)) { 45 | textView.setText(emptyMsg); 46 | } 47 | helper.showLayout(layout); 48 | } 49 | 50 | public void showLoading() { 51 | View layout = helper.inflate(R.layout.view_loading_loading); 52 | helper.showLayout(layout); 53 | } 54 | 55 | public void restore() { 56 | helper.restoreView(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/android/mvp/widget/view/MyCardView.java: -------------------------------------------------------------------------------- 1 | package com.android.mvp.widget.view; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.CardView; 5 | import android.util.AttributeSet; 6 | 7 | import com.zhy.autolayout.AutoFrameLayout; 8 | import com.zhy.autolayout.utils.AutoLayoutHelper; 9 | 10 | /** 11 | * desc 12 | * 13 | * @autor 徐文龙 14 | * @time 2016/7/18 12:01 15 | */ 16 | public class MyCardView extends CardView { 17 | 18 | private final AutoLayoutHelper mHelper = new AutoLayoutHelper(this); 19 | public MyCardView(Context context) { 20 | super(context); 21 | } 22 | 23 | public MyCardView(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | } 26 | 27 | @Override 28 | public AutoFrameLayout.LayoutParams generateLayoutParams(AttributeSet attrs) 29 | { 30 | return new AutoFrameLayout.LayoutParams(getContext(), attrs); 31 | } 32 | 33 | @Override 34 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) 35 | { 36 | if (!isInEditMode()) 37 | { 38 | mHelper.adjustChildren(); 39 | } 40 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/res/anim/poplayout_down.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/anim/poplayout_up.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/borad_label_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/drawer_item_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_bg_card.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu649526275/MyMVPDemo/ef394b9fb7c24eb14818d8728d1c711995484f4d/app/src/main/res/drawable/ic_bg_card.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/net_error_loading_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/sel_btn_reload.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selector_toolbar_like.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout-xlarge/fragment_gank.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 21 | 22 | 28 | 29 | 30 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_gank_girl.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 21 | 22 | 29 | 30 | 41 | 42 | 43 | 44 | 48 | 52 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_wx_web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 14 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_loadding.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 16 | 22 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_loadding_f.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 16 | 23 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_gank.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 21 | 22 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_gank_android.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 14 | 15 | 16 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_gank_girl.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 15 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_home.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_new_id.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_news.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 23 | 32 | 33 | 34 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_wx.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 15 | 16 | 17 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_zhihu.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_girl.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 14 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_home_barand.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 17 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_home_special.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 17 | 18 | 21 | 27 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_newstab.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/lazy_progress_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 17 | 24 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_drawer_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 11 | 19 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_fragment_home_banner_img.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 15 | 16 | 17 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_loadding_error.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 16 | 17 | 24 | 25 |