├── .gitignore ├── README.md ├── agile_android ├── .gitignore ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── agile │ │ └── android │ │ └── leo │ │ ├── base │ │ ├── AgileActivity.kt │ │ ├── AgileApplication.kt │ │ └── AgileFragment.kt │ │ ├── exception │ │ └── ApiException.kt │ │ ├── integration │ │ ├── IActivity.kt │ │ ├── IFragment.kt │ │ └── IRepositoryManager.java │ │ ├── mvp │ │ ├── BaseModel.kt │ │ ├── BasePresenter.kt │ │ ├── IModel.kt │ │ ├── IPresenter.kt │ │ └── IView.kt │ │ └── utils │ │ ├── DisplayUtils.java │ │ ├── FileUtils.java │ │ ├── ListUtils.java │ │ ├── Preconditions.java │ │ └── TimeUtils.java │ └── res │ └── values │ └── strings.xml ├── api ├── .gitignore ├── README.md ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── leo │ │ └── android │ │ └── api │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── leo │ │ │ └── android │ │ │ └── api │ │ │ ├── ApiSubscriber.kt │ │ │ ├── ErrorCode.kt │ │ │ ├── ResultException.kt │ │ │ ├── logger │ │ │ ├── HttpLogger.java │ │ │ └── HttpLoggingInterceptor.java │ │ │ └── retrofit │ │ │ ├── ApiConfig.kt │ │ │ └── RetrofitManager.kt │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── leo │ └── android │ └── api │ └── ExampleUnitTest.java ├── base ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── android │ │ └── leo │ │ └── base │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── android │ │ │ └── leo │ │ │ └── base │ │ │ ├── BaseApplication.kt │ │ │ ├── Extensions.kt │ │ │ ├── GlobalConstant.kt │ │ │ ├── delegate │ │ │ ├── AppDelegate.kt │ │ │ └── AppLifecycles.java │ │ │ ├── events │ │ │ └── NetChangeEvent.kt │ │ │ ├── glide │ │ │ ├── BlurTransformation.java │ │ │ ├── CircleTransformation.java │ │ │ ├── GlideImageLoader.java │ │ │ └── GlobalGlideConfig.kt │ │ │ ├── integration │ │ │ ├── ConfigModule.java │ │ │ └── ManifestParser.java │ │ │ ├── manager │ │ │ └── NetworkManager.kt │ │ │ ├── receiver │ │ │ └── NetChangeReceiver.kt │ │ │ ├── ui │ │ │ ├── activities │ │ │ │ └── BaseActivity.kt │ │ │ ├── dialog │ │ │ │ └── IosAlertDialog.java │ │ │ ├── fragments │ │ │ │ └── BaseFragment.kt │ │ │ └── widgets │ │ │ │ ├── LoadingView.kt │ │ │ │ └── listener │ │ │ │ └── OnRvItemClickListener.java │ │ │ └── utils │ │ │ ├── GsonUtils.kt │ │ │ ├── LayoutHelper.java │ │ │ ├── Preference.kt │ │ │ ├── PreferencesUtil.java │ │ │ └── rxjava │ │ │ └── SchedulersUtil.kt │ └── res │ │ ├── drawable │ │ ├── anim_loading.xml │ │ ├── iosdialog_btn_left_pressed.9.png │ │ ├── iosdialog_btn_right_pressed.9.png │ │ ├── iosdialog_btn_single_pressed.9.png │ │ ├── iosdialog_left_selector.xml │ │ ├── iosdialog_right_selector.xml │ │ ├── iosdialog_single_selector.xml │ │ ├── item_background.xml │ │ └── shape_iosdialog_bg.xml │ │ ├── font │ │ ├── bold.ttf │ │ ├── fz_lb_regular.ttf │ │ └── lobster.otf │ │ ├── layout │ │ └── dialog_ios.xml │ │ ├── mipmap-xxhdpi │ │ ├── icon_loading_1.png │ │ ├── icon_loading_10.png │ │ ├── icon_loading_11.png │ │ ├── icon_loading_12.png │ │ ├── icon_loading_13.png │ │ ├── icon_loading_14.png │ │ ├── icon_loading_15.png │ │ ├── icon_loading_16.png │ │ ├── icon_loading_17.png │ │ ├── icon_loading_18.png │ │ ├── icon_loading_19.png │ │ ├── icon_loading_2.png │ │ ├── icon_loading_20.png │ │ ├── icon_loading_21.png │ │ ├── icon_loading_22.png │ │ ├── icon_loading_23.png │ │ ├── icon_loading_24.png │ │ ├── icon_loading_3.png │ │ ├── icon_loading_4.png │ │ ├── icon_loading_5.png │ │ ├── icon_loading_6.png │ │ ├── icon_loading_7.png │ │ ├── icon_loading_8.png │ │ ├── icon_loading_9.png │ │ └── iosdialog_btn_trans_bg.png │ │ ├── values-v21 │ │ └── styles.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── ids.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── android │ └── leo │ └── base │ └── ExampleUnitTest.java ├── build.gradle ├── config.gradle ├── eyepetizer ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── example │ │ └── wang │ │ └── goclient │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── leowong │ │ │ └── project │ │ │ └── eyepetizer │ │ │ ├── api │ │ │ ├── ApiManagerService.kt │ │ │ ├── BaseResponse.kt │ │ │ ├── ErrorResponse.kt │ │ │ ├── GsonRequestBodyConverter.java │ │ │ ├── GsonResponseBodyConverter.java │ │ │ ├── ResponseConverterFactory.kt │ │ │ ├── ServiceCode.kt │ │ │ └── UrlConstants.kt │ │ │ ├── base │ │ │ ├── AppBaseActivity.kt │ │ │ └── AppBaseFragment.kt │ │ │ ├── constants │ │ │ ├── Constants.kt │ │ │ └── PreferencesConstant.kt │ │ │ ├── events │ │ │ └── VideoDetailItemClickEvent.kt │ │ │ ├── managers │ │ │ └── RepositoryManager.kt │ │ │ ├── mvp │ │ │ ├── contract │ │ │ │ ├── HomeContract.kt │ │ │ │ └── VideoDetailContract.kt │ │ │ ├── model │ │ │ │ ├── HomeModel.kt │ │ │ │ ├── VideoDetailModel.kt │ │ │ │ └── entity │ │ │ │ │ └── HomeBean.kt │ │ │ └── presenter │ │ │ │ ├── HomePresenter.kt │ │ │ │ └── VideoDetailPresenter.kt │ │ │ └── ui │ │ │ ├── activities │ │ │ └── VideoDetailActivity.kt │ │ │ ├── adapters │ │ │ ├── HomeAdapter.kt │ │ │ ├── VideoDetailAdapter.kt │ │ │ ├── entity │ │ │ │ ├── HomeMultipleEntity.kt │ │ │ │ └── VideoDetailMultipleEntity.kt │ │ │ └── provider │ │ │ │ ├── HomeVideoProvider.kt │ │ │ │ ├── VideoDetaiSmallCardProvider.kt │ │ │ │ ├── VideoDetaiTextCardProvider.kt │ │ │ │ ├── VideoDetailFooterProvider.kt │ │ │ │ └── VideoDetailInfoProvider.kt │ │ │ ├── fragments │ │ │ └── HomeFragment.kt │ │ │ └── view │ │ │ └── widgets │ │ │ └── VideoDetailMediaControlView.kt │ └── res │ │ ├── drawable-nodpi │ │ └── landing_background.jpg │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── bg_radius_black.xml │ │ ├── btn_radius_normal_bg.xml │ │ ├── ic_launcher_background.xml │ │ ├── placeholder_banner.png │ │ └── video_seek_bar_style.xml │ │ ├── layout-land │ │ └── item_video_detail_media_control.xml │ │ ├── layout-port │ │ └── item_video_detail_media_control.xml │ │ ├── layout │ │ ├── activity_video_detail.xml │ │ ├── animator_hot.xml │ │ ├── fragment_home.xml │ │ ├── item_footer.xml │ │ ├── item_home_content.xml │ │ ├── item_video_detail_info.xml │ │ ├── item_video_detail_loading.xml │ │ ├── item_video_detail_media_control.xml │ │ ├── item_video_detail_media_control_land.xml │ │ ├── item_video_detail_media_control_port.xml │ │ ├── item_video_small_card.xml │ │ └── item_video_text_card.xml │ │ ├── mipmap-xhdpi │ │ ├── default_avatar.png │ │ ├── ic_action_collection.png │ │ ├── ic_action_comment.png │ │ ├── ic_action_down_white.png │ │ ├── ic_action_favorites.png │ │ ├── ic_action_full_screen.png │ │ ├── ic_action_min_screen.png │ │ ├── ic_action_more_arrow.png │ │ ├── ic_action_offline.png │ │ ├── ic_action_reply.png │ │ ├── ic_action_search_black.png │ │ ├── ic_action_share.png │ │ └── ic_player_reload.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_action_lock_open.png │ │ ├── ic_action_lock_outline.png │ │ ├── ic_player_before.png │ │ ├── ic_player_close_white.png │ │ ├── ic_player_next.png │ │ ├── ic_player_pause.png │ │ ├── ic_player_play.png │ │ ├── ic_player_progress_handle.png │ │ └── ic_player_reload.png │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── example │ └── wang │ └── goclient │ └── ExampleUnitTest.kt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── imageloader ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── lasingwu │ │ └── baselibrary │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── lasingwu │ │ │ └── baselibrary │ │ │ ├── BitmapUtils.java │ │ │ ├── IImageLoaderstrategy.java │ │ │ ├── ImageLoader.kt │ │ │ ├── ImageLoaderConfig.java │ │ │ ├── ImageLoaderOptions.java │ │ │ ├── LoaderEnum.java │ │ │ └── LoaderResultCallBack.java │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── lasingwu │ └── baselibrary │ └── ExampleUnitTest.java ├── log ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── leo │ │ └── android │ │ └── log │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── leo │ │ │ └── android │ │ │ └── log │ │ │ ├── DefaultLog.java │ │ │ ├── core │ │ │ ├── ILog.java │ │ │ └── LogUtils.java │ │ │ └── logan │ │ │ └── LogAnAgent.java │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── leo │ └── android │ └── log │ └── ExampleUnitTest.java ├── mine ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── android │ │ └── leo │ │ └── mine │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── android │ │ │ └── leo │ │ │ └── mine │ │ │ ├── HeaderZoomLayout.java │ │ │ └── MineFragment.kt │ └── res │ │ ├── layout │ │ └── fragment_mine.xml │ │ ├── mipmap-xxhdpi │ │ ├── icon_mine_head.jpg │ │ ├── icon_mine_head_bg.png │ │ └── icon_right_arrow.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── android │ └── leo │ └── mine │ └── ExampleUnitTest.java ├── multiple-status-view ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── classic │ │ └── common │ │ └── MultipleStatusView.java │ └── res │ ├── layout │ ├── empty_view.xml │ ├── error_view.xml │ ├── loading_view.xml │ └── no_network_view.xml │ └── values │ ├── attrs.xml │ ├── ids.xml │ ├── strings.xml │ └── styles.xml ├── router ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── leo │ │ └── android │ │ └── router │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── leo │ └── android │ └── router │ └── ExampleUnitTest.java ├── settings.gradle ├── short_video ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── leowang │ │ └── shortvideo │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── shortvideo │ │ │ └── android │ │ │ └── leo │ │ │ ├── mvp │ │ │ ├── contract │ │ │ │ └── SmallVideoContract.kt │ │ │ ├── model │ │ │ │ ├── SmallVideoModel.kt │ │ │ │ └── entity │ │ │ │ │ └── VideoBean.java │ │ │ └── presenter │ │ │ │ └── ShortVideoPresenter.kt │ │ │ └── ui │ │ │ ├── adapters │ │ │ └── ShortVideoTabAdapter.kt │ │ │ ├── fragments │ │ │ └── SmallVideoTabFragment.kt │ │ │ └── view │ │ │ ├── ShortVideoControlView.kt │ │ │ └── widgets │ │ │ ├── ClipProgressBar.java │ │ │ ├── OnPageStateChangedListener.java │ │ │ ├── PagerSnapHelper.java │ │ │ ├── RecyclerPagerView.java │ │ │ └── SnapHelper.java │ └── res │ │ ├── drawable │ │ └── clip_progress.xml │ │ ├── layout │ │ ├── fragment_small_video_tab.xml │ │ ├── sv_item_short_video_control.xml │ │ └── sv_item_short_video_feed.xml │ │ ├── mipmap-xxhdpi │ │ ├── btn_comment.png │ │ ├── btn_favor_def.png │ │ ├── btn_favor_like.png │ │ ├── btn_relay.png │ │ ├── ic_small_video_top_shadow.png │ │ ├── ic_video_bottom_shadow.png │ │ └── icon_btn_play.png │ │ └── values │ │ ├── colors.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── leowang │ └── shortvideo │ └── ExampleUnitTest.java ├── toutiao ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── android │ │ └── leo │ │ └── toutiao │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── android │ │ │ └── leo │ │ │ └── toutiao │ │ │ ├── Constant.java │ │ │ ├── TouTiaoApp.kt │ │ │ ├── TouTiaoConfiguration.kt │ │ │ ├── api │ │ │ ├── ApiConstant.java │ │ │ ├── ApiService.kt │ │ │ └── RepositoryManager.kt │ │ │ ├── mvp │ │ │ ├── contract │ │ │ │ ├── NewsListContract.kt │ │ │ │ └── TouTiaoContract.kt │ │ │ ├── model │ │ │ │ ├── NewsListModel.kt │ │ │ │ ├── TouTiaoModel.kt │ │ │ │ ├── entity │ │ │ │ │ ├── Channel.java │ │ │ │ │ ├── ImageEntity.java │ │ │ │ │ ├── News.java │ │ │ │ │ ├── NewsData.java │ │ │ │ │ ├── TipEntity.java │ │ │ │ │ ├── TouTiaoModel.kt │ │ │ │ │ ├── UserEntity.java │ │ │ │ │ ├── Video.java │ │ │ │ │ ├── VideoEntity.java │ │ │ │ │ └── VideoModel.java │ │ │ │ └── response │ │ │ │ │ ├── NewsResponse.java │ │ │ │ │ └── ResultResponse.java │ │ │ └── presenter │ │ │ │ ├── NewsListPresenter.kt │ │ │ │ └── TouTiaoPresenter.kt │ │ │ ├── ui │ │ │ ├── adapter │ │ │ │ ├── ChannelPagerAdapter.java │ │ │ │ ├── NewsListAdapter.kt │ │ │ │ ├── entity │ │ │ │ │ └── NewsFeedMultipleEntity.kt │ │ │ │ └── provider │ │ │ │ │ ├── BaseNewsItemProvider.kt │ │ │ │ │ ├── CenterPicNewsItemProvider.kt │ │ │ │ │ ├── RightPicNewsItemProvider.kt │ │ │ │ │ ├── TextNewsItemProvider.kt │ │ │ │ │ ├── ThreePicNewsItemProvider.kt │ │ │ │ │ └── VideoFeedItemProvider.kt │ │ │ ├── fragment │ │ │ │ ├── NewsListFragment.kt │ │ │ │ └── TouTiaoFragment.kt │ │ │ └── widget │ │ │ │ ├── BorderTextView.java │ │ │ │ ├── TipView.java │ │ │ │ └── VideoFeedItemController.kt │ │ │ └── utils │ │ │ └── VideoPathParser.kt │ └── res │ │ ├── drawable-xhdpi │ │ └── search_background.9.png │ │ ├── drawable │ │ ├── jc_title_bg.9.png │ │ ├── selector_play_video.xml │ │ ├── shape_rectangle_translucent.xml │ │ ├── toutiao_video_feed_seek_bar_style.xml │ │ └── video_progress_drawable.xml │ │ ├── layout │ │ ├── fragment_news_list.xml │ │ ├── fragment_toutiao.xml │ │ ├── include_news_bottom.xml │ │ ├── include_news_title.xml │ │ ├── item_center_pic_news.xml │ │ ├── item_feed_loading_view.xml │ │ ├── item_pic_video_news.xml │ │ ├── item_text_news.xml │ │ ├── item_three_pics_news.xml │ │ ├── item_video_feed_media_control_land.xml │ │ ├── item_video_feed_media_control_port.xml │ │ └── item_video_list.xml │ │ ├── mipmap-xxhdpi │ │ ├── add_channel.png │ │ ├── add_focus.png │ │ ├── comment_count.png │ │ ├── ic_default.png │ │ ├── ic_toutiao_action_full_screen.png │ │ ├── ic_toutiao_action_min_screen.png │ │ ├── ic_toutiao_play_pause.png │ │ ├── ic_toutiao_play_start.png │ │ ├── ic_toutiao_player_close_white.png │ │ ├── ic_toutiao_player_progress_handle.png │ │ ├── icon_picture_group.png │ │ ├── icon_video_play.png │ │ ├── new_more_titlebar.png │ │ ├── play_normal.png │ │ ├── play_pressed.png │ │ └── shadow_add_titlebar_new.png │ │ └── values │ │ ├── arrays_news.xml │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── android │ └── leo │ └── toutiao │ └── ExampleUnitTest.java ├── trunk ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── leo │ │ └── elegant │ │ └── trunk │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── landing.mp4 │ ├── java │ │ └── com │ │ │ └── leo │ │ │ └── elegant │ │ │ └── trunk │ │ │ ├── MyApplication.kt │ │ │ ├── activity │ │ │ ├── MainActivity.kt │ │ │ └── SplashActivity.kt │ │ │ ├── adapter │ │ │ └── SplashVideoTextAdapter.kt │ │ │ ├── entity │ │ │ └── TabEntity.kt │ │ │ ├── fragments │ │ │ ├── SplashFragment.kt │ │ │ └── SplashVideoFragment.kt │ │ │ └── manager │ │ │ └── TabManager.kt │ └── res │ │ ├── drawable-nodpi │ │ └── landing_background.jpg │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── activity_splash.xml │ │ ├── fragment_splash.xml │ │ ├── fragment_splash_video.xml │ │ └── item_splash_video.xml │ │ ├── mipmap-xhdpi │ │ ├── ic_discovery_normal.png │ │ ├── ic_discovery_selected.png │ │ ├── ic_home_normal.png │ │ ├── ic_home_selected.png │ │ ├── ic_hot_normal.png │ │ ├── ic_hot_selected.png │ │ ├── ic_icon_guide_detail_slide_up.png │ │ ├── ic_mine_normal.png │ │ └── ic_mine_selected.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── leo │ └── elegant │ └── trunk │ └── ExampleUnitTest.kt └── video_player ├── .gitignore ├── build.gradle ├── libs ├── armeabi-v7a │ ├── libijkffmpeg.so │ ├── libijkplayer.so │ └── libijksdl.so └── x86 │ ├── libijkffmpeg.so │ ├── libijkplayer.so │ └── libijksdl.so ├── proguard-rules.pro └── src ├── androidTest └── java │ └── com │ └── leo │ └── android │ └── videoplayer │ └── ExampleInstrumentedTest.java ├── main ├── AndroidManifest.xml ├── java │ └── com │ │ └── leo │ │ └── android │ │ └── videoplayer │ │ ├── IjkVideoView.kt │ │ ├── PlayerAttachListManager.kt │ │ ├── PlayerListManager.kt │ │ ├── SimpleMediaPlayerListener.kt │ │ ├── cache │ │ └── VideoCacheManager.java │ │ ├── core │ │ ├── BaseVideoController.kt │ │ ├── IMediaIntercept.kt │ │ ├── IMediaPlayerControl.java │ │ └── IMediaPlayerListener.java │ │ ├── ijk │ │ ├── IRenderView.java │ │ ├── MeasureHelper.java │ │ ├── PlayerConfig.kt │ │ ├── RawDataSourceProvider.java │ │ ├── SurfaceRenderView.java │ │ └── TextureRenderView.java │ │ └── utils │ │ ├── FileUtils.java │ │ ├── LogUtils.kt │ │ └── VideoUrlUtils.kt └── res │ ├── layout │ └── layout_ijk_video_view.xml │ └── values │ ├── ids.xml │ └── strings.xml └── test └── java └── com └── leo └── android └── videoplayer └── ExampleUnitTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | lint.xml 5 | version.properties 6 | 7 | #Eclipse 8 | .project 9 | .classpath 10 | .settings 11 | .checkstyle 12 | 13 | #IntelliJ IDEA 14 | .idea 15 | .svn 16 | *.iml 17 | *.ipr 18 | *.iws 19 | classes 20 | gen-external-apklibs 21 | 22 | #Maven 23 | target 24 | release.properties 25 | pom.xml.* 26 | 27 | #Ant 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | #Other 34 | .DS_Store 35 | dist/ 36 | tmp 37 | 38 | # Gradle 39 | .gradle 40 | /build 41 | /out 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ElegantEyepetizer ->使用kotlin语言编写的仿开眼的学习项目 2 | ## Description 3 | ### 项目架构 4 | kotlin+mvp+retrofit+rxjava架构 5 | ### 功能 6 | 1、视频feed流 7 |
8 | 2、视频详情,封装的IJK播放器,支持横竖屏切换,支持重力感应,支持边播边缓存 9 |
10 | 3、仿抖音小视频列表,支持缓存功能 11 |
12 | 4、仿今日头条feed流,支持视频feed流播放 13 |
14 | ## 效果Demo## 15 | 16 | ![image](https://github.com/wanglg/resource/blob/master/5BCE4EBBB2F6FD3A1F41263A5AA3B511.jpg) 17 | ![image](https://github.com/wanglg/resource/blob/master/15DDF18C59BB4404BC2ABA5574ABD17C.jpg) 18 | ![image](https://github.com/wanglg/resource/blob/master/E800EE6229D21DC4BAB1207A8713DF93.jpg) 19 | ![image](https://github.com/wanglg/resource/blob/master/9EBE517ED219BF344680C18D692ABA1B.jpg) 20 | ![image](https://github.com/wanglg/resource/blob/master/9DFDE854243D827C1A2604BBB780508F.jpg) 21 | ![image](https://github.com/wanglg/resource/blob/master/878C6697157DE47FD69B04995B4AAB30.jpg) 22 | ![image](https://github.com/wanglg/resource/blob/master/D608A3F6202C4929830B8FBD4B25F346.jpg) 23 | -------------------------------------------------------------------------------- /agile_android/.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | lint.xml 5 | version.properties 6 | 7 | #Eclipse 8 | .project 9 | .classpath 10 | .settings 11 | .checkstyle 12 | 13 | #IntelliJ IDEA 14 | .idea 15 | .svn 16 | *.iml 17 | *.ipr 18 | *.iws 19 | classes 20 | gen-external-apklibs 21 | 22 | #Maven 23 | target 24 | release.properties 25 | pom.xml.* 26 | 27 | #Ant 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | #Other 34 | .DS_Store 35 | dist/ 36 | tmp 37 | 38 | # Gradle 39 | .gradle 40 | /build 41 | /out -------------------------------------------------------------------------------- /agile_android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /agile_android/src/main/java/com/agile/android/leo/base/AgileActivity.kt: -------------------------------------------------------------------------------- 1 | package com.agile.android.leo.base 2 | 3 | import android.os.Bundle 4 | import com.agile.android.leo.integration.IActivity 5 | import com.agile.android.leo.mvp.IPresenter 6 | import com.trello.rxlifecycle2.components.support.RxAppCompatActivity 7 | import io.reactivex.disposables.CompositeDisposable 8 | import io.reactivex.disposables.Disposable 9 | 10 | /** 11 | * User: wanglg 12 | * Date: 2018-05-09 13 | * Time: 14:56 14 | * FIXME 15 | */ 16 | abstract class AgileActivity

: RxAppCompatActivity(), IActivity { 17 | open var mPresenter: P? = null//如果当前页面逻辑简单, Presenter 可以为 null 18 | open var mCompositeDisposable: CompositeDisposable? = null 19 | override fun onCreate(savedInstanceState: Bundle?) { 20 | super.onCreate(savedInstanceState) 21 | initData(savedInstanceState) 22 | setContentView(getLayoutId()) 23 | initPresenter() 24 | configViews() 25 | requestData() 26 | 27 | } 28 | 29 | fun addDispose(disposable: Disposable) { 30 | if (mCompositeDisposable == null) { 31 | mCompositeDisposable = CompositeDisposable() 32 | } 33 | mCompositeDisposable?.add(disposable)//将所有 Disposable 放入集中处理 34 | } 35 | 36 | override fun onDestroy() { 37 | super.onDestroy() 38 | unDispose() 39 | mPresenter?.onDestroy() 40 | mCompositeDisposable = null 41 | } 42 | 43 | /** 44 | * 停止集合中正在执行的 RxJava 任务 45 | */ 46 | fun unDispose() { 47 | mCompositeDisposable?.clear()//保证 Activity 结束时取消所有正在执行的订阅 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /agile_android/src/main/java/com/agile/android/leo/base/AgileApplication.kt: -------------------------------------------------------------------------------- 1 | package com.agile.android.leo.base 2 | 3 | import android.app.Application 4 | import com.agile.android.leo.BuildConfig 5 | import com.leo.android.log.core.LogUtils 6 | 7 | /** 8 | * 此模块设计为和业务无关的技术框架 9 | * User: wanglg 10 | * Date: 2018-05-02 11 | * Time: 16:34 12 | * FIXME 13 | */ 14 | open class AgileApplication : Application() { 15 | 16 | override fun onCreate() { 17 | super.onCreate() 18 | LogUtils.init(this, BuildConfig.DEBUG) 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /agile_android/src/main/java/com/agile/android/leo/exception/ApiException.kt: -------------------------------------------------------------------------------- 1 | package com.agile.android.leo.exception 2 | 3 | /** 4 | * User: wanglg 5 | * Date: 2018-05-14 6 | * Time: 10:59 7 | * FIXME 8 | */ 9 | class ApiException : RuntimeException { 10 | var errCode: Int = 0 11 | 12 | constructor(errCode: Int, msg: String) : super(msg) { 13 | this.errCode = errCode 14 | } 15 | } -------------------------------------------------------------------------------- /agile_android/src/main/java/com/agile/android/leo/integration/IActivity.kt: -------------------------------------------------------------------------------- 1 | package com.agile.android.leo.integration 2 | 3 | import android.os.Bundle 4 | 5 | /** 6 | * User: wanglg 7 | * Date: 2018-05-10 8 | * Time: 20:14 9 | * FIXME 10 | */ 11 | interface IActivity { 12 | fun getLayoutId(): Int 13 | fun initPresenter() 14 | fun configViews() 15 | fun initData(savedInstanceState: Bundle?) 16 | fun requestData() 17 | } -------------------------------------------------------------------------------- /agile_android/src/main/java/com/agile/android/leo/integration/IFragment.kt: -------------------------------------------------------------------------------- 1 | package com.agile.android.leo.integration 2 | 3 | import android.os.Bundle 4 | 5 | /** 6 | * User: wanglg 7 | * Date: 2018-05-10 8 | * Time: 20:28 9 | * FIXME 10 | */ 11 | interface IFragment { 12 | fun getLayoutId(): Int 13 | fun initPresenter() 14 | fun configViews() 15 | fun initData(savedInstanceState: Bundle?) 16 | fun requestData() 17 | /** 18 | * 处理back事件。 19 | * @return True: 表示已经处理; False: 没有处理,让基类处理。 20 | */ 21 | fun onBack(): Boolean 22 | } -------------------------------------------------------------------------------- /agile_android/src/main/java/com/agile/android/leo/integration/IRepositoryManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 JessYan 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.agile.android.leo.integration; 17 | 18 | import android.content.Context; 19 | 20 | 21 | public interface IRepositoryManager { 22 | 23 | /** 24 | * 根据传入的 Class 获取对应的 Retrofit service 25 | * 26 | * @param service 27 | * @param 28 | * @return 29 | */ 30 | T obtainRetrofitService(Class service); 31 | 32 | 33 | Context getContext(); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /agile_android/src/main/java/com/agile/android/leo/mvp/BaseModel.kt: -------------------------------------------------------------------------------- 1 | package com.agile.android.leo.mvp 2 | 3 | import com.agile.android.leo.integration.IRepositoryManager 4 | 5 | /** 6 | * User: wanglg 7 | * Date: 2018-05-02 8 | * Time: 15:29 9 | * FIXME 10 | */ 11 | open class BaseModel : IModel { 12 | protected var mRepositoryManager: IRepositoryManager? = null//用于管理网络请求层, 以及数据缓存层 13 | 14 | // protected constructor(repositoryManager: IRepositoryManager) { 15 | // this.mRepositoryManager = repositoryManager 16 | // } 17 | 18 | override fun onDestroy() { 19 | mRepositoryManager = null 20 | } 21 | } -------------------------------------------------------------------------------- /agile_android/src/main/java/com/agile/android/leo/mvp/IModel.kt: -------------------------------------------------------------------------------- 1 | package com.agile.android.leo.mvp 2 | 3 | /** 4 | * User: wanglg 5 | * Date: 2018-05-02 6 | * Time: 12:11 7 | * FIXME 8 | */ 9 | interface IModel { 10 | /** 11 | * 在框架中 [BasePresenter.onDestroy] 时会默认调用 [IModel.onDestroy] 12 | */ 13 | fun onDestroy() 14 | } -------------------------------------------------------------------------------- /agile_android/src/main/java/com/agile/android/leo/mvp/IPresenter.kt: -------------------------------------------------------------------------------- 1 | package com.agile.android.leo.mvp 2 | 3 | import android.app.Activity 4 | 5 | /** 6 | * User: wanglg 7 | * Date: 2018-05-02 8 | * Time: 12:10 9 | * FIXME 10 | */ 11 | interface IPresenter { 12 | /** 13 | * 做一些初始化操作 14 | */ 15 | fun onStart() 16 | 17 | /** 18 | * 在框架中 [Activity.onDestroy] 时会默认调用 [IPresenter.onDestroy] 19 | */ 20 | fun onDestroy() 21 | } -------------------------------------------------------------------------------- /agile_android/src/main/java/com/agile/android/leo/mvp/IView.kt: -------------------------------------------------------------------------------- 1 | package com.agile.android.leo.mvp 2 | 3 | import com.agile.android.leo.exception.ApiException 4 | 5 | /** 6 | * view接口基类 7 | */ 8 | 9 | interface IView { 10 | fun resultError(exception: ApiException) 11 | 12 | fun showLoading() 13 | 14 | fun dismissLoading() 15 | } 16 | -------------------------------------------------------------------------------- /agile_android/src/main/java/com/agile/android/leo/utils/DisplayUtils.java: -------------------------------------------------------------------------------- 1 | package com.agile.android.leo.utils; 2 | 3 | import android.content.Context; 4 | import android.graphics.Point; 5 | import android.util.DisplayMetrics; 6 | import android.util.TypedValue; 7 | import android.view.Display; 8 | import android.view.WindowManager; 9 | 10 | public class DisplayUtils { 11 | 12 | public static int dpToPx(Context c, float dipValue) { 13 | DisplayMetrics metrics = c.getResources().getDisplayMetrics(); 14 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, metrics); 15 | } 16 | 17 | public static int spToPx(Context context, float spValue) { 18 | DisplayMetrics metrics = context.getResources().getDisplayMetrics(); 19 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, spValue, metrics); 20 | } 21 | 22 | /** 23 | * Returns the screen/display size 24 | */ 25 | public static Point getDisplaySize(Context context) { 26 | WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); 27 | Display display = wm.getDefaultDisplay(); 28 | Point size = new Point(); 29 | display.getSize(size); 30 | return size; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /agile_android/src/main/java/com/agile/android/leo/utils/ListUtils.java: -------------------------------------------------------------------------------- 1 | package com.agile.android.leo.utils; 2 | 3 | import java.util.List; 4 | 5 | 6 | public class ListUtils { 7 | 8 | public static boolean isEmpty(List list) { 9 | if (list == null) { 10 | return true; 11 | } 12 | return list.size() == 0; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /agile_android/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /api/.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | lint.xml 5 | version.properties 6 | 7 | #Eclipse 8 | .project 9 | .classpath 10 | .settings 11 | .checkstyle 12 | 13 | #IntelliJ IDEA 14 | .idea 15 | .svn 16 | *.iml 17 | *.ipr 18 | *.iws 19 | classes 20 | gen-external-apklibs 21 | 22 | #Maven 23 | target 24 | release.properties 25 | pom.xml.* 26 | 27 | #Ant 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | #Other 34 | .DS_Store 35 | dist/ 36 | tmp 37 | 38 | # Gradle 39 | .gradle 40 | /build 41 | /out -------------------------------------------------------------------------------- /api/README.md: -------------------------------------------------------------------------------- 1 | ### 网络请求框架 2 | 依赖agile_android -------------------------------------------------------------------------------- /api/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-kapt' 4 | android { 5 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 6 | defaultConfig { 7 | minSdkVersion rootProject.ext.android["minSdkVersion"] 8 | targetSdkVersion rootProject.ext.android["targetSdkVersion"] 9 | versionCode rootProject.ext.android["versionCode"] 10 | versionName rootProject.ext.android["versionName"] 11 | 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | 14 | } 15 | 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | 23 | } 24 | 25 | dependencies { 26 | implementation fileTree(dir: 'libs', include: ['*.jar']) 27 | 28 | api project(':agile_android') 29 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 30 | } 31 | -------------------------------------------------------------------------------- /api/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /api/src/androidTest/java/com/leo/android/api/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.leo.android.api; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.leo.android.api.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /api/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /api/src/main/java/com/leo/android/api/ErrorCode.kt: -------------------------------------------------------------------------------- 1 | package com.leo.android.api 2 | 3 | object ErrorCode { 4 | 5 | 6 | /** 7 | * 未知错误 8 | */ 9 | val UNKNOWN_ERROR = 1002 10 | 11 | /** 12 | * 服务器内部错误 13 | */ 14 | val SERVER_ERROR = 1003 15 | 16 | /** 17 | * 网络连接超时 18 | */ 19 | val NETWORK_ERROR = 1004 20 | 21 | /** 22 | * API解析异常(或者第三方数据结构更改)等其他异常 23 | */ 24 | val API_ERROR = 1005 25 | 26 | } -------------------------------------------------------------------------------- /api/src/main/java/com/leo/android/api/ResultException.kt: -------------------------------------------------------------------------------- 1 | package com.leo.android.api 2 | 3 | /** 4 | * 自定义请求错误 5 | * Created by 1 on 2017/10/25. 6 | */ 7 | class ResultException : Exception { 8 | var errCode: Int? = 0 9 | 10 | constructor(errCode: Int, msg: String) : super(msg) { 11 | this.errCode = errCode 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /api/src/main/java/com/leo/android/api/logger/HttpLogger.java: -------------------------------------------------------------------------------- 1 | package com.leo.android.api.logger; 2 | 3 | 4 | import com.leo.android.log.core.LogUtils; 5 | 6 | public class HttpLogger implements HttpLoggingInterceptor.Logger { 7 | private StringBuilder mMessage = new StringBuilder(); 8 | private String json; 9 | 10 | @Override 11 | public void log(String message) { 12 | // 请求或者响应开始 13 | if (message.startsWith("--> START HTTP")) { 14 | mMessage.setLength(0); 15 | mMessage.append("\n"); 16 | } 17 | // 以{}或者[]形式的说明是响应结果的json数据,需要进行格式化 18 | if ((message.startsWith("{") && message.endsWith("}")) 19 | || (message.startsWith("[") && message.endsWith("]"))) { 20 | json = message; 21 | return; 22 | } 23 | mMessage.append(message.concat("\n")); 24 | // 请求或者响应结束,打印整条日志 25 | if (message.startsWith("<-- END HTTP")) { 26 | LogUtils.e("HTTP_LOG", "\n--------------------------------------------\n"); 27 | LogUtils.d("HTTP_LOG", mMessage.toString()); 28 | LogUtils.e("HTTP_LOG", "\n--------------------------------------------\n\n\n\n"); 29 | LogUtils.json("HTTP_LOG", "\n" + json); 30 | LogUtils.e("HTTP_LOG", "--------------------------------------------\n\n\n\n"); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /api/src/main/java/com/leo/android/api/retrofit/ApiConfig.kt: -------------------------------------------------------------------------------- 1 | package com.leo.android.api.retrofit 2 | 3 | import okhttp3.Interceptor 4 | import okhttp3.OkHttpClient 5 | 6 | class ApiConfig { 7 | var baseUrl: String = "" 8 | var timeOut: Long = 30 9 | var interceptors: ArrayList = ArrayList() 10 | var netInterceptor: Interceptor? = null 11 | var okHttpClient: OkHttpClient? = null 12 | 13 | class Builder { 14 | var target: ApiConfig = ApiConfig() 15 | fun setBaseUrl(baseUrl: String): Builder { 16 | this.target.baseUrl = baseUrl 17 | return this 18 | } 19 | 20 | fun setTimeOut(timeOut: Long): Builder { 21 | this.target.timeOut = timeOut 22 | return this 23 | } 24 | 25 | fun setOkHttpClient(okHttpClient: OkHttpClient): Builder { 26 | this.target.okHttpClient = okHttpClient 27 | return this 28 | } 29 | 30 | fun addInterceptor(interceptor: Interceptor): Builder { 31 | this.target.interceptors.add(interceptor) 32 | return this 33 | } 34 | 35 | fun addNetInterceptor(interceptor: Interceptor): Builder { 36 | this.target.netInterceptor = interceptor 37 | return this 38 | } 39 | 40 | fun build(): ApiConfig { 41 | return target 42 | } 43 | 44 | } 45 | } -------------------------------------------------------------------------------- /api/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | api 3 | 4 | -------------------------------------------------------------------------------- /api/src/test/java/com/leo/android/api/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.leo.android.api; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /base/.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | lint.xml 5 | version.properties 6 | 7 | #Eclipse 8 | .project 9 | .classpath 10 | .settings 11 | .checkstyle 12 | 13 | #IntelliJ IDEA 14 | .idea 15 | .svn 16 | *.iml 17 | *.ipr 18 | *.iws 19 | classes 20 | gen-external-apklibs 21 | 22 | #Maven 23 | target 24 | release.properties 25 | pom.xml.* 26 | 27 | #Ant 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | #Other 34 | .DS_Store 35 | dist/ 36 | tmp 37 | 38 | # Gradle 39 | .gradle 40 | /build 41 | /out -------------------------------------------------------------------------------- /base/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /base/src/androidTest/java/com/android/leo/base/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.base; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.android.leo.base.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /base/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /base/src/main/java/com/android/leo/base/GlobalConstant.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.base 2 | 3 | object GlobalConstant { 4 | object Fragment { 5 | const val EYEPETIZER: String = "/fragment/eyepetizer" 6 | const val LITTLE_VIDEO: String = "/fragment/small_video" 7 | const val MINE: String = "/fragment/mine" 8 | const val TOUTIAO: String = "/fragment/toutiao" 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /base/src/main/java/com/android/leo/base/delegate/AppDelegate.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.base.delegate 2 | 3 | import android.app.Application 4 | import android.content.Context 5 | import android.support.annotation.NonNull 6 | import com.android.leo.base.integration.ConfigModule 7 | import com.android.leo.base.integration.ManifestParser 8 | import java.util.ArrayList 9 | 10 | class AppDelegate : AppLifecycles { 11 | private var mApplication: Application? = null 12 | private var mModules: List? = null 13 | private var mAppLifecycles: List = ArrayList() 14 | private var mActivityLifecycles: List? = ArrayList() 15 | 16 | constructor(@NonNull context: Context) { 17 | mModules = ManifestParser(context).parse() 18 | mModules?.let { 19 | for (module in it) { 20 | module.injectAppLifecycle(context, mAppLifecycles) 21 | module.injectActivityLifecycle(context, mActivityLifecycles) 22 | } 23 | } 24 | 25 | } 26 | 27 | override fun attachBaseContext(base: Context) { 28 | //遍历 mAppLifecycles, 执行所有已注册的 AppLifecycles 的 attachBaseContext() 方法 (框架外部, 开发者扩展的逻辑) 29 | for (lifecycle in mAppLifecycles) { 30 | lifecycle.attachBaseContext(base) 31 | } 32 | } 33 | 34 | override fun onCreate(mApplication: Application) { 35 | 36 | 37 | //执行框架外部, 开发者扩展的 App onCreate 逻辑 38 | for (lifecycle in mAppLifecycles) { 39 | lifecycle.onCreate(mApplication) 40 | } 41 | } 42 | 43 | override fun onTerminate(application: Application) { 44 | mApplication = null 45 | } 46 | } -------------------------------------------------------------------------------- /base/src/main/java/com/android/leo/base/delegate/AppLifecycles.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 JessYan 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.android.leo.base.delegate; 17 | 18 | import android.app.Application; 19 | import android.content.Context; 20 | import android.support.annotation.NonNull; 21 | 22 | /** 23 | * 用于代理 {@link Application} 的生命周期 24 | */ 25 | public interface AppLifecycles { 26 | void attachBaseContext(@NonNull Context base); 27 | 28 | void onCreate(@NonNull Application application); 29 | 30 | void onTerminate(@NonNull Application application); 31 | } 32 | -------------------------------------------------------------------------------- /base/src/main/java/com/android/leo/base/events/NetChangeEvent.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.base.events 2 | 3 | /** 4 | * User: wanglg 5 | * Date: 2018-05-30 6 | * Time: 12:01 7 | * FIXME 8 | */ 9 | class NetChangeEvent(val connected: Boolean) { 10 | } -------------------------------------------------------------------------------- /base/src/main/java/com/android/leo/base/glide/BlurTransformation.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.base.glide; 2 | 3 | import android.graphics.Bitmap; 4 | import android.support.annotation.IntRange; 5 | import android.support.annotation.NonNull; 6 | 7 | import com.bumptech.glide.load.Key; 8 | import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; 9 | import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; 10 | import com.lasingwu.baselibrary.BitmapUtils; 11 | 12 | import java.security.MessageDigest; 13 | 14 | 15 | 16 | public class BlurTransformation extends BitmapTransformation { 17 | private static final String ID = BlurTransformation.class.getName(); 18 | private static final byte[] ID_BYTES = ID.getBytes(Key.CHARSET); 19 | 20 | private int defaultRadius=15; 21 | public BlurTransformation(@IntRange(from=0) int radius){ 22 | defaultRadius=radius; 23 | } 24 | @Override 25 | public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { 26 | messageDigest.update(ID_BYTES); 27 | 28 | } 29 | 30 | @Override 31 | protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight) { 32 | return BitmapUtils.fastBlur(toTransform,defaultRadius); 33 | } 34 | 35 | @Override 36 | public boolean equals(Object o) { 37 | return o instanceof BlurTransformation; 38 | } 39 | 40 | @Override 41 | public int hashCode() { 42 | return ID.hashCode(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /base/src/main/java/com/android/leo/base/glide/CircleTransformation.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.base.glide; 2 | 3 | import android.graphics.Bitmap; 4 | import android.support.annotation.NonNull; 5 | 6 | import com.bumptech.glide.load.Key; 7 | import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; 8 | import com.bumptech.glide.load.resource.bitmap.BitmapTransformation; 9 | import com.bumptech.glide.load.resource.bitmap.TransformationUtils; 10 | 11 | import java.security.MessageDigest; 12 | 13 | 14 | public class CircleTransformation extends BitmapTransformation { 15 | private static final String ID = CircleTransformation.class.getName(); 16 | private static final byte[] ID_BYTES = ID.getBytes(Key.CHARSET); 17 | 18 | @Override 19 | public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) { 20 | messageDigest.update(ID_BYTES); 21 | } 22 | 23 | @Override 24 | protected Bitmap transform(@NonNull BitmapPool pool, @NonNull Bitmap toTransform, int outWidth, int outHeight) { 25 | return TransformationUtils.circleCrop(pool, toTransform, outWidth, outHeight); 26 | } 27 | 28 | @Override 29 | public boolean equals(Object o) { 30 | return o instanceof CircleTransformation; 31 | } 32 | 33 | @Override 34 | public int hashCode() { 35 | return ID.hashCode(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /base/src/main/java/com/android/leo/base/ui/fragments/BaseFragment.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.base.ui.fragments 2 | 3 | import android.app.Activity 4 | import android.content.Intent 5 | import android.os.Bundle 6 | import com.agile.android.leo.base.AgileFragment 7 | import com.agile.android.leo.mvp.IPresenter 8 | import com.classic.common.MultipleStatusView 9 | import org.greenrobot.eventbus.EventBus 10 | 11 | abstract class BaseFragment

: AgileFragment

() { 12 | var multipleStatusView: MultipleStatusView? = null 13 | override fun onCreate(savedInstanceState: Bundle?) { 14 | super.onCreate(savedInstanceState) 15 | if (useEventBus()) { 16 | EventBus.getDefault().register(this) 17 | } 18 | } 19 | 20 | override fun onDestroy() { 21 | super.onDestroy() 22 | if (useEventBus()) { 23 | EventBus.getDefault().unregister(this) 24 | } 25 | } 26 | 27 | open fun useEventBus(): Boolean { 28 | return false 29 | } 30 | 31 | fun startActivity(activity: Class) { 32 | startActivity(activity, null) 33 | } 34 | 35 | fun startActivity(activity: Class, bundle: Bundle?) { 36 | val intent = Intent(getActivity(), activity) 37 | if (bundle != null) { 38 | intent.putExtras(bundle) 39 | } 40 | startActivity(intent) 41 | } 42 | } -------------------------------------------------------------------------------- /base/src/main/java/com/android/leo/base/ui/widgets/LoadingView.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.base.ui.widgets 2 | 3 | import android.content.Context 4 | import android.graphics.drawable.AnimationDrawable 5 | import android.support.v7.widget.AppCompatImageView 6 | import android.util.AttributeSet 7 | import com.android.leo.base.R 8 | 9 | 10 | class LoadingView : AppCompatImageView { 11 | var animationDrawable: AnimationDrawable? = null 12 | 13 | constructor(context: Context) : super(context) { 14 | initView() 15 | } 16 | 17 | constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { 18 | initView() 19 | } 20 | 21 | private fun initView() { 22 | setImageResource(R.drawable.anim_loading) 23 | animationDrawable = drawable as AnimationDrawable 24 | startAnim() 25 | } 26 | 27 | fun startAnim() { 28 | animationDrawable?.start() 29 | } 30 | 31 | fun stopAnim() { 32 | animationDrawable?.stop() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /base/src/main/java/com/android/leo/base/ui/widgets/listener/OnRvItemClickListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 JustWayward Team 3 | *

4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | *

8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | *

10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.android.leo.base.ui.widgets.listener; 17 | 18 | import android.view.View; 19 | 20 | public interface OnRvItemClickListener { 21 | 22 | void onItemClick(View view, int position, T data); 23 | 24 | } -------------------------------------------------------------------------------- /base/src/main/java/com/android/leo/base/utils/GsonUtils.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.base.utils 2 | 3 | import com.google.gson.* 4 | import java.lang.reflect.Type 5 | 6 | /** 7 | * gson 8 | * Created by 1 on 2017/9/28. 9 | */ 10 | 11 | class GsonUtils { 12 | 13 | 14 | /** 15 | * 实现了 序列化 接口 对为null的字段进行转换 16 | */ 17 | class StringConverter : JsonSerializer, JsonDeserializer { 18 | //字符串为null 转换成"",否则为字符串类型 19 | @Throws(JsonParseException::class) 20 | override fun deserialize(json: JsonElement, typeOfT: Type, context: JsonDeserializationContext): String { 21 | return json.asJsonPrimitive.asString 22 | } 23 | 24 | override fun serialize(src: String?, typeOfSrc: Type, context: JsonSerializationContext): JsonElement = 25 | if (src == null || src == "null") JsonPrimitive("") else JsonPrimitive(src.toString()) 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /base/src/main/java/com/android/leo/base/utils/rxjava/SchedulersUtil.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.base.utils.rxjava 2 | 3 | import io.reactivex.ObservableTransformer 4 | import io.reactivex.android.schedulers.AndroidSchedulers 5 | import io.reactivex.schedulers.Schedulers 6 | 7 | 8 | /** 9 | * Created by JokAr on 2017/6/11. 10 | */ 11 | object SchedulersUtil { 12 | 13 | fun applyApiSchedulers(): ObservableTransformer { 14 | return ObservableTransformer { observable -> 15 | observable.subscribeOn(Schedulers.io()) 16 | .unsubscribeOn(Schedulers.io()) 17 | .observeOn(AndroidSchedulers.mainThread()) 18 | } 19 | } 20 | 21 | fun applySchedulersIO(): ObservableTransformer { 22 | return ObservableTransformer { observable -> 23 | observable.subscribeOn(Schedulers.io()) 24 | .unsubscribeOn(Schedulers.io()) 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /base/src/main/res/drawable/iosdialog_btn_left_pressed.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/drawable/iosdialog_btn_left_pressed.9.png -------------------------------------------------------------------------------- /base/src/main/res/drawable/iosdialog_btn_right_pressed.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/drawable/iosdialog_btn_right_pressed.9.png -------------------------------------------------------------------------------- /base/src/main/res/drawable/iosdialog_btn_single_pressed.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/drawable/iosdialog_btn_single_pressed.9.png -------------------------------------------------------------------------------- /base/src/main/res/drawable/iosdialog_left_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /base/src/main/res/drawable/iosdialog_right_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /base/src/main/res/drawable/iosdialog_single_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /base/src/main/res/drawable/item_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /base/src/main/res/drawable/shape_iosdialog_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /base/src/main/res/font/bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/font/bold.ttf -------------------------------------------------------------------------------- /base/src/main/res/font/fz_lb_regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/font/fz_lb_regular.ttf -------------------------------------------------------------------------------- /base/src/main/res/font/lobster.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/font/lobster.otf -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_1.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_10.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_11.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_12.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_13.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_14.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_15.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_16.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_17.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_18.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_19.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_2.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_20.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_21.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_22.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_23.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_24.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_3.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_4.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_5.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_6.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_7.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_8.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/icon_loading_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/icon_loading_9.png -------------------------------------------------------------------------------- /base/src/main/res/mipmap-xxhdpi/iosdialog_btn_trans_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/base/src/main/res/mipmap-xxhdpi/iosdialog_btn_trans_bg.png -------------------------------------------------------------------------------- /base/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /eyepetizer/src/test/java/com/example/wang/goclient/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.example.wang.goclient 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Apr 18 20:04:51 CST 2019 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-5.2.1-all.zip 7 | -------------------------------------------------------------------------------- /imageloader/.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | lint.xml 5 | version.properties 6 | 7 | #Eclipse 8 | .project 9 | .classpath 10 | .settings 11 | .checkstyle 12 | 13 | #IntelliJ IDEA 14 | .idea 15 | .svn 16 | *.iml 17 | *.ipr 18 | *.iws 19 | classes 20 | gen-external-apklibs 21 | 22 | #Maven 23 | target 24 | release.properties 25 | pom.xml.* 26 | 27 | #Ant 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | #Other 34 | .DS_Store 35 | dist/ 36 | tmp 37 | 38 | # Gradle 39 | .gradle 40 | /build 41 | /out -------------------------------------------------------------------------------- /imageloader/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-kapt' 4 | android { 5 | compileSdkVersion rootProject.ext.android.compileSdkVersion 6 | 7 | defaultConfig { 8 | minSdkVersion rootProject.ext.android.minSdkVersion 9 | targetSdkVersion rootProject.ext.android.targetSdkVersion 10 | versionCode rootProject.ext.android.versionCode 11 | versionName rootProject.ext.android.versionName 12 | } 13 | 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | lintOptions { 21 | abortOnError false 22 | } 23 | } 24 | dependencies { 25 | implementation fileTree(dir: 'libs', include: ['*.jar']) 26 | api rootProject.ext.dependencies["annotations"] 27 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 28 | } 29 | -------------------------------------------------------------------------------- /imageloader/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -keep class android.support.v8.renderscript.** { *; } -------------------------------------------------------------------------------- /imageloader/src/androidTest/java/com/lasingwu/baselibrary/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.lasingwu.baselibrary; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.lasingwu.baselibrary.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /imageloader/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /imageloader/src/main/java/com/lasingwu/baselibrary/IImageLoaderstrategy.java: -------------------------------------------------------------------------------- 1 | package com.lasingwu.baselibrary; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | import android.view.View; 6 | 7 | 8 | 9 | 10 | public interface IImageLoaderstrategy { 11 | void showImage(@NonNull ImageLoaderOptions options); 12 | void hideImage(@NonNull View view,int visiable); 13 | void cleanMemory(Context context); 14 | void pause(Context context); 15 | void resume(Context context); 16 | // 在application的oncreate中初始化 17 | void init(Context context,ImageLoaderConfig config); 18 | } 19 | -------------------------------------------------------------------------------- /imageloader/src/main/java/com/lasingwu/baselibrary/ImageLoaderConfig.java: -------------------------------------------------------------------------------- 1 | package com.lasingwu.baselibrary; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | 7 | 8 | public class ImageLoaderConfig { 9 | private HashMap imageloaderMap; 10 | private long maxMemory=0; 11 | private ImageLoaderConfig(Builder builder){ 12 | imageloaderMap=builder.imageloaderMap; 13 | maxMemory=builder.maxMemory; 14 | } 15 | 16 | public long getMaxMemory() { 17 | return maxMemory <= 0 ? 40*1024*1024 : maxMemory; 18 | } 19 | 20 | public HashMap getImageloaderMap() { 21 | return imageloaderMap; 22 | } 23 | 24 | public static class Builder{ 25 | private HashMap imageloaderMap =new HashMap<>(); 26 | private long maxMemory=40*1024*1024; 27 | public Builder(LoaderEnum emun,IImageLoaderstrategy loaderstrategy){ 28 | imageloaderMap.put(emun,loaderstrategy); 29 | } 30 | public Builder addImageLodaer(LoaderEnum emun,IImageLoaderstrategy loaderstrategy){ 31 | imageloaderMap.put(emun,loaderstrategy); 32 | return this; 33 | } 34 | 35 | /** 36 | * 37 | * @param maxMemory 单位为 Byte 38 | * @return 39 | */ 40 | public Builder maxMemory(Long maxMemory){ 41 | this.maxMemory = maxMemory; 42 | return this; 43 | } 44 | public ImageLoaderConfig build(){ 45 | return new ImageLoaderConfig(this); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /imageloader/src/main/java/com/lasingwu/baselibrary/LoaderEnum.java: -------------------------------------------------------------------------------- 1 | package com.lasingwu.baselibrary; 2 | 3 | 4 | 5 | public enum LoaderEnum { 6 | GLIDE,FRESCO,OTHER,WHATEVER 7 | } 8 | -------------------------------------------------------------------------------- /imageloader/src/main/java/com/lasingwu/baselibrary/LoaderResultCallBack.java: -------------------------------------------------------------------------------- 1 | package com.lasingwu.baselibrary; 2 | 3 | /** 4 | * Created by wuzhao on 2018/1/14. 5 | */ 6 | 7 | public interface LoaderResultCallBack { 8 | void onSucc(); 9 | void onFail(); 10 | } 11 | -------------------------------------------------------------------------------- /imageloader/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | BaseLibrary 3 | 4 | -------------------------------------------------------------------------------- /imageloader/src/test/java/com/lasingwu/baselibrary/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.lasingwu.baselibrary; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /log/.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | lint.xml 5 | version.properties 6 | 7 | #Eclipse 8 | .project 9 | .classpath 10 | .settings 11 | .checkstyle 12 | 13 | #IntelliJ IDEA 14 | .idea 15 | .svn 16 | *.iml 17 | *.ipr 18 | *.iws 19 | classes 20 | gen-external-apklibs 21 | 22 | #Maven 23 | target 24 | release.properties 25 | pom.xml.* 26 | 27 | #Ant 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | #Other 34 | .DS_Store 35 | dist/ 36 | tmp 37 | 38 | # Gradle 39 | .gradle 40 | /build 41 | /out 42 | -------------------------------------------------------------------------------- /log/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 5 | defaultConfig { 6 | minSdkVersion rootProject.ext.android.minSdkVersion 7 | targetSdkVersion rootProject.ext.android.targetSdkVersion 8 | versionCode rootProject.ext.android.versionCode 9 | versionName rootProject.ext.android.versionName 10 | } 11 | 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | api 'com.dianping.android.sdk:logan:1.2.2' 24 | //log库 25 | implementation 'com.orhanobut:logger:2.2.0' 26 | } 27 | -------------------------------------------------------------------------------- /log/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /log/src/androidTest/java/com/leo/android/log/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.leo.android.log; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.leo.android.log.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /log/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /log/src/main/java/com/leo/android/log/DefaultLog.java: -------------------------------------------------------------------------------- 1 | package com.leo.android.log; 2 | 3 | import android.content.Context; 4 | 5 | import com.leo.android.log.core.ILog; 6 | import com.orhanobut.logger.AndroidLogAdapter; 7 | import com.orhanobut.logger.Logger; 8 | 9 | /** 10 | * @Author: wangliugeng 11 | * @Date : 2019-05-31 12 | * @Email: leo3552@163.com 13 | * @Desciption: 14 | */ 15 | public class DefaultLog implements ILog { 16 | @Override 17 | public void initLog(Context context) { 18 | Logger.addLogAdapter(new AndroidLogAdapter()); 19 | } 20 | 21 | @Override 22 | public void d(String msg) { 23 | Logger.d(msg); 24 | } 25 | 26 | @Override 27 | public void d(String tag, String msg) { 28 | Logger.d(tag, msg); 29 | } 30 | 31 | @Override 32 | public void e(String msg) { 33 | Logger.e(msg); 34 | } 35 | 36 | @Override 37 | public void e(String tag, String msg) { 38 | Logger.e(tag, msg); 39 | } 40 | 41 | @Override 42 | public void w(String msg) { 43 | Logger.w(msg); 44 | } 45 | 46 | @Override 47 | public void w(String tag, String msg) { 48 | Logger.w(tag, msg); 49 | } 50 | 51 | @Override 52 | public void json(String msg) { 53 | Logger.json(msg); 54 | } 55 | 56 | @Override 57 | public void json(String tag, String msg) { 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /log/src/main/java/com/leo/android/log/core/ILog.java: -------------------------------------------------------------------------------- 1 | package com.leo.android.log.core; 2 | 3 | import android.content.Context; 4 | 5 | public interface ILog { 6 | void initLog(Context context); 7 | 8 | void d(String msg); 9 | 10 | void d(String tag, String msg); 11 | 12 | void e(String msg); 13 | 14 | void e(String tag, String msg); 15 | 16 | void w(String msg); 17 | 18 | 19 | void w(String tag, String msg); 20 | 21 | 22 | void json(String msg); 23 | 24 | void json(String tag, String msg); 25 | } 26 | -------------------------------------------------------------------------------- /log/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | log 3 | 4 | -------------------------------------------------------------------------------- /log/src/test/java/com/leo/android/log/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.leo.android.log; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /mine/.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | lint.xml 5 | version.properties 6 | 7 | #Eclipse 8 | .project 9 | .classpath 10 | .settings 11 | .checkstyle 12 | 13 | #IntelliJ IDEA 14 | .idea 15 | .svn 16 | *.iml 17 | *.ipr 18 | *.iws 19 | classes 20 | gen-external-apklibs 21 | 22 | #Maven 23 | target 24 | release.properties 25 | pom.xml.* 26 | 27 | #Ant 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | #Other 34 | .DS_Store 35 | dist/ 36 | tmp 37 | 38 | # Gradle 39 | .gradle 40 | /build 41 | /out -------------------------------------------------------------------------------- /mine/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-kapt' 4 | apply plugin: 'kotlin-android-extensions' 5 | 6 | android { 7 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 8 | defaultConfig { 9 | minSdkVersion rootProject.ext.android["minSdkVersion"] 10 | targetSdkVersion rootProject.ext.android["targetSdkVersion"] 11 | versionCode rootProject.ext.android["versionCode"] 12 | versionName rootProject.ext.android["versionName"] 13 | 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | 25 | } 26 | 27 | dependencies { 28 | implementation project(':base') 29 | testImplementation 'junit:junit:4.12' 30 | kapt 'com.sankuai.waimai.router:compiler:1.1.0' 31 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 32 | } 33 | -------------------------------------------------------------------------------- /mine/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /mine/src/androidTest/java/com/android/leo/mine/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.mine; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.android.leo.mine.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /mine/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /mine/src/main/java/com/android/leo/mine/MineFragment.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.mine 2 | 3 | import android.content.Intent 4 | import android.net.Uri 5 | import android.os.Bundle 6 | import android.support.v4.app.Fragment 7 | import com.agile.android.leo.mvp.IPresenter 8 | import com.android.leo.base.GlobalConstant 9 | import com.android.leo.base.ui.fragments.BaseFragment 10 | import com.lasingwu.baselibrary.ImageLoader 11 | import com.lasingwu.baselibrary.ImageLoaderOptions 12 | import com.sankuai.waimai.router.annotation.RouterService 13 | import kotlinx.android.synthetic.main.fragment_mine.* 14 | 15 | @RouterService(interfaces = arrayOf(Fragment::class), key = arrayOf(GlobalConstant.Fragment.MINE)) 16 | class MineFragment : BaseFragment() { 17 | override fun getLayoutId(): Int { 18 | return R.layout.fragment_mine 19 | } 20 | 21 | override fun initPresenter() { 22 | } 23 | 24 | override fun configViews() { 25 | val imageLoaderOptions = ImageLoaderOptions.Builder(mine_head, R.mipmap.icon_mine_head).isCircle().isCrossFade(true).build() 26 | ImageLoader.showImage(imageLoaderOptions) 27 | github_jump.setOnClickListener { 28 | val intent = Intent(Intent.ACTION_VIEW) 29 | intent.data = Uri.parse("https://github.com/wanglg") 30 | startActivity(intent) 31 | } 32 | // val imagebgOptions = ImageLoaderOptions.Builder(iv_bg, R.mipmap.icon_mine_head).blurImage(true).blurValue(20).build() 33 | // ImageLoader.showImage(imagebgOptions) 34 | 35 | } 36 | 37 | override fun initData(savedInstanceState: Bundle?) { 38 | } 39 | 40 | override fun requestData() { 41 | } 42 | } -------------------------------------------------------------------------------- /mine/src/main/res/mipmap-xxhdpi/icon_mine_head.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/mine/src/main/res/mipmap-xxhdpi/icon_mine_head.jpg -------------------------------------------------------------------------------- /mine/src/main/res/mipmap-xxhdpi/icon_mine_head_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/mine/src/main/res/mipmap-xxhdpi/icon_mine_head_bg.png -------------------------------------------------------------------------------- /mine/src/main/res/mipmap-xxhdpi/icon_right_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/mine/src/main/res/mipmap-xxhdpi/icon_right_arrow.png -------------------------------------------------------------------------------- /mine/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #222222 4 | -------------------------------------------------------------------------------- /mine/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | leo3552@163.com 3 | https://github.com/wanglg 4 | 5 | -------------------------------------------------------------------------------- /mine/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | 17 | 23 | 24 | 29 | 30 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /mine/src/test/java/com/android/leo/mine/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.mine; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /multiple-status-view/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | *.iml -------------------------------------------------------------------------------- /multiple-status-view/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | 5 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 6 | buildToolsVersion rootProject.ext.android["buildToolsVersion"] 7 | 8 | defaultConfig { 9 | minSdkVersion rootProject.ext.android.minSdkVersion 10 | targetSdkVersion rootProject.ext.android.targetSdkVersion 11 | versionCode rootProject.ext.android.versionCode 12 | versionName rootProject.ext.android.versionName 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { } -------------------------------------------------------------------------------- /multiple-status-view/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\AndroidStudio\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 | -------------------------------------------------------------------------------- /multiple-status-view/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /multiple-status-view/src/main/res/layout/empty_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | -------------------------------------------------------------------------------- /multiple-status-view/src/main/res/layout/error_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | -------------------------------------------------------------------------------- /multiple-status-view/src/main/res/layout/loading_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /multiple-status-view/src/main/res/layout/no_network_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | -------------------------------------------------------------------------------- /multiple-status-view/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /multiple-status-view/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /multiple-status-view/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | multiple-status-view 3 | 4 | 暂无数据 5 | 加载失败 6 | 网络异常 7 | 8 | -------------------------------------------------------------------------------- /multiple-status-view/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | -------------------------------------------------------------------------------- /router/.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | lint.xml 5 | version.properties 6 | 7 | #Eclipse 8 | .project 9 | .classpath 10 | .settings 11 | .checkstyle 12 | 13 | #IntelliJ IDEA 14 | .idea 15 | .svn 16 | *.iml 17 | *.ipr 18 | *.iws 19 | classes 20 | gen-external-apklibs 21 | 22 | #Maven 23 | target 24 | release.properties 25 | pom.xml.* 26 | 27 | #Ant 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | #Other 34 | .DS_Store 35 | dist/ 36 | tmp 37 | 38 | # Gradle 39 | .gradle 40 | /build 41 | /out -------------------------------------------------------------------------------- /router/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | // 添加kapt插件 5 | apply plugin: 'kotlin-kapt' 6 | android { 7 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 8 | defaultConfig { 9 | minSdkVersion rootProject.ext.android["minSdkVersion"] 10 | targetSdkVersion rootProject.ext.android["targetSdkVersion"] 11 | versionCode rootProject.ext.android["versionCode"] 12 | versionName rootProject.ext.android["versionName"] 13 | 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | 25 | } 26 | 27 | dependencies { 28 | implementation fileTree(dir: 'libs', include: ['*.jar']) 29 | kapt 'com.sankuai.waimai.router:compiler:1.1.0' 30 | api ('com.sankuai.waimai.router:router:1.1.0'){ 31 | exclude module: 'support-annotations' 32 | exclude module: 'appcompat-v7' 33 | exclude module: 'support-v4' 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /router/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /router/src/androidTest/java/com/leo/android/router/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.leo.android.router; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.leo.android.router.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /router/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /router/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | router 3 | 4 | -------------------------------------------------------------------------------- /router/src/test/java/com/leo/android/router/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.leo.android.router; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':eyepetizer', ':agile_android', ':short_video', ':video_player', ':router', ':base', ':api', ':trunk', ':mine', ':log', 2 | ':toutiao','multiple-status-view','imageloader' 3 | -------------------------------------------------------------------------------- /short_video/.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | lint.xml 5 | version.properties 6 | 7 | #Eclipse 8 | .project 9 | .classpath 10 | .settings 11 | .checkstyle 12 | 13 | #IntelliJ IDEA 14 | .idea 15 | .svn 16 | *.iml 17 | *.ipr 18 | *.iws 19 | classes 20 | gen-external-apklibs 21 | 22 | #Maven 23 | target 24 | release.properties 25 | pom.xml.* 26 | 27 | #Ant 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | #Other 34 | .DS_Store 35 | dist/ 36 | tmp 37 | 38 | # Gradle 39 | .gradle 40 | /build 41 | /out -------------------------------------------------------------------------------- /short_video/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-kapt' 4 | apply plugin: 'kotlin-android-extensions' 5 | android { 6 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 7 | defaultConfig { 8 | minSdkVersion rootProject.ext.android["minSdkVersion"] 9 | targetSdkVersion rootProject.ext.android["targetSdkVersion"] 10 | versionCode rootProject.ext.android["versionCode"] 11 | versionName rootProject.ext.android["versionName"] 12 | 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | 24 | } 25 | 26 | dependencies { 27 | implementation fileTree(dir: 'libs', include: ['*.jar']) 28 | implementation project(':base') 29 | implementation project(':video_player') 30 | kapt 'com.sankuai.waimai.router:compiler:1.1.0' 31 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 32 | } 33 | -------------------------------------------------------------------------------- /short_video/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /short_video/src/androidTest/java/com/leowang/shortvideo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.leowang.shortvideo; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.leowang.shortvideo.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /short_video/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /short_video/src/main/java/com/shortvideo/android/leo/mvp/contract/SmallVideoContract.kt: -------------------------------------------------------------------------------- 1 | package com.shortvideo.android.leo.mvp.contract 2 | 3 | import com.agile.android.leo.mvp.IModel 4 | import com.agile.android.leo.mvp.IView 5 | import com.shortvideo.android.leo.mvp.model.entity.VideoBean 6 | import io.reactivex.Observable 7 | 8 | interface SmallVideoContract { 9 | interface View : IView { 10 | fun setVideoData(data: ArrayList) 11 | } 12 | 13 | interface Model : IModel { 14 | fun getVideoData(): Observable> 15 | } 16 | } -------------------------------------------------------------------------------- /short_video/src/main/java/com/shortvideo/android/leo/mvp/model/entity/VideoBean.java: -------------------------------------------------------------------------------- 1 | package com.shortvideo.android.leo.mvp.model.entity; 2 | 3 | 4 | public class VideoBean { 5 | 6 | private String title; 7 | private String url; 8 | private String thumb; 9 | /** 10 | * 0、centerCrop 1、FIT_CENTER 11 | */ 12 | public int thumbScaleType; 13 | 14 | public String getTitle() { 15 | return title; 16 | } 17 | 18 | public void setTitle(String title) { 19 | this.title = title; 20 | } 21 | 22 | public String getUrl() { 23 | return url; 24 | } 25 | 26 | public void setUrl(String url) { 27 | this.url = url; 28 | } 29 | 30 | public String getThumb() { 31 | return thumb; 32 | } 33 | 34 | public void setThumb(String thumb) { 35 | this.thumb = thumb; 36 | } 37 | 38 | public VideoBean(String title, String thumb, String url) { 39 | this.title = title; 40 | this.url = url; 41 | this.thumb = thumb; 42 | 43 | } 44 | 45 | public VideoBean(String title, String thumb, String url, int thumbScaleType) { 46 | this.title = title; 47 | this.url = url; 48 | this.thumb = thumb; 49 | this.thumbScaleType = thumbScaleType; 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /short_video/src/main/java/com/shortvideo/android/leo/mvp/presenter/ShortVideoPresenter.kt: -------------------------------------------------------------------------------- 1 | package com.shortvideo.android.leo.mvp.presenter 2 | 3 | import com.agile.android.leo.exception.ApiException 4 | import com.agile.android.leo.mvp.BasePresenter 5 | import com.android.leo.base.utils.rxjava.SchedulersUtil 6 | import com.leo.android.api.ApiSubscriber 7 | import com.shortvideo.android.leo.mvp.contract.SmallVideoContract 8 | import com.shortvideo.android.leo.mvp.model.entity.VideoBean 9 | import io.reactivex.disposables.Disposable 10 | 11 | class ShortVideoPresenter(model: SmallVideoContract.Model, rootView: SmallVideoContract.View) : 12 | BasePresenter(model, rootView) { 13 | 14 | fun requestVideoData() { 15 | mModel?.getVideoData()?.compose(SchedulersUtil.applyApiSchedulers())?.subscribe(object : ApiSubscriber>() { 16 | override fun onFailure(t: ApiException) { 17 | } 18 | 19 | override fun onSubscribe(d: Disposable) { 20 | addDispose(d) 21 | } 22 | 23 | override fun onNext(t: ArrayList) { 24 | mRootView?.setVideoData(t) 25 | } 26 | 27 | }) 28 | } 29 | } -------------------------------------------------------------------------------- /short_video/src/main/java/com/shortvideo/android/leo/ui/adapters/ShortVideoTabAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.shortvideo.android.leo.ui.adapters 2 | 3 | import android.widget.ImageView 4 | import com.chad.library.adapter.base.BaseQuickAdapter 5 | import com.chad.library.adapter.base.BaseViewHolder 6 | import com.lasingwu.baselibrary.ImageLoader 7 | import com.lasingwu.baselibrary.ImageLoaderOptions 8 | import com.leowang.shortvideo.R 9 | import com.shortvideo.android.leo.mvp.model.entity.VideoBean 10 | 11 | class ShortVideoTabAdapter(data: ArrayList) : BaseQuickAdapter(R.layout.sv_item_short_video_feed, data) { 12 | override fun convert(helper: BaseViewHolder, item: VideoBean) { 13 | helper.setText(R.id.videoTitleText, item.title) 14 | val coverOption = ImageLoaderOptions.Builder(helper.getView(R.id.videoCover), item.thumb) 15 | .build() 16 | val cover = helper.getView(R.id.videoCover) 17 | if (item.thumbScaleType == 0) { 18 | cover.scaleType = ImageView.ScaleType.CENTER_CROP 19 | } else { 20 | cover.scaleType = ImageView.ScaleType.FIT_CENTER 21 | } 22 | ImageLoader.showImage(coverOption) 23 | } 24 | } -------------------------------------------------------------------------------- /short_video/src/main/java/com/shortvideo/android/leo/ui/view/widgets/OnPageStateChangedListener.java: -------------------------------------------------------------------------------- 1 | package com.shortvideo.android.leo.ui.view.widgets; 2 | 3 | /** 4 | * 5 | */ 6 | public interface OnPageStateChangedListener { 7 | /** 8 | * @param oldPosition old position 9 | * @param newPosition new position 10 | */ 11 | void onPageChanged(int oldPosition, int newPosition); 12 | 13 | /** 14 | * 快速滑动后在onFling中切换到其他position,触发回调,仿抖音,在这里移除播放器 15 | */ 16 | void onFlingToOtherPosition(); 17 | 18 | /*位于该position 的item从window detach*/ 19 | void onPageDetachedFromWindow(int position); 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /short_video/src/main/res/drawable/clip_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /short_video/src/main/res/layout/sv_item_short_video_control.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 22 | -------------------------------------------------------------------------------- /short_video/src/main/res/mipmap-xxhdpi/btn_comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/short_video/src/main/res/mipmap-xxhdpi/btn_comment.png -------------------------------------------------------------------------------- /short_video/src/main/res/mipmap-xxhdpi/btn_favor_def.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/short_video/src/main/res/mipmap-xxhdpi/btn_favor_def.png -------------------------------------------------------------------------------- /short_video/src/main/res/mipmap-xxhdpi/btn_favor_like.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/short_video/src/main/res/mipmap-xxhdpi/btn_favor_like.png -------------------------------------------------------------------------------- /short_video/src/main/res/mipmap-xxhdpi/btn_relay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/short_video/src/main/res/mipmap-xxhdpi/btn_relay.png -------------------------------------------------------------------------------- /short_video/src/main/res/mipmap-xxhdpi/ic_small_video_top_shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/short_video/src/main/res/mipmap-xxhdpi/ic_small_video_top_shadow.png -------------------------------------------------------------------------------- /short_video/src/main/res/mipmap-xxhdpi/ic_video_bottom_shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/short_video/src/main/res/mipmap-xxhdpi/ic_video_bottom_shadow.png -------------------------------------------------------------------------------- /short_video/src/main/res/mipmap-xxhdpi/icon_btn_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/short_video/src/main/res/mipmap-xxhdpi/icon_btn_play.png -------------------------------------------------------------------------------- /short_video/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | -------------------------------------------------------------------------------- /short_video/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | short_video 3 | 4 | -------------------------------------------------------------------------------- /short_video/src/test/java/com/leowang/shortvideo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.leowang.shortvideo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /toutiao/.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | lint.xml 5 | version.properties 6 | 7 | #Eclipse 8 | .project 9 | .classpath 10 | .settings 11 | .checkstyle 12 | 13 | #IntelliJ IDEA 14 | .idea 15 | .svn 16 | *.iml 17 | *.ipr 18 | *.iws 19 | classes 20 | gen-external-apklibs 21 | 22 | #Maven 23 | target 24 | release.properties 25 | pom.xml.* 26 | 27 | #Ant 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | #Other 34 | .DS_Store 35 | dist/ 36 | tmp 37 | 38 | # Gradle 39 | .gradle 40 | /build 41 | /out -------------------------------------------------------------------------------- /toutiao/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-kapt' 4 | apply plugin: 'kotlin-android-extensions' 5 | 6 | android { 7 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 8 | defaultConfig { 9 | minSdkVersion rootProject.ext.android["minSdkVersion"] 10 | targetSdkVersion rootProject.ext.android["targetSdkVersion"] 11 | versionCode rootProject.ext.android["versionCode"] 12 | versionName rootProject.ext.android["versionName"] 13 | 14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 15 | 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | 25 | } 26 | 27 | dependencies { 28 | implementation project(':base') 29 | testImplementation 'junit:junit:4.12' 30 | kapt 'com.sankuai.waimai.router:compiler:1.1.0' 31 | implementation project(':video_player') 32 | // 底部菜单 33 | implementation('com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar') { 34 | exclude group: 'com.android.support', module: 'support-v4' 35 | } 36 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 37 | } 38 | -------------------------------------------------------------------------------- /toutiao/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /toutiao/src/androidTest/java/com/android/leo/toutiao/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.android.leo.toutiao.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /toutiao/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/Constant.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao; 2 | 3 | 4 | public class Constant { 5 | /** 6 | * 已选中频道的json 7 | */ 8 | public static final String SELECTED_CHANNEL_JSON = "selectedChannelJson"; 9 | /** 10 | * w未选频道的json 11 | */ 12 | public static final String UNSELECTED_CHANNEL_JSON = "unselectChannelJson"; 13 | 14 | /** 15 | * 频道对应的请求参数 16 | */ 17 | public static final String CHANNEL_CODE = "channelCode"; 18 | public static final String IS_VIDEO_LIST = "isVideoList"; 19 | 20 | public static final String ARTICLE_GENRE_VIDEO = "video"; 21 | public static final String ARTICLE_GENRE_AD = "ad"; 22 | 23 | public static final String TAG_MOVIE = "video_movie"; 24 | 25 | public static final String URL_VIDEO = "/video/urls/v/1/toutiao/mp4/%s?r=%s"; 26 | 27 | /** 28 | * 获取评论列表每页的数目 29 | */ 30 | public static final int COMMENT_PAGE_SIZE = 20; 31 | 32 | public static final String DATA_SELECTED = "dataSelected"; 33 | public static final String DATA_UNSELECTED = "dataUnselected"; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/TouTiaoApp.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao 2 | 3 | import android.app.Application 4 | import android.content.Context 5 | import com.android.leo.base.BaseApplication 6 | import com.android.leo.base.delegate.AppLifecycles 7 | import kotlin.properties.Delegates 8 | 9 | class TouTiaoApp : AppLifecycles { 10 | val mChannelCodes by lazy { 11 | BaseApplication.context.resources.getStringArray(R.array.channel_code) 12 | } 13 | 14 | companion object { 15 | 16 | private val TAG = "BaseApplication" 17 | 18 | var context: TouTiaoApp by Delegates.notNull() 19 | private set 20 | } 21 | 22 | override fun attachBaseContext(base: Context) { 23 | } 24 | 25 | override fun onCreate(application: Application) { 26 | context = this 27 | } 28 | 29 | override fun onTerminate(application: Application) { 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/TouTiaoConfiguration.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao 2 | 3 | import android.app.Application 4 | import android.content.Context 5 | import android.support.v4.app.FragmentManager 6 | import com.android.leo.base.delegate.AppLifecycles 7 | import com.android.leo.base.integration.ConfigModule 8 | 9 | class TouTiaoConfiguration : ConfigModule { 10 | override fun injectAppLifecycle(context: Context?, lifecycles: MutableList) { 11 | lifecycles.add(TouTiaoApp()) 12 | } 13 | 14 | override fun injectActivityLifecycle(context: Context?, lifecycles: MutableList?) { 15 | } 16 | 17 | override fun injectFragmentLifecycle(context: Context?, lifecycles: MutableList?) { 18 | } 19 | } -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/api/ApiConstant.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.api; 2 | 3 | 4 | public class ApiConstant { 5 | /** 6 | * 接口根地址 7 | */ 8 | public static final String BASE_SERVER_URL = "http://is.snssdk.com/"; 9 | public static final String HOST_VIDEO = "http://i.snssdk.com"; 10 | public static final String GET_ARTICLE_LIST = "api/news/feed/v62/?refer=1&count=20&loc_mode=4&iid=13136511752"; 11 | public static final String URL_VIDEO = "/video/urls/v/1/toutiao/mp4/%s?r=%s"; 12 | } 13 | -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/api/ApiService.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.api 2 | 3 | import com.android.leo.toutiao.api.ApiConstant.GET_ARTICLE_LIST 4 | import com.android.leo.toutiao.mvp.model.entity.VideoModel 5 | import com.android.leo.toutiao.mvp.model.response.NewsResponse 6 | import com.android.leo.toutiao.mvp.model.response.ResultResponse 7 | import io.reactivex.Observable 8 | import retrofit2.http.GET 9 | import retrofit2.http.Query 10 | import retrofit2.http.Url 11 | 12 | interface ApiService { 13 | 14 | 15 | /** 16 | * 获取新闻列表 17 | * 18 | * @param category 频道 19 | * @return 20 | */ 21 | @GET(GET_ARTICLE_LIST) 22 | fun getNewsList(@Query("category") category: String, @Query("max_behot_time") max_behot_time: Long): Observable 23 | 24 | /** 25 | * 获取视频页的html代码 26 | */ 27 | @GET 28 | fun getVideoHtml(@Url url: String): Observable 29 | 30 | /** 31 | * 获取视频数据json 32 | * @param url 33 | * @return 34 | */ 35 | @GET 36 | fun getVideoData(@Url url: String): Observable> 37 | } -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/mvp/contract/NewsListContract.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.mvp.contract 2 | 3 | import com.agile.android.leo.exception.ApiException 4 | import com.agile.android.leo.mvp.IModel 5 | import com.agile.android.leo.mvp.IView 6 | import com.android.leo.toutiao.mvp.model.entity.News 7 | import com.android.leo.toutiao.mvp.model.entity.NewsData 8 | import com.android.leo.toutiao.mvp.model.response.NewsResponse 9 | import io.reactivex.Observable 10 | 11 | interface NewsListContract { 12 | interface View : IView { 13 | fun onGetNewsListSuccess(newList: ArrayList, tipInfo: String) 14 | fun addToEndListSuccess(newList: ArrayList) 15 | fun addToEndListFailed(e: ApiException) 16 | } 17 | 18 | interface Model : IModel { 19 | fun getNewsLst(channelCode: String, max_behot_time: Long): Observable 20 | } 21 | } -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/mvp/contract/TouTiaoContract.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.mvp.contract 2 | 3 | import com.agile.android.leo.mvp.IModel 4 | import com.agile.android.leo.mvp.IView 5 | import com.android.leo.toutiao.mvp.model.entity.Channel 6 | 7 | interface TouTiaoContract { 8 | interface View : IView { 9 | 10 | } 11 | 12 | interface Model : IModel { 13 | fun getSelectChannels(): ArrayList 14 | } 15 | } -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/mvp/model/NewsListModel.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.mvp.model 2 | 3 | import com.agile.android.leo.mvp.BaseModel 4 | import com.android.leo.toutiao.api.ApiService 5 | import com.android.leo.toutiao.api.RepositoryManager 6 | import com.android.leo.toutiao.mvp.contract.NewsListContract 7 | import com.android.leo.toutiao.mvp.model.response.NewsResponse 8 | import io.reactivex.Observable 9 | 10 | class NewsListModel : BaseModel(), NewsListContract.Model { 11 | override fun getNewsLst(channelCode: String, max_behot_time: Long): Observable { 12 | return RepositoryManager.obtainRetrofitService(ApiService::class.java).getNewsList(channelCode, max_behot_time) 13 | } 14 | } -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/mvp/model/entity/Channel.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.mvp.model.entity; 2 | 3 | import com.chad.library.adapter.base.entity.MultiItemEntity; 4 | 5 | import java.io.Serializable; 6 | 7 | public class Channel implements MultiItemEntity, Serializable { 8 | public static final int TYPE_MY = 1; 9 | public static final int TYPE_OTHER = 2; 10 | public static final int TYPE_MY_CHANNEL = 3; 11 | public static final int TYPE_OTHER_CHANNEL = 4; 12 | 13 | public String title; 14 | public String channelCode; 15 | public int itemType; 16 | 17 | public Channel(String title, String channelCode) { 18 | this(TYPE_MY_CHANNEL, title, channelCode); 19 | } 20 | 21 | public Channel(int type, String title, String channelCode) { 22 | this.title = title; 23 | this.channelCode = channelCode; 24 | itemType = type; 25 | } 26 | 27 | @Override 28 | public int getItemType() { 29 | return itemType; 30 | } 31 | 32 | public void setItemType(int itemType) { 33 | this.itemType = itemType; 34 | } 35 | } -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/mvp/model/entity/ImageEntity.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.mvp.model.entity; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | 7 | public class ImageEntity implements Serializable { 8 | /** 9 | * url : http://p3.pstatp.com/list/300x196/2c23000095ae9f56b15f.webp 10 | * width : 700 11 | * url_list : [{"url":"http://p3.pstatp.com/list/300x196/2c23000095ae9f56b15f.webp"},{"url":"http://pb9.pstatp.com/list/300x196/2c23000095ae9f56b15f.webp"},{"url":"http://pb1.pstatp.com/list/300x196/2c23000095ae9f56b15f.webp"}] 12 | * uri : list/2c23000095ae9f56b15f 13 | * height : 393 14 | */ 15 | 16 | public String url; 17 | public int width; 18 | public String uri; 19 | public int height; 20 | public List url_list; 21 | 22 | public static class UrlListBeanX { 23 | /** 24 | * url : http://p3.pstatp.com/list/300x196/2c23000095ae9f56b15f.webp 25 | */ 26 | 27 | public String url; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/mvp/model/entity/TipEntity.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.mvp.model.entity; 2 | 3 | 4 | import java.io.Serializable; 5 | 6 | public class TipEntity implements Serializable { 7 | /** 8 | * display_info : 今日头条推荐引擎有15条更新 9 | * open_url : 10 | * web_url : 11 | * app_name : 今日头条 12 | * package_name : 13 | * display_template : 今日头条推荐引擎有%s条更新 14 | * type : app 15 | * display_duration : 2 16 | * download_url : 17 | */ 18 | 19 | public String display_info; 20 | public String open_url; 21 | public String web_url; 22 | public String app_name; 23 | public String package_name; 24 | public String display_template; 25 | public String type; 26 | public int display_duration; 27 | public String download_url; 28 | } 29 | -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/mvp/model/entity/TouTiaoModel.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.mvp.model.entity 2 | 3 | class TouTiaoModel { 4 | } -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/mvp/model/entity/UserEntity.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.mvp.model.entity; 2 | 3 | 4 | import java.io.Serializable; 5 | 6 | public class UserEntity implements Serializable { 7 | /** 8 | * verified_content : 9 | * avatar_url : http://p3.pstatp.com/thumb/216b000e0abb3ee9cb91 10 | * user_id : 59834611934 11 | * name : 电竞手游君 12 | * follower_count : 0 13 | * follow : false 14 | * user_auth_info : 15 | * user_verified : false 16 | * description : 游戏 资讯 游戏攻略 你要的这里都有,来这里就对了。 17 | */ 18 | 19 | public String verified_content; 20 | public String avatar_url; 21 | public long user_id; 22 | public String name; 23 | public int follower_count; 24 | public boolean follow; 25 | public String user_auth_info; 26 | public boolean user_verified; 27 | public String description; 28 | } 29 | -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/mvp/model/entity/VideoEntity.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.mvp.model.entity; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | public class VideoEntity implements Serializable { 7 | /** 8 | * group_flags : 32832 9 | * video_type : 0 10 | * video_preloading_flag : 1 11 | * video_url : [] 12 | * direct_play : 1 13 | * detail_video_large_image : {"url":"http://p1.pstatp.com/video1609/2130000392cc3ddb8076","width":580,"url_list":[{"url":"http://p1.pstatp.com/video1609/2130000392cc3ddb8076"},{"url":"http://pb3.pstatp.com/video1609/2130000392cc3ddb8076"},{"url":"http://pb9.pstatp.com/video1609/2130000392cc3ddb8076"}],"uri":"video1609/2130000392cc3ddb8076","height":326} 14 | * show_pgc_subscribe : 1 15 | * video_third_monitor_url : 16 | * video_id : eb0eab0d76274b13a3fd0649ba1d0f74 17 | * video_watching_count : 0 18 | * video_watch_count : 657298 19 | */ 20 | 21 | public int group_flags; 22 | public int video_type; 23 | public int video_preloading_flag; 24 | public int direct_play; 25 | public ImageEntity detail_video_large_image; 26 | public int show_pgc_subscribe; 27 | public String video_third_monitor_url; 28 | public String video_id; 29 | public int video_watching_count; 30 | public int video_watch_count; 31 | public List video_url; 32 | //自己新增的字段,记录视频播放的进度,用于同步视频列表也和详情页的进度 33 | public int progress; 34 | } 35 | -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/mvp/model/response/NewsResponse.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.mvp.model.response; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | import com.android.leo.toutiao.mvp.model.entity.NewsData; 6 | import com.android.leo.toutiao.mvp.model.entity.TipEntity; 7 | import com.google.gson.Gson; 8 | 9 | import java.util.ArrayList; 10 | 11 | 12 | public class NewsResponse { 13 | 14 | public int login_status; 15 | public int total_number; 16 | public boolean has_more; 17 | public String post_content_hint; 18 | public int show_et_status; 19 | public int feed_flag; 20 | public int action_to_last_stick; 21 | public String message; 22 | public boolean has_more_to_refresh; 23 | public TipEntity tips; 24 | 25 | public ArrayList data; 26 | 27 | @NonNull 28 | @Override 29 | public String toString() { 30 | return new Gson().toJson(this); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/mvp/model/response/ResultResponse.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.mvp.model.response; 2 | 3 | 4 | public class ResultResponse { 5 | 6 | public String has_more; 7 | public String message; 8 | public String success; 9 | public T data; 10 | 11 | public ResultResponse(String more, String _message, T result) { 12 | has_more = more; 13 | message = _message; 14 | data = result; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/mvp/presenter/TouTiaoPresenter.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.mvp.presenter 2 | 3 | import com.agile.android.leo.mvp.BasePresenter 4 | import com.android.leo.toutiao.mvp.contract.TouTiaoContract 5 | import com.android.leo.toutiao.mvp.model.entity.Channel 6 | import io.reactivex.Observable 7 | 8 | class TouTiaoPresenter(model: TouTiaoContract.Model, rootView: TouTiaoContract.View) : BasePresenter(model, rootView) { 9 | 10 | fun requestSelectChannel(): Observable> { 11 | return Observable.just(mModel?.getSelectChannels()) 12 | } 13 | } -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/ui/adapter/ChannelPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.ui.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentStatePagerAdapter; 6 | 7 | import com.android.leo.toutiao.mvp.model.entity.Channel; 8 | import com.android.leo.toutiao.ui.fragment.NewsListFragment; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | 14 | public class ChannelPagerAdapter extends FragmentStatePagerAdapter { 15 | 16 | private List mFragments; 17 | private List mChannels; 18 | 19 | public ChannelPagerAdapter(List fragmentList, List channelList, FragmentManager fm) { 20 | super(fm); 21 | mFragments = fragmentList == null ? new ArrayList() : fragmentList; 22 | mChannels = channelList == null ? new ArrayList() : channelList; 23 | } 24 | 25 | @Override 26 | public Fragment getItem(int position) { 27 | return mFragments.get(position); 28 | } 29 | 30 | @Override 31 | public int getCount() { 32 | return mFragments.size(); 33 | } 34 | 35 | @Override 36 | public CharSequence getPageTitle(int position) { 37 | return mChannels.get(position).title; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/ui/adapter/provider/RightPicNewsItemProvider.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.ui.adapter.provider 2 | 3 | import com.agile.android.leo.utils.TimeUtils 4 | import com.android.leo.toutiao.R 5 | import com.android.leo.toutiao.mvp.model.entity.News 6 | import com.android.leo.toutiao.ui.adapter.NewsListAdapter 7 | import com.android.leo.toutiao.ui.adapter.entity.NewsFeedMultipleEntity 8 | import com.chad.library.adapter.base.BaseViewHolder 9 | import com.lasingwu.baselibrary.ImageLoader 10 | import com.lasingwu.baselibrary.ImageLoaderOptions 11 | 12 | class RightPicNewsItemProvider(mChannelCode: String) : BaseNewsItemProvider(mChannelCode) { 13 | override fun convert(helper: BaseViewHolder, data: NewsFeedMultipleEntity, position: Int) { 14 | val item: News? = data.news; 15 | item?.let { 16 | convert(helper, it, position) 17 | //右侧小图布局,判断是否有视频 18 | if (it.has_video) { 19 | helper.setVisible(R.id.ll_duration, true)//显示时长 20 | helper.setText(R.id.tv_duration, TimeUtils.secToTime(it.video_duration))//设置时长 21 | } else { 22 | helper.setVisible(R.id.ll_duration, false)//隐藏时长 23 | } 24 | val imageLoaderOptions = ImageLoaderOptions.Builder(helper.getView(R.id.iv_img), it.middle_image.url).build() 25 | ImageLoader.showImage(imageLoaderOptions) 26 | } 27 | } 28 | 29 | override fun layout(): Int { 30 | return R.layout.item_pic_video_news 31 | } 32 | 33 | override fun viewType(): Int { 34 | return NewsListAdapter.RIGHT_PIC_VIDEO_NEWS 35 | } 36 | } -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/ui/adapter/provider/TextNewsItemProvider.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.ui.adapter.provider 2 | 3 | import com.android.leo.toutiao.R 4 | import com.android.leo.toutiao.mvp.model.entity.News 5 | import com.android.leo.toutiao.ui.adapter.NewsListAdapter 6 | import com.android.leo.toutiao.ui.adapter.entity.NewsFeedMultipleEntity 7 | import com.chad.library.adapter.base.BaseViewHolder 8 | 9 | class TextNewsItemProvider(mChannelCode: String) : BaseNewsItemProvider(mChannelCode) { 10 | override fun layout(): Int { 11 | return R.layout.item_text_news 12 | } 13 | 14 | override fun viewType(): Int { 15 | return NewsListAdapter.TEXT_NEWS 16 | } 17 | 18 | override fun convert(helper: BaseViewHolder, data: NewsFeedMultipleEntity, position: Int) { 19 | val item: News? = data.news; 20 | item?.let { 21 | convert(helper, it, position) 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /toutiao/src/main/java/com/android/leo/toutiao/ui/adapter/provider/ThreePicNewsItemProvider.kt: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao.ui.adapter.provider 2 | 3 | import com.android.leo.toutiao.R 4 | import com.android.leo.toutiao.mvp.model.entity.News 5 | import com.android.leo.toutiao.ui.adapter.NewsListAdapter 6 | import com.android.leo.toutiao.ui.adapter.entity.NewsFeedMultipleEntity 7 | import com.chad.library.adapter.base.BaseViewHolder 8 | import com.lasingwu.baselibrary.ImageLoader 9 | import com.lasingwu.baselibrary.ImageLoaderOptions 10 | 11 | class ThreePicNewsItemProvider(mChannelCode: String) : BaseNewsItemProvider(mChannelCode) { 12 | override fun convert(helper: BaseViewHolder, data: NewsFeedMultipleEntity, position: Int) { 13 | val item: News? = data.news; 14 | item?.let { 15 | convert(helper, it, position) 16 | val imageLoaderOptions1 = ImageLoaderOptions.Builder(helper.getView(R.id.iv_img1), it.image_list.get(0).url).build() 17 | ImageLoader.showImage(imageLoaderOptions1) 18 | val imageLoaderOptions2 = ImageLoaderOptions.Builder(helper.getView(R.id.iv_img2), it.image_list.get(1).url).build() 19 | ImageLoader.showImage(imageLoaderOptions2) 20 | val imageLoaderOptions3 = ImageLoaderOptions.Builder(helper.getView(R.id.iv_img3), it.image_list.get(2).url).build() 21 | ImageLoader.showImage(imageLoaderOptions3) 22 | } 23 | } 24 | 25 | override fun layout(): Int { 26 | return R.layout.item_three_pics_news 27 | } 28 | 29 | override fun viewType(): Int { 30 | return NewsListAdapter.THREE_PICS_NEWS 31 | } 32 | } -------------------------------------------------------------------------------- /toutiao/src/main/res/drawable-xhdpi/search_background.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/drawable-xhdpi/search_background.9.png -------------------------------------------------------------------------------- /toutiao/src/main/res/drawable/jc_title_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/drawable/jc_title_bg.9.png -------------------------------------------------------------------------------- /toutiao/src/main/res/drawable/selector_play_video.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /toutiao/src/main/res/drawable/shape_rectangle_translucent.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /toutiao/src/main/res/drawable/toutiao_video_feed_seek_bar_style.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 | -------------------------------------------------------------------------------- /toutiao/src/main/res/drawable/video_progress_drawable.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /toutiao/src/main/res/layout/include_news_title.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | -------------------------------------------------------------------------------- /toutiao/src/main/res/layout/item_feed_loading_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 12 | -------------------------------------------------------------------------------- /toutiao/src/main/res/layout/item_text_news.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/add_channel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/add_channel.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/add_focus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/add_focus.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/comment_count.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/comment_count.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/ic_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/ic_default.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/ic_toutiao_action_full_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/ic_toutiao_action_full_screen.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/ic_toutiao_action_min_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/ic_toutiao_action_min_screen.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/ic_toutiao_play_pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/ic_toutiao_play_pause.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/ic_toutiao_play_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/ic_toutiao_play_start.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/ic_toutiao_player_close_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/ic_toutiao_player_close_white.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/ic_toutiao_player_progress_handle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/ic_toutiao_player_progress_handle.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/icon_picture_group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/icon_picture_group.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/icon_video_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/icon_video_play.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/new_more_titlebar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/new_more_titlebar.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/play_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/play_normal.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/play_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/play_pressed.png -------------------------------------------------------------------------------- /toutiao/src/main/res/mipmap-xxhdpi/shadow_add_titlebar_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/toutiao/src/main/res/mipmap-xxhdpi/shadow_add_titlebar_new.png -------------------------------------------------------------------------------- /toutiao/src/main/res/values/arrays_news.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 | video 29 | news_hot 30 | news_society 31 | news_entertainment 32 | news_tech 33 | news_car 34 | news_sports 35 | news_finance 36 | news_military 37 | news_world 38 | news_fashion 39 | news_game 40 | news_travel 41 | news_history 42 | news_discovery 43 | news_food 44 | news_baby 45 | news_regimen 46 | news_story 47 | news_essay 48 | 49 | -------------------------------------------------------------------------------- /toutiao/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /toutiao/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #D5E8F6 4 | #4592C6 5 | #AEAEAE 6 | #222222 7 | #F96B6B 8 | #999999 9 | #3091D8 10 | #C1C1C1 11 | #F3F5F4 12 | -------------------------------------------------------------------------------- /toutiao/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 置顶 3 | 4 | 广告 5 | 影视 6 | 网络不可用 7 | 搜你想搜的 8 | 目前没有最新新闻了 9 | 评论 10 | 11 | 关注 12 | %s次播放 13 | 解析视频失败,请重试 14 | 15 | -------------------------------------------------------------------------------- /toutiao/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 18 | -------------------------------------------------------------------------------- /toutiao/src/test/java/com/android/leo/toutiao/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.android.leo.toutiao; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /trunk/.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | lint.xml 5 | version.properties 6 | 7 | #Eclipse 8 | .project 9 | .classpath 10 | .settings 11 | .checkstyle 12 | 13 | #IntelliJ IDEA 14 | .idea 15 | .svn 16 | *.iml 17 | *.ipr 18 | *.iws 19 | classes 20 | gen-external-apklibs 21 | 22 | #Maven 23 | target 24 | release.properties 25 | pom.xml.* 26 | 27 | #Ant 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | #Other 34 | .DS_Store 35 | dist/ 36 | tmp 37 | 38 | # Gradle 39 | .gradle 40 | /build 41 | /out 42 | 43 | -------------------------------------------------------------------------------- /trunk/src/androidTest/java/com/leo/elegant/trunk/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.leo.elegant.trunk 2 | 3 | import android.support.test.InstrumentationRegistry 4 | import android.support.test.runner.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("com.leo.elegant.trunk", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /trunk/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 17 | 21 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /trunk/src/main/assets/landing.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/trunk/src/main/assets/landing.mp4 -------------------------------------------------------------------------------- /trunk/src/main/java/com/leo/elegant/trunk/entity/TabEntity.kt: -------------------------------------------------------------------------------- 1 | package com.leo.elegant.trunk.entity 2 | 3 | import com.flyco.tablayout.listener.CustomTabEntity 4 | 5 | 6 | class TabEntity(var title: String, private var selectedIcon: Int, private var unSelectedIcon: Int) : CustomTabEntity { 7 | 8 | override fun getTabTitle(): String { 9 | return title 10 | } 11 | 12 | override fun getTabSelectedIcon(): Int { 13 | return selectedIcon 14 | } 15 | 16 | override fun getTabUnselectedIcon(): Int { 17 | return unSelectedIcon 18 | } 19 | } -------------------------------------------------------------------------------- /trunk/src/main/java/com/leo/elegant/trunk/fragments/SplashFragment.kt: -------------------------------------------------------------------------------- 1 | package com.leo.elegant.trunk.fragments 2 | 3 | import android.animation.AnimatorSet 4 | import android.animation.ObjectAnimator 5 | import android.os.Bundle 6 | import com.agile.android.leo.mvp.IPresenter 7 | import com.android.leo.base.ui.fragments.BaseFragment 8 | import com.leo.elegant.trunk.R 9 | import com.leo.elegant.trunk.activity.MainActivity 10 | import com.trello.rxlifecycle2.android.FragmentEvent 11 | import io.reactivex.Observable 12 | import kotlinx.android.synthetic.main.fragment_splash.* 13 | import java.util.concurrent.TimeUnit 14 | 15 | class SplashFragment : BaseFragment() { 16 | override fun getLayoutId(): Int { 17 | return R.layout.fragment_splash 18 | } 19 | 20 | override fun initPresenter() { 21 | } 22 | 23 | override fun configViews() { 24 | val animator_x = ObjectAnimator.ofFloat(splash_im, "scaleX", 1.0f, 1.1f) 25 | val animator_y = ObjectAnimator.ofFloat(splash_im, "scaleY", 1.0f, 1.1f) 26 | val animorSet = AnimatorSet() 27 | animorSet.duration = 1500; 28 | animorSet.play(animator_x).with(animator_y); 29 | animorSet.start(); 30 | } 31 | 32 | override fun initData(savedInstanceState: Bundle?) { 33 | } 34 | 35 | override fun requestData() { 36 | addDispose(Observable.timer(1500, TimeUnit.MILLISECONDS).compose(bindUntilEvent(FragmentEvent.DESTROY)) 37 | .subscribe({ 38 | startActivity(MainActivity::class.java) 39 | activity?.finish() 40 | })) 41 | } 42 | } -------------------------------------------------------------------------------- /trunk/src/main/res/drawable-nodpi/landing_background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/trunk/src/main/res/drawable-nodpi/landing_background.jpg -------------------------------------------------------------------------------- /trunk/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /trunk/src/main/res/layout/fragment_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 13 | 20 | 28 | 36 | 37 | -------------------------------------------------------------------------------- /trunk/src/main/res/layout/item_splash_video.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 22 | 23 | 33 | -------------------------------------------------------------------------------- /trunk/src/main/res/mipmap-xhdpi/ic_discovery_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/trunk/src/main/res/mipmap-xhdpi/ic_discovery_normal.png -------------------------------------------------------------------------------- /trunk/src/main/res/mipmap-xhdpi/ic_discovery_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/trunk/src/main/res/mipmap-xhdpi/ic_discovery_selected.png -------------------------------------------------------------------------------- /trunk/src/main/res/mipmap-xhdpi/ic_home_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/trunk/src/main/res/mipmap-xhdpi/ic_home_normal.png -------------------------------------------------------------------------------- /trunk/src/main/res/mipmap-xhdpi/ic_home_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/trunk/src/main/res/mipmap-xhdpi/ic_home_selected.png -------------------------------------------------------------------------------- /trunk/src/main/res/mipmap-xhdpi/ic_hot_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/trunk/src/main/res/mipmap-xhdpi/ic_hot_normal.png -------------------------------------------------------------------------------- /trunk/src/main/res/mipmap-xhdpi/ic_hot_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/trunk/src/main/res/mipmap-xhdpi/ic_hot_selected.png -------------------------------------------------------------------------------- /trunk/src/main/res/mipmap-xhdpi/ic_icon_guide_detail_slide_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/trunk/src/main/res/mipmap-xhdpi/ic_icon_guide_detail_slide_up.png -------------------------------------------------------------------------------- /trunk/src/main/res/mipmap-xhdpi/ic_mine_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/trunk/src/main/res/mipmap-xhdpi/ic_mine_normal.png -------------------------------------------------------------------------------- /trunk/src/main/res/mipmap-xhdpi/ic_mine_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/trunk/src/main/res/mipmap-xhdpi/ic_mine_selected.png -------------------------------------------------------------------------------- /trunk/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/trunk/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /trunk/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /trunk/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ElegantEyepetizer 3 | 每日编辑精选,一如既往 4 | Daily appetizers for your eyes,as always 5 | 关注越多,发现越多 6 | Subscribe more,discover a whole lot more 7 | 离线自动缓存,精彩永不下线 8 | Off-line automatically replaced, wonderful never offline 9 | 登录即可订阅、评论和同步已收藏视频 10 | Sign in to subscribe, comment and sync to bookmark video 11 | 12 | 每日精选视频推介,让你大开眼界 13 | Daily appetizers for your eyes, Bon eye 14 | 15 | 16 | 网络不给力啊 17 | 18 | 19 | transition_reveal 20 | 帮你找到感兴趣的视频 21 | 输入标题或描述中的关键词找到更多视频 22 | - 热门搜索词 - 23 | -「%1$s」搜索结果共%2$d个- 24 | 25 | 缓存 26 | 27 | + 关注 28 | - The End 29 | 30 | -------------------------------------------------------------------------------- /trunk/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /trunk/src/test/java/com/leo/elegant/trunk/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.leo.elegant.trunk 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /video_player/.gitignore: -------------------------------------------------------------------------------- 1 | #Android generated 2 | bin 3 | gen 4 | lint.xml 5 | version.properties 6 | 7 | #Eclipse 8 | .project 9 | .classpath 10 | .settings 11 | .checkstyle 12 | 13 | #IntelliJ IDEA 14 | .idea 15 | .svn 16 | *.iml 17 | *.ipr 18 | *.iws 19 | classes 20 | gen-external-apklibs 21 | 22 | #Maven 23 | target 24 | release.properties 25 | pom.xml.* 26 | 27 | #Ant 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | #Other 34 | .DS_Store 35 | dist/ 36 | tmp 37 | 38 | # Gradle 39 | .gradle 40 | /build 41 | /out 42 | 43 | -------------------------------------------------------------------------------- /video_player/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-kapt' 4 | android { 5 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 6 | defaultConfig { 7 | minSdkVersion rootProject.ext.android.minSdkVersion 8 | targetSdkVersion rootProject.ext.android.targetSdkVersion 9 | versionCode rootProject.ext.android.versionCode 10 | versionName rootProject.ext.android.versionName 11 | } 12 | sourceSets { 13 | main { 14 | jniLibs.srcDirs = ['libs'] 15 | } 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | buildConfigField "boolean", "LOG_DEBUG", "false" 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | debug { 24 | // 显示Log 25 | buildConfigField "boolean", "LOG_DEBUG", "true" 26 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 27 | } 28 | } 29 | 30 | 31 | } 32 | 33 | dependencies { 34 | implementation fileTree(dir: 'libs', include: ['*.jar']) 35 | api rootProject.ext.dependencies["annotations"] 36 | //Ijkplayer 37 | api 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8' 38 | // api 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.8' 39 | api rootProject.ext.dependencies["videoCache"] 40 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 41 | } 42 | -------------------------------------------------------------------------------- /video_player/libs/armeabi-v7a/libijkffmpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/video_player/libs/armeabi-v7a/libijkffmpeg.so -------------------------------------------------------------------------------- /video_player/libs/armeabi-v7a/libijkplayer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/video_player/libs/armeabi-v7a/libijkplayer.so -------------------------------------------------------------------------------- /video_player/libs/armeabi-v7a/libijksdl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/video_player/libs/armeabi-v7a/libijksdl.so -------------------------------------------------------------------------------- /video_player/libs/x86/libijkffmpeg.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/video_player/libs/x86/libijkffmpeg.so -------------------------------------------------------------------------------- /video_player/libs/x86/libijkplayer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/video_player/libs/x86/libijkplayer.so -------------------------------------------------------------------------------- /video_player/libs/x86/libijksdl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglg/ElegantEyepetizer/f4e92f036cdff6254cda7896552c2c6e9ca6ccef/video_player/libs/x86/libijksdl.so -------------------------------------------------------------------------------- /video_player/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /video_player/src/androidTest/java/com/leo/android/videoplayer/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.leo.android.videoplayer; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.leo.android.videplayer.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /video_player/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /video_player/src/main/java/com/leo/android/videoplayer/SimpleMediaPlayerListener.kt: -------------------------------------------------------------------------------- 1 | package com.leo.android.videoplayer 2 | 3 | import android.net.Uri 4 | import com.leo.android.videoplayer.core.IMediaPlayerListener 5 | 6 | open class SimpleMediaPlayerListener : IMediaPlayerListener { 7 | override fun onBufferingUpdate(percent: Int) { 8 | } 9 | 10 | override fun onCompletion() { 11 | } 12 | 13 | override fun onError(what: Int, extra: Int, msg: String?) { 14 | } 15 | 16 | override fun onFirstFrameStart() { 17 | } 18 | 19 | override fun onPrepared() { 20 | } 21 | 22 | override fun updatePlayDuration(currentDuration: Long, videoDuration: Long) { 23 | } 24 | 25 | override fun startPrepare(uri: Uri?) { 26 | } 27 | 28 | override fun stopPlayer(isPlayComplete: Boolean) { 29 | } 30 | 31 | override fun onInfo(what: Int, extra: Int) { 32 | } 33 | 34 | override fun onLoadProgress(progress: Int) { 35 | } 36 | 37 | override fun onLoadStart() { 38 | } 39 | 40 | override fun onLoadEnd() { 41 | } 42 | 43 | override fun onFullScreenChange(isFullScreen: Boolean) { 44 | } 45 | } -------------------------------------------------------------------------------- /video_player/src/main/java/com/leo/android/videoplayer/core/BaseVideoController.kt: -------------------------------------------------------------------------------- 1 | package com.leo.android.videoplayer.core 2 | 3 | import android.content.Context 4 | import android.util.AttributeSet 5 | import android.widget.FrameLayout 6 | 7 | /** 8 | * 控制View层 9 | */ 10 | abstract class BaseVideoController(context: Context, attrs: AttributeSet?) : FrameLayout(context, attrs), IMediaPlayerListener { 11 | 12 | 13 | open var videoControl: IMediaPlayerControl? = null 14 | 15 | open fun setMediaControl(player: IMediaPlayerControl) { 16 | player.attachMediaControl(this) 17 | } 18 | 19 | /** 20 | * 重置状态 21 | */ 22 | abstract fun resetView() 23 | } -------------------------------------------------------------------------------- /video_player/src/main/java/com/leo/android/videoplayer/core/IMediaIntercept.kt: -------------------------------------------------------------------------------- 1 | package com.leo.android.videoplayer.core 2 | 3 | import android.net.Uri 4 | import android.view.ViewGroup 5 | 6 | interface IMediaIntercept { 7 | /** 8 | * 拦截播放 9 | */ 10 | fun interceptPlay(uri: Uri): Boolean 11 | 12 | fun interceptAttachView(): ViewGroup? 13 | } -------------------------------------------------------------------------------- /video_player/src/main/java/com/leo/android/videoplayer/core/IMediaPlayerControl.java: -------------------------------------------------------------------------------- 1 | package com.leo.android.videoplayer.core; 2 | 3 | 4 | import android.net.Uri; 5 | 6 | /** 7 | * 抽象播放控制层,播放器实现 8 | * User: wanglg 9 | * Date: 2016-04-14 10 | * Time: 11:33 11 | * FIXME 12 | */ 13 | public interface IMediaPlayerControl { 14 | 15 | void start(); 16 | 17 | void pause(); 18 | 19 | void stop(); 20 | 21 | void reset(); 22 | 23 | void release(); 24 | 25 | boolean isPlaying(); 26 | 27 | boolean isPlayComplete(); 28 | 29 | long getDuration(); 30 | 31 | long getCurrentPosition(); 32 | 33 | void seekTo(long pos); 34 | 35 | /** 36 | * 静音 37 | * 38 | * @param isMute 39 | */ 40 | void setMute(boolean isMute); 41 | 42 | void play(Uri videoUri, Long position); 43 | 44 | void play(); 45 | 46 | void play(Uri videoUri); 47 | 48 | void preLoad(Uri videoUri); 49 | 50 | int getBufferPercentage(); 51 | 52 | boolean isFullScreen(); 53 | 54 | void toggleFullScreen(); 55 | 56 | /** 57 | * 设置是否锁定屏幕 58 | * 59 | * @param isLocked true 锁定屏幕,禁止自动旋转 false otherwise 60 | */ 61 | void setLock(boolean isLocked); 62 | 63 | boolean getLockState(); 64 | 65 | /** 66 | * @param baseVideoController 67 | */ 68 | void attachMediaControl(BaseVideoController baseVideoController); 69 | 70 | /** 71 | * detach 控制view 72 | */ 73 | void detachMediaControl(); 74 | 75 | void addMediaPlayerListener(IMediaPlayerListener iMediaPlayerListener); 76 | 77 | void setMediaIntercept(IMediaIntercept mediaIntercept); 78 | 79 | } 80 | -------------------------------------------------------------------------------- /video_player/src/main/java/com/leo/android/videoplayer/core/IMediaPlayerListener.java: -------------------------------------------------------------------------------- 1 | package com.leo.android.videoplayer.core; 2 | 3 | 4 | import android.net.Uri; 5 | 6 | /** 7 | * User: wanglg 8 | * Date: 2016-04-12 9 | * Time: 16:20 10 | * FIXME 11 | */ 12 | public interface IMediaPlayerListener { 13 | 14 | void onBufferingUpdate(int percent); 15 | 16 | void onCompletion(); 17 | 18 | void onError(int what, int extra, String msg); 19 | 20 | void onFirstFrameStart(); 21 | 22 | void onPrepared(); 23 | 24 | void updatePlayDuration(long currentDuration, long videoDuration); 25 | 26 | void startPrepare(Uri uri); 27 | 28 | void stopPlayer(boolean isPlayComplete); 29 | 30 | void onInfo(int what, int extra); 31 | 32 | void onLoadProgress(int progress); 33 | 34 | void onLoadStart(); 35 | 36 | void onLoadEnd(); 37 | 38 | /** 39 | * @param isFullScreen true进入全屏 false otherwise 40 | */ 41 | void onFullScreenChange(boolean isFullScreen); 42 | } 43 | -------------------------------------------------------------------------------- /video_player/src/main/java/com/leo/android/videoplayer/utils/LogUtils.kt: -------------------------------------------------------------------------------- 1 | package com.leo.android.videoplayer.utils 2 | 3 | import android.util.Log 4 | import com.leo.android.videoplayer.BuildConfig 5 | 6 | 7 | object LogUtils { 8 | private var isPrintLog = BuildConfig.LOG_DEBUG 9 | private var TAG: String = "LEO" 10 | 11 | 12 | fun d(tag: String, msg: String) { 13 | if (isPrintLog) { 14 | Log.d(tag, msg) 15 | } 16 | } 17 | 18 | 19 | fun d(msg: String) { 20 | if (isPrintLog) { 21 | Log.d(TAG, msg) 22 | } 23 | } 24 | 25 | fun i(tag: String, msg: String) { 26 | if (isPrintLog) { 27 | Log.i(tag, msg) 28 | } 29 | } 30 | 31 | fun e(tag: String, msg: String) { 32 | if (isPrintLog) { 33 | Log.e(tag, msg) 34 | } 35 | } 36 | 37 | fun e(msg: String) { 38 | if (isPrintLog) { 39 | Log.e(TAG, msg) 40 | } 41 | } 42 | 43 | fun v(tag: String, msg: String) { 44 | if (isPrintLog) { 45 | Log.v(tag, msg) 46 | } 47 | } 48 | 49 | fun w(tag: String, msg: String) { 50 | if (isPrintLog) { 51 | Log.w(tag, msg) 52 | } 53 | } 54 | 55 | fun w(msg: String) { 56 | if (isPrintLog) { 57 | Log.w(TAG, msg) 58 | } 59 | } 60 | 61 | 62 | } 63 | -------------------------------------------------------------------------------- /video_player/src/main/java/com/leo/android/videoplayer/utils/VideoUrlUtils.kt: -------------------------------------------------------------------------------- 1 | package com.leo.android.videoplayer.utils 2 | 3 | import android.net.Uri 4 | import android.text.TextUtils 5 | 6 | object VideoUrlUtils { 7 | fun convertRemoteUrl(videoPath: String): Uri { 8 | return Uri.parse("common://" + "remote?path=" + Uri.encode(videoPath)) 9 | } 10 | 11 | fun convertUrlToString(uri: Uri): String { 12 | var path = "" 13 | val scheme = uri.scheme; 14 | if (TextUtils.equals(scheme, "common")) { 15 | val host = uri.host 16 | if (TextUtils.equals("remote", host)) { 17 | val videoPath = uri.getQueryParameter("path") 18 | if (!TextUtils.isEmpty(videoPath)) { 19 | path = videoPath as String 20 | } 21 | } 22 | } 23 | return path 24 | } 25 | 26 | fun convertAssertUrl(videoPath: String): Uri { 27 | return Uri.parse("common://" + "assert?path=" + videoPath) 28 | } 29 | } -------------------------------------------------------------------------------- /video_player/src/main/res/layout/layout_ijk_video_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | -------------------------------------------------------------------------------- /video_player/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /video_player/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | video_player 3 | 4 | -------------------------------------------------------------------------------- /video_player/src/test/java/com/leo/android/videoplayer/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.leo.android.videoplayer; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } --------------------------------------------------------------------------------