├── app
├── .gitignore
├── libs
│ ├── armeabi
│ │ ├── libijksdl.so
│ │ ├── libijkffmpeg.so
│ │ └── libijkplayer.so
│ └── ijkplayer-java-release.aar
├── src
│ └── main
│ │ ├── res
│ │ ├── drawable-xxhdpi
│ │ │ ├── vol.png
│ │ │ ├── home.png
│ │ │ ├── live.png
│ │ │ ├── user.png
│ │ │ ├── video.png
│ │ │ ├── follow.png
│ │ │ ├── followed.png
│ │ │ ├── l_follow.png
│ │ │ ├── loading.png
│ │ │ ├── bg_splash.png
│ │ │ ├── brightness.png
│ │ │ ├── logo_icon.png
│ │ │ ├── not_showed.png
│ │ │ ├── pull_arrow.png
│ │ │ ├── home_pressed.png
│ │ │ ├── home_selected.png
│ │ │ ├── icon_setting.png
│ │ │ ├── image_loading.png
│ │ │ ├── live_pressed.png
│ │ │ ├── live_selected.png
│ │ │ ├── pagefailed_bg.png
│ │ │ ├── user_pressed.png
│ │ │ ├── user_selected.png
│ │ │ ├── follow_pressed.png
│ │ │ ├── follow_selected.png
│ │ │ ├── loading_play_1.png
│ │ │ ├── loading_play_2.png
│ │ │ ├── loading_play_3.png
│ │ │ ├── loading_play_4.png
│ │ │ ├── page_icon_empty.png
│ │ │ ├── refresh_success.png
│ │ │ ├── video_selected.png
│ │ │ ├── icon_video_first.png
│ │ │ ├── l_follow_pressed.png
│ │ │ ├── pad_play_opendanmu.png
│ │ │ ├── page_icon_network.png
│ │ │ ├── video_back_normal.png
│ │ │ ├── video_back_press.png
│ │ │ ├── video_pause_normal.png
│ │ │ ├── video_pause_press.png
│ │ │ ├── video_play_normal.png
│ │ │ ├── video_play_press.png
│ │ │ ├── image_about_backage.png
│ │ │ ├── image_search_normal.png
│ │ │ ├── pad_play_closedanmu.png
│ │ │ ├── ic_favorite_white_36dp.png
│ │ │ ├── icon_full_screen_normal.png
│ │ │ └── icon_full_screen_pressed.png
│ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-hdpi
│ │ │ ├── ic_battery_0.png
│ │ │ ├── ic_battery_10.png
│ │ │ ├── ic_battery_100.png
│ │ │ ├── ic_battery_20.png
│ │ │ ├── ic_battery_40.png
│ │ │ ├── ic_battery_60.png
│ │ │ ├── ic_battery_80.png
│ │ │ ├── icon_launcher.png
│ │ │ ├── video_progress_thumb.png
│ │ │ ├── video_seekbar_bg.9.png
│ │ │ ├── video_seekbar_progress.png
│ │ │ └── bg_video_volume_control.9.png
│ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── color
│ │ │ ├── primary_text_light.xml
│ │ │ ├── primary_text_material_dark.xml
│ │ │ └── primary_text_material_light.xml
│ │ ├── values
│ │ │ ├── values.xml
│ │ │ ├── dimens.xml
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── drawable
│ │ │ ├── btn_bottom_text_selector.xml
│ │ │ ├── splash.xml
│ │ │ ├── video_follow_selector.xml
│ │ │ ├── video_back_selector.xml
│ │ │ ├── video_play_selector.xml
│ │ │ ├── video_pause_selector.xml
│ │ │ ├── textcolor_selector.xml
│ │ │ ├── video_fullscreen_selector.xml
│ │ │ ├── btn_bottom_home_selector.xml
│ │ │ ├── btn_bottom_live_selector.xml
│ │ │ ├── btn_bottom_channels_selector.xml
│ │ │ ├── btn_bottom_like_selector.xml
│ │ │ ├── btn_bottom_setting_selector.xml
│ │ │ ├── loading_anim.xml
│ │ │ ├── rounded_rectangle_bg.xml
│ │ │ └── progress_video.xml
│ │ ├── anim
│ │ │ ├── rotate_up.xml
│ │ │ └── rotate_down.xml
│ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ ├── menu
│ │ │ └── main_menu.xml
│ │ ├── layout
│ │ │ ├── activity_splash.xml
│ │ │ ├── channels_item.xml
│ │ │ ├── toolbar.xml
│ │ │ ├── fragment_channals_list.xml
│ │ │ ├── fragment_live_list.xml
│ │ │ ├── activity_home.xml
│ │ │ ├── view_statelayout.xml
│ │ │ ├── activity_channel.xml
│ │ │ ├── layout_classic_footer.xml
│ │ │ ├── widget_bar.xml
│ │ │ ├── activity_search.xml
│ │ │ ├── layout_classic_header.xml
│ │ │ ├── room_info_item.xml
│ │ │ ├── video_top_pannel.xml
│ │ │ ├── fragment_setting.xml
│ │ │ ├── activity_play.xml
│ │ │ └── video_bottom_panel.xml
│ │ └── values-v21
│ │ │ └── styles.xml
│ │ ├── java
│ │ └── com
│ │ │ └── lcorekit
│ │ │ └── l
│ │ │ └── live
│ │ │ ├── commons
│ │ │ ├── AttentionConstants.java
│ │ │ ├── Pages.java
│ │ │ └── DebugLog.java
│ │ │ ├── mvp
│ │ │ ├── presenter
│ │ │ │ ├── LivePresenter.java
│ │ │ │ ├── SettingPresenter.java
│ │ │ │ ├── impl
│ │ │ │ │ ├── IChannelPresenter.java
│ │ │ │ │ ├── IRecommendPresenter.java
│ │ │ │ │ ├── ISearchPresenter.java
│ │ │ │ │ ├── IChannelInfoPreseter.java
│ │ │ │ │ ├── ISplahActivityPresenter.java
│ │ │ │ │ ├── IAttentionPresenter.java
│ │ │ │ │ ├── IChannelListPresenter.java
│ │ │ │ │ └── IPlayPresenter.java
│ │ │ │ ├── SplahActivityPresenter.java
│ │ │ │ ├── ChannelPresenter.java
│ │ │ │ ├── RecommendPresenter.java
│ │ │ │ ├── ChannelInfoPreseter.java
│ │ │ │ └── SearchPresenter.java
│ │ │ ├── view
│ │ │ │ ├── fragment
│ │ │ │ │ ├── impl
│ │ │ │ │ │ ├── SettingFragmentView.java
│ │ │ │ │ │ ├── LiveFragmentView.java
│ │ │ │ │ │ ├── ChannelsFragmentView.java
│ │ │ │ │ │ ├── RecommendFragmentView.java
│ │ │ │ │ │ └── AttentionFragmentView.java
│ │ │ │ │ ├── secondfragment
│ │ │ │ │ │ ├── CsGoFragment.java
│ │ │ │ │ │ ├── LoLFragment.java
│ │ │ │ │ │ ├── WoWFragment.java
│ │ │ │ │ │ ├── Dota2Fragment.java
│ │ │ │ │ │ ├── StarCraftFragment.java
│ │ │ │ │ │ └── HearthStoneFragment.java
│ │ │ │ │ ├── SettingFragment.java
│ │ │ │ │ └── LiveFragment.java
│ │ │ │ ├── activity
│ │ │ │ │ ├── impl
│ │ │ │ │ │ ├── SplashActivityView.java
│ │ │ │ │ │ ├── HomeActivityView.java
│ │ │ │ │ │ ├── ChannelInfoListActivityView.java
│ │ │ │ │ │ ├── SearchActivityView.java
│ │ │ │ │ │ └── PalyActivityView.java
│ │ │ │ │ ├── SplashActivity.java
│ │ │ │ │ ├── AboutActivity.java
│ │ │ │ │ └── HomeActivity.java
│ │ │ │ └── base
│ │ │ │ │ └── impl
│ │ │ │ │ └── ChannelListView.java
│ │ │ └── model
│ │ │ │ ├── impl
│ │ │ │ ├── IAttentionModel.java
│ │ │ │ └── IDouYuModel.java
│ │ │ │ ├── AttentionModel.java
│ │ │ │ └── DouYuModel.java
│ │ │ ├── bean
│ │ │ ├── SubChannelInfo.java
│ │ │ ├── RoomInfo.java
│ │ │ ├── DouyuRoom.java
│ │ │ ├── DouyuRoomInfo.java
│ │ │ ├── AllSubChannels.java
│ │ │ └── SubChannel.java
│ │ │ ├── utils
│ │ │ ├── NumberUtils.java
│ │ │ ├── Md5.java
│ │ │ ├── StringUtils.java
│ │ │ ├── LoadImage.java
│ │ │ ├── GreenDaoUtils.java
│ │ │ ├── CircleTransform.java
│ │ │ ├── DouYuApi.java
│ │ │ └── FileUtils.java
│ │ │ ├── danmu
│ │ │ ├── utils
│ │ │ │ ├── KeepGetMsg.java
│ │ │ │ ├── KeepAlive.java
│ │ │ │ └── FormatTransfer.java
│ │ │ └── msg
│ │ │ │ ├── DyEncoder.java
│ │ │ │ ├── MsgView.java
│ │ │ │ └── DyMessage.java
│ │ │ ├── widget
│ │ │ ├── RoundCornerImageView.java
│ │ │ ├── SquareLinearLayout.java
│ │ │ ├── media
│ │ │ │ ├── IMediaController.java
│ │ │ │ ├── FileMediaDataSource.java
│ │ │ │ ├── AndroidMediaController.java
│ │ │ │ ├── IRenderView.java
│ │ │ │ └── MediaPlayerCompat.java
│ │ │ ├── ClassicLoadMoreFooterView.java
│ │ │ └── ClassicRefreshHeaderView.java
│ │ │ ├── db
│ │ │ ├── bean
│ │ │ │ └── Person.java
│ │ │ ├── DaoSession.java
│ │ │ └── DaoMaster.java
│ │ │ ├── adapter
│ │ │ ├── BaseFragmentAdapter.java
│ │ │ ├── SubChannelAdapter.java
│ │ │ └── RoomInfoAdapter.java
│ │ │ └── App.java
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── screen-shot
├── Home.png
├── About.png
├── Home2.png
├── Play1.png
├── Play2.png
├── Attention.png
├── Channels.png
└── Setting.png
├── .idea
├── copyright
│ └── profiles_settings.xml
├── vcs.xml
├── modules.xml
├── runConfigurations.xml
├── compiler.xml
├── gradle.xml
└── misc.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── swipeback
├── libs
│ └── android-support-v4.jar
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── drawable-xhdpi
│ │ │ ├── shadow_bottom.png
│ │ │ ├── shadow_left.png
│ │ │ └── shadow_right.png
│ │ ├── layout
│ │ │ └── swipeback_layout.xml
│ │ └── values
│ │ │ ├── styles.xml
│ │ │ └── attrs.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── me
│ │ └── imid
│ │ └── swipebacklayout
│ │ └── lib
│ │ └── app
│ │ ├── SwipeBackActivityBase.java
│ │ ├── SwipeBackPreferenceActivity.java
│ │ ├── SwipeBackActivity.java
│ │ └── SwipeBackActivityHelper.java
└── build.gradle
├── .gitignore
├── gradle.properties
├── README.md
└── gradlew.bat
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':swipeback'
2 |
--------------------------------------------------------------------------------
/screen-shot/Home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/screen-shot/Home.png
--------------------------------------------------------------------------------
/screen-shot/About.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/screen-shot/About.png
--------------------------------------------------------------------------------
/screen-shot/Home2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/screen-shot/Home2.png
--------------------------------------------------------------------------------
/screen-shot/Play1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/screen-shot/Play1.png
--------------------------------------------------------------------------------
/screen-shot/Play2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/screen-shot/Play2.png
--------------------------------------------------------------------------------
/screen-shot/Attention.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/screen-shot/Attention.png
--------------------------------------------------------------------------------
/screen-shot/Channels.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/screen-shot/Channels.png
--------------------------------------------------------------------------------
/screen-shot/Setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/screen-shot/Setting.png
--------------------------------------------------------------------------------
/app/libs/armeabi/libijksdl.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/libs/armeabi/libijksdl.so
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/app/libs/armeabi/libijkffmpeg.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/libs/armeabi/libijkffmpeg.so
--------------------------------------------------------------------------------
/app/libs/armeabi/libijkplayer.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/libs/armeabi/libijkplayer.so
--------------------------------------------------------------------------------
/app/libs/ijkplayer-java-release.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/libs/ijkplayer-java-release.aar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/swipeback/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/swipeback/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/vol.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/vol.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/home.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/live.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/live.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/user.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/video.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/video.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/follow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/follow.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/followed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/followed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/l_follow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/l_follow.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/loading.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_battery_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-hdpi/ic_battery_0.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/bg_splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/bg_splash.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/brightness.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/brightness.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/logo_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/logo_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/not_showed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/not_showed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/pull_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/pull_arrow.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/swipeback/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_battery_10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-hdpi/ic_battery_10.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_battery_100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-hdpi/ic_battery_100.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_battery_20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-hdpi/ic_battery_20.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_battery_40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-hdpi/ic_battery_40.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_battery_60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-hdpi/ic_battery_60.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_battery_80.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-hdpi/ic_battery_80.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/icon_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-hdpi/icon_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/home_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/home_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/home_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/home_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_setting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/icon_setting.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/image_loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/image_loading.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/live_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/live_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/live_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/live_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/pagefailed_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/pagefailed_bg.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/user_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/user_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/user_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/user_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/follow_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/follow_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/follow_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/follow_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/loading_play_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/loading_play_1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/loading_play_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/loading_play_2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/loading_play_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/loading_play_3.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/loading_play_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/loading_play_4.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/page_icon_empty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/page_icon_empty.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/refresh_success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/refresh_success.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/video_selected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/video_selected.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/video_progress_thumb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-hdpi/video_progress_thumb.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/video_seekbar_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-hdpi/video_seekbar_bg.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_video_first.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/icon_video_first.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/l_follow_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/l_follow_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/pad_play_opendanmu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/pad_play_opendanmu.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/page_icon_network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/page_icon_network.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/video_back_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/video_back_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/video_back_press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/video_back_press.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/video_pause_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/video_pause_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/video_pause_press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/video_pause_press.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/video_play_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/video_play_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/video_play_press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/video_play_press.png
--------------------------------------------------------------------------------
/swipeback/src/main/res/drawable-xhdpi/shadow_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/swipeback/src/main/res/drawable-xhdpi/shadow_bottom.png
--------------------------------------------------------------------------------
/swipeback/src/main/res/drawable-xhdpi/shadow_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/swipeback/src/main/res/drawable-xhdpi/shadow_left.png
--------------------------------------------------------------------------------
/swipeback/src/main/res/drawable-xhdpi/shadow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/swipeback/src/main/res/drawable-xhdpi/shadow_right.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/video_seekbar_progress.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-hdpi/video_seekbar_progress.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/image_about_backage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/image_about_backage.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/image_search_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/image_search_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/pad_play_closedanmu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/pad_play_closedanmu.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-hdpi/bg_video_volume_control.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-hdpi/bg_video_volume_control.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_favorite_white_36dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/ic_favorite_white_36dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_full_screen_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/icon_full_screen_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/icon_full_screen_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LZzzzz/DouYuLiveSample/HEAD/app/src/main/res/drawable-xxhdpi/icon_full_screen_pressed.png
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/commons/AttentionConstants.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.commons;
2 |
3 | /**
4 | * Created by l on 17-1-14.
5 | */
6 |
7 | public class AttentionConstants {
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/LivePresenter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter;
2 |
3 | /**
4 | * Created by l on 16-12-30.
5 | */
6 |
7 | public class LivePresenter {
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/SettingPresenter.java:
--------------------------------------------------------------------------------
1 |
2 | package com.lcorekit.l.live.mvp.presenter;
3 |
4 | /**
5 | * Created by l on 16-12-30.
6 | */
7 |
8 | public class SettingPresenter {
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/fragment/impl/SettingFragmentView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.fragment.impl;
2 |
3 | /**
4 | * Created by l on 17-1-17.
5 | */
6 | public interface SettingFragmentView {
7 | }
8 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/impl/IChannelPresenter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter.impl;
2 |
3 | /**
4 | * Created by l on 17-1-2.
5 | */
6 | public interface IChannelPresenter {
7 | void getAllChannels();
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/activity/impl/SplashActivityView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.activity.impl;
2 |
3 | /**
4 | * Created by l on 16-12-31.
5 | */
6 | public interface SplashActivityView {
7 | void enterApp();
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/impl/IRecommendPresenter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter.impl;
2 |
3 | /**
4 | * Created by l on 17-1-5.
5 | */
6 | public interface IRecommendPresenter {
7 | void getRecommend(int offset);
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/res/color/primary_text_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/impl/ISearchPresenter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter.impl;
2 |
3 | /**
4 | * Created by l on 17-1-6.
5 | */
6 | public interface ISearchPresenter {
7 | void getSearchListResult(String keyword);
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/impl/IChannelInfoPreseter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter.impl;
2 |
3 | /**
4 | * Created by l on 17-1-9.
5 | */
6 | public interface IChannelInfoPreseter {
7 | void getChannelInfoList(int tag, int offset);
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/bean/SubChannelInfo.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.bean;
2 |
3 | /**
4 | * Created by l on 2016/12/31.
5 | */
6 | public class SubChannelInfo {
7 | public int tagId;
8 | public String tagName;
9 | public String iconUrl;
10 | }
11 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/values.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #ffffff
4 | #fafafa
5 | #fafafa
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/impl/ISplahActivityPresenter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter.impl;
2 |
3 | /**
4 | * Created by l on 16-12-31.
5 | */
6 | public interface ISplahActivityPresenter {
7 | void setDelay();
8 | void unRegister();
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_bottom_text_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/impl/IAttentionPresenter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter.impl;
2 |
3 | /**
4 | * Created by l on 17-1-15.
5 | */
6 | public interface IAttentionPresenter {
7 | void getAllRoomId();
8 |
9 | void getRoomInfoResult(String keyword);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/video_follow_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/video_back_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/video_play_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/swipeback/src/main/res/layout/swipeback_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/video_pause_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/textcolor_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/bean/RoomInfo.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.bean;
2 |
3 | /**
4 | * Created by l on 2017/01/02.
5 | */
6 | public class RoomInfo {
7 | public int roomId;
8 | public String roomSrc;
9 | public String roomName;
10 | public String nickname;
11 | public int online;
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/video_fullscreen_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/activity/impl/HomeActivityView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.activity.impl;
2 |
3 | import android.support.v4.app.Fragment;
4 |
5 | /**
6 | * Created by l on 16-12-31.
7 | */
8 | public interface HomeActivityView {
9 | void switchTab(Fragment fragment);
10 | void initView();
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/impl/IChannelListPresenter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter.impl;
2 |
3 | /**
4 | * Created by l on 17-1-5.
5 | */
6 | public interface IChannelListPresenter {
7 | void getChannelList(int channelid, int offset);
8 |
9 | // void getPlayerInfo(int roomId, String roomName);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/res/color/primary_text_material_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/color/primary_text_material_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/fragment/impl/LiveFragmentView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.fragment.impl;
2 |
3 | import android.support.v4.view.ViewPager;
4 |
5 | /**
6 | * Created by l on 17-1-4.
7 | */
8 | public interface LiveFragmentView {
9 | void initData();
10 | void setUpViewPager(ViewPager ViewPager);
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_bottom_home_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_bottom_live_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_bottom_channels_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_bottom_like_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_bottom_setting_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/rotate_up.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/bean/DouyuRoom.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.bean;
2 |
3 | /**
4 | * Created by mengshen on 2016/11/1.
5 | */
6 |
7 | public class DouyuRoom {
8 | public int error;
9 | public Data data;
10 |
11 |
12 | public static class Data {
13 | public int room_id;
14 | public String rtmp_url;
15 | public String rtmp_live;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/swipeback/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
--------------------------------------------------------------------------------
/swipeback/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/rotate_down.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/fragment/impl/ChannelsFragmentView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.fragment.impl;
2 |
3 |
4 | import com.lcorekit.l.live.bean.SubChannelInfo;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by l on 17-1-2.
10 | */
11 | public interface ChannelsFragmentView {
12 | void showData(List datas);
13 | void initView();
14 | void setRefresh();
15 | void setLoadmore();
16 | void swipeToLoadComplete();
17 | }
18 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/utils/NumberUtils.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.utils;
2 |
3 | import java.util.regex.Matcher;
4 | import java.util.regex.Pattern;
5 |
6 | /**
7 | * Created by l on 17-1-6.
8 | */
9 |
10 | public class NumberUtils {
11 | public static boolean isNumeric(String str) {
12 | Pattern pattern = Pattern.compile("[0-9]*");
13 | Matcher isNum = pattern.matcher(str);
14 | if (!isNum.matches()) {
15 | return false;
16 | }
17 | return true;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/bean/DouyuRoomInfo.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.bean;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by l on 2017/01/02.
7 | */
8 | public class DouyuRoomInfo {
9 |
10 | public int error;
11 | public Data data;
12 |
13 | public static class Data {
14 | public List room;
15 | }
16 | // public int error;
17 | //
18 | // public Data data;
19 | //
20 | // public static class Data {
21 | // public List room;
22 | // }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/model/impl/IAttentionModel.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.model.impl;
2 |
3 |
4 | import com.lcorekit.l.live.db.bean.Person;
5 |
6 | import java.util.List;
7 |
8 | import rx.Observable;
9 |
10 | /**
11 | * Created by l on 17-1-14.
12 | */
13 | public interface IAttentionModel {
14 | Observable insertData(Person person);
15 |
16 | Observable deleteData(Person person);
17 |
18 | Observable> queryAll();
19 |
20 | Observable query(Person person);
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/base/impl/ChannelListView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.base.impl;
2 |
3 |
4 | import com.lcorekit.l.live.bean.RoomInfo;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by l on 17-1-5.
10 | */
11 | public interface ChannelListView {
12 | void showData(List datas);
13 |
14 | void initView();
15 |
16 | void setRefresh();
17 |
18 | void setLoadmore();
19 |
20 | void swipeToLoadComplete();
21 |
22 | void startPlay(String roomName, int roomId);
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/activity/impl/ChannelInfoListActivityView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.activity.impl;
2 |
3 |
4 | import com.lcorekit.l.live.bean.RoomInfo;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by l on 17-1-9.
10 | */
11 | public interface ChannelInfoListActivityView {
12 | void initView();
13 | void showData(List datas);
14 | void setRefresh();
15 | void setLoadmore();
16 | void swipeToLoadComplete();
17 | void startPlay(String roomName, int roomId);
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/danmu/utils/KeepGetMsg.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.danmu.utils;
2 |
3 |
4 | import com.lcorekit.l.live.danmu.client.DyBulletScreenClient;
5 |
6 | public class KeepGetMsg extends Thread {
7 | @Override
8 | public void run() {
9 | ////获取弹幕客户端
10 | DyBulletScreenClient danmuClient = DyBulletScreenClient.getInstance();
11 |
12 | //判断客户端就绪状态
13 | while (danmuClient.getReadyFlag()) {
14 | //获取服务器发送的弹幕信息
15 | danmuClient.getServerMsg();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/activity/impl/SearchActivityView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.activity.impl;
2 |
3 |
4 | import com.lcorekit.l.live.bean.RoomInfo;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by l on 17-1-5.
10 | */
11 | public interface SearchActivityView {
12 | void initView();
13 | void hiddenKyBroad();
14 | void showData(List datas);
15 | void setRefresh();
16 | void setLoadmore();
17 | void swipeToLoadComplete();
18 | void startPlay(String roomName, int roomId);
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/fragment/impl/RecommendFragmentView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.fragment.impl;
2 |
3 |
4 | import com.lcorekit.l.live.bean.RoomInfo;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by l on 17-1-3.
10 | */
11 | public interface RecommendFragmentView {
12 | void showData(List datas);
13 |
14 | void initView();
15 |
16 | void setRefresh();
17 |
18 | void setLoadmore();
19 |
20 | void swipeToLoadComplete();
21 |
22 | void startPlay(String roomName, int roomId);
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/model/impl/IDouYuModel.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.model.impl;
2 |
3 | import rx.Observable;
4 |
5 | /**
6 | * Created by l on 17-1-2.
7 | */
8 | public interface IDouYuModel {
9 | Observable ChannelsGet();
10 |
11 | Observable ChannelListGet(int channelid, int offset);
12 |
13 | Observable RecommendGet(int offset);
14 |
15 | Observable SearchGet(String keyword);
16 |
17 | Observable PlyerInfoGet(int roomId);
18 |
19 | Observable ChannelInfoGet(int tag, int offset);
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/impl/IPlayPresenter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter.impl;
2 |
3 |
4 | import com.lcorekit.l.live.db.bean.Person;
5 |
6 | /**
7 | * Created by l on 17-1-10.
8 | */
9 | public interface IPlayPresenter {
10 | void getSystemTime();
11 |
12 | void unRigister();
13 |
14 | void autoHidePanel();
15 |
16 | void getPlayerInfo(int roomId);
17 |
18 | void dismissVolAlpha();
19 |
20 | void showAttention(Person person);
21 |
22 | void insertPerson(Person person);
23 |
24 | void deletePerson(Person person);
25 | }
26 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/activity/impl/PalyActivityView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.activity.impl;
2 |
3 | /**
4 | * Created by l on 17-1-7.
5 | */
6 | public interface PalyActivityView {
7 | void showPanel();
8 |
9 | void hidePanel();
10 |
11 | void initData();
12 |
13 | void updateSystemTime();
14 |
15 | void playVideo(String url);
16 |
17 | void onVolumeSlide(float percent);
18 |
19 | void onBrightnessSlide(float percent);
20 |
21 | void hideVolAlpha();
22 |
23 | void playDanmu();
24 |
25 | void showAttention(boolean isAttention);
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/loading_anim.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
10 |
13 |
16 |
--------------------------------------------------------------------------------
/swipeback/src/main/java/me/imid/swipebacklayout/lib/app/SwipeBackActivityBase.java:
--------------------------------------------------------------------------------
1 | package me.imid.swipebacklayout.lib.app;
2 |
3 | import me.imid.swipebacklayout.lib.SwipeBackLayout;
4 | /**
5 | * @author Yrom
6 | */
7 | public interface SwipeBackActivityBase {
8 | /**
9 | * @return the SwipeBackLayout associated with this activity.
10 | */
11 | public abstract SwipeBackLayout getSwipeBackLayout();
12 |
13 | public abstract void setSwipeBackEnable(boolean enable);
14 |
15 | /**
16 | * Scroll out contentView and finish the activity
17 | */
18 | public abstract void scrollToFinishActivity();
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 0.5dp
6 | 48dp
7 |
8 |
9 | 60dp
10 | 80dp
11 | 60dp
12 | 5dp
13 | 16dp
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/rounded_rectangle_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
15 |
16 |
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/fragment/impl/AttentionFragmentView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.fragment.impl;
2 |
3 |
4 | import com.lcorekit.l.live.bean.RoomInfo;
5 | import com.lcorekit.l.live.db.bean.Person;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by l on 17-1-15.
11 | */
12 | public interface AttentionFragmentView {
13 |
14 | void showData(List datas);
15 |
16 | void initView();
17 |
18 | void setRefresh();
19 |
20 | void setLoadmore();
21 |
22 | void swipeToLoadComplete();
23 |
24 | void startPlay(String roomName, int roomId);
25 |
26 | void getAllRoomInfo(List roomInfos);
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF630E
4 | #D54B00
5 | #ff630e
6 | #E0E0E0
7 |
8 |
9 | #fff
10 | #66000000
11 | #fff
12 |
13 | #fff
14 | #EBEBEB
15 | #efefef
16 | #fafafa
17 |
18 |
--------------------------------------------------------------------------------
/swipeback/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/bean/AllSubChannels.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.bean;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by l on 2016/12/31.
7 | */
8 | public class AllSubChannels {
9 | public List data;
10 |
11 | public static class Data {
12 | public int tag_id;
13 | public String tag_name;
14 | public String icon_url;
15 |
16 | @Override
17 | public String toString() {
18 | return "Data [tag_id=" + tag_id + ", tag_name="
19 | + tag_name + ", icon_url=" + icon_url + "]";
20 | }
21 | }
22 |
23 | @Override
24 | public String toString() {
25 | return "AllSubChannels [data=" + data + "]";
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /home/l/Android/Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | -keepattributes EnclosingMethod
20 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/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/main/res/layout/channels_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/bean/SubChannel.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.bean;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by l on 2017/01/02.
7 | */
8 |
9 | public class SubChannel {
10 | public List data;
11 |
12 | public static class Room {
13 |
14 | public int room_id;
15 | public String room_src;
16 | public String roomSrc;
17 | public String room_name;
18 | public String nickname;
19 | public int online;
20 | }
21 | // public List data;
22 | //
23 | // public static class Room {
24 | // public int room_id;
25 | // public String room_src;
26 | // public String roomSrc;
27 | // public String room_name;
28 | // public String nick_name;
29 | // public int online;
30 | // }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/fragment/secondfragment/CsGoFragment.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.fragment.secondfragment;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.lcorekit.l.live.mvp.view.base.BaseFragment;
6 |
7 |
8 | /**
9 | * Created by l on 16-12-31.
10 | */
11 |
12 | public class CsGoFragment extends BaseFragment {
13 |
14 | private static CsGoFragment fragment = null;
15 |
16 | public static CsGoFragment getInstance(int type) {
17 | Bundle args = new Bundle();
18 | fragment = new CsGoFragment();
19 | args.putInt("type", type);
20 | fragment.setArguments(args);
21 | return fragment;
22 | }
23 |
24 | @Override
25 | public int getType() {
26 | Bundle arguments = fragment.getArguments();
27 | return arguments.getInt("type");
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/fragment/secondfragment/LoLFragment.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.fragment.secondfragment;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.lcorekit.l.live.mvp.view.base.BaseFragment;
6 |
7 |
8 | /**
9 | * Created by l on 16-12-31.
10 | */
11 |
12 | public class LoLFragment extends BaseFragment {
13 |
14 | private static LoLFragment fragment = null;
15 |
16 | public static LoLFragment getInstance(int type) {
17 | Bundle args = new Bundle();
18 | fragment = new LoLFragment();
19 | args.putInt("type", type);
20 | fragment.setArguments(args);
21 | return fragment;
22 | }
23 |
24 | @Override
25 | public int getType() {
26 | Bundle arguments = fragment.getArguments();
27 | return arguments.getInt("type");
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/fragment/secondfragment/WoWFragment.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.fragment.secondfragment;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.lcorekit.l.live.mvp.view.base.BaseFragment;
6 |
7 |
8 | /**
9 | * Created by l on 16-12-31.
10 | */
11 |
12 | public class WoWFragment extends BaseFragment {
13 |
14 | private static WoWFragment fragment = null;
15 |
16 | public static WoWFragment getInstance(int type) {
17 | Bundle args = new Bundle();
18 | fragment = new WoWFragment();
19 | args.putInt("type", type);
20 | fragment.setArguments(args);
21 | return fragment;
22 | }
23 |
24 |
25 | @Override
26 | public int getType() {
27 | Bundle arguments = fragment.getArguments();
28 | return arguments.getInt("type");
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/fragment/secondfragment/Dota2Fragment.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.fragment.secondfragment;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.lcorekit.l.live.mvp.view.base.BaseFragment;
6 |
7 |
8 | /**
9 | * Created by l on 16-12-31.
10 | */
11 |
12 | public class Dota2Fragment extends BaseFragment {
13 |
14 | private static Dota2Fragment fragment = null;
15 |
16 | public static Dota2Fragment getInstance(int type) {
17 | Bundle args = new Bundle();
18 | fragment = new Dota2Fragment();
19 | args.putInt("type", type);
20 | fragment.setArguments(args);
21 | return fragment;
22 | }
23 |
24 | @Override
25 | public int getType() {
26 | Bundle arguments = fragment.getArguments();
27 | return arguments.getInt("type");
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/danmu/utils/KeepAlive.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.danmu.utils;
2 |
3 |
4 | import com.lcorekit.l.live.danmu.client.DyBulletScreenClient;
5 |
6 | public class KeepAlive extends Thread {
7 | @Override
8 | public void run()
9 | {
10 | //获取弹幕客户端
11 | DyBulletScreenClient danmuClient = DyBulletScreenClient.getInstance();
12 |
13 | //判断客户端就绪状态
14 | while(danmuClient.getReadyFlag())
15 | {
16 | //发送心跳保持协议给服务器端
17 | danmuClient.keepAlive();
18 | try
19 | {
20 | //设置间隔45秒再发送心跳协议
21 | Thread.sleep(45000); //keep live at least once per minute
22 | }
23 | catch (Exception e)
24 | {
25 | e.printStackTrace();
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/fragment/secondfragment/StarCraftFragment.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.fragment.secondfragment;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.lcorekit.l.live.mvp.view.base.BaseFragment;
6 |
7 |
8 | /**
9 | * Created by l on 16-12-31.
10 | */
11 |
12 | public class StarCraftFragment extends BaseFragment {
13 |
14 | private static StarCraftFragment fragment = null;
15 |
16 | public static StarCraftFragment getInstance(int type) {
17 | Bundle args = new Bundle();
18 | fragment = new StarCraftFragment();
19 | args.putInt("type", type);
20 | fragment.setArguments(args);
21 | return fragment;
22 | }
23 |
24 |
25 | @Override
26 | public int getType() {
27 | Bundle arguments = fragment.getArguments();
28 | return arguments.getInt("type");
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/commons/Pages.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.commons;
2 |
3 | /**
4 | * Created by l on 16-12-31.
5 | */
6 |
7 | public class Pages {
8 | public final static int HOT_PAGE = 0;
9 | public final static int LIVE_PAGE = 1;
10 | public final static int CHANNELS_PAGE = 2;
11 | public final static int LIKE_PAGE = 3;
12 | public final static int SETTING_PAGE = 4;
13 |
14 | /**
15 | * 子频道
16 | */
17 | public final static int LOL_PAGE = 1;
18 | public final static int HEARTHSTONE_PAGE = 2;
19 | public final static int DOTA2_PAGE = 3;
20 | public final static int STARCRAFT_PAGE = 4;
21 | public final static int WOW_PAGE = 5;
22 | public final static int CSGO_PAGE = 6;
23 |
24 | public final static String[] TITLES = new String[]{
25 | "英雄联盟", "炉石传说", "Dota2", "星际争霸", "魔兽世界", "CS:GO"
26 | };
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/fragment/secondfragment/HearthStoneFragment.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.fragment.secondfragment;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.lcorekit.l.live.mvp.view.base.BaseFragment;
6 |
7 |
8 | /**
9 | * Created by l on 16-12-31.
10 | */
11 |
12 | public class HearthStoneFragment extends BaseFragment {
13 |
14 | private static HearthStoneFragment fragment = null;
15 |
16 | public static HearthStoneFragment getInstance(int type) {
17 | Bundle args = new Bundle();
18 | fragment = new HearthStoneFragment();
19 | args.putInt("type", type);
20 | fragment.setArguments(args);
21 | return fragment;
22 | }
23 |
24 |
25 | @Override
26 | public int getType() {
27 | Bundle arguments = fragment.getArguments();
28 | return arguments.getInt("type");
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/utils/Md5.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.utils;
2 |
3 | import java.security.MessageDigest;
4 | import java.security.NoSuchAlgorithmException;
5 |
6 | public class Md5 {
7 | public static String strToMd5Low32(String str) {
8 | StringBuilder builder = new StringBuilder();
9 | try {
10 | MessageDigest md5 = MessageDigest.getInstance("MD5");
11 | md5.update(str.getBytes());
12 | byte[] bytes = md5.digest();
13 | for (byte b : bytes) {
14 | int digital = b&0xff;
15 | if (digital < 16)
16 | builder.append(0);
17 | builder.append(Integer.toHexString(digital));
18 | }
19 | } catch (NoSuchAlgorithmException e) {
20 | e.printStackTrace();
21 | }
22 | return builder.toString().toLowerCase();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_channals_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
18 |
19 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_live_list.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
12 |
13 |
18 |
19 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/danmu/msg/DyEncoder.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.danmu.msg;
2 |
3 |
4 | public class DyEncoder {
5 | private StringBuffer buf = new StringBuffer();
6 |
7 | /**
8 | * 返回弹幕协议格式化后的结果
9 | * @return
10 | */
11 | public String getResult()
12 | {
13 | //数据包末尾必须以'\0'结尾
14 | buf.append('\0');
15 | return buf.toString();
16 | }
17 |
18 | /**
19 | * 添加协议参数项
20 | * @param key
21 | * @param value
22 | */
23 | public void addItem(String key, Object value)
24 | {
25 | //根据斗鱼弹幕协议进行相应的编码处理
26 | buf.append(key.replaceAll("/", "@S").replaceAll("@", "@A"));
27 | buf.append("@=");
28 | if(value instanceof String){
29 | buf.append(((String)value).replaceAll("/", "@S").replaceAll("@", "@A"));
30 | }else if(value instanceof Integer){
31 | buf.append(value);
32 | }
33 | buf.append("/");
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/widget/RoundCornerImageView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.widget;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Path;
6 | import android.graphics.RectF;
7 | import android.util.AttributeSet;
8 | import android.widget.ImageView;
9 |
10 | public class RoundCornerImageView extends ImageView {
11 | public RoundCornerImageView(Context context) {
12 | super(context);
13 | }
14 |
15 | public RoundCornerImageView(Context context, AttributeSet attrs) {
16 | super(context, attrs);
17 | }
18 |
19 | public RoundCornerImageView(Context context, AttributeSet attrs,
20 | int defStyle) {
21 | super(context, attrs, defStyle);
22 | }
23 |
24 | @Override
25 | protected void onDraw(Canvas canvas) {
26 | Path clipPath = new Path();
27 | int w = this.getWidth();
28 | int h = this.getHeight();
29 | clipPath.addRoundRect(new RectF(0, 0, w, h), 10.0f, 10.0f, Path.Direction.CW);
30 | canvas.clipPath(clipPath);
31 | super.onDraw(canvas);
32 | }
33 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/utils/StringUtils.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.utils;
2 |
3 | import java.text.SimpleDateFormat;
4 | import java.util.Date;
5 |
6 | /**
7 | * Created by fullcircle on 2016/12/6.
8 | */
9 |
10 | public class StringUtils {
11 | public static int hour = 1000 * 60 * 60;
12 | public static int minute = 1000 * 60;
13 | public static int second = 1000;
14 |
15 | public static String formatMediaTime(int millsec) {
16 | //"hh:mm:ss"
17 | //"mm:ss"
18 | int h = millsec / hour;
19 | int m = millsec % hour / minute;
20 | int sec = millsec % minute / second;
21 |
22 | if (h > 0) {
23 | //"hh:mm:ss" "1:36:2"
24 | return String.format("%02d:%02d:%02d", h, m, sec);
25 | } else {
26 | return String.format("%02d:%02d", m, sec);
27 | }
28 | }
29 |
30 | /**
31 | * 获取当前系统时间 返回格式"HH:mm:ss"
32 | *
33 | * @return
34 | */
35 | public static String formatSystemTime() {
36 | SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
37 | return format.format(new Date());
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/widget/SquareLinearLayout.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.widget;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.LinearLayout;
6 |
7 | /**
8 | *
9 | * Created by l on 2016/12/31.
10 | */
11 | public class SquareLinearLayout extends LinearLayout {
12 | public SquareLinearLayout(Context context) {
13 | super(context);
14 | }
15 |
16 | public SquareLinearLayout(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | }
19 |
20 | public SquareLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
21 | super(context, attrs, defStyleAttr);
22 | }
23 |
24 | @Override
25 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
26 | setMeasuredDimension(getDefaultSize(0, widthMeasureSpec),
27 | getDefaultSize(0, heightMeasureSpec));
28 | int childWidthSize = getMeasuredWidth();
29 | heightMeasureSpec = widthMeasureSpec = MeasureSpec.makeMeasureSpec(
30 | childWidthSize, MeasureSpec.EXACTLY);
31 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/db/bean/Person.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.db.bean;
2 |
3 | import org.greenrobot.greendao.annotation.Entity;
4 | import org.greenrobot.greendao.annotation.Id;
5 | import org.greenrobot.greendao.annotation.Generated;
6 |
7 | /**
8 | * Created by l on 17-1-14.
9 | */
10 |
11 | @Entity
12 | public class Person {
13 | @Id(autoincrement = true)
14 | private Long id;
15 | private long roomId;
16 | private String name;
17 | @Generated(hash = 837491630)
18 | public Person(Long id, long roomId, String name) {
19 | this.id = id;
20 | this.roomId = roomId;
21 | this.name = name;
22 | }
23 | @Generated(hash = 1024547259)
24 | public Person() {
25 | }
26 | public String getName() {
27 | return this.name;
28 | }
29 | public void setName(String name) {
30 | this.name = name;
31 | }
32 | public long getRoomId() {
33 | return this.roomId;
34 | }
35 | public void setRoomId(long roomId) {
36 | this.roomId = roomId;
37 | }
38 | public Long getId() {
39 | return this.id;
40 | }
41 | public void setId(Long id) {
42 | this.id = id;
43 | }
44 |
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/adapter/BaseFragmentAdapter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.adapter;
2 |
3 | /**
4 | * Created by LZJ on 2016/11/6.
5 | */
6 |
7 | import android.support.v4.app.Fragment;
8 | import android.support.v4.app.FragmentManager;
9 | import android.support.v4.app.FragmentPagerAdapter;
10 |
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | /**
15 | * 主页的每个分支的适配器
16 | */
17 | public class BaseFragmentAdapter extends FragmentPagerAdapter {
18 | List mFragments = new ArrayList<>();
19 | List mTitles = new ArrayList<>();
20 |
21 | public BaseFragmentAdapter(FragmentManager fm) {
22 | super(fm);
23 | }
24 |
25 | @Override
26 | public CharSequence getPageTitle(int position) {
27 | return mTitles.get(position);
28 | }
29 |
30 | @Override
31 | public Fragment getItem(int position) {
32 | return mFragments.get(position);
33 | }
34 |
35 | @Override
36 | public int getCount() {
37 | return mTitles.size();
38 | }
39 |
40 | public void addFragment(Fragment fragment, String title) {
41 | mFragments.add(fragment);
42 | mTitles.add(title);
43 | }
44 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/adapter/SubChannelAdapter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.adapter;
2 |
3 | import android.content.Context;
4 | import android.widget.ImageView;
5 |
6 | import com.chad.library.adapter.base.BaseQuickAdapter;
7 | import com.chad.library.adapter.base.BaseViewHolder;
8 | import com.lcorekit.l.douyu.R;
9 | import com.lcorekit.l.live.bean.SubChannelInfo;
10 | import com.lcorekit.l.live.utils.LoadImage;
11 |
12 | import java.util.List;
13 |
14 |
15 | /**
16 | * Created by l on 17-1-2.
17 | */
18 |
19 | public class SubChannelAdapter extends BaseQuickAdapter {
20 | private Context mCtx;
21 | private List mData;
22 |
23 | public SubChannelAdapter(Context context, List data) {
24 | super(context, R.layout.channels_item, data);
25 | this.mCtx = context;
26 | this.mData = data;
27 | }
28 |
29 | @Override
30 | protected void convert(BaseViewHolder baseViewHolder, SubChannelInfo subChannelInfo) {
31 | baseViewHolder.setText(R.id.tv_channels_name, subChannelInfo.tagName);
32 | ImageView channels_icon = baseViewHolder.getView(R.id.iv_channels);
33 | LoadImage.loadCircleImage(mCtx, subChannelInfo.iconUrl, channels_icon);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/danmu/utils/FormatTransfer.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.danmu.utils;
2 |
3 | public class FormatTransfer {
4 | public static byte [] toLH( int n)
5 | {
6 | byte [] b = new byte [ 4 ];
7 | b[0 ] = ( byte ) (n & 0xff );
8 | b[1 ] = ( byte ) (n >> 8 & 0xff );
9 | b[2 ] = ( byte ) (n >> 16 & 0xff );
10 | b[3 ] = ( byte ) (n >> 24 & 0xff );
11 | return b;
12 | }
13 |
14 | public static byte [] toHH( int n)
15 | {
16 | byte [] b = new byte [ 4 ];
17 | b[3 ] = ( byte ) (n & 0xff );
18 | b[2 ] = ( byte ) (n >> 8 & 0xff );
19 | b[1 ] = ( byte ) (n >> 16 & 0xff );
20 | b[0 ] = ( byte ) (n >> 24 & 0xff );
21 | return b;
22 | }
23 |
24 | public static byte [] toLH( short n)
25 | {
26 | byte [] b = new byte [ 2 ];
27 | b[0 ] = ( byte ) (n & 0xff );
28 | b[1 ] = ( byte ) (n >> 8 & 0xff );
29 | return b;
30 | }
31 |
32 | public static byte [] toHH( short n)
33 | {
34 | byte [] b = new byte [ 2 ];
35 | b[1 ] = ( byte ) (n & 0xff );
36 | b[0 ] = ( byte ) (n >> 8 & 0xff );
37 | return b;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/widget/media/IMediaController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Zhang Rui
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.lcorekit.l.live.widget.media;
18 |
19 | import android.view.View;
20 | import android.widget.MediaController;
21 |
22 | public interface IMediaController {
23 | void hide();
24 |
25 | boolean isShowing();
26 |
27 | void setAnchorView(View view);
28 |
29 | void setEnabled(boolean enabled);
30 |
31 | void setMediaPlayer(MediaController.MediaPlayerControl player);
32 |
33 | void show(int timeout);
34 |
35 | void show();
36 |
37 | //----------
38 | // Extends
39 | //----------
40 | void showOnce(View view);
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/utils/LoadImage.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.utils;
2 |
3 | import android.content.Context;
4 | import android.net.Uri;
5 | import android.widget.ImageView;
6 |
7 | import com.lcorekit.l.douyu.R;
8 | import com.squareup.picasso.Picasso;
9 |
10 | /**
11 | * Created by Andy on 2016/11/8.
12 | */
13 |
14 | public class LoadImage {
15 | //加载展示圆形图片
16 | public static void loadCircleImage(Context context, String url, ImageView imageView) {
17 | Uri parseUrl = Uri.parse(url);
18 | Picasso.with(context)
19 | .load(parseUrl)
20 | .placeholder(R.drawable.loading)//指定图片未加载成功前显示的图片
21 | .error(R.drawable.not_showed)//指定图片加载失败时显示的图片
22 | .transform(new CircleTransform())//指定图片的形状为圆形
23 | .into(imageView);//指定图片展示的控件
24 | }
25 |
26 | //加载展示普通图片
27 | public static void loadNormalImage(Context context, String url, ImageView imageView) {
28 | Uri parseUrl = Uri.parse(url);
29 | Picasso.with(context)
30 | .load(parseUrl)
31 | .placeholder(R.drawable.image_loading)//指定图片未加载成功前显示的图片
32 | .error(R.drawable.not_showed)//指定图片加载失败时显示的图片
33 | .into(imageView);//指定图片展示的控件
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
15 |
16 |
19 |
20 |
21 |
26 |
27 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/adapter/RoomInfoAdapter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.adapter;
2 |
3 | import android.content.Context;
4 | import android.widget.ImageView;
5 |
6 | import com.chad.library.adapter.base.BaseQuickAdapter;
7 | import com.chad.library.adapter.base.BaseViewHolder;
8 | import com.lcorekit.l.douyu.R;
9 | import com.lcorekit.l.live.bean.RoomInfo;
10 | import com.lcorekit.l.live.utils.LoadImage;
11 |
12 | import java.util.List;
13 |
14 | /**
15 | * Created by l on 17-1-3.
16 | */
17 |
18 | public class RoomInfoAdapter extends BaseQuickAdapter {
19 | private Context mCtx;
20 | public List mData;
21 |
22 | public RoomInfoAdapter(Context context, List datas) {
23 | super(context, R.layout.room_info_item, datas);
24 | this.mCtx = context;
25 | this.mData = datas;
26 | }
27 |
28 | @Override
29 | protected void convert(BaseViewHolder baseViewHolder, RoomInfo roomInfo) {
30 | baseViewHolder.setText(R.id.tv_nickname, roomInfo.nickname.trim())
31 | .setText(R.id.tv_online, String.valueOf(roomInfo.online))
32 | .setText(R.id.tv_room_name, roomInfo.roomName);
33 | ImageView imageView = baseViewHolder.getView(R.id.iv_room);
34 | LoadImage.loadNormalImage(mCtx, roomInfo.roomSrc, imageView);
35 | }
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 斗鱼直播
3 | 推荐
4 | 直播
5 | 关注
6 | 设置
7 | 频道
8 | 直播截图
9 | 搜索
10 | 请输入房间号,或关键字
11 | 视频的标题
12 | 15:38:20
13 | 12%
14 | 仅Wi-Fi下观看
15 | 缓存清理
16 | 关于
17 | 此软件是一款精简的斗鱼直播。\n采用了MVP的设计模式。\n这是一款使用Rxjava响应式编程,结合ijkplayer实现的直播软件。
18 | butterknife
19 | \nrxjava
20 | \nrxandroid
21 | \nokgo
22 | \nokrx
23 | \ngson
24 | \npicasso
25 | \nswipeback
26 | \ngreendao
27 | \nmaterialdialog
28 | \nijkplayer
29 | \nDanmakuFlameMaster
30 | \nBaseRecyclerViewAdapterHelper
31 | \nSwipeToLoadLayout
32 |
33 |
34 | 如果你有好的意见或建议,可以联系我。\n邮箱:lcorekit@sina.com。\n我将十分注重你的建议,在此感谢!
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/activity/SplashActivity.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.activity;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 |
8 | import com.lcorekit.l.live.mvp.presenter.SplahActivityPresenter;
9 | import com.lcorekit.l.live.mvp.presenter.impl.ISplahActivityPresenter;
10 | import com.lcorekit.l.live.mvp.view.activity.impl.SplashActivityView;
11 |
12 |
13 | /**
14 | * Created by l on 16-12-30.
15 | * 欢迎界面
16 | */
17 |
18 | public class SplashActivity extends AppCompatActivity implements SplashActivityView {
19 |
20 | private ISplahActivityPresenter mSplahActivityPresenter;
21 |
22 | @Override
23 | protected void onCreate(@Nullable Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | mSplahActivityPresenter = new SplahActivityPresenter(this);
26 | mSplahActivityPresenter.setDelay();
27 | }
28 |
29 |
30 | /**
31 | * 进入app
32 | */
33 | @Override
34 | public void enterApp() {
35 | startActivity(new Intent(this, HomeActivity.class));
36 | finish();
37 | }
38 |
39 | @Override
40 | protected void onDestroy() {
41 | super.onDestroy();
42 | //反注册
43 | mSplahActivityPresenter.unRegister();
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/db/DaoSession.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.db;
2 |
3 | import com.lcorekit.l.live.db.bean.Person;
4 |
5 | import org.greenrobot.greendao.AbstractDao;
6 | import org.greenrobot.greendao.AbstractDaoSession;
7 | import org.greenrobot.greendao.database.Database;
8 | import org.greenrobot.greendao.identityscope.IdentityScopeType;
9 | import org.greenrobot.greendao.internal.DaoConfig;
10 |
11 | import java.util.Map;
12 |
13 |
14 |
15 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
16 |
17 | /**
18 | * {@inheritDoc}
19 | *
20 | * @see AbstractDaoSession
21 | */
22 | public class DaoSession extends AbstractDaoSession {
23 |
24 | private final DaoConfig personDaoConfig;
25 |
26 | private final PersonDao personDao;
27 |
28 | public DaoSession(Database db, IdentityScopeType type, Map>, DaoConfig>
29 | daoConfigMap) {
30 | super(db);
31 |
32 | personDaoConfig = daoConfigMap.get(PersonDao.class).clone();
33 | personDaoConfig.initIdentityScope(type);
34 |
35 | personDao = new PersonDao(personDaoConfig, this);
36 |
37 | registerDao(Person.class, personDao);
38 | }
39 |
40 | public void clear() {
41 | personDaoConfig.clearIdentityScope();
42 | }
43 |
44 | public PersonDao getPersonDao() {
45 | return personDao;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_statelayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
26 |
27 |
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/utils/GreenDaoUtils.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.utils;
2 |
3 | import android.database.sqlite.SQLiteDatabase;
4 |
5 | import com.lcorekit.l.live.App;
6 | import com.lcorekit.l.live.db.DaoMaster;
7 | import com.lcorekit.l.live.db.DaoSession;
8 |
9 |
10 | /**
11 | * Created by l on 17-1-14.
12 | */
13 |
14 | public class GreenDaoUtils {
15 | private SQLiteDatabase database;
16 | private DaoSession mDaoSession;
17 |
18 | private static GreenDaoUtils greenDaoUtils;
19 |
20 | private GreenDaoUtils() {
21 |
22 | }
23 |
24 | public static GreenDaoUtils getInstance() {
25 | if (greenDaoUtils == null) {
26 | greenDaoUtils = new GreenDaoUtils();
27 | }
28 | return greenDaoUtils;
29 | }
30 |
31 | private void initGreenDao() {
32 | DaoMaster.DevOpenHelper mHelper = new DaoMaster.DevOpenHelper(App.getCotext(), "attention.db", null);
33 | database = mHelper.getWritableDatabase();
34 | DaoMaster mDaoMaster = new DaoMaster(database);
35 | mDaoSession = mDaoMaster.newSession();
36 | }
37 |
38 | public DaoSession getmDaoSession() {
39 | if (mDaoSession == null) {
40 | initGreenDao();
41 | }
42 | return mDaoSession;
43 | }
44 |
45 | public SQLiteDatabase getDatabase() {
46 | if (database == null) {
47 | initGreenDao();
48 | }
49 | return database;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/utils/CircleTransform.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.utils;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.BitmapShader;
5 | import android.graphics.Canvas;
6 | import android.graphics.Paint;
7 |
8 | import com.squareup.picasso.Transformation;
9 |
10 | public class CircleTransform implements Transformation {
11 | @Override
12 | public Bitmap transform(Bitmap source) {
13 | int size = Math.min(source.getWidth(), source.getHeight());
14 |
15 | int x = (source.getWidth() - size) / 2;
16 | int y = (source.getHeight() - size) / 2;
17 |
18 | Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
19 | if (squaredBitmap != source) {
20 | source.recycle();
21 | }
22 |
23 | Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig());
24 |
25 | Canvas canvas = new Canvas(bitmap);
26 | Paint paint = new Paint();
27 | BitmapShader shader = new BitmapShader(squaredBitmap,
28 | BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
29 | paint.setShader(shader);
30 | paint.setAntiAlias(true);
31 |
32 | float r = size / 2f;
33 | canvas.drawCircle(r, r, r, paint);
34 |
35 | squaredBitmap.recycle();
36 | return bitmap;
37 | }
38 |
39 | @Override
40 | public String key() {
41 | return "circle";
42 | }
43 |
44 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/progress_video.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 | -
8 |
9 |
10 |
11 |
18 |
19 |
20 |
21 |
22 | -
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/swipeback/src/main/java/me/imid/swipebacklayout/lib/app/SwipeBackPreferenceActivity.java:
--------------------------------------------------------------------------------
1 |
2 | package me.imid.swipebacklayout.lib.app;
3 |
4 | import me.imid.swipebacklayout.lib.SwipeBackLayout;
5 | import android.os.Bundle;
6 | import android.preference.PreferenceActivity;
7 | import android.view.View;
8 |
9 | public class SwipeBackPreferenceActivity extends PreferenceActivity implements SwipeBackActivityBase {
10 | private SwipeBackActivityHelper mHelper;
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | mHelper = new SwipeBackActivityHelper(this);
16 | mHelper.onActivityCreate();
17 | }
18 |
19 | @Override
20 | protected void onPostCreate(Bundle savedInstanceState) {
21 | super.onPostCreate(savedInstanceState);
22 | mHelper.onPostCreate();
23 | }
24 |
25 | @Override
26 | public View findViewById(int id) {
27 | View v = super.findViewById(id);
28 | if (v == null && mHelper != null)
29 | return mHelper.findViewById(id);
30 | return v;
31 | }
32 |
33 | @Override
34 | public SwipeBackLayout getSwipeBackLayout() {
35 | return mHelper.getSwipeBackLayout();
36 | }
37 | @Override
38 | public void setSwipeBackEnable(boolean enable) {
39 | getSwipeBackLayout().setEnableGesture(enable);
40 | }
41 |
42 | @Override
43 | public void scrollToFinishActivity() {
44 | getSwipeBackLayout().scrollToFinishActivity();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_channel.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
21 |
22 |
25 |
26 |
31 |
32 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/SplahActivityPresenter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter;
2 |
3 | import android.util.Log;
4 |
5 | import com.lcorekit.l.live.mvp.presenter.impl.ISplahActivityPresenter;
6 | import com.lcorekit.l.live.mvp.view.activity.impl.SplashActivityView;
7 |
8 | import java.util.concurrent.TimeUnit;
9 |
10 | import rx.Observable;
11 | import rx.Subscription;
12 | import rx.functions.Action1;
13 |
14 | import static com.lzy.okgo.utils.OkLogger.tag;
15 |
16 | /**
17 | * Created by l on 16-12-31.
18 | */
19 |
20 | public class SplahActivityPresenter implements ISplahActivityPresenter {
21 | private SplashActivityView view;
22 | private Subscription subscription;
23 |
24 | public SplahActivityPresenter(SplashActivityView view) {
25 | this.view = view;
26 | }
27 |
28 | @Override
29 | public void setDelay() {
30 | //不想有延迟,秒开时间可以设置为0
31 | subscription = Observable.timer(1500, TimeUnit.MILLISECONDS).subscribe(new Action1() {
32 | @Override
33 | public void call(Long aLong) {
34 | view.enterApp();
35 | }
36 | });
37 | }
38 |
39 | @Override
40 | public void unRegister() {
41 | Log.e(tag, "是否已经反注册:" + subscription.isUnsubscribed() + "");
42 | //先判断是否已经反注册
43 | if (!subscription.isUnsubscribed()) {
44 | Log.e(tag, "进行反注册");
45 | subscription.unsubscribe();
46 | Log.e(tag, "是否已经反注册:" + subscription.isUnsubscribed() + "");
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_classic_footer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
10 |
11 |
19 |
20 |
28 |
29 |
37 |
38 |
--------------------------------------------------------------------------------
/swipeback/src/main/java/me/imid/swipebacklayout/lib/app/SwipeBackActivity.java:
--------------------------------------------------------------------------------
1 |
2 | package me.imid.swipebacklayout.lib.app;
3 |
4 | import android.os.Bundle;
5 | import android.support.v4.app.FragmentActivity;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 |
9 | import me.imid.swipebacklayout.lib.SwipeBackLayout;
10 | import me.imid.swipebacklayout.lib.Utils;
11 |
12 | public class SwipeBackActivity extends AppCompatActivity implements SwipeBackActivityBase {
13 | private SwipeBackActivityHelper mHelper;
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | mHelper = new SwipeBackActivityHelper(this);
19 | mHelper.onActivityCreate();
20 | }
21 |
22 | @Override
23 | protected void onPostCreate(Bundle savedInstanceState) {
24 | super.onPostCreate(savedInstanceState);
25 | mHelper.onPostCreate();
26 | }
27 |
28 | @Override
29 | public View findViewById(int id) {
30 | View v = super.findViewById(id);
31 | if (v == null && mHelper != null)
32 | return mHelper.findViewById(id);
33 | return v;
34 | }
35 |
36 | @Override
37 | public SwipeBackLayout getSwipeBackLayout() {
38 | return mHelper.getSwipeBackLayout();
39 | }
40 |
41 | @Override
42 | public void setSwipeBackEnable(boolean enable) {
43 | getSwipeBackLayout().setEnableGesture(enable);
44 | }
45 |
46 | @Override
47 | public void scrollToFinishActivity() {
48 | Utils.convertActivityToTranslucent(this);
49 | getSwipeBackLayout().scrollToFinishActivity();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/widget_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
20 |
21 |
26 |
27 |
32 |
33 |
38 |
39 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
31 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/widget/media/FileMediaDataSource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Zhang Rui
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.lcorekit.l.live.widget.media;
18 |
19 | import java.io.File;
20 | import java.io.IOException;
21 | import java.io.RandomAccessFile;
22 |
23 | import tv.danmaku.ijk.media.player.misc.IMediaDataSource;
24 |
25 | public class FileMediaDataSource implements IMediaDataSource {
26 | private RandomAccessFile mFile;
27 | private long mFileSize;
28 |
29 | public FileMediaDataSource(File file) throws IOException {
30 | mFile = new RandomAccessFile(file, "r");
31 | mFileSize = mFile.length();
32 | }
33 |
34 | @Override
35 | public int readAt(long position, byte[] buffer, int offset, int size) throws IOException {
36 | if (mFile.getFilePointer() != position)
37 | mFile.seek(position);
38 |
39 | if (size == 0)
40 | return 0;
41 |
42 | return mFile.read(buffer, 0, size);
43 | }
44 |
45 | @Override
46 | public long getSize() throws IOException {
47 | return mFileSize;
48 | }
49 |
50 | @Override
51 | public void close() throws IOException {
52 | mFileSize = 0;
53 | mFile.close();
54 | mFile = null;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_search.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
25 |
26 |
33 |
34 |
37 |
38 |
43 |
44 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/layout_classic_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
19 |
20 |
28 |
29 |
37 |
38 |
45 |
46 |
--------------------------------------------------------------------------------
/swipeback/src/main/java/me/imid/swipebacklayout/lib/app/SwipeBackActivityHelper.java:
--------------------------------------------------------------------------------
1 | package me.imid.swipebacklayout.lib.app;
2 |
3 | import android.app.Activity;
4 | import android.graphics.Color;
5 | import android.graphics.drawable.ColorDrawable;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 |
9 | import me.imid.swipebacklayout.lib.SwipeBackLayout;
10 | import me.imid.swipebacklayout.lib.Utils;
11 |
12 | /**
13 | * @author Yrom
14 | */
15 | public class SwipeBackActivityHelper {
16 | private Activity mActivity;
17 |
18 | private SwipeBackLayout mSwipeBackLayout;
19 |
20 | public SwipeBackActivityHelper(Activity activity) {
21 | mActivity = activity;
22 | }
23 |
24 | @SuppressWarnings("deprecation")
25 | public void onActivityCreate() {
26 | mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
27 | mActivity.getWindow().getDecorView().setBackgroundDrawable(null);
28 | mSwipeBackLayout = (SwipeBackLayout) LayoutInflater.from(mActivity).inflate(
29 | me.imid.swipebacklayout.lib.R.layout.swipeback_layout, null);
30 | mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() {
31 | @Override
32 | public void onScrollStateChange(int state, float scrollPercent) {
33 | }
34 |
35 | @Override
36 | public void onEdgeTouch(int edgeFlag) {
37 | Utils.convertActivityToTranslucent(mActivity);
38 | }
39 |
40 | @Override
41 | public void onScrollOverThreshold() {
42 |
43 | }
44 | });
45 | }
46 |
47 | public void onPostCreate() {
48 | mSwipeBackLayout.attachToActivity(mActivity);
49 | }
50 |
51 | public View findViewById(int id) {
52 | if (mSwipeBackLayout != null) {
53 | return mSwipeBackLayout.findViewById(id);
54 | }
55 | return null;
56 | }
57 |
58 | public SwipeBackLayout getSwipeBackLayout() {
59 | return mSwipeBackLayout;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
34 |
35 |
36 |
40 |
41 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/danmu/msg/MsgView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.danmu.msg;
2 |
3 | import android.text.TextUtils;
4 |
5 | import java.util.HashMap;
6 | import java.util.Map;
7 |
8 |
9 | public class MsgView {
10 | private Map messageList;
11 |
12 | public MsgView(String data) {
13 | this.messageList = parseRespond(data);
14 | }
15 |
16 | /**
17 | * 获取弹幕信息对象
18 | *
19 | * @return
20 | */
21 | public Map getMessageList() {
22 | return messageList;
23 | }
24 |
25 | /**
26 | * 设置弹幕信息对象
27 | *
28 | * @param messageList
29 | */
30 | public void setMessageList(Map messageList) {
31 | this.messageList = messageList;
32 | }
33 |
34 | /**
35 | * 解析弹幕服务器接收到的协议数据
36 | *
37 | * @param data
38 | * @return
39 | */
40 | public Map parseRespond(String data) {
41 | Map rtnMsg = new HashMap();
42 | String dataWithoutLast;
43 |
44 | //处理数据字符串末尾的'/0字符'
45 | dataWithoutLast = TextUtils.substring(data, 0, TextUtils.lastIndexOf(data, '/'));
46 |
47 | //对数据字符串进行拆分
48 | String[] buff = dataWithoutLast.split("/");
49 |
50 | //分析协议字段中的key和value值
51 | for (String tmp : buff) {
52 | //获取key值
53 | String key = TextUtils.substring(tmp, 0, TextUtils.indexOf(tmp, "@="));
54 | //获取对应的value值
55 | Object value = TextUtils.substring(tmp, TextUtils.indexOf(tmp, "@=") + 2, tmp.length());
56 |
57 | //如果value值中包含子序列化值,则进行递归分析
58 | if (TextUtils.indexOf((String) value, "@A") > 0) {
59 | value = ((String) value).replaceAll("@S", "/").replaceAll("@A", "@");
60 | value = this.parseRespond((String) value);
61 | }
62 |
63 | //将分析后的键值对添加到信息列表中
64 | rtnMsg.put(key, value);
65 | }
66 | return rtnMsg;
67 | }
68 |
69 | /**
70 | * 调试信息输出
71 | *
72 | * @return
73 | */
74 | public String printStr() {
75 | return messageList.toString();
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/room_info_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
21 |
22 |
32 |
33 |
43 |
44 |
45 |
53 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/video_top_pannel.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
30 |
31 |
42 |
43 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DouYuLiveSample
2 | 基于斗鱼第三方接口的直播App,软件使用了Rxjava+IjkPlayer+GreenDao+MVP
3 | ---
4 | # 开发简介
5 | 软件借鉴于[video-live](https://github.com/littleMeng/video-live)重新架构了软件,重新设计了UI,抽取了基类,使用了Mvp的开发模式,加入了[Rxjava](https://github.com/ReactiveX/RxJava/tree/1.x),使用[IjkPlayer](https://github.com/Bilibili/ijkplayer)进行视频播放,替换了原项目中的[vitamio](https://www.vitamio.org/)。由于偷懒弹幕模块摘自于[video-live](https://github.com/littleMeng/video-live),使用的是[DanmakuFlame](https://github.com/Bilibili/DanmakuFlameMaster)。
6 | ## 软件截图
7 |   
8 |  
9 | ## dependencies
10 | ```java
11 | dependencies {
12 | compile fileTree(include: ['*.jar'], dir: 'libs')
13 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
14 | exclude group: 'com.android.support', module: 'support-annotations'
15 | })
16 | compile 'com.android.support:appcompat-v7:25.1.0'
17 | testCompile 'junit:junit:4.12'
18 | compile 'com.google.code.gson:gson:2.8.0'
19 | compile 'com.jakewharton:butterknife:8.4.0'
20 | annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
21 | compile 'com.android.support:recyclerview-v7:25.1.0'
22 | compile 'io.reactivex:rxjava:1.0.14'
23 | compile 'io.reactivex:rxandroid:1.0.1'
24 | compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v1.6.8'
25 | compile 'com.squareup.picasso:picasso:2.5.2'
26 | compile 'com.android.support:design:25.1.0'
27 | compile 'com.github.Aspsine:SwipeToLoadLayout:1.0.3'
28 | compile 'me.drakeet.materialdialog:library:1.3.1'
29 | compile 'com.lzy.net:okgo:2.0.0'
30 | compile 'com.lzy.net:okrx:0.1.0'
31 | compile project(':swipeback')
32 | compile(name: 'ijkplayer-java-release', ext: 'aar')
33 | compile 'com.github.ctiao:DanmakuFlameMaster:0.6.2'
34 | compile 'org.greenrobot:greendao:3.1.1'
35 | compile 'com.android.support:multidex:1.0.1'
36 | }
37 | ```
38 | ###联系方式
39 | * 邮箱 lcorekit@sina.com
40 |
--------------------------------------------------------------------------------
/.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 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_setting.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
24 |
25 |
33 |
34 |
44 |
45 |
46 |
47 |
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/model/AttentionModel.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.model;
2 |
3 |
4 | import com.lcorekit.l.live.db.PersonDao;
5 | import com.lcorekit.l.live.db.bean.Person;
6 | import com.lcorekit.l.live.mvp.model.impl.IAttentionModel;
7 | import com.lcorekit.l.live.utils.GreenDaoUtils;
8 |
9 | import java.util.List;
10 |
11 | import rx.Observable;
12 | import rx.functions.Func1;
13 |
14 | /**
15 | * Created by l on 17-1-14.
16 | */
17 |
18 | public class AttentionModel implements IAttentionModel {
19 | private PersonDao dao;
20 |
21 | public AttentionModel() {
22 | dao = GreenDaoUtils.getInstance().getmDaoSession().getPersonDao();
23 | }
24 |
25 | /**
26 | * 插入关注主播
27 | *
28 | * @param person 主播对象
29 | * @return Observable
30 | */
31 | @Override
32 | public Observable insertData(Person person) {
33 | return dao.rx().insert(person);
34 | }
35 |
36 | /**
37 | * 取消关注主播
38 | *
39 | * @param person 主播对象
40 | * @return Observable
41 | */
42 | @Override
43 | public Observable deleteData(final Person person) {
44 | return dao.queryBuilder().rx().list().map(new Func1, Void>() {
45 | @Override
46 | public Void call(List persons) {
47 | for (Person p : persons) {
48 | if (p.getRoomId() == person.getRoomId()) {
49 | dao.delete(p);
50 | }
51 | }
52 | return null;
53 | }
54 | });
55 | }
56 |
57 | /**
58 | * 查询所有
59 | *
60 | * @return Observable
61 | */
62 | @Override
63 | public Observable> queryAll() {
64 | return dao.queryBuilder().rx().list();
65 | }
66 |
67 | /**
68 | * 查询一条
69 | *
70 | * @param person 主播
71 | * @return Observable
72 | */
73 | @Override
74 | public Observable query(final Person person) {
75 | return dao.queryBuilder().rx().list().exists(new Func1, Boolean>() {
76 | @Override
77 | public Boolean call(List persons) {
78 | for (Person p : persons) {
79 | if (p.getRoomId() == person.getRoomId()) {
80 | return true;
81 | }
82 | }
83 | return false;
84 | }
85 | });
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/utils/DouYuApi.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.utils;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 | import java.util.UUID;
6 |
7 | public class DouYuApi {
8 | public static final String DOUYU_API = "http://capi.douyucdn.cn/api/v1/";
9 |
10 | // public static String getDouyuLOLSubChannel() {
11 | // return DOUYU_API + "live/1?&limit=20&offset=0";
12 | // }
13 | //
14 | // public static String getDouyuFurnaceStoneSubChannel() {
15 | // return DOUYU_API + "live/2?&limit=20&offset=0";
16 | // }
17 | //
18 | // public static String getDouyuDota2SubChannel() {
19 | // return DOUYU_API + "live/3?&limit=20&offset=0";
20 | // }
21 |
22 | public static String getChannelUrl(int channelid, int offset) {
23 | return DOUYU_API + "live/" + channelid + "?&limit=20&offset=" + offset;
24 | }
25 |
26 | public static String getDouyuAllSubChannelsUrl() {
27 | return DOUYU_API + "getColumnDetail?shortName=game";
28 | }
29 |
30 | public static String getDouyuRecommendUrl(int offset) {
31 | return DOUYU_API + "live?&limit=20&offset=" + offset;
32 | }
33 |
34 | public static String getDouyuSubChannelBaseTag(int channelTag) {
35 | return DOUYU_API + "live/" + channelTag + "?&limit=20&offset=0";
36 | }
37 |
38 | public static String getDouyuRoom(int roomId) {
39 | return "http://capi.douyucdn.cn/api/v1/searchNew/" + roomId + "/1?limit=1&offset=0";//1374989
40 | }
41 |
42 | public static String getDouyuRoomUrl(int roomId) {
43 | return "http://www.douyu.com/lapi/live/getPlay/" + roomId;
44 | }
45 |
46 | public static Map getDouyuRoomParams(int roomId) {
47 | Map map = new HashMap<>();
48 | long time = System.currentTimeMillis() / (1000 * 60);
49 | String did = UUID.randomUUID().toString().toUpperCase();
50 | did = did.replace("-", "");
51 | String str = roomId + did + "A12Svb&%1UUmf@hC" + time;
52 | String sign = Md5.strToMd5Low32(str);
53 |
54 | map.put("cdn", "ws");
55 | map.put("rate", "0");
56 | map.put("tt", String.valueOf(time));
57 | map.put("did", did);
58 | map.put("sign", sign);
59 |
60 | return map;
61 | }
62 |
63 | public static String getDouyuSearchUrl(String keyWord) {
64 | return "http://capi.douyucdn.cn/api/v1/mobileSearch/1/1?sk=" + keyWord +
65 | "&offset=0&limit=10&client_sys=android";
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_play.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
15 |
16 |
17 |
18 |
23 |
24 |
37 |
38 |
44 |
45 |
53 |
54 |
55 |
63 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/widget/ClassicLoadMoreFooterView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.widget;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.widget.ImageView;
6 | import android.widget.ProgressBar;
7 | import android.widget.TextView;
8 |
9 | import com.aspsine.swipetoloadlayout.SwipeLoadMoreFooterLayout;
10 | import com.lcorekit.l.douyu.R;
11 |
12 |
13 | /**
14 | * Created by Aspsine on 2015/9/2.
15 | */
16 | public class ClassicLoadMoreFooterView extends SwipeLoadMoreFooterLayout {
17 | private TextView tvLoadMore;
18 | private ImageView ivSuccess;
19 | private ProgressBar progressBar;
20 |
21 | private int mFooterHeight;
22 |
23 | public ClassicLoadMoreFooterView(Context context) {
24 | this(context, null);
25 | }
26 |
27 | public ClassicLoadMoreFooterView(Context context, AttributeSet attrs) {
28 | this(context, attrs, 0);
29 | }
30 |
31 | public ClassicLoadMoreFooterView(Context context, AttributeSet attrs, int defStyleAttr) {
32 | super(context, attrs, defStyleAttr);
33 | mFooterHeight = getResources().getDimensionPixelOffset(R.dimen.load_more_footer_height_classic);
34 | }
35 |
36 | @Override
37 | protected void onFinishInflate() {
38 | super.onFinishInflate();
39 | tvLoadMore = (TextView) findViewById(R.id.tvLoadMore);
40 | ivSuccess = (ImageView) findViewById(R.id.ivSuccess);
41 | progressBar = (ProgressBar) findViewById(R.id.progressbar);
42 | }
43 |
44 | @Override
45 | public void onPrepare() {
46 | ivSuccess.setVisibility(GONE);
47 | }
48 |
49 | @Override
50 | public void onMove(int y, boolean isComplete, boolean automatic) {
51 | if (!isComplete) {
52 | ivSuccess.setVisibility(GONE);
53 | progressBar.setVisibility(GONE);
54 | if (-y >= mFooterHeight) {
55 | tvLoadMore.setText("释放刷新");
56 | } else {
57 | tvLoadMore.setText("上拉刷新");
58 | }
59 | }
60 | }
61 |
62 | @Override
63 | public void onLoadMore() {
64 | tvLoadMore.setText("正在加载");
65 | progressBar.setVisibility(VISIBLE);
66 | }
67 |
68 | @Override
69 | public void onRelease() {
70 |
71 | }
72 |
73 | @Override
74 | public void onComplete() {
75 | progressBar.setVisibility(GONE);
76 | ivSuccess.setVisibility(VISIBLE);
77 | }
78 |
79 | @Override
80 | public void onReset() {
81 | ivSuccess.setVisibility(GONE);
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/utils/FileUtils.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.utils;
2 |
3 | import android.text.format.Formatter;
4 |
5 | import com.lcorekit.l.live.App;
6 |
7 | import java.io.File;
8 | import java.io.FileInputStream;
9 |
10 | /**
11 | * Author:Koterwong,Data:2016/5/4.
12 | * Description:
13 | */
14 | public class FileUtils {
15 |
16 | /**
17 | * 获取缓存目录
18 | */
19 | public static String getCacheFilePath() {
20 | StringBuilder builder = new StringBuilder();
21 | builder
22 | .append(App.getCotext().getCacheDir().getAbsolutePath())
23 | .append(File.separator)
24 | .append(App.CACHE_NAME)
25 | .append(File.separator);
26 | return builder.toString();
27 | }
28 |
29 | public static String getCacheSize() {
30 | return getAutoFileOrFilesSize(getCacheFilePath());
31 | }
32 |
33 | /**
34 | * 调用此方法自动计算指定文件或指定文件夹的大小
35 | *
36 | * @param filePath 文件路径
37 | * @return 计算好的带B、KB、MB、GB的字符串
38 | */
39 | public static String getAutoFileOrFilesSize(String filePath) {
40 | File file = new File(filePath);
41 | long blockSize = 0;
42 | try {
43 | if (file.isDirectory()) {
44 | blockSize = getFileSizes(file);
45 | } else {
46 | blockSize = getFileSize(file);
47 | }
48 | } catch (Exception e) {
49 | e.printStackTrace();
50 | }
51 | return Formatter.formatFileSize(App.getCotext(), blockSize);
52 | }
53 |
54 | /**
55 | * 遍历文件目录,获取目录下总大小
56 | *
57 | * @throws Exception
58 | */
59 | private static long getFileSizes(File f) throws Exception {
60 | long size = 0;
61 | File files[] = f.listFiles();
62 | for (int i = 0; i < files.length; i++) {
63 | if (files[i].isDirectory()) {
64 | size = size + getFileSizes(files[i]);
65 | } else {
66 | size = size + getFileSize(files[i]);
67 | }
68 | }
69 | return size;
70 | }
71 |
72 | /**
73 | * 获取指定文件大小
74 | *
75 | * @throws Exception
76 | */
77 | private static long getFileSize(File file) throws Exception {
78 | long size = 0;
79 | if (file.exists()) {
80 | FileInputStream fis = null;
81 | fis = new FileInputStream(file);
82 | size = fis.available();
83 | } else {
84 | file.createNewFile();
85 | }
86 | return size;
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/video_bottom_panel.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
25 |
26 |
35 |
36 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/activity/AboutActivity.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.activity;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.design.widget.FloatingActionButton;
6 | import android.support.v7.app.ActionBar;
7 | import android.support.v7.widget.Toolbar;
8 | import android.view.View;
9 |
10 | import com.lcorekit.l.douyu.R;
11 | import com.lcorekit.l.live.App;
12 |
13 | import butterknife.BindView;
14 | import butterknife.ButterKnife;
15 | import butterknife.OnClick;
16 | import me.drakeet.materialdialog.MaterialDialog;
17 | import me.imid.swipebacklayout.lib.app.SwipeBackActivity;
18 |
19 | /**
20 | * Created by l on 17-1-16.
21 | */
22 |
23 | public class AboutActivity extends SwipeBackActivity {
24 | @BindView(R.id.toolbar)
25 | Toolbar toolbar;
26 | @BindView(R.id.fab)
27 | FloatingActionButton fab;
28 |
29 | @Override
30 | protected void onCreate(@Nullable Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_about);
33 | ButterKnife.bind(this);
34 | initView();
35 | }
36 |
37 | private void initView() {
38 | setSupportActionBar(toolbar);
39 | final ActionBar ab = getSupportActionBar();
40 | if (ab != null) {
41 | ab.setDisplayHomeAsUpEnabled(true);
42 | ab.setDisplayShowTitleEnabled(false);
43 | }
44 | // 结束当前界面,返回
45 | toolbar.setNavigationOnClickListener(new View.OnClickListener() {
46 | @Override
47 | public void onClick(View v) {
48 | finish();
49 | }
50 | });
51 | toolbar.setTitle("关于");
52 | }
53 |
54 |
55 | @OnClick(R.id.fab)
56 | public void onClick() {
57 | showDialog();
58 | }
59 |
60 | private void showDialog() {
61 | final MaterialDialog dialog = new MaterialDialog(this)
62 | .setTitle("给我点个赞吧~")
63 | .setMessage("github传送门(*^__^*)")
64 | .setCanceledOnTouchOutside(true);
65 | dialog.setPositiveButton("开车", new View.OnClickListener() {
66 | @Override
67 | public void onClick(View v) {
68 | App.getACache().clear();
69 | dialog.dismiss();
70 | }
71 | });
72 | dialog.setNegativeButton("取消", new View.OnClickListener() {
73 | @Override
74 | public void onClick(View v) {
75 | dialog.dismiss();
76 | }
77 | });
78 | dialog.show();
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/commons/DebugLog.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.commons;
2 |
3 | import android.util.Log;
4 |
5 | import com.lcorekit.l.douyu.BuildConfig;
6 |
7 |
8 | /**
9 | * 日志工具类 在发布时不显示日志
10 | *
11 | * @author RANDY_ZHANG
12 | */
13 | public class DebugLog {
14 |
15 | static String className;
16 | static String methodName;
17 | static int lineNumber;
18 |
19 | private DebugLog() {
20 | /* Protect from instantiations */
21 | }
22 |
23 | public static boolean isDebuggable() {
24 | return BuildConfig.DEBUG;
25 | }
26 |
27 | private static String createLog(String log) {
28 |
29 | StringBuffer buffer = new StringBuffer();
30 | buffer.append("[");
31 | buffer.append(methodName);
32 | buffer.append(":");
33 | buffer.append(lineNumber);
34 | buffer.append("]");
35 | buffer.append(log);
36 |
37 | return buffer.toString();
38 | }
39 |
40 | private static void getMethodNames(StackTraceElement[] sElements) {
41 | className = sElements[1].getFileName();
42 | methodName = sElements[1].getMethodName();
43 | lineNumber = sElements[1].getLineNumber();
44 | }
45 |
46 | public static void e(String message) {
47 | if (!isDebuggable())
48 | return;
49 |
50 | // Throwable instance must be created before any methods
51 | getMethodNames(new Throwable().getStackTrace());
52 | Log.e(className, createLog(message));
53 | }
54 |
55 | public static void i(String message) {
56 | if (!isDebuggable())
57 | return;
58 |
59 | getMethodNames(new Throwable().getStackTrace());
60 | Log.i(className, createLog(message));
61 | }
62 |
63 | public static void d(String message) {
64 | if (!isDebuggable())
65 | return;
66 |
67 | getMethodNames(new Throwable().getStackTrace());
68 | Log.d(className, createLog(message));
69 | }
70 |
71 | public static void v(String message) {
72 | if (!isDebuggable())
73 | return;
74 |
75 | getMethodNames(new Throwable().getStackTrace());
76 | Log.v(className, createLog(message));
77 | }
78 |
79 | public static void w(String message) {
80 | if (!isDebuggable())
81 | return;
82 |
83 | getMethodNames(new Throwable().getStackTrace());
84 | Log.w(className, createLog(message));
85 | }
86 |
87 | public static void wtf(String message) {
88 | if (!isDebuggable())
89 | return;
90 |
91 | getMethodNames(new Throwable().getStackTrace());
92 | Log.wtf(className, createLog(message));
93 | }
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/swipeback/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | repositories {
4 | mavenCentral()
5 | }
6 |
7 | dependencies {
8 | compile 'com.android.support:appcompat-v7:25.1.0'
9 | }
10 |
11 | android {
12 | compileSdkVersion 25
13 | buildToolsVersion "25.0.2"
14 |
15 | defaultConfig {
16 | minSdkVersion 19
17 | targetSdkVersion 25
18 | versionCode 1
19 | versionName "1.0"
20 | }
21 | }
22 |
23 | /*
24 | def siteUrl = 'https://github.com/ikew0ng/SwipeBackLayout'
25 | def gitUrl = 'https://github.com/ikew0ng/SwipeBackLayout.git'
26 | group = "me.imid.swipebacklayout.lib"
27 |
28 | install {
29 | repositories.mavenInstaller {
30 | pom {
31 | project {
32 | packaging 'aar'
33 | // Add your description here
34 | name 'An Android library that help you to build app with swipe back gesture.'
35 | url siteUrl
36 | licenses {
37 | license {
38 | name 'The Apache Software License, Version 2.0'
39 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
40 | }
41 | }
42 | developers {
43 | developer {
44 | id 'ike'
45 | name 'ike'
46 | email 'ike@imid.me'
47 | }
48 | }
49 | scm {
50 | connection gitUrl
51 | developerConnection gitUrl
52 | url siteUrl
53 | }
54 | }
55 | }
56 | }
57 | }
58 | task sourcesJar(type: Jar) {
59 | from android.sourceSets.main.java.srcDirs
60 | classifier = 'sources'
61 | }
62 | task javadoc(type: Javadoc) {
63 | source = android.sourceSets.main.java.srcDirs
64 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
65 | }
66 | task javadocJar(type: Jar, dependsOn: javadoc) {
67 | classifier = 'javadoc'
68 | from javadoc.destinationDir
69 | }
70 | artifacts {
71 | archives javadocJar
72 | archives sourcesJar
73 | }
74 | Properties properties = new Properties()
75 | File gradle_properties = project.file('gradle.properties');
76 | if (gradle_properties.exists()) {
77 | properties.load(project.file('gradle.properties').newDataInputStream())
78 | }
79 | bintray {
80 | user = properties.getProperty("bintray.user")
81 | key = properties.getProperty("bintray.apikey")
82 | configurations = ['archives']
83 | pkg {
84 | repo = "maven"
85 | name = "SwipeBackLayout"
86 | websiteUrl = siteUrl
87 | vcsUrl = gitUrl
88 | licenses = ["Apache-2.0"]
89 | publish = true
90 | }
91 | }*/
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/widget/media/AndroidMediaController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Zhang Rui
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.lcorekit.l.live.widget.media;
18 |
19 | import android.content.Context;
20 | import android.support.annotation.NonNull;
21 | import android.support.annotation.Nullable;
22 | import android.support.v7.app.ActionBar;
23 | import android.util.AttributeSet;
24 | import android.view.View;
25 | import android.widget.MediaController;
26 |
27 | import java.util.ArrayList;
28 |
29 | public class AndroidMediaController extends MediaController implements IMediaController {
30 | private ActionBar mActionBar;
31 |
32 | public AndroidMediaController(Context context, AttributeSet attrs) {
33 | super(context, attrs);
34 | initView(context);
35 | }
36 |
37 | public AndroidMediaController(Context context, boolean useFastForward) {
38 | super(context, useFastForward);
39 | initView(context);
40 | }
41 |
42 | public AndroidMediaController(Context context) {
43 | super(context);
44 | initView(context);
45 | }
46 |
47 | private void initView(Context context) {
48 | }
49 |
50 | public void setSupportActionBar(@Nullable ActionBar actionBar) {
51 | mActionBar = actionBar;
52 | if (isShowing()) {
53 | actionBar.show();
54 | } else {
55 | actionBar.hide();
56 | }
57 | }
58 |
59 | @Override
60 | public void show() {
61 | super.show();
62 | if (mActionBar != null)
63 | mActionBar.show();
64 | }
65 |
66 | @Override
67 | public void hide() {
68 | super.hide();
69 | if (mActionBar != null)
70 | mActionBar.hide();
71 | for (View view : mShowOnceArray)
72 | view.setVisibility(View.GONE);
73 | mShowOnceArray.clear();
74 | }
75 |
76 | //----------
77 | // Extends
78 | //----------
79 | private ArrayList mShowOnceArray = new ArrayList();
80 |
81 | public void showOnce(@NonNull View view) {
82 | mShowOnceArray.add(view);
83 | view.setVisibility(View.VISIBLE);
84 | show();
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'com.jakewharton.butterknife'
3 | //apply plugin: 'org.greenrobot.greendao'
4 |
5 | android {
6 | compileSdkVersion 25
7 | buildToolsVersion "25.0.2"
8 | defaultConfig {
9 | applicationId "com.lcorekit.l.live"
10 | minSdkVersion 19
11 | targetSdkVersion 25
12 | versionCode 1
13 | versionName "1.0"
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 | multiDexEnabled true
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled true
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 |
24 | sourceSets {
25 | main {
26 | jniLibs.srcDirs = ['libs']
27 | }
28 | }
29 | //
30 | // greendao {
31 | // schemaVersion 1
32 | // daoPackage 'com.lcorekit.l.live.db'
33 | // targetGenDir 'src/main/java'
34 | // }
35 | }
36 |
37 | repositories {
38 | mavenCentral()
39 | flatDir {
40 | dirs 'libs' //this way we can find the .aar file in libs folder
41 | }
42 | }
43 |
44 | dependencies {
45 | compile fileTree(include: ['*.jar'], dir: 'libs')
46 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
47 | exclude group: 'com.android.support', module: 'support-annotations'
48 | })
49 | compile 'com.android.support:appcompat-v7:25.1.0'
50 | testCompile 'junit:junit:4.12'
51 | compile 'com.google.code.gson:gson:2.8.0'
52 | compile 'com.jakewharton:butterknife:8.4.0'
53 | annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
54 | compile 'com.android.support:recyclerview-v7:25.1.0'
55 | compile 'io.reactivex:rxjava:1.0.14'
56 | compile 'io.reactivex:rxandroid:1.0.1'
57 | compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v1.6.8'
58 | compile 'com.squareup.picasso:picasso:2.5.2'
59 | compile 'com.android.support:design:25.1.0'
60 | compile 'com.github.Aspsine:SwipeToLoadLayout:1.0.3'
61 | compile 'me.drakeet.materialdialog:library:1.3.1'
62 | compile 'com.lzy.net:okgo:2.0.0'
63 | //可以单独使用,不需要依赖下方的扩展包
64 | compile 'com.lzy.net:okrx:0.1.0'
65 | //RxJava扩展支持,根据需要添加
66 | //compile 'com.lzy.net:okserver:1.1.0' //下载管理和上传管理扩展,根据需要添加
67 | // debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
68 | // releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
69 | compile project(':swipeback')
70 | compile(name: 'ijkplayer-java-release', ext: 'aar')
71 | compile 'com.github.ctiao:DanmakuFlameMaster:0.6.2'
72 | compile 'org.greenrobot:greendao:3.1.1'
73 | // compile 'org.greenrobot:greendao-generator:3.1.0'
74 | compile 'com.android.support:multidex:1.0.1'
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/widget/media/IRenderView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Zhang Rui
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.lcorekit.l.live.widget.media;
18 |
19 | import android.graphics.SurfaceTexture;
20 | import android.support.annotation.NonNull;
21 | import android.support.annotation.Nullable;
22 | import android.view.Surface;
23 | import android.view.SurfaceHolder;
24 | import android.view.View;
25 |
26 | import tv.danmaku.ijk.media.player.IMediaPlayer;
27 |
28 | public interface IRenderView {
29 | int AR_ASPECT_FIT_PARENT = 0; // without clip
30 | int AR_ASPECT_FILL_PARENT = 1; // may clip
31 | int AR_ASPECT_WRAP_CONTENT = 2;
32 | int AR_MATCH_PARENT = 3;
33 | int AR_16_9_FIT_PARENT = 4;
34 | int AR_4_3_FIT_PARENT = 5;
35 |
36 | View getView();
37 |
38 | boolean shouldWaitForResize();
39 |
40 | void setVideoSize(int videoWidth, int videoHeight);
41 |
42 | void setVideoSampleAspectRatio(int videoSarNum, int videoSarDen);
43 |
44 | void setVideoRotation(int degree);
45 |
46 | void setAspectRatio(int aspectRatio);
47 |
48 | void addRenderCallback(@NonNull IRenderCallback callback);
49 |
50 | void removeRenderCallback(@NonNull IRenderCallback callback);
51 |
52 | interface ISurfaceHolder {
53 | void bindToMediaPlayer(IMediaPlayer mp);
54 |
55 | @NonNull
56 | IRenderView getRenderView();
57 |
58 | @Nullable
59 | SurfaceHolder getSurfaceHolder();
60 |
61 | @Nullable
62 | Surface openSurface();
63 |
64 | @Nullable
65 | SurfaceTexture getSurfaceTexture();
66 | }
67 |
68 | interface IRenderCallback {
69 | /**
70 | * @param holder
71 | * @param width could be 0
72 | * @param height could be 0
73 | */
74 | void onSurfaceCreated(@NonNull ISurfaceHolder holder, int width, int height);
75 |
76 | /**
77 | * @param holder
78 | * @param format could be 0
79 | * @param width
80 | * @param height
81 | */
82 | void onSurfaceChanged(@NonNull ISurfaceHolder holder, int format, int width, int height);
83 |
84 | void onSurfaceDestroyed(@NonNull ISurfaceHolder holder);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/model/DouYuModel.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.model;
2 |
3 |
4 | import com.lcorekit.l.live.mvp.model.impl.IDouYuModel;
5 | import com.lcorekit.l.live.utils.DouYuApi;
6 | import com.lcorekit.l.live.utils.NumberUtils;
7 | import com.lzy.okgo.OkGo;
8 | import com.lzy.okgo.convert.StringConvert;
9 | import com.lzy.okrx.RxAdapter;
10 |
11 | import rx.Observable;
12 |
13 | /**
14 | * 数据请求
15 | * Created by l on 16-12-31.
16 | */
17 |
18 | public class DouYuModel implements IDouYuModel {
19 | public DouYuModel() {
20 | }
21 |
22 | /**
23 | * 所有类别
24 | *
25 | * @return Observable
26 | */
27 | @Override
28 | public Observable ChannelsGet() {
29 | return OkGo.get(DouYuApi.getDouyuAllSubChannelsUrl())
30 | .getCall(StringConvert.create(), RxAdapter.create());
31 | }
32 |
33 | /**
34 | * 频道列表
35 | */
36 | @Override
37 | public Observable ChannelListGet(int channelid, int offset) {
38 | return OkGo.get(DouYuApi.getChannelUrl(channelid, offset))
39 | .getCall(StringConvert.create(), RxAdapter.create());
40 | }
41 |
42 | /**
43 | * 推荐
44 | *
45 | * @return Observable
46 | */
47 | @Override
48 | public Observable RecommendGet(int offset) {
49 | return OkGo.get(DouYuApi.getDouyuRecommendUrl(offset))
50 | .getCall(StringConvert.create(), RxAdapter.create());
51 | }
52 |
53 | /**
54 | * 搜索
55 | */
56 | @Override
57 | public Observable SearchGet(String keyword) {
58 | String url;
59 | //判断是关键字还是房间号
60 | if (NumberUtils.isNumeric(keyword)) {
61 | url = DouYuApi.getDouyuRoom(Integer.valueOf(keyword));
62 | } else {
63 | url = DouYuApi.getDouyuSearchUrl(keyword);
64 | }
65 | return OkGo.get(url)
66 | .getCall(StringConvert.create(), RxAdapter.create());
67 | }
68 |
69 | /**
70 | * 获取房间播放信息
71 | *
72 | * @param roomId 房间号
73 | * @return Observable
74 | */
75 | @Override
76 | public Observable PlyerInfoGet(int roomId) {
77 | return OkGo.post(DouYuApi.getDouyuRoomUrl(roomId))
78 | .params(DouYuApi.getDouyuRoomParams(roomId))
79 | .getCall(StringConvert.create(), RxAdapter.create());
80 | }
81 |
82 | /**
83 | * 获取频道所有主播
84 | *
85 | * @param tag tag
86 | * @return Observable
87 | */
88 | @Override
89 | public Observable ChannelInfoGet(int tag, int offset) {
90 | String douyuSubChannelBaseTag = DouYuApi.getDouyuSubChannelBaseTag(tag);
91 | return OkGo.get(DouYuApi.getChannelUrl(tag, offset))
92 | .getCall(StringConvert.create(), RxAdapter.create());
93 | }
94 |
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/ChannelPresenter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter;
2 |
3 | import android.util.Log;
4 |
5 | import com.google.gson.Gson;
6 | import com.lcorekit.l.live.bean.AllSubChannels;
7 | import com.lcorekit.l.live.bean.SubChannelInfo;
8 | import com.lcorekit.l.live.mvp.model.DouYuModel;
9 | import com.lcorekit.l.live.mvp.model.impl.IDouYuModel;
10 | import com.lcorekit.l.live.mvp.presenter.impl.IChannelPresenter;
11 | import com.lcorekit.l.live.mvp.view.fragment.impl.ChannelsFragmentView;
12 |
13 | import java.util.ArrayList;
14 | import java.util.List;
15 |
16 | import rx.Subscriber;
17 | import rx.android.schedulers.AndroidSchedulers;
18 |
19 | /**
20 | * Created by l on 16-12-30.
21 | */
22 |
23 | public class ChannelPresenter implements IChannelPresenter {
24 | private ChannelsFragmentView view;
25 | private IDouYuModel model;
26 |
27 | public ChannelPresenter(ChannelsFragmentView view) {
28 | this.view = view;
29 | model = new DouYuModel();
30 | }
31 |
32 | @Override
33 | public void getAllChannels() {
34 | model.ChannelsGet()
35 | .observeOn(AndroidSchedulers.mainThread())
36 | .subscribe(getAllChannelsSubscriber());
37 | }
38 |
39 | private Subscriber getAllChannelsSubscriber() {
40 | Subscriber allChannelsSubscriber;
41 | allChannelsSubscriber = new Subscriber() {
42 |
43 | @Override
44 | public void onCompleted() {
45 | Log.i("RX", "onCompleted");
46 | //停止刷新
47 | view.swipeToLoadComplete();
48 | }
49 |
50 | @Override
51 | public void onError(Throwable e) {
52 | Log.i("RX", "error");
53 | //停止刷新
54 | view.swipeToLoadComplete();
55 | }
56 |
57 | @Override
58 | public void onNext(String s) {
59 | Log.i("RX-->result: ", s);
60 | List subChannelInfos = new ArrayList<>();
61 | Gson gson = new Gson();
62 | try {
63 | AllSubChannels allSubChannels = gson.fromJson(s, AllSubChannels.class);
64 | for (AllSubChannels.Data data : allSubChannels.data) {
65 | SubChannelInfo subChannelInfo = new SubChannelInfo();
66 | subChannelInfo.tagId = data.tag_id;
67 | subChannelInfo.tagName = data.tag_name;
68 | subChannelInfo.iconUrl = data.icon_url;
69 | subChannelInfos.add(subChannelInfo);
70 | }
71 | view.showData(subChannelInfos);
72 | view.swipeToLoadComplete();
73 | unsubscribe();
74 | } catch (Exception e) {
75 | e.printStackTrace();
76 | }
77 | }
78 | };
79 | return allChannelsSubscriber;
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/RecommendPresenter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter;
2 |
3 | import android.util.Log;
4 |
5 | import com.google.gson.Gson;
6 | import com.lcorekit.l.live.bean.RoomInfo;
7 | import com.lcorekit.l.live.bean.SubChannel;
8 | import com.lcorekit.l.live.mvp.model.DouYuModel;
9 | import com.lcorekit.l.live.mvp.model.impl.IDouYuModel;
10 | import com.lcorekit.l.live.mvp.presenter.impl.IRecommendPresenter;
11 | import com.lcorekit.l.live.mvp.view.fragment.impl.RecommendFragmentView;
12 |
13 | import java.util.ArrayList;
14 | import java.util.List;
15 |
16 | import rx.Subscriber;
17 | import rx.android.schedulers.AndroidSchedulers;
18 |
19 | /**
20 | * Created by l on 16-12-30.
21 | */
22 |
23 | public class RecommendPresenter implements IRecommendPresenter {
24 | private RecommendFragmentView view;
25 | private IDouYuModel model;
26 |
27 | public RecommendPresenter(RecommendFragmentView view) {
28 | this.view = view;
29 | model = new DouYuModel();
30 | }
31 |
32 | @Override
33 | public void getRecommend(int offset) {
34 | model.RecommendGet(offset)
35 | .observeOn(AndroidSchedulers.mainThread())
36 | .subscribe(getrecommendSubscriber());
37 | }
38 |
39 | private Subscriber getrecommendSubscriber() {
40 | Subscriber recommendSubscriber;
41 | recommendSubscriber = new Subscriber() {
42 | @Override
43 | public void onCompleted() {
44 | Log.i("RX", "onCompleted");
45 | //停止刷新
46 | view.swipeToLoadComplete();
47 | }
48 |
49 | @Override
50 | public void onError(Throwable e) {
51 | Log.i("RX", "error");
52 | //停止刷新
53 | view.swipeToLoadComplete();
54 | }
55 |
56 | @Override
57 | public void onNext(String s) {
58 | Log.i("RX-->result: ", s);
59 | List roomInfos = new ArrayList<>();
60 | try {
61 | Gson gson = new Gson();
62 | SubChannel douyuRoomInfo = gson.fromJson(s, SubChannel.class);
63 | for (SubChannel.Room room : douyuRoomInfo.data) {
64 | RoomInfo roomInfo = new RoomInfo();
65 | roomInfo.roomId = room.room_id;
66 | roomInfo.roomSrc = room.room_src;
67 | Log.i("room_name", room.room_name);
68 | roomInfo.nickname = room.nickname;
69 | roomInfo.roomName = room.room_name;
70 | roomInfo.online = room.online;
71 | roomInfos.add(roomInfo);
72 | }
73 | view.showData(roomInfos);
74 | unsubscribe();
75 | view.swipeToLoadComplete();
76 | } catch (Exception e) {
77 | e.printStackTrace();
78 | }
79 | }
80 | };
81 | return recommendSubscriber;
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/widget/media/MediaPlayerCompat.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Zhang Rui
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.lcorekit.l.live.widget.media;
18 |
19 | import tv.danmaku.ijk.media.player.IMediaPlayer;
20 | import tv.danmaku.ijk.media.player.IjkMediaPlayer;
21 | import tv.danmaku.ijk.media.player.MediaPlayerProxy;
22 | import tv.danmaku.ijk.media.player.TextureMediaPlayer;
23 |
24 | public class MediaPlayerCompat {
25 | public static String getName(IMediaPlayer mp) {
26 | if (mp == null) {
27 | return "null";
28 | } else if (mp instanceof TextureMediaPlayer) {
29 | StringBuilder sb = new StringBuilder("TextureMediaPlayer <");
30 | IMediaPlayer internalMediaPlayer = ((TextureMediaPlayer) mp).getInternalMediaPlayer();
31 | if (internalMediaPlayer == null) {
32 | sb.append("null>");
33 | } else {
34 | sb.append(internalMediaPlayer.getClass().getSimpleName());
35 | sb.append(">");
36 | }
37 | return sb.toString();
38 | } else {
39 | return mp.getClass().getSimpleName();
40 | }
41 | }
42 |
43 | public static IjkMediaPlayer getIjkMediaPlayer(IMediaPlayer mp) {
44 | IjkMediaPlayer ijkMediaPlayer = null;
45 | if (mp == null) {
46 | return null;
47 | } if (mp instanceof IjkMediaPlayer) {
48 | ijkMediaPlayer = (IjkMediaPlayer) mp;
49 | } else if (mp instanceof MediaPlayerProxy && ((MediaPlayerProxy) mp).getInternalMediaPlayer() instanceof IjkMediaPlayer) {
50 | ijkMediaPlayer = (IjkMediaPlayer) ((MediaPlayerProxy) mp).getInternalMediaPlayer();
51 | }
52 | return ijkMediaPlayer;
53 | }
54 |
55 | public static void selectTrack(IMediaPlayer mp, int stream) {
56 | IjkMediaPlayer ijkMediaPlayer = getIjkMediaPlayer(mp);
57 | if (ijkMediaPlayer == null)
58 | return;
59 | ijkMediaPlayer.selectTrack(stream);
60 | }
61 |
62 | public static void deselectTrack(IMediaPlayer mp, int stream) {
63 | IjkMediaPlayer ijkMediaPlayer = getIjkMediaPlayer(mp);
64 | if (ijkMediaPlayer == null)
65 | return;
66 | ijkMediaPlayer.deselectTrack(stream);
67 | }
68 |
69 | public static int getSelectedTrack(IMediaPlayer mp, int trackType) {
70 | IjkMediaPlayer ijkMediaPlayer = getIjkMediaPlayer(mp);
71 | if (ijkMediaPlayer == null)
72 | return -1;
73 | return ijkMediaPlayer.getSelectedTrack(trackType);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/ChannelInfoPreseter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter;
2 |
3 | import android.util.Log;
4 |
5 | import com.google.gson.Gson;
6 | import com.lcorekit.l.live.bean.RoomInfo;
7 | import com.lcorekit.l.live.bean.SubChannel;
8 | import com.lcorekit.l.live.mvp.model.DouYuModel;
9 | import com.lcorekit.l.live.mvp.model.impl.IDouYuModel;
10 | import com.lcorekit.l.live.mvp.presenter.impl.IChannelInfoPreseter;
11 | import com.lcorekit.l.live.mvp.view.activity.impl.ChannelInfoListActivityView;
12 |
13 | import java.util.ArrayList;
14 | import java.util.List;
15 |
16 | import rx.Observer;
17 | import rx.Subscriber;
18 | import rx.android.schedulers.AndroidSchedulers;
19 |
20 | /**
21 | * Created by l on 17-1-9.
22 | */
23 |
24 | public class ChannelInfoPreseter implements IChannelInfoPreseter {
25 | private ChannelInfoListActivityView view;
26 | private IDouYuModel model;
27 |
28 | public ChannelInfoPreseter(ChannelInfoListActivityView view) {
29 | this.view = view;
30 | model = new DouYuModel();
31 | }
32 |
33 | @Override
34 | public void getChannelInfoList(int tag, int offset) {
35 | model.ChannelInfoGet(tag, offset)
36 | .observeOn(AndroidSchedulers.mainThread())
37 | .subscribe(getChannelInfoListSubscriber());
38 | }
39 |
40 | private Observer super String> getChannelInfoListSubscriber() {
41 | Subscriber channelInfoListSubscriber;
42 | channelInfoListSubscriber = new Subscriber() {
43 | @Override
44 | public void onCompleted() {
45 | Log.i("RX", "onCompleted");
46 | //停止刷新
47 | view.swipeToLoadComplete();
48 | }
49 |
50 | @Override
51 | public void onError(Throwable e) {
52 | Log.i("RX", "error");
53 | //停止刷新
54 | view.swipeToLoadComplete();
55 | }
56 |
57 | @Override
58 | public void onNext(String s) {
59 | Log.i("RX-->result: ", s);
60 | List roomInfos = new ArrayList<>();
61 | try {
62 | Gson gson = new Gson();
63 | SubChannel douyuRoomInfo = gson.fromJson(s, SubChannel.class);
64 | for (SubChannel.Room room : douyuRoomInfo.data) {
65 | RoomInfo roomInfo = new RoomInfo();
66 | roomInfo.roomId = room.room_id;
67 | roomInfo.roomSrc = room.room_src;
68 | Log.i("room_name", room.room_name);
69 | roomInfo.nickname = room.nickname;
70 | roomInfo.roomName = room.room_name;
71 | roomInfo.online = room.online;
72 | roomInfos.add(roomInfo);
73 | }
74 | view.showData(roomInfos);
75 | unsubscribe();
76 | view.swipeToLoadComplete();
77 | } catch (Exception e) {
78 | e.printStackTrace();
79 | }
80 | }
81 | };
82 | return channelInfoListSubscriber;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/presenter/SearchPresenter.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.presenter;
2 |
3 | import android.util.Log;
4 |
5 | import com.google.gson.Gson;
6 | import com.lcorekit.l.live.bean.DouyuRoomInfo;
7 | import com.lcorekit.l.live.bean.RoomInfo;
8 | import com.lcorekit.l.live.bean.SubChannel;
9 | import com.lcorekit.l.live.mvp.model.DouYuModel;
10 | import com.lcorekit.l.live.mvp.model.impl.IDouYuModel;
11 | import com.lcorekit.l.live.mvp.presenter.impl.ISearchPresenter;
12 | import com.lcorekit.l.live.mvp.view.activity.impl.SearchActivityView;
13 |
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | import rx.Observer;
18 | import rx.Subscriber;
19 | import rx.android.schedulers.AndroidSchedulers;
20 |
21 | /**
22 | * Created by l on 17-1-6.
23 | */
24 |
25 | public class SearchPresenter implements ISearchPresenter {
26 | private SearchActivityView view;
27 | private IDouYuModel model;
28 |
29 | public SearchPresenter(SearchActivityView view) {
30 | this.view = view;
31 | model = new DouYuModel();
32 | }
33 |
34 | @Override
35 | public void getSearchListResult(String keyword) {
36 | model.SearchGet(keyword)
37 | .observeOn(AndroidSchedulers.mainThread())
38 | .subscribe(getSearchListSubscriber());
39 | }
40 |
41 | private Observer super String> getSearchListSubscriber() {
42 | Subscriber searchListSubscriber;
43 | searchListSubscriber = new Subscriber() {
44 | @Override
45 | public void onCompleted() {
46 | Log.i("RX", "onCompleted");
47 | //停止刷新
48 | view.swipeToLoadComplete();
49 | }
50 |
51 | @Override
52 | public void onError(Throwable e) {
53 | Log.i("RX", "error");
54 | //停止刷新
55 | view.swipeToLoadComplete();
56 | }
57 |
58 | @Override
59 | public void onNext(String s) {
60 | Log.i("RX-->result: ", s);
61 | List roomInfos = new ArrayList<>();
62 | try {
63 | Gson gson = new Gson();
64 | DouyuRoomInfo douyuRoomInfo = gson.fromJson(s, DouyuRoomInfo.class);
65 | for (SubChannel.Room room : douyuRoomInfo.data.room) {
66 | RoomInfo roomInfo = new RoomInfo();
67 | roomInfo.roomId = room.room_id;
68 | if (room.room_src != null) {
69 | roomInfo.roomSrc = room.room_src;
70 | } else {
71 | roomInfo.roomSrc = room.roomSrc;
72 | }
73 | Log.i("room_name", room.room_name);
74 | roomInfo.nickname = room.nickname;
75 | roomInfo.roomName = room.room_name;
76 | roomInfo.online = room.online;
77 | roomInfos.add(roomInfo);
78 | }
79 | view.showData(roomInfos);
80 | unsubscribe();
81 | view.swipeToLoadComplete();
82 | } catch (Exception e) {
83 | e.printStackTrace();
84 | }
85 | }
86 | };
87 | return searchListSubscriber;
88 | }
89 |
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/db/DaoMaster.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.db;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteDatabase.CursorFactory;
6 | import android.util.Log;
7 |
8 | import org.greenrobot.greendao.AbstractDaoMaster;
9 | import org.greenrobot.greendao.database.StandardDatabase;
10 | import org.greenrobot.greendao.database.Database;
11 | import org.greenrobot.greendao.database.DatabaseOpenHelper;
12 | import org.greenrobot.greendao.identityscope.IdentityScopeType;
13 |
14 |
15 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
16 | /**
17 | * Master of DAO (schema version 1): knows all DAOs.
18 | */
19 | public class DaoMaster extends AbstractDaoMaster {
20 | public static final int SCHEMA_VERSION = 1;
21 |
22 | /** Creates underlying database table using DAOs. */
23 | public static void createAllTables(Database db, boolean ifNotExists) {
24 | PersonDao.createTable(db, ifNotExists);
25 | }
26 |
27 | /** Drops underlying database table using DAOs. */
28 | public static void dropAllTables(Database db, boolean ifExists) {
29 | PersonDao.dropTable(db, ifExists);
30 | }
31 |
32 | /**
33 | * WARNING: Drops all table on Upgrade! Use only during development.
34 | * Convenience method using a {@link DevOpenHelper}.
35 | */
36 | public static DaoSession newDevSession(Context context, String name) {
37 | Database db = new DevOpenHelper(context, name).getWritableDb();
38 | DaoMaster daoMaster = new DaoMaster(db);
39 | return daoMaster.newSession();
40 | }
41 |
42 | public DaoMaster(SQLiteDatabase db) {
43 | this(new StandardDatabase(db));
44 | }
45 |
46 | public DaoMaster(Database db) {
47 | super(db, SCHEMA_VERSION);
48 | registerDaoClass(PersonDao.class);
49 | }
50 |
51 | public DaoSession newSession() {
52 | return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);
53 | }
54 |
55 | public DaoSession newSession(IdentityScopeType type) {
56 | return new DaoSession(db, type, daoConfigMap);
57 | }
58 |
59 | /**
60 | * Calls {@link #createAllTables(Database, boolean)} in {@link #onCreate(Database)} -
61 | */
62 | public static abstract class OpenHelper extends DatabaseOpenHelper {
63 | public OpenHelper(Context context, String name) {
64 | super(context, name, SCHEMA_VERSION);
65 | }
66 |
67 | public OpenHelper(Context context, String name, CursorFactory factory) {
68 | super(context, name, factory, SCHEMA_VERSION);
69 | }
70 |
71 | @Override
72 | public void onCreate(Database db) {
73 | Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
74 | createAllTables(db, false);
75 | }
76 | }
77 |
78 | /** WARNING: Drops all table on Upgrade! Use only during development. */
79 | public static class DevOpenHelper extends OpenHelper {
80 | public DevOpenHelper(Context context, String name) {
81 | super(context, name);
82 | }
83 |
84 | public DevOpenHelper(Context context, String name, CursorFactory factory) {
85 | super(context, name, factory);
86 | }
87 |
88 | @Override
89 | public void onUpgrade(Database db, int oldVersion, int newVersion) {
90 | Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
91 | dropAllTables(db, true);
92 | onCreate(db);
93 | }
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/fragment/SettingFragment.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.fragment;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.RelativeLayout;
11 | import android.widget.TextView;
12 | import android.widget.Toast;
13 |
14 | import com.lcorekit.l.douyu.R;
15 | import com.lcorekit.l.live.App;
16 | import com.lcorekit.l.live.mvp.view.activity.AboutActivity;
17 | import com.lcorekit.l.live.mvp.view.fragment.impl.SettingFragmentView;
18 | import com.lcorekit.l.live.utils.FileUtils;
19 |
20 | import butterknife.BindView;
21 | import butterknife.ButterKnife;
22 | import butterknife.OnClick;
23 | import me.drakeet.materialdialog.MaterialDialog;
24 |
25 | /**
26 | * Created by l on 16-12-31.
27 | */
28 |
29 | public class SettingFragment extends Fragment implements SettingFragmentView {
30 |
31 | private static SettingFragment fragment = null;
32 | @BindView(R.id.rl_setting_clearcache)
33 | RelativeLayout rlSettingClearcache;
34 | @BindView(R.id.tv_about)
35 | TextView tvAbout;
36 | @BindView(R.id.tv_setting_cache)
37 | TextView tvSettingCache;
38 | private View mView;
39 |
40 | public static synchronized SettingFragment getInstance(int type) {
41 | if (fragment == null) {
42 | Bundle args = new Bundle();
43 | fragment = new SettingFragment();
44 | args.putInt("type", type);
45 | fragment.setArguments(args);
46 | }
47 | return fragment;
48 | }
49 |
50 | @Nullable
51 | @Override
52 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
53 | if (mView == null) {
54 | mView = inflater.inflate(R.layout.fragment_setting, container, false);
55 | ButterKnife.bind(this, this.mView);
56 | }
57 | initData();
58 | return mView;
59 | }
60 |
61 | private void initData() {
62 | tvSettingCache.setText(FileUtils.getCacheSize());
63 | }
64 |
65 | @OnClick({R.id.rl_setting_clearcache, R.id.tv_about})
66 | public void onClick(View view) {
67 | switch (view.getId()) {
68 | case R.id.rl_setting_clearcache:
69 | showDialog("清理缓存");
70 | break;
71 | case R.id.tv_about:
72 | startActivity(new Intent(getContext(), AboutActivity.class));
73 | break;
74 | }
75 | }
76 |
77 | private void showDialog(CharSequence title) {
78 | final MaterialDialog dialog = new MaterialDialog(getActivity())
79 | .setTitle(title)
80 | .setMessage("是否清楚缓存")
81 | .setCanceledOnTouchOutside(true);
82 | dialog.setPositiveButton("OK", new View.OnClickListener() {
83 | @Override
84 | public void onClick(View v) {
85 | App.getACache().clear();
86 | tvSettingCache.setText(FileUtils.getCacheSize());
87 | Toast.makeText(getContext(), "缓存已清除", Toast.LENGTH_SHORT).show();
88 | dialog.dismiss();
89 | }
90 | });
91 | dialog.setNegativeButton("取消", new View.OnClickListener() {
92 | @Override
93 | public void onClick(View v) {
94 | dialog.dismiss();
95 | }
96 | });
97 | dialog.show();
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/danmu/msg/DyMessage.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.danmu.msg;
2 |
3 |
4 | import com.lcorekit.l.live.danmu.utils.FormatTransfer;
5 |
6 | import java.io.ByteArrayOutputStream;
7 | import java.io.DataOutputStream;
8 |
9 |
10 | public class DyMessage {
11 | //弹幕客户端类型设置
12 | public final static int DY_MESSAGE_TYPE_CLIENT = 689;
13 |
14 | /**
15 | * 生成登录请求数据包
16 | * @param roomId
17 | * @return
18 | */
19 | public static byte[] getLoginRequestData(int roomId){
20 | //编码器初始化
21 | DyEncoder enc = new DyEncoder();
22 | //添加登录协议type类型
23 | enc.addItem("type", "loginreq");
24 | //添加登录房间ID
25 | enc.addItem("roomid", roomId);
26 |
27 | //返回登录协议数据
28 | return DyMessage.getByte(enc.getResult());
29 | }
30 |
31 | /**
32 | * 解析登录请求返回结果
33 | * @param respond
34 | * @return
35 | */
36 | public static boolean parseLoginRespond(byte[] respond){
37 | boolean rtn = false;
38 |
39 | //返回数据不正确(仅包含12位信息头,没有信息内容)
40 | if(respond.length <= 12){
41 | return rtn;
42 | }
43 |
44 | //解析返回信息包中的信息内容
45 | String dataStr = new String(respond, 12, respond.length - 12);
46 |
47 | //针对登录返回信息进行判断
48 | // if(StringUtils.contains(dataStr, "type@=loginres")){
49 | // rtn = true;
50 | // }
51 | if(dataStr.contains("type@=loginres")){
52 | rtn = true;
53 | }
54 |
55 | //返回登录是否成功判断结果
56 | return rtn;
57 | }
58 |
59 | /**
60 | * 生成加入弹幕分组池数据包
61 | * @param roomId
62 | * @param groupId
63 | * @return
64 | */
65 | public static byte[] getJoinGroupRequest(int roomId, int groupId){
66 | //编码器初始化
67 | DyEncoder enc = new DyEncoder();
68 | //添加加入弹幕池协议type类型
69 | enc.addItem("type", "joingroup");
70 | //添加房间id信息
71 | enc.addItem("rid", roomId);
72 | //添加弹幕分组池id信息
73 | enc.addItem("gid", groupId);
74 |
75 | //返回加入弹幕池协议数据
76 | return DyMessage.getByte(enc.getResult());
77 | }
78 |
79 | /**
80 | * 生成心跳协议数据包
81 | * @param timeStamp
82 | * @return
83 | */
84 | public static byte[] getKeepAliveData(int timeStamp){
85 | //编码器初始化
86 | DyEncoder enc = new DyEncoder();
87 | //添加心跳协议type类型
88 | enc.addItem("type", "keeplive");
89 | //添加心跳时间戳
90 | enc.addItem("tick", timeStamp);
91 |
92 | //返回心跳协议数据
93 | return DyMessage.getByte(enc.getResult());
94 | }
95 |
96 | /**
97 | * 通用方法,将数据转换为小端整数格式
98 | * @param data
99 | * @return
100 | */
101 | private static byte[] getByte(String data){
102 | ByteArrayOutputStream boutput = new ByteArrayOutputStream();
103 | DataOutputStream doutput = new DataOutputStream(boutput);
104 |
105 | try
106 | {
107 | boutput.reset();
108 | doutput.write(FormatTransfer.toLH(data.length() + 8), 0, 4); // 4 bytes packet length
109 | doutput.write(FormatTransfer.toLH(data.length() + 8), 0, 4); // 4 bytes packet length
110 | doutput.write(FormatTransfer.toLH(DY_MESSAGE_TYPE_CLIENT), 0, 2); // 2 bytes message type
111 | doutput.writeByte(0); // 1 bytes encrypt
112 | doutput.writeByte(0); // 1 bytes reserve
113 | doutput.writeBytes(data);
114 | }
115 | catch(Exception e)
116 | {
117 | e.printStackTrace();
118 | }
119 |
120 | return boutput.toByteArray();
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/fragment/LiveFragment.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.fragment;
2 |
3 | import android.graphics.Color;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.design.widget.TabLayout;
7 | import android.support.v4.app.Fragment;
8 | import android.support.v4.view.ViewPager;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 |
13 | import com.lcorekit.l.douyu.R;
14 | import com.lcorekit.l.live.adapter.BaseFragmentAdapter;
15 | import com.lcorekit.l.live.commons.Pages;
16 | import com.lcorekit.l.live.mvp.view.fragment.impl.LiveFragmentView;
17 | import com.lcorekit.l.live.mvp.view.fragment.secondfragment.CsGoFragment;
18 | import com.lcorekit.l.live.mvp.view.fragment.secondfragment.Dota2Fragment;
19 | import com.lcorekit.l.live.mvp.view.fragment.secondfragment.HearthStoneFragment;
20 | import com.lcorekit.l.live.mvp.view.fragment.secondfragment.LoLFragment;
21 | import com.lcorekit.l.live.mvp.view.fragment.secondfragment.StarCraftFragment;
22 | import com.lcorekit.l.live.mvp.view.fragment.secondfragment.WoWFragment;
23 |
24 | import butterknife.BindView;
25 | import butterknife.ButterKnife;
26 |
27 | /**
28 | * 所有频道列表
29 | * Created by l on 16-12-31.
30 | */
31 |
32 | public class LiveFragment extends Fragment implements LiveFragmentView {
33 |
34 | private static LiveFragment fragment = null;
35 | @BindView(R.id.vp_content)
36 | ViewPager vpContent;
37 | @BindView(R.id.tb_channels)
38 | TabLayout tbChannels;
39 | private View mView;
40 | private String[] mTitles;
41 |
42 | public static LiveFragment getInstance(int type) {
43 | Bundle args = new Bundle();
44 | fragment = new LiveFragment();
45 | args.putInt("type", type);
46 | fragment.setArguments(args);
47 | return fragment;
48 | }
49 |
50 | @Nullable
51 | @Override
52 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
53 | if (mView == null) {
54 | mView = inflater.inflate(R.layout.fragment_channals_list, container, false);
55 | ButterKnife.bind(this, mView);
56 | }
57 | initData();
58 | return mView;
59 | }
60 |
61 | /**
62 | * 初始化数据
63 | */
64 | @Override
65 | public void initData() {
66 | tbChannels.setTabTextColors(Color.DKGRAY, getResources().getColor(R.color.colorPrimary));
67 | tbChannels.setSelectedTabIndicatorColor(getResources().getColor(R.color.colorPrimary));
68 | tbChannels.setTabMode(TabLayout.MODE_SCROLLABLE);
69 | vpContent.setOffscreenPageLimit(3);
70 | mTitles = Pages.TITLES;
71 | //设置标题
72 | for (int i = 0; i < mTitles.length; i++) {
73 | tbChannels.addTab(tbChannels.newTab().setText(mTitles[i]));
74 | }
75 | setUpViewPager(vpContent);
76 | tbChannels.setupWithViewPager(vpContent);
77 | }
78 |
79 | /**
80 | * 设置ViewPager
81 | */
82 | @Override
83 | public void setUpViewPager(ViewPager mViewPager) {
84 | BaseFragmentAdapter adapter = new BaseFragmentAdapter(getChildFragmentManager());
85 | adapter.addFragment(LoLFragment.getInstance(Pages.LOL_PAGE), mTitles[0]);
86 | adapter.addFragment(HearthStoneFragment.getInstance(Pages.HEARTHSTONE_PAGE), mTitles[1]);
87 | adapter.addFragment(Dota2Fragment.getInstance(Pages.DOTA2_PAGE), mTitles[2]);
88 | adapter.addFragment(StarCraftFragment.getInstance(Pages.STARCRAFT_PAGE), mTitles[3]);
89 | adapter.addFragment(WoWFragment.getInstance(Pages.WOW_PAGE), mTitles[4]);
90 | adapter.addFragment(CsGoFragment.getInstance(Pages.CSGO_PAGE), mTitles[5]);
91 | mViewPager.setAdapter(adapter);
92 | mViewPager.setCurrentItem(0);
93 | }
94 |
95 | @Override
96 | public void onPause() {
97 | super.onPause();
98 | onDestroy();
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/widget/ClassicRefreshHeaderView.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.widget;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.util.Log;
6 | import android.view.animation.Animation;
7 | import android.view.animation.AnimationUtils;
8 | import android.widget.ImageView;
9 | import android.widget.ProgressBar;
10 | import android.widget.TextView;
11 |
12 | import com.aspsine.swipetoloadlayout.SwipeRefreshHeaderLayout;
13 | import com.lcorekit.l.douyu.R;
14 |
15 | /**
16 | * Created by Aspsine on 2015/9/9.
17 | */
18 | public class ClassicRefreshHeaderView extends SwipeRefreshHeaderLayout {
19 |
20 | private ImageView ivArrow;
21 |
22 | private ImageView ivSuccess;
23 |
24 | private TextView tvRefresh;
25 |
26 | private ProgressBar progressBar;
27 |
28 | private int mHeaderHeight;
29 |
30 | private Animation rotateUp;
31 |
32 | private Animation rotateDown;
33 |
34 | private boolean rotated = false;
35 |
36 | public ClassicRefreshHeaderView(Context context) {
37 | this(context, null);
38 | }
39 |
40 | public ClassicRefreshHeaderView(Context context, AttributeSet attrs) {
41 | this(context, attrs, 0);
42 | }
43 |
44 | public ClassicRefreshHeaderView(Context context, AttributeSet attrs, int defStyleAttr) {
45 | super(context, attrs, defStyleAttr);
46 | mHeaderHeight = getResources().getDimensionPixelOffset(R.dimen.refresh_header_height);
47 | rotateUp = AnimationUtils.loadAnimation(context, R.anim.rotate_up);
48 | rotateDown = AnimationUtils.loadAnimation(context, R.anim.rotate_down);
49 | }
50 |
51 | @Override
52 | protected void onFinishInflate() {
53 | super.onFinishInflate();
54 |
55 | tvRefresh = (TextView) findViewById(R.id.tvRefresh);
56 | ivArrow = (ImageView) findViewById(R.id.ivArrow);
57 | ivSuccess = (ImageView) findViewById(R.id.ivSuccess);
58 | progressBar = (ProgressBar) findViewById(R.id.progressbar);
59 | }
60 |
61 | @Override
62 | public void onRefresh() {
63 | ivSuccess.setVisibility(GONE);
64 | ivArrow.clearAnimation();
65 | ivArrow.setVisibility(GONE);
66 | progressBar.setVisibility(VISIBLE);
67 | tvRefresh.setText("正在刷新");
68 | }
69 |
70 | @Override
71 | public void onPrepare() {
72 | Log.d("TwitterRefreshHeader", "onPrepare()");
73 | }
74 |
75 | @Override
76 | public void onMove(int y, boolean isComplete, boolean automatic) {
77 | if (!isComplete) {
78 | ivArrow.setVisibility(VISIBLE);
79 | progressBar.setVisibility(GONE);
80 | ivSuccess.setVisibility(GONE);
81 | if (y > mHeaderHeight) {
82 | tvRefresh.setText("释放刷新");
83 | if (!rotated) {
84 | ivArrow.clearAnimation();
85 | ivArrow.startAnimation(rotateUp);
86 | rotated = true;
87 | }
88 | } else if (y < mHeaderHeight) {
89 | if (rotated) {
90 | ivArrow.clearAnimation();
91 | ivArrow.startAnimation(rotateDown);
92 | rotated = false;
93 | }
94 |
95 | tvRefresh.setText("下拉刷新");
96 | }
97 | }
98 | }
99 |
100 | @Override
101 | public void onRelease() {
102 | Log.d("RefreshHeader", "onRelease()");
103 | }
104 |
105 | @Override
106 | public void onComplete() {
107 | rotated = false;
108 | ivSuccess.setVisibility(VISIBLE);
109 | ivArrow.clearAnimation();
110 | ivArrow.setVisibility(GONE);
111 | progressBar.setVisibility(GONE);
112 | tvRefresh.setText("完成");
113 | }
114 |
115 | @Override
116 | public void onReset() {
117 | rotated = false;
118 | ivSuccess.setVisibility(GONE);
119 | ivArrow.clearAnimation();
120 | ivArrow.setVisibility(GONE);
121 | progressBar.setVisibility(GONE);
122 | }
123 |
124 | }
125 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/App.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live;
2 |
3 | import android.content.Context;
4 | import android.support.multidex.MultiDexApplication;
5 |
6 | import com.lcorekit.l.live.utils.ACache;
7 | import com.lzy.okgo.OkGo;
8 | import com.lzy.okgo.cache.CacheEntity;
9 | import com.lzy.okgo.cache.CacheMode;
10 | import com.lzy.okgo.cookie.store.PersistentCookieStore;
11 |
12 | import java.io.File;
13 | import java.io.FileNotFoundException;
14 | import java.io.PrintStream;
15 |
16 | /**
17 | * Created by l on 16-12-29.
18 | */
19 |
20 | public class App extends MultiDexApplication {
21 | private static Context mContext;
22 | public static final String CACHE_NAME = "picasso-cache";
23 | private static ACache mACache;
24 |
25 | @Override
26 | public void onCreate() {
27 | mContext = this;
28 | mACache = ACache.get(this, CACHE_NAME);
29 | init();
30 | }
31 |
32 | private void init() {
33 | //bug监听操作
34 | Thread.currentThread().setUncaughtExceptionHandler(new MyUncaughtExceptionHandler());
35 | // LeakCanary.install(this);
36 | //必须调用初始化
37 | OkGo.init(this);
38 | try {
39 | //以下都不是必须的,根据需要自行选择,一般来说只需要 debug,缓存相关,cookie相关的 就可以了
40 | OkGo.getInstance()
41 |
42 | //打开该调试开关,控制台会使用 红色error 级别打印log,并不是错误,是为了显眼,不需要就不要加入该行
43 | .debug("OkGo")
44 |
45 | //如果使用默认的 60秒,以下三行也不需要传
46 | .setConnectTimeout(OkGo.DEFAULT_MILLISECONDS) //全局的连接超时时间
47 | .setReadTimeOut(OkGo.DEFAULT_MILLISECONDS) //全局的读取超时时间
48 | .setWriteTimeOut(OkGo.DEFAULT_MILLISECONDS) //全局的写入超时时间
49 |
50 | //可以全局统一设置缓存模式,默认是不使用缓存,可以不传,具体其他模式看 github 介绍 https://github.com/jeasonlzy/
51 | .setCacheMode(CacheMode.REQUEST_FAILED_READ_CACHE)
52 |
53 | //可以全局统一设置缓存时间,默认永不过期,具体使用方法看 github 介绍
54 | .setCacheTime(CacheEntity.CACHE_NEVER_EXPIRE)
55 |
56 | //如果不想让框架管理cookie,以下不需要
57 | // .setCookieStore(new MemoryCookieStore()) //cookie使用内存缓存(app退出后,cookie消失)
58 | .setCookieStore(new PersistentCookieStore()) //cookie持久化存储,如果cookie不过期,则一直有效
59 |
60 | //可以设置https的证书,以下几种方案根据需要自己设置,不需要不用设置
61 | // .setCertificates() //方法一:信任所有证书
62 | // .setCertificates(getAssets().open("srca.cer")) //方法二:也可以自己设置https证书
63 | // .setCertificates(getAssets().open("aaaa.bks"), "123456", getAssets().open("srca.cer"))//方法三:传入bks证书,密码,和cer证书,支持双向加密
64 |
65 | //可以添加全局拦截器,不会用的千万不要传,错误写法直接导致任何回调不执行
66 | // .addInterceptor(new Interceptor() {
67 | // @Override
68 | // public Response intercept(Chain chain) throws IOException {
69 | // return chain.proceed(chain.request());
70 | // }
71 | // })
72 | ;
73 | } catch (Exception e) {
74 | e.printStackTrace();
75 | }
76 | }
77 |
78 | public static Context getCotext() {
79 | return mContext;
80 | }
81 |
82 | public static ACache getACache() {
83 | return mACache;
84 | }
85 |
86 | private class MyUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
87 | //当有未捕获的bug的时候调用的方法
88 | //ex : 异常
89 | @Override
90 | public void uncaughtException(Thread thread, Throwable ex) {
91 | System.out.println("哥发现异常了,哥捕获了....");
92 | try {
93 | //将异常信息保存到本地文件中
94 | String s = ex.toString();
95 | ex.printStackTrace(new PrintStream(new File("mnt/sdcard/error.log")));
96 | } catch (FileNotFoundException e) {
97 | // TODO Auto-generated catch block
98 | e.printStackTrace();
99 | }
100 | //自杀
101 | //闪退操作
102 | android.os.Process.killProcess(android.os.Process.myPid());
103 | }
104 |
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lcorekit/l/live/mvp/view/activity/HomeActivity.java:
--------------------------------------------------------------------------------
1 | package com.lcorekit.l.live.mvp.view.activity;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.support.v7.widget.Toolbar;
9 | import android.view.Menu;
10 | import android.view.MenuItem;
11 | import android.widget.FrameLayout;
12 | import android.widget.RadioButton;
13 | import android.widget.RadioGroup;
14 |
15 | import com.lcorekit.l.douyu.R;
16 | import com.lcorekit.l.live.commons.Pages;
17 | import com.lcorekit.l.live.mvp.view.activity.impl.HomeActivityView;
18 | import com.lcorekit.l.live.mvp.view.fragment.AttentionFragment;
19 | import com.lcorekit.l.live.mvp.view.fragment.ChannelsFragment;
20 | import com.lcorekit.l.live.mvp.view.fragment.LiveFragment;
21 | import com.lcorekit.l.live.mvp.view.fragment.RecommendFragment;
22 | import com.lcorekit.l.live.mvp.view.fragment.SettingFragment;
23 |
24 | import butterknife.BindView;
25 | import butterknife.ButterKnife;
26 |
27 | /**
28 | * 主界面
29 | */
30 | public class HomeActivity extends AppCompatActivity implements RadioGroup.OnCheckedChangeListener, HomeActivityView {
31 | @BindView(R.id.fr_main)
32 | FrameLayout frMain;
33 | @BindView(R.id.rb_recommend)
34 | RadioButton rbRecommend;
35 | @BindView(R.id.rb_live)
36 | RadioButton rbLive;
37 | @BindView(R.id.rb_channels)
38 | RadioButton rbChannels;
39 | @BindView(R.id.rb_like)
40 | RadioButton rbLike;
41 | @BindView(R.id.rb_setting)
42 | RadioButton rbSetting;
43 | @BindView(R.id.rg_bottom)
44 | RadioGroup rgBottom;
45 | @BindView(R.id.toolbar)
46 | Toolbar toolbar;
47 |
48 | @Override
49 | protected void onCreate(@Nullable Bundle savedInstanceState) {
50 | super.onCreate(savedInstanceState);
51 | setContentView(R.layout.activity_home);
52 | ButterKnife.bind(this);
53 | initView();
54 | }
55 |
56 | @Override
57 | public void switchTab(Fragment fragment) {
58 | getSupportFragmentManager().beginTransaction().replace(R.id.fr_main, fragment).commit();
59 | }
60 |
61 | @Override
62 | public void initView() {
63 | ButterKnife.bind(this);
64 | rgBottom.setOnCheckedChangeListener(this);
65 | rgBottom.check(R.id.rb_recommend);
66 | setSupportActionBar(toolbar);
67 | getSupportActionBar().setDisplayShowTitleEnabled(false);
68 | }
69 |
70 | /**
71 | * 选择页面
72 | */
73 | @Override
74 | public void onCheckedChanged(RadioGroup group, int checkedId) {
75 | switch (checkedId) {
76 | case R.id.rb_recommend:
77 | RecommendFragment homeFragment = RecommendFragment.getInstance(Pages.HOT_PAGE);
78 | switchTab(homeFragment);
79 | break;
80 | case R.id.rb_live:
81 | LiveFragment liveFragment = LiveFragment.getInstance(Pages.LIVE_PAGE);
82 | switchTab(liveFragment);
83 | break;
84 | case R.id.rb_channels:
85 | ChannelsFragment channelsFragment = ChannelsFragment.getInstance(Pages.CHANNELS_PAGE);
86 | switchTab(channelsFragment);
87 | break;
88 | case R.id.rb_like:
89 | AttentionFragment likeFragment = AttentionFragment.getInstance(Pages.LIKE_PAGE);
90 | switchTab(likeFragment);
91 | break;
92 | case R.id.rb_setting:
93 | SettingFragment settintFragment = SettingFragment.getInstance(Pages.SETTING_PAGE);
94 | switchTab(settintFragment);
95 | break;
96 |
97 | }
98 | }
99 |
100 | @Override
101 | public boolean onCreateOptionsMenu(Menu menu) {
102 | super.onPrepareOptionsMenu(menu);
103 | getMenuInflater().inflate(R.menu.main_menu, menu);
104 | return true;
105 | }
106 |
107 | @Override
108 | public boolean onOptionsItemSelected(MenuItem item) {
109 | startActivity(new Intent(this, SearchActivity.class));
110 | return super.onOptionsItemSelected(item);
111 | }
112 | }
113 |
--------------------------------------------------------------------------------