├── settings.gradle ├── image ├── gif.gif ├── FhgiUrqPH2o-wtdkq7ybybIqTenz.png ├── Fu-RMSBK8gwPQlPEV5W6R0fdtMif.png ├── llLkq3ioq-Sq2QbGSl02F0GezPye.png └── lshfORwRDboOU57DHLSVPxwsehOO.png ├── .idea ├── copyright │ └── profiles_settings.xml ├── inspectionProfiles │ ├── profiles_settings.xml │ └── Project_Default.xml ├── libraries │ ├── ijkplayer_java_0_6_0.xml │ ├── ijkplayer_x86_0_6_0.xml │ ├── ijkplayer_arm64_0_6_0.xml │ ├── ijkplayer_armv7a_0_6_0.xml │ ├── ijkplayer_x86_64_0_6_0.xml │ ├── junit_4_12.xml │ ├── jsoup_1_9_2.xml │ ├── gson_2_7.xml │ ├── okio_1_8_0.xml │ ├── rxjava_1_1_6.xml │ ├── support_annotations_24_1_1.xml │ ├── eventbus_3_0_0.xml │ ├── okhttp_3_3_1.xml │ ├── glide_3_7_0.xml │ ├── library_2_4_0.xml │ ├── picasso_2_5_2.xml │ ├── hamcrest_core_1_3.xml │ ├── retrofit_2_1_0.xml │ ├── library_1_2_2.xml │ ├── fastjson_1_1_52_android.xml │ ├── adapter_rxjava_2_1_0.xml │ ├── converter_gson_2_1_0.xml │ ├── logging_interceptor_3_3_1.xml │ ├── library_1_0_5.xml │ ├── library_1_2_6.xml │ ├── jiecaovideoplayer_4_6_3.xml │ ├── cardview_v7_24_0_0.xml │ ├── logger_1_14.xml │ ├── rxandroid_1_2_0.xml │ ├── library_1_2_4.xml │ ├── support_vector_drawable_24_1_1.xml │ ├── animated_vector_drawable_24_1_1.xml │ ├── bga_refreshlayout_1_1_6.xml │ ├── design_24_0_0.xml │ ├── appcompat_v7_24_1_1.xml │ ├── recyclerview_v7_24_0_0.xml │ └── support_v4_24_1_1.xml ├── modules.xml ├── gradle.xml └── compiler.xml ├── app ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ ├── icon.jpg │ │ │ │ ├── like.png │ │ │ │ ├── wink.png │ │ │ │ ├── film48.png │ │ │ │ ├── thumb.jpg │ │ │ │ ├── unlike.png │ │ │ │ ├── comedy48.png │ │ │ │ ├── welecome.jpeg │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── qq_refresh_success.png │ │ │ │ ├── tb_navigation_icon.png │ │ │ │ ├── twitter_pull_arrow.png │ │ │ │ └── google_news_copyrighted48.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values-zh │ │ │ │ ├── strings.xml │ │ │ │ └── arrays.xml │ │ │ ├── transition │ │ │ │ └── transition.xml │ │ │ ├── layout │ │ │ │ ├── activity_joke_detail_layout.xml │ │ │ │ ├── activity_fuck.xml │ │ │ │ ├── item_des_layout.xml │ │ │ │ ├── item_image_layout.xml │ │ │ │ ├── activity_images_detail.xml │ │ │ │ ├── fragment_joke_layout.xml │ │ │ │ ├── fragment_image_layout.xml │ │ │ │ ├── fragment_qiushi_layout.xml │ │ │ │ ├── fragment_video_list_layout.xml │ │ │ │ ├── common_toolbar.xml │ │ │ │ ├── item_joke_video_layout.xml │ │ │ │ ├── item_joke_duanzi_layout.xml │ │ │ │ ├── item_tuwen_detail_layout.xml │ │ │ │ ├── nagavation_list_item.xml │ │ │ │ ├── item_joke_gif_layout.xml │ │ │ │ ├── item_joke_imag_layout.xml │ │ │ │ ├── activity_webview_layout.xml │ │ │ │ ├── title.xml │ │ │ │ ├── drawer_header.xml │ │ │ │ ├── fragment_main_lauout.xml │ │ │ │ ├── fragment_video_layout.xml │ │ │ │ ├── fragment_news_layout.xml │ │ │ │ ├── foot.xml │ │ │ │ ├── item_baisi_comment_layout.xml │ │ │ │ ├── activity_welecome_layout.xml │ │ │ │ └── activity_main.xml │ │ │ ├── anim │ │ │ │ └── item_bottom_in.xml │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── arrays.xml │ │ │ │ ├── styles.xml │ │ │ │ └── attrs.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── drawable │ │ │ │ └── gradient_blue_white.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── github │ │ │ │ └── hyr0318 │ │ │ │ └── materialnews_mvp │ │ │ │ ├── entity │ │ │ │ ├── BaseResult.java │ │ │ │ ├── TuwenUrlResult.java │ │ │ │ ├── HomeOneIdResult.java │ │ │ │ ├── TabBaseEntity.java │ │ │ │ ├── TuwenTabBaseEntity.java │ │ │ │ ├── HomeNavigationEntity.java │ │ │ │ ├── TuwenEntity.java │ │ │ │ └── TuwenDetailEntity.java │ │ │ │ ├── listener │ │ │ │ ├── OnPagerSelectedListener.java │ │ │ │ ├── OnRecyclerViewItemClickListener.java │ │ │ │ └── BaseMultiLoadedListener.java │ │ │ │ ├── widget │ │ │ │ ├── OnItemClickListener.java │ │ │ │ ├── OnItemLongClickListener.java │ │ │ │ ├── IPhotoView.java │ │ │ │ └── BaseRecyclerViewHolder.java │ │ │ │ ├── contract │ │ │ │ ├── JokeMainContract.java │ │ │ │ ├── TuwenMainContract.java │ │ │ │ ├── VideoMainContract.java │ │ │ │ ├── ImageMainContract.java │ │ │ │ ├── TuwenDetialContract.java │ │ │ │ ├── WelecomeContract.java │ │ │ │ ├── ImageContract.java │ │ │ │ ├── BaiSiContract.java │ │ │ │ ├── BaiSiDetailContract.java │ │ │ │ ├── HomeContract.java │ │ │ │ ├── TuwenContract.java │ │ │ │ ├── VideoListContract.java │ │ │ │ └── JokeContract.java │ │ │ │ ├── App.java │ │ │ │ ├── utils │ │ │ │ ├── SpacesItemDecoration.java │ │ │ │ ├── RetrofitUtil.java │ │ │ │ ├── HttpUtils.java │ │ │ │ └── Toaster.java │ │ │ │ ├── api │ │ │ │ ├── Urls.java │ │ │ │ └── ApiConstants.java │ │ │ │ ├── presenter │ │ │ │ ├── HomePresenterImpl.java │ │ │ │ ├── Presenter.java │ │ │ │ ├── VideoMainPresenterImpl.java │ │ │ │ ├── TuwenMainPresenterImpl.java │ │ │ │ ├── ImageMainPresenterImpl.java │ │ │ │ ├── JokeMainPresenterImpl.java │ │ │ │ ├── WelecomePresenterImpl.java │ │ │ │ ├── TuwenDetialPresenterImpl.java │ │ │ │ ├── BaiSiDetailPresenterImpl.java │ │ │ │ ├── BaiSiPresenterImpl.java │ │ │ │ ├── TuwenPresenterImpl.java │ │ │ │ ├── ImagePresenterImpl.java │ │ │ │ ├── JokePresenterImpl.java │ │ │ │ └── VideoListPresenterImpl.java │ │ │ │ ├── model │ │ │ │ ├── CommonListModel.java │ │ │ │ ├── VideoMainModelImpl.java │ │ │ │ ├── TuwenMainModelImpl.java │ │ │ │ ├── JokeMainModelImpl.java │ │ │ │ ├── BaiSiModelImpl.java │ │ │ │ ├── ImageMainModelImpl.java │ │ │ │ ├── ImageModelImpl.java │ │ │ │ ├── BaiSiDetailModelImpl.java │ │ │ │ ├── JokeModelImpl.java │ │ │ │ ├── VideoListModelImpl.java │ │ │ │ ├── HomeModelImpl.java │ │ │ │ └── WelecomeModelImpl.java │ │ │ │ ├── data │ │ │ │ └── http │ │ │ │ │ └── BaseObserver.java │ │ │ │ ├── common │ │ │ │ └── Constants.java │ │ │ │ ├── ui │ │ │ │ └── adapter │ │ │ │ │ ├── HomeViewPagerFragmentAdapter.java │ │ │ │ │ ├── JokeMainFragmentPagerAdapter.java │ │ │ │ │ ├── TuwenMainFragmentPagerAdapter.java │ │ │ │ │ ├── VideoMainFragmentPagerAdapter.java │ │ │ │ │ ├── ImageMainFragmentPagerAdapter.java │ │ │ │ │ └── TuwenAapter.java │ │ │ │ └── view │ │ │ │ └── BaseView.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── hyr0318 │ │ │ └── materialnews_mvp │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── github │ │ └── hyr0318 │ │ └── materialnews_mvp │ │ └── ApplicationTest.java ├── .gitignore ├── proguard-rules.pro └── build.gradle ├── base_library ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ ├── error.png │ │ │ │ └── exception.png │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── strings.xml │ │ │ │ └── colors.xml │ │ │ └── layout │ │ │ │ ├── common_toolbar.xml │ │ │ │ ├── message.xml │ │ │ │ └── loading.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── hyr0318 │ │ │ └── baselibrary │ │ │ ├── date │ │ │ ├── entity │ │ │ │ └── BaseResult.java │ │ │ └── BaseObserver.java │ │ │ ├── net │ │ │ └── NetChangeObserver.java │ │ │ ├── loading │ │ │ ├── ILoadingViewHelper.java │ │ │ └── LoadingViewHelper.java │ │ │ ├── base │ │ │ └── fragment │ │ │ │ └── BaseFragment.java │ │ │ ├── adapter │ │ │ ├── ViewHolderCreator.java │ │ │ ├── ListViewDataAdapter.java │ │ │ └── ViewHolderBase.java │ │ │ ├── view │ │ │ └── BaseView.java │ │ │ ├── eventbus │ │ │ └── EventCenter.java │ │ │ └── widgets │ │ │ └── XViewPager.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── github │ │ │ └── hyr0318 │ │ │ └── baselibrary │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── github │ │ └── hyr0318 │ │ └── baselibrary │ │ └── ExampleInstrumentationTest.java ├── .gitignore ├── proguard-rules.pro └── build.gradle ├── gradle └── wrapper │ └── gradle-wrapper.properties ├── local.properties ├── .gitignore ├── MaterialNews-Mvp.iml ├── gradle.properties └── gradlew.bat /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':base_library' 2 | -------------------------------------------------------------------------------- /image/gif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/image/gif.gif -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-hdpi/icon.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/like.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-hdpi/like.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/wink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-hdpi/wink.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/film48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-hdpi/film48.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-hdpi/thumb.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/unlike.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-hdpi/unlike.png -------------------------------------------------------------------------------- /image/FhgiUrqPH2o-wtdkq7ybybIqTenz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/image/FhgiUrqPH2o-wtdkq7ybybIqTenz.png -------------------------------------------------------------------------------- /image/Fu-RMSBK8gwPQlPEV5W6R0fdtMif.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/image/Fu-RMSBK8gwPQlPEV5W6R0fdtMif.png -------------------------------------------------------------------------------- /image/llLkq3ioq-Sq2QbGSl02F0GezPye.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/image/llLkq3ioq-Sq2QbGSl02F0GezPye.png -------------------------------------------------------------------------------- /image/lshfORwRDboOU57DHLSVPxwsehOO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/image/lshfORwRDboOU57DHLSVPxwsehOO.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/comedy48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-hdpi/comedy48.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/welecome.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-hdpi/welecome.jpeg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /base_library/src/main/res/mipmap-hdpi/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/base_library/src/main/res/mipmap-hdpi/error.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/qq_refresh_success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-hdpi/qq_refresh_success.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/tb_navigation_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-hdpi/tb_navigation_icon.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/twitter_pull_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-hdpi/twitter_pull_arrow.png -------------------------------------------------------------------------------- /base_library/src/main/res/mipmap-hdpi/exception.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/base_library/src/main/res/mipmap-hdpi/exception.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/google_news_copyrighted48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i91h1r/MaterialNews-Mvp/HEAD/app/src/main/res/mipmap-hdpi/google_news_copyrighted48.png -------------------------------------------------------------------------------- /base_library/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10dp 4 | 5dp 5 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | MaterialNews 4 | Copyright © 2016 MaterialNews All Rights Reserved\nPowered by hyr 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Oct 11 15:58:42 CST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 7 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/transition/transition.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_joke_detail_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values-zh/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 百思不得姐 5 | 今日头条 6 | 每日图文 7 | 美图欣赏 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /base_library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/entity/BaseResult.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 返回的Json数据的结构 7 | * 8 | */ 9 | public abstract class BaseResult implements Serializable { 10 | // @SerializedName("msg") 11 | // public String msg; 12 | } 13 | -------------------------------------------------------------------------------- /base_library/src/main/java/com/github/hyr0318/baselibrary/date/entity/BaseResult.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.baselibrary.date.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 返回的Json数据的结构 7 | * 8 | */ 9 | public abstract class BaseResult implements Serializable { 10 | // @SerializedName("msg") 11 | // public String msg; 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/listener/OnPagerSelectedListener.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.listener; 2 | 3 | /** 4 | * Description: 5 | * 作者:hyr on 2016/8/29 10:54 6 | * 邮箱:2045446584@qq.com 7 | */ 8 | public interface OnPagerSelectedListener { 9 | 10 | void onPagerSelected(int position , String type ); 11 | } 12 | -------------------------------------------------------------------------------- /base_library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Base Library 3 | 网络连接出现问题,请重试 4 | 网络没有连接,请点击屏幕重试 5 | 没有数据,请点击屏幕重试 6 | 正在加载中... 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/anim/item_bottom_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MaterialNews 3 | V 4 | Copyright © 2016 MaterialNews All Rights Reserved\nPowered by hyr 5 | drawer_open 6 | drawer_close 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/listener/OnRecyclerViewItemClickListener.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.listener; 2 | 3 | import android.view.View; 4 | 5 | /** 6 | * Description: 7 | * 作者:hyr on 2016/8/30 13:13 8 | * 邮箱:2045446584@qq.com 9 | */ 10 | public interface OnRecyclerViewItemClickListener { 11 | void onItemClick(View view, T entity); 12 | } -------------------------------------------------------------------------------- /base_library/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ff999999 4 | #ffeeeeee 5 | #028CE5 6 | #FF000000 7 | #FFFFFFFF 8 | #00000000 9 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/gradient_blue_white.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/test/java/com/github/hyr0318/materialnews_mvp/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/widget/OnItemClickListener.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.widget; 2 | 3 | import android.view.View; 4 | 5 | /** 6 | * ClassName: OnItemClickListener

7 | * Author:oubowu

8 | * Fuction: 点击长按的接口

9 | * CreateDate:2016/2/14 1:48

10 | * UpdateUser:

11 | * UpdateDate:

12 | */ 13 | public interface OnItemClickListener { 14 | void onItemClick(View view, int position,Object item); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /.idea/libraries/ijkplayer_java_0_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/ijkplayer_x86_0_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/github/hyr0318/materialnews_mvp/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_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/java/com/github/hyr0318/materialnews_mvp/entity/TuwenUrlResult.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.entity; 2 | 3 | /** 4 | * Description: 5 | * 作者:hyr on 2016/9/1 09:41 6 | * 邮箱:2045446584@qq.com 7 | */ 8 | public class TuwenUrlResult extends BaseResult { 9 | String url ; 10 | 11 | 12 | public String getUrl() { 13 | return url; 14 | } 15 | 16 | 17 | public void setUrl(String url) { 18 | this.url = url; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/widget/OnItemLongClickListener.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.widget; 2 | 3 | import android.view.View; 4 | 5 | /** 6 | * ClassName: OnItemClickListener

7 | * Author:oubowu

8 | * Fuction: 点击长按的接口

9 | * CreateDate:2016/2/14 1:48

10 | * UpdateUser:

11 | * UpdateDate:

12 | */ 13 | public interface OnItemLongClickListener { 14 | boolean onItemLongClickListener(View view, int position); 15 | } 16 | -------------------------------------------------------------------------------- /.idea/libraries/ijkplayer_arm64_0_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/ijkplayer_armv7a_0_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/ijkplayer_x86_64_0_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /local.properties: -------------------------------------------------------------------------------- 1 | ## This file is automatically generated by Android Studio. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | # 7 | # Location of the SDK. This is only used by Gradle. 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | #Wed Sep 07 09:18:41 CST 2016 11 | sdk.dir=E\:\\SDK\\sdk1 12 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | # Android generated 2 | bin 3 | gen 4 | lint.xml 5 | 6 | # IntelliJ IDEA 7 | .idea 8 | *.iml 9 | *.ipr 10 | *.iws 11 | classes 12 | gen-external-apklibs 13 | 14 | # Eclipse 15 | .project 16 | .classpath 17 | .settings 18 | .checkstyle 19 | 20 | # Gradle 21 | .gradle 22 | build 23 | out 24 | 25 | # Maven 26 | target 27 | release.properties 28 | pom.xml.* 29 | 30 | # Ant 31 | ant.properties 32 | local.properties 33 | proguard.cfg 34 | proguard-project.txt 35 | 36 | # Other 37 | .DS_Store 38 | dist 39 | tmp -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_fuck.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /base_library/.gitignore: -------------------------------------------------------------------------------- 1 | # Android generated 2 | bin 3 | gen 4 | lint.xml 5 | 6 | # IntelliJ IDEA 7 | .idea 8 | *.iml 9 | *.ipr 10 | *.iws 11 | classes 12 | gen-external-apklibs 13 | 14 | # Eclipse 15 | .project 16 | .classpath 17 | .settings 18 | .checkstyle 19 | 20 | # Gradle 21 | .gradle 22 | build 23 | out 24 | 25 | # Maven 26 | target 27 | release.properties 28 | pom.xml.* 29 | 30 | # Ant 31 | ant.properties 32 | local.properties 33 | proguard.cfg 34 | proguard-project.txt 35 | 36 | # Other 37 | .DS_Store 38 | dist 39 | tmp -------------------------------------------------------------------------------- /.idea/libraries/jsoup_1_9_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /base_library/src/main/java/com/github/hyr0318/baselibrary/net/NetChangeObserver.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.baselibrary.net; 2 | 3 | /** 4 | *@Description: 5 | *@author: hyr 6 | *@time: 2016/9/2 15:05 7 | *@Email: 2045446584@qq.com 8 | */ 9 | public class NetChangeObserver { 10 | 11 | /** 12 | * when network connected callback 13 | */ 14 | public void onNetConnected(NetUtils.NetType type) { 15 | 16 | } 17 | 18 | /** 19 | * when network disconnected callback 20 | */ 21 | public void onNetDisConnect() { 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.idea/libraries/gson_2_7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /base_library/src/test/java/com/github/hyr0318/baselibrary/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.baselibrary; 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 | } -------------------------------------------------------------------------------- /.idea/libraries/okio_1_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/rxjava_1_1_6.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/eventbus_3_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/okhttp_3_3_1.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/library_2_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/picasso_2_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_des_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/retrofit_2_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/library_1_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Android generated 2 | bin 3 | gen 4 | lint.xml 5 | 6 | # IntelliJ IDEA 7 | .idea 8 | *.iml 9 | *.ipr 10 | *.iws 11 | classes 12 | gen-external-apklibs 13 | 14 | # Eclipse 15 | .project 16 | .classpath 17 | .settings 18 | .checkstyle 19 | 20 | # Gradle 21 | .gradle 22 | build 23 | out 24 | 25 | # Maven 26 | target 27 | release.properties 28 | pom.xml.* 29 | 30 | # Ant 31 | ant.properties 32 | local.properties 33 | proguard.cfg 34 | proguard-project.txt 35 | 36 | # Other 37 | .DS_Store 38 | dist 39 | tmp 40 | 41 | # Proguard folder generated by Eclipse 42 | proguard/ 43 | 44 | # Log Files 45 | *.log -------------------------------------------------------------------------------- /.idea/libraries/fastjson_1_1_52_android.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/adapter_rxjava_2_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/converter_gson_2_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/logging_interceptor_3_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_image_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/library_1_0_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_images_detail.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/library_1_2_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /base_library/src/main/java/com/github/hyr0318/baselibrary/loading/ILoadingViewHelper.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.baselibrary.loading; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | 6 | /** 7 | * Description: 8 | * 作者:hyr on 2016/9/2 15:13 9 | * 邮箱:2045446584@qq.com 10 | */ 11 | public interface ILoadingViewHelper { 12 | 13 | public abstract View getCurrentLayout(); 14 | 15 | public abstract void restoreView(); 16 | 17 | public abstract void showLayout(View view); 18 | 19 | public abstract View inflate(int layoutId); 20 | 21 | public abstract Context getContext(); 22 | 23 | public abstract View getView(); 24 | } 25 | -------------------------------------------------------------------------------- /.idea/libraries/jiecaovideoplayer_4_6_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 20sp 6 | 15sp 7 | 260dp 8 | 16sp 9 | 2dp 10 | 2dp 11 | 20dp 12 | 60dp 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/contract/JokeMainContract.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.contract; 2 | 3 | import com.github.hyr0318.materialnews_mvp.entity.BaiSiTabResult; 4 | 5 | /** 6 | * Description: 7 | * 作者:hyr on 2016/9/9 15:19 8 | * 邮箱:2045446584@qq.com 9 | */ 10 | public class JokeMainContract { 11 | 12 | public interface JokeMainView { 13 | void initializedView(BaiSiTabResult baiSiTabResults); 14 | } 15 | 16 | 17 | public interface JokeMainPresenter { 18 | void initialized(String requestTag); 19 | } 20 | 21 | 22 | public interface JokeMainModel { 23 | void getTabList(String requestTag); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_joke_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_image_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_qiushi_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 15 | -------------------------------------------------------------------------------- /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 E:\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 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_video_list_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | -------------------------------------------------------------------------------- /base_library/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 E:\SDK\sdk1/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/contract/TuwenMainContract.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.contract; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.entity.TuwenTabBaseEntity; 5 | import java.util.List; 6 | 7 | /** 8 | * Description: 9 | * 作者:hyr on 2016/9/1 09:59 10 | * 邮箱:2045446584@qq.com 11 | */ 12 | public class TuwenMainContract { 13 | public interface TuwenMainView{ 14 | void initializedView(List tabBaseEntityList); 15 | } 16 | 17 | public interface TuwenMainPresenter{ 18 | void initialized(); 19 | } 20 | 21 | public interface TuwenMainModel{ 22 | List getTabList(Context context); 23 | } 24 | 25 | 26 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/common_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 17 | 18 | -------------------------------------------------------------------------------- /base_library/src/main/res/layout/common_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/contract/VideoMainContract.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.contract; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.entity.TabBaseEntity; 5 | import java.util.List; 6 | 7 | /** 8 | * Description: 9 | * 作者:hyr on 2016/8/29 10:31 10 | * 邮箱:2045446584@qq.com 11 | */ 12 | public class VideoMainContract { 13 | public interface VideoMainView { 14 | void initializedView(List tabBaseEntityList); 15 | } 16 | 17 | 18 | public interface VideoMainPresenter { 19 | void initialized(); 20 | } 21 | 22 | 23 | public interface VideoMainModel { 24 | List getTabList(Context context); 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /.idea/libraries/cardview_v7_24_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/entity/HomeOneIdResult.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.entity; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Description: 7 | * 作者:hyr on 2016/9/9 11:29 8 | * 邮箱:2045446584@qq.com 9 | */ 10 | public class HomeOneIdResult { 11 | 12 | /** 13 | * res : 0 14 | * data : ["1458","1457","1462","1461","1460","1450","1449","1455","1453","1451"] 15 | */ 16 | 17 | private int res; 18 | private List data; 19 | 20 | 21 | public int getRes() { return res;} 22 | 23 | 24 | public void setRes(int res) { this.res = res;} 25 | 26 | 27 | public List getData() { return data;} 28 | 29 | 30 | public void setData(List data) { this.data = data;} 31 | } 32 | -------------------------------------------------------------------------------- /.idea/libraries/logger_1_14.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #028CE5 4 | #028CE5 5 | #FF4081 6 | 7 | 8 | #ffeeeeee 9 | #212121 10 | #ff9602 11 | #fe4817 12 | #c8bfb5 13 | #a7a9bf 14 | #1f0000 15 | #555555 16 | #9a9a9a 17 | #cc0000 18 | 19 | -------------------------------------------------------------------------------- /.idea/libraries/rxandroid_1_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/entity/TabBaseEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.entity; 2 | 3 | /** 4 | * Description: 5 | * 作者:hyr on 2016/8/29 10:32 6 | * 邮箱:2045446584@qq.com 7 | */ 8 | public class TabBaseEntity { 9 | String type ; 10 | 11 | String name ; 12 | 13 | 14 | public TabBaseEntity(String type, String name) { 15 | this.type = type; 16 | this.name = name; 17 | } 18 | 19 | 20 | public String getType() { 21 | return type; 22 | } 23 | 24 | 25 | public void setType(String type) { 26 | this.type = type; 27 | } 28 | 29 | 30 | public String getName() { 31 | return name; 32 | } 33 | 34 | 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/App.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp; 2 | 3 | import android.app.Application; 4 | import com.github.hyr0318.materialnews_mvp.utils.Toaster; 5 | 6 | public class App extends Application { 7 | 8 | private static App sApp; 9 | 10 | private static Toaster sToaster; 11 | 12 | public static App getInstance() { 13 | if (sApp == null) { 14 | sApp = new App(); 15 | } 16 | return sApp; 17 | } 18 | 19 | @Override 20 | public void onCreate() { 21 | super.onCreate(); 22 | sApp = this; 23 | 24 | } 25 | 26 | public static void showToast(String msg) { 27 | if (sToaster == null) 28 | sToaster = new Toaster(); 29 | sToaster.showToast(msg); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/entity/TuwenTabBaseEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.entity; 2 | 3 | /** 4 | * Description: 5 | * 作者:hyr on 2016/8/29 10:32 6 | * 邮箱:2045446584@qq.com 7 | */ 8 | public class TuwenTabBaseEntity { 9 | String type ; 10 | 11 | String name ; 12 | 13 | 14 | public TuwenTabBaseEntity(String type, String name) { 15 | this.type = type; 16 | this.name = name; 17 | } 18 | 19 | 20 | public String getType() { 21 | return type; 22 | } 23 | 24 | 25 | public void setType(String type) { 26 | this.type = type; 27 | } 28 | 29 | 30 | public String getName() { 31 | return name; 32 | } 33 | 34 | 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/contract/ImageMainContract.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.contract; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.entity.TabBaseEntity; 5 | import com.github.hyr0318.materialnews_mvp.view.BaseView; 6 | import java.util.List; 7 | 8 | /** 9 | * Description: 10 | * 作者:hyr on 2016/9/2 11:21 11 | * 邮箱:2045446584@qq.com 12 | */ 13 | public class ImageMainContract { 14 | public interface ImageMainView extends BaseView{ 15 | void initializedView(List tabBaseEntityList); 16 | } 17 | 18 | 19 | public interface ImageMainPresenter { 20 | void initialized(); 21 | } 22 | 23 | 24 | public interface ImageMainModel { 25 | List getTabList(Context context); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/item_joke_video_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/libraries/library_1_2_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/support_vector_drawable_24_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/animated_vector_drawable_24_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/contract/TuwenDetialContract.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.contract; 2 | 3 | import com.github.hyr0318.materialnews_mvp.entity.TuwenDetailEntity; 4 | import com.github.hyr0318.materialnews_mvp.view.BaseView; 5 | 6 | /** 7 | * Description: 8 | * 作者:hyr on 2016/8/31 12:11 9 | * 邮箱:2045446584@qq.com 10 | */ 11 | public class TuwenDetialContract { 12 | 13 | public interface TuwenDetialView extends BaseView { 14 | void initializedView(TuwenDetailEntity tuwenDetailEntity); 15 | } 16 | 17 | 18 | public interface TuwenDetialPresenter { 19 | void loadTuwenDetail(String requestTag,int event_tag,String url ,boolean isSwipeRefresh); 20 | } 21 | 22 | 23 | public interface TuwenDetialModel { 24 | void getTuwenDetailContent(String requestTag,int event_tag,String url); 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/contract/WelecomeContract.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.contract; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.entity.HomeOneResult; 5 | 6 | /** 7 | * Author:hyr on 2016/8/27 11:01 8 | * Email:2045446584@qq.com 9 | */ 10 | public class WelecomeContract { 11 | 12 | public interface View { 13 | 14 | void initializedView(String versionName, String copyright); 15 | 16 | void getHomeOne(HomeOneResult oneResult); 17 | } 18 | 19 | 20 | public interface Presenter { 21 | void initialized(); 22 | void loadHomeOne(); 23 | } 24 | 25 | 26 | public interface Model { 27 | 28 | String getVsersionName(Context context); 29 | 30 | String getCopyright(Context context); 31 | 32 | void getHomeOne(); 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /.idea/libraries/bga_refreshlayout_1_1_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_joke_duanzi_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 20 | 21 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_tuwen_detail_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 16 | 17 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/contract/ImageContract.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.contract; 2 | 3 | import com.github.hyr0318.materialnews_mvp.entity.ImageResult; 4 | import com.github.hyr0318.materialnews_mvp.view.BaseView; 5 | 6 | /** 7 | * Description: 8 | * 作者:hyr on 2016/9/2 11:37 9 | * 邮箱:2045446584@qq.com 10 | */ 11 | public class ImageContract { 12 | public interface ImageContractView extends BaseView{ 13 | void refreshListData(ImageResult ImageReult); 14 | 15 | void addMoreListData(ImageResult ImageReult); 16 | } 17 | 18 | 19 | public interface ImagePresenter { 20 | void loadListData(String requestTag, int event_tag, String word, int cl, boolean isSwipeRefresh); 21 | } 22 | 23 | 24 | public interface ImageModel { 25 | void getImageList(String requestTag, int event_tag, String word, int cl); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/contract/BaiSiContract.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.contract; 2 | 3 | import com.github.hyr0318.baselibrary.view.BaseView; 4 | import com.github.hyr0318.materialnews_mvp.entity.BaiSiResult; 5 | 6 | /** 7 | * Description: 8 | * 作者:hyr on 2016/9/9 15:59 9 | * 邮箱:2045446584@qq.com 10 | */ 11 | public class BaiSiContract { 12 | 13 | public interface BaiSiView extends BaseView{ 14 | void refreshListData(BaiSiResult baiSiResult); 15 | 16 | void addMoreListData(BaiSiResult baiSiResult); 17 | } 18 | 19 | 20 | public interface BaiSiPresenter { 21 | void loadListData(String requestTag, int event_tag,String url , long page, boolean isSwipeRefresh); 22 | 23 | } 24 | 25 | 26 | public interface BaiSiModel { 27 | void getListData(String requestTag, int event_tag,String url , long page); 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/contract/BaiSiDetailContract.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.contract; 2 | 3 | import com.github.hyr0318.baselibrary.view.BaseView; 4 | import com.github.hyr0318.materialnews_mvp.entity.BaiSiDetailResult; 5 | 6 | /** 7 | * Description: 8 | * 作者:hyr on 2016/9/13 10:23 9 | * 邮箱:2045446584@qq.com 10 | */ 11 | public class BaiSiDetailContract { 12 | 13 | public interface BaiSiDetailView extends BaseView { 14 | 15 | void initCommentList(BaiSiDetailResult baiSiDetailResult); 16 | 17 | } 18 | 19 | 20 | public interface BaiSiDetailPresenter { 21 | 22 | void loadCommentList(String request_tag, int enent_tag, int page, String id, boolean isRrefresh); 23 | 24 | } 25 | 26 | 27 | public interface BaiSiDetailModel { 28 | 29 | void getCommentList(String request_tag, int enent_tag, int page, String id); 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/utils/SpacesItemDecoration.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.utils; 2 | 3 | import android.graphics.Rect; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.View; 6 | 7 | /** 8 | * Description: 9 | * 作者:hyr on 2016/9/2 12:12 10 | * 邮箱:2045446584@qq.com 11 | */ 12 | public class SpacesItemDecoration extends RecyclerView.ItemDecoration { 13 | 14 | private int space; 15 | 16 | 17 | public SpacesItemDecoration(int space) { 18 | this.space = space; 19 | } 20 | 21 | 22 | @Override 23 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { 24 | outRect.left = space; 25 | outRect.right = space; 26 | outRect.bottom = space; 27 | if (parent.getChildAdapterPosition(view) == 0) { 28 | outRect.top = space; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/contract/HomeContract.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.contract; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.baselibrary.base.fragment.BaseLazyFragment; 5 | import com.github.hyr0318.materialnews_mvp.entity.HomeNavigationEntity; 6 | import java.util.List; 7 | 8 | /** 9 | * Author: hyr on 2016/8/28. 10 | * Email:2045446584@qq.com 11 | */ 12 | public class HomeContract { 13 | public interface View { 14 | 15 | void initializedView(List fragments, List homeNavigationEntities); 16 | } 17 | 18 | 19 | public interface Presenter { 20 | 21 | void initialized(); 22 | } 23 | 24 | 25 | public interface Model { 26 | 27 | List getFragments(Context context); 28 | 29 | List getNavigationList(Context context); 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/contract/TuwenContract.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.contract; 2 | 3 | import com.github.hyr0318.materialnews_mvp.entity.TuwenEntity; 4 | import com.github.hyr0318.materialnews_mvp.view.BaseView; 5 | import java.util.List; 6 | 7 | /** 8 | * Description: 9 | * 作者:hyr on 2016/8/30 16:46 10 | * 邮箱:2045446584@qq.com 11 | */ 12 | public class TuwenContract { 13 | public interface TuwenView extends BaseView{ 14 | void refreshListData( List tuwenEntity); 15 | 16 | void loadMoreList(List tuwenEntity); 17 | } 18 | 19 | 20 | public interface TuwenPresenter { 21 | void loadListData(String requestTag, int event_tag, String keywords, int page ,boolean isSwipeRefresh); 22 | } 23 | 24 | 25 | public interface TuwenModel { 26 | void getCommonListData(String requestTag, final int event_tag, String keywords,int page); 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/api/Urls.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.api; 2 | 3 | /** 4 | * Description: 5 | * 作者:hyr on 2016/8/29 12:08 6 | * 邮箱:2045446584@qq.com 7 | */ 8 | public class Urls { 9 | public static final String TOUTIAO_BASE_ROOT_URL = "http://toutiao.com"; 10 | public static final String TOUTIAO_BASE_URL = "http://toutiao.com/"; 11 | public static final String TUWEN_BASE_URL = "http://www.tuweng.com/"; 12 | public static final String JOKE_BASE_URL = "https://route.showapi.com/255-1/"; 13 | public static final String BAIDU_IMAGE_BASE_URL = "https://image.baidu.com/"; 14 | public static final String ONE_BASE_URL="http://v3.wufazhuce.com:8000/"; 15 | 16 | public static final String BAISI_BASE_URL="http://s.budejie.com/"; 17 | public static final String BAISI__COMMENT_BASE_URL="http://s.budejie.com/"; 18 | 19 | public static final String BAISI__DETAIL_BASE_URL="http://api.budejie.com/api/"; 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/HomePresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.presenter; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.contract.HomeContract; 5 | import com.github.hyr0318.materialnews_mvp.model.HomeModelImpl; 6 | 7 | /** 8 | * Created by MVPHelper on 2016/08/28 9 | */ 10 | 11 | public class HomePresenterImpl implements HomeContract.Presenter { 12 | 13 | private Context mContext; 14 | 15 | private HomeContract.View hv; 16 | private final HomeModelImpl homeModel; 17 | 18 | 19 | public HomePresenterImpl(Context context, HomeContract.View hv) { 20 | 21 | this.mContext = context; 22 | 23 | this.hv = hv; 24 | 25 | homeModel = new HomeModelImpl(); 26 | 27 | } 28 | 29 | 30 | @Override public void initialized() { 31 | 32 | hv.initializedView(homeModel.getFragments(mContext), homeModel.getNavigationList(mContext)); 33 | } 34 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/contract/VideoListContract.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.contract; 2 | 3 | import com.github.hyr0318.materialnews_mvp.entity.TouTiaoVideoResult; 4 | import com.github.hyr0318.materialnews_mvp.view.BaseView; 5 | 6 | /** 7 | * Description: 8 | * 作者:hyr on 2016/8/29 12:21 9 | * 邮箱:2045446584@qq.com 10 | */ 11 | public class VideoListContract { 12 | public interface VideoListView extends BaseView{ 13 | 14 | void refreshListData(TouTiaoVideoResult touTiaoVideoResult); 15 | 16 | void addMoreListData(TouTiaoVideoResult touTiaoVideoResult); 17 | } 18 | 19 | 20 | public interface VideoListPresenter { 21 | void loadListData(String requestTag, int event_tag, String keywords, int page, boolean isSwipeRefresh); 22 | 23 | 24 | } 25 | 26 | 27 | public interface VideoListModel { 28 | void getCommonListData(String requestTag, final int event_tag, String keywords, int page); 29 | 30 | 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/Presenter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com] 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.github.hyr0318.materialnews_mvp.presenter; 18 | 19 | /** 20 | * @author hyr. 21 | * @time 2016/8/27 9:51. 22 | * @des : 23 | * @email :2045446584@qq.com 24 | */ 25 | public interface Presenter { 26 | 27 | void initialized(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /MaterialNews-Mvp.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/VideoMainPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.presenter; 2 | import android.content.Context; 3 | import com.github.hyr0318.materialnews_mvp.contract.VideoMainContract; 4 | import com.github.hyr0318.materialnews_mvp.model.VideoMainModelImpl; 5 | 6 | /** 7 | * Created by MVPHelper on 2016/08/29 8 | */ 9 | 10 | public class VideoMainPresenterImpl implements VideoMainContract.VideoMainPresenter{ 11 | private Context mContext ; 12 | private VideoMainContract.VideoMainView mVv ; 13 | private final VideoMainModelImpl videoMainModel; 14 | 15 | 16 | public VideoMainPresenterImpl(Context context, VideoMainContract.VideoMainView vv) { 17 | this.mContext = context; 18 | 19 | this.mVv =vv; 20 | 21 | videoMainModel = new VideoMainModelImpl(); 22 | 23 | 24 | } 25 | 26 | 27 | @Override public void initialized() { 28 | mVv.initializedView(videoMainModel.getTabList(mContext)); 29 | } 30 | } -------------------------------------------------------------------------------- /base_library/src/androidTest/java/com/github/hyr0318/baselibrary/ExampleInstrumentationTest.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.baselibrary; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.filters.MediumTest; 6 | import android.support.test.runner.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumentation test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @MediumTest 19 | @RunWith(AndroidJUnit4.class) 20 | public class ExampleInstrumentationTest { 21 | @Test 22 | public void useAppContext() throws Exception { 23 | // Context of the app under test. 24 | Context appContext = InstrumentationRegistry.getTargetContext(); 25 | 26 | assertEquals("com.github.hyr0318.baselibrary.test", appContext.getPackageName()); 27 | } 28 | } -------------------------------------------------------------------------------- /base_library/src/main/java/com/github/hyr0318/baselibrary/base/fragment/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.baselibrary.base.fragment; 2 | 3 | import com.github.hyr0318.baselibrary.view.BaseView; 4 | 5 | /** 6 | * Description: 7 | * 作者:hyr on 2016/9/2 16:31 8 | * 邮箱:2045446584@qq.com 9 | */ 10 | public abstract class BaseFragment extends BaseLazyFragment implements BaseView { 11 | @Override 12 | public void showError(String msg) { 13 | triggerShowError(true, msg, null); 14 | } 15 | 16 | 17 | @Override 18 | public void showException(String msg) { 19 | triggerShowError(true, msg, null); 20 | } 21 | 22 | 23 | @Override 24 | public void showNetError() { 25 | triggerNetworkError(true, null); 26 | } 27 | 28 | 29 | @Override 30 | public void showLoading(String msg) { 31 | triggerShowLoading(true, null); 32 | } 33 | 34 | 35 | @Override 36 | public void hideLoading() { 37 | triggerShowLoading(false, null); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/contract/JokeContract.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.contract; 2 | 3 | import com.github.hyr0318.materialnews_mvp.entity.JokeResult; 4 | import com.github.hyr0318.materialnews_mvp.view.BaseView; 5 | 6 | /** 7 | * Description: 8 | * 作者:hyr on 2016/9/1 11:07 9 | * 邮箱:2045446584@qq.com 10 | */ 11 | public class JokeContract { 12 | public interface JokeView extends BaseView{ 13 | 14 | void refreshListData(JokeResult jokeResult); 15 | 16 | void addMoreListData(JokeResult jokeResult); 17 | } 18 | 19 | 20 | public interface JokePresenter { 21 | 22 | void loadListData(String requestTag, int event_tag, int page,String showapi_appid,String showapi_timestamp,String showapi_sign, boolean isSwipeRefresh); 23 | } 24 | 25 | 26 | public interface JokeModel { 27 | 28 | void getCommonListData(String requestTag, int event_tag, int page,String showapi_appid,String showapi_timestamp,String showapi_sign); 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /.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 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/TuwenMainPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.presenter; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.contract.TuwenMainContract; 5 | import com.github.hyr0318.materialnews_mvp.model.TuwenMainModelImpl; 6 | 7 | /** 8 | * Created by MVPHelper on 2016/09/01 9 | */ 10 | 11 | public class TuwenMainPresenterImpl implements TuwenMainContract.TuwenMainPresenter { 12 | private Context mContext; 13 | 14 | private TuwenMainContract.TuwenMainView view; 15 | private final TuwenMainModelImpl tuwenMainModel; 16 | 17 | 18 | public TuwenMainPresenterImpl(Context mContext, TuwenMainContract.TuwenMainView view) { 19 | this.mContext = mContext; 20 | 21 | this.view = view; 22 | 23 | tuwenMainModel = new TuwenMainModelImpl(); 24 | } 25 | 26 | 27 | @Override public void initialized() { 28 | view.initializedView(tuwenMainModel.getTabList(mContext)); 29 | 30 | } 31 | } -------------------------------------------------------------------------------- /.idea/libraries/design_24_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /base_library/src/main/res/layout/message.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/ImageMainPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.presenter; 2 | import android.content.Context; 3 | import com.github.hyr0318.materialnews_mvp.contract.ImageMainContract; 4 | import com.github.hyr0318.materialnews_mvp.model.ImageMainModelImpl; 5 | 6 | /** 7 | * Created by MVPHelper on 2016/09/02 8 | */ 9 | 10 | public class ImageMainPresenterImpl implements ImageMainContract.ImageMainPresenter{ 11 | private Context mContext ; 12 | 13 | private ImageMainContract.ImageMainView imageMainView; 14 | private final ImageMainModelImpl imageMainModel; 15 | 16 | 17 | public ImageMainPresenterImpl(Context mContext, ImageMainContract.ImageMainView imageMainView) { 18 | this.mContext = mContext ; 19 | 20 | this.imageMainView = imageMainView; 21 | 22 | imageMainModel = new ImageMainModelImpl(); 23 | } 24 | 25 | 26 | @Override public void initialized() { 27 | imageMainView.initializedView(imageMainModel.getTabList(mContext)); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/model/CommonListModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com] 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.github.hyr0318.materialnews_mvp.model; 18 | 19 | /** 20 | * @author hyr. 21 | * @time 2016/8/27 9:50. 22 | * @des : 23 | * @email :2045446584@qq.com 24 | */ 25 | 26 | public interface CommonListModel { 27 | 28 | void getCommonListData(String requestTag, final int event_tag, String keywords, int page); 29 | } 30 | -------------------------------------------------------------------------------- /.idea/libraries/appcompat_v7_24_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/nagavation_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 19 | 20 | 28 | -------------------------------------------------------------------------------- /.idea/libraries/recyclerview_v7_24_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/entity/HomeNavigationEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.entity; 2 | 3 | /** 4 | * Author: hyr on 2016/8/28. 5 | * Email:2045446584@qq.com 6 | */ 7 | public class HomeNavigationEntity { 8 | 9 | int iconResID; 10 | 11 | String iconName ; 12 | 13 | String iconID; 14 | 15 | 16 | public HomeNavigationEntity(int iconResID, String iconName, String iconID) { 17 | this.iconResID = iconResID; 18 | this.iconName = iconName; 19 | this.iconID = iconID; 20 | } 21 | 22 | 23 | public int getIconResID() { 24 | return iconResID; 25 | } 26 | 27 | 28 | public void setIconResID(int iconResID) { 29 | this.iconResID = iconResID; 30 | } 31 | 32 | 33 | public String getIconName() { 34 | return iconName; 35 | } 36 | 37 | 38 | public void setIconName(String iconName) { 39 | this.iconName = iconName; 40 | } 41 | 42 | 43 | public String getIconID() { 44 | return iconID; 45 | } 46 | 47 | 48 | public void setIconID(String iconID) { 49 | this.iconID = iconID; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /base_library/src/main/java/com/github/hyr0318/baselibrary/adapter/ViewHolderCreator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com] 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.github.hyr0318.baselibrary.adapter; 18 | 19 | /** 20 | * A interface that defines what a View Holder Creator should do. 21 | * 22 | * @param the generic type of the data in each item of a list. 23 | * @author http://www.liaohuqiu.net 24 | */ 25 | public interface ViewHolderCreator { 26 | public ViewHolderBase createViewHolder(int position); 27 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/data/http/BaseObserver.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.data.http; 2 | 3 | import android.text.TextUtils; 4 | import android.util.Log; 5 | import com.github.hyr0318.materialnews_mvp.App; 6 | import com.github.hyr0318.materialnews_mvp.entity.BaseResult; 7 | import rx.Observer; 8 | 9 | 10 | /** 11 | * 网络请求返回需要的模型 12 | * Created by ice on 3/3/16. 13 | */ 14 | public abstract class BaseObserver implements Observer { 15 | 16 | protected abstract void onSucceed(T result); 17 | 18 | protected void onFailed(String msg) { 19 | if (!TextUtils.isEmpty(msg)) 20 | App.showToast(msg); 21 | } 22 | 23 | @Override 24 | public void onCompleted() { 25 | Log.i("onCompleted =====", "onCompleted"); 26 | } 27 | 28 | @Override 29 | public void onError(Throwable e) { 30 | Log.i("onError====", e.toString()); 31 | onFailed(null); 32 | } 33 | 34 | @Override 35 | public void onNext(T result) { 36 | if (result != null) 37 | onSucceed(result); 38 | else 39 | onFailed(null); 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/utils/RetrofitUtil.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.utils; 2 | 3 | import com.github.hyr0318.materialnews_mvp.data.ApiService; 4 | import java.util.concurrent.TimeUnit; 5 | import okhttp3.OkHttpClient; 6 | import retrofit2.Retrofit; 7 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; 8 | import retrofit2.converter.gson.GsonConverterFactory; 9 | 10 | /** 11 | * Description: 12 | * 作者:hyr on 2016/8/29 12:01 13 | * 邮箱:2045446584@qq.com 14 | */ 15 | public class RetrofitUtil { 16 | public static Retrofit.Builder get(String baseUrl){ 17 | OkHttpClient okHttpClient =new OkHttpClient.Builder().connectTimeout(5, TimeUnit.SECONDS).build(); 18 | 19 | Retrofit.Builder builder = new Retrofit.Builder(); 20 | 21 | builder.client(okHttpClient).baseUrl(baseUrl).addConverterFactory(GsonConverterFactory.create()).addCallAdapterFactory( 22 | RxJavaCallAdapterFactory.create()); 23 | 24 | return builder ; 25 | 26 | } 27 | 28 | public static ApiService getApi (String baseuRL){ 29 | 30 | return get(baseuRL).build().create(ApiService.class); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /base_library/src/main/java/com/github/hyr0318/baselibrary/date/BaseObserver.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.baselibrary.date; 2 | 3 | import android.text.TextUtils; 4 | import com.github.hyr0318.baselibrary.date.entity.BaseResult; 5 | import com.orhanobut.logger.Logger; 6 | import rx.Observer; 7 | 8 | /** 9 | * 网络请求返回需要的模型 10 | * Created by ice on 3/3/16. 11 | */ 12 | public abstract class BaseObserver implements Observer { 13 | 14 | protected abstract void onSucceed(T result); 15 | 16 | 17 | protected void onFailed(String msg) { 18 | if (!TextUtils.isEmpty(msg)) { 19 | Logger.i(msg); 20 | } 21 | } 22 | 23 | 24 | @Override 25 | public void onCompleted() { 26 | Logger.i("onCompleted =====", "onCompleted"); 27 | } 28 | 29 | 30 | @Override 31 | public void onError(Throwable e) { 32 | Logger.i("onError====", e.toString()); 33 | onFailed(null); 34 | } 35 | 36 | 37 | @Override 38 | public void onNext(T result) { 39 | if (result != null) { 40 | onSucceed(result); 41 | } else { 42 | onFailed(null); 43 | } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/common/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com] 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.github.hyr0318.materialnews_mvp.common; 18 | 19 | public class Constants { 20 | 21 | public static final int EVENT_BEGIN = 0X100; 22 | public static final int EVENT_REFRESH_DATA = EVENT_BEGIN + 10; 23 | public static final int EVENT_LOAD_MORE_DATA = EVENT_BEGIN + 20; 24 | 25 | public static final String SHOW_API_APP_ID = "23885"; 26 | 27 | public static final String SHOW_API_SIGN = "04e0e94a0431cd612af4bc818217b595"; 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/utils/HttpUtils.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.utils; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.net.HttpURLConnection; 6 | import java.net.MalformedURLException; 7 | import java.net.URL; 8 | 9 | /** 10 | * Description: 11 | * 作者:hyr on 2016/9/12 12:29 12 | * 邮箱:2045446584@qq.com 13 | */ 14 | public class HttpUtils { 15 | 16 | /** 17 | * 通过图片url返回图片Bitmap 18 | * @param url 19 | * @return 20 | */ 21 | public static InputStream returnBitMap(String path) { 22 | URL url = null; 23 | InputStream is =null; 24 | try { 25 | url = new URL(path); 26 | } catch (MalformedURLException e) { 27 | e.printStackTrace(); 28 | } 29 | try { 30 | HttpURLConnection conn = (HttpURLConnection) url.openConnection();//利用HttpURLConnection对象,我们可以从网络中获取网页数据. 31 | conn.setDoInput(true); 32 | conn.connect(); 33 | is = conn.getInputStream(); //得到网络返回的输入流 34 | 35 | } catch (IOException e) { 36 | e.printStackTrace(); 37 | } 38 | return is; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_joke_gif_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 19 | 20 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_joke_imag_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 19 | 20 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_24_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/ui/adapter/HomeViewPagerFragmentAdapter.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.ui.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | import com.github.hyr0318.baselibrary.base.fragment.BaseLazyFragment; 7 | import java.util.List; 8 | 9 | /** 10 | * Author: hyr on 2016/8/28. 11 | * Email:2045446584@qq.com 12 | */ 13 | public class HomeViewPagerFragmentAdapter extends FragmentPagerAdapter { 14 | 15 | private List fragments; 16 | 17 | 18 | public HomeViewPagerFragmentAdapter(FragmentManager supportFragmentManager, List fragments) { 19 | super(supportFragmentManager); 20 | 21 | this.fragments = fragments; 22 | } 23 | 24 | 25 | @Override public Fragment getItem(int position) { 26 | 27 | if (null != fragments && position < fragments.size()) { 28 | 29 | return fragments.get(position); 30 | } else { 31 | return null; 32 | } 33 | 34 | } 35 | 36 | 37 | @Override public int getCount() { 38 | return null != fragments ? fragments.size() : 0; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /base_library/src/main/res/layout/loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 19 | 20 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_webview_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 16 | 17 | 24 | 25 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/model/VideoMainModelImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.model; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.R; 5 | import com.github.hyr0318.materialnews_mvp.entity.TabBaseEntity; 6 | import com.github.hyr0318.materialnews_mvp.contract.VideoMainContract; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by MVPHelper on 2016/08/29 12 | */ 13 | 14 | public class VideoMainModelImpl implements VideoMainContract.VideoMainModel { 15 | 16 | @Override public List getTabList(Context context) { 17 | List list = new ArrayList<>(); 18 | 19 | String[] tabArrayType = context.getResources().getStringArray(R.array.tab_array_type); 20 | String[] tabArrayName = context.getResources().getStringArray(R.array.tab_array_name); 21 | 22 | list.add(new TabBaseEntity(tabArrayType[0], tabArrayName[0])); 23 | list.add(new TabBaseEntity(tabArrayType[1], tabArrayName[1])); 24 | list.add(new TabBaseEntity(tabArrayType[2], tabArrayName[2])); 25 | list.add(new TabBaseEntity(tabArrayType[3], tabArrayName[3])); 26 | list.add(new TabBaseEntity(tabArrayType[4], tabArrayName[4])); 27 | return list; 28 | } 29 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/title.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 15 | 16 | 22 | 23 | 27 | 28 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/listener/BaseMultiLoadedListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com] 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.github.hyr0318.materialnews_mvp.listener; 18 | 19 | public interface BaseMultiLoadedListener { 20 | 21 | /** 22 | * when data call back success 23 | * 24 | * @param event_tag 25 | * @param data 26 | */ 27 | void onSuccess(int event_tag, T data); 28 | 29 | /** 30 | * when data call back error 31 | * 32 | * @param msg 33 | */ 34 | void onError(String msg); 35 | 36 | /** 37 | * when data call back occurred exception 38 | * 39 | * @param msg 40 | */ 41 | void onException(String msg); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/ui/adapter/JokeMainFragmentPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.ui.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | import com.github.hyr0318.materialnews_mvp.entity.BaiSiTabResult; 7 | import com.github.hyr0318.materialnews_mvp.ui.fragment.JokeFragment; 8 | import java.util.List; 9 | 10 | /** 11 | * Description: 12 | * 作者:hyr on 2016/9/2 11:32 13 | * 邮箱:2045446584@qq.com 14 | */ 15 | public class JokeMainFragmentPagerAdapter extends FragmentPagerAdapter { 16 | 17 | List submenus; 18 | 19 | 20 | public JokeMainFragmentPagerAdapter(FragmentManager fm, List submenus) { 21 | super(fm); 22 | this.submenus = submenus; 23 | } 24 | 25 | 26 | @Override public Fragment getItem(int position) { 27 | return new JokeFragment(submenus.get(position).getUrl()); 28 | } 29 | 30 | 31 | @Override public int getCount() { 32 | return submenus != null ? submenus.size() : 0; 33 | } 34 | 35 | 36 | @Override public CharSequence getPageTitle(int position) { 37 | return null != submenus ? submenus.get(position).getName() : ""; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/ui/adapter/TuwenMainFragmentPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.ui.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | import com.github.hyr0318.materialnews_mvp.entity.TuwenTabBaseEntity; 7 | import com.github.hyr0318.materialnews_mvp.ui.fragment.TuwenFragment; 8 | import java.util.List; 9 | 10 | /** 11 | * Description: 12 | * 作者:hyr on 2016/9/1 10:10 13 | * 邮箱:2045446584@qq.com 14 | */ 15 | public class TuwenMainFragmentPagerAdapter extends FragmentPagerAdapter { 16 | private List tabBaseEntityList; 17 | public TuwenMainFragmentPagerAdapter(FragmentManager fm, List tabBaseEntityList) { 18 | super(fm); 19 | this.tabBaseEntityList = tabBaseEntityList ; 20 | } 21 | 22 | 23 | @Override public Fragment getItem(int position) { 24 | return new TuwenFragment(); 25 | } 26 | 27 | 28 | @Override public int getCount() { 29 | return null != tabBaseEntityList ? tabBaseEntityList.size() : 0; 30 | } 31 | @Override 32 | public CharSequence getPageTitle(int position) { 33 | return null != tabBaseEntityList ? tabBaseEntityList.get(position).getName() : ""; 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/ui/adapter/VideoMainFragmentPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.ui.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | import com.github.hyr0318.materialnews_mvp.entity.TabBaseEntity; 7 | import com.github.hyr0318.materialnews_mvp.ui.fragment.VideoListFragment; 8 | import java.util.List; 9 | 10 | /** 11 | * Description: 12 | * 作者:hyr on 2016/8/29 10:48 13 | * 邮箱:2045446584@qq.com 14 | */ 15 | public class VideoMainFragmentPagerAdapter extends FragmentPagerAdapter { 16 | private List tabBaseEntityList; 17 | public VideoMainFragmentPagerAdapter(FragmentManager fm, List tabBaseEntityList) { 18 | super(fm); 19 | this.tabBaseEntityList = tabBaseEntityList ; 20 | } 21 | 22 | 23 | @Override public Fragment getItem(int position) { 24 | return new VideoListFragment(); 25 | } 26 | 27 | 28 | @Override public int getCount() { 29 | return null != tabBaseEntityList ? tabBaseEntityList.size() : 0; 30 | } 31 | @Override 32 | public CharSequence getPageTitle(int position) { 33 | return null != tabBaseEntityList ? tabBaseEntityList.get(position).getName() : null; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/ui/adapter/ImageMainFragmentPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.ui.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | import com.github.hyr0318.materialnews_mvp.entity.TabBaseEntity; 7 | import com.github.hyr0318.materialnews_mvp.ui.fragment.ImageFragment; 8 | import java.util.List; 9 | 10 | /** 11 | * Description: 12 | * 作者:hyr on 2016/9/2 11:32 13 | * 邮箱:2045446584@qq.com 14 | */ 15 | public class ImageMainFragmentPagerAdapter extends FragmentPagerAdapter { 16 | 17 | private List tabBaseEntityList; 18 | 19 | 20 | public ImageMainFragmentPagerAdapter(FragmentManager fm, List tabBaseEntityList) { 21 | super(fm); 22 | this.tabBaseEntityList = tabBaseEntityList; 23 | } 24 | 25 | 26 | @Override public Fragment getItem(int position) { 27 | return new ImageFragment(); 28 | } 29 | 30 | 31 | @Override public int getCount() { 32 | return tabBaseEntityList != null ? tabBaseEntityList.size() : 0; 33 | } 34 | 35 | 36 | @Override public CharSequence getPageTitle(int position) { 37 | return null != tabBaseEntityList ? tabBaseEntityList.get(position).getName() : ""; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /base_library/src/main/java/com/github/hyr0318/baselibrary/view/BaseView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com] 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.github.hyr0318.baselibrary.view; 18 | 19 | /** 20 | * @Description: 21 | * @author: hyr 22 | * @time: 2016/9/2 16:06 23 | * @Email: 2045446584@qq.com 24 | */ 25 | public interface BaseView { 26 | 27 | /** 28 | * 显示正在加载 29 | */ 30 | void showLoading(String msg); 31 | 32 | /** 33 | * 隐藏加载进度 34 | */ 35 | void hideLoading(); 36 | 37 | /** 38 | * 显示错误信息 39 | */ 40 | void showError(String msg); 41 | 42 | /** 43 | * 显示异常信息 44 | */ 45 | void showException(String msg); 46 | 47 | /** 48 | * 显示网络错误 49 | */ 50 | void showNetError(); 51 | 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/res/layout/drawer_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 20 | 21 | 27 | 28 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/model/TuwenMainModelImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.model; 2 | import android.content.Context; 3 | import com.github.hyr0318.materialnews_mvp.R; 4 | import com.github.hyr0318.materialnews_mvp.contract.TuwenMainContract; 5 | import com.github.hyr0318.materialnews_mvp.entity.TuwenTabBaseEntity; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * Created by MVPHelper on 2016/09/01 11 | */ 12 | 13 | public class TuwenMainModelImpl implements TuwenMainContract.TuwenMainModel{ 14 | 15 | 16 | 17 | @Override public List getTabList(Context context) { 18 | 19 | List tabBaseEntities = new ArrayList<>(); 20 | 21 | String[] typeArray = context.getResources().getStringArray(R.array.tab_array_tuwen_type); 22 | String[] nameArray = context.getResources().getStringArray(R.array.tab_array_tuwen_name); 23 | 24 | tabBaseEntities.add(new TuwenTabBaseEntity(typeArray[0],nameArray[0])); 25 | tabBaseEntities.add(new TuwenTabBaseEntity(typeArray[1],nameArray[1])); 26 | tabBaseEntities.add(new TuwenTabBaseEntity(typeArray[2],nameArray[2])); 27 | tabBaseEntities.add(new TuwenTabBaseEntity(typeArray[3],nameArray[3])); 28 | tabBaseEntities.add(new TuwenTabBaseEntity(typeArray[4],nameArray[4])); 29 | 30 | return tabBaseEntities; 31 | } 32 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/api/ApiConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com] 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.github.hyr0318.materialnews_mvp.api; 18 | 19 | import android.os.Environment; 20 | 21 | /** 22 | * 23 | */ 24 | public class ApiConstants { 25 | 26 | public static final class Urls { 27 | 28 | 29 | } 30 | 31 | public static final class Paths { 32 | public static final String BASE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath(); 33 | public static final String IMAGE_LOADER_CACHE_PATH = ""; 34 | } 35 | 36 | public static final class Integers { 37 | public static final int PAGE_LAZY_LOAD_DELAY_TIME_MS = 500; 38 | public static final int PAGE_LAZY_LOAD_DELAY_TIME_MS_NO_TIME = 0; 39 | } 40 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/model/JokeMainModelImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.model; 2 | 3 | import com.github.hyr0318.materialnews_mvp.contract.JokeMainContract; 4 | import com.github.hyr0318.materialnews_mvp.data.MaterialNewsApi; 5 | import com.github.hyr0318.materialnews_mvp.data.http.BaseObserver; 6 | import com.github.hyr0318.materialnews_mvp.entity.BaiSiTabResult; 7 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 8 | import rx.schedulers.Schedulers; 9 | 10 | /** 11 | * Created by MVPHelper on 2016/09/09 12 | */ 13 | 14 | public class JokeMainModelImpl implements JokeMainContract.JokeMainModel { 15 | private BaseMultiLoadedListener baseMultiLoadedListener; 16 | 17 | 18 | public JokeMainModelImpl(BaseMultiLoadedListener baseMultiLoadedListener) { 19 | this.baseMultiLoadedListener = baseMultiLoadedListener; 20 | } 21 | 22 | 23 | @Override public void getTabList(String requestTag) { 24 | 25 | MaterialNewsApi materialNewsApi = new MaterialNewsApi(); 26 | 27 | materialNewsApi.getTabList().subscribeOn(Schedulers.immediate()).subscribe( 28 | new BaseObserver() { 29 | @Override protected void onSucceed(BaiSiTabResult result) { 30 | baseMultiLoadedListener.onSuccess(0, result); 31 | } 32 | }); 33 | 34 | } 35 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/ui/adapter/TuwenAapter.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.ui.adapter; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.R; 5 | import com.github.hyr0318.materialnews_mvp.entity.TuwenEntity; 6 | import com.github.hyr0318.materialnews_mvp.widget.BaseRecyclerAdapter; 7 | import com.github.hyr0318.materialnews_mvp.widget.BaseRecyclerViewHolder; 8 | import com.squareup.picasso.Picasso; 9 | 10 | /** 11 | * Description: 12 | * 作者:hyr on 2016/8/31 10:18 13 | * 邮箱:2045446584@qq.com 14 | */ 15 | public class TuwenAapter extends BaseRecyclerAdapter { 16 | 17 | public TuwenAapter(Context mContext) { 18 | super(mContext); 19 | } 20 | 21 | 22 | @Override public int getItemLayoutId(int viewType) { 23 | return R.layout.item_tuwen_layout; 24 | } 25 | 26 | 27 | @Override public void bindData(BaseRecyclerViewHolder holder, int position, TuwenEntity item) { 28 | 29 | Picasso.with(mContext).load(item.getThumb()).into(holder.getImageView(R.id.thumb)); 30 | 31 | holder.getTextView(R.id.type).setText(item.getType()); 32 | 33 | holder.getTextView(R.id.author).setText(item.getAuthor()); 34 | 35 | holder.getTextView(R.id.data).setText(item.getDate()); 36 | 37 | holder.getTextView(R.id.title).setText(item.getTitle()); 38 | 39 | holder.getTextView(R.id.des).setText(item.getDes()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Settings specified in this file will override any Gradle settings 4 | # configured through the IDE. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # The Gradle daemon aims to improve the startup and execution time of Gradle. 8 | # When set to true the Gradle daemon is to run the build. 9 | # TODO: disable daemon on CI, since builds should be clean and reliable on servers 10 | org.gradle.daemon=true 11 | # Specifies the JVM arguments used for the daemon process. 12 | # The setting is particularly useful for tweaking memory settings. 13 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 14 | org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | org.gradle.parallel=true 19 | # Enables new incubating mode that makes Gradle selective when configuring projects. 20 | # Only relevant projects are configured which results in faster builds for large multi-projects. 21 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand 22 | org.gradle.configureondemand=true -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_main_lauout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 22 | 23 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_video_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 22 | 23 | 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/view/BaseView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com] 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.github.hyr0318.materialnews_mvp.view; 18 | 19 | /** 20 | * Author: Tau.Chen 21 | * Email: 1076559197@qq.com | tauchen1990@gmail.com 22 | * Date: 2015/3/9. 23 | * Description: the base view 24 | */ 25 | public interface BaseView { 26 | 27 | /** 28 | * show loading message 29 | * 30 | * @param msg 31 | */ 32 | void showLoading(String msg); 33 | 34 | /** 35 | * hide loading 36 | */ 37 | void hideLoading(); 38 | 39 | /** 40 | * show error message 41 | */ 42 | void showError(String msg); 43 | 44 | /** 45 | * show exception message 46 | */ 47 | void showException(String msg); 48 | 49 | /** 50 | * show net error 51 | */ 52 | void showNetError(); 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 百思不得姐 5 | 今日头条 6 | 每日图文 7 | 美图欣赏 8 | 9 | 10 | 11 | 12 | video 13 | subv_funny 14 | subv_voice 15 | subv_society 16 | subv_entertainment 17 | 18 | 19 | 全部 20 | 逗比剧 21 | 好声音 22 | 看天下 23 | 最娱乐 24 | 25 | 26 | 27 | life 28 | feeling 29 | illustration 30 | culture 31 | pic 32 | 33 | 34 | 35 | 生活图文 36 | 情感图文 37 | 插画图文 38 | 文化图文 39 | 唯美图片 40 | 41 | 42 | 二次元 43 | 丝袜美女 44 | 性感美女 45 | 美腿美女 46 | 唯美摄影 47 | 宠物 48 | 高清动漫 49 | 宠物 50 | 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/model/BaiSiModelImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.model; 2 | 3 | import com.github.hyr0318.materialnews_mvp.contract.BaiSiContract; 4 | import com.github.hyr0318.materialnews_mvp.data.MaterialNewsApi; 5 | import com.github.hyr0318.materialnews_mvp.data.http.BaseObserver; 6 | import com.github.hyr0318.materialnews_mvp.entity.BaiSiResult; 7 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 8 | import rx.schedulers.Schedulers; 9 | 10 | /** 11 | * Created by MVPHelper on 2016/09/09 12 | */ 13 | 14 | public class BaiSiModelImpl implements BaiSiContract.BaiSiModel { 15 | BaseMultiLoadedListener baseMultiLoadedListener; 16 | 17 | 18 | public BaiSiModelImpl(BaseMultiLoadedListener baseMultiLoadedListener) { 19 | this.baseMultiLoadedListener = baseMultiLoadedListener; 20 | } 21 | 22 | 23 | @Override public void getListData(String requestTag, int event_tag, String url, long page) { 24 | 25 | MaterialNewsApi materialNewsApi = new MaterialNewsApi(); 26 | 27 | String substring2 = url.substring(21, url.length()); 28 | 29 | materialNewsApi.getBaiSiList(substring2,page).subscribeOn(Schedulers.immediate()).subscribe( 30 | new BaseObserver() { 31 | @Override protected void onSucceed(BaiSiResult result) { 32 | baseMultiLoadedListener.onSuccess(event_tag, result); 33 | 34 | } 35 | }); 36 | 37 | } 38 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/model/ImageMainModelImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.model; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.R; 5 | import com.github.hyr0318.materialnews_mvp.contract.ImageMainContract; 6 | import com.github.hyr0318.materialnews_mvp.entity.TabBaseEntity; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by MVPHelper on 2016/09/02 12 | */ 13 | 14 | public class ImageMainModelImpl implements ImageMainContract.ImageMainModel { 15 | 16 | @Override public List getTabList(Context context) { 17 | 18 | String[] stringArray = context.getResources().getStringArray(R.array.baidu_image_tab_type); 19 | 20 | List tabBaseEntities = new ArrayList<>(); 21 | 22 | tabBaseEntities.add(new TabBaseEntity(stringArray[0], stringArray[0])); 23 | tabBaseEntities.add(new TabBaseEntity(stringArray[1], stringArray[1])); 24 | tabBaseEntities.add(new TabBaseEntity(stringArray[2], stringArray[2])); 25 | tabBaseEntities.add(new TabBaseEntity(stringArray[3], stringArray[3])); 26 | tabBaseEntities.add(new TabBaseEntity(stringArray[4], stringArray[4])); 27 | tabBaseEntities.add(new TabBaseEntity(stringArray[5], stringArray[5])); 28 | tabBaseEntities.add(new TabBaseEntity(stringArray[6], stringArray[6])); 29 | tabBaseEntities.add(new TabBaseEntity(stringArray[7], stringArray[7])); 30 | 31 | return tabBaseEntities; 32 | } 33 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_news_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 22 | 23 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/foot.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 12 | 13 | 17 | 18 | 24 | 25 | 26 | 27 | 32 | 33 | 37 | 38 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/JokeMainPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.presenter; 2 | import android.content.Context; 3 | import com.github.hyr0318.materialnews_mvp.contract.JokeMainContract; 4 | import com.github.hyr0318.materialnews_mvp.entity.BaiSiTabResult; 5 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 6 | import com.github.hyr0318.materialnews_mvp.model.JokeMainModelImpl; 7 | 8 | /** 9 | * Created by MVPHelper on 2016/09/09 10 | */ 11 | 12 | public class JokeMainPresenterImpl implements JokeMainContract.JokeMainPresenter,BaseMultiLoadedListener{ 13 | private Context mContext ; 14 | 15 | private JokeMainContract.JokeMainView jokeMainView; 16 | private final JokeMainModelImpl jokeMainModel; 17 | 18 | 19 | public JokeMainPresenterImpl(Context mContext, JokeMainContract.JokeMainView jokeMainView) { 20 | this.mContext = mContext ; 21 | 22 | this.jokeMainView = jokeMainView; 23 | 24 | jokeMainModel = new JokeMainModelImpl(this); 25 | 26 | } 27 | 28 | 29 | @Override public void initialized(String requestTag) { 30 | jokeMainModel.getTabList(requestTag); 31 | } 32 | 33 | 34 | @Override public void onSuccess(int event_tag, BaiSiTabResult data) { 35 | 36 | if(null != data){ 37 | 38 | jokeMainView.initializedView(data); 39 | } 40 | } 41 | 42 | 43 | @Override public void onError(String msg) { 44 | 45 | } 46 | 47 | 48 | @Override public void onException(String msg) { 49 | 50 | } 51 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/model/ImageModelImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.model; 2 | 3 | import android.util.Log; 4 | import com.github.hyr0318.materialnews_mvp.contract.ImageContract; 5 | import com.github.hyr0318.materialnews_mvp.data.MaterialNewsApi; 6 | import com.github.hyr0318.materialnews_mvp.data.http.BaseObserver; 7 | import com.github.hyr0318.materialnews_mvp.entity.ImageResult; 8 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 9 | import rx.schedulers.Schedulers; 10 | 11 | /** 12 | * Created by MVPHelper on 2016/09/02 13 | */ 14 | 15 | public class ImageModelImpl implements ImageContract.ImageModel { 16 | 17 | private BaseMultiLoadedListener baseMultiLoadedListener; 18 | 19 | 20 | public ImageModelImpl(BaseMultiLoadedListener baseMultiLoadedListener) { 21 | this.baseMultiLoadedListener = baseMultiLoadedListener; 22 | 23 | } 24 | 25 | 26 | @Override public void getImageList(String requestTag, int event_tag, String word, int cl) { 27 | 28 | MaterialNewsApi materialNewsApi = new MaterialNewsApi(); 29 | 30 | Log.i("word============",word); 31 | Log.i("cl============",cl+""); 32 | materialNewsApi.getImageList("resultjson_com", "rj",word, String.valueOf(cl)) 33 | .subscribeOn(Schedulers.immediate()) 34 | .subscribe( 35 | new BaseObserver() { 36 | @Override protected void onSucceed(ImageResult result) { 37 | baseMultiLoadedListener.onSuccess(event_tag, result); 38 | } 39 | }); 40 | } 41 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/model/BaiSiDetailModelImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.model; 2 | 3 | import com.github.hyr0318.materialnews_mvp.contract.BaiSiDetailContract; 4 | import com.github.hyr0318.materialnews_mvp.data.MaterialNewsApi; 5 | import com.github.hyr0318.materialnews_mvp.data.http.BaseObserver; 6 | import com.github.hyr0318.materialnews_mvp.entity.BaiSiDetailResult; 7 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 8 | import com.orhanobut.logger.Logger; 9 | import rx.schedulers.Schedulers; 10 | 11 | /** 12 | * Created by MVPHelper on 2016/09/13 13 | */ 14 | 15 | public class BaiSiDetailModelImpl implements BaiSiDetailContract.BaiSiDetailModel { 16 | 17 | private BaseMultiLoadedListener baseMultiLoadedListener; 18 | 19 | 20 | public BaiSiDetailModelImpl(BaseMultiLoadedListener baseMultiLoadedListener) { 21 | this.baseMultiLoadedListener = baseMultiLoadedListener; 22 | } 23 | 24 | 25 | @Override 26 | public void getCommentList(String request_tag, int enent_tag, int page, String id) { 27 | 28 | Logger.d(id); 29 | 30 | MaterialNewsApi materialNewsApi = new MaterialNewsApi(); 31 | 32 | materialNewsApi.getBaiSiDetailResult(id).subscribeOn(Schedulers.immediate()).subscribe( 33 | new BaseObserver() { 34 | @Override protected void onSucceed(BaiSiDetailResult result) { 35 | 36 | Logger.d(result.getTotal()); 37 | 38 | baseMultiLoadedListener.onSuccess(enent_tag, result); 39 | } 40 | }); 41 | 42 | } 43 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/model/JokeModelImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.model; 2 | 3 | import android.util.Log; 4 | import com.github.hyr0318.materialnews_mvp.contract.JokeContract; 5 | import com.github.hyr0318.materialnews_mvp.data.MaterialNewsApi; 6 | import com.github.hyr0318.materialnews_mvp.data.http.BaseObserver; 7 | import com.github.hyr0318.materialnews_mvp.entity.JokeResult; 8 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 9 | import rx.schedulers.Schedulers; 10 | 11 | /** 12 | * Created by MVPHelper on 2016/09/01 13 | */ 14 | 15 | public class JokeModelImpl implements JokeContract.JokeModel { 16 | private BaseMultiLoadedListener multiLoadedListener; 17 | 18 | 19 | public JokeModelImpl(BaseMultiLoadedListener multiLoadedListener) { 20 | this.multiLoadedListener = multiLoadedListener; 21 | 22 | } 23 | 24 | 25 | @Override 26 | public void getCommonListData(String requestTag, int event_tag, int page, String showapi_appid, String showapi_timestamp, String showapi_sign) { 27 | 28 | MaterialNewsApi materialNewsApi = new MaterialNewsApi(); 29 | 30 | materialNewsApi.getJokeList(page,showapi_appid,showapi_timestamp,showapi_sign).subscribeOn( 31 | Schedulers.immediate()).subscribe(new BaseObserver() { 32 | @Override protected void onSucceed(JokeResult result) { 33 | 34 | if(result != null ){ 35 | multiLoadedListener.onSuccess(event_tag,result); 36 | 37 | Log.i("mCurrentPage",page+""); 38 | } 39 | } 40 | }); 41 | 42 | } 43 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/WelecomePresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.presenter; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.contract.WelecomeContract; 5 | import com.github.hyr0318.materialnews_mvp.entity.HomeOneResult; 6 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 7 | import com.github.hyr0318.materialnews_mvp.model.WelecomeModelImpl; 8 | 9 | /** 10 | * Created by hyr on 2016/08/27 11 | */ 12 | 13 | public class WelecomePresenterImpl 14 | implements WelecomeContract.Presenter, BaseMultiLoadedListener { 15 | 16 | private Context mContext; 17 | 18 | private WelecomeContract.View wv; 19 | private final WelecomeModelImpl welecomeModel; 20 | 21 | 22 | public WelecomePresenterImpl(Context context, WelecomeContract.View wv) { 23 | this.mContext = context; 24 | this.wv = wv; 25 | 26 | welecomeModel = new WelecomeModelImpl(this); 27 | 28 | } 29 | 30 | 31 | @Override public void initialized() { 32 | 33 | wv.initializedView(welecomeModel.getVsersionName(mContext), 34 | welecomeModel.getCopyright(mContext)); 35 | 36 | } 37 | 38 | 39 | @Override public void loadHomeOne() { 40 | welecomeModel.getHomeOne(); 41 | } 42 | 43 | 44 | @Override public void onSuccess(int event_tag, HomeOneResult data) { 45 | 46 | if (null != data) { 47 | wv.getHomeOne(data); 48 | } 49 | 50 | } 51 | 52 | 53 | @Override public void onError(String msg) { 54 | 55 | } 56 | 57 | 58 | @Override public void onException(String msg) { 59 | 60 | } 61 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/item_baisi_comment_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 20 | 21 | 26 | 27 | 32 | 33 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /base_library/src/main/java/com/github/hyr0318/baselibrary/eventbus/EventCenter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com] 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.github.hyr0318.baselibrary.eventbus; 18 | 19 | /** 20 | *@Description: 21 | *@author: hyr 22 | *@time: 2016/9/2 15:48 23 | *@Email: 2045446584@qq.com 24 | */ 25 | public class EventCenter { 26 | 27 | /** 28 | * reserved data 29 | */ 30 | private T data; 31 | 32 | /** 33 | * this code distinguish between different events 34 | */ 35 | private int eventCode = -1; 36 | 37 | public EventCenter(int eventCode) { 38 | this(eventCode, null); 39 | } 40 | 41 | public EventCenter(int eventCode, T data) { 42 | this.eventCode = eventCode; 43 | this.data = data; 44 | } 45 | 46 | /** 47 | * get event code 48 | * 49 | * @return 50 | */ 51 | public int getEventCode() { 52 | return this.eventCode; 53 | } 54 | 55 | /** 56 | * get event reserved data 57 | * 58 | * @return 59 | */ 60 | public T getData() { 61 | return this.data; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/entity/TuwenEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.entity; 2 | 3 | /** 4 | * Description: 5 | * 作者:hyr on 2016/8/31 09:31 6 | * 邮箱:2045446584@qq.com 7 | */ 8 | public class TuwenEntity { 9 | 10 | String detialURL ; 11 | 12 | String thumb ; 13 | 14 | String title ; 15 | 16 | String type ; 17 | 18 | String author ; 19 | 20 | String date ; 21 | 22 | String des ; 23 | 24 | 25 | public String getDetialURL() { 26 | return detialURL; 27 | } 28 | 29 | 30 | public void setDetialURL(String detialURL) { 31 | this.detialURL = detialURL; 32 | } 33 | 34 | 35 | public String getThumb() { 36 | return thumb; 37 | } 38 | 39 | 40 | public void setThumb(String thumb) { 41 | this.thumb = thumb; 42 | } 43 | 44 | 45 | public String getTitle() { 46 | return title; 47 | } 48 | 49 | 50 | public void setTitle(String title) { 51 | this.title = title; 52 | } 53 | 54 | 55 | public String getType() { 56 | return type; 57 | } 58 | 59 | 60 | public void setType(String type) { 61 | this.type = type; 62 | } 63 | 64 | 65 | public String getAuthor() { 66 | return author; 67 | } 68 | 69 | 70 | public void setAuthor(String author) { 71 | this.author = author; 72 | } 73 | 74 | 75 | public String getDate() { 76 | return date; 77 | } 78 | 79 | 80 | public void setDate(String date) { 81 | this.date = date; 82 | } 83 | 84 | 85 | public String getDes() { 86 | return des; 87 | } 88 | 89 | 90 | public void setDes(String des) { 91 | this.des = des; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/TuwenDetialPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.presenter; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.contract.TuwenDetialContract; 5 | import com.github.hyr0318.materialnews_mvp.entity.TuwenDetailEntity; 6 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 7 | import com.github.hyr0318.materialnews_mvp.model.TuwenDetialModelImpl; 8 | 9 | /** 10 | * Created by MVPHelper on 2016/08/31 11 | */ 12 | 13 | public class TuwenDetialPresenterImpl implements TuwenDetialContract.TuwenDetialPresenter, 14 | BaseMultiLoadedListener { 15 | private Context mContext; 16 | 17 | private TuwenDetialContract.TuwenDetialView tv; 18 | private final TuwenDetialModelImpl tuwenDetialModel; 19 | 20 | 21 | public TuwenDetialPresenterImpl(Context cxt, TuwenDetialContract.TuwenDetialView tv) { 22 | this.mContext = cxt; 23 | 24 | this.tv = tv; 25 | 26 | tuwenDetialModel = new TuwenDetialModelImpl(this); 27 | } 28 | 29 | 30 | @Override 31 | public void loadTuwenDetail(String requestTag, int event_tag, String url, boolean isSwipeRefresh) { 32 | 33 | if (!isSwipeRefresh) { 34 | tv.showLoading(""); 35 | } 36 | tuwenDetialModel.getTuwenDetailContent(requestTag, event_tag, url); 37 | } 38 | 39 | 40 | @Override public void onSuccess(int event_tag, TuwenDetailEntity data) { 41 | tv.hideLoading(); 42 | tv.initializedView(data); 43 | } 44 | 45 | 46 | @Override public void onError(String msg) { 47 | 48 | } 49 | 50 | 51 | @Override public void onException(String msg) { 52 | 53 | } 54 | } -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 18 | 19 | 24 | 25 | 30 | 31 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/widget/IPhotoView.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 shizhefei(LuckyJayce) 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | */ 13 | package com.github.hyr0318.materialnews_mvp.widget; 14 | 15 | import java.io.InputStream; 16 | 17 | public interface IPhotoView { 18 | 19 | public void setScale(float scale, float offsetX, float offsetY); 20 | 21 | public void setImage(String filePath); 22 | 23 | public void setImage(InputStream inputStream); 24 | 25 | public int getImageWidth(); 26 | 27 | public int getImageHeight(); 28 | 29 | public Scale getScale(); 30 | 31 | public static class Scale { 32 | volatile float scale; 33 | volatile int fromX; 34 | volatile int fromY; 35 | 36 | public Scale(float scale, int fromX, int fromY) { 37 | super(); 38 | this.scale = scale; 39 | this.fromX = fromX; 40 | this.fromY = fromY; 41 | } 42 | 43 | public float getScale() { 44 | return scale; 45 | } 46 | 47 | void setScale(float scale) { 48 | this.scale = scale; 49 | } 50 | 51 | public int getFromX() { 52 | return fromX; 53 | } 54 | 55 | void setFromX(int fromX) { 56 | this.fromX = fromX; 57 | } 58 | 59 | public int getFromY() { 60 | return fromY; 61 | } 62 | 63 | void setFromY(int fromY) { 64 | this.fromY = fromY; 65 | } 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/utils/Toaster.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.utils; 2 | 3 | import android.content.Context; 4 | import android.widget.Toast; 5 | import com.github.hyr0318.materialnews_mvp.App; 6 | 7 | /** 8 | * @author kaka from github 9 | * @date 2014-12-22 10 | */ 11 | public class Toaster { 12 | 13 | private Toast mToast; 14 | private Context context; 15 | 16 | public Toaster() { 17 | context = App.getInstance().getApplicationContext(); 18 | } 19 | 20 | 21 | public Toast getToast(int resId) { 22 | return Toast.makeText(context, resId, Toast.LENGTH_SHORT); 23 | } 24 | 25 | public Toast getToast(String text) { 26 | return Toast.makeText(context, text, Toast.LENGTH_SHORT); 27 | } 28 | 29 | public Toast getLongToast(int resId) { 30 | return Toast.makeText(context, resId, Toast.LENGTH_LONG); 31 | } 32 | 33 | public Toast getLongToast(String text) { 34 | return Toast.makeText(context, text, Toast.LENGTH_LONG); 35 | } 36 | 37 | public void showToast(int resId) { 38 | if (mToast != null) 39 | mToast.cancel(); 40 | mToast = getToast(resId); 41 | show(); 42 | } 43 | 44 | public void showToast(String text) { 45 | if (mToast != null) 46 | mToast.cancel(); 47 | mToast = getToast(text); 48 | show(); 49 | } 50 | 51 | public void showLongToast(int resId) { 52 | if (mToast != null) 53 | mToast.cancel(); 54 | mToast = getLongToast(resId); 55 | show(); 56 | } 57 | 58 | public void showLongToast(String text) { 59 | if (mToast != null) 60 | mToast.cancel(); 61 | mToast = getLongToast(text); 62 | show(); 63 | } 64 | 65 | private void show() { 66 | mToast.show(); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/BaiSiDetailPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.presenter; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.common.Constants; 5 | import com.github.hyr0318.materialnews_mvp.contract.BaiSiDetailContract; 6 | import com.github.hyr0318.materialnews_mvp.entity.BaiSiDetailResult; 7 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 8 | import com.github.hyr0318.materialnews_mvp.model.BaiSiDetailModelImpl; 9 | 10 | /** 11 | * Created by MVPHelper on 2016/09/13 12 | */ 13 | 14 | public class BaiSiDetailPresenterImpl implements BaiSiDetailContract.BaiSiDetailPresenter, 15 | BaseMultiLoadedListener { 16 | 17 | private Context mContext; 18 | private BaiSiDetailContract.BaiSiDetailView baiSiDetailView; 19 | private final BaiSiDetailModelImpl baiSiDetailModel; 20 | 21 | 22 | public BaiSiDetailPresenterImpl(Context mContext, BaiSiDetailContract.BaiSiDetailView baiSiDetailView) { 23 | this.mContext = mContext; 24 | 25 | this.baiSiDetailView = baiSiDetailView; 26 | 27 | baiSiDetailModel = new BaiSiDetailModelImpl(this); 28 | 29 | } 30 | 31 | 32 | @Override 33 | public void loadCommentList(String request_tag, int enent_tag, int page, String id, boolean isRrefresh) { 34 | 35 | if (enent_tag == Constants.EVENT_REFRESH_DATA) { 36 | baiSiDetailModel.getCommentList(request_tag, enent_tag, page, id); 37 | } 38 | } 39 | 40 | 41 | @Override public void onSuccess(int event_tag, BaiSiDetailResult data) { 42 | 43 | if (null != data) { 44 | baiSiDetailView.initCommentList(data); 45 | } 46 | } 47 | 48 | 49 | @Override public void onError(String msg) { 50 | 51 | } 52 | 53 | 54 | @Override public void onException(String msg) { 55 | 56 | } 57 | } -------------------------------------------------------------------------------- /base_library/src/main/java/com/github/hyr0318/baselibrary/widgets/XViewPager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com] 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.github.hyr0318.baselibrary.widgets; 18 | 19 | import android.content.Context; 20 | import android.support.v4.view.ViewPager; 21 | import android.util.AttributeSet; 22 | import android.view.MotionEvent; 23 | 24 | /** 25 | *@Description: 26 | *@author: hyr 27 | *@time: 2016/9/2 17:12 28 | *@Email: 2045446584@qq.com 29 | */ 30 | public class XViewPager extends ViewPager { 31 | 32 | private boolean isEnableScroll = true; 33 | 34 | public void setEnableScroll(boolean isEnableScroll) { 35 | this.isEnableScroll = isEnableScroll; 36 | } 37 | 38 | public XViewPager(Context context) { 39 | super(context); 40 | } 41 | 42 | public XViewPager(Context context, AttributeSet attrs) { 43 | super(context, attrs); 44 | } 45 | 46 | @Override 47 | public boolean onInterceptTouchEvent(MotionEvent ev) { 48 | if (!isEnableScroll) { 49 | return false; 50 | } 51 | return super.onInterceptTouchEvent(ev); 52 | } 53 | 54 | @Override 55 | public boolean onTouchEvent(MotionEvent ev) { 56 | if (!isEnableScroll) { 57 | return false; 58 | } 59 | return super.onTouchEvent(ev); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/BaiSiPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.presenter; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.common.Constants; 5 | import com.github.hyr0318.materialnews_mvp.contract.BaiSiContract; 6 | import com.github.hyr0318.materialnews_mvp.entity.BaiSiResult; 7 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 8 | import com.github.hyr0318.materialnews_mvp.model.BaiSiModelImpl; 9 | 10 | /** 11 | * Created by MVPHelper on 2016/09/09 12 | */ 13 | 14 | public class BaiSiPresenterImpl 15 | implements BaiSiContract.BaiSiPresenter, BaseMultiLoadedListener { 16 | private Context mContext; 17 | 18 | private BaiSiContract.BaiSiView baiSiView; 19 | private final BaiSiModelImpl baiSiModel; 20 | 21 | 22 | public BaiSiPresenterImpl(Context mContext, BaiSiContract.BaiSiView baiSiView) { 23 | this.mContext = mContext; 24 | 25 | this.baiSiView = baiSiView; 26 | 27 | baiSiModel = new BaiSiModelImpl(this); 28 | 29 | } 30 | 31 | 32 | @Override 33 | public void loadListData(String requestTag, int event_tag, String url, long page, boolean isSwipeRefresh) { 34 | if (!isSwipeRefresh) { 35 | baiSiView.showLoading(""); 36 | } 37 | baiSiModel.getListData(requestTag, event_tag, url, page); 38 | 39 | } 40 | 41 | 42 | @Override public void onSuccess(int event_tag, BaiSiResult data) { 43 | baiSiView.hideLoading(); 44 | if (event_tag == Constants.EVENT_REFRESH_DATA) { 45 | baiSiView.refreshListData(data); 46 | } else if (event_tag == Constants.EVENT_LOAD_MORE_DATA) { 47 | baiSiView.addMoreListData(data); 48 | } 49 | } 50 | 51 | 52 | @Override public void onError(String msg) { 53 | 54 | } 55 | 56 | 57 | @Override public void onException(String msg) { 58 | 59 | } 60 | } -------------------------------------------------------------------------------- /app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/model/VideoListModelImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.model; 2 | 3 | import com.github.hyr0318.materialnews_mvp.contract.VideoListContract; 4 | import com.github.hyr0318.materialnews_mvp.data.MaterialNewsApi; 5 | import com.github.hyr0318.materialnews_mvp.data.http.BaseObserver; 6 | import com.github.hyr0318.materialnews_mvp.entity.TouTiaoVideoResult; 7 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 8 | import rx.schedulers.Schedulers; 9 | 10 | /** 11 | * Created by MVPHelper on 2016/08/29 12 | */ 13 | 14 | public class VideoListModelImpl implements VideoListContract.VideoListModel { 15 | private BaseMultiLoadedListener baseMultiLoadedListener; 16 | 17 | 18 | public VideoListModelImpl(BaseMultiLoadedListener baseMultiLoadedListener) { 19 | this.baseMultiLoadedListener = baseMultiLoadedListener; 20 | } 21 | 22 | 23 | @Override 24 | public void getCommonListData(String requestTag, int event_tag, String keywords, int page) { 25 | 26 | MaterialNewsApi materialNewsApi = new MaterialNewsApi(); 27 | 28 | materialNewsApi.getvideoList(keywords, "A13557DC737A670") 29 | .subscribeOn(Schedulers.immediate()) 30 | .subscribe( 31 | new BaseObserver() { 32 | @Override protected void onSucceed(TouTiaoVideoResult result) { 33 | 34 | if (null != result) { 35 | baseMultiLoadedListener.onSuccess(event_tag, result); 36 | } 37 | 38 | } 39 | 40 | 41 | @Override public void onError(Throwable e) { 42 | baseMultiLoadedListener.onException(e.toString()); 43 | } 44 | 45 | 46 | @Override protected void onFailed(String msg) { 47 | baseMultiLoadedListener.onError(msg); 48 | } 49 | }); 50 | 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/TuwenPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.presenter; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.common.Constants; 5 | import com.github.hyr0318.materialnews_mvp.contract.TuwenContract; 6 | import com.github.hyr0318.materialnews_mvp.entity.TuwenEntity; 7 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 8 | import com.github.hyr0318.materialnews_mvp.model.TuwenModelImpl; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by MVPHelper on 2016/08/30 13 | */ 14 | 15 | public class TuwenPresenterImpl implements TuwenContract.TuwenPresenter, 16 | BaseMultiLoadedListener> { 17 | 18 | private Context mContext; 19 | private TuwenContract.TuwenView tuwenView; 20 | private final TuwenModelImpl tuwenModel; 21 | 22 | 23 | public TuwenPresenterImpl(Context mContext, TuwenContract.TuwenView tuwenView) { 24 | this.mContext = mContext; 25 | this.tuwenView = tuwenView; 26 | 27 | tuwenModel = new TuwenModelImpl(this); 28 | } 29 | 30 | 31 | @Override 32 | public void loadListData(String requestTag, int event_tag, String keywords,int page, boolean isSwipeRefresh) { 33 | 34 | 35 | if(! isSwipeRefresh){ 36 | tuwenView.showLoading(""); 37 | } 38 | tuwenModel.getCommonListData(requestTag, event_tag, keywords,page); 39 | 40 | } 41 | 42 | 43 | @Override public void onSuccess(int event_tag, List data) { 44 | tuwenView.hideLoading(); 45 | 46 | if(event_tag == Constants.EVENT_REFRESH_DATA){ 47 | tuwenView.refreshListData(data); 48 | }else if(event_tag == Constants.EVENT_LOAD_MORE_DATA){ 49 | tuwenView.loadMoreList(data); 50 | } 51 | 52 | 53 | } 54 | 55 | 56 | @Override public void onError(String msg) { 57 | tuwenView.hideLoading(); 58 | } 59 | 60 | 61 | @Override public void onException(String msg) { 62 | tuwenView.hideLoading(); 63 | } 64 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/ImagePresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.presenter; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.common.Constants; 5 | import com.github.hyr0318.materialnews_mvp.contract.ImageContract; 6 | import com.github.hyr0318.materialnews_mvp.entity.ImageResult; 7 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 8 | import com.github.hyr0318.materialnews_mvp.model.ImageModelImpl; 9 | 10 | /** 11 | * Created by MVPHelper on 2016/09/02 12 | */ 13 | 14 | public class ImagePresenterImpl 15 | implements ImageContract.ImagePresenter, BaseMultiLoadedListener { 16 | private Context mContext; 17 | 18 | private ImageContract.ImageContractView imageContractView; 19 | private final ImageModelImpl imageModel; 20 | 21 | 22 | public ImagePresenterImpl(Context mContext, ImageContract.ImageContractView imageContractView) { 23 | this.mContext = mContext; 24 | 25 | this.imageContractView = imageContractView; 26 | 27 | imageModel = new ImageModelImpl(this); 28 | 29 | } 30 | 31 | 32 | @Override 33 | public void loadListData(String requestTag, int event_tag, String word, int cl, boolean isSwipeRefresh) { 34 | 35 | if (!isSwipeRefresh) { 36 | imageContractView.showLoading(""); 37 | } 38 | 39 | imageModel.getImageList(requestTag, event_tag, word, cl); 40 | 41 | } 42 | 43 | 44 | @Override public void onSuccess(int event_tag, ImageResult data) { 45 | imageContractView.hideLoading(); 46 | if(event_tag == Constants.EVENT_REFRESH_DATA){ 47 | imageContractView.refreshListData(data); 48 | }else if(event_tag == Constants.EVENT_LOAD_MORE_DATA){ 49 | imageContractView.addMoreListData(data); 50 | } 51 | } 52 | 53 | 54 | @Override public void onError(String msg) { 55 | imageContractView.hideLoading(); 56 | } 57 | 58 | 59 | @Override public void onException(String msg) { 60 | imageContractView.hideLoading(); 61 | } 62 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/JokePresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.presenter; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.common.Constants; 5 | import com.github.hyr0318.materialnews_mvp.contract.JokeContract; 6 | import com.github.hyr0318.materialnews_mvp.entity.JokeResult; 7 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 8 | import com.github.hyr0318.materialnews_mvp.model.JokeModelImpl; 9 | 10 | /** 11 | * Created by MVPHelper on 2016/09/01 12 | */ 13 | 14 | public class JokePresenterImpl 15 | implements JokeContract.JokePresenter, BaseMultiLoadedListener { 16 | private Context mContext; 17 | 18 | private JokeContract.JokeView jokeView; 19 | private final JokeModelImpl jokeModel; 20 | 21 | 22 | public JokePresenterImpl(Context mContext, JokeContract.JokeView jokeView) { 23 | this.mContext = mContext; 24 | 25 | this.jokeView = jokeView; 26 | 27 | jokeModel = new JokeModelImpl(this); 28 | 29 | } 30 | 31 | 32 | @Override 33 | public void loadListData(String requestTag, int event_tag, int page, String showapi_appid, String showapi_timestamp, String showapi_sign, boolean isSwipeRefresh) { 34 | 35 | if (!isSwipeRefresh) { 36 | jokeView.showLoading(""); 37 | } 38 | jokeModel.getCommonListData(requestTag, event_tag, page, showapi_appid, showapi_timestamp, 39 | showapi_sign); 40 | 41 | } 42 | 43 | 44 | @Override public void onSuccess(int event_tag, JokeResult data) { 45 | jokeView.hideLoading(); 46 | if (event_tag == Constants.EVENT_REFRESH_DATA) { 47 | jokeView.refreshListData(data); 48 | } else if (event_tag == Constants.EVENT_LOAD_MORE_DATA) { 49 | jokeView.addMoreListData(data); 50 | } 51 | 52 | } 53 | 54 | 55 | @Override public void onError(String msg) { 56 | jokeView.hideLoading(); 57 | } 58 | 59 | 60 | @Override public void onException(String msg) { 61 | jokeView.hideLoading(); 62 | } 63 | } -------------------------------------------------------------------------------- /base_library/src/main/java/com/github/hyr0318/baselibrary/adapter/ListViewDataAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com] 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.github.hyr0318.baselibrary.adapter; 18 | 19 | import java.util.ArrayList; 20 | 21 | /** 22 | * A adapter using View Holder to display the item of a list view; 23 | * 24 | * @param 25 | * @author http://www.liaohuqiu.net 26 | */ 27 | public class ListViewDataAdapter extends ListViewDataAdapterBase { 28 | 29 | protected ArrayList mItemDataList = new ArrayList(); 30 | 31 | public ListViewDataAdapter() { 32 | 33 | } 34 | 35 | /** 36 | * @param viewHolderCreator The view holder creator will create a View Holder that extends {@link ViewHolderBase} 37 | */ 38 | public ListViewDataAdapter(ViewHolderCreator viewHolderCreator) { 39 | super(viewHolderCreator); 40 | } 41 | 42 | public ArrayList getDataList() { 43 | return mItemDataList; 44 | } 45 | 46 | @Override 47 | public int getCount() { 48 | return mItemDataList.size(); 49 | } 50 | 51 | @Override 52 | public ItemDataType getItem(int position) { 53 | if (mItemDataList.size() <= position || position < 0) { 54 | return null; 55 | } 56 | return mItemDataList.get(position); 57 | } 58 | 59 | @Override 60 | public long getItemId(int position) { 61 | return position; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 27 | 31 | 32 | 36 | 40 | 41 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/model/HomeModelImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.model; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.baselibrary.base.fragment.BaseLazyFragment; 5 | import com.github.hyr0318.materialnews_mvp.R; 6 | import com.github.hyr0318.materialnews_mvp.contract.HomeContract; 7 | import com.github.hyr0318.materialnews_mvp.entity.HomeNavigationEntity; 8 | import com.github.hyr0318.materialnews_mvp.ui.fragment.ImageMainFragment; 9 | import com.github.hyr0318.materialnews_mvp.ui.fragment.JokeMainFragment; 10 | import com.github.hyr0318.materialnews_mvp.ui.fragment.TuwenMainFragment; 11 | import com.github.hyr0318.materialnews_mvp.ui.fragment.VideoFragment; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by MVPHelper on 2016/08/28 17 | */ 18 | 19 | public class HomeModelImpl implements HomeContract.Model { 20 | 21 | @Override public List getFragments(Context context) { 22 | List fragments = new ArrayList<>(); 23 | fragments.add(new JokeMainFragment()); 24 | fragments.add(new VideoFragment()); 25 | fragments.add(new TuwenMainFragment()); 26 | fragments.add(new ImageMainFragment()); 27 | 28 | return fragments; 29 | } 30 | 31 | 32 | @Override public List getNavigationList(Context context) { 33 | List homeNavigationEntities = new ArrayList<>(); 34 | 35 | String[] navigationArray = context.getResources() 36 | .getStringArray(R.array.nagivation_list); 37 | homeNavigationEntities.add( 38 | new HomeNavigationEntity(R.mipmap.comedy48, navigationArray[0], "")); 39 | homeNavigationEntities.add( 40 | new HomeNavigationEntity(R.mipmap.film48, navigationArray[1], "")); 41 | homeNavigationEntities.add( 42 | new HomeNavigationEntity(R.mipmap.wink, navigationArray[2], "")); 43 | homeNavigationEntities.add( 44 | new HomeNavigationEntity(R.mipmap.google_news_copyrighted48, navigationArray[3], "")); 45 | 46 | return homeNavigationEntities; 47 | } 48 | } -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/presenter/VideoListPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.presenter; 2 | 3 | import android.content.Context; 4 | import com.github.hyr0318.materialnews_mvp.entity.TouTiaoVideoResult; 5 | import com.github.hyr0318.materialnews_mvp.common.Constants; 6 | import com.github.hyr0318.materialnews_mvp.contract.VideoListContract; 7 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 8 | import com.github.hyr0318.materialnews_mvp.model.VideoListModelImpl; 9 | import com.orhanobut.logger.Logger; 10 | 11 | /** 12 | * Created by MVPHelper on 2016/08/29 13 | */ 14 | 15 | public class VideoListPresenterImpl 16 | implements VideoListContract.VideoListPresenter, BaseMultiLoadedListener { 17 | 18 | private Context mContext; 19 | 20 | private VideoListContract.VideoListView vv; 21 | private final VideoListModelImpl videoListModel; 22 | 23 | 24 | public VideoListPresenterImpl(Context ct, VideoListContract.VideoListView vv) { 25 | this.mContext = ct; 26 | 27 | this.vv = vv; 28 | 29 | videoListModel = new VideoListModelImpl(this); 30 | 31 | } 32 | 33 | 34 | @Override 35 | public void loadListData(String requestTag, int event_tag, String keywords, int page, boolean isSwipeRefresh) { 36 | 37 | if (!isSwipeRefresh) { 38 | vv.showLoading(""); 39 | } 40 | 41 | videoListModel.getCommonListData(requestTag, event_tag, keywords, page); 42 | } 43 | 44 | 45 | @Override public void onSuccess(int event_tag, TouTiaoVideoResult data) { 46 | vv.hideLoading(); 47 | if (event_tag == Constants.EVENT_REFRESH_DATA) { 48 | vv.refreshListData(data); 49 | } else if (event_tag == Constants.EVENT_LOAD_MORE_DATA) { 50 | vv.addMoreListData(data); 51 | } 52 | 53 | } 54 | 55 | 56 | @Override public void onError(String msg) { 57 | 58 | vv.hideLoading(); 59 | 60 | vv.showError(msg); 61 | Logger.e(msg); 62 | } 63 | 64 | 65 | @Override public void onException(String msg) { 66 | 67 | vv.hideLoading(); 68 | 69 | vv.showException(msg); 70 | } 71 | } -------------------------------------------------------------------------------- /base_library/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | dependencies { 3 | classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0' 4 | } 5 | } 6 | apply plugin: 'com.android.library' 7 | apply plugin: 'com.jakewharton.butterknife' 8 | android { 9 | compileSdkVersion 24 10 | buildToolsVersion "24.0.1" 11 | 12 | defaultConfig { 13 | minSdkVersion 15 14 | targetSdkVersion 24 15 | versionCode 1 16 | versionName "1.0" 17 | 18 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 19 | } 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | 27 | //为了解决部分第三方库重复打包了META-INF的问题 28 | packagingOptions { 29 | exclude 'META-INF/LICENSE.txt' 30 | exclude 'META-INF/NOTICE.txt' 31 | } 32 | } 33 | 34 | dependencies { 35 | final SUPPORT_LIBRARY_VERSION = '24.0.0' 36 | final RETROFIT_VERSION = '2.1.0' 37 | final OK_HTTP_VERSION = '3.3.1' 38 | 39 | compile fileTree(dir: 'libs', include: ['*.jar']) 40 | 41 | compile "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION" 42 | compile "com.android.support:design:$SUPPORT_LIBRARY_VERSION" 43 | compile "com.android.support:cardview-v7:$SUPPORT_LIBRARY_VERSION" 44 | 45 | compile 'org.greenrobot:eventbus:3.0.0' 46 | compile 'com.orhanobut:logger:1.14' 47 | compile 'com.wang.avi:library:1.0.5' 48 | compile 'com.jaeger.statusbaruitl:library:1.2.4' 49 | 50 | 51 | compile 'io.reactivex:rxandroid:1.2.0' 52 | compile 'io.reactivex:rxjava:1.1.6' 53 | compile 'com.alibaba:fastjson:1.1.52.android' 54 | compile "com.squareup.okhttp3:okhttp:$OK_HTTP_VERSION" 55 | compile "com.squareup.okhttp3:logging-interceptor:$OK_HTTP_VERSION" 56 | compile "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION" 57 | compile "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION" 58 | compile "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION" 59 | 60 | compile 'com.github.chrisbanes.photoview:library:1.2.2' 61 | 62 | compile 'com.nineoldandroids:library:2.4.0' 63 | compile 'cn.bingoogolapple:bga-refreshlayout:1.1.6@aar' 64 | 65 | 66 | //view注释 67 | compile deps.butterknife 68 | annotationProcessor deps.butterknifeCompiler 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/entity/TuwenDetailEntity.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.entity; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Description: 7 | * 作者:hyr on 2016/8/31 12:11 8 | * 邮箱:2045446584@qq.com 9 | */ 10 | public class TuwenDetailEntity { 11 | 12 | String title ; 13 | 14 | String type ; 15 | 16 | 17 | String date; 18 | 19 | String des ; 20 | 21 | 22 | List imgList ; 23 | 24 | 25 | List detailDes; 26 | 27 | 28 | public class DetailImg { 29 | String img ; 30 | 31 | 32 | public DetailImg(String img) { 33 | this.img = img; 34 | } 35 | 36 | 37 | public String getImg() { 38 | return img; 39 | } 40 | 41 | 42 | public void setImg(String img) { 43 | this.img = img; 44 | } 45 | } 46 | 47 | 48 | public String getTitle() { 49 | return title; 50 | } 51 | 52 | 53 | public void setTitle(String title) { 54 | this.title = title; 55 | } 56 | 57 | 58 | public String getType() { 59 | return type; 60 | } 61 | 62 | 63 | public void setType(String type) { 64 | this.type = type; 65 | } 66 | 67 | 68 | public String getDate() { 69 | return date; 70 | } 71 | 72 | 73 | public void setDate(String date) { 74 | this.date = date; 75 | } 76 | 77 | 78 | public String getDes() { 79 | return des; 80 | } 81 | 82 | 83 | public void setDes(String des) { 84 | this.des = des; 85 | } 86 | 87 | 88 | public List getImgList() { 89 | return imgList; 90 | } 91 | 92 | 93 | public void setImgList(List imgList) { 94 | this.imgList = imgList; 95 | } 96 | 97 | 98 | public class DetailDes { 99 | String des ; 100 | 101 | 102 | public String getDes() { 103 | return des; 104 | } 105 | 106 | 107 | public void setDes(String des) { 108 | this.des = des; 109 | } 110 | } 111 | 112 | 113 | public List getDetailDes() { 114 | return detailDes; 115 | } 116 | 117 | 118 | public void setDetailDes(List detailDes) { 119 | this.detailDes = detailDes; 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_welecome_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 23 | 24 | 34 | 35 | 44 | 45 | 52 | 53 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /base_library/src/main/java/com/github/hyr0318/baselibrary/loading/LoadingViewHelper.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.baselibrary.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 | * Description: 10 | * 作者:hyr on 2016/9/2 15:14 11 | * 邮箱:2045446584@qq.com 12 | */ 13 | public class LoadingViewHelper implements ILoadingViewHelper { 14 | private View view; 15 | 16 | private View currentView; 17 | 18 | private ViewGroup parentView; 19 | 20 | private int viewIndex; 21 | private ViewGroup.LayoutParams params; 22 | 23 | 24 | public LoadingViewHelper(View view) { 25 | this.view = view; 26 | } 27 | 28 | 29 | private void init() { 30 | 31 | params = view.getLayoutParams(); 32 | 33 | if (view.getParent() != null) { 34 | parentView = (ViewGroup) view.getParent(); 35 | } else { 36 | parentView = (ViewGroup) view.getRootView().findViewById(android.R.id.content); 37 | } 38 | int count = parentView.getChildCount(); 39 | for (int index = 0; index < count; index++) { 40 | if (view == parentView.getChildAt(index)) { 41 | viewIndex = index; 42 | break; 43 | } 44 | } 45 | currentView = view; 46 | 47 | 48 | } 49 | 50 | 51 | @Override public View getCurrentLayout() { 52 | return currentView; 53 | } 54 | 55 | 56 | @Override public void restoreView() { 57 | showLayout(view); 58 | } 59 | 60 | 61 | @Override public void showLayout(View view) { 62 | 63 | if (null == parentView) { 64 | init(); 65 | } 66 | 67 | this.currentView = view ; 68 | 69 | // 如果已经是那个view,那就不需要再进行替换操作了 70 | if (parentView.getChildAt(viewIndex) != view) { 71 | ViewGroup parent = (ViewGroup) view.getParent(); 72 | if (parent != null) { 73 | parent.removeView(view); 74 | } 75 | parentView.removeViewAt(viewIndex); 76 | parentView.addView(view, viewIndex, params); 77 | } 78 | 79 | } 80 | 81 | 82 | @Override public View inflate(int layoutId) { 83 | return LayoutInflater.from(view.getContext()).inflate(layoutId, null); 84 | } 85 | 86 | 87 | @Override public Context getContext() { 88 | return view.getContext(); 89 | } 90 | 91 | 92 | @Override public View getView() { 93 | return view; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/model/WelecomeModelImpl.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.model; 2 | 3 | import android.content.Context; 4 | import android.content.pm.PackageManager; 5 | import com.github.hyr0318.materialnews_mvp.R; 6 | import com.github.hyr0318.materialnews_mvp.contract.WelecomeContract; 7 | import com.github.hyr0318.materialnews_mvp.data.MaterialNewsApi; 8 | import com.github.hyr0318.materialnews_mvp.data.http.BaseObserver; 9 | import com.github.hyr0318.materialnews_mvp.entity.HomeOneIdResult; 10 | import com.github.hyr0318.materialnews_mvp.entity.HomeOneResult; 11 | import com.github.hyr0318.materialnews_mvp.listener.BaseMultiLoadedListener; 12 | import rx.Observable; 13 | import rx.functions.Func1; 14 | import rx.schedulers.Schedulers; 15 | 16 | /** 17 | * Created by hyr on 2016/08/27 18 | */ 19 | 20 | public class WelecomeModelImpl implements WelecomeContract.Model { 21 | private BaseMultiLoadedListener multiLoadedListener; 22 | 23 | 24 | public WelecomeModelImpl(BaseMultiLoadedListener multiLoadedListener) { 25 | this.multiLoadedListener = multiLoadedListener; 26 | } 27 | 28 | 29 | //获取版本号 30 | @Override public String getVsersionName(Context context) { 31 | 32 | String versionName = null; 33 | try { 34 | versionName = context.getPackageManager() 35 | .getPackageInfo(context.getPackageName(), 0).versionName; 36 | } catch (PackageManager.NameNotFoundException e) { 37 | e.printStackTrace(); 38 | } 39 | 40 | return versionName; 41 | } 42 | 43 | 44 | @Override public String getCopyright(Context context) { 45 | return context.getResources().getString(R.string.wele_copyright); 46 | } 47 | 48 | 49 | @Override public void getHomeOne() { 50 | 51 | MaterialNewsApi materialNewsApi = new MaterialNewsApi(); 52 | 53 | materialNewsApi.getHomeOneId() 54 | .flatMap(new Func1>() { 55 | @Override public Observable call(HomeOneIdResult homeOneIdResult) { 56 | return materialNewsApi.getHomeOneData(homeOneIdResult.getData().get(0)); 57 | } 58 | }) 59 | .subscribeOn(Schedulers.immediate()) 60 | .subscribe(new BaseObserver() { 61 | @Override protected void onSucceed(HomeOneResult result) { 62 | 63 | multiLoadedListener.onSuccess(0 ,result); 64 | 65 | } 66 | }); 67 | 68 | } 69 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 23 | 24 | 25 | 30 | 31 | 35 | 36 | 40 | 41 | 42 | 43 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /base_library/src/main/java/com/github/hyr0318/baselibrary/adapter/ViewHolderBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 [1076559197@qq.com | tchen0707@gmail.com] 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.github.hyr0318.baselibrary.adapter; 18 | 19 | import android.view.LayoutInflater; 20 | import android.view.View; 21 | 22 | /** 23 | * As described in 24 | *

25 | * http://developer.android.com/training/improving-layouts/smooth-scrolling.html 26 | *

27 | * Using A View Holder in ListView getView() method is a good practice in using ListView; 28 | *

29 | * This class encapsulate the base operate of a View Holder: createView / showData 30 | * 31 | * @param the generic type of the data in each item 32 | * @author http://www.liaohuqiu.net 33 | */ 34 | public abstract class ViewHolderBase { 35 | 36 | protected int mLastPosition; 37 | protected int mPosition = -1; 38 | protected View mCurrentView; 39 | 40 | /** 41 | * create a view from resource Xml file, and hold the view that may be used in displaying data. 42 | */ 43 | public abstract View createView(LayoutInflater layoutInflater); 44 | 45 | /** 46 | * using the held views to display data 47 | */ 48 | public abstract void showData(int position, ItemDataType itemData); 49 | 50 | public void setItemData(int position, View view) { 51 | mLastPosition = mPosition; 52 | mPosition = position; 53 | mCurrentView = view; 54 | } 55 | 56 | /** 57 | * Check if the View Holder is still display the same data after back to screen. 58 | *

59 | * A view in a ListView or GridView may go down the screen and then back, 60 | *

61 | * for efficiency, in getView() method, a convertView will be reused. 62 | *

63 | * If the convertView is reused, View Holder will hold new data. 64 | */ 65 | public boolean stillHoldLastItemData() { 66 | return mLastPosition == mPosition; 67 | } 68 | } -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/github/hyr0318/materialnews_mvp/widget/BaseRecyclerViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.github.hyr0318.materialnews_mvp.widget; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.util.SparseArray; 6 | import android.view.View; 7 | import android.widget.Button; 8 | import android.widget.EditText; 9 | import android.widget.ImageButton; 10 | import android.widget.ImageView; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * ClassName: BaseRecyclerViewHolder

15 | * Author:oubowu

16 | * Fuction: RecyclerView通用适配器Holder

17 | * CreateDate:2016/2/16 23:00

18 | * UpdateUser:

19 | * UpdateDate:

20 | */ 21 | public class BaseRecyclerViewHolder extends RecyclerView.ViewHolder { 22 | 23 | //集合类,layout里包含的View,以view的id作为key,value是view对象 24 | protected SparseArray mViews; 25 | protected Context mContext;//上下文对象 26 | 27 | public BaseRecyclerViewHolder(Context context, View itemView) { 28 | super(itemView); 29 | mContext = context; 30 | mViews = new SparseArray(); 31 | } 32 | 33 | @SuppressWarnings("unchecked") 34 | private T findViewById(int viewId) { 35 | View view = mViews.get(viewId); 36 | if (view == null) { 37 | view = itemView.findViewById(viewId); 38 | mViews.put(viewId, view); 39 | } 40 | return (T) view; 41 | } 42 | 43 | public View getView(int viewId) { 44 | return findViewById(viewId); 45 | } 46 | 47 | public TextView getTextView(int viewId) { 48 | return (TextView) getView(viewId); 49 | } 50 | 51 | public Button getButton(int viewId) { 52 | return (Button) getView(viewId); 53 | } 54 | 55 | public ImageView getImageView(int viewId) { 56 | return (ImageView) getView(viewId); 57 | } 58 | 59 | public ImageButton getImageButton(int viewId) { 60 | return (ImageButton) getView(viewId); 61 | } 62 | 63 | public EditText getEditText(int viewId) { 64 | return (EditText) getView(viewId); 65 | } 66 | 67 | 68 | public BaseRecyclerViewHolder setText(int viewId, String value) { 69 | TextView view = findViewById(viewId); 70 | view.setText(value); 71 | return this; 72 | } 73 | 74 | public BaseRecyclerViewHolder setBackground(int viewId, int resId) { 75 | View view = findViewById(viewId); 76 | view.setBackgroundResource(resId); 77 | return this; 78 | } 79 | 80 | public BaseRecyclerViewHolder setClickListener(int viewId, View.OnClickListener listener) { 81 | View view = findViewById(viewId); 82 | view.setOnClickListener(listener); 83 | return this; 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 24 5 | buildToolsVersion "24.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.github.hyr0318.materialnews_mvp" 9 | minSdkVersion 15 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | jackOptions { 14 | enabled true 15 | } 16 | 17 | } 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | 25 | 26 | //为了解决部分第三方库重复打包了META-INF的问题 27 | packagingOptions { 28 | exclude 'META-INF/LICENSE.txt' 29 | exclude 'META-INF/NOTICE.txt' 30 | } 31 | lintOptions { 32 | checkReleaseBuilds false 33 | abortOnError false 34 | } 35 | 36 | 37 | compileOptions { 38 | sourceCompatibility JavaVersion.VERSION_1_8 39 | targetCompatibility JavaVersion.VERSION_1_8 40 | } 41 | } 42 | 43 | 44 | gradle.ext.supportLibraryVersion = '24.0.0' 45 | dependencies { 46 | final SUPPORT_LIBRARY_VERSION = '24.0.0' 47 | final RETROFIT_VERSION = '2.1.0' 48 | final OK_HTTP_VERSION = '3.3.1' 49 | compile fileTree(dir: 'libs', include: ['*.jar']) 50 | testCompile 'junit:junit:4.12' 51 | 52 | compile "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION" 53 | compile "com.android.support:design:$SUPPORT_LIBRARY_VERSION" 54 | compile "com.android.support:cardview-v7:$SUPPORT_LIBRARY_VERSION" 55 | 56 | compile 'org.jsoup:jsoup:1.9.2' 57 | 58 | compile 'io.reactivex:rxandroid:1.2.0' 59 | compile 'io.reactivex:rxjava:1.1.6' 60 | compile 'com.alibaba:fastjson:1.1.52.android' 61 | compile "com.squareup.okhttp3:okhttp:$OK_HTTP_VERSION" 62 | compile "com.squareup.okhttp3:logging-interceptor:$OK_HTTP_VERSION" 63 | compile "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION" 64 | compile "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION" 65 | compile "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION" 66 | 67 | compile 'com.jaeger.statusbaruitl:library:1.2.4' 68 | 69 | compile project(':base_library') 70 | 71 | compile 'com.orhanobut:logger:1.14' 72 | 73 | 74 | compile 'com.liaoinstan.springview:library:1.2.6' 75 | 76 | compile 'fm.jiecao:jiecaovideoplayer:4.6.3' 77 | 78 | compile 'com.github.bumptech.glide:glide:3.7.0' 79 | 80 | compile 'com.squareup.picasso:picasso:2.5.2' 81 | 82 | 83 | compile 'com.nineoldandroids:library:2.4.0' 84 | compile 'cn.bingoogolapple:bga-refreshlayout:1.1.6@aar' 85 | 86 | compile deps.butterknife 87 | annotationProcessor deps.butterknifeCompiler 88 | } 89 | --------------------------------------------------------------------------------