├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── assets
│ │ │ ├── font
│ │ │ │ ├── consola.ttf
│ │ │ │ └── consolab.ttf
│ │ │ ├── ifeng
│ │ │ │ └── read.js
│ │ │ ├── litepal.xml
│ │ │ ├── jd
│ │ │ │ ├── post_detail.html
│ │ │ │ ├── read.js
│ │ │ │ └── post_detail_style.css
│ │ │ └── anim
│ │ │ │ └── loading_.json
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── logo.gif
│ │ │ │ ├── newlogo.gif
│ │ │ │ ├── shape_bg_dialog.xml
│ │ │ │ ├── read_bt_bg.xml
│ │ │ │ ├── indicator_selected.xml
│ │ │ │ ├── ic_tab_my.xml
│ │ │ │ ├── ic_tab_news.xml
│ │ │ │ ├── ic_tab_video.xml
│ │ │ │ ├── ic_tab_jiandan.xml
│ │ │ │ ├── popup_tv_selector.xml
│ │ │ │ ├── side_nav_bar.xml
│ │ │ │ ├── delpop_tv_bg.xml
│ │ │ │ ├── news_ad_bg.xml
│ │ │ │ ├── popup_news_del_bg.xml
│ │ │ │ ├── delpop_tv_selected_bg.xml
│ │ │ │ ├── loading_xz.xml
│ │ │ │ ├── splash_ad_ignore_bg.xml
│ │ │ │ └── progress_bar_states.xml
│ │ │ ├── drawable-hdpi
│ │ │ │ ├── ic_my.png
│ │ │ │ ├── ic_news.png
│ │ │ │ ├── ic_play.png
│ │ │ │ ├── ic_video.png
│ │ │ │ ├── ic_jiandan.png
│ │ │ │ ├── ic_news_close.png
│ │ │ │ ├── ic_my_selected.png
│ │ │ │ ├── ic_news_selected.png
│ │ │ │ ├── ic_video_selected.png
│ │ │ │ └── ic_jiandan_selected.png
│ │ │ ├── drawable-mdpi
│ │ │ │ ├── ic_my.png
│ │ │ │ ├── ic_news.png
│ │ │ │ ├── ic_play.png
│ │ │ │ ├── ic_video.png
│ │ │ │ ├── ic_jiandan.png
│ │ │ │ ├── ic_news_close.png
│ │ │ │ ├── ic_my_selected.png
│ │ │ │ ├── ic_news_selected.png
│ │ │ │ ├── ic_video_selected.png
│ │ │ │ └── ic_jiandan_selected.png
│ │ │ ├── drawable-xhdpi
│ │ │ │ ├── ic_my.png
│ │ │ │ ├── ic_news.png
│ │ │ │ ├── ic_play.png
│ │ │ │ ├── background.jpg
│ │ │ │ ├── ic_close.png
│ │ │ │ ├── ic_jiandan.png
│ │ │ │ ├── ic_loading.png
│ │ │ │ ├── ic_video.png
│ │ │ │ ├── hughjackman.jpg
│ │ │ │ ├── ic_my_selected.png
│ │ │ │ ├── ic_news_close.png
│ │ │ │ ├── ic_news_selected.png
│ │ │ │ ├── ic_video_selected.png
│ │ │ │ ├── ic_jiandan_selected.png
│ │ │ │ ├── ifeng_hot_del_popup_up.png
│ │ │ │ └── ifeng_hot_del_popup_down.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── logo.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── drawable-xxhdpi
│ │ │ │ ├── ic_eye.png
│ │ │ │ ├── ic_my.png
│ │ │ │ ├── ic_logo.png
│ │ │ │ ├── ic_news.png
│ │ │ │ ├── ic_play.png
│ │ │ │ ├── ic_search.png
│ │ │ │ ├── ic_video.png
│ │ │ │ ├── ic_jiandan.png
│ │ │ │ ├── ic_news_add.png
│ │ │ │ ├── ic_play_gif.png
│ │ │ │ ├── ic_my_selected.png
│ │ │ │ ├── ic_news_close.png
│ │ │ │ ├── ic_news_delete.png
│ │ │ │ ├── ic_read_back.png
│ │ │ │ ├── ic_channel_close.png
│ │ │ │ ├── ic_news_selected.png
│ │ │ │ ├── ic_retry_button.png
│ │ │ │ ├── ic_dots_horizontal.png
│ │ │ │ ├── ic_jiandan_selected.png
│ │ │ │ ├── ic_video_selected.png
│ │ │ │ ├── ic_comment_grey600_24dp.png
│ │ │ │ ├── ic_arrow_left_grey600_24dp.png
│ │ │ │ └── ic_share_variant_grey600_24dp.png
│ │ │ ├── drawable-xxxhdpi
│ │ │ │ ├── error.png
│ │ │ │ ├── ic_my.png
│ │ │ │ ├── ic_news.png
│ │ │ │ ├── ic_play.png
│ │ │ │ ├── ic_video.png
│ │ │ │ ├── ic_jiandan.png
│ │ │ │ ├── ic_news_close.png
│ │ │ │ ├── ic_kenburnsview.jpg
│ │ │ │ ├── ic_my_selected.png
│ │ │ │ ├── ic_personal_bg.jpg
│ │ │ │ ├── ic_personal_bg2.jpg
│ │ │ │ ├── ic_personal_bg5.jpg
│ │ │ │ ├── ic_personal_bg6.jpg
│ │ │ │ ├── ic_news_selected.png
│ │ │ │ ├── ic_personal_bg3.jpeg
│ │ │ │ ├── ic_personal_bg4.jpeg
│ │ │ │ ├── ic_video_selected.png
│ │ │ │ ├── ic_jiandan_selected.png
│ │ │ │ └── ic_personal_background.jpg
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── res
│ │ │ │ ├── drawable-hdpi
│ │ │ │ │ └── ic_close.png
│ │ │ │ ├── drawable-mdpi
│ │ │ │ │ └── ic_close.png
│ │ │ │ ├── drawable-xhdpi
│ │ │ │ │ └── ic_close.png
│ │ │ │ ├── drawable-xxhdpi
│ │ │ │ │ └── ic_close.png
│ │ │ │ └── drawable-xxxhdpi
│ │ │ │ │ └── ic_close.png
│ │ │ ├── values-v19
│ │ │ │ └── dimens.xml
│ │ │ ├── values
│ │ │ │ ├── ids.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── drawables.xml
│ │ │ │ ├── attrs.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── strings.xml
│ │ │ ├── anim
│ │ │ │ ├── anim_no.xml
│ │ │ │ ├── fade_in.xml
│ │ │ │ ├── fade_out.xml
│ │ │ │ ├── slide_in_left.xml
│ │ │ │ ├── slide_out_right.xml
│ │ │ │ ├── slide_in_right.xml
│ │ │ │ ├── slide_out_left.xml
│ │ │ │ ├── dialog_bottom_slide_in.xml
│ │ │ │ └── dialog_bottom_slide_out.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── drawable-v21
│ │ │ │ ├── ic_menu_send.xml
│ │ │ │ ├── ic_menu_slideshow.xml
│ │ │ │ ├── ic_menu_gallery.xml
│ │ │ │ ├── ic_menu_manage.xml
│ │ │ │ ├── ic_menu_camera.xml
│ │ │ │ └── ic_menu_share.xml
│ │ │ ├── menu
│ │ │ │ ├── main2.xml
│ │ │ │ └── activity_main2_drawer.xml
│ │ │ ├── layout
│ │ │ │ ├── layout_tab_top.xml
│ │ │ │ ├── item_newsdelpop_del.xml
│ │ │ │ ├── view_empty.xml
│ │ │ │ ├── view_nonet.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── loadimage.xml
│ │ │ │ ├── channel_rv_item.xml
│ │ │ │ ├── view_loading.xml
│ │ │ │ ├── activity_image_browse.xml
│ │ │ │ ├── layout_dialog.xml
│ │ │ │ ├── fragment_jd_detail.xml
│ │ │ │ ├── dialog_channel.xml
│ │ │ │ ├── fragment_video.xml
│ │ │ │ ├── fragment_jiandan.xml
│ │ │ │ ├── news_detail_headerview.xml
│ │ │ │ ├── item_channel_title.xml
│ │ │ │ ├── activity_advert.xml
│ │ │ │ ├── view_load_more.xml
│ │ │ │ ├── view_retry.xml
│ │ │ │ ├── fragment_news.xml
│ │ │ │ ├── fragment_news_new.xml
│ │ │ │ ├── fragment_detail.xml
│ │ │ │ ├── activity_welcome.xml
│ │ │ │ ├── item_freshnews.xml
│ │ │ │ ├── popup_newsdel.xml
│ │ │ │ ├── activity_imagebrowse.xml
│ │ │ │ └── item_detail_video.xml
│ │ │ └── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── will
│ │ │ └── weiyuekotlin
│ │ │ ├── bean
│ │ │ ├── JdBaseBean.kt
│ │ │ ├── Channel.kt
│ │ │ ├── Constants.kt
│ │ │ ├── VideoDetailBean.kt
│ │ │ └── FreshNewsBean.kt
│ │ │ ├── event
│ │ │ ├── SelectChannelEvent.kt
│ │ │ └── NewChannelEvent.kt
│ │ │ ├── widget
│ │ │ ├── channelDialog
│ │ │ │ ├── OnChannelListener.kt
│ │ │ │ ├── OnDragVHListener.kt
│ │ │ │ └── ItemDragHelperCallBack.kt
│ │ │ ├── CustomViewPager.java
│ │ │ ├── CustomLoadMoreView.kt
│ │ │ ├── ObservableScrollView.java
│ │ │ ├── HackyViewPager.java
│ │ │ ├── ShowMaxImageView.java
│ │ │ ├── ColorFilterImageView.java
│ │ │ ├── MyScrollView.java
│ │ │ └── ContextUtils.java
│ │ │ ├── net
│ │ │ ├── ApiConstants.kt
│ │ │ ├── BaseObserver.kt
│ │ │ ├── NewsUtils.kt
│ │ │ ├── JanDanApiService.kt
│ │ │ ├── JanDanApi.kt
│ │ │ ├── NewsApi.kt
│ │ │ └── NewsApiService.kt
│ │ │ ├── ui
│ │ │ ├── base
│ │ │ │ ├── BasePresenter.kt
│ │ │ │ ├── BaseContract.kt
│ │ │ │ ├── SupportActivity.kt
│ │ │ │ └── BaseFragment.kt
│ │ │ ├── news
│ │ │ │ ├── contract
│ │ │ │ │ ├── NewsContract.kt
│ │ │ │ │ ├── ArticleReadContract.kt
│ │ │ │ │ └── DetailContract.kt
│ │ │ │ └── presenter
│ │ │ │ │ ├── ArticleReadPresenter.kt
│ │ │ │ │ └── NewsPresenter.kt
│ │ │ ├── listener
│ │ │ │ └── IBase.kt
│ │ │ ├── adapter
│ │ │ │ ├── VideoPagerAdapter.kt
│ │ │ │ ├── ChannelPagerAdapter.kt
│ │ │ │ ├── JokesAdapter.kt
│ │ │ │ ├── FreshNewsAdapter.kt
│ │ │ │ └── VideoDetailAdapter.kt
│ │ │ ├── video
│ │ │ │ ├── contract
│ │ │ │ │ └── VideoContract.kt
│ │ │ │ ├── presenter
│ │ │ │ │ └── VideoPresenter.kt
│ │ │ │ └── VideoFragment.kt
│ │ │ ├── jandan
│ │ │ │ ├── contract
│ │ │ │ │ └── JanDanContract.kt
│ │ │ │ └── ImageBrowseActivity.kt
│ │ │ └── personal
│ │ │ │ └── PersonalFragment.kt
│ │ │ ├── module
│ │ │ ├── ApplicationModule.kt
│ │ │ └── HttpModule.kt
│ │ │ ├── component
│ │ │ ├── ApplicationComponent.kt
│ │ │ └── HttpComponent.kt
│ │ │ ├── MyApp.kt
│ │ │ ├── database
│ │ │ └── ChannelDao.kt
│ │ │ ├── utils
│ │ │ └── ImageLoaderUtil.java
│ │ │ ├── WelcomeActivity.kt
│ │ │ └── MainActivity.kt
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── will
│ │ │ └── weiyuekotlin
│ │ │ └── ExampleUnitTest.kt
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── will
│ │ └── weiyuekotlin
│ │ └── ExampleInstrumentedTest.kt
└── proguard-rules.pro
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── .idea
├── vcs.xml
├── modules.xml
├── runConfigurations.xml
├── gradle.xml
└── misc.xml
├── gradle.properties
├── README.md
└── gradlew.bat
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/assets/font/consola.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/assets/font/consola.ttf
--------------------------------------------------------------------------------
/app/src/main/res/drawable/logo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable/logo.gif
--------------------------------------------------------------------------------
/app/src/main/assets/font/consolab.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/assets/font/consolab.ttf
--------------------------------------------------------------------------------
/app/src/main/res/drawable/newlogo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable/newlogo.gif
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_my.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-hdpi/ic_my.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_my.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-mdpi/ic_my.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_my.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ic_my.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/mipmap-xxxhdpi/logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_news.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-hdpi/ic_news.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-hdpi/ic_play.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-hdpi/ic_video.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_news.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-mdpi/ic_news.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-mdpi/ic_play.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-mdpi/ic_video.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_news.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ic_news.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ic_play.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_eye.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_eye.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_my.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_my.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/error.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_my.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_my.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_jiandan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-hdpi/ic_jiandan.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_jiandan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-mdpi/ic_jiandan.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/background.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ic_close.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_jiandan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ic_jiandan.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ic_loading.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ic_video.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_news.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_news.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_play.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_search.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_video.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_news.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_news.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_play.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_video.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_news_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-hdpi/ic_news_close.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_news_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-mdpi/ic_news_close.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/hughjackman.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/hughjackman.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_jiandan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_jiandan.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_news_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_news_add.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_play_gif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_play_gif.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_jiandan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_jiandan.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/res/drawable-hdpi/ic_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/res/drawable-hdpi/ic_close.png
--------------------------------------------------------------------------------
/app/src/main/res/res/drawable-mdpi/ic_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/res/drawable-mdpi/ic_close.png
--------------------------------------------------------------------------------
/app/src/main/res/res/drawable-xhdpi/ic_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/res/drawable-xhdpi/ic_close.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_my_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-hdpi/ic_my_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_news_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-hdpi/ic_news_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_my_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-mdpi/ic_my_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_news_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-mdpi/ic_news_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_my_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ic_my_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_news_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ic_news_close.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_my_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_my_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_news_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_news_close.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_news_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_news_delete.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_read_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_read_back.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_news_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_news_close.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/res/drawable-xxhdpi/ic_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/res/drawable-xxhdpi/ic_close.png
--------------------------------------------------------------------------------
/app/src/main/res/res/drawable-xxxhdpi/ic_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/res/drawable-xxxhdpi/ic_close.png
--------------------------------------------------------------------------------
/app/src/main/assets/ifeng/read.js:
--------------------------------------------------------------------------------
1 |
2 | function show_content(content) {
3 | document.getElementById("main_content").innerHTML = content;
4 | }
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_video_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-hdpi/ic_video_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_video_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-mdpi/ic_video_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_news_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ic_news_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_video_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ic_video_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_channel_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_channel_close.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_news_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_news_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_retry_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_retry_button.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_kenburnsview.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_kenburnsview.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_my_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_my_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_personal_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_personal_bg.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_personal_bg2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_personal_bg2.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_personal_bg5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_personal_bg5.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_personal_bg6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_personal_bg6.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_jiandan_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-hdpi/ic_jiandan_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_jiandan_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-mdpi/ic_jiandan_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_jiandan_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ic_jiandan_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_dots_horizontal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_dots_horizontal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_jiandan_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_jiandan_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_video_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_video_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_news_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_news_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_personal_bg3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_personal_bg3.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_personal_bg4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_personal_bg4.jpeg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_video_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_video_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ifeng_hot_del_popup_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ifeng_hot_del_popup_up.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_jiandan_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_jiandan_selected.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ifeng_hot_del_popup_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xhdpi/ifeng_hot_del_popup_down.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_comment_grey600_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_comment_grey600_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_personal_background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxxhdpi/ic_personal_background.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_arrow_left_grey600_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_arrow_left_grey600_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_share_variant_grey600_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Will-Ls/WeiYueKotlin/HEAD/app/src/main/res/drawable-xxhdpi/ic_share_variant_grey600_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v19/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 25dp
4 |
5 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/bean/JdBaseBean.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.bean
2 |
3 |
4 | /**
5 | * desc: .
6 | * author: Will .
7 | * date: 2017/12/9 .
8 | */
9 |
10 | abstract class JdBaseBean() {
11 |
12 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/event/SelectChannelEvent.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.event
2 |
3 |
4 | /**
5 | * desc:
6 | * author: Will .
7 | * date: 2017/9/10 .
8 | */
9 | class SelectChannelEvent(var channelName: String)
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shape_bg_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/anim_no.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/fade_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/fade_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_in_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_out_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_in_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_out_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Nov 21 11:22:49 CST 2017
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-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/read_bt_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/indicator_selected.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/assets/litepal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_tab_my.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_tab_news.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_tab_video.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_tab_jiandan.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/popup_tv_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/dialog_bottom_slide_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
9 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/widget/channelDialog/OnChannelListener.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.widget.channelDialog
2 |
3 |
4 | interface OnChannelListener {
5 | fun onItemMove(starPos: Int, endPos: Int)
6 | fun onMoveToMyChannel(starPos: Int, endPos: Int)
7 | fun onMoveToOtherChannel(starPos: Int, endPos: Int)
8 | fun onFinish(selectedChannelName: String)
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_send.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main2.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/delpop_tv_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/news_ad_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/popup_news_del_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_tab_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/delpop_tv_selected_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/widget/channelDialog/OnDragVHListener.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.widget.channelDialog
2 |
3 | /**
4 | * ViewHolder 被选中 以及 拖拽释放 触发监听器
5 | * Created by YoKeyword on 15/12/29.
6 | */
7 | interface OnDragVHListener {
8 | /**
9 | * Item被选中时触发
10 | */
11 | fun onItemSelected()
12 |
13 |
14 | /**
15 | * Item在拖拽结束/滑动结束后触发
16 | */
17 | fun onItemFinish()
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/assets/jd/post_detail.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/test/java/com/will/weiyuekotlin/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/loading_xz.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 | 160dp
7 | 16dp
8 | 0dp
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/dialog_bottom_slide_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
8 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #64B6D1
4 | #F68E54
5 | #FF4081
6 | @android:color/white
7 |
8 | #a3a3a3
9 | #a3a3a3
10 | #BDBDBD
11 | #3c3c3c
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/splash_ad_ignore_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
5 |
6 |
7 |
8 |
9 |
10 | -
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/net/ApiConstants.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.net
2 |
3 | /**
4 | * desc:
5 | * author: Will .
6 | * date: 2017/9/2 .
7 | */
8 | object ApiConstants{
9 |
10 | val sIFengApi = "http://api.iclient.ifeng.com/"
11 |
12 | val sJanDanApi = "http://i.jandan.net/"
13 |
14 | val sGetNewsImagesApi = "NewRelativeVideoList"
15 |
16 | val sGetNewsArticleCmppApi = "http://api.3g.ifeng.com/"
17 |
18 | val sGetNewsArticleDocCmppApi = "ipadtestdoc"
19 |
20 | //public static final String IFengApi = "http://api.irecommend.ifeng.com/";
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/base/BasePresenter.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.base
2 |
3 |
4 | /**
5 | * desc: .
6 | * author: Will .
7 | * date: 2017/11/27 .
8 | */
9 | abstract class BasePresenter : BaseContract.BasePresenter {
10 |
11 | protected var mView: T? = null
12 |
13 | /**
14 | * 绑定 view
15 | */
16 | override fun attachView(view: BaseContract.BaseView) {
17 | this.mView = view as T
18 | }
19 |
20 | /**
21 | * 解绑 view
22 | */
23 | override fun detachView() {
24 | mView?.let {
25 | mView = null
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/module/ApplicationModule.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.module
2 |
3 | import android.content.Context
4 | import com.will.weiyuekotlin.MyApp
5 |
6 | import dagger.Module
7 | import dagger.Provides
8 |
9 | /**
10 | * desc:
11 | * author: Will .
12 | * date: 2017/9/2 .
13 | */
14 | @Module
15 | class ApplicationModule(private val mContext: Context) {
16 |
17 | @Provides
18 | internal fun provideApplication(): MyApp {
19 | return mContext.applicationContext as MyApp
20 | }
21 |
22 | @Provides
23 | internal fun provideContext(): Context {
24 | return mContext
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 | - @android:drawable/ic_menu_camera
3 | - @android:drawable/ic_menu_gallery
4 | - @android:drawable/ic_menu_slideshow
5 | - @android:drawable/ic_menu_manage
6 | - @android:drawable/ic_menu_share
7 | - @android:drawable/ic_menu_send
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_newsdelpop_del.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_empty.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_nonet.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/news/contract/NewsContract.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.news.contract
2 |
3 |
4 | import com.will.weiyuekotlin.bean.Channel
5 | import com.will.weiyuekotlin.ui.base.BaseContract
6 |
7 | /**
8 | * desc: .
9 | * author: Will .
10 | * date: 2017/9/7 .
11 | */
12 | interface NewsContract {
13 |
14 | interface View : BaseContract.BaseView {
15 |
16 | /**
17 | * 初始化频道
18 | */
19 | fun loadData(channels: List, otherChannels: List)
20 |
21 | }
22 |
23 | interface Presenter : BaseContract.BasePresenter {
24 | /**
25 | * 获取频道列表
26 | */
27 | fun getChannel()
28 |
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/net/BaseObserver.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.net
2 |
3 | import io.reactivex.Observer
4 | import io.reactivex.annotations.NonNull
5 | import io.reactivex.disposables.Disposable
6 |
7 | /**
8 | * desc:
9 | * author: Will .
10 | * date: 2017/9/2 .
11 | */
12 | abstract class BaseObserver : Observer {
13 |
14 | abstract fun onSuccess(t: T?)
15 |
16 | abstract fun onFail(e: Throwable)
17 |
18 | override fun onSubscribe(@NonNull d: Disposable) {}
19 |
20 | override fun onNext(@NonNull t: T) {
21 | onSuccess(t)
22 | }
23 |
24 | override fun onError(@NonNull e: Throwable) {
25 | onFail(e)
26 | }
27 |
28 | override fun onComplete() {}
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/component/ApplicationComponent.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.component
2 |
3 | import android.content.Context
4 | import com.will.weiyuekotlin.MyApp
5 |
6 | import com.will.weiyuekotlin.module.ApplicationModule
7 | import com.will.weiyuekotlin.module.HttpModule
8 | import com.will.weiyuekotlin.net.JanDanApi
9 | import com.will.weiyuekotlin.net.NewsApi
10 |
11 | import dagger.Component
12 |
13 | /**
14 | * desc: .
15 | * author: Will .
16 | * date: 2017/9/2 .
17 | */
18 | @Component(modules = [(ApplicationModule::class), (HttpModule::class)])
19 | interface ApplicationComponent {
20 |
21 | val application: MyApp
22 |
23 | val context: Context
24 |
25 | fun getNetEaseApi(): NewsApi
26 |
27 | fun getJanDanApi(): JanDanApi
28 |
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/loadimage.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
20 |
21 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/will/weiyuekotlin/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin
2 |
3 | import android.support.test.InstrumentationRegistry
4 | import android.support.test.runner.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getTargetContext()
22 | assertEquals("com.will.weiyuekotlin", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/news/contract/ArticleReadContract.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.news.contract
2 |
3 |
4 | import com.will.weiyuekotlin.bean.NewsArticleBean
5 | import com.will.weiyuekotlin.ui.base.BaseContract
6 |
7 | /**
8 | * desc: .
9 | * author: Will .
10 | * date: 2017/12/8 .
11 | */
12 | interface ArticleReadContract {
13 |
14 | interface View : BaseContract.BaseView {
15 |
16 | /**
17 | * 加载新闻内容
18 | *
19 | * @param articleBean 新闻内容
20 | */
21 | fun loadData(articleBean: NewsArticleBean?)
22 | }
23 |
24 | interface Presenter : BaseContract.BasePresenter {
25 |
26 | /**
27 | * 获取新闻内容
28 | *
29 | * @param aid 新闻id
30 | */
31 | fun getData(aid: String)
32 |
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/listener/IBase.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.listener
2 |
3 | import android.os.Bundle
4 | import android.view.View
5 | import com.will.weiyuekotlin.component.ApplicationComponent
6 | import com.will.weiyuekotlin.widget.SimpleMultiStateView
7 |
8 |
9 | /**
10 | * desc: .
11 | * author: Will .
12 | * date: 2017/11/27 .
13 | */
14 | interface IBase {
15 |
16 | /**
17 | * 获取页面布局 id
18 | */
19 | fun getContentLayout(): Int
20 |
21 | /**
22 | * 获取状态布局
23 | */
24 | fun getSimpleMultiStateView(): SimpleMultiStateView?
25 |
26 | /**
27 | * Dagger2 注入
28 | */
29 | fun initInjector(appComponent: ApplicationComponent)
30 |
31 | /**
32 | * 初始化布局
33 | */
34 | fun bindView(view: View, savedInstanceState: Bundle?)
35 |
36 | /**
37 | * 加载数据
38 | */
39 | fun initData()
40 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/widget/CustomViewPager.java:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.widget;
2 |
3 | import android.content.Context;
4 | import android.support.v4.view.ViewPager;
5 | import android.util.AttributeSet;
6 |
7 | /**
8 | * desc: 取消 viewpager 切换动画.
9 | * author: Will .
10 | * date: 2017/10/18 .
11 | */
12 | public class CustomViewPager extends ViewPager {
13 |
14 |
15 | public CustomViewPager(Context context, AttributeSet attrs) {
16 | super(context, attrs);
17 | }
18 |
19 | public CustomViewPager(Context context) {
20 | super(context);
21 | }
22 |
23 | //去除页面切换时的滑动翻页效果
24 | @Override
25 | public void setCurrentItem(int item, boolean smoothScroll) {
26 | super.setCurrentItem(item, smoothScroll);
27 | }
28 |
29 | @Override
30 | public void setCurrentItem(int item) {
31 | super.setCurrentItem(item, false);
32 | }
33 |
34 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/channel_rv_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/progress_bar_states.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | -
6 |
7 |
8 |
9 |
14 |
15 |
16 | -
17 |
18 |
19 |
20 |
21 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/bean/Channel.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.bean
2 |
3 | import com.chad.library.adapter.base.entity.MultiItemEntity
4 |
5 | import org.litepal.annotation.Column
6 | import org.litepal.crud.DataSupport
7 |
8 | import java.io.Serializable
9 |
10 | /**
11 | * desc: .
12 | * author: Will .
13 | * date: 2017/9/3 .
14 | */
15 | class Channel : DataSupport(), Serializable, MultiItemEntity {
16 | companion object {
17 | val TYPE_MY = 1
18 | val TYPE_OTHER = 2
19 | val TYPE_MY_CHANNEL = 3
20 | val TYPE_OTHER_CHANNEL = 4
21 | }
22 |
23 | @Column(ignore = true)
24 | var viewType: Int = 0
25 |
26 | var channelId: String? = null
27 | var channelName: String? = null
28 | /**
29 | * 0 可移除,1不可移除
30 | */
31 | var channelType: Int = 0
32 |
33 | /**
34 | * 0 未选中 1 选中
35 | */
36 | var isChannelSelect: Boolean = false
37 |
38 | override fun getItemType(): Int {
39 | return viewType
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_loading.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/component/HttpComponent.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.component
2 |
3 |
4 | import com.will.weiyuekotlin.ui.jandan.JdDetailFragment
5 | import com.will.weiyuekotlin.ui.news.ArticleReadActivity
6 | import com.will.weiyuekotlin.ui.news.ImageBrowseActivity
7 | import com.will.weiyuekotlin.ui.news.NewsFragment
8 | import com.will.weiyuekotlin.ui.video.DetailFragment
9 | import com.will.weiyuekotlin.ui.video.VideoFragment
10 | import dagger.Component
11 |
12 | /**
13 | * desc: .
14 | * author: Will .
15 | * date: 2017/9/2 .
16 | */
17 | @Component(dependencies = [(ApplicationComponent::class)])
18 | interface HttpComponent {
19 |
20 | fun inject(videoFragment: VideoFragment)
21 |
22 | fun inject(detailFragment: DetailFragment)
23 |
24 | fun inject(imageBrowseActivity: ImageBrowseActivity)
25 |
26 | fun inject(detailFragment: com.will.weiyuekotlin.ui.news.DetailFragment)
27 |
28 | fun inject(articleReadActivity: ArticleReadActivity)
29 |
30 | fun inject(newsFragment: NewsFragment)
31 |
32 | fun inject(jdDetailFragment: JdDetailFragment)
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/adapter/VideoPagerAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.adapter
2 |
3 | import android.support.v4.app.FragmentManager
4 | import android.support.v4.app.FragmentStatePagerAdapter
5 | import android.support.v4.view.PagerAdapter
6 |
7 | import com.will.weiyuekotlin.bean.VideoChannelBean
8 | import com.will.weiyuekotlin.ui.base.BaseFragment
9 | import com.will.weiyuekotlin.ui.video.DetailFragment
10 |
11 | /**
12 | * desc 视频 Adapter :
13 | * author: Will .
14 | * date: 2017/9/10 .
15 | */
16 | class VideoPagerAdapter(fm: FragmentManager, private val videoChannelBean: VideoChannelBean?) : FragmentStatePagerAdapter(fm) {
17 |
18 | override fun getItem(position: Int): BaseFragment<*>
19 | = DetailFragment.newInstance("clientvideo_" + videoChannelBean!!.types!![position].id)
20 |
21 | override fun getPageTitle(position: Int): CharSequence = videoChannelBean!!.types!![position].name!!
22 |
23 | override fun getCount(): Int = videoChannelBean?.types?.size ?: 0
24 |
25 | override fun getItemPosition(`object`: Any?): Int = PagerAdapter.POSITION_NONE
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/net/NewsUtils.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.net
2 |
3 | import com.will.weiyuekotlin.bean.NewsDetail
4 |
5 | /**
6 | * desc:
7 | * author: Will .
8 | * date: 2017/9/20 .
9 | */
10 | object NewsUtils {
11 |
12 | //顶部banner新闻
13 | val TYPE_BANNER = "focus"
14 | //置顶新闻
15 | val TYPE_TOP = "top"
16 | //常规新闻
17 | val TYPE_List = "list"
18 |
19 | //文章类型
20 | val TYPE_DOC = "doc"
21 | //广告类型
22 | val TYPE_ADVERT = "advert"
23 | //图片类型
24 | val TYPE_SLIDE = "slide"
25 | //视频类型
26 | val TYPE_PHVIDEO = "phvideo"
27 |
28 | //显示形式单图
29 | val VIEW_TITLEIMG = "titleimg"
30 | //显示形式多图
31 | val VIEW_SLIDEIMG = "slideimg"
32 | //显示形式多图
33 | val VIEW_LONGIMG = "longimg"
34 |
35 | fun isBannerNews(detail: NewsDetail): Boolean = detail.type == TYPE_BANNER
36 |
37 | fun isTopNews(detail: NewsDetail): Boolean = detail.type == TYPE_TOP
38 |
39 | fun isListNews(detail: NewsDetail): Boolean = detail.type == TYPE_List
40 |
41 | fun isAvertNews(bean: NewsDetail.ItemBean): Boolean = bean.type == TYPE_ADVERT
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/adapter/ChannelPagerAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.adapter
2 |
3 | import android.support.v4.app.FragmentManager
4 | import android.support.v4.app.FragmentStatePagerAdapter
5 | import android.support.v4.view.PagerAdapter
6 |
7 | import com.will.weiyuekotlin.bean.Channel
8 | import com.will.weiyuekotlin.ui.base.BaseFragment
9 | import com.will.weiyuekotlin.ui.news.DetailFragment
10 |
11 | /**
12 | * desc:
13 | * author: Will .
14 | * date: 2017/9/7 .
15 | */
16 | class ChannelPagerAdapter(fm: FragmentManager, private var mChannels: List?) : FragmentStatePagerAdapter(fm) {
17 |
18 | fun updateChannel(channels: List) {
19 | this.mChannels = channels
20 | notifyDataSetChanged()
21 | }
22 |
23 | override fun getItem(position: Int): BaseFragment<*> = DetailFragment.newInstance(mChannels!![position].channelId!!)
24 |
25 | override fun getPageTitle(position: Int): CharSequence? = mChannels!![position].channelName
26 |
27 | override fun getCount(): Int = mChannels?.size ?: 0
28 |
29 | override fun getItemPosition(`object`: Any?): Int = PagerAdapter.POSITION_NONE
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/widget/CustomLoadMoreView.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.widget
2 |
3 | import com.chad.library.adapter.base.loadmore.LoadMoreView
4 | import com.will.weiyuekotlin.R
5 |
6 | /**
7 | * desc: .
8 | * author: Will .
9 | * date: 2017/9/27 .
10 | */
11 | class CustomLoadMoreView : LoadMoreView() {
12 |
13 | override fun getLayoutId(): Int {
14 | return R.layout.view_load_more
15 | }
16 |
17 | /**
18 | * If you return to true, the data will be loaded more after all the data is loaded.
19 | * If you return to false, the data will be displayed after all the getLoadEndViewId () layout
20 | */
21 | override fun isLoadEndGone(): Boolean {
22 | return true
23 | }
24 |
25 | override fun getLoadingViewId(): Int {
26 | return R.id.load_more_loading_view
27 | }
28 |
29 | override fun getLoadFailViewId(): Int {
30 | return R.id.load_more_load_fail_view
31 | }
32 |
33 | /**
34 | * IsLoadEndGone () for true, you can return 0
35 | * IsLoadEndGone () for false, can not return 0
36 | */
37 | override fun getLoadEndViewId(): Int {
38 | return 0
39 | }
40 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/base/BaseContract.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.base
2 |
3 | import com.trello.rxlifecycle2.LifecycleTransformer
4 |
5 |
6 | /**
7 | * desc: .
8 | * author: Will .
9 | * date: 2017/11/27 .
10 | */
11 |
12 | interface BaseContract {
13 | interface BasePresenter {
14 |
15 | /**
16 | * 绑定View
17 | */
18 | fun attachView(view: BaseView)
19 |
20 | /**
21 | * 解除绑定
22 | */
23 | fun detachView()
24 | }
25 |
26 | interface BaseView {
27 | /**
28 | * 显示加载页面
29 | */
30 | fun showLoading()
31 |
32 | /**
33 | * 显示内容页面
34 | */
35 | fun showSuccess()
36 |
37 | /**
38 | * 显示错误页面
39 | */
40 | fun showError()
41 |
42 | /**
43 | * 显示无网络页面
44 | */
45 | fun showNoNet()
46 |
47 | /**
48 | * 加载失败重试
49 | */
50 | fun onRetry()
51 |
52 | /**
53 | * 绑定生命周期
54 | *
55 | * @param
56 | * @return
57 | */
58 | fun bindToLife(): LifecycleTransformer
59 | }
60 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WeiYueKotlin
2 |
3 | 微阅是一款使用 kotlin MVP + Retrofit2 + RxJava + dagger2 等框架开发的阅读软件。包括新闻、视频、煎蛋三个模块,项目的大部分功能已经完成。
4 | 另有 [Java版本](https://github.com/Will-Ls/WeiYue)
5 |
6 | [下载apk](http://fir.im/5jhv)
7 |
8 |
9 | ## 截图
10 |
11 |
12 |
13 |
14 |
15 |
16 | ## 声明
17 | 本项目使用 Api 来自凤凰新闻,煎蛋,此开源项目仅做学习交流使用, 不可用于任何商业用途,如果你觉得不错, 对你有帮助, 欢迎点个 star 谢谢
18 |
19 | License
20 | =======
21 |
22 | Copyright 2017 Will
23 |
24 |
25 | Licensed under the Apache License, Version 2.0 (the "License");
26 | you may not use this file except in compliance with the License.
27 | You may obtain a copy of the License at
28 |
29 | http://www.apache.org/licenses/LICENSE-2.0
30 |
31 | Unless required by applicable law or agreed to in writing, software
32 | distributed under the License is distributed on an "AS IS" BASIS,
33 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34 | See the License for the specific language governing permissions and
35 | limitations under the License.
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_image_browse.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
14 |
15 |
19 |
20 |
21 |
22 |
23 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/MyApp.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin
2 |
3 | import cn.bingoogolapple.swipebacklayout.BGASwipeBackManager
4 | import com.will.weiyuekotlin.component.ApplicationComponent
5 | import com.will.weiyuekotlin.component.DaggerApplicationComponent
6 | import com.will.weiyuekotlin.module.ApplicationModule
7 | import com.will.weiyuekotlin.module.HttpModule
8 | import org.litepal.LitePal
9 | import org.litepal.LitePalApplication
10 | import kotlin.properties.Delegates
11 |
12 |
13 | /**
14 | * desc: .
15 | * author: Will .
16 | * date: 2017/12/5 .
17 | */
18 | class MyApp : LitePalApplication() {
19 |
20 | companion object {
21 | var instance: MyApp by Delegates.notNull()
22 | var mApplicationComponent: ApplicationComponent by Delegates.notNull()
23 | }
24 |
25 | override fun onCreate() {
26 | super.onCreate()
27 | instance = this
28 | mApplicationComponent = DaggerApplicationComponent.builder()
29 | .applicationModule(ApplicationModule(this))
30 | .httpModule(HttpModule())
31 | .build()
32 | //初始化数据库
33 | LitePal.initialize(this)
34 | //初始化侧滑返回组件
35 | BGASwipeBackManager.getInstance().init(this)
36 | }
37 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
19 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_jd_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
14 |
15 |
20 |
21 |
22 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main2_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/database/ChannelDao.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.database
2 |
3 |
4 | import com.will.weiyuekotlin.bean.Channel
5 | import org.litepal.crud.DataSupport
6 | import java.util.*
7 |
8 | /**
9 | * desc: .
10 | * author: Will .
11 | * date: 2017/9/7 .
12 | */
13 | object ChannelDao {
14 |
15 | /**
16 | * 获取所有频道
17 | */
18 | val channels: List
19 | get() = DataSupport.findAll(Channel::class.java)
20 |
21 |
22 | /**
23 | * 保存所有频道
24 | */
25 | fun saveChannels(channels: List?) {
26 | if (channels == null) return
27 | if (channels.size > 0) {
28 | val channelList = ArrayList()
29 | channelList.addAll(channels)
30 | DataSupport.deleteAllAsync(Channel::class.java).listen {
31 | /**
32 | * 因为model之前被存储过了,再次存储就存不进去了。
33 | * 单个model调用一下clearSavedState方法就可以了,
34 | * 集合的话调用markAsDeleted方法。
35 | */
36 | DataSupport.markAsDeleted(channelList)
37 | DataSupport.saveAllAsync(channelList).listen { }
38 | }
39 | }
40 | }
41 |
42 | /**
43 | * 清空所有频道
44 | */
45 | fun cleanChanels() {
46 | DataSupport.deleteAll(Channel::class.java)
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_channel.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
22 |
23 |
27 |
28 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/event/NewChannelEvent.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.event
2 |
3 |
4 | import com.will.weiyuekotlin.bean.Channel
5 | import java.util.*
6 |
7 | /**
8 | * desc:
9 | * author: Will .
10 | * date: 2017/9/10 .
11 | */
12 | class NewChannelEvent(allChannels: MutableList?,
13 | /**
14 | * 添加的第一个频道名称
15 | */
16 | var firstChannelName: String) {
17 | //选中频道
18 | lateinit var selectedData: MutableList
19 |
20 | //未选中频道
21 | lateinit var unSelectedData: MutableList
22 |
23 | //全部频道
24 | lateinit var allChannel: List
25 |
26 | init {
27 | allChannels?.let {
28 | this.allChannel = allChannels
29 | selectedData = ArrayList()
30 | unSelectedData = ArrayList()
31 |
32 | val iterator = it.iterator()
33 | while (iterator.hasNext()) {
34 | val channel = iterator.next()
35 | when {
36 | channel.itemType == Channel.TYPE_MY || channel.itemType == Channel.TYPE_OTHER -> iterator.remove()
37 | channel.itemType == Channel.TYPE_MY_CHANNEL -> selectedData.add(channel)
38 | else -> unSelectedData.add(channel)
39 | }
40 | }
41 | }
42 |
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/adapter/JokesAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.adapter
2 |
3 | import com.chad.library.adapter.base.BaseQuickAdapter
4 | import com.chad.library.adapter.base.BaseViewHolder
5 | import com.will.weiyuekotlin.R
6 | import com.will.weiyuekotlin.bean.JdDetailBean
7 | import com.will.weiyuekotlin.utils.getTimestampString
8 | import com.will.weiyuekotlin.utils.string2Date
9 |
10 | /**
11 | * desc: .
12 | * author: Will .
13 | * date: 2017/9/31 .
14 | */
15 | class JokesAdapter(data: List?) : BaseQuickAdapter(R.layout.item_joke, data) {
16 |
17 | override fun convert(viewHolder: BaseViewHolder, commentsBean: JdDetailBean.CommentsBean) {
18 | viewHolder.setText(R.id.tv_author, commentsBean.comment_author)
19 | .setText(R.id.tv_time, getTimestampString(string2Date(commentsBean.comment_date!!, "yyyy-MM-dd HH:mm:ss")))
20 | .setText(R.id.tv_content, commentsBean.text_content)
21 | .setText(R.id.tv_like, commentsBean.vote_negative)
22 | .setText(R.id.tv_unlike, commentsBean.vote_positive)
23 | .setText(R.id.tv_comment_count, commentsBean.sub_comment_count)
24 |
25 | //viewHolder.getView(R.id.img_share).setOnClickListener { ShareUtils.shareText(mContext, commentsBean.text_content) }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/net/JanDanApiService.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.net
2 |
3 | import com.will.weiyuekotlin.bean.FreshNewsArticleBean
4 | import com.will.weiyuekotlin.bean.FreshNewsBean
5 | import com.will.weiyuekotlin.bean.JdDetailBean
6 |
7 | import io.reactivex.Observable
8 | import retrofit2.http.GET
9 | import retrofit2.http.Query
10 | import retrofit2.http.Url
11 |
12 |
13 | /**
14 | * desc: .
15 | * author: Will .
16 | * date: 2017/9/27 .
17 | */
18 | interface JanDanApiService {
19 |
20 | @GET
21 | fun getFreshNews(@Url url: String, @Query("oxwlxojflwblxbsapi") oxwlxojflwblxbsapi: String,
22 | @Query("include") include: String,
23 | @Query("page") page: Int,
24 | @Query("custom_fields") custom_fields: String,
25 | @Query("dev") dev: String
26 | ): Observable
27 |
28 |
29 | @GET
30 | fun getDetailData(@Url url: String, @Query("oxwlxojflwblxbsapi") oxwlxojflwblxbsapi: String,
31 | @Query("page") page: Int
32 | ): Observable
33 |
34 | @GET
35 | fun getFreshNewsArticle(@Url url: String, @Query("oxwlxojflwblxbsapi") oxwlxojflwblxbsapi: String,
36 | @Query("include") include: String,
37 | @Query("id") id: Int
38 | ): Observable
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/news/presenter/ArticleReadPresenter.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.news.presenter
2 |
3 |
4 | import com.will.weiyuekotlin.bean.NewsArticleBean
5 | import com.will.weiyuekotlin.net.BaseObserver
6 | import com.will.weiyuekotlin.net.NewsApi
7 | import com.will.weiyuekotlin.ui.base.BasePresenter
8 | import com.will.weiyuekotlin.ui.news.contract.ArticleReadContract
9 | import com.will.weiyuekotlin.utils.applySchedulers
10 | import javax.inject.Inject
11 |
12 |
13 | /**
14 | * desc: .
15 | * author: Will .
16 | * date: 2017/12/8 .
17 | */
18 | class ArticleReadPresenter @Inject
19 | constructor(private var mNewsApi: NewsApi) : BasePresenter(), ArticleReadContract.Presenter {
20 |
21 | /**
22 | * 获取新闻内容
23 | *
24 | * @param aid 新闻id
25 | */
26 | override fun getData(aid: String) {
27 | mNewsApi.getNewsArticle(aid)
28 | .applySchedulers()
29 | .compose(mView?.bindToLife())
30 | .subscribe(object : BaseObserver(){
31 | override fun onSuccess(t: NewsArticleBean?) {
32 | mView?.loadData(t)
33 | }
34 |
35 | override fun onFail(e: Throwable) {
36 | mView?.loadData(null)
37 | }
38 | })
39 |
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_video.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
28 |
29 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_jiandan.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
28 |
29 |
30 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/news_detail_headerview.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
18 |
19 |
28 |
29 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_channel_title.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
29 |
30 |
34 |
35 |
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/video/contract/VideoContract.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.video.contract
2 |
3 |
4 | import com.will.weiyuekotlin.bean.VideoChannelBean
5 | import com.will.weiyuekotlin.bean.VideoDetailBean
6 | import com.will.weiyuekotlin.ui.base.BaseContract
7 |
8 | /**
9 | * desc: .
10 | * author: Will .
11 | * date: 2017/9/10 .
12 | */
13 | interface VideoContract {
14 |
15 | interface View : BaseContract.BaseView {
16 |
17 | /**
18 | * 加载视频频道列表
19 | *
20 | * @param channelBean 频道列表
21 | */
22 | fun loadVideoChannel(channelBean: List?)
23 |
24 | /**
25 | * 加载频道视频列表
26 | *
27 | * @param detailBean 视频列表
28 | */
29 | fun loadVideoDetails(detailBean: List?)
30 |
31 | /**
32 | * 加载更多频道视频列表
33 | *
34 | * @param detailBean 视频列表
35 | */
36 | fun loadMoreVideoDetails(detailBean: List?)
37 |
38 | }
39 |
40 | interface Presenter : BaseContract.BasePresenter {
41 |
42 | /**
43 | * 获取视频频道列表
44 | */
45 | fun getVideoChannel()
46 |
47 | /**
48 | * 获取视频列表
49 | *
50 | * @param page 页码
51 | * @param listType 默认list
52 | * @param typeId 频道id
53 | */
54 | fun getVideoDetails(page: Int, listType: String, typeId: String)
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/widget/ObservableScrollView.java:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.widget;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.ScrollView;
6 |
7 | /**
8 | * desc: .
9 | * author: Will .
10 | * date: 2017/12/22 .
11 | */
12 | public class ObservableScrollView extends ScrollView {
13 | public interface ScrollViewListener {
14 |
15 | void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx, int oldy);
16 |
17 | }
18 |
19 | private ScrollViewListener scrollViewListener = null;
20 |
21 | public ObservableScrollView(Context context) {
22 | super(context);
23 | }
24 |
25 | public ObservableScrollView(Context context, AttributeSet attrs,
26 | int defStyle) {
27 | super(context, attrs, defStyle);
28 | }
29 |
30 | public ObservableScrollView(Context context, AttributeSet attrs) {
31 | super(context, attrs);
32 | }
33 |
34 | public void setScrollViewListener(ScrollViewListener scrollViewListener) {
35 | this.scrollViewListener = scrollViewListener;
36 | }
37 | //重写滚动方法
38 | @Override
39 | protected void onScrollChanged(int x, int y, int oldx, int oldy) {
40 | super.onScrollChanged(x, y, oldx, oldy);
41 | if (scrollViewListener != null) {
42 | scrollViewListener.onScrollChanged(this, x, y, oldx, oldy);
43 | }
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/bean/Constants.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.bean
2 |
3 | /**
4 | * desc: .
5 | * author: Will .
6 | * date: 2017/9/2 .
7 | */
8 | object Constants {
9 | //864678036850608 如果数据太少,请自行抓包凤凰新闻 获取数据时的参数中的 uid 更换
10 | val uid = "864678036850608"
11 |
12 | //头条
13 | val TOPNEWS_ID = "SYLB10,SYDT10"
14 |
15 | //娱乐
16 | val YL_ID = "YL53,FOCUSYL53"
17 |
18 | //军事
19 | val JS_ID = "JS83,FOCUSJS83"
20 |
21 | //体育
22 | val TY_ID = "TY43,FOCUSTY43,TYLIVE,TYTOPIC"
23 |
24 | //财经
25 | val CJ_ID = "CJ33,FOCUSCJ33,HNCJ33"
26 |
27 | //科技
28 | val KJ_ID = "KJ123,FOCUSKJ123"
29 |
30 | //历史
31 | val LS_ID = "LS153,FOCUSLS153"
32 |
33 | //台湾
34 | val TW_ID = "TW73"
35 |
36 | //汽车
37 | val QC_ID = "QC45,FOCUSQC45"
38 |
39 | //社会
40 | val SH_ID = "SH133,FOCUSSH133"
41 |
42 | //FUN来了
43 | val FUN_ID = "DZPD,FOCUSDZPD"
44 |
45 | //时尚
46 | val SS_ID = "SS78,FOCUSSS78"
47 |
48 | //国学
49 | val GX_ID = "GXPD,FOCUSGXPD"
50 |
51 | //时政
52 | val SZ_ID = "SZPD,FOCUSSZPD"
53 |
54 | //凤凰大学问
55 | val FHDXW_ID = "FHDXW,FOCUSFHDXW"
56 |
57 | //文化
58 | val WH_ID = "WH25,FOCUSWH25"
59 |
60 | //星座
61 | val XZ_ID = "XZ09,FOCUSXZ09"
62 |
63 | //读书
64 | val DS_ID = "DS57,FOCUSDS57"
65 |
66 | //游戏
67 | val YH_ID = "YX11,FOCUSYX11"
68 |
69 | //电影
70 | val DY_ID = "DYPD"
71 |
72 | //国际
73 | val GJ_ID = "GJPD"
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/adapter/FreshNewsAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.adapter
2 |
3 | import android.content.Context
4 | import android.view.View
5 | import android.widget.ImageView
6 | import com.chad.library.adapter.base.BaseQuickAdapter
7 | import com.chad.library.adapter.base.BaseViewHolder
8 | import com.will.weiyuekotlin.R
9 | import com.will.weiyuekotlin.bean.FreshNewsBean
10 | import com.will.weiyuekotlin.utils.ImageLoaderUtil
11 |
12 | /**
13 | * desc: .
14 | * author: Will .
15 | * date: 2017/9/27 .
16 | */
17 | class FreshNewsAdapter(private val context: Context, data: List?) : BaseQuickAdapter(R.layout.item_freshnews, data), BaseQuickAdapter.OnItemClickListener {
18 |
19 | override fun convert(viewHolder: BaseViewHolder, postsBean: FreshNewsBean.PostsBean) {
20 | viewHolder.setText(R.id.tv_title, postsBean.title)
21 | viewHolder.setText(R.id.tv_info, postsBean.author!!.name)
22 | viewHolder.setText(R.id.tv_commnetsize, postsBean.comment_count.toString() + "评论")
23 | ImageLoaderUtil.LoadImage(context, postsBean.custom_fields!!.thumb_c!![0], viewHolder.getView(R.id.iv_logo) as ImageView)
24 | // onItemClickListener = this
25 | }
26 |
27 | override fun onItemClick(baseQuickAdapter: BaseQuickAdapter<*, *>, view: View, i: Int) {
28 | // ReadActivity.launch(context, (baseQuickAdapter.getItem(i) as FreshNewsBean.PostsBean?)!!)
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/widget/HackyViewPager.java:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.widget;
2 |
3 | import android.content.Context;
4 | import android.support.v4.view.ViewPager;
5 | import android.util.AttributeSet;
6 | import android.util.Log;
7 | import android.view.MotionEvent;
8 |
9 | /**
10 | * Hacky fix for Issue #4 and
11 | * http://code.google.com/p/android/issues/detail?id=18990
12 | *
13 | * ScaleGestureDetector seems to mess up the touch events, which means that
14 | * ViewGroups which make use of onInterceptTouchEvent throw a lot of
15 | * IllegalArgumentException: pointerIndex out of range.
16 | *
17 | * There's not much I can do in my code for now, but we can mask the result by
18 | * just catching the problem and ignoring it.
19 | *
20 | * @author Chris Banes
21 | */
22 | public class HackyViewPager extends ViewPager {
23 |
24 |
25 | private static final String TAG = "HackyViewPager";
26 |
27 | public HackyViewPager(Context context) {
28 | super(context);
29 | }
30 |
31 | public HackyViewPager(Context context, AttributeSet attrs) {
32 | super(context, attrs);
33 | }
34 |
35 | @Override
36 | public boolean onInterceptTouchEvent(MotionEvent ev) {
37 | try {
38 | return super.onInterceptTouchEvent(ev);
39 | } catch (IllegalArgumentException e) {
40 | Log.e(TAG,"hacky viewpager error1");
41 | return false;
42 | }catch(ArrayIndexOutOfBoundsException e ){
43 | Log.e(TAG,"hacky viewpager error2");
44 | return false;
45 | }
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/widget/ShowMaxImageView.java:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.widget;
2 |
3 | import android.content.Context;
4 | import android.graphics.drawable.Drawable;
5 | import android.support.v7.widget.AppCompatImageView;
6 | import android.util.AttributeSet;
7 |
8 |
9 | /**
10 | * 自定义控件,用于显示宽度和ImageView相同,高度自适应的图片显示模式.
11 | * 除此之外,还添加了最大高度限制,若图片长度大于等于屏幕长度,则高度显示为屏幕的1/3
12 | * Created by zhaokaiqiang on 15/4/20.
13 | */
14 | public class ShowMaxImageView extends AppCompatImageView {
15 |
16 | private float mHeight = 0;
17 |
18 | public ShowMaxImageView(Context context) {
19 | super(context);
20 | }
21 |
22 | public ShowMaxImageView(Context context, AttributeSet attrs) {
23 | super(context, attrs);
24 | }
25 |
26 | public ShowMaxImageView(Context context, AttributeSet attrs, int defStyleAttr) {
27 | super(context, attrs, defStyleAttr);
28 | }
29 |
30 |
31 | @Override
32 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
33 | Drawable d = getDrawable();
34 | if (d != null) {
35 | int width = MeasureSpec.getSize(widthMeasureSpec);
36 | //高度根据使得图片的宽度充满屏幕计算而得
37 | int height = (int) Math.ceil((float) width * (float) d.getIntrinsicHeight() / (float) d.getIntrinsicWidth());
38 | setMeasuredDimension(width, height);
39 | } else {
40 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
41 | }
42 |
43 | }
44 |
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/news/contract/DetailContract.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.news.contract
2 |
3 |
4 | import com.will.weiyuekotlin.bean.NewsDetail
5 | import com.will.weiyuekotlin.ui.base.BaseContract
6 |
7 | /**
8 | * desc: .
9 | * author: Will .
10 | * date: 2017/9/7 .
11 | */
12 | interface DetailContract {
13 |
14 | interface View : BaseContract.BaseView {
15 |
16 | /**
17 | * 加载顶部banner数据
18 | *
19 | * @param newsDetail
20 | */
21 | fun loadBannerData(newsDetail: NewsDetail?)
22 |
23 | /**
24 | * 加载置顶新闻数据
25 | *
26 | * @param newsDetail
27 | */
28 | fun loadTopNewsData(newsDetail: NewsDetail?)
29 |
30 | /**
31 | * 加载新闻数据
32 | *
33 | * @param itemBeanList
34 | */
35 | fun loadData(itemBeanList: List?)
36 |
37 | /**
38 | * 加载更多新闻数据
39 | *
40 | * @param itemBeanList
41 | */
42 | fun loadMoreData(itemBeanList: List?)
43 |
44 | }
45 |
46 | interface Presenter : BaseContract.BasePresenter {
47 |
48 | /**
49 | * 获取新闻详细信息
50 | *
51 | * @param id 频道ID值
52 | * @param action 用户操作方式
53 | * 1:下拉 down
54 | * 2:上拉 up
55 | * 3:默认 default
56 | * @param pullNum 操作次数 累加
57 | */
58 | fun getData(id: String, action: String, pullNum: Int)
59 |
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_advert.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
11 |
19 |
25 |
26 |
27 |
36 |
37 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_load_more.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
26 |
27 |
28 |
33 |
34 |
35 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/assets/jd/read.js:
--------------------------------------------------------------------------------
1 | function handle_img(){
2 | var imgs = document.getElementsByTagName("img");
3 | var img_url_data = "";
4 | for (var i = 0 ; i < imgs.length ; i++){
5 | img_url_data += imgs[i].src + "|";
6 | }
7 | for (var i = 0 ; i < imgs.length ; i++){
8 | imgs[i].onclick = (function(index){
9 | return function(){
10 | window.article.showImg(index, img_url_data);
11 | }
12 | })(i + "");
13 | }
14 | }
15 |
16 | function show_content(content) {
17 | document.getElementById("main_content").innerHTML = content;
18 |
19 | var ems = document.getElementsByTagName("em");
20 | for (var i = 0 ; i < ems.length ; i++){
21 | ems[i].style.color = "#737373";
22 | }
23 |
24 | var as = document.getElementsByTagName("a");
25 | for (var i = 0 ; i < as.length ; i++){
26 | as[i].style.color = "#FF0000";
27 | }
28 |
29 | var iframes = document.getElementsByTagName("iframe");
30 | for (var i = 0 ; i < iframes.length ; i++){
31 | iframes[i].width = '100%';
32 | iframes[i].height = '100%';
33 | }
34 |
35 | var quotes = document.getElementsByTagName("blockquote");
36 | for (var i = 0 ; i < quotes.length ; i++){
37 | quotes[i].style.borderColor = "#D6D6D6";
38 | quotes[i].style.backgroundColor = "#F2F2F2";
39 | }
40 |
41 | handle_img();
42 | }
43 |
44 | function change_trick_space_height(height) {
45 | document.getElementById('trick_space').style.height = height + 'px';
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_retry.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
15 |
16 |
27 |
28 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/widget/ColorFilterImageView.java:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.widget;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.graphics.PorterDuff.Mode;
6 | import android.util.AttributeSet;
7 | import android.view.MotionEvent;
8 | import android.view.View;
9 | import android.view.View.OnTouchListener;
10 | import android.widget.ImageView;
11 |
12 | /**
13 | *
14 | * @ClassName: ColorFilterImageView
15 | * @Description: 实现图像根据按下抬起动作变化颜色
16 | * @author hnclca
17 | * @date 2016-02-26
18 | *
19 | */
20 | public class ColorFilterImageView extends ImageView implements OnTouchListener {
21 | public ColorFilterImageView(Context context) {
22 | this(context, null, 0);
23 | }
24 |
25 | public ColorFilterImageView(Context context, AttributeSet attrs) {
26 | this(context, attrs, 0);
27 | }
28 |
29 | public ColorFilterImageView(Context context, AttributeSet attrs, int defStyle) {
30 | super(context, attrs, defStyle);
31 | init();
32 | }
33 |
34 | private void init() {
35 | setOnTouchListener(this);
36 | }
37 |
38 | @Override
39 | public boolean onTouch(View v, MotionEvent event) {
40 | switch (event.getAction()) {
41 | case MotionEvent.ACTION_DOWN: // 按下时图像变灰
42 | setColorFilter(Color.GRAY, Mode.MULTIPLY);
43 | break;
44 | case MotionEvent.ACTION_UP: // 手指离开或取消操作时恢复原色
45 | case MotionEvent.ACTION_CANCEL:
46 | setColorFilter(Color.TRANSPARENT);
47 | break;
48 | default:
49 | break;
50 | }
51 | return false;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/widget/MyScrollView.java:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.widget;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.util.DisplayMetrics;
7 | import android.view.Display;
8 | import android.widget.ScrollView;
9 |
10 | /**
11 | * desc:
12 | * author: Will .
13 | * date: 2017/9/24 .
14 | */
15 | public class MyScrollView extends ScrollView {
16 | private Context mContext;
17 |
18 | public MyScrollView(Context context) {
19 | super(context);
20 | init(context);
21 | }
22 |
23 | public MyScrollView(Context context, AttributeSet attrs) {
24 | super(context, attrs);
25 | init(context);
26 |
27 | }
28 |
29 | public MyScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
30 | super(context, attrs, defStyleAttr);
31 | init(context);
32 | }
33 |
34 | private void init(Context context) {
35 | mContext = context;
36 | }
37 |
38 | @Override
39 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
40 | try {
41 | //最大高度显示为屏幕内容高度的一半
42 | Display display = ((Activity) mContext).getWindowManager().getDefaultDisplay();
43 | DisplayMetrics d = new DisplayMetrics();
44 | display.getMetrics(d);
45 | //此处是关键,设置控件高度不能超过屏幕高度一半(d.heightPixels / 2)(在此替换成自己需要的高度)
46 | heightMeasureSpec = MeasureSpec.makeMeasureSpec(d.heightPixels / 4, MeasureSpec.AT_MOST);
47 |
48 | } catch (Exception e) {
49 | e.printStackTrace();
50 | }
51 | //重新计算控件高、宽
52 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_news.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
26 |
27 |
37 |
38 |
39 |
43 |
--------------------------------------------------------------------------------
/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 |
31 |
32 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_news_new.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
16 |
17 |
27 |
28 |
38 |
39 |
40 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
18 |
19 |
20 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
39 |
40 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/jandan/contract/JanDanContract.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.jandan.contract
2 |
3 | import com.will.weiyuekotlin.bean.FreshNewsBean
4 | import com.will.weiyuekotlin.bean.JdDetailBean
5 | import com.will.weiyuekotlin.ui.base.BaseContract
6 |
7 | /**
8 | * desc: .
9 | * author: Will .
10 | * date: 2017/9/27 .
11 | */
12 | interface JanDanContract {
13 |
14 | interface View : BaseContract.BaseView {
15 |
16 | /**
17 | * 加载新鲜事列表
18 | *
19 | * @param freshNewsBean 新鲜事列表
20 | */
21 | fun loadFreshNews(freshNewsBean: FreshNewsBean?)
22 |
23 | /**
24 | * 加载更多新鲜事列表
25 | *
26 | * @param freshNewsBean 新鲜事列表
27 | */
28 | fun loadMoreFreshNews(freshNewsBean: FreshNewsBean?)
29 |
30 | /**
31 | * 加载 无聊图、妹子图、段子列表
32 | *
33 | * @param type 具体看 [com.will.weiyuekotlin.net.JanDanApi.Type]
34 | * @param jdDetailBean 数据列表
35 | */
36 | fun loadDetailData(type: String, jdDetailBean: JdDetailBean?)
37 |
38 | /**
39 | * 加载更多 无聊图、妹子图、段子列表
40 | *
41 | * @param type 具体看 [com.will.weiyuekotlin.net.JanDanApi.Type]
42 | * @param jdDetailBean 数据列表
43 | */
44 | fun loadMoreDetailData(type: String, jdDetailBean: JdDetailBean?)
45 |
46 | }
47 |
48 | interface Presenter : BaseContract.BasePresenter {
49 |
50 | /**
51 | * 获取新鲜事,无聊图、妹子图、段子列表
52 | *
53 | * @param type 具体看 [com.will.weiyuekotlin.net.JanDanApi.Type]
54 | * @param page 页码
55 | */
56 | fun getData(type: String, page: Int)
57 |
58 | /**
59 | * 获取新鲜事数据
60 | *
61 | * @param page 页码
62 | */
63 | fun getFreshNews(page: Int)
64 |
65 | /**
66 | * 获取无聊图、妹子图、段子列表
67 | *
68 | * @param type 具体看 [com.will.weiyuekotlin.net.JanDanApi.Type]
69 | * @param page 页码
70 | */
71 | fun getDetailData(type: String, page: Int)
72 |
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/adapter/VideoDetailAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.adapter
2 |
3 | import android.content.Context
4 | import android.support.annotation.LayoutRes
5 | import android.view.View
6 | import com.chad.library.adapter.base.BaseQuickAdapter
7 | import com.chad.library.adapter.base.BaseViewHolder
8 | import com.will.weiyuekotlin.R
9 | import com.will.weiyuekotlin.bean.VideoDetailBean
10 | import com.will.weiyuekotlin.utils.ImageLoaderUtil
11 | import com.will.weiyuekotlin.utils.conversionPlayTime
12 | import com.will.weiyuekotlin.utils.conversionTime
13 | import fm.jiecao.jcvideoplayer_lib.JCUserAction
14 | import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer
15 | import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard
16 |
17 | /**
18 | * desc: 视频详情 Adapter .
19 | * author: Will .
20 | * date: 2017/12/7 .
21 | */
22 | class VideoDetailAdapter(private var context: Context, @LayoutRes layoutResId: Int, data: List?)
23 | : BaseQuickAdapter(layoutResId, data) {
24 |
25 | override fun convert(viewHolder: BaseViewHolder, itemBean: VideoDetailBean.ItemBean) {
26 | // viewHolder.setText(R.id.tv_title, itemBean.getTitle());
27 | val jcVideoPlayerStandard = viewHolder.getView(R.id.videoplayer)
28 | jcVideoPlayerStandard.setUp(itemBean.video_url, JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, itemBean.title)
29 | JCVideoPlayer.setJcUserAction({ type, _, _, _ ->
30 | when (type) {
31 | JCUserAction.ON_CLICK_START_ICON -> {
32 | viewHolder.getView(R.id.tv_videoduration).visibility = View.GONE
33 | }
34 | }
35 | })
36 | ImageLoaderUtil.LoadImage(context, itemBean.image, jcVideoPlayerStandard.thumbImageView)
37 | viewHolder.setText(R.id.tv_videoduration, conversionTime(itemBean.duration))
38 | itemBean.playTime?.let {
39 | viewHolder.setText(R.id.tv_playtime, conversionPlayTime(Integer.valueOf(it)!!))
40 | }
41 |
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_welcome.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
17 |
18 |
25 |
26 |
33 |
34 |
35 |
36 |
45 |
46 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/video/presenter/VideoPresenter.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.video.presenter
2 |
3 | import com.will.weiyuekotlin.bean.VideoChannelBean
4 | import com.will.weiyuekotlin.bean.VideoDetailBean
5 | import com.will.weiyuekotlin.net.BaseObserver
6 | import com.will.weiyuekotlin.net.NewsApi
7 | import com.will.weiyuekotlin.ui.base.BasePresenter
8 | import com.will.weiyuekotlin.ui.video.contract.VideoContract
9 | import com.will.weiyuekotlin.utils.applySchedulers
10 | import javax.inject.Inject
11 |
12 | /**
13 | * desc: .
14 | * author: Will .
15 | * date: 2017/11/28 .
16 | */
17 | class VideoPresenter @Inject
18 | constructor(private var mNewsApi: NewsApi) : BasePresenter(), VideoContract.Presenter {
19 |
20 | /**
21 | * 获取视频频道列表
22 | *
23 | */
24 | override fun getVideoChannel() {
25 | mNewsApi.videoChannel
26 | .applySchedulers()
27 | .compose(mView!!.bindToLife>())
28 | .subscribe(object : BaseObserver>() {
29 | override fun onSuccess(t: List?) {
30 | mView?.loadVideoChannel(t)
31 | }
32 |
33 | override fun onFail(e: Throwable) {
34 | mView?.showError()
35 | }
36 |
37 | })
38 |
39 | }
40 |
41 | /**
42 | * 获取视频列表
43 | *
44 | * @param page 页码
45 | * @param listType 默认list
46 | * @param typeId 频道id
47 | */
48 | override fun getVideoDetails(page: Int, listType: String, typeId: String) {
49 | mNewsApi.getVideoDetail(page, listType, typeId)
50 | .applySchedulers()
51 | .compose(mView!!.bindToLife>())
52 | .subscribe(object : BaseObserver>() {
53 | override fun onSuccess(t: List?) {
54 | when {
55 | page > 1 -> mView!!.loadMoreVideoDetails(t)
56 | else -> mView!!.loadVideoDetails(t)
57 | }
58 | }
59 |
60 | override fun onFail(e: Throwable) {
61 | mView?.showError()
62 | }
63 | })
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | 1.8
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/module/HttpModule.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.module
2 |
3 |
4 | import com.will.weiyuekotlin.MyApp
5 | import com.will.weiyuekotlin.net.*
6 | import dagger.Module
7 | import dagger.Provides
8 | import okhttp3.Cache
9 | import okhttp3.OkHttpClient
10 | import retrofit2.Retrofit
11 | import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
12 | import retrofit2.converter.gson.GsonConverterFactory
13 | import java.io.File
14 | import java.util.concurrent.TimeUnit
15 |
16 | /**
17 | * desc:
18 | * author: Will .
19 | * date: 2017/9/2 .
20 | */
21 | @Module
22 | class HttpModule {
23 |
24 | @Provides
25 | internal fun provideOkHttpClient(): OkHttpClient.Builder {
26 | // 指定缓存路径,缓存大小100Mb
27 | val cache = Cache(File(MyApp.instance.cacheDir, "HttpCache"),
28 | (1024 * 1024 * 100).toLong())
29 | return OkHttpClient().newBuilder().cache(cache)
30 | .retryOnConnectionFailure(true)
31 | .addInterceptor(RetrofitConfig.sLoggingInterceptor)
32 | .addInterceptor(RetrofitConfig.sRewriteCacheControlInterceptor)
33 | .addNetworkInterceptor(RetrofitConfig.sRewriteCacheControlInterceptor)
34 | .connectTimeout(10, TimeUnit.SECONDS)
35 | }
36 |
37 | @Provides
38 | internal fun provideNetEaseApis(builder: OkHttpClient.Builder): NewsApi {
39 | builder.addInterceptor(RetrofitConfig.sQueryParameterInterceptor)
40 |
41 | val retrofitBuilder = Retrofit.Builder()
42 | .addConverterFactory(GsonConverterFactory.create())
43 | .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
44 | .client(builder.build())
45 |
46 | return NewsApi.getInstance(retrofitBuilder
47 | .baseUrl(ApiConstants.sIFengApi)
48 | .build().create(NewsApiService::class.java))
49 | }
50 |
51 | @Provides
52 | internal fun provideJanDanApis(builder: OkHttpClient.Builder): JanDanApi {
53 |
54 | val retrofitBuilder = Retrofit.Builder()
55 | .addConverterFactory(GsonConverterFactory.create())
56 | .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
57 | .client(builder.build())
58 |
59 | return JanDanApi.getInstance(retrofitBuilder
60 | .baseUrl(ApiConstants.sJanDanApi)
61 | .build().create(JanDanApiService::class.java))
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/video/VideoFragment.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.video
2 |
3 | import android.os.Bundle
4 | import android.view.View
5 | import com.will.weiyuekotlin.R
6 | import com.will.weiyuekotlin.bean.VideoChannelBean
7 | import com.will.weiyuekotlin.bean.VideoDetailBean
8 | import com.will.weiyuekotlin.component.ApplicationComponent
9 | import com.will.weiyuekotlin.component.DaggerHttpComponent
10 | import com.will.weiyuekotlin.ui.adapter.VideoPagerAdapter
11 | import com.will.weiyuekotlin.ui.base.BaseFragment
12 | import com.will.weiyuekotlin.ui.video.contract.VideoContract
13 | import com.will.weiyuekotlin.ui.video.presenter.VideoPresenter
14 | import com.will.weiyuekotlin.widget.SimpleMultiStateView
15 | import kotlinx.android.synthetic.main.fragment_video.*
16 |
17 |
18 | /**
19 | * desc: 视频 .
20 | * author: Will .
21 | * date: 2017/11/28 .
22 | */
23 |
24 | class VideoFragment : BaseFragment(), VideoContract.View {
25 | private var mVideoPagerAdapter: VideoPagerAdapter? = null
26 |
27 | companion object {
28 | fun newInstance(): VideoFragment {
29 | val args = Bundle()
30 | val fragment = VideoFragment()
31 | fragment.arguments = args
32 | return fragment
33 | }
34 | }
35 |
36 | override fun getSimpleMultiStateView(): SimpleMultiStateView? = null
37 |
38 | override fun initInjector(appComponent: ApplicationComponent) {
39 | DaggerHttpComponent.builder()
40 | .applicationComponent(appComponent)
41 | .build()
42 | .inject(this)
43 | }
44 |
45 | override fun getContentLayout(): Int = R.layout.fragment_video
46 |
47 | override fun bindView(view: View, savedInstanceState: Bundle?) {
48 |
49 | }
50 |
51 | override fun initData() {
52 | mPresenter?.getVideoChannel()
53 | }
54 |
55 | /**
56 | * 加载视频频道列表
57 | *
58 | * @param channelBean 频道列表
59 | */
60 | override fun loadVideoChannel(channelBean: List?) {
61 | mVideoPagerAdapter = VideoPagerAdapter(childFragmentManager, channelBean?.get(0))
62 | viewPager.adapter = mVideoPagerAdapter
63 | viewPager.offscreenPageLimit = 1
64 | viewPager.setCurrentItem(0, false)
65 | tabLayout.setupWithViewPager(viewPager, true)
66 | }
67 |
68 | override fun loadVideoDetails(detailBean: List?) {
69 | }
70 |
71 | override fun loadMoreVideoDetails(detailBean: List?) {
72 | }
73 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
21 |
22 |
23 |
27 |
28 |
32 |
33 |
34 |
35 |
36 |
40 |
41 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_freshnews.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
24 |
25 |
36 |
37 |
46 |
47 |
58 |
59 |
60 |
64 |
65 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/popup_newsdel.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
16 |
17 |
23 |
24 |
25 |
33 |
34 |
39 |
40 |
45 |
46 |
56 |
57 |
58 |
59 |
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/will/weiyuekotlin/net/JanDanApi.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.net
2 |
3 | import android.support.annotation.StringDef
4 | import com.will.weiyuekotlin.bean.FreshNewsArticleBean
5 | import com.will.weiyuekotlin.bean.FreshNewsBean
6 | import com.will.weiyuekotlin.bean.JdDetailBean
7 | import io.reactivex.Observable
8 | import java.lang.annotation.Retention
9 | import java.lang.annotation.RetentionPolicy
10 |
11 | /**
12 | * desc: .
13 | * author: Will .
14 | * date: 2017/9/27 .
15 | */
16 | class JanDanApi(private val mService: JanDanApiService) {
17 |
18 | companion object {
19 | /**
20 | * 新鲜事
21 | */
22 | const val TYPE_FRESH = "get_recent_posts"
23 | /**
24 | * 新鲜事文章
25 | */
26 | const val TYPE_FRESHARTICLE = "get_post"
27 | /**
28 | * 无聊图
29 | */
30 | const val TYPE_BORED = "jandan.get_pic_comments"
31 | /**
32 | * 妹子图
33 | */
34 | const val TYPE_GIRLS = "jandan.get_ooxx_comments"
35 | /**
36 | * 段子
37 | */
38 | const val TYPE_Duan = "jandan.get_duan_comments"
39 |
40 | private var sInstance: JanDanApi? = null
41 |
42 | fun getInstance(janDanApiService: JanDanApiService): JanDanApi {
43 | if (sInstance == null)
44 | sInstance = JanDanApi(janDanApiService)
45 | return sInstance as JanDanApi
46 | }
47 | }
48 |
49 | @StringDef(TYPE_FRESH, TYPE_BORED, TYPE_GIRLS, TYPE_Duan)
50 | @Retention(RetentionPolicy.SOURCE)
51 | annotation class Type
52 |
53 | /**
54 | * 获取新鲜事列表
55 | *
56 | * @param page 页码
57 | * @return
58 | */
59 | fun getFreshNews(page: Int): Observable {
60 | return mService.getFreshNews(ApiConstants.sJanDanApi, TYPE_FRESH,
61 | "url,date,tags,author,title,excerpt,comment_count,comment_status,custom_fields",
62 | page, "thumb_c,views", "1")
63 | }
64 |
65 | /**
66 | * 获取 无聊图,妹子图,段子列表
67 | *
68 | * @param type [Type]
69 | * @param page 页码
70 | * @return
71 | */
72 | fun getJdDetails(@Type type: String, page: Int): Observable {
73 | return mService.getDetailData(ApiConstants.sJanDanApi, type, page)
74 | }
75 |
76 | /**
77 | * 获取新鲜事文章详情
78 | *
79 | * @param id PostsBean id [FreshNewsBean.PostsBean]
80 | * @return
81 | */
82 | fun getFreshNewsArticle(id: Int): Observable {
83 | return mService.getFreshNewsArticle(ApiConstants.sJanDanApi, TYPE_FRESHARTICLE, "content,date,modified", id)
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/net/NewsApi.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.net
2 |
3 | import android.support.annotation.StringDef
4 | import com.will.weiyuekotlin.bean.NewsArticleBean
5 | import com.will.weiyuekotlin.bean.NewsDetail
6 | import com.will.weiyuekotlin.bean.VideoChannelBean
7 | import com.will.weiyuekotlin.bean.VideoDetailBean
8 | import io.reactivex.Observable
9 | import java.lang.annotation.Retention
10 | import java.lang.annotation.RetentionPolicy
11 |
12 |
13 | /**
14 | * desc:
15 | * author: Will .
16 | * date: 2017/9/2 .
17 | */
18 | class NewsApi(private val mService: NewsApiService) {
19 |
20 | companion object {
21 | const val ACTION_DEFAULT = "default"
22 | const val ACTION_DOWN = "down"
23 | const val ACTION_UP = "up"
24 |
25 | private var sInstance: NewsApi? = null
26 |
27 | fun getInstance(newsApiService: NewsApiService): NewsApi {
28 | if (sInstance == null)
29 | sInstance = NewsApi(newsApiService)
30 | return sInstance as NewsApi
31 | }
32 | }
33 |
34 | @StringDef(ACTION_DEFAULT, ACTION_DOWN, ACTION_UP)
35 | @Retention(RetentionPolicy.SOURCE)
36 | annotation class Actions
37 |
38 | /**
39 | * 获取视频频道列表
40 | *
41 | * @return
42 | */
43 | val videoChannel: Observable>
44 | get() = mService.getVideoChannel(1)
45 |
46 | /**
47 | * 获取新闻详情
48 | *
49 | * @param id 频道ID值
50 | * @param action 用户操作方式
51 | * 1:下拉 down
52 | * 2:上拉 up
53 | * 3:默认 default
54 | *
55 | * @param pullNum 操作次数 累加
56 | * @return
57 | */
58 | fun getNewsDetail(id: String, @Actions action: String, pullNum: Int): Observable>
59 | = mService.getNewsDetail(id, action, pullNum)
60 |
61 | /**
62 | * 获取新闻文章详情
63 | *
64 | * @param aid 文章aid 此处baseurl可能不同,需要特殊处理
65 | * aid 以 cmpp 开头则调用 getNewsArticleWithCmpp
66 | * @return
67 | */
68 | fun getNewsArticle(aid: String): Observable = when {
69 | aid.startsWith("sub") -> mService.getNewsArticleWithSub(aid)
70 | else -> mService.getNewsArticleWithCmpp(ApiConstants.sGetNewsArticleCmppApi + ApiConstants.sGetNewsArticleDocCmppApi, aid)
71 | }
72 |
73 | /**
74 | * 获取
75 | *
76 | * @param page
77 | * @param listType
78 | * @param typeId
79 | * @return
80 | */
81 | fun getVideoDetail(page: Int, listType: String, typeId: String): Observable>
82 | = mService.getVideoDetail(page, listType, typeId)
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/widget/channelDialog/ItemDragHelperCallBack.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.widget.channelDialog
2 |
3 | import android.support.v7.widget.GridLayoutManager
4 | import android.support.v7.widget.RecyclerView
5 | import android.support.v7.widget.StaggeredGridLayoutManager
6 | import android.support.v7.widget.helper.ItemTouchHelper
7 |
8 |
9 | class ItemDragHelperCallBack(private var onChannelListener: OnChannelListener?) : ItemTouchHelper.Callback() {
10 |
11 | fun setOnChannelDragListener(onChannelDragListener: OnChannelListener) {
12 | this.onChannelListener = onChannelDragListener
13 | }
14 |
15 | override fun getMovementFlags(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder): Int {
16 | val manager = recyclerView.layoutManager
17 | val dragFlags = when (manager) {
18 | is GridLayoutManager, is StaggeredGridLayoutManager -> //监听上下左右拖动
19 | ItemTouchHelper.UP or ItemTouchHelper.DOWN or ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT
20 | else -> ItemTouchHelper.UP or ItemTouchHelper.DOWN
21 | }
22 | return ItemTouchHelper.Callback.makeMovementFlags(dragFlags, 0)
23 | }
24 |
25 | override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean {
26 | // 不同Type之间不可移动
27 | if (viewHolder.itemViewType != target.itemViewType) return false
28 | onChannelListener?.onItemMove(viewHolder.adapterPosition, target.adapterPosition)
29 | return true
30 | }
31 |
32 | override fun onSelectedChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) {
33 | // 不在闲置状态
34 | if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
35 | if (viewHolder is OnDragVHListener) {
36 | val itemViewHolder = viewHolder as OnDragVHListener?
37 | itemViewHolder!!.onItemSelected()
38 | }
39 | }
40 | super.onSelectedChanged(viewHolder, actionState)
41 | }
42 |
43 | override fun clearView(recyclerView: RecyclerView?, viewHolder: RecyclerView.ViewHolder) {
44 | if (viewHolder is OnDragVHListener) {
45 | val itemViewHolder = viewHolder as OnDragVHListener
46 | itemViewHolder.onItemFinish()
47 | }
48 | super.clearView(recyclerView, viewHolder)
49 | }
50 |
51 | //不需要长按拖动,因为我们的标题和 频道推荐 是不需要拖动的,所以手动控制
52 | override fun isLongPressDragEnabled(): Boolean = false
53 |
54 | //不需要侧滑
55 | override fun isItemViewSwipeEnabled(): Boolean = false
56 |
57 | override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
58 |
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/net/NewsApiService.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.net
2 |
3 | import com.will.weiyuekotlin.bean.*
4 | import io.reactivex.Observable
5 | import retrofit2.http.GET
6 | import retrofit2.http.Headers
7 | import retrofit2.http.Query
8 | import retrofit2.http.Url
9 |
10 |
11 | /**
12 | * desc:
13 | * author: Will .
14 | * date: 2017/9/2 .
15 | */
16 | interface NewsApiService {
17 |
18 |
19 | // @GET("ClientNews")
20 | // Observable> getNewsDetail(@Query("id") String id,
21 | // @Query("action") String action,
22 | // @Query("pullNum") String pullNum,
23 | // @Query("uid") String uid,
24 | // @Query("devid") String devid,
25 | // @Query("proid") String proid,
26 | // @Query("vt") String vt,
27 | // @Query("publishid") String publishid,
28 | // @Query("screen") String screen,
29 | // @Query("os") String os,
30 | // @Query("df") String df,
31 | // @Query("nw") String nw);
32 |
33 | @GET("ClientNews")
34 | fun getNewsDetail(@Query("id") id: String,
35 | @Query("action") action: String,
36 | @Query("pullNum") pullNum: Int
37 | ): Observable>
38 |
39 | @GET("api_vampire_article_detail")
40 | fun getNewsArticleWithSub(@Query("aid") aid: String): Observable
41 |
42 | @GET
43 | fun getNewsArticleWithCmpp(@Url url: String,
44 | @Query("aid") aid: String): Observable
45 |
46 | @GET
47 | fun getNewsImagesWithCmpp(@Url url: String,
48 | @Query("aid") aid: String): Observable
49 |
50 | @GET("NewRelativeVideoList")
51 | fun getNewsVideoWithCmpp(@Url url: String,
52 | @Query("guid") guid: String): Observable
53 |
54 | @GET("ifengvideoList")
55 | fun getVideoChannel(@Query("page") page: Int): Observable>
56 |
57 | @GET("ifengvideoList")
58 | fun getVideoDetail(@Query("page") page: Int,
59 | @Query("listtype") listtype: String,
60 | @Query("typeid") typeid: String): Observable>
61 |
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/personal/PersonalFragment.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.personal
2 |
3 | import android.content.Intent
4 | import android.graphics.Typeface
5 | import android.net.Uri
6 | import android.os.Bundle
7 | import android.view.View
8 | import android.widget.TextView
9 | import com.bumptech.glide.load.engine.DiskCacheStrategy
10 | import com.bumptech.glide.request.RequestOptions
11 | import com.will.weiyuekotlin.R
12 | import com.will.weiyuekotlin.component.ApplicationComponent
13 | import com.will.weiyuekotlin.ui.base.BaseContract
14 | import com.will.weiyuekotlin.ui.base.BaseFragment
15 | import com.will.weiyuekotlin.ui.base.BasePresenter
16 | import com.will.weiyuekotlin.utils.ImageLoaderUtil
17 | import com.will.weiyuekotlin.widget.SimpleMultiStateView
18 | import kotlinx.android.synthetic.main.fragment_personal.*
19 |
20 |
21 | /**
22 | * desc: 个人 .
23 | * author: Will .
24 | * date: 2017/11/28 .
25 | */
26 |
27 | class PersonalFragment : BaseFragment>() {
28 | companion object {
29 | fun newInstance(): PersonalFragment {
30 | val args = Bundle()
31 | val fragment = PersonalFragment()
32 | fragment.arguments = args
33 | return fragment
34 | }
35 | }
36 |
37 | override fun getSimpleMultiStateView(): SimpleMultiStateView? = null
38 |
39 | override fun initInjector(appComponent: ApplicationComponent) {}
40 |
41 | override fun getContentLayout(): Int = R.layout.fragment_personal
42 |
43 | override fun initData() {}
44 |
45 | override fun bindView(view: View, savedInstanceState: Bundle?) {
46 | ImageLoaderUtil.LoadImage(this, "http://oon8y1sqh.bkt.clouddn.com/avatar.JPG", ivAuthor,
47 | RequestOptions().circleCrop().diskCacheStrategy(DiskCacheStrategy.ALL))
48 | val mTypeFace = Typeface.createFromAsset(activity.assets, "font/consolab.ttf")
49 | tvContacts.typeface = mTypeFace
50 | setFont(tvName, tvBlog, tvGithub, tvEmail, tvGithubUrl, tvUrl, tvEmailUrl)
51 |
52 | tvUrl.setOnClickListener {
53 | toWeb(resources.getString(R.string.willUrl))
54 | }
55 | tvGithubUrl.setOnClickListener {
56 | toWeb(resources.getString(R.string.gitHubUrl))
57 | }
58 | }
59 |
60 | private fun setFont(vararg view: TextView) {
61 | val typeface = Typeface.createFromAsset(activity.assets, "font/consola.ttf")
62 | view.forEach {
63 | it.typeface = typeface
64 | }
65 | }
66 |
67 | private fun toWeb(url: String) {
68 | val webUrl = Uri.parse(url)
69 | val webIntent = Intent(Intent.ACTION_VIEW, webUrl)
70 | activity.startActivity(webIntent)
71 | }
72 |
73 | }
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 微阅
3 |
4 |
5 | 加载中...
6 | 还没有数据呢!
7 | 网络异常!
8 | 点击重试
9 | Main2Activity
10 | Open navigation drawer
11 | Close navigation drawer
12 | Settings
13 |
14 |
15 | %1$s评论
16 | 下拉一下,看点儿不一样的
17 | 已为您推荐了%1$s条新资讯
18 | 完成
19 | 编辑
20 | http://will-ls.top/
21 | https://github.com/Will-Ls
22 | liwanglin_001@163.com
23 |
24 |
25 | %1$s / %2$s %3$s
26 |
27 |
28 | Blog
29 | Will
30 | Contacts
31 | Github
32 | E-mail
33 |
34 |
35 |
36 | - 头条
37 | - 娱乐
38 | - 军事
39 | - 体育
40 | - 财经
41 | - 科技
42 | - 历史
43 | - 台湾
44 | - 汽车
45 | - 社会
46 | - 时尚
47 | - 国学
48 | - 文化
49 | - 星座
50 | - 读书
51 | - 游戏
52 | - 电影
53 | - 国际
54 |
55 |
56 |
57 | - SYLB10,SYDT10
58 | - YL53,FOCUSYL53
59 | - JS83,FOCUSJS83
60 | - TY43,FOCUSTY43,TYLIVE,TYTOPIC
61 | - CJ33,FOCUSCJ33,HNCJ33
62 | - KJ123,FOCUSKJ123
63 | - LS153,FOCUSLS153
64 | - TW73
65 | - QC45,FOCUSQC45
66 | - SH133,FOCUSSH133
67 | - SS78,FOCUSSS78
68 | - GXPD,FOCUSGXPD
69 | - WH25,FOCUSWH25
70 | - XZ09,FOCUSXZ09
71 | - DS57,FOCUSDS57
72 | - YX11,FOCUSYX11
73 | - DYPD
74 | - GJPD
75 |
76 |
77 |
--------------------------------------------------------------------------------
/app/src/main/assets/jd/post_detail_style.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0px;
3 | font-size: 18px;
4 | line-height: 1.6em;
5 | text-align: left;
6 | font-family: "Helvetica Neue", "Microsoft Yahei";
7 | word-wrap: break-word;
8 | word-break: normal;
9 | }
10 |
11 | object, embed {
12 | display:none;
13 | }
14 |
15 | ol, ul, li, h1, h2, h3, h4, h5, h6, p, form, input {
16 | margin: 0px;
17 | padding: 0px;
18 | }
19 |
20 | #main_content {
21 | padding: 16px 16px 0px 16px;
22 | }
23 |
24 | #main_content p {
25 | margin-bottom: 20px;
26 | }
27 |
28 | #main_content img {
29 | border:0 none;
30 | max-width: 100%;
31 | width: 100%;
32 | }
33 |
34 | #main_content em {
35 | text-align: center;
36 | font-size: 14px;
37 | font-style: normal;
38 | }
39 |
40 | #main_content h4 {
41 | margin-bottom: 5px;
42 | }
43 |
44 | #main_content a {
45 | text-decoration: none;
46 | }
47 |
48 | #main_content blockquote {
49 | margin: 10px 0;
50 | padding: 20px 20px 0px;
51 | border-width: 1px 0;
52 | border-style: solid;
53 | }
54 |
55 |
56 | .loader {
57 | position: absolute;
58 | top: 60%;
59 | left: 40%;
60 | margin-left: 10%;
61 | transform: translate3d(-50%, -50%, 0);
62 | }
63 |
64 | .dot {
65 | width: 24px;
66 | height: 24px;
67 | background: #3ac;
68 | border-radius: 100%;
69 | display: inline-block;
70 | animation: slide 1s infinite;
71 | }
72 | .dot:nth-child(1) {
73 | animation-delay: 0.1s;
74 | background: #32aacc;
75 | }
76 | .dot:nth-child(2) {
77 | animation-delay: 0.2s;
78 | background: #64aacc;
79 | }
80 | .dot:nth-child(3) {
81 | animation-delay: 0.3s;
82 | background: #96aacc;
83 | }
84 | .dot:nth-child(4) {
85 | animation-delay: 0.4s;
86 | background: #c8aacc;
87 | }
88 | .dot:nth-child(5) {
89 | animation-delay: 0.5s;
90 | background: #faaacc;
91 | }
92 | @-moz-keyframes slide {
93 | 0% {
94 | transform: scale(1);
95 | }
96 | 50% {
97 | opacity: 0.3;
98 | transform: scale(2);
99 | }
100 | 100% {
101 | transform: scale(1);
102 | }
103 | }
104 | @-webkit-keyframes slide {
105 | 0% {
106 | transform: scale(1);
107 | }
108 | 50% {
109 | opacity: 0.3;
110 | transform: scale(2);
111 | }
112 | 100% {
113 | transform: scale(1);
114 | }
115 | }
116 | @-o-keyframes slide {
117 | 0% {
118 | transform: scale(1);
119 | }
120 | 50% {
121 | opacity: 0.3;
122 | transform: scale(2);
123 | }
124 | 100% {
125 | transform: scale(1);
126 | }
127 | }
128 | @keyframes slide {
129 | 0% {
130 | transform: scale(1);
131 | }
132 | 50% {
133 | opacity: 0.3;
134 | transform: scale(2);
135 | }
136 | 100% {
137 | transform: scale(1);
138 | }
139 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/bean/VideoDetailBean.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.bean
2 |
3 | /**
4 | * desc: .
5 | * author: Will .
6 | * date: 2017/9/10 .
7 | */
8 | class VideoDetailBean {
9 |
10 | /**
11 | * totalPage : 2863
12 | * currentPage : 1
13 | * type : list
14 | * item : [{"documentId":"video_611796","title":"狂甩陈伟霆 刘奕君逆袭成主角?","image":"http://d.ifengimg.com/w640_h360_q80/p0.ifengimg.com/pmop/2017/07/24/40f7fad4-b6a4-4d88-989f-a99eced358e5.jpg","thumbnail":"http://d.ifengimg.com/w132_h94_q80/p0.ifengimg.com/pmop/2017/07/24/40f7fad4-b6a4-4d88-989f-a99eced358e5.jpg","guid":"656e107c-fe02-4c11-8ce8-d7de1111cf8c","type":"phvideo","commentsall":0,"duration":107,"shareUrl":"http://share.iclient.ifeng.com/sharenews.f?guid=656e107c-fe02-4c11-8ce8-d7de1111cf8c","commentsUrl":"http://share.iclient.ifeng.com/sharenews.f?guid=656e107c-fe02-4c11-8ce8-d7de1111cf8c","video_url":"http://ips.ifeng.com/video19.ifeng.com/video09/2017/07/24/5081903-102-9987619-095153.mp4","video_size":7184,"praise":"0","tread":"0","playTime":"6572"}]
15 | */
16 |
17 | var totalPage: Int = 0
18 | var currentPage: String? = null
19 | var type: String? = null
20 | var item: List? = null
21 |
22 | class ItemBean {
23 | /**
24 | * documentId : video_611796
25 | * title : 狂甩陈伟霆 刘奕君逆袭成主角?
26 | * image : http://d.ifengimg.com/w640_h360_q80/p0.ifengimg.com/pmop/2017/07/24/40f7fad4-b6a4-4d88-989f-a99eced358e5.jpg
27 | * thumbnail : http://d.ifengimg.com/w132_h94_q80/p0.ifengimg.com/pmop/2017/07/24/40f7fad4-b6a4-4d88-989f-a99eced358e5.jpg
28 | * guid : 656e107c-fe02-4c11-8ce8-d7de1111cf8c
29 | * type : phvideo
30 | * commentsall : 0
31 | * duration : 107
32 | * shareUrl : http://share.iclient.ifeng.com/sharenews.f?guid=656e107c-fe02-4c11-8ce8-d7de1111cf8c
33 | * commentsUrl : http://share.iclient.ifeng.com/sharenews.f?guid=656e107c-fe02-4c11-8ce8-d7de1111cf8c
34 | * video_url : http://ips.ifeng.com/video19.ifeng.com/video09/2017/07/24/5081903-102-9987619-095153.mp4
35 | * video_size : 7184
36 | * praise : 0
37 | * tread : 0
38 | * playTime : 6572
39 | */
40 |
41 | var documentId: String? = null
42 | var title: String? = null
43 | var image: String? = null
44 | var thumbnail: String? = null
45 | var guid: String? = null
46 | var type: String? = null
47 | var commentsall: Int = 0
48 | var duration: Int = 0
49 | var shareUrl: String? = null
50 | var commentsUrl: String? = null
51 | var video_url: String? = null
52 | var video_size: Int = 0
53 | var praise: String? = null
54 | var tread: String? = null
55 | var playTime: String? = null
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/news/presenter/NewsPresenter.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.news.presenter
2 |
3 | import com.will.weiyuekotlin.MyApp
4 | import com.will.weiyuekotlin.R
5 | import com.will.weiyuekotlin.bean.Channel
6 | import com.will.weiyuekotlin.database.ChannelDao
7 | import com.will.weiyuekotlin.ui.base.BasePresenter
8 | import com.will.weiyuekotlin.ui.news.contract.NewsContract
9 | import org.litepal.crud.DataSupport
10 | import java.util.*
11 | import javax.inject.Inject
12 |
13 |
14 | /**
15 | * desc: 新闻频道业务类.
16 | * author: Will .
17 | * date: 2017/9/7 .
18 | */
19 | class NewsPresenter @Inject
20 | constructor() : BasePresenter(), NewsContract.Presenter {
21 |
22 | /**
23 | * 获取频道列表
24 | */
25 | override fun getChannel() {
26 | var channelList: MutableList
27 | val myChannels = ArrayList()
28 | val otherChannels = ArrayList()
29 | channelList = ChannelDao.channels as MutableList
30 | when {
31 | channelList.size < 1 -> {
32 | val channelName = MyApp.instance.resources.getStringArray(R.array.news_channel)
33 | val channelId = MyApp.instance.resources.getStringArray(R.array.news_channel_id)
34 | val channels = ArrayList()
35 |
36 | for (i in channelName.indices) {
37 | val channel = Channel()
38 | channel.channelId = channelId[i].toString()
39 | channel.channelName = channelName[i].toString()
40 | channel.channelType = if (i < 1) 1 else 0 //默认第一个频道不可移除
41 | channel.isChannelSelect = i < channelName.size - 3 //默认后三个频道为未选中状态
42 | when {
43 | i < channelId.size - 3 -> myChannels.add(channel)
44 | else -> otherChannels.add(channel)
45 | }
46 | channels.add(channel)
47 | }
48 | //存入数据库
49 | DataSupport.saveAllAsync(channels)
50 | channelList = ArrayList()
51 | channelList.addAll(channels)
52 | }
53 | else -> {
54 | channelList = ChannelDao.channels as MutableList
55 | val iterator = channelList.iterator()
56 | while (iterator.hasNext()) {
57 | val channel = iterator.next()
58 | if (!channel.isChannelSelect) {
59 | otherChannels.add(channel)
60 | iterator.remove()
61 | }
62 | }
63 | myChannels.addAll(channelList)
64 | }
65 | }
66 |
67 | mView?.loadData(myChannels, otherChannels)
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/assets/anim/loading_.json:
--------------------------------------------------------------------------------
1 | {"v":"4.10.1","fr":30,"ip":0,"op":41,"w":300,"h":300,"nm":"合成 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"形状图层 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[180,156.5,0],"e":[100,156.5,0],"to":[-13.3333330154419,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":19,"s":[100,156.5,0],"e":[180,156.5,0],"to":[0,0,0],"ti":[-13.3333330154419,0,0]},{"t":40}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[40.916,40.916],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.114865059946,0.659905586991,0.980438112745,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[4.534,-3.114],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":900,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"形状图层 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[100,156.5,0],"e":[180,156.5,0],"to":[13.3333330154419,0,0],"ti":[0,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":19,"s":[180,156.5,0],"e":[100,156.5,0],"to":[0,0,0],"ti":[13.3333330154419,0,0]},{"t":40}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[40.916,40.916],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"椭圆路径 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"nm":"描边 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.145097994337,0.847059003045,0.654901960784,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[4.534,-3.114],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"椭圆 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":900,"st":0,"bm":0}]}
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/jandan/ImageBrowseActivity.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.jandan
2 |
3 | import android.app.Activity
4 | import android.content.Intent
5 | import android.os.Bundle
6 | import android.support.v4.content.ContextCompat
7 | import android.view.View
8 | import com.will.weiyuekotlin.R
9 | import com.will.weiyuekotlin.component.ApplicationComponent
10 | import com.will.weiyuekotlin.ui.base.BaseContract
11 | import com.will.weiyuekotlin.ui.base.BaseImageDrowseActivity
12 | import com.will.weiyuekotlin.utils.StatusBarUtil
13 | import com.will.weiyuekotlin.widget.SimpleMultiStateView
14 | import kotlinx.android.synthetic.main.activity_image_browse.*
15 | import java.io.Serializable
16 |
17 |
18 | /**
19 | * desc: 煎蛋 图片浏览.
20 | * author: Will .
21 | * date: 2017/12/11 .
22 | */
23 |
24 | class ImageBrowseActivity : BaseImageDrowseActivity() {
25 | private var imageUrls: List? = null
26 | private var selectedIndex: Int = 0
27 |
28 | companion object {
29 | fun launch(context: Activity, urls: List, selectedIndex: Int) {
30 | val intent = Intent(context, ImageBrowseActivity::class.java)
31 | intent.putExtra("urls", urls as Serializable)
32 | intent.putExtra("selectedIndex", selectedIndex)
33 | context.startActivity(intent)
34 | context.overridePendingTransition(R.anim.fade_in, R.anim.fade_out)
35 | }
36 | }
37 |
38 | override fun getContentLayout(): Int = R.layout.activity_image_browse
39 |
40 | override fun getSimpleMultiStateView(): SimpleMultiStateView? = null
41 |
42 | override fun initInjector(appComponent: ApplicationComponent) {}
43 |
44 | override fun bindView(view: View, savedInstanceState: Bundle?) {
45 | StatusBarUtil.setColor(this, ContextCompat.getColor(this, android.R.color.black))
46 | initView(rl_ImageBrowse, swipeLayout, viewPager)
47 | }
48 |
49 | override fun initData() {
50 | intent.extras?.let {
51 | imageUrls = intent.extras.getSerializable("urls") as List
52 | selectedIndex = intent.extras.getInt("selectedIndex")
53 | imageUrls?.let {
54 | initViewPager(this, it)
55 | viewPager.currentItem = selectedIndex
56 | tvPage.text = (selectedIndex + 1).toString() + " / " + it.size
57 | }
58 | }
59 | }
60 |
61 | /**
62 | * 图片点击回调
63 | */
64 | override fun onPhotoTap() {
65 | super.onPhotoTap()
66 | finish()
67 | }
68 |
69 | /**
70 | * ViewPager 滑动时更新文本内容
71 | *
72 | * @param position 下标
73 | */
74 | override fun setTvInfo(position: Int) {
75 | super.setTvInfo(position)
76 | tvPage.text = (position + 1).toString() + " / " + imageUrls?.size
77 | }
78 |
79 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/widget/ContextUtils.java:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.widget;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.WindowManager;
7 |
8 |
9 | public class ContextUtils {
10 | /**
11 | * 将px值转换为sp值,保证文字大小不变
12 | *
13 | * @param pxValue
14 | * @return
15 | */
16 | public static int px2sp(Context context, float pxValue) {
17 | final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
18 | return (int) (pxValue / fontScale + 0.5f);
19 | }
20 |
21 | /**
22 | * dip转换px
23 | */
24 | public static int dip2px(Context context, float dip) {
25 | final float scale = context.getResources().getDisplayMetrics().density;
26 | return (int) (dip * scale + 0.5f);
27 | }
28 |
29 | /**
30 | * px转dp
31 | *
32 | * @param context
33 | * @param pxVal
34 | * @return
35 | */
36 | public static float px2dp(Context context, float pxVal) {
37 | final float scale = context.getResources().getDisplayMetrics().density;
38 | return (pxVal / scale);
39 | }
40 |
41 | /**
42 | * px转dp
43 | *
44 | * @param context
45 | * @param pxVal
46 | * @return
47 | */
48 | public static int px2Dp(Context context, float pxVal) {
49 | final float scale = context.getResources().getDisplayMetrics().density;
50 | return (int) (pxVal / scale + 0.5f);
51 | }
52 |
53 | /**
54 | * 将sp值转换为px值,保证文字大小不变
55 | *
56 | * @param spValue
57 | * @param context (DisplayMetrics类中属性scaledDensity)
58 | * @return
59 | */
60 | public static int sp2px(Context context, float spValue) {
61 | final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
62 | return (int) (spValue * fontScale + 0.5f);
63 | }
64 |
65 | private static LayoutInflater inflater;
66 |
67 | public static View inflate(Context context, int res) {
68 | if (inflater == null) {
69 | inflater = LayoutInflater.from(context);
70 | }
71 | return inflater.inflate(res, null);
72 | }
73 |
74 | /**
75 | * 获取屏幕宽
76 | *
77 | * @param context
78 | * @return
79 | */
80 | public static int getSreenWidth(Context context) {
81 | WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
82 | return wm.getDefaultDisplay().getWidth();
83 | }
84 |
85 | /**
86 | * 获取屏幕高
87 | *
88 | * @param context
89 | * @return
90 | */
91 | public static int getSreenHeight(Context context) {
92 | WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
93 | return wm.getDefaultDisplay().getHeight();
94 | }
95 |
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_imagebrowse.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
21 |
22 |
23 |
24 |
31 |
32 |
40 |
41 |
53 |
54 |
55 |
56 |
69 |
70 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/base/SupportActivity.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.base
2 |
3 | import android.os.Bundle
4 | import android.view.MotionEvent
5 | import com.trello.rxlifecycle2.components.support.RxAppCompatActivity
6 | import me.yokeyword.fragmentation.*
7 | import me.yokeyword.fragmentation.anim.FragmentAnimator
8 |
9 |
10 | /**
11 | * desc: .
12 | * author: Will .
13 | * date: 2017/11/27 .
14 | */
15 | open abstract class SupportActivity : RxAppCompatActivity(), ISupportActivity {
16 | private val mDelegate = SupportActivityDelegate(this)
17 |
18 | override fun getSupportDelegate(): SupportActivityDelegate = mDelegate
19 |
20 | /**
21 | * Perform some extra transactions.
22 | * 额外的事务:自定义Tag,添加SharedElement动画,操作非回退栈Fragment
23 | */
24 | override fun extraTransaction(): ExtraTransaction = mDelegate.extraTransaction()
25 |
26 | override fun onCreate(savedInstanceState: Bundle?) {
27 | super.onCreate(savedInstanceState)
28 | mDelegate.onCreate(savedInstanceState)
29 | }
30 |
31 | override fun onPostCreate(savedInstanceState: Bundle?) {
32 | super.onPostCreate(savedInstanceState)
33 | mDelegate.onPostCreate(savedInstanceState)
34 | }
35 |
36 | override fun onDestroy() {
37 | mDelegate.onDestroy()
38 | super.onDestroy()
39 | }
40 |
41 | /**
42 | * Note: return mDelegate.dispatchTouchEvent(ev) || super.dispatchTouchEvent(ev);
43 | */
44 | override fun dispatchTouchEvent(ev: MotionEvent): Boolean = mDelegate.dispatchTouchEvent(ev) || super.dispatchTouchEvent(ev)
45 |
46 | /**
47 | * 不建议复写该方法,请使用 [.onBackPressedSupport] 代替
48 | */
49 | override fun onBackPressed() {
50 | mDelegate.onBackPressed()
51 | }
52 |
53 | /**
54 | * 该方法回调时机为,Activity回退栈内Fragment的数量 小于等于1 时,默认finish Activity
55 | * 请尽量复写该方法,避免复写onBackPress(),以保证SupportFragment内的onBackPressedSupport()回退事件正常执行
56 | */
57 | override fun onBackPressedSupport() {
58 | mDelegate.onBackPressedSupport()
59 | }
60 |
61 | /**
62 | * 获取设置的全局动画 copy
63 | *
64 | * @return FragmentAnimator
65 | */
66 | override fun getFragmentAnimator(): FragmentAnimator = mDelegate.fragmentAnimator
67 |
68 | /**
69 | * Set all fragments animation.
70 | * 设置Fragment内的全局动画
71 | */
72 | override fun setFragmentAnimator(fragmentAnimator: FragmentAnimator) {
73 | mDelegate.fragmentAnimator = fragmentAnimator
74 | }
75 |
76 | /**
77 | * Set all fragments animation.
78 | * 构建Fragment转场动画
79 | *
80 | *
81 | * 如果是在Activity内实现,则构建的是Activity内所有Fragment的转场动画,
82 | * 如果是在Fragment内实现,则构建的是该Fragment的转场动画,此时优先级 > Activity的onCreateFragmentAnimator()
83 | *
84 | * @return FragmentAnimator对象
85 | */
86 | override fun onCreateFragmentAnimator(): FragmentAnimator = mDelegate.onCreateFragmentAnimator()
87 |
88 |
89 | /**
90 | * 获取栈内的fragment对象
91 | */
92 | fun findFragment(fragmentClass: Class): T = SupportHelper.findFragment(supportFragmentManager, fragmentClass)
93 |
94 | }
95 |
96 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/utils/ImageLoaderUtil.java:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.utils;
2 |
3 | import android.content.Context;
4 | import android.widget.ImageView;
5 |
6 | import com.bumptech.glide.Glide;
7 | import com.bumptech.glide.load.engine.DiskCacheStrategy;
8 | import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
9 | import com.bumptech.glide.request.RequestListener;
10 | import com.bumptech.glide.request.RequestOptions;
11 | import com.bumptech.glide.request.target.ImageViewTarget;
12 |
13 | /**
14 | * desc: .
15 | * author: Will .
16 | * date: 2017/7/27 .
17 | */
18 | public class ImageLoaderUtil {
19 |
20 | /**
21 | * 常规使用
22 | *
23 | * @param context 上下文
24 | * @param url 图片链接
25 | * @param imageView 目标view
26 | */
27 | public static void LoadImage(Context context, Object url, ImageView imageView) {
28 | Glide.with(context).load(url)
29 | .apply(new RequestOptions()
30 | .centerCrop()
31 | .diskCacheStrategy(DiskCacheStrategy.ALL))
32 | .transition(new DrawableTransitionOptions().crossFade(800))
33 | .into(imageView);
34 | }
35 |
36 |
37 | /**
38 | * 自定义RequestOptions使用
39 | *
40 | * @param context 上下文
41 | * @param url 图片链接
42 | * @param requestOptions
43 | * @param imageView 目标view
44 | */
45 | public static void LoadImage(Context context, Object url, ImageView imageView, RequestOptions requestOptions) {
46 | Glide.with(context).load(url)
47 | .apply(requestOptions)
48 | .into(imageView);
49 | }
50 |
51 | /**
52 | * 自定义RequestOptions使用
53 | *
54 | * @param fragment
55 | * @param url 图片链接
56 | * @param requestOptions
57 | * @param imageView 目标view
58 | */
59 | public static void LoadImage(android.support.v4.app.Fragment fragment, Object url, ImageView imageView, RequestOptions requestOptions) {
60 | Glide.with(fragment).load(url)
61 | .apply(requestOptions)
62 | .into(imageView);
63 | }
64 |
65 |
66 | /**
67 | * 需要回调时使用
68 | *
69 | * @param context 上下文
70 | * @param url 图片链接
71 | * @param imageViewTarget 回调需求
72 | */
73 | public static void LoadImage(Context context, Object url, ImageViewTarget imageViewTarget) {
74 | Glide.with(context).load(url)
75 | .apply(new RequestOptions()
76 | .diskCacheStrategy(DiskCacheStrategy.ALL))
77 | .into(imageViewTarget);
78 | }
79 |
80 | /**
81 | * 需要回调时使用
82 | *
83 | * @param context 上下文
84 | * @param url 图片链接
85 | * @param imageView 回调需求
86 | */
87 | public static void LoadImage(Context context, Object url, ImageView imageView, RequestListener listener) {
88 | Glide.with(context).load(url)
89 | //.thumbnail(0.1f)
90 | .apply(new RequestOptions()
91 | .diskCacheStrategy(DiskCacheStrategy.ALL))
92 | .listener(listener)
93 | .into(imageView);
94 | }
95 |
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/WelcomeActivity.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin
2 |
3 | import android.content.Intent
4 | import android.os.Bundle
5 | import android.view.View
6 | import com.will.weiyuekotlin.component.ApplicationComponent
7 | import com.will.weiyuekotlin.ui.base.BaseActivity
8 | import com.will.weiyuekotlin.ui.base.BaseContract
9 | import com.will.weiyuekotlin.utils.ImageLoaderUtil
10 | import com.will.weiyuekotlin.widget.SimpleMultiStateView
11 | import io.reactivex.Observable
12 | import io.reactivex.android.schedulers.AndroidSchedulers
13 | import io.reactivex.disposables.CompositeDisposable
14 | import io.reactivex.observers.DisposableObserver
15 | import kotlinx.android.synthetic.main.activity_welcome.*
16 | import pl.droidsonroids.gif.GifDrawable
17 | import java.util.concurrent.TimeUnit
18 |
19 |
20 | /**
21 | * desc: 欢迎页面
22 | * author: Will .
23 | * date: 2017/12/11 .
24 | */
25 |
26 | class WelcomeActivity : BaseActivity() {
27 |
28 | //必应每日壁纸 来源于 https://www.dujin.org/fenxiang/jiaocheng/3618.html.
29 | private val picUrl = "http://api.dujin.org/bing/1920.php"
30 |
31 | private var mCompositeDisposable: CompositeDisposable? = CompositeDisposable()
32 |
33 | override fun getContentLayout(): Int = R.layout.activity_welcome
34 |
35 | override fun getSimpleMultiStateView(): SimpleMultiStateView? = null
36 |
37 | override fun initInjector(appComponent: ApplicationComponent) {
38 | }
39 |
40 | override fun bindView(view: View, savedInstanceState: Bundle?) {
41 | val gifDrawable = gifImageView.drawable as GifDrawable
42 | gifDrawable.loopCount = 1
43 | gifImageView.postDelayed({ gifDrawable.start() }, 100)
44 |
45 | ImageLoaderUtil.LoadImage(this, picUrl, iv_ad)
46 | mCompositeDisposable?.add(countDown(3)
47 | .doOnSubscribe({ tv_skip.text = "跳过 4" })
48 | .subscribeWith(object : DisposableObserver() {
49 | override fun onNext(t: Int) {
50 | tv_skip.text = "跳过${t + 1} "
51 | }
52 |
53 | override fun onError(e: Throwable) {
54 |
55 | }
56 |
57 | override fun onComplete() {
58 | toMain()
59 | }
60 | }))
61 |
62 | fl_ad.setOnClickListener { toMain() }
63 | }
64 |
65 | /**
66 | * 倒计时
67 | * @param time 秒
68 | */
69 | private fun countDown(time: Int): Observable {
70 | return Observable.interval(0, 1, TimeUnit.SECONDS)
71 | .observeOn(AndroidSchedulers.mainThread())
72 | .map { t -> time - t.toInt() }
73 | .take((time + 1).toLong())
74 | }
75 |
76 | /**
77 | * 跳转到 MainActivity 并取消订阅
78 | */
79 | private fun toMain() {
80 | mCompositeDisposable?.dispose()
81 | val intent = Intent()
82 | intent.setClass(this@WelcomeActivity, MainActivity::class.java)
83 | startActivity(intent)
84 | finish()
85 | }
86 |
87 | override fun onDestroy() {
88 | mCompositeDisposable?.dispose()
89 | super.onDestroy()
90 | }
91 |
92 | override fun initData() {
93 | }
94 |
95 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_detail_video.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
18 |
19 |
24 |
25 |
33 |
34 |
35 |
36 |
44 |
45 |
57 |
58 |
59 |
60 |
61 |
65 |
66 |
74 |
75 |
86 |
87 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin
2 |
3 | import android.os.Bundle
4 | import android.view.View
5 | import com.will.weiyuekotlin.component.ApplicationComponent
6 | import com.will.weiyuekotlin.ui.base.BaseActivity
7 | import com.will.weiyuekotlin.ui.base.BaseContract
8 | import com.will.weiyuekotlin.ui.base.SupportFragment
9 | import com.will.weiyuekotlin.ui.jandan.JanDanFragment
10 | import com.will.weiyuekotlin.ui.news.NewsFragment
11 | import com.will.weiyuekotlin.ui.personal.PersonalFragment
12 | import com.will.weiyuekotlin.ui.video.VideoFragment
13 | import com.will.weiyuekotlin.utils.StatusBarUtil
14 | import com.will.weiyuekotlin.widget.BottomBar
15 | import com.will.weiyuekotlin.widget.BottomBarTab
16 | import com.will.weiyuekotlin.widget.SimpleMultiStateView
17 | import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer
18 | import kotlinx.android.synthetic.main.activity_main.*
19 |
20 | class MainActivity : BaseActivity() {
21 |
22 | private val mFragments = arrayOfNulls(4)
23 |
24 | override fun getContentLayout(): Int = R.layout.activity_main
25 |
26 | override fun getSimpleMultiStateView(): SimpleMultiStateView? = null
27 |
28 | override fun initInjector(appComponent: ApplicationComponent) {}
29 |
30 | override fun bindView(view: View, savedInstanceState: Bundle?) {
31 | StatusBarUtil.setTranslucentForImageViewInFragment(this@MainActivity, 0, null)
32 | if (savedInstanceState == null) {
33 | mFragments[0] = NewsFragment.newInstance()
34 | mFragments[1] = VideoFragment.newInstance()
35 | mFragments[2] = JanDanFragment.newInstance()
36 | mFragments[3] = PersonalFragment.newInstance()
37 |
38 | supportDelegate.loadMultipleRootFragment(R.id.contentContainer, 0,
39 | mFragments[0],
40 | mFragments[1],
41 | mFragments[2],
42 | mFragments[3])
43 | } else {
44 | mFragments[0] = findFragment(NewsFragment::class.java)
45 | mFragments[1] = findFragment(VideoFragment::class.java)
46 | mFragments[2] = findFragment(JanDanFragment::class.java)
47 | mFragments[3] = findFragment(PersonalFragment::class.java)
48 | }
49 |
50 | mBootomBar.addItem(BottomBarTab(this, R.drawable.ic_news, "新闻"))
51 | .addItem(BottomBarTab(this, R.drawable.ic_video, "视频"))
52 | .addItem(BottomBarTab(this, R.drawable.ic_jiandan, "煎蛋"))
53 | .addItem(BottomBarTab(this, R.drawable.ic_my, "我的"))
54 |
55 | mBootomBar.setOnTabSelectedListener(object : BottomBar.OnTabSelectedListener {
56 | override fun onTabSelected(position: Int, prePosition: Int) {
57 | supportDelegate.showHideFragment(mFragments[position], mFragments[prePosition])
58 | }
59 |
60 | override fun onTabUnselected(position: Int) {
61 |
62 | }
63 |
64 | override fun onTabReselected(position: Int) {
65 |
66 | }
67 | })
68 |
69 | }
70 |
71 | override fun initData() {
72 |
73 | }
74 |
75 | override fun onBackPressedSupport() {
76 | if (JCVideoPlayer.backPress()) {
77 | return
78 | }
79 | super.onBackPressedSupport()
80 | }
81 |
82 | override fun onPause() {
83 | super.onPause()
84 | JCVideoPlayer.releaseAllVideos()
85 | }
86 |
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/ui/base/BaseFragment.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.ui.base
2 |
3 | import android.content.Context
4 | import android.os.Bundle
5 | import android.support.annotation.Nullable
6 | import android.view.LayoutInflater
7 | import android.view.View
8 | import android.view.ViewGroup
9 | import com.trello.rxlifecycle2.LifecycleTransformer
10 | import com.will.weiyuekotlin.MyApp
11 | import com.will.weiyuekotlin.R
12 | import com.will.weiyuekotlin.ui.listener.IBase
13 | import com.will.weiyuekotlin.utils.toast
14 | import com.will.weiyuekotlin.widget.SimpleMultiStateView
15 | import javax.inject.Inject
16 |
17 | /**
18 | * desc :
19 | * author: Will .
20 | * date: 2017/11/27 .
21 | */
22 | abstract class BaseFragment : SupportFragment(), IBase, BaseContract.BaseView {
23 |
24 | private lateinit var mContext: Context
25 | private var mRootView: View? = null
26 |
27 | @Nullable
28 | private var mSimpleMultiStateView: SimpleMultiStateView? = null
29 |
30 | @Nullable
31 | @Inject
32 | @JvmField
33 | var mPresenter: T1? = null
34 |
35 | override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
36 | if (mRootView != null) {
37 | val parent = mRootView!!.parent as ViewGroup
38 | parent.removeView(mRootView)
39 | } else {
40 | mRootView = inflater!!.inflate(getContentLayout(), container, false)
41 | }
42 | mContext = mRootView!!.context
43 | return mRootView
44 | }
45 |
46 | override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
47 | super.onViewCreated(view, savedInstanceState)
48 | initInjector(MyApp.mApplicationComponent)
49 | attachView()
50 | mSimpleMultiStateView = getSimpleMultiStateView()
51 | bindView(view!!, savedInstanceState)
52 | initStateView()
53 | }
54 |
55 | override fun onLazyInitView(savedInstanceState: Bundle?) {
56 | super.onLazyInitView(savedInstanceState)
57 | initData()
58 | }
59 |
60 | private fun attachView() {
61 | mPresenter?.attachView(this)
62 | }
63 |
64 | override fun onRetry() {
65 |
66 | }
67 |
68 | private fun initStateView() {
69 | mSimpleMultiStateView?.setEmptyResource(R.layout.view_empty)
70 | ?.setRetryResource(R.layout.view_retry)
71 | ?.setLoadingResource(R.layout.view_loading)
72 | ?.setNoNetResource(R.layout.view_nonet)
73 | ?.build()
74 | ?.setOnReLoadListener { onRetry() }
75 | }
76 |
77 | override fun showLoading() {
78 | mSimpleMultiStateView?.showLoadingView()
79 | }
80 |
81 | override fun showSuccess() {
82 | mSimpleMultiStateView?.showContent()
83 | }
84 |
85 | override fun showError() {
86 | mSimpleMultiStateView?.showErrorView()
87 | }
88 |
89 | override fun showNoNet() {
90 | mSimpleMultiStateView?.showNoNetView()
91 | }
92 |
93 | protected fun toast(string: String) {
94 | toast(activity, string)
95 | }
96 |
97 | override fun bindToLife(): LifecycleTransformer {
98 | return this.bindToLifecycle()
99 | }
100 |
101 | override fun onDestroy() {
102 | super.onDestroy()
103 | mPresenter?.detachView()
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/app/src/main/java/com/will/weiyuekotlin/bean/FreshNewsBean.kt:
--------------------------------------------------------------------------------
1 | package com.will.weiyuekotlin.bean
2 |
3 | import java.io.Serializable
4 |
5 | /**
6 | * desc: .
7 | * author: Will .
8 | * date: 2017/9/27 .
9 | */
10 | class FreshNewsBean : Serializable {
11 |
12 | /**
13 | * status : ok
14 | * count : 24
15 | * count_total : 61393
16 | * pages : 2559
17 | * posts : [{"id":89822,"url":"http://i.jandan.net/2017/07/25/mirror-x2.html","title":"半夜背后凉飕飕:镜子 两则","excerpt":"两个关于镜子的小故事。","date":"2017-07-25 23:45:59","tags":[{"id":969,"slug":"%e6%95%85%e4%ba%8b","title":"故事","description":"","post_count":90}],"author":{"id":677,"slug":"tunshu","name":"喵熊汪太狼","first_name":"","last_name":"","nickname":"喵熊汪太狼","url":"","description":""},"comment_count":20,"comment_status":"open","custom_fields":{"thumb_c":["http://img.jandan.net/news/2017/07/e449082796cbc599bbe08a93a05fa6ee.jpg"]}}]
18 | */
19 |
20 | var status: String? = null
21 | var count: Int = 0
22 | var count_total: Int = 0
23 | var pages: Int = 0
24 | var posts: MutableList? = null
25 |
26 | class PostsBean : JdBaseBean(), Serializable {
27 | /**
28 | * id : 89822
29 | * url : http://i.jandan.net/2017/07/25/mirror-x2.html
30 | * title : 半夜背后凉飕飕:镜子 两则
31 | * excerpt : 两个关于镜子的小故事。
32 | * date : 2017-07-25 23:45:59
33 | * tags : [{"id":969,"slug":"%e6%95%85%e4%ba%8b","title":"故事","description":"","post_count":90}]
34 | * author : {"id":677,"slug":"tunshu","name":"喵熊汪太狼","first_name":"","last_name":"","nickname":"喵熊汪太狼","url":"","description":""}
35 | * comment_count : 20
36 | * comment_status : open
37 | * custom_fields : {"thumb_c":["http://img.jandan.net/news/2017/07/e449082796cbc599bbe08a93a05fa6ee.jpg"]}
38 | */
39 |
40 | var id: Int = 0
41 | var url: String? = null
42 | var title: String? = null
43 | var excerpt: String? = null
44 | var date: String? = null
45 | var author: AuthorBean? = null
46 | var comment_count: Int = 0
47 | var comment_status: String? = null
48 | var custom_fields: CustomFieldsBean? = null
49 | var tags: List? = null
50 |
51 | class AuthorBean : Serializable {
52 | /**
53 | * id : 677
54 | * slug : tunshu
55 | * name : 喵熊汪太狼
56 | * first_name :
57 | * last_name :
58 | * nickname : 喵熊汪太狼
59 | * url :
60 | * description :
61 | */
62 |
63 | var id: Int = 0
64 | var slug: String? = null
65 | var name: String? = null
66 | var first_name: String? = null
67 | var last_name: String? = null
68 | var nickname: String? = null
69 | var url: String? = null
70 | var description: String? = null
71 | }
72 |
73 | class CustomFieldsBean : Serializable {
74 | var thumb_c: List? = null
75 | }
76 |
77 | class TagsBean : Serializable {
78 | /**
79 | * id : 969
80 | * slug : %e6%95%85%e4%ba%8b
81 | * title : 故事
82 | * description :
83 | * post_count : 90
84 | */
85 |
86 | var id: Int = 0
87 | var slug: String? = null
88 | var title: String? = null
89 | var description: String? = null
90 | var post_count: Int = 0
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------