Ver Fonte

优化了网络状态变化后广播监听事件

yangchong211 há 6 anos atrás
pai
commit
66f42b4799
85 ficheiros alterados com 721 adições e 5625 exclusões
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 2 2
      .idea/markdown-navigator.xml
  3. 5 15
      README.md
  4. 1 1
      YCVideoPlayerLib/build.gradle
  5. 17 1
      YCVideoPlayerLib/src/main/AndroidManifest.xml
  6. 28 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/constant/ConstantKeys.java
  7. 23 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/controller/AbsVideoPlayerController.java
  8. 60 72
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/controller/VideoPlayerController.java
  9. 15 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/dialog/ChangeClarityDialog.java
  10. 15 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/dialog/VideoClarity.java
  11. 15 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnClarityChangedListener.java
  12. 15 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnCompletedListener.java
  13. 15 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnPlayOrPauseListener.java
  14. 15 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnPlayerTypeListener.java
  15. 15 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnSurfaceListener.java
  16. 15 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnVideoBackListener.java
  17. 15 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnVideoControlListener.java
  18. 15 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/player/InterVideoPlayer.java
  19. 15 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/manager/VideoPlayerManager.java
  20. 33 5
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/player/VideoPlayer.java
  21. 81 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/receiver/BatterReceiver.java
  22. 69 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/receiver/NetChangedReceiver.java
  23. 99 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/utils/NetworkUtils.java
  24. 16 1
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/utils/VideoLogUtil.java
  25. 20 6
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/utils/VideoPlayerUtils.java
  26. 16 0
      YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/view/VideoTextureView.java
  27. 1 3
      app/build.gradle
  28. 1 3
      app/src/main/java/org/yczbj/ycvideoplayer/api/constant/Constant.java
  29. 0 14
      app/src/main/java/org/yczbj/ycvideoplayer/api/constant/ConstantImage.java
  30. 0 66
      app/src/main/java/org/yczbj/ycvideoplayer/api/http/movie/MovieApi.java
  31. 0 58
      app/src/main/java/org/yczbj/ycvideoplayer/api/http/movie/MovieModel.java
  32. 0 56
      app/src/main/java/org/yczbj/ycvideoplayer/api/http/wangyi/WyApi.java
  33. 0 53
      app/src/main/java/org/yczbj/ycvideoplayer/api/http/wangyi/WyModel.java
  34. 0 20
      app/src/main/java/org/yczbj/ycvideoplayer/base/BaseApplication.java
  35. 4 0
      app/src/main/java/org/yczbj/ycvideoplayer/base/BaseDelegateAdapter.java
  36. 1 29
      app/src/main/java/org/yczbj/ycvideoplayer/base/BaseFragmentFactory.java
  37. 0 32
      app/src/main/java/org/yczbj/ycvideoplayer/base/BaseInterceptor.java
  38. 0 242
      app/src/main/java/org/yczbj/ycvideoplayer/db/RealmHelper.java
  39. 0 21
      app/src/main/java/org/yczbj/ycvideoplayer/download/TaskViewHolderImp.java
  40. 0 224
      app/src/main/java/org/yczbj/ycvideoplayer/download/TasksManager.java
  41. 0 75
      app/src/main/java/org/yczbj/ycvideoplayer/download/TasksManagerDBController.java
  42. 0 52
      app/src/main/java/org/yczbj/ycvideoplayer/download/TasksManagerDBOpenHelper.java
  43. 0 68
      app/src/main/java/org/yczbj/ycvideoplayer/download/TasksManagerModel.java
  44. 0 10
      app/src/main/java/org/yczbj/ycvideoplayer/model/exception/ApiException.java
  45. 0 66
      app/src/main/java/org/yczbj/ycvideoplayer/model/realm/Collection.java
  46. 0 49
      app/src/main/java/org/yczbj/ycvideoplayer/model/realm/Record.java
  47. 0 21
      app/src/main/java/org/yczbj/ycvideoplayer/model/realm/SearchKey.java
  48. 1 0
      app/src/main/java/org/yczbj/ycvideoplayer/ui/home/contract/VideoPlayerJzContract.java
  49. 0 79
      app/src/main/java/org/yczbj/ycvideoplayer/ui/home/view/activity/VideoPlayerJzActivity.java
  50. 0 446
      app/src/main/java/org/yczbj/ycvideoplayer/ui/home/view/adapter/DownloadVideoAdapter.java
  51. 42 1
      app/src/main/java/org/yczbj/ycvideoplayer/ui/home/view/fragment/HomeFragment.java
  52. 2 33
      app/src/main/java/org/yczbj/ycvideoplayer/ui/main/view/activity/MainActivity.java
  53. 0 29
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/contract/MovieContract.java
  54. 0 29
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/contract/MovieDetailContract.java
  55. 0 356
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/model/MovieBean.java
  56. 0 586
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/model/MovieDetailBean.java
  57. 0 68
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/presenter/MovieDetailPresenter.java
  58. 0 92
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/presenter/MoviePresenter.java
  59. 0 363
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/activity/MovieDetailActivity.java
  60. 0 68
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/activity/MovieNewsActivity.java
  61. 0 62
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/adapter/MovieAdapter.java
  62. 0 54
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/adapter/MovieBannerAdapter.java
  63. 0 68
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/adapter/MovieDetailAdapter.java
  64. 0 40
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/adapter/MovieNewsAdapter.java
  65. 0 351
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/fragment/MovieFragment.java
  66. 0 114
      app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/fragment/MovieNewsFragment.java
  67. 0 43
      app/src/main/java/org/yczbj/ycvideoplayer/ui/news/view/adapter/NewsArticleAdapter.java
  68. 1 1
      app/src/main/java/org/yczbj/ycvideoplayer/ui/news/view/fragment/NewsFragment.java
  69. 0 344
      app/src/main/java/org/yczbj/ycvideoplayer/ui/special/SpecialFragment.java
  70. 0 28
      app/src/main/java/org/yczbj/ycvideoplayer/ui/special/contract/SpecialContract.java
  71. 0 62
      app/src/main/java/org/yczbj/ycvideoplayer/ui/special/model/SpecialBean.java
  72. 0 57
      app/src/main/java/org/yczbj/ycvideoplayer/ui/special/presenter/SpecialPresenter.java
  73. 0 41
      app/src/main/java/org/yczbj/ycvideoplayer/ui/special/view/SpecialAdapter.java
  74. 2 9
      app/src/main/java/org/yczbj/ycvideoplayer/ui/video/view/adapter/VideoArticleAdapter.java
  75. 0 76
      app/src/main/java/org/yczbj/ycvideoplayer/util/ImageCropUtils.java
  76. 0 227
      app/src/main/java/org/yczbj/ycvideoplayer/util/OkHttpUtils.java
  77. 0 226
      app/src/main/java/org/yczbj/ycvideoplayer/util/ScreenCaptureUtils.java
  78. 0 117
      app/src/main/java/org/yczbj/ycvideoplayer/util/animation/AnimationViewUtil.java
  79. 0 179
      app/src/main/java/org/yczbj/ycvideoplayer/util/animation/AnimationsUtils.java
  80. 0 105
      app/src/main/java/org/yczbj/ycvideoplayer/util/animation/AnimatorUtils.java
  81. 14 0
      app/src/main/res/layout/view_vlayout_recycler.xml
  82. 0 3
      app/src/main/res/values/array.xml
  83. 0 3
      build.gradle
  84. 15 0
      read/wiki4.md
  85. 2 0
      read/wiki5.md

BIN
.idea/caches/build_file_checksums.ser


+ 2 - 2
.idea/markdown-navigator.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="MarkdownProjectSettings" wasCopied="false">
+  <component name="MarkdownProjectSettings" wasCopied="true">
     <PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="false" showSelectionInPreview="true" openRemoteLinks="true" replaceUnicodeEmoji="false" lastLayoutSetsDefault="false">
       <PanelProvider>
         <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
@@ -62,7 +62,7 @@
       <bodyTop />
       <bodyBottom />
     </HtmlSettings>
-    <CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssUriSerial="true" isCssTextEnabled="false" isDynamicPageWidth="true">
+    <CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssUriSerial="false" isCssTextEnabled="false" isDynamicPageWidth="true">
       <StylesheetProvider>
         <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
       </StylesheetProvider>

+ 5 - 15
README.md

@@ -243,20 +243,8 @@
 
 
 ### 5.运行的效果展示
-![image](http://p2mqszpjf.bkt.clouddn.com/ycVideoPlayer2.png)
-![image](http://p0u62g00n.bkt.clouddn.com/Screenshot_2018-01-05-13-21-49.jpg)
-![image](http://p2mqszpjf.bkt.clouddn.com/Screenshot_2018-01-16-11-22-43.jpg)
-![image](http://p2mqszpjf.bkt.clouddn.com/Screenshot_2018-01-16-11-24-31.jpg)
-![image](http://p2mqszpjf.bkt.clouddn.com/Screenshot_20180116-113446.png)
-![image](http://p2mqszpjf.bkt.clouddn.com/Screenshot_20180116-113706.png)
-![image](http://p2mqszpjf.bkt.clouddn.com/Screenshot_20180116-113721.png)
-![image](http://p2mqszpjf.bkt.clouddn.com/Screenshot_20180116-113732.png)
-![image](http://p2mqszpjf.bkt.clouddn.com/Screenshot_20180116-113802.png)
-![image](http://p2mqszpjf.bkt.clouddn.com/Screenshot_20180116-113840.png)
-![image](http://p2mqszpjf.bkt.clouddn.com/Screenshot_20180116-135824.png)
-![image](https://upload-images.jianshu.io/upload_images/4432347-c2b61a83c1aaecba.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
-![image](https://upload-images.jianshu.io/upload_images/4432347-f4776dfc42c94ebd.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
-![image](https://upload-images.jianshu.io/upload_images/4432347-1b5870de5a3d3318.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
+
+
 
 
 ### 6.版本更新说明
@@ -334,11 +322,13 @@
 
 #### 8.2 关于LICENSE
 ```
+Copyright 2017 yangchong211(github.com/yangchong211)
+
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
-   http://www.apache.org/licenses/LICENSE-2.0
+http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,

+ 1 - 1
YCVideoPlayerLib/build.gradle

@@ -48,7 +48,7 @@ group = "cn.yc"
 //发布到JCenter上的项目名字,必须填写
 def libName = "YCVideoPlayerLib"
 // 版本号,下次更新是只需要更改版本号即可
-version = "2.6.4"
+version = "2.6.6"
 /**  上面配置后上传至jcenter后的编译路径是这样的: compile 'cn.yc:YCVideoPlayerLib:2.4'  **/
 
 //生成源文件

+ 17 - 1
YCVideoPlayerLib/src/main/AndroidManifest.xml

@@ -1,2 +1,18 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="org.yczbj.ycvideoplayerlib" />
+    xmlns:tools="http://schemas.android.com/tools"
+    package="org.yczbj.ycvideoplayerlib" >
+
+
+    <!--监听网络状态变化需要的权限-->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+
+    <application>
+        <receiver android:name=".receiver.BatterReceiver"/>
+        <receiver android:name=".receiver.NetChangedReceiver">
+            <intent-filter>
+                <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
+            </intent-filter>
+        </receiver>
+    </application>
+
+</manifest>

+ 28 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/constant/ConstantKeys.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.constant;
 
 import android.support.annotation.IntDef;
@@ -113,5 +128,18 @@ public final class ConstantKeys {
     @Retention(RetentionPolicy.SOURCE)
     public @interface LoadingType{}
 
+    /**
+     * 电量状态
+     */
+    @Retention(RetentionPolicy.SOURCE)
+    public @interface BatterMode {
+        int BATTERY_CHARGING = 80;
+        int BATTERY_FULL = 81;
+        int BATTERY_10 = 82;
+        int BATTERY_20 = 83;
+        int BATTERY_50 = 84;
+        int BATTERY_80 = 85;
+        int BATTERY_100 = 86;
+    }
 
 }

+ 23 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/controller/AbsVideoPlayerController.java

@@ -1,5 +1,21 @@
 package org.yczbj.ycvideoplayerlib.controller;
 
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
 import android.content.Context;
 import android.support.annotation.DrawableRes;
 import android.view.MotionEvent;
@@ -166,6 +182,13 @@ public abstract class AbsVideoPlayerController extends FrameLayout implements Vi
     public abstract void destroy();
 
 
+    /**
+     * 当电量发生变化的时候,在此方法中国你更新不同的电量状态的UI
+     *
+     * @param batterState 电量状态
+     */
+    public abstract void onBatterStateChanged(int batterState);
+
     /**
      * 当正在缓冲或者播放准备中状态时,开启缓冲时更新网络加载速度
      */

+ 60 - 72
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/controller/VideoPlayerController.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.controller;
 
 import android.annotation.SuppressLint;
@@ -28,6 +43,8 @@ import org.yczbj.ycvideoplayerlib.dialog.ChangeClarityDialog;
 import org.yczbj.ycvideoplayerlib.R;
 import org.yczbj.ycvideoplayerlib.dialog.VideoClarity;
 import org.yczbj.ycvideoplayerlib.inter.listener.OnPlayerTypeListener;
+import org.yczbj.ycvideoplayerlib.receiver.BatterReceiver;
+import org.yczbj.ycvideoplayerlib.receiver.NetChangedReceiver;
 import org.yczbj.ycvideoplayerlib.utils.VideoLogUtil;
 import org.yczbj.ycvideoplayerlib.utils.VideoPlayerUtils;
 import org.yczbj.ycvideoplayerlib.constant.ConstantKeys;
@@ -153,76 +170,10 @@ public class VideoPlayerController extends AbsVideoPlayerController implements V
      * 网络变化监听广播,在网络变更时进行对应处理
      */
     private NetChangedReceiver netChangedReceiver;
-    private class NetChangedReceiver extends BroadcastReceiver {
-        private String getConnectionType(int type) {
-            String connType = "";
-            if (type == ConnectivityManager.TYPE_MOBILE) {
-                connType = "3G,4G网络数据";
-            } else if (type == ConnectivityManager.TYPE_WIFI) {
-                connType = "WIFI网络";
-            }
-            return connType;
-        }
-
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            // 监听网络连接,包括wifi和移动数据的打开和关闭,以及连接上可用的连接都会接到监听
-            if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) {
-                //获取联网状态的NetworkInfo对象
-                NetworkInfo info = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
-                if (info != null) {
-                    //如果当前的网络连接成功并且网络连接可用
-                    if (NetworkInfo.State.CONNECTED == info.getState() && info.isAvailable()) {
-                        if (info.getType() == ConnectivityManager.TYPE_WIFI ||
-                                info.getType() == ConnectivityManager.TYPE_MOBILE) {
-                            VideoLogUtil.i(getConnectionType(info.getType()) + "连上");
-                        }
-                    } else {
-                        VideoLogUtil.i(getConnectionType(info.getType()) + "断开");
-                        if(mVideoPlayer.isIdle()){
-                            mVideoPlayer.pause();
-                        }else {
-                            onPlayStateChanged(ConstantKeys.CurrentState.STATE_ERROR);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-
     /**
      * 电池状态即电量变化广播接收器
      */
-    private BroadcastReceiver mBatterReceiver = new BroadcastReceiver() {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, BatteryManager.BATTERY_STATUS_UNKNOWN);
-            if (status == BatteryManager.BATTERY_STATUS_CHARGING) {
-                // 充电中
-                mBattery.setImageResource(R.drawable.battery_charging);
-            } else if (status == BatteryManager.BATTERY_STATUS_FULL) {
-                // 充电完成
-                mBattery.setImageResource(R.drawable.battery_full);
-            } else {
-                int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
-                int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, 0);
-                int percentage = (int) (((float) level / scale) * 100);
-                if (percentage <= 10) {
-                    mBattery.setImageResource(R.drawable.battery_10);
-                } else if (percentage <= 20) {
-                    mBattery.setImageResource(R.drawable.battery_20);
-                } else if (percentage <= 50) {
-                    mBattery.setImageResource(R.drawable.battery_50);
-                } else if (percentage <= 80) {
-                    mBattery.setImageResource(R.drawable.battery_80);
-                } else if (percentage <= 100) {
-                    mBattery.setImageResource(R.drawable.battery_100);
-                }
-            }
-        }
-    };
-
+    private BroadcastReceiver mBatterReceiver;
 
     public VideoPlayerController(Context context) {
         super(context);
@@ -235,7 +186,6 @@ public class VideoPlayerController extends AbsVideoPlayerController implements V
         super.onAttachedToWindow();
     }
 
-
     /**
      * 注意,在view被销毁调用该方法后,手动销毁动画
      */
@@ -289,6 +239,7 @@ public class VideoPlayerController extends AbsVideoPlayerController implements V
      */
     private void registerBatterReceiver() {
         if (!hasRegisterBatteryReceiver) {
+            mBatterReceiver = new BatterReceiver();
             mContext.registerReceiver(mBatterReceiver, new IntentFilter(
                     Intent.ACTION_BATTERY_CHANGED));
             hasRegisterBatteryReceiver = true;
@@ -304,6 +255,7 @@ public class VideoPlayerController extends AbsVideoPlayerController implements V
         if (hasRegisterBatteryReceiver) {
             mContext.unregisterReceiver(mBatterReceiver);
             hasRegisterBatteryReceiver = false;
+            VideoLogUtil.i("解绑电池监听广播");
         }
     }
 
@@ -311,8 +263,7 @@ public class VideoPlayerController extends AbsVideoPlayerController implements V
      * 初始化操作
      */
     private void init() {
-        LayoutInflater.from(mContext).inflate(R.layout.custom_video_player,
-                this, true);
+        LayoutInflater.from(mContext).inflate(R.layout.custom_video_player, this, true);
         initFindViewById();
         initListener();
         registerNetChangedReceiver();
@@ -688,6 +639,7 @@ public class VideoPlayerController extends AbsVideoPlayerController implements V
                 break;
             //正在缓冲(播放器正在播放时,缓冲区数据不足,进行缓冲,缓冲区数据足够后恢复播放)
             case ConstantKeys.CurrentState.STATE_BUFFERING_PLAYING:
+                mError.setVisibility(View.GONE);
                 mLoading.setVisibility(View.VISIBLE);
                 mCenterStart.setVisibility(View.GONE);
                 mRestartPause.setImageResource(R.drawable.ic_player_pause);
@@ -733,6 +685,7 @@ public class VideoPlayerController extends AbsVideoPlayerController implements V
         mLength.setVisibility(View.GONE);
         //开启缓冲时更新网络加载速度
         startUpdateNetSpeedTimer();
+        startUpdateProgressTimer();
     }
 
 
@@ -870,7 +823,6 @@ public class VideoPlayerController extends AbsVideoPlayerController implements V
         cancelUpdateNetSpeedTimer();
     }
 
-
     /**
      * 尽量不要在onClick中直接处理控件的隐藏、显示及各种UI逻辑。
      * UI相关的逻辑都尽量到{@link #onPlayStateChanged}和{@link #onPlayModeChanged}中处理.
@@ -938,8 +890,9 @@ public class VideoPlayerController extends AbsVideoPlayerController implements V
             mClarityDialog.show();
         } else if (v == mRetry) {
             //点击重试
-            //不论是否记录播放位置,都是从零开始播放
             if(VideoPlayerUtils.isConnected(mContext)){
+                startPreparing();
+                //开始从此位置播放
                 mVideoPlayer.restart();
             }else {
                 Toast.makeText(mContext,"请检测是否有网络",Toast.LENGTH_SHORT).show();
@@ -1007,6 +960,40 @@ public class VideoPlayerController extends AbsVideoPlayerController implements V
         }
     }
 
+    /**
+     * 当电量发生变化的时候,在此方法中国你更新不同的电量状态的UI
+     *
+     * @param batterState 电量状态
+     */
+    @Override
+    public void onBatterStateChanged(@ConstantKeys.BatterMode int batterState) {
+        switch (batterState){
+            case ConstantKeys.BatterMode.BATTERY_10:
+                mBattery.setImageResource(R.drawable.battery_10);
+                break;
+            case ConstantKeys.BatterMode.BATTERY_20:
+                mBattery.setImageResource(R.drawable.battery_20);
+                break;
+            case ConstantKeys.BatterMode.BATTERY_50:
+                mBattery.setImageResource(R.drawable.battery_50);
+                break;
+            case ConstantKeys.BatterMode.BATTERY_80:
+                mBattery.setImageResource(R.drawable.battery_80);
+                break;
+            case ConstantKeys.BatterMode.BATTERY_100:
+                mBattery.setImageResource(R.drawable.battery_100);
+                break;
+            case ConstantKeys.BatterMode.BATTERY_FULL:
+                mBattery.setImageResource(R.drawable.battery_full);
+                break;
+            case ConstantKeys.BatterMode.BATTERY_CHARGING:
+                mBattery.setImageResource(R.drawable.battery_charging);
+                break;
+            default:
+                break;
+        }
+    }
+
 
     /**
      * 设置top、bottom的显示和隐藏
@@ -1126,6 +1113,7 @@ public class VideoPlayerController extends AbsVideoPlayerController implements V
         VideoLogUtil.i("获取网络加载速度---------"+tcpSpeed);
     }
 
+
     /**
      * 显示视频播放位置
      * @param duration            视频总时长ms

+ 15 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/dialog/ChangeClarityDialog.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.dialog;
 
 import android.app.Dialog;

+ 15 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/dialog/VideoClarity.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.dialog;
 
 

+ 15 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnClarityChangedListener.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.inter.listener;
 
 

+ 15 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnCompletedListener.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.inter.listener;
 
 

+ 15 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnPlayOrPauseListener.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.inter.listener;
 
 

+ 15 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnPlayerTypeListener.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.inter.listener;
 
 

+ 15 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnSurfaceListener.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.inter.listener;
 
 

+ 15 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnVideoBackListener.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.inter.listener;
 
 

+ 15 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/listener/OnVideoControlListener.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.inter.listener;
 
 

+ 15 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/inter/player/InterVideoPlayer.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.inter.player;
 
 import java.util.Map;

+ 15 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/manager/VideoPlayerManager.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.manager;
 
 

+ 33 - 5
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/player/VideoPlayer.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.player;
 
 import android.content.Context;
@@ -149,7 +164,7 @@ public class VideoPlayer extends FrameLayout implements InterVideoPlayer {
      * @param headers           请求header.
      */
     @Override
-    public void setUp(String url, Map<String, String> headers) {
+    public final void setUp(String url, Map<String, String> headers) {
         if(url==null || url.length()==0){
             VideoLogUtil.d("设置的视频链接不能为空");
         }
@@ -174,6 +189,9 @@ public class VideoPlayer extends FrameLayout implements InterVideoPlayer {
         mContainer.addView(mController, params);
     }
 
+    public AbsVideoPlayerController getController(){
+        return mController;
+    }
 
     /**
      * 设置播放器类型,必须设置
@@ -270,7 +288,8 @@ public class VideoPlayer extends FrameLayout implements InterVideoPlayer {
             mCurrentState = ConstantKeys.CurrentState.STATE_BUFFERING_PLAYING;
             mController.onPlayStateChanged(mCurrentState);
             VideoLogUtil.d("STATE_BUFFERING_PLAYING");
-        } else if (mCurrentState == ConstantKeys.CurrentState.STATE_COMPLETED || mCurrentState == ConstantKeys.CurrentState.STATE_ERROR) {
+        } else if (mCurrentState == ConstantKeys.CurrentState.STATE_COMPLETED
+                || mCurrentState == ConstantKeys.CurrentState.STATE_ERROR) {
             //如果是完成播放或者播放错误,则重新播放
             mMediaPlayer.reset();
             openMediaPlayer();
@@ -751,7 +770,8 @@ public class VideoPlayer extends FrameLayout implements InterVideoPlayer {
     /**
      * 设置视频播放完成监听事件
      */
-    private IMediaPlayer.OnCompletionListener mOnCompletionListener = new IMediaPlayer.OnCompletionListener() {
+    private IMediaPlayer.OnCompletionListener mOnCompletionListener =
+            new IMediaPlayer.OnCompletionListener() {
         @Override
         public void onCompletion(IMediaPlayer mp) {
             mCurrentState = ConstantKeys.CurrentState.STATE_COMPLETED;
@@ -765,17 +785,25 @@ public class VideoPlayer extends FrameLayout implements InterVideoPlayer {
     /**
      * 设置视频缓冲更新监听事件
      */
-    private IMediaPlayer.OnBufferingUpdateListener mOnBufferingUpdateListener = new IMediaPlayer.OnBufferingUpdateListener() {
+    private IMediaPlayer.OnBufferingUpdateListener mOnBufferingUpdateListener =
+            new IMediaPlayer.OnBufferingUpdateListener() {
+        final int MAX_PERCENT = 97;
         @Override
         public void onBufferingUpdate(IMediaPlayer mp, int percent) {
             mBufferPercentage = percent;
+            //播放完成后再次播放getBufferPercentage获取的值也不准确,94、95,达不到100
+            if (percent>MAX_PERCENT){
+                mBufferPercentage = 100;
+            }
+            VideoLogUtil.d("onBufferingUpdate ——> " + percent);
         }
     };
 
     /**
      * 设置视频seek完成监听事件
      */
-    private IMediaPlayer.OnSeekCompleteListener mOnSeekCompleteListener = new IMediaPlayer.OnSeekCompleteListener() {
+    private IMediaPlayer.OnSeekCompleteListener mOnSeekCompleteListener =
+            new IMediaPlayer.OnSeekCompleteListener() {
         @Override
         public void onSeekComplete(IMediaPlayer iMediaPlayer) {
 

+ 81 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/receiver/BatterReceiver.java

@@ -0,0 +1,81 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package org.yczbj.ycvideoplayerlib.receiver;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.BatteryManager;
+
+import org.yczbj.ycvideoplayerlib.constant.ConstantKeys;
+import org.yczbj.ycvideoplayerlib.controller.AbsVideoPlayerController;
+import org.yczbj.ycvideoplayerlib.manager.VideoPlayerManager;
+import org.yczbj.ycvideoplayerlib.player.VideoPlayer;
+import org.yczbj.ycvideoplayerlib.utils.VideoLogUtil;
+
+/**
+ * <pre>
+ *     @author yangchong
+ *     blog  : https://github.com/yangchong211
+ *     time  : 2017/9/17
+ *     desc  : 电量状态监听广播
+ *     revise:
+ * </pre>
+ */
+public class BatterReceiver extends BroadcastReceiver {
+
+    @Override
+    public void onReceive(Context context, Intent intent) {
+        VideoLogUtil.i("电量状态监听广播接收到数据了");
+        int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS,
+                BatteryManager.BATTERY_STATUS_UNKNOWN);
+        VideoPlayer mVideoPlayer = VideoPlayerManager.instance().getCurrentVideoPlayer();
+        if (mVideoPlayer!=null){
+            AbsVideoPlayerController controller = mVideoPlayer.getController();
+            if (controller!=null){
+                if (status == BatteryManager.BATTERY_STATUS_CHARGING) {
+                    // 充电中
+                    controller.onBatterStateChanged(ConstantKeys.BatterMode.BATTERY_CHARGING);
+                } else if (status == BatteryManager.BATTERY_STATUS_FULL) {
+                    // 充电完成
+                    controller.onBatterStateChanged(ConstantKeys.BatterMode.BATTERY_FULL);
+                } else {
+                    // 当前电量
+                    int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
+                    // 总电量
+                    int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, 0);
+                    int percentage = (int) (((float) level / scale) * 100);
+                    VideoLogUtil.i("广播NetworkReceiver------当前电量"+level);
+                    VideoLogUtil.i("广播NetworkReceiver------总电量"+scale);
+                    VideoLogUtil.i("广播NetworkReceiver------百分比"+percentage);
+                    if (percentage <= 10) {
+                        controller.onBatterStateChanged(ConstantKeys.BatterMode.BATTERY_10);
+                    } else if (percentage <= 20) {
+                        controller.onBatterStateChanged(ConstantKeys.BatterMode.BATTERY_20);
+                    } else if (percentage <= 50) {
+                        controller.onBatterStateChanged(ConstantKeys.BatterMode.BATTERY_50);
+                    } else if (percentage <= 80) {
+                        controller.onBatterStateChanged(ConstantKeys.BatterMode.BATTERY_80);
+                    } else if (percentage <= 100) {
+                        controller.onBatterStateChanged(ConstantKeys.BatterMode.BATTERY_100);
+                    }
+                }
+            }
+        }
+    }
+
+}

+ 69 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/receiver/NetChangedReceiver.java

@@ -0,0 +1,69 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+package org.yczbj.ycvideoplayerlib.receiver;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import org.yczbj.ycvideoplayerlib.constant.ConstantKeys;
+import org.yczbj.ycvideoplayerlib.controller.AbsVideoPlayerController;
+import org.yczbj.ycvideoplayerlib.manager.VideoPlayerManager;
+import org.yczbj.ycvideoplayerlib.player.VideoPlayer;
+import org.yczbj.ycvideoplayerlib.utils.NetworkUtils;
+import org.yczbj.ycvideoplayerlib.utils.VideoLogUtil;
+
+/**
+ * <pre>
+ *     @author yangchong
+ *     blog  : https://github.com/yangchong211
+ *     time  : 2019/5/21
+ *     desc  : 网络状态监听广播
+ *     revise:
+ * </pre>
+ */
+public class NetChangedReceiver extends BroadcastReceiver {
+
+    @Override
+    public void onReceive(Context context, Intent intent) {
+        VideoLogUtil.i("网络状态监听广播接收到数据了");
+        VideoPlayer mVideoPlayer = VideoPlayerManager.instance().getCurrentVideoPlayer();
+        if (mVideoPlayer!=null){
+            AbsVideoPlayerController controller = mVideoPlayer.getController();
+            switch (NetworkUtils.getConnectState(context)) {
+                case MOBILE:
+                    VideoLogUtil.i("当网络状态监听前连接了移动数据");
+                    break;
+                case WIFI:
+                    VideoLogUtil.i("网络状态监听当前连接了Wifi");
+                    break;
+                case UN_CONNECTED:
+                    VideoLogUtil.i("网络状态监听当前没有网络连接");
+                    if (mVideoPlayer.isPlaying() || mVideoPlayer.isBufferingPlaying()) {
+                        VideoLogUtil.i("网络状态监听当前没有网络连接---设置暂停播放");
+                        mVideoPlayer.pause();
+                    }
+                    if (controller!=null){
+                        controller.onPlayStateChanged(ConstantKeys.CurrentState.STATE_ERROR);
+                    }
+                    break;
+                default:
+                    VideoLogUtil.i("网络状态监听其他情况");
+                    break;
+            }
+        }
+    }
+}

+ 99 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/utils/NetworkUtils.java

@@ -0,0 +1,99 @@
+package org.yczbj.ycvideoplayerlib.utils;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.Network;
+import android.net.NetworkInfo;
+import android.os.Build;
+
+/**
+ * <pre>
+ *     @author yangchong
+ *     blog  : https://github.com/yangchong211
+ *     time  : 2019/5/21
+ *     desc  : 网络状态监听工具类
+ *     revise:
+ * </pre>
+ */
+public class NetworkUtils {
+
+
+    /**
+     * 标记当前网络状态,分别是:移动数据、Wifi、未连接、网络状态已公布
+     */
+    public enum State {
+        MOBILE, WIFI, UN_CONNECTED, PUBLISHED
+    }
+
+    /**
+     * 为了避免因多次接收到广播反复提醒的情况而设置的标志位,用于缓存收到新的广播前的网络状态
+     */
+    private static State tempState;
+
+    /**
+     * 获取当前网络连接状态
+     *
+     * @param context Context
+     * @return 网络状态
+     */
+    public static State getConnectState(Context context) {
+        ConnectivityManager manager = (ConnectivityManager) context.
+                getSystemService(Context.CONNECTIVITY_SERVICE);
+        NetworkInfo networkInfo = null;
+        if (manager != null) {
+            networkInfo = manager.getActiveNetworkInfo();
+        }
+        State state = State.UN_CONNECTED;
+        if (networkInfo != null && networkInfo.isAvailable()) {
+            if (isMobileConnected(context)) {
+                state = State.MOBILE;
+            } else if (isWifiConnected(context)) {
+                state = State.WIFI;
+            }
+        }
+        if (state.equals(tempState)) {
+            return State.PUBLISHED;
+        }
+        tempState = state;
+        return state;
+    }
+
+    private static boolean isMobileConnected(Context context) {
+        return isConnected(context, ConnectivityManager.TYPE_MOBILE);
+    }
+
+    private static boolean isWifiConnected(Context context) {
+        return isConnected(context, ConnectivityManager.TYPE_WIFI);
+    }
+
+    private static boolean isConnected(Context context, int type) {
+        //getAllNetworkInfo() 在 API 23 中被弃用
+        //getAllNetworks() 在 API 21 中才添加
+        ConnectivityManager manager = (ConnectivityManager) context.
+                getSystemService(Context.CONNECTIVITY_SERVICE);
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
+            NetworkInfo[] allNetworkInfo = new NetworkInfo[0];
+            if (manager != null) {
+                allNetworkInfo = manager.getAllNetworkInfo();
+            }
+            for (NetworkInfo info : allNetworkInfo) {
+                if (info.getType() == type) {
+                    return info.isAvailable();
+                }
+            }
+        } else {
+            Network[] networks = new Network[0];
+            if (manager != null) {
+                networks = manager.getAllNetworks();
+            }
+            for (Network network : networks) {
+                NetworkInfo networkInfo = manager.getNetworkInfo(network);
+                if (networkInfo.getType() == type) {
+                    return networkInfo.isAvailable();
+                }
+            }
+        }
+        return false;
+    }
+
+}

+ 16 - 1
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/utils/VideoLogUtil.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.utils;
 
 import android.util.Log;
@@ -11,7 +26,7 @@ import android.util.Log;
  *     revise:
  * </pre>
  */
-public class VideoLogUtil {
+public final class VideoLogUtil {
 
     private static final String TAG = "YCVideoPlayer";
     private static boolean isLog = true;

+ 20 - 6
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/utils/VideoPlayerUtils.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
 package org.yczbj.ycvideoplayerlib.utils;
 
 import android.annotation.SuppressLint;
@@ -9,10 +24,8 @@ import android.net.NetworkInfo;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AppCompatActivity;
 import android.support.v7.view.ContextThemeWrapper;
-import android.util.Log;
 import android.util.TypedValue;
 import android.view.WindowManager;
-
 import java.util.Formatter;
 import java.util.Locale;
 
@@ -92,7 +105,8 @@ public final class VideoPlayerUtils {
             ab.setShowHideAnimationEnabled(false);
             ab.hide();
         }
-        scanForActivity(context).getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
+        scanForActivity(context).getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+                WindowManager.LayoutParams.FLAG_FULLSCREEN);
     }
 
     /**
@@ -144,7 +158,7 @@ public final class VideoPlayerUtils {
      * @param context           上下文
      * @param url               视频链接url
      */
-    public static void savePlayPosition(Context context, String url, long position) {
+    public static synchronized void savePlayPosition(Context context, String url, long position) {
         if (context==null){
             return;
         }
@@ -158,7 +172,7 @@ public final class VideoPlayerUtils {
      * @param url               视频链接url
      * @return 上次保存的播放位置
      */
-    public static long getSavedPlayPosition(Context context, String url) {
+    public static synchronized long getSavedPlayPosition(Context context, String url) {
         if (context==null){
             return 0;
         }
@@ -170,7 +184,7 @@ public final class VideoPlayerUtils {
      * 清楚播放位置的痕迹
      * @param context           上下文
      */
-    public static void clearPlayPosition(Context context){
+    public static synchronized void clearPlayPosition(Context context){
         if (context==null){
             return;
         }

+ 16 - 0
YCVideoPlayerLib/src/main/java/org/yczbj/ycvideoplayerlib/view/VideoTextureView.java

@@ -1,3 +1,19 @@
+/*
+Copyright 2017 yangchong211(github.com/yangchong211)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
 package org.yczbj.ycvideoplayerlib.view;
 
 import android.annotation.SuppressLint;

+ 1 - 3
app/build.gradle

@@ -1,5 +1,4 @@
 apply plugin: 'com.android.application'
-apply plugin: 'realm-android'
 
 android {
     compileSdkVersion 28
@@ -92,7 +91,6 @@ dependencies {
         transitive = true
         exclude module: 'support-v4'
     }
-    implementation 'com.liulishuo.filedownloader:library:1.6.9'            //下载框架
     implementation 'com.trello.rxlifecycle2:rxlifecycle:2.2.1'             //RxLifecycle
     implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.2.1'
     implementation 'me.drakeet.multitype:multitype:3.4.0'                  //简化版 Adapter
@@ -106,7 +104,7 @@ dependencies {
     implementation 'cn.yc:YCBaseAdapterLib:1.3'                            //adapter封装
     implementation 'cn.yc:YCDialogLib:3.5'                                 //弹窗
     implementation 'cn.yc:YCProgressLib:1.2'                               //进度条
-    implementation 'cn.yc:YCVideoPlayerLib:2.6.4'                            //播放器
+    implementation 'cn.yc:YCVideoPlayerLib:2.6.6'                            //播放器
 //    implementation project(':YCVideoPlayerLib')
     implementation 'cn.yc:YCStatusBarLib:1.4.0'                              //状态栏
 }

+ 1 - 3
app/src/main/java/org/yczbj/ycvideoplayer/api/constant/Constant.java

@@ -25,11 +25,9 @@ public class Constant {
         int typeList4 = 9;          //list4
         int typeGvBottom = 10;      //九宫格
         int typeList5 = 11;          //list4
+        int typeRecycler = 12;          //list4
     }
 
-    public static final int SLIDABLE_DISABLE = 0;
-    public static final int SLIDABLE_EDGE = 1;
-    public static final int SLIDABLE_FULL = 2;
 
     public static final long CLICK_TIME = 500;
 

+ 0 - 14
app/src/main/java/org/yczbj/ycvideoplayer/api/constant/ConstantImage.java

@@ -1,14 +0,0 @@
-package org.yczbj.ycvideoplayer.api.constant;
-
-public class ConstantImage {
-
-
-    public static String[] homePageConcentration = {
-        "http://sandcolleges.zero2ipo.com.cn/vc-talk-img/1513594514204.png",
-        "http://sandcolleges.zero2ipo.com.cn/vc-talk-img/1514968425896.png",
-        "http://sandcolleges.zero2ipo.com.cn/vc-talk-img/1513595685864.png",
-        "http://sandcolleges.zero2ipo.com.cn/vc-talk-img/1513596366962.png",
-    };
-
-
-}

+ 0 - 66
app/src/main/java/org/yczbj/ycvideoplayer/api/http/movie/MovieApi.java

@@ -1,66 +0,0 @@
-package org.yczbj.ycvideoplayer.api.http.movie;
-
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieBean;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieDetailBean;
-import org.yczbj.ycvideoplayer.ui.video.model.bean.MultiNewsArticleBean;
-import org.yczbj.ycvideoplayer.ui.video.model.bean.VideoContentBean;
-
-import io.reactivex.Observable;
-import retrofit2.http.GET;
-import retrofit2.http.Query;
-import retrofit2.http.Url;
-
-
-public interface MovieApi {
-
-    /**
-     * 首页
-     *
-     * @return
-     */
-    @GET("homePageApi/homePage.do")
-    Observable<MovieBean> getHomePage();
-
-    /**
-     * 影片详情
-     *
-     * @param mediaId 影片id
-     * @return
-     */
-    @GET("videoDetailApi/videoDetail.do")
-    Observable<MovieDetailBean> getVideoInfo(@Query("mediaId") String mediaId);
-
-    /**
-     * 影片分类列表
-     *
-     * @param catalogId
-     * @param pnum
-     * @return
-     */
-    @GET("columns/getVideoList.do")
-    Observable<MovieBean> getVideoList(@Query("catalogId") String catalogId,
-                                                         @Query("pnum") String pnum);
-
-    /**
-     * 影片搜索
-     *
-     * @param pnum
-     * @return
-     */
-    @GET("searchKeyWordApi/getVideoListByKeyWord.do")
-    Observable<MovieBean> getVideoListByKeyWord(@Query("keyword") String keyword,
-                                                                  @Query("pnum") String pnum);
-
-    /**
-     * 获取评论列表
-     * @param mediaId
-     * @param pnum
-     * @return
-     */
-    @GET("Commentary/getCommentList.do")
-    Observable<MovieBean> getCommentList(@Query("mediaId") String mediaId,
-                                                           @Query("pnum") String pnum);
-
-
-
-}

+ 0 - 58
app/src/main/java/org/yczbj/ycvideoplayer/api/http/movie/MovieModel.java

@@ -1,58 +0,0 @@
-package org.yczbj.ycvideoplayer.api.http.movie;
-
-
-import org.yczbj.ycvideoplayer.api.manager.RetrofitWrapper;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieBean;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieDetailBean;
-import org.yczbj.ycvideoplayer.ui.video.model.bean.MultiNewsArticleBean;
-import org.yczbj.ycvideoplayer.ui.video.model.bean.VideoContentBean;
-
-import io.reactivex.Observable;
-
-
-/**
- * Created by PC on 2017/8/21.
- * 作者:PC
- */
-
-public class MovieModel {
-
-    private static MovieModel model;
-    private MovieApi mApiService;
-    private static final String HOST = "http://api.svipmovie.com/front/";
-
-    private MovieModel() {
-        mApiService = RetrofitWrapper
-                .getInstance(HOST)
-                .create(MovieApi.class);
-    }
-
-    public static MovieModel getInstance(){
-        if(model == null) {
-            model = new MovieModel();
-        }
-        return model;
-    }
-
-    public Observable<MovieBean> getHomePage() {
-        return mApiService.getHomePage();
-    }
-
-    public Observable<MovieDetailBean> getVideoInfo(String mediaId) {
-        return mApiService.getVideoInfo(mediaId);
-    }
-
-    public Observable<MovieBean> getVideoList(String catalogId , String pnum) {
-        return mApiService.getVideoList(catalogId,pnum);
-    }
-
-    public Observable<MovieBean> getVideoListByKeyWord(String keyword,String pnum) {
-        return mApiService.getVideoListByKeyWord(keyword,pnum);
-    }
-
-    public Observable<MovieBean> getCommentList(String mediaId , String pnum) {
-        return mApiService.getCommentList(mediaId,pnum);
-    }
-
-
-}

+ 0 - 56
app/src/main/java/org/yczbj/ycvideoplayer/api/http/wangyi/WyApi.java

@@ -1,56 +0,0 @@
-package org.yczbj.ycvideoplayer.api.http.wangyi;
-
-
-import org.yczbj.ycvideoplayer.ui.news.model.bean.NewsCommentBean;
-import org.yczbj.ycvideoplayer.ui.video.model.bean.MultiNewsArticleBean;
-
-import java.util.Map;
-
-import io.reactivex.Observable;
-import okhttp3.ResponseBody;
-import retrofit2.Call;
-import retrofit2.http.FieldMap;
-import retrofit2.http.FormUrlEncoded;
-import retrofit2.http.GET;
-import retrofit2.http.Headers;
-import retrofit2.http.POST;
-import retrofit2.http.Query;
-
-/**
- * 参考 : https://github.com/hrscy/TodayNews/blob/master/news.json
- */
-
-public interface WyApi {
-
-
-    @GET("api/channelInfo?platformType=androidPhone&adapterNo=7.0.0&pid=&recommendNo=3,2&positionId=&pageSize=20&protocol=1.0.0")
-    Observable<String> getTabs();
-
-    @GET("api/homePageList?platformType=androidPhone&isNotModified=0&adapterNo=7.0.0&protocol=1.0.0")
-    Observable<String> refreshVideos(@Query("channelId") int tabId,
-                                     @Query("pageSize") int pageSize,
-                                     @Query("requireTime") String requireTime);
-
-    @GET("api/homePageList?platformType=androidPhone&isNotModified=0&adapterNo=7.0.0&protocol=1.0.0")
-    Observable<String> loadMoreVideos(@Query("channelId") int tabId,
-                                      @Query("pageSize") int pageSize,
-                                      @Query("positionId") String positionId);
-
-    /**
-     * 网易视频
-     */
-    @GET("recommend/getChanListNews?channel=T1457068979049&fn=3&passport=h3o88AuDhdH7tlyrE3hlILX2WMCoMqapk08GhEzPqX4%3D&devId=DWT861zlolJo7mHnyynnGA%3D%3D&version=15.0&net=wifi&ts=1474185450&sign=JmMhXTnPo%2BqgTgwyxKstDgS9lmS5Pv%2BUCP5tZ%2FrWevV48ErR02zJ6%2FKXOnxX046I&encryption=1")
-    Observable<String> getVideos(@Query("size") int size, @Query("offset") int offset);
-
-
-    /**
-     * 头条快报视频
-     * http://video.toutiaokuaibao.com/app_video/getvideos
-     */
-    @Headers({/*"Content-Type: application/x-www-form-urlencoded;charset=UTF-8",*/
-            "Accept-Encoding: gzip",
-            "User-Agent: okhttp/3.2.0"})
-    @FormUrlEncoded
-    @POST("app_video/getvideos")
-    Observable<String> getVideos(@FieldMap Map<String, String> fieldMap);
-}

+ 0 - 53
app/src/main/java/org/yczbj/ycvideoplayer/api/http/wangyi/WyModel.java

@@ -1,53 +0,0 @@
-package org.yczbj.ycvideoplayer.api.http.wangyi;
-
-
-import org.yczbj.ycvideoplayer.api.manager.RetrofitWrapper;
-import org.yczbj.ycvideoplayer.ui.video.model.bean.MultiNewsArticleBean;
-
-import io.reactivex.Observable;
-
-
-/**
- * Created by PC on 2017/8/21.
- * 作者:PC
- */
-
-public class WyModel {
-
-    private static WyModel model;
-    private WyApi mApiService;
-    private static final String NETEASY_BASE_URL = "http://c.m.163.com/";
-    private static final String TTKB_BASE_URL = "http://video.toutiaokuaibao.com/";
-    private static final String IFENG_BASE_URL = "http://vcis.ifeng.com/";
-
-    private WyModel(int type) {
-        switch (type){
-            case 1:
-                mApiService = RetrofitWrapper
-                        .getInstance(NETEASY_BASE_URL)
-                        .create(WyApi.class);
-                break;
-            case 2:
-                mApiService = RetrofitWrapper
-                        .getInstance(TTKB_BASE_URL)
-                        .create(WyApi.class);
-                break;
-            case 3:
-                mApiService = RetrofitWrapper
-                        .getInstance(IFENG_BASE_URL)
-                        .create(WyApi.class);
-                break;
-            default:
-                break;
-        }
-    }
-
-    public static WyModel getInstance(int type){
-        if(model == null) {
-            model = new WyModel(type);
-        }
-        return model;
-    }
-
-
-}

+ 0 - 20
app/src/main/java/org/yczbj/ycvideoplayer/base/BaseApplication.java

@@ -7,8 +7,6 @@ import android.support.multidex.MultiDex;
 import android.util.Log;
 
 import com.blankj.utilcode.util.Utils;
-import com.liulishuo.filedownloader.FileDownloader;
-import com.liulishuo.filedownloader.connection.FileDownloadUrlConnection;
 
 import org.yczbj.ycvideoplayer.BuildConfig;
 import org.yczbj.ycvideoplayer.util.LogUtils;
@@ -69,7 +67,6 @@ public class BaseApplication extends Application {
         }else {
             VideoLogUtil.setIsLog(false);
         }
-        initDownLoadLib();
     }
 
     /**
@@ -121,23 +118,6 @@ public class BaseApplication extends Application {
     }
 
 
-    /**
-     * 初始化下载库
-     */
-    private void initDownLoadLib() {
-        FileDownloader.setupOnApplicationOnCreate(BaseApplication.getInstance())
-                .connectionCreator(new FileDownloadUrlConnection
-                        .Creator(new FileDownloadUrlConnection.Configuration()
-                        .connectTimeout(15_000)
-                        .readTimeout(15_000)
-                        .proxy(Proxy.NO_PROXY)
-                ))
-                .commit();
-        //最简单的初始化
-        //FileDownloader.setup(instance);
-    }
-
-
 }
 
 

+ 4 - 0
app/src/main/java/org/yczbj/ycvideoplayer/base/BaseDelegateAdapter.java

@@ -34,6 +34,10 @@ public class BaseDelegateAdapter extends DelegateAdapter.Adapter<BaseViewHolder>
         this.mViewTypeItem = viewTypeItem;
     }
 
+    public void setData(){
+
+    }
+
     @Override
     public LayoutHelper onCreateLayoutHelper() {
         return mLayoutHelper;

+ 1 - 29
app/src/main/java/org/yczbj/ycvideoplayer/base/BaseFragmentFactory.java

@@ -1,11 +1,9 @@
 package org.yczbj.ycvideoplayer.base;
 
-import org.yczbj.ycvideoplayer.ui.movie.view.fragment.MovieFragment;
-import org.yczbj.ycvideoplayer.ui.news.NewsFragment;
+import org.yczbj.ycvideoplayer.ui.news.view.fragment.NewsFragment;
 import org.yczbj.ycvideoplayer.ui.video.view.fragment.VideoFragment;
 import org.yczbj.ycvideoplayer.ui.home.view.fragment.HomeFragment;
 import org.yczbj.ycvideoplayer.ui.person.MeFragment;
-import org.yczbj.ycvideoplayer.ui.special.SpecialFragment;
 
 
 /**
@@ -23,8 +21,6 @@ public class BaseFragmentFactory {
     private static BaseFragmentFactory mInstance;
     private HomeFragment mHomeFragment;
     private NewsFragment mNewsFragment;
-    private MovieFragment mMovieFragment;
-    private SpecialFragment mSpecialFragment;
     private VideoFragment mVideoFragment;
     private MeFragment mMeFragment;
 
@@ -64,30 +60,6 @@ public class BaseFragmentFactory {
         return mNewsFragment;
     }
 
-    public MovieFragment getMovieFragment() {
-        if (mMovieFragment == null) {
-            synchronized (BaseFragmentFactory.class) {
-                if (mMovieFragment == null) {
-                    mMovieFragment = new MovieFragment();
-                }
-            }
-        }
-        return mMovieFragment;
-    }
-
-
-    public SpecialFragment getSpecialFragment() {
-        if (mSpecialFragment == null) {
-            synchronized (BaseFragmentFactory.class) {
-                if (mSpecialFragment == null) {
-                    mSpecialFragment = new SpecialFragment();
-                }
-            }
-        }
-        return mSpecialFragment;
-    }
-
-
     public VideoFragment getVideoFragment() {
         if (mVideoFragment == null) {
             synchronized (BaseFragmentFactory.class) {

+ 0 - 32
app/src/main/java/org/yczbj/ycvideoplayer/base/BaseInterceptor.java

@@ -1,32 +0,0 @@
-package org.yczbj.ycvideoplayer.base;
-
-import java.io.IOException;
-
-import okhttp3.Interceptor;
-import okhttp3.Request;
-import okhttp3.Response;
-
-/**
- * ================================================
- * 作    者:杨充
- * 版    本:1.0
- * 创建日期:2016/6/20
- * 描    述:自定义拦截器,比如请求中有共同的请求头或者key值
- * 修订历史:
- * ================================================
- */
-public class BaseInterceptor implements Interceptor {
-
-    @Override
-    public Response intercept(Chain chain) throws IOException {
-        //用chain.request()构造一个新的传入统计参数的request,作为参数调用chain.proceed
-        Request req = chain.request();
-        Request request = req.newBuilder()
-                .addHeader("Cookie", "Cookie值,假设值")
-                .addHeader("appType", "android")
-                .addHeader("uuid", "uuid")
-                .addHeader("key","key值")
-                .build();
-        return chain.proceed(request);
-    }
-}

+ 0 - 242
app/src/main/java/org/yczbj/ycvideoplayer/db/RealmHelper.java

@@ -1,242 +0,0 @@
-package org.yczbj.ycvideoplayer.db;
-
-
-import org.yczbj.ycvideoplayer.model.realm.Collection;
-import org.yczbj.ycvideoplayer.model.realm.Record;
-import org.yczbj.ycvideoplayer.model.realm.SearchKey;
-
-import java.util.List;
-
-import io.realm.Realm;
-import io.realm.RealmResults;
-import io.realm.Sort;
-
-public class RealmHelper {
-
-    public static final String DB_NAME = "ycMovie.realm";
-    private Realm mRealm;
-    private static RealmHelper instance;
-
-    private RealmHelper() {
-
-    }
-
-    public static RealmHelper getInstance() {
-        if (instance == null) {
-            synchronized (RealmHelper.class) {
-                if (instance == null) {
-                    instance = new RealmHelper();
-                }
-            }
-        }
-        return instance;
-    }
-
-
-    Realm getRealm() {
-        if (mRealm == null || mRealm.isClosed()) {
-            mRealm = Realm.getDefaultInstance();
-        }
-        return mRealm;
-    }
-    //--------------------------------------------------收藏相关----------------------------------------------------
-
-    /**
-     * 增加 收藏记录
-     *
-     * @param bean
-     */
-    public void insertCollection(Collection bean) {
-        getRealm().beginTransaction();
-        getRealm().copyToRealm(bean);
-        getRealm().commitTransaction();
-    }
-
-    /**
-     * 删除 收藏记录
-     *
-     * @param id
-     */
-    public void deleteCollection(String id) {
-        Collection data = getRealm()
-                .where(Collection.class)
-                .equalTo("id", id).findFirst();
-        getRealm().beginTransaction();
-        data.deleteFromRealm();
-        getRealm().commitTransaction();
-    }
-
-    /**
-     * 清空收藏
-     */
-    public void deleteAllCollection() {
-        getRealm().beginTransaction();
-        getRealm().delete(Collection.class);
-        getRealm().commitTransaction();
-    }
-
-    /**
-     * 查询 收藏记录
-     *
-     * @param id
-     * @return
-     */
-    public boolean queryCollectionId(String id) {
-        RealmResults<Collection> results = getRealm()
-                .where(Collection.class)
-                .findAll();
-        for (Collection item : results) {
-            if (item.getId().equals(id)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 收藏列表
-     *
-     * @return
-     */
-    public List<Collection> getCollectionList() {
-        //使用findAllSort ,先findAll再result.sort排序
-        RealmResults<Collection> results = getRealm()
-                .where(Collection.class)
-                .findAllAsync("time");
-        return getRealm().copyFromRealm(results);
-    }
-
-
-    //--------------------------------------------------播放记录相关----------------------------------------------------
-
-    /**
-     * 增加播放记录
-     *
-     * @param bean
-     * @param maxSize 保存最大数量
-     */
-    public void insertRecord(Record bean, int maxSize) {
-        if (maxSize != 0) {
-            RealmResults<Record> results = getRealm()
-                    .where(Record.class)
-                    .findAllAsync("time");
-            if (results.size() >= maxSize) {
-                for (int i = maxSize - 1; i < results.size(); i++) {
-                    deleteRecord(results.get(i).getId());
-                }
-            }
-        }
-        getRealm().beginTransaction();
-        getRealm().copyToRealm(bean);
-        getRealm().commitTransaction();
-    }
-
-
-    /**
-     * 删除 播放记录
-     *
-     * @param id
-     */
-    public void deleteRecord(String id) {
-        Record data = getRealm()
-                .where(Record.class)
-                .equalTo("id", id).findFirst();
-        getRealm().beginTransaction();
-        data.deleteFromRealm();
-        getRealm().commitTransaction();
-    }
-
-    /**
-     * 查询 播放记录
-     *
-     * @param id
-     * @return
-     */
-    public boolean queryRecordId(String id) {
-        RealmResults<Record> results = getRealm()
-                .where(Record.class)
-                .findAll();
-        for (Record item : results) {
-            if (item.getId().equals(id)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 清空历史
-     */
-    public void deleteAllRecord() {
-        getRealm().beginTransaction();
-        getRealm().delete(Record.class);
-        getRealm().commitTransaction();
-    }
-
-    /**
-     * 增加 搜索记录
-     *
-     * @param bean
-     */
-    public void insertSearchHistory(SearchKey bean) {
-        //如果有不保存
-        List<SearchKey> list = getSearchHistoryList(bean.getSearchKey());
-        if (list == null || list.size() == 0) {
-            getRealm().beginTransaction();
-            getRealm().copyToRealm(bean);
-            getRealm().commitTransaction();
-        }
-        //如果保存记录超过20条,就删除一条。保存最多20条
-        List<SearchKey> listAll = getSearchHistoryListAll();
-        if (listAll != null && listAll.size() >= 10) {
-            deleteSearchHistoryList(listAll.get(listAll.size() - 1).getSearchKey());
-        }
-    }
-
-    /**
-     * 获取搜索历史记录列表
-     *
-     * @return
-     */
-    public List<SearchKey> getSearchHistoryList(String value) {
-        //使用findAllSort ,先findAll再result.sort排序
-        RealmResults<SearchKey> results = getRealm()
-                .where(SearchKey.class)
-                .contains("searchKey", value)
-                .findAllAsync("insertTime");
-        return getRealm().copyFromRealm(results);
-    }
-
-    /**
-     * 删除指定搜索历史记录列表
-     *
-     * @return
-     */
-    public void deleteSearchHistoryList(String value) {
-        SearchKey data = getRealm()
-                .where(SearchKey.class)
-                .equalTo("searchKey", value).findFirst();
-        getRealm().beginTransaction();
-        data.deleteFromRealm();
-        getRealm().commitTransaction();
-    }
-
-    public void deleteSearchHistoryAll() {
-        getRealm().beginTransaction();
-        getRealm().delete(SearchKey.class);
-        getRealm().commitTransaction();
-    }
-
-    /**
-     * 获取搜索历史记录列表
-     *
-     * @return
-     */
-    public List<SearchKey> getSearchHistoryListAll() {
-        //使用findAllSort ,先findAll再result.sort排序
-        RealmResults<SearchKey> results = getRealm()
-                .where(SearchKey.class)
-                .findAllAsync("insertTime");
-        return getRealm().copyFromRealm(results);
-    }
-}

+ 0 - 21
app/src/main/java/org/yczbj/ycvideoplayer/download/TaskViewHolderImp.java

@@ -1,21 +0,0 @@
-package org.yczbj.ycvideoplayer.download;
-
-
-/**
- * ================================================
- * 作    者:杨充
- * 版    本:1.0
- * 创建日期:2017/1/9
- * 描    述:下载Tasks的ViewHolder接口
- * 修订历史:
- *          下载框架:https://github.com/lingochamp/FileDownloader
- * ================================================
- */
-public interface TaskViewHolderImp {
-
-    void update(final int id, final int position) ;
-    void updateDownloaded();
-    void updateNotDownloaded(final int status, final long sofar, final long total) ;
-    void updateDownloading(final int status, final long sofar, final long total);
-
-}

+ 0 - 224
app/src/main/java/org/yczbj/ycvideoplayer/download/TasksManager.java

@@ -1,224 +0,0 @@
-package org.yczbj.ycvideoplayer.download;
-
-
-import android.app.Activity;
-import android.content.Context;
-import android.text.TextUtils;
-import android.util.SparseArray;
-
-import com.liulishuo.filedownloader.BaseDownloadTask;
-import com.liulishuo.filedownloader.FileDownloadConnectListener;
-import com.liulishuo.filedownloader.FileDownloader;
-import com.liulishuo.filedownloader.model.FileDownloadStatus;
-import com.liulishuo.filedownloader.util.FileDownloadUtils;
-
-import org.yczbj.ycvideoplayer.ui.home.view.adapter.DownloadVideoAdapter;
-
-import java.lang.ref.WeakReference;
-import java.util.List;
-
-/**
- * ================================================
- * 作    者:杨充
- * 版    本:1.0
- * 创建日期:2017/1/9
- * 描    述:下载Tasks帮助类
- * 修订历史:
- *          下载框架:https://github.com/lingochamp/FileDownloader
- * ================================================
- */
-public class TasksManager {
-
-    /**数据库控制器*/
-    private TasksManagerDBController dbController;
-    private List<TasksManagerModel> modelList;
-    private SparseArray<BaseDownloadTask> taskSparseArray = new SparseArray<>();
-    /**下载连接监听器*/
-    private FileDownloadConnectListener listener;
-
-
-    private final static class HolderClass {
-        private final static TasksManager INSTANCE = new TasksManager();
-    }
-
-    public static TasksManager getImpl() {
-        return HolderClass.INSTANCE;
-    }
-
-    private TasksManager() {
-        dbController = new TasksManagerDBController();
-        modelList = dbController.getAllTasks();
-        initListData();
-    }
-
-    /**
-     * 这一步很重要,将数据添加到下载队列中
-     */
-    private void initListData() {
-
-    }
-
-    /**
-     * 创建时执行
-     * @param activityWeakReference         软引用集合对象
-     */
-    public void onCreate(final WeakReference<DownloadVideoAdapter> activityWeakReference) {
-        if (!FileDownloader.getImpl().isServiceConnected()) {
-            FileDownloader.getImpl().bindService();
-            registerServiceConnectionListener(activityWeakReference);
-        }
-    }
-
-    /**
-     * 销毁时执行
-     */
-    public void onDestroy() {
-        unregisterServiceConnectionListener();
-        releaseTask();
-    }
-
-
-    public void addTaskForViewHolder(final BaseDownloadTask task) {
-        taskSparseArray.put(task.getId(), task);
-    }
-
-    public void removeTaskForViewHolder(final int id) {
-        taskSparseArray.remove(id);
-    }
-
-    public void updateViewHolder(final int id, final TaskViewHolderImp holder) {
-        final BaseDownloadTask task = taskSparseArray.get(id);
-        if (task == null) {
-            return;
-        }
-        task.setTag(holder);
-    }
-
-    private void releaseTask() {
-        taskSparseArray.clear();
-    }
-
-
-    /**
-     * 注册服务连接监听器
-     * @param activityWeakReference             软引用集合
-     */
-    private void registerServiceConnectionListener(final WeakReference<DownloadVideoAdapter> activityWeakReference) {
-        if (listener != null) {
-            FileDownloader.getImpl().removeServiceConnectListener(listener);
-        }
-
-        listener = new FileDownloadConnectListener() {
-            @Override
-            public void connected() {
-                if (activityWeakReference == null
-                        || activityWeakReference.get() == null) {
-                    return;
-                }
-                activityWeakReference.get().postNotifyDataChanged();
-            }
-
-            @Override
-            public void disconnected() {
-                if (activityWeakReference == null
-                        || activityWeakReference.get() == null) {
-                    return;
-                }
-                activityWeakReference.get().postNotifyDataChanged();
-            }
-        };
-        FileDownloader.getImpl().addServiceConnectListener(listener);
-    }
-
-    /**
-     * 移除服务连接监听器
-     */
-    private void unregisterServiceConnectionListener() {
-        FileDownloader.getImpl().removeServiceConnectListener(listener);
-        listener = null;
-    }
-
-
-    public boolean isReady() {
-        return FileDownloader.getImpl().isServiceConnected();
-    }
-
-
-    public TasksManagerModel get(final int position) {
-        if(modelList!=null){
-            return modelList.get(position);
-        }
-        return null;
-    }
-
-
-    private TasksManagerModel getById(final int id) {
-        for (TasksManagerModel model : modelList) {
-            if (model.getId() == id) {
-                return model;
-            }
-        }
-        return null;
-    }
-
-    public int getId(String url) {
-        if (TextUtils.isEmpty(url)){
-            return -1 ;
-        }
-        return FileDownloadUtils.generateId(url, createPath(url));
-    }
-
-
-    /**
-     * @param status Download Status
-     * @return has already downloaded
-     * @see FileDownloadStatus
-     */
-    public boolean isDownloaded(final int status) {
-        return status == FileDownloadStatus.completed;
-    }
-
-    public int getStatus(final int id, String path) {
-        return FileDownloader.getImpl().getStatus(id, path);
-    }
-
-    public long getTotal(final int id) {
-        return FileDownloader.getImpl().getTotal(id);
-    }
-
-    public long getSoFar(final int id) {
-        return FileDownloader.getImpl().getSoFar(id);
-    }
-
-    public int getTaskCounts() {
-        return modelList.size();
-    }
-
-    public TasksManagerModel addTask(final String url) {
-        return addTask(url, createPath(url));
-    }
-
-    private TasksManagerModel addTask(final String url, final String path) {
-        if (TextUtils.isEmpty(url) || TextUtils.isEmpty(path)) {
-            return null;
-        }
-        final int id = FileDownloadUtils.generateId(url, path);
-        TasksManagerModel model = getById(id);
-        if (model != null) {
-            return model;
-        }
-        final TasksManagerModel newModel = dbController.addTask(url, path);
-        if (newModel != null) {
-            modelList.add(newModel);
-        }
-        return newModel;
-    }
-
-    public String createPath(final String url) {
-        if (TextUtils.isEmpty(url)) {
-            return null;
-        }
-        return FileDownloadUtils.getDefaultSaveFilePath(url);
-    }
-
-}

+ 0 - 75
app/src/main/java/org/yczbj/ycvideoplayer/download/TasksManagerDBController.java

@@ -1,75 +0,0 @@
-package org.yczbj.ycvideoplayer.download;
-
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.text.TextUtils;
-
-import com.liulishuo.filedownloader.util.FileDownloadUtils;
-
-import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.base.BaseApplication;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * ================================================
- * 作    者:杨充
- * 版    本:1.0
- * 创建日期:2017/1/9
- * 描    述:下载Tasks帮助类
- * 修订历史:
- *          下载框架:https://github.com/lingochamp/FileDownloader
- * ================================================
- */
-public class TasksManagerDBController {
-
-    final static String TABLE_NAME = "tasksManger";
-    private final SQLiteDatabase db;
-
-    TasksManagerDBController() {
-        TasksManagerDBOpenHelper openHelper = new TasksManagerDBOpenHelper(BaseApplication.getInstance());
-        db = openHelper.getWritableDatabase();
-    }
-
-    public List<TasksManagerModel> getAllTasks() {
-        final Cursor c = db.rawQuery("SELECT * FROM " + TABLE_NAME, null);
-        final List<TasksManagerModel> list = new ArrayList<>();
-        try {
-            if (!c.moveToLast()) {
-                return list;
-            }
-            do {
-                TasksManagerModel model = new TasksManagerModel();
-                model.setId(c.getInt(c.getColumnIndex(TasksManagerModel.ID)));
-                model.setName(c.getString(c.getColumnIndex(TasksManagerModel.NAME)));
-                model.setUrl(c.getString(c.getColumnIndex(TasksManagerModel.URL)));
-                model.setPath(c.getString(c.getColumnIndex(TasksManagerModel.PATH)));
-                list.add(model);
-            } while (c.moveToPrevious());
-        } finally {
-            if (c != null) {
-                c.close();
-            }
-        }
-        return list;
-    }
-
-
-    public TasksManagerModel addTask(final String url, final String path) {
-        if (TextUtils.isEmpty(url) || TextUtils.isEmpty(path)) {
-            return null;
-        }
-        // 必须使用文件下载器,将TasksManagerModel与文件下载器关联
-        final int id = FileDownloadUtils.generateId(url, path);
-        TasksManagerModel model = new TasksManagerModel();
-        model.setId(id);
-        model.setName(url.substring(url.lastIndexOf("/")));
-        model.setUrl(url);
-        model.setPath(path);
-        final boolean succeed = db.insert(TABLE_NAME, null, model.toContentValues()) != -1;
-        return succeed ? model : null;
-    }
-
-
-}

+ 0 - 52
app/src/main/java/org/yczbj/ycvideoplayer/download/TasksManagerDBOpenHelper.java

@@ -1,52 +0,0 @@
-package org.yczbj.ycvideoplayer.download;
-
-import android.content.Context;
-import android.database.sqlite.SQLiteDatabase;
-import android.database.sqlite.SQLiteOpenHelper;
-
-/**
- * ================================================
- * 作    者:杨充
- * 版    本:1.0
- * 创建日期:2017/1/9
- * 描    述:下载Tasks帮助类
- * 修订历史:
- *          下载框架:https://github.com/lingochamp/FileDownloader
- * ================================================
- */
-public class TasksManagerDBOpenHelper extends SQLiteOpenHelper {
-
-    private final static String DATABASE_NAME = "tasksManager.db";
-    private final static int DATABASE_VERSION = 2;
-
-    TasksManagerDBOpenHelper(Context context) {
-        super(context, DATABASE_NAME, null, DATABASE_VERSION);
-    }
-
-
-    @Override
-    public void onCreate(SQLiteDatabase db) {
-        db.execSQL("CREATE TABLE IF NOT EXISTS "
-                + TasksManagerDBController.TABLE_NAME
-                + String.format(
-                "("
-                        + "%s INTEGER PRIMARY KEY, " // id, download id
-                        + "%s VARCHAR, " // name
-                        + "%s VARCHAR, " // url
-                        + "%s VARCHAR " // path
-                        + ")"
-                , TasksManagerModel.ID
-                , TasksManagerModel.NAME
-                , TasksManagerModel.URL
-                , TasksManagerModel.PATH
-        ));
-    }
-
-    @Override
-    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
-        if (oldVersion == 1 && newVersion == 2) {
-            db.delete(TasksManagerDBController.TABLE_NAME, null, null);
-        }
-    }
-
-}

+ 0 - 68
app/src/main/java/org/yczbj/ycvideoplayer/download/TasksManagerModel.java

@@ -1,68 +0,0 @@
-package org.yczbj.ycvideoplayer.download;
-
-import android.content.ContentValues;
-
-/**
- * ================================================
- * 作    者:杨充
- * 版    本:1.0
- * 创建日期:2017/1/9
- * 描    述:下载Tasks帮助类
- * 修订历史:
- *          下载框架:https://github.com/lingochamp/FileDownloader
- * ================================================
- */
-public class TasksManagerModel {
-
-    public final static String ID = "id";
-    public final static String NAME = "name";
-    public final static String URL = "url";
-    public final static String PATH = "path";
-
-    private int id;
-    private String name;
-    private String url;
-    private String path;
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getUrl() {
-        return url;
-    }
-
-    public void setUrl(String url) {
-        this.url = url;
-    }
-
-    public String getPath() {
-        return path;
-    }
-
-    public void setPath(String path) {
-        this.path = path;
-    }
-
-    public ContentValues toContentValues() {
-        ContentValues cv = new ContentValues();
-        cv.put(ID, id);
-        cv.put(NAME, name);
-        cv.put(URL, url);
-        cv.put(PATH, path);
-        return cv;
-    }
-
-}

+ 0 - 10
app/src/main/java/org/yczbj/ycvideoplayer/model/exception/ApiException.java

@@ -1,10 +0,0 @@
-package org.yczbj.ycvideoplayer.model.exception;
-
-
-public class ApiException extends Exception{
-
-    public ApiException(String msg) {
-        super(msg);
-    }
-
-}

+ 0 - 66
app/src/main/java/org/yczbj/ycvideoplayer/model/realm/Collection.java

@@ -1,66 +0,0 @@
-package org.yczbj.ycvideoplayer.model.realm;
-
-import java.io.Serializable;
-
-import io.realm.RealmObject;
-
-/**
- * Description: 收藏
- */
-public class Collection extends RealmObject implements Serializable {
-
-    String id;
-    long time;
-    public String title;
-    public String pic;
-    public String airTime;
-    public String score;
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public long getTime() {
-        return time;
-    }
-
-    public void setTime(long time) {
-        this.time = time;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public String getPic() {
-        return pic;
-    }
-
-    public void setPic(String pic) {
-        this.pic = pic;
-    }
-
-    public String getAirTime() {
-        return airTime;
-    }
-
-    public void setAirTime(String airTime) {
-        this.airTime = airTime;
-    }
-
-    public String getScore() {
-        return score;
-    }
-
-    public void setScore(String score) {
-        this.score = score;
-    }
-}

+ 0 - 49
app/src/main/java/org/yczbj/ycvideoplayer/model/realm/Record.java

@@ -1,49 +0,0 @@
-package org.yczbj.ycvideoplayer.model.realm;
-
-import java.io.Serializable;
-
-import io.realm.RealmObject;
-
-/**
- * Description: 播放记录
- */
-public class Record extends RealmObject implements Serializable {
-
-    public String title;
-    public String pic;
-    String id;
-    long time;
-
-    public long getTime() {
-        return time;
-    }
-
-    public void setTime(long time) {
-        this.time = time;
-    }
-
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public String getPic() {
-        return pic;
-    }
-
-    public void setPic(String pic) {
-        this.pic = pic;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-}

+ 0 - 21
app/src/main/java/org/yczbj/ycvideoplayer/model/realm/SearchKey.java

@@ -1,21 +0,0 @@
-package org.yczbj.ycvideoplayer.model.realm;
-
-import io.realm.RealmObject;
-
-public class SearchKey extends RealmObject {
-
-    public String searchKey;
-    //插入时间
-    public long insertTime;
-
-    public SearchKey() {}
-
-    public SearchKey(String suggestion, long insertTime) {
-        this.searchKey = suggestion;
-        this.insertTime = insertTime;
-    }
-
-    public String getSearchKey() {
-        return searchKey;
-    }
-}

+ 1 - 0
app/src/main/java/org/yczbj/ycvideoplayer/ui/home/contract/VideoPlayerJzContract.java

@@ -32,4 +32,5 @@ public interface VideoPlayerJzContract {
     }
 
 
+
 }

+ 0 - 79
app/src/main/java/org/yczbj/ycvideoplayer/ui/home/view/activity/VideoPlayerJzActivity.java

@@ -33,14 +33,11 @@ import org.yczbj.ycvideoplayer.R;
 import org.yczbj.ycvideoplayer.api.constant.ConstantVideo;
 import org.yczbj.ycvideoplayer.base.mvp1.BaseActivity;
 import org.yczbj.ycvideoplayer.ui.home.contract.VideoPlayerJzContract;
-import org.yczbj.ycvideoplayer.ui.home.model.DialogListBean;
 import org.yczbj.ycvideoplayer.ui.home.model.VideoPlayerComment;
 import org.yczbj.ycvideoplayer.ui.home.model.VideoPlayerFavorite;
 import org.yczbj.ycvideoplayer.ui.home.presenter.VideoPlayerJzPresenter;
-import org.yczbj.ycvideoplayer.ui.home.view.adapter.DownloadVideoAdapter;
 import org.yczbj.ycvideoplayer.ui.home.view.adapter.NarrowImageAdapter;
 import org.yczbj.ycvideoplayer.ui.home.view.adapter.VideoPlayerMeAdapter;
-import org.yczbj.ycvideoplayer.util.AppUtil;
 import org.yczbj.ycvideoplayerlib.manager.VideoPlayerManager;
 import org.yczbj.ycvideoplayerlib.player.VideoPlayer;
 import org.yczbj.ycvideoplayerlib.constant.ConstantKeys;
@@ -237,7 +234,6 @@ public class VideoPlayerJzActivity extends BaseActivity implements VideoPlayerJz
                                 ToastUtil.showToast(VideoPlayerJzActivity.this, "收藏视频");
                                 break;
                             case R.id.iv_player_download:
-                                showDownloadDialog();
                                 break;
                             case R.id.iv_player_share:
                                 ToastUtil.showToast(VideoPlayerJzActivity.this, "分享视频");
@@ -362,81 +358,6 @@ public class VideoPlayerJzActivity extends BaseActivity implements VideoPlayerJz
     }
 
 
-    /**
-     * 弹出下载弹窗
-     */
-    private void showDownloadDialog() {
-        final List<DialogListBean> list = new ArrayList<>();
-        for(int a = 0; a< ConstantVideo.VideoPlayerList.length; a++){
-            DialogListBean dialogListBean = new DialogListBean("logo",
-                    "name",ConstantVideo.VideoPlayerTitle[a],ConstantVideo.VideoPlayerList[a]);
-            list.add(dialogListBean);
-        }
-        if(AppUtil.isActivityLiving(this)){
-            View view = getLayoutInflater().inflate(R.layout.dialog_download_video, null);
-            final PopupWindow popMenu = new PopupWindow(view, RelativeLayout.LayoutParams.MATCH_PARENT
-                    , RelativeLayout.LayoutParams.MATCH_PARENT, true){
-                //重写方法
-                @Override
-                public void showAsDropDown(View anchor) {
-                    Rect visibleFrame = new Rect();
-                    anchor.getGlobalVisibleRect(visibleFrame);
-                    int height = anchor.getResources().getDisplayMetrics().heightPixels - visibleFrame.bottom;
-                    setHeight(height);
-                    super.showAsDropDown(anchor);
-                }
-            };
-            popMenu.setClippingEnabled(false);
-            //点击其他地方关闭
-            popMenu.setFocusable(true);
-            //设置动画
-            popMenu.setAnimationStyle(R.style.animator_dialog_download);
-            popMenu.showAsDropDown(videoPlayer);
-            AppUtil.setBackgroundAlpha(VideoPlayerJzActivity.this,0.5f);
-            popMenu.setOnDismissListener(new PopupWindow.OnDismissListener() {
-                @Override
-                public void onDismiss() {
-                    AppUtil.setBackgroundAlpha(VideoPlayerJzActivity.this,1.0f);
-                }
-            });
-
-
-            RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
-            ImageView ivCancel = (ImageView) view.findViewById(R.id.iv_cancel);
-            ImageView ivDownload = (ImageView) view.findViewById(R.id.iv_download);
-            recyclerView.setLayoutManager(new LinearLayoutManager(this));
-            final DownloadVideoAdapter mAdapter = new DownloadVideoAdapter(this, list);
-            recyclerView.setAdapter(mAdapter);
-            final RecycleViewItemLine line = new RecycleViewItemLine(this, LinearLayout.HORIZONTAL,
-                    SizeUtils.dp2px(1), this.getResources().getColor(R.color.grayLine));
-            recyclerView.addItemDecoration(line);
-            mAdapter.setOnItemClickListener(new DownloadVideoAdapter.OnItemClickListener() {
-                @Override
-                public void onItemClick(int position) {
-                    ToastUtil.showToast(VideoPlayerJzActivity.this,"点击了"+position+"条目");
-                }
-            });
-            View.OnClickListener listener = new View.OnClickListener() {
-                @Override
-                public void onClick(View v) {
-                    switch (v.getId()){
-                        case R.id.iv_cancel:
-                            if(AppUtil.isActivityLiving(VideoPlayerJzActivity.this)){
-                                popMenu.dismiss();
-                            }
-                            break;
-                        case R.id.iv_download:
-
-                            break;
-                        default:
-                            break;
-                    }
-                }
-            };
-            ivCancel.setOnClickListener(listener);
-            ivDownload.setOnClickListener(listener);
-        }
-    }
 
 
 }

+ 0 - 446
app/src/main/java/org/yczbj/ycvideoplayer/ui/home/view/adapter/DownloadVideoAdapter.java

@@ -1,446 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.home.view.adapter;
-
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.content.Context;
-import android.support.v7.widget.RecyclerView;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.liulishuo.filedownloader.BaseDownloadTask;
-import com.liulishuo.filedownloader.FileDownloadListener;
-import com.liulishuo.filedownloader.FileDownloadSampleListener;
-import com.liulishuo.filedownloader.FileDownloader;
-import com.liulishuo.filedownloader.model.FileDownloadStatus;
-import com.liulishuo.filedownloader.util.FileDownloadUtils;
-import com.ns.yc.ycprogresslib.CircleProgressbar;
-
-import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.download.TaskViewHolderImp;
-import org.yczbj.ycvideoplayer.download.TasksManager;
-import org.yczbj.ycvideoplayer.ui.home.model.DialogListBean;
-import org.yczbj.ycvideoplayer.util.LogUtils;
-
-import java.io.File;
-import java.lang.ref.WeakReference;
-import java.util.List;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-
-public class DownloadVideoAdapter extends RecyclerView.Adapter<DownloadVideoAdapter.ViewHolder> {
-
-
-    private LayoutInflater inflater;
-    private List<DialogListBean> mList;
-    private Context mContext;
-    private OnItemClickListener onItemClickListener;
-    private ViewHolder viewHolder;
-    //下载状态
-    private final String STATE_START = "start";
-    private final String STATE_STOP = "stop";
-    private final String STATE_DETAIL = "detail";
-
-    public DownloadVideoAdapter(Context mContext, List<DialogListBean> mList) {
-        this.mList = mList;
-        this.mContext = mContext;
-        inflater = LayoutInflater.from(mContext);
-        TasksManager.getImpl().onCreate(new WeakReference<>(this));
-    }
-
-
-    @Override
-    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
-        viewHolder = new ViewHolder(inflater.inflate(R.layout.item_dialog_list_view, parent, false));
-        return viewHolder;
-    }
-
-    @SuppressLint("SetTextI18n")
-    @Override
-    public void onBindViewHolder(ViewHolder holder, @SuppressLint("RecyclerView") final int position) {
-        //final TasksManagerModel model = TasksManager.getImpl().get(position);
-        DialogListBean model = mList.get(position);
-        final String path = TasksManager.getImpl().createPath(model.getVideo());
-        int id = TasksManager.getImpl().getId(model.getVideo());
-        holder.update(id, position);
-        TasksManager.getImpl().updateViewHolder(holder.id, holder);
-
-        holder.tvTitle.setText(mList.get(position).getTitle());
-        holder.tvTime.setText("时长98:00:12");
-        holder.tvVideoSize.setText("100MB");
-        holder.ivDownload.setBackgroundResource(R.drawable.icon_cache_download);
-
-        //设置类型
-        holder.circlePb.setProgressType(CircleProgressbar.ProgressType.COUNT);
-        //设置圆形的填充颜色
-        holder.circlePb.setInCircleColor(mContext.getResources().getColor(R.color.colorTransparent));
-        //设置外部轮廓的颜色
-        holder.circlePb.setOutLineColor(mContext.getResources().getColor(R.color.gray3));
-        //设置进度监听
-        holder.circlePb.setCountdownProgressListener(1, progressListener);
-        //设置外部轮廓的颜色
-        holder.circlePb.setOutLineWidth(1);
-        //设置进度条线的宽度
-        holder.circlePb.setProgressLineWidth(3);
-        //设置进度
-        holder.circlePb.setProgress(0);
-
-        //状态: 加载中...
-        LogUtils.e(DownloadVideoAdapter.class.getName()+" ----- "+holder.toString());
-        holder.llDownload.setTag(holder);
-        holder.tvDownloadState.setTag(STATE_START);
-        holder.llDownload.setOnClickListener(listener);
-
-        //条目点击事件
-        holder.itemView.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View view) {
-                if (onItemClickListener != null) {
-                    onItemClickListener.onItemClick(position);
-                }
-            }
-        });
-
-
-        if (TasksManager.getImpl().isReady()) {
-            final int status = TasksManager.getImpl().getStatus(model.getId(), path);
-            if (status == FileDownloadStatus.pending || status == FileDownloadStatus.started ||
-                    status == FileDownloadStatus.connected) {
-                // start task, but file not created yet
-                holder.updateDownloading(status, TasksManager.getImpl().getSoFar(model.getId())
-                        , TasksManager.getImpl().getTotal(model.getId()));
-            } else if (!new File(path).exists() && !new File(FileDownloadUtils.getTempPath(path)).exists()) {
-                // not exist file
-                holder.updateNotDownloaded(status, 0, 0);
-            } else if (TasksManager.getImpl().isDownloaded(status)) {
-                // already downloaded and exist
-                holder.updateDownloaded();
-            } else if (status == FileDownloadStatus.progress) {
-                // downloading
-                holder.updateDownloading(status, TasksManager.getImpl().getSoFar(model.getId())
-                        , TasksManager.getImpl().getTotal(model.getId()));
-            } else {
-                // not start
-                holder.updateNotDownloaded(status, TasksManager.getImpl().getSoFar(model.getId())
-                        , TasksManager.getImpl().getTotal(model.getId()));
-            }
-        } else {
-            //状态: 加载中...
-            LogUtils.e(DownloadVideoAdapter.class.getName()+" ----- 状态: 加载中...");
-        }
-    }
-
-    @Override
-    public int getItemCount() {
-        return mList==null ? 0 :mList.size();
-    }
-
-    class ViewHolder extends RecyclerView.ViewHolder implements TaskViewHolderImp {
-
-        private int position;
-        public int id;
-
-        @BindView(R.id.tv_title)
-        TextView tvTitle;
-        @BindView(R.id.tv_time)
-        TextView tvTime;
-        @BindView(R.id.ll_download)
-        LinearLayout llDownload;
-        @BindView(R.id.iv_download)
-        ImageView ivDownload;
-        @BindView(R.id.circle_pb)
-        CircleProgressbar circlePb;
-        @BindView(R.id.tv_video_size)
-        TextView tvVideoSize;
-        @BindView(R.id.tv_download_state)
-        TextView tvDownloadState;
-
-        ViewHolder(View itemView) {
-            super(itemView);
-            ButterKnife.bind(this, itemView);
-        }
-
-        @Override
-        public void update(int id, int position) {
-            this.id = id;
-            this.position = position;
-        }
-
-        @Override
-        public void updateDownloaded() {
-            LogUtils.e(DownloadVideoAdapter.class.getName()+" ----- updateDownloaded: ");
-            //当下载完成后,隐藏圆环控件,显示删除图标
-            circlePb.setVisibility(View.GONE);
-            circlePb.setProgress(1);
-            ivDownload.setBackgroundResource(R.drawable.icon_cache_delete);
-            tvDownloadState.setTag(STATE_DETAIL);
-            tvDownloadState.setText("下载完成");
-
-            /*TasksManager.getImpl().deleteTasksManagerModel(videolistBean.getVideoUrl());
-            if (!TasksManager.getImpl().isExistDownloadFile(videolistBean.getVideoUrl())) {
-                TasksManager.getImpl().addDownloaded(videolistBean);
-            }*/
-        }
-
-        @SuppressLint("DefaultLocale")
-        @Override
-        public void updateNotDownloaded(int status, long sofar, long total) {
-            LogUtils.e(DownloadVideoAdapter.class.getName()+" ----- updateNotDownloaded: ");
-            if (sofar > 0 && total > 0) {
-                final float percent = sofar / (float) total;
-                circlePb.setProgress((int) (percent * 100));
-            } else {
-                circlePb.setProgress(0);
-            }
-            switch (status) {
-                case FileDownloadStatus.error:
-                    ivDownload.setBackgroundResource(R.drawable.icon_cache_download);
-                    tvDownloadState.setTag(STATE_START);
-                    tvDownloadState.setText("错误");
-                    break;
-                case FileDownloadStatus.paused:
-                    tvVideoSize.setText(String.format("%dMB",total/1024/1024));
-                    ivDownload.setBackgroundResource(R.drawable.icon_cache_download);
-                    tvDownloadState.setTag(STATE_START);
-                    tvDownloadState.setText("暂停");
-                    break;
-                default:
-                    ivDownload.setBackgroundResource(R.drawable.icon_cache_download);
-                    tvDownloadState.setTag(STATE_START);
-                    break;
-            }
-        }
-
-        @Override
-        public void updateDownloading(int status, long sofar, long total) {
-            LogUtils.e(DownloadVideoAdapter.class.getName()+" ----- updateDownloading: ");
-            final float percent = sofar / (float) total;
-            circlePb.setProgress((int) (percent * 100));
-            switch (status) {
-                case FileDownloadStatus.pending:
-                    tvDownloadState.setText("排队中");
-                    ivDownload.setBackgroundResource(R.drawable.icon_cache_download);
-                    tvDownloadState.setTag(STATE_START);
-                    break;
-                case FileDownloadStatus.started:
-                    tvDownloadState.setText("开始下载");
-                    ivDownload.setBackgroundResource(R.drawable.icon_cache_download);
-                    tvDownloadState.setTag(STATE_START);
-                    break;
-                case FileDownloadStatus.connected:
-                    tvDownloadState.setText("链接中");
-                    ivDownload.setBackgroundResource(R.drawable.icon_cache_download);
-                    tvDownloadState.setTag(STATE_START);
-                    break;
-                case FileDownloadStatus.progress:
-                    tvDownloadState.setText("下载中");
-                    ivDownload.setBackgroundResource(R.drawable.icon_cache_play);
-                    tvDownloadState.setTag(STATE_STOP);
-                    break;
-                default:
-                    ivDownload.setBackgroundResource(R.drawable.icon_cache_play);
-                    tvDownloadState.setTag(STATE_STOP);
-                    break;
-            }
-        }
-    }
-
-
-    public View.OnClickListener listener = new View.OnClickListener() {
-        @Override
-        public void onClick(View v) {
-            if (v.getTag() == null) {
-                return;
-            }
-            Object tag = v.getTag();
-            LogUtils.e(DownloadVideoAdapter.class.getName()+" ----- " +tag.toString());
-            ViewHolder holder = (ViewHolder) v.getTag();
-            String state = (String) holder.tvDownloadState.getTag();
-            DialogListBean model = mList.get(holder.position);
-            switch (state){
-                //下载
-                case STATE_START:
-                    String path = TasksManager.getImpl().createPath(model.getVideo());
-                    final BaseDownloadTask task = FileDownloader.getImpl().create(model.getVideo())
-                            .setPath(path)
-                            .setCallbackProgressTimes(500)
-                            .setListener(taskDownloadListener);
-                    TasksManager.getImpl().addTaskForViewHolder(task);
-                    TasksManager.getImpl().updateViewHolder(holder.id, holder);
-                    task.start();
-                    viewHolder.tvDownloadState.setText("开始下载");
-                    LogUtils.e(DownloadVideoAdapter.class.getName()+" --开始下载--- "+ holder.position
-                            + "-----" +model.getVideo());
-                    break;
-                //暂停
-                case STATE_STOP:
-                    //ToastUtil.showToast(mContext,"暂停下载");
-                    FileDownloader.getImpl().pause(holder.id);
-                    holder.ivDownload.setBackgroundResource(R.drawable.icon_cache_download);
-                    holder.tvDownloadState.setTag(STATE_START);
-                    viewHolder.tvDownloadState.setText("暂停下载");
-                    LogUtils.e(DownloadVideoAdapter.class.getName()+" --暂停下载--- "+ holder.position
-                            + "-----" +model.getVideo());
-                    break;
-                //删除
-                case STATE_DETAIL:
-                    //ToastUtil.showToast(mContext,"删除文件");
-                    // to delete
-                    // File file = new File(TasksManager.getImpl().get(holder.position).getPath());
-                    // 删除文件file.delete();
-                    File file = new File(TasksManager.getImpl().createPath(model.getVideo()));
-                    //noinspection ResultOfMethodCallIgnored
-                    file.delete();
-                    holder.updateNotDownloaded(FileDownloadStatus.INVALID_STATUS, 0, 0);
-                    holder.ivDownload.setBackgroundResource(R.drawable.icon_cache_download);
-                    holder.tvDownloadState.setTag(STATE_START);
-                    holder.circlePb.setVisibility(View.VISIBLE);
-                    viewHolder.tvDownloadState.setText("已经删除");
-                    LogUtils.e(DownloadVideoAdapter.class.getName()+" --已经删除--- "+ holder.position
-                            + "-----" +model.getVideo());
-                    break;
-                default:
-                    break;
-            }
-        }
-    };
-
-
-    /**
-     * 这个是用来监听下载的情况[没问题]
-     * 1.下载队列中
-     * 2.开始下载
-     * 3.连接中
-     * 4.下载中
-     * 5.下载错误
-     * 6.暂停
-     * 7.完成
-     */
-    private FileDownloadListener taskDownloadListener = new FileDownloadSampleListener() {
-
-        private ViewHolder checkCurrentHolder(final BaseDownloadTask task) {
-            final ViewHolder tag = (ViewHolder) task.getTag();
-            if (tag.id != task.getId()) {
-                return null;
-            }
-            return tag;
-        }
-
-        @Override
-        protected void pending(BaseDownloadTask task, int soFarBytes, int totalBytes) {
-            super.pending(task, soFarBytes, totalBytes);
-            final ViewHolder tag = checkCurrentHolder(task);
-            if (tag == null) {
-                return;
-            }
-            tag.updateDownloading(FileDownloadStatus.pending, soFarBytes, totalBytes);
-            tag.tvDownloadState.setText("队列中");
-        }
-
-        @Override
-        protected void started(BaseDownloadTask task) {
-            super.started(task);
-            final ViewHolder tag = checkCurrentHolder(task);
-            if (tag == null) {
-                return;
-            }
-            tag.tvDownloadState.setText("状态: 开始下载");
-        }
-
-        @Override
-        protected void connected(BaseDownloadTask task, String etag, boolean isContinue, int soFarBytes, int totalBytes) {
-            super.connected(task, etag, isContinue, soFarBytes, totalBytes);
-            final ViewHolder tag = checkCurrentHolder(task);
-            if (tag == null) {
-                return;
-            }
-            tag.updateDownloading(FileDownloadStatus.connected, soFarBytes, totalBytes);
-            tag.tvDownloadState.setText("状态: 连接中");
-        }
-
-        @Override
-        protected void progress(BaseDownloadTask task, int soFarBytes, int totalBytes) {
-            super.progress(task, soFarBytes, totalBytes);
-            final ViewHolder tag = checkCurrentHolder(task);
-            if (tag == null) {
-                return;
-            }
-            tag.updateDownloading(FileDownloadStatus.progress, soFarBytes, totalBytes);
-            tag.tvDownloadState.setText("状态: 下载中");
-        }
-
-        @Override
-        protected void error(BaseDownloadTask task, Throwable e) {
-            super.error(task, e);
-            final ViewHolder tag = checkCurrentHolder(task);
-            if (tag == null) {
-                return;
-            }
-            tag.updateNotDownloaded(FileDownloadStatus.error, task.getLargeFileSoFarBytes()
-                    , task.getLargeFileTotalBytes());
-            tag.tvDownloadState.setText("状态: 错误");
-            TasksManager.getImpl().removeTaskForViewHolder(task.getId());
-        }
-
-        @Override
-        protected void paused(BaseDownloadTask task, int soFarBytes, int totalBytes) {
-            super.paused(task, soFarBytes, totalBytes);
-            final ViewHolder tag = checkCurrentHolder(task);
-            if (tag == null) {
-                return;
-            }
-            tag.updateNotDownloaded(FileDownloadStatus.paused, soFarBytes, totalBytes);
-            tag.tvDownloadState.setText("状态: 暂停");
-            TasksManager.getImpl().removeTaskForViewHolder(task.getId());
-        }
-
-        @Override
-        protected void completed(BaseDownloadTask task) {
-            super.completed(task);
-            final ViewHolder tag = checkCurrentHolder(task);
-            if (tag == null) {
-                return;
-            }
-            tag.updateDownloaded();
-            tag.tvDownloadState.setText("状态: 完成");
-            TasksManager.getImpl().removeTaskForViewHolder(task.getId());
-        }
-    };
-
-
-    private CircleProgressbar.OnCountdownProgressListener progressListener = new CircleProgressbar.OnCountdownProgressListener() {
-        @Override
-        public void onProgress(int what, int progress) {
-            if (what == 1) {
-                viewHolder.circlePb.setText("0");
-            }
-        }
-    };
-
-    public void postNotifyDataChanged() {
-        ((Activity) mContext).runOnUiThread(new Runnable() {
-            @Override
-            public void run() {
-                notifyDataSetChanged();
-            }
-        });
-    }
-
-
-    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
-        this.onItemClickListener = onItemClickListener;
-    }
-
-
-    public interface OnItemClickListener {
-        void onItemClick(int id);
-    }
-
-
-}

+ 42 - 1
app/src/main/java/org/yczbj/ycvideoplayer/ui/home/view/fragment/HomeFragment.java

@@ -3,8 +3,10 @@ package org.yczbj.ycvideoplayer.ui.home.view.fragment;
 import android.content.Context;
 import android.graphics.Color;
 import android.support.v4.widget.SwipeRefreshLayout;
+import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.view.View;
+import android.view.ViewGroup;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 
@@ -22,6 +24,8 @@ import org.yczbj.ycvideoplayer.api.constant.Constant;
 import org.yczbj.ycvideoplayer.base.BaseConfig;
 import org.yczbj.ycvideoplayer.base.BaseDelegateAdapter;
 import org.yczbj.ycvideoplayer.base.mvp1.BaseFragment;
+import org.yczbj.ycvideoplayer.ui.home.model.VideoPlayerFavorite;
+import org.yczbj.ycvideoplayer.ui.home.view.adapter.NarrowImageAdapter;
 import org.yczbj.ycvideoplayer.ui.person.TestFourWindowActivity;
 import org.yczbj.ycvideoplayer.ui.test.test2.TestMyActivity;
 import org.yczbj.ycvideoplayer.ui.home.view.activity.VideoPlayerJzActivity;
@@ -259,6 +263,7 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener {
         initBannerView();
         initFiveButtonView();
         initListFirstView();
+        initRecyclerView();
         initFirstAdView();
         initListSecondView();
         initSecondAdView();
@@ -269,6 +274,7 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener {
     }
 
 
+
     private void initBannerView() {
         final ArrayList<String> arrayList = new ArrayList<>();
         arrayList.add("http://bpic.wotucdn.com/11/66/23/55bOOOPIC3c_1024.jpg!/fw/780/quality/90/unsharp/true/compress/true/watermark/url/L2xvZ28ud2F0ZXIudjIucG5n/repeat/true");
@@ -291,6 +297,7 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener {
 
             }
         };
+
         mAdapters.add(adapter);
     }
 
@@ -358,6 +365,38 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener {
         initMoreView(1);
     }
 
+    private void initRecyclerView() {
+        BaseDelegateAdapter adapter = new BaseDelegateAdapter(activity, new LinearLayoutHelper(),
+                R.layout.view_vlayout_recycler, 1, Constant.viewType.typeRecycler) {
+            @Override
+            public void onBindViewHolder(BaseViewHolder holder, int position) {
+                super.onBindViewHolder(holder, position);
+                final RecyclerView recycler = holder.getView(R.id.recyclerView);
+                recycler.setLayoutManager(new LinearLayoutManager(activity,
+                        LinearLayoutManager.HORIZONTAL,false));
+                NarrowImageAdapter narrowImageAdapter = new NarrowImageAdapter(activity);
+                recycler.setAdapter(narrowImageAdapter);
+                List<VideoPlayerFavorite> favoriteList = new ArrayList<>();
+                for (int a = 0; a < 30; a++) {
+                    VideoPlayerFavorite videoPlayerFavorite = new VideoPlayerFavorite(
+                            "这个是猜你喜欢的标题", R.drawable.bg_small_tree_min, "");
+                    favoriteList.add(videoPlayerFavorite);
+                }
+                narrowImageAdapter.addAll(favoriteList);
+            }
+        };
+
+        LinearLayoutHelper linearLayoutHelper = new LinearLayoutHelper();
+        BaseDelegateAdapter adapter1 = new BaseDelegateAdapter(activity, new LinearLayoutHelper(),
+                R.layout.view_video_player_favorite, 30, Constant.viewType.typeRecycler) {
+            @Override
+            public void onBindViewHolder(BaseViewHolder holder, int position) {
+                super.onBindViewHolder(holder, position);
+            }
+        };
+        mAdapters.add(adapter);
+    }
+
 
     private void initFirstAdView() {
         BaseDelegateAdapter adAdapter = new BaseDelegateAdapter(activity, new LinearLayoutHelper(), R.layout.view_vlayout_ad, 1, Constant.viewType.typeAd) {
@@ -547,7 +586,9 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener {
 
 
     private void initMoreView(final int type) {
-        BaseDelegateAdapter moreAdapter = new BaseDelegateAdapter(activity, new LinearLayoutHelper(), R.layout.view_vlayout_more, 1, Constant.viewType.typeMore) {
+        BaseDelegateAdapter moreAdapter = new BaseDelegateAdapter(activity,
+                new LinearLayoutHelper(), R.layout.view_vlayout_more, 1,
+                Constant.viewType.typeMore) {
             @Override
             public void onBindViewHolder(BaseViewHolder holder, int position) {
                 super.onBindViewHolder(holder, position);

+ 2 - 33
app/src/main/java/org/yczbj/ycvideoplayer/ui/main/view/activity/MainActivity.java

@@ -13,7 +13,6 @@ import com.blankj.utilcode.util.ToastUtils;
 import com.flyco.tablayout.CommonTabLayout;
 import com.flyco.tablayout.listener.CustomTabEntity;
 import com.flyco.tablayout.listener.OnTabSelectListener;
-import com.liulishuo.filedownloader.FileDownloader;
 import com.ns.yc.ycutilslib.activityManager.AppManager;
 import com.ns.yc.ycutilslib.managerLeak.InputMethodManagerLeakUtils;
 
@@ -21,9 +20,7 @@ import org.yczbj.ycvideoplayer.R;
 import org.yczbj.ycvideoplayer.api.constant.Constant;
 import org.yczbj.ycvideoplayer.base.mvp1.BaseActivity;
 import org.yczbj.ycvideoplayer.base.BaseFragmentFactory;
-import org.yczbj.ycvideoplayer.download.TasksManager;
-import org.yczbj.ycvideoplayer.ui.movie.view.fragment.MovieFragment;
-import org.yczbj.ycvideoplayer.ui.news.NewsFragment;
+import org.yczbj.ycvideoplayer.ui.news.view.fragment.NewsFragment;
 import org.yczbj.ycvideoplayer.ui.video.view.fragment.VideoFragment;
 import org.yczbj.ycvideoplayer.ui.home.view.fragment.HomeFragment;
 import org.yczbj.ycvideoplayer.ui.main.contract.MainContract;
@@ -56,7 +53,6 @@ public class MainActivity extends BaseActivity implements MainContract.View {
     private static final String POSITION = "position";
     private static final String SELECT_ITEM = "selectItem";
     private static final int FRAGMENT_HOME = 0;
-    private static final int FRAGMENT_MOVIE = 1;
     private static final int FRAGMENT_VIDEO = 2;
     private static final int FRAGMENT_ME = 3;
     private static final int FRAGMENT_NEWS = 4;
@@ -68,7 +64,6 @@ public class MainActivity extends BaseActivity implements MainContract.View {
     private Bundle savedInstanceState;
     private HomeFragment homeFragment;
     private VideoFragment videoFragment;
-    private MovieFragment mMovieFragment;
     private MeFragment meFragment;
     private NewsFragment newsFragment;
 
@@ -145,10 +140,6 @@ public class MainActivity extends BaseActivity implements MainContract.View {
     private void initTabLayout() {
         ArrayList<CustomTabEntity> mTabEntities = presenter.getTabEntity();
         ctlTable.setTabData(mTabEntities);
-        //ctlTable.showDot(3);                   //显示红点
-        //ctlTable.showMsg(2,5);                 //显示未读信息
-        //ctlTable.showMsg(1,3);                 //显示未读信息
-        //ctlTable.setMsgMargin(1, 2, 2);        //显示红点信息位置
         ctlTable.setOnTabSelectListener(new OnTabSelectListener() {
             @Override
             public void onTabSelect(int position) {
@@ -161,14 +152,10 @@ public class MainActivity extends BaseActivity implements MainContract.View {
                         doubleClick(FRAGMENT_NEWS);
                         break;
                     case 2:
-                        showFragment(FRAGMENT_MOVIE);
-                        doubleClick(FRAGMENT_MOVIE);
-                        break;
-                    case 3:
                         showFragment(FRAGMENT_VIDEO);
                         doubleClick(FRAGMENT_VIDEO);
                         break;
-                    case 4:
+                    case 3:
                         showFragment(FRAGMENT_ME);
                         break;
                     default:
@@ -189,7 +176,6 @@ public class MainActivity extends BaseActivity implements MainContract.View {
         if(savedInstanceState!=null){
             homeFragment = BaseFragmentFactory.getInstance().getHomeFragment();
             newsFragment = BaseFragmentFactory.getInstance().getNewsFragment();
-            mMovieFragment = BaseFragmentFactory.getInstance().getMovieFragment();
             videoFragment = BaseFragmentFactory.getInstance().getVideoFragment();
             meFragment = BaseFragmentFactory.getInstance().getMeFragment();
             int index = savedInstanceState.getInt(POSITION);
@@ -218,14 +204,6 @@ public class MainActivity extends BaseActivity implements MainContract.View {
                     ft.show(homeFragment);
                 }
                 break;
-            case FRAGMENT_MOVIE:
-                if (mMovieFragment == null) {
-                    mMovieFragment = BaseFragmentFactory.getInstance().getMovieFragment();
-                    ft.add(R.id.fl_main, mMovieFragment, MovieFragment.class.getName());
-                } else {
-                    ft.show(mMovieFragment);
-                }
-                break;
             case FRAGMENT_VIDEO:
                 if (videoFragment == null) {
                     videoFragment = BaseFragmentFactory.getInstance().getVideoFragment();
@@ -265,9 +243,6 @@ public class MainActivity extends BaseActivity implements MainContract.View {
         if (newsFragment != null) {
             setHide(ft,newsFragment);
         }
-        if (mMovieFragment != null) {
-            setHide(ft,mMovieFragment);
-        }
         if (videoFragment != null) {
             setHide(ft,videoFragment);
         }
@@ -292,9 +267,6 @@ public class MainActivity extends BaseActivity implements MainContract.View {
                     break;
                 case FRAGMENT_VIDEO:
                     videoFragment.onDoubleClick();
-                    break;
-                case FRAGMENT_MOVIE:
-
                     break;
                 default:
                     break;
@@ -321,9 +293,6 @@ public class MainActivity extends BaseActivity implements MainContract.View {
                 ToastUtils.showShort("再按一次退出");
                 exitTime = System.currentTimeMillis();
             } else {
-                // 关闭文件下载
-                TasksManager.getImpl().onDestroy();
-                FileDownloader.getImpl().pauseAll();
                 finish();
                 AppManager.getAppManager().appExit(false);
             }

+ 0 - 29
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/contract/MovieContract.java

@@ -1,29 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.contract;
-
-
-import org.yczbj.ycvideoplayer.base.mvp1.BasePresenter;
-import org.yczbj.ycvideoplayer.base.mvp1.BaseView;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieBean;
-import org.yczbj.ycvideoplayer.ui.special.model.SpecialBean;
-
-import java.util.List;
-
-/**
- * Description:
- * Update:2018/1/2
- * CreatedTime:2017/12/29
- * Author:yc
- */
-
-public interface MovieContract {
-
-    interface View extends BaseView {
-        void setAdapterData(MovieBean movieBean);
-    }
-
-    interface Presenter extends BasePresenter {
-        void getData();
-    }
-
-
-}

+ 0 - 29
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/contract/MovieDetailContract.java

@@ -1,29 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.contract;
-
-
-import org.yczbj.ycvideoplayer.base.mvp1.BasePresenter;
-import org.yczbj.ycvideoplayer.base.mvp1.BaseView;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieBean;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieDetailBean;
-
-/**
- * Description:
- * Update:2018/1/2
- * CreatedTime:2017/12/29
- * Author:yc
- */
-
-public interface MovieDetailContract {
-
-    interface View extends BaseView {
-        void setAdapterData(MovieDetailBean movieDetailBean);
-        void setError();
-        void setEmptyView();
-    }
-
-    interface Presenter extends BasePresenter {
-        void getData(String dataId);
-    }
-
-
-}

+ 0 - 356
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/model/MovieBean.java

@@ -1,356 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.model;
-
-import java.util.List;
-
-/**
- * Created by yc on 2018/3/1.
- */
-
-public class MovieBean {
-
-    private String msg;
-    private RetBean ret;
-    private String code;
-
-    public String getMsg() {
-        return msg;
-    }
-
-    public void setMsg(String msg) {
-        this.msg = msg;
-    }
-
-    public RetBean getRet() {
-        return ret;
-    }
-
-    public void setRet(RetBean ret) {
-        this.ret = ret;
-    }
-
-    public String getCode() {
-        return code;
-    }
-
-    public void setCode(String code) {
-        this.code = code;
-    }
-
-    public static class RetBean {
-        private List<HotSearchListBean> hotSearchList;
-        private List<ListBean> list;
-
-        public List<HotSearchListBean> getHotSearchList() {
-            return hotSearchList;
-        }
-
-        public void setHotSearchList(List<HotSearchListBean> hotSearchList) {
-            this.hotSearchList = hotSearchList;
-        }
-
-        public List<ListBean> getList() {
-            return list;
-        }
-
-        public void setList(List<ListBean> list) {
-            this.list = list;
-        }
-
-        public static class HotSearchListBean {
-            /**
-             * refCounter : 1
-             * cnname : xingjichuanyue
-             * siteId : 1
-             * simplename : xjcy
-             * id : ff8080815a5f91db015a68a763b750d5
-             * tagName : 星际穿越
-             * createdtime : 2017-02-23 09:48:04
-             * enname :
-             */
-
-            private int refCounter;
-            private String cnname;
-            private String siteId;
-            private String simplename;
-            private String id;
-            private String tagName;
-            private String createdtime;
-            private String enname;
-
-            public int getRefCounter() {
-                return refCounter;
-            }
-
-            public void setRefCounter(int refCounter) {
-                this.refCounter = refCounter;
-            }
-
-            public String getCnname() {
-                return cnname;
-            }
-
-            public void setCnname(String cnname) {
-                this.cnname = cnname;
-            }
-
-            public String getSiteId() {
-                return siteId;
-            }
-
-            public void setSiteId(String siteId) {
-                this.siteId = siteId;
-            }
-
-            public String getSimplename() {
-                return simplename;
-            }
-
-            public void setSimplename(String simplename) {
-                this.simplename = simplename;
-            }
-
-            public String getId() {
-                return id;
-            }
-
-            public void setId(String id) {
-                this.id = id;
-            }
-
-            public String getTagName() {
-                return tagName;
-            }
-
-            public void setTagName(String tagName) {
-                this.tagName = tagName;
-            }
-
-            public String getCreatedtime() {
-                return createdtime;
-            }
-
-            public void setCreatedtime(String createdtime) {
-                this.createdtime = createdtime;
-            }
-
-            public String getEnname() {
-                return enname;
-            }
-
-            public void setEnname(String enname) {
-                this.enname = enname;
-            }
-        }
-
-        public static class ListBean {
-
-            private String showStyle;
-            private String loadType;
-            private String changeOpenFlag;
-            private int line;
-            private String showType;
-            private String moreURL;
-            private String title;
-            private String bigPicShowFlag;
-            private List<ChildListBean> childList;
-
-            public String getShowStyle() {
-                return showStyle;
-            }
-
-            public void setShowStyle(String showStyle) {
-                this.showStyle = showStyle;
-            }
-
-            public String getLoadType() {
-                return loadType;
-            }
-
-            public void setLoadType(String loadType) {
-                this.loadType = loadType;
-            }
-
-            public String getChangeOpenFlag() {
-                return changeOpenFlag;
-            }
-
-            public void setChangeOpenFlag(String changeOpenFlag) {
-                this.changeOpenFlag = changeOpenFlag;
-            }
-
-            public int getLine() {
-                return line;
-            }
-
-            public void setLine(int line) {
-                this.line = line;
-            }
-
-            public String getShowType() {
-                return showType;
-            }
-
-            public void setShowType(String showType) {
-                this.showType = showType;
-            }
-
-            public String getMoreURL() {
-                return moreURL;
-            }
-
-            public void setMoreURL(String moreURL) {
-                this.moreURL = moreURL;
-            }
-
-            public String getTitle() {
-                return title;
-            }
-
-            public void setTitle(String title) {
-                this.title = title;
-            }
-
-            public String getBigPicShowFlag() {
-                return bigPicShowFlag;
-            }
-
-            public void setBigPicShowFlag(String bigPicShowFlag) {
-                this.bigPicShowFlag = bigPicShowFlag;
-            }
-
-            public List<ChildListBean> getChildList() {
-                return childList;
-            }
-
-            public void setChildList(List<ChildListBean> childList) {
-                this.childList = childList;
-            }
-
-            public static class ChildListBean {
-                /**
-                 * airTime : 2012
-                 * duration : 02:03:46
-                 * loadType : video
-                 * score : 0
-                 * angleIcon : http://phonemovie.ks3-cn-beijing.ksyun.com/image/2017/05/09/1494296614609066838.png
-                 * dataId : e4871e503816456eb5ae84758d70d0dd
-                 * description : 21世纪末,人类的科技水平已高度发达,克隆人技术和宇宙航行早已实现,不再是梦想。与此同时,许多科学家仍孜孜不倦追索着人类起源的秘密与真相。通过对许多古老文明的考察与对比,科学家伊丽莎白·肖和查理·赫洛维发现,人类可能是来自一个遥远星系的外星人创造的。在Weyland公司资助下,他们乘坐维克丝所掌管的宇宙飞船普罗米修斯号前往那颗未知的星球。
-                 * loadURL : http://api.svipmovie.com/front/videoDetailApi/videoDetail.do?mediaId=e4871e503816456eb5ae84758d70d0dd
-                 * shareURL : http://m.svipmovie.com/#/moviedetails/e4871e503816456eb5ae84758d70d0dd
-                 * pic : http://phonemovie.ks3-cn-beijing.ksyun.com/image/2017/06/06/1496743562076010888.jpg
-                 * title : 恐怖异形起源之谜
-                 * roomId :
-                 */
-
-                private int airTime;
-                private String duration;
-                private String loadType;
-                private int score;
-                private String angleIcon;
-                private String dataId;
-                private String description;
-                private String loadURL;
-                private String shareURL;
-                private String pic;
-                private String title;
-                private String roomId;
-
-                public int getAirTime() {
-                    return airTime;
-                }
-
-                public void setAirTime(int airTime) {
-                    this.airTime = airTime;
-                }
-
-                public String getDuration() {
-                    return duration;
-                }
-
-                public void setDuration(String duration) {
-                    this.duration = duration;
-                }
-
-                public String getLoadType() {
-                    return loadType;
-                }
-
-                public void setLoadType(String loadType) {
-                    this.loadType = loadType;
-                }
-
-                public int getScore() {
-                    return score;
-                }
-
-                public void setScore(int score) {
-                    this.score = score;
-                }
-
-                public String getAngleIcon() {
-                    return angleIcon;
-                }
-
-                public void setAngleIcon(String angleIcon) {
-                    this.angleIcon = angleIcon;
-                }
-
-                public String getDataId() {
-                    return dataId;
-                }
-
-                public void setDataId(String dataId) {
-                    this.dataId = dataId;
-                }
-
-                public String getDescription() {
-                    return description;
-                }
-
-                public void setDescription(String description) {
-                    this.description = description;
-                }
-
-                public String getLoadURL() {
-                    return loadURL;
-                }
-
-                public void setLoadURL(String loadURL) {
-                    this.loadURL = loadURL;
-                }
-
-                public String getShareURL() {
-                    return shareURL;
-                }
-
-                public void setShareURL(String shareURL) {
-                    this.shareURL = shareURL;
-                }
-
-                public String getPic() {
-                    return pic;
-                }
-
-                public void setPic(String pic) {
-                    this.pic = pic;
-                }
-
-                public String getTitle() {
-                    return title;
-                }
-
-                public void setTitle(String title) {
-                    this.title = title;
-                }
-
-                public String getRoomId() {
-                    return roomId;
-                }
-
-                public void setRoomId(String roomId) {
-                    this.roomId = roomId;
-                }
-            }
-        }
-    }
-}

+ 0 - 586
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/model/MovieDetailBean.java

@@ -1,586 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.model;
-
-import java.util.List;
-
-/**
- * Created by yc on 2018/3/2.
- */
-
-public class MovieDetailBean {
-
-
-    /**
-     * msg : 成功
-     * ret
-     * code : 200
-     */
-
-    private String msg;
-    private RetBean ret;
-    private String code;
-
-    public String getMsg() {
-        return msg;
-    }
-
-    public void setMsg(String msg) {
-        this.msg = msg;
-    }
-
-    public RetBean getRet() {
-        return ret;
-    }
-
-    public void setRet(RetBean ret) {
-        this.ret = ret;
-    }
-
-    public String getCode() {
-        return code;
-    }
-
-    public void setCode(String code) {
-        this.code = code;
-    }
-
-    public static class RetBean {
-        /**
-         * couponNum : 0
-         * HDURL : http://movie.vods1.cnlive.com/3/vod/2017/0606/3_e4871e503816456eb5ae84758d70d0dd/ff8080815bf6b453015c7c7e5452120b_1500.m3u8
-         * downloadURL :
-         * description : 21世纪末,人类的科技水平已高度发达,克隆人技术和宇宙航行早已实现,不再是梦想。与此同时,许多科学家仍孜孜不倦追索着人类起源的秘密与真相。通过对许多古老文明的考察与对比,科学家伊丽莎白·肖和查理·赫洛维发现,人类可能是来自一个遥远星系的外星人创造的。在Weyland公司资助下,他们乘坐维克丝所掌管的宇宙飞船普罗米修斯号前往那颗未知的星球。
-         * pic : http://phonemovie.ks3-cn-beijing.ksyun.com/image/2018/02/16/1518786460711038815.jpg
-         * title : 普罗米修斯
-         * kuaiKan : false
-         * smoothURL : http://movie.vods1.cnlive.com/3/vod/2017/0606/3_e4871e503816456eb5ae84758d70d0dd/ff8080815bf6b453015c7c7e5452120b_400.m3u8
-         * duration : 02:03:46
-         * score : 0
-         * ticketContent : {"score":"0分","name":"三块广告牌","poster_url":"https://msdbpic-cos.wepiao.com/msdb/movie/p/img_cover/small/c61cf6e3e7abaa381638d0aa552ad4686703.jpg","id":"238404","version":"2D","url":"http://m.wepiao.com/movies/238404"}
-         * airTime : 2012
-         * fastDataId :
-         * ultraClearURL : http://movie.vods1.cnlive.com/3/vod/2017/0606/3_e4871e503816456eb5ae84758d70d0dd/ff8080815bf6b453015c7c7e5452120b_1500.m3u8
-         * director : 雷德利·斯科特
-         * videoType : 冒险,科幻,惊悚
-         * htmlURL : http://m.svipmovie.com/#/moviedetails/e4871e503816456eb5ae84758d70d0dd
-         * list
-         * SDURL : http://movie.vods1.cnlive.com/3/vod/2017/0606/3_e4871e503816456eb5ae84758d70d0dd/ff8080815bf6b453015c7c7e5452120b_800.m3u8
-         * actors : 劳米·拉佩斯 / 迈克尔·法斯宾德 / 查理兹·塞隆 / 伊德里斯·艾尔巴 / 盖·皮尔斯
-         * canWatchFlag : false
-         * adv : {"imgURL":"http://phonemovie.ks3-cn-beijing.ksyun.com/image/2018/03/02/1519955693461058585.jpg","dataId":"ff80808161d4dd470161e46be6496eaf","htmlURL":"http://www.iqiyi.com/v_19rrfg41d0.html","shareURL":"","title":"白夜侠"}
-         * collectionFalg : false
-         * lastPlayTime : 4
-         * region : 欧美
-         * vipFlag : false
-         */
-
-        private int couponNum;
-        private String HDURL;
-        private String downloadURL;
-        private String description;
-        private String pic;
-        private String title;
-        private String kuaiKan;
-        private String smoothURL;
-        private String duration;
-        private int score;
-        private TicketContentBean ticketContent;
-        private int airTime;
-        private String fastDataId;
-        private String ultraClearURL;
-        private String director;
-        private String videoType;
-        private String htmlURL;
-        private String SDURL;
-        private String actors;
-        private String canWatchFlag;
-        private AdvBean adv;
-        private String collectionFalg;
-        private String lastPlayTime;
-        private String region;
-        private String vipFlag;
-        private List<ListBean> list;
-
-        public int getCouponNum() {
-            return couponNum;
-        }
-
-        public void setCouponNum(int couponNum) {
-            this.couponNum = couponNum;
-        }
-
-        public String getHDURL() {
-            return HDURL;
-        }
-
-        public void setHDURL(String HDURL) {
-            this.HDURL = HDURL;
-        }
-
-        public String getDownloadURL() {
-            return downloadURL;
-        }
-
-        public void setDownloadURL(String downloadURL) {
-            this.downloadURL = downloadURL;
-        }
-
-        public String getDescription() {
-            return description;
-        }
-
-        public void setDescription(String description) {
-            this.description = description;
-        }
-
-        public String getPic() {
-            return pic;
-        }
-
-        public void setPic(String pic) {
-            this.pic = pic;
-        }
-
-        public String getTitle() {
-            return title;
-        }
-
-        public void setTitle(String title) {
-            this.title = title;
-        }
-
-        public String getKuaiKan() {
-            return kuaiKan;
-        }
-
-        public void setKuaiKan(String kuaiKan) {
-            this.kuaiKan = kuaiKan;
-        }
-
-        public String getSmoothURL() {
-            return smoothURL;
-        }
-
-        public void setSmoothURL(String smoothURL) {
-            this.smoothURL = smoothURL;
-        }
-
-        public String getDuration() {
-            return duration;
-        }
-
-        public void setDuration(String duration) {
-            this.duration = duration;
-        }
-
-        public int getScore() {
-            return score;
-        }
-
-        public void setScore(int score) {
-            this.score = score;
-        }
-
-        public TicketContentBean getTicketContent() {
-            return ticketContent;
-        }
-
-        public void setTicketContent(TicketContentBean ticketContent) {
-            this.ticketContent = ticketContent;
-        }
-
-        public int getAirTime() {
-            return airTime;
-        }
-
-        public void setAirTime(int airTime) {
-            this.airTime = airTime;
-        }
-
-        public String getFastDataId() {
-            return fastDataId;
-        }
-
-        public void setFastDataId(String fastDataId) {
-            this.fastDataId = fastDataId;
-        }
-
-        public String getUltraClearURL() {
-            return ultraClearURL;
-        }
-
-        public void setUltraClearURL(String ultraClearURL) {
-            this.ultraClearURL = ultraClearURL;
-        }
-
-        public String getDirector() {
-            return director;
-        }
-
-        public void setDirector(String director) {
-            this.director = director;
-        }
-
-        public String getVideoType() {
-            return videoType;
-        }
-
-        public void setVideoType(String videoType) {
-            this.videoType = videoType;
-        }
-
-        public String getHtmlURL() {
-            return htmlURL;
-        }
-
-        public void setHtmlURL(String htmlURL) {
-            this.htmlURL = htmlURL;
-        }
-
-        public String getSDURL() {
-            return SDURL;
-        }
-
-        public void setSDURL(String SDURL) {
-            this.SDURL = SDURL;
-        }
-
-        public String getActors() {
-            return actors;
-        }
-
-        public void setActors(String actors) {
-            this.actors = actors;
-        }
-
-        public String getCanWatchFlag() {
-            return canWatchFlag;
-        }
-
-        public void setCanWatchFlag(String canWatchFlag) {
-            this.canWatchFlag = canWatchFlag;
-        }
-
-        public AdvBean getAdv() {
-            return adv;
-        }
-
-        public void setAdv(AdvBean adv) {
-            this.adv = adv;
-        }
-
-        public String getCollectionFalg() {
-            return collectionFalg;
-        }
-
-        public void setCollectionFalg(String collectionFalg) {
-            this.collectionFalg = collectionFalg;
-        }
-
-        public String getLastPlayTime() {
-            return lastPlayTime;
-        }
-
-        public void setLastPlayTime(String lastPlayTime) {
-            this.lastPlayTime = lastPlayTime;
-        }
-
-        public String getRegion() {
-            return region;
-        }
-
-        public void setRegion(String region) {
-            this.region = region;
-        }
-
-        public String getVipFlag() {
-            return vipFlag;
-        }
-
-        public void setVipFlag(String vipFlag) {
-            this.vipFlag = vipFlag;
-        }
-
-        public List<ListBean> getList() {
-            return list;
-        }
-
-        public void setList(List<ListBean> list) {
-            this.list = list;
-        }
-
-        public static class TicketContentBean {
-            /**
-             * score : 0分
-             * name : 三块广告牌
-             * poster_url : https://msdbpic-cos.wepiao.com/msdb/movie/p/img_cover/small/c61cf6e3e7abaa381638d0aa552ad4686703.jpg
-             * id : 238404
-             * version : 2D
-             * url : http://m.wepiao.com/movies/238404
-             */
-
-            private String score;
-            private String name;
-            private String poster_url;
-            private String id;
-            private String version;
-            private String url;
-
-            public String getScore() {
-                return score;
-            }
-
-            public void setScore(String score) {
-                this.score = score;
-            }
-
-            public String getName() {
-                return name;
-            }
-
-            public void setName(String name) {
-                this.name = name;
-            }
-
-            public String getPoster_url() {
-                return poster_url;
-            }
-
-            public void setPoster_url(String poster_url) {
-                this.poster_url = poster_url;
-            }
-
-            public String getId() {
-                return id;
-            }
-
-            public void setId(String id) {
-                this.id = id;
-            }
-
-            public String getVersion() {
-                return version;
-            }
-
-            public void setVersion(String version) {
-                this.version = version;
-            }
-
-            public String getUrl() {
-                return url;
-            }
-
-            public void setUrl(String url) {
-                this.url = url;
-            }
-        }
-
-        public static class AdvBean {
-            /**
-             * imgURL : http://phonemovie.ks3-cn-beijing.ksyun.com/image/2018/03/02/1519955693461058585.jpg
-             * dataId : ff80808161d4dd470161e46be6496eaf
-             * htmlURL : http://www.iqiyi.com/v_19rrfg41d0.html
-             * shareURL :
-             * title : 白夜侠
-             */
-
-            private String imgURL;
-            private String dataId;
-            private String htmlURL;
-            private String shareURL;
-            private String title;
-
-            public String getImgURL() {
-                return imgURL;
-            }
-
-            public void setImgURL(String imgURL) {
-                this.imgURL = imgURL;
-            }
-
-            public String getDataId() {
-                return dataId;
-            }
-
-            public void setDataId(String dataId) {
-                this.dataId = dataId;
-            }
-
-            public String getHtmlURL() {
-                return htmlURL;
-            }
-
-            public void setHtmlURL(String htmlURL) {
-                this.htmlURL = htmlURL;
-            }
-
-            public String getShareURL() {
-                return shareURL;
-            }
-
-            public void setShareURL(String shareURL) {
-                this.shareURL = shareURL;
-            }
-
-            public String getTitle() {
-                return title;
-            }
-
-            public void setTitle(String title) {
-                this.title = title;
-            }
-        }
-
-        public static class ListBean {
-            /**
-             * showType : vertical
-             * childList
-             * title : 猜你喜欢
-             */
-
-            private String showType;
-            private String title;
-            private List<ChildListBean> childList;
-
-            public String getShowType() {
-                return showType;
-            }
-
-            public void setShowType(String showType) {
-                this.showType = showType;
-            }
-
-            public String getTitle() {
-                return title;
-            }
-
-            public void setTitle(String title) {
-                this.title = title;
-            }
-
-            public List<ChildListBean> getChildList() {
-                return childList;
-            }
-
-            public void setChildList(List<ChildListBean> childList) {
-                this.childList = childList;
-            }
-
-            public static class ChildListBean {
-                /**
-                 * airTime : 2015
-                 * duration : 01:52:15
-                 * loadtype : video
-                 * score : 0
-                 * angleIcon : http://phonemovie.ks3-cn-beijing.ksyun.com/image/2017/05/09/1494296614609066838.png
-                 * dataId : d459e58100af4e5aa6d6d09070442878
-                 * description : 未来世界,水资源短缺引发了连绵的战争。人们相互厮杀,争夺有限的资源,地球变成了血腥十足的杀戮死战场。面容恐怖的不死乔在戈壁山谷建立了难以撼动的强大武装王国,他手下的战郎驾驶装备尖端武器的战车四下抢掠,杀伐无度,甚至将自己的孩子打造成战争机器。在最近一次行动中,不死乔的得力战将弗瑞奥萨(查理兹·塞隆 Charlize Theron 饰)带着生育者们叛逃,这令不死乔恼羞成怒,发誓要追回生育者。经历了激烈的追逐战和摧毁力极强的沙尘暴,弗瑞奥萨和作为血主的麦克斯(汤姆·哈迪 Tom Hardy 饰)被迫上路,而身后不仅有不死乔的追兵,还有汽油镇、子弹农场的重兵追逐。
-                   末世战争,全面爆发……
-                 * loadURL : http://api.svipmovie.com/front/videoDetailApi/videoDetail.do?mediaId=d459e58100af4e5aa6d6d09070442878
-                 * shareURL : http://h5.svipmovie.com/bqdy/d459e58100af4e5aa6d6d09070442878.shtml?fromTo=shoujimovie
-                 * pic : http://phonemovie.ks3-cn-beijing.ksyun.com/image/2017/06/30/1498819818604078748.jpg
-                 * title : 疯狂的麦克斯4
-                 */
-
-                private int airTime;
-                private String duration;
-                private String loadtype;
-                private int score;
-                private String angleIcon;
-                private String dataId;
-                private String description;
-                private String loadURL;
-                private String shareURL;
-                private String pic;
-                private String title;
-
-                public int getAirTime() {
-                    return airTime;
-                }
-
-                public void setAirTime(int airTime) {
-                    this.airTime = airTime;
-                }
-
-                public String getDuration() {
-                    return duration;
-                }
-
-                public void setDuration(String duration) {
-                    this.duration = duration;
-                }
-
-                public String getLoadtype() {
-                    return loadtype;
-                }
-
-                public void setLoadtype(String loadtype) {
-                    this.loadtype = loadtype;
-                }
-
-                public int getScore() {
-                    return score;
-                }
-
-                public void setScore(int score) {
-                    this.score = score;
-                }
-
-                public String getAngleIcon() {
-                    return angleIcon;
-                }
-
-                public void setAngleIcon(String angleIcon) {
-                    this.angleIcon = angleIcon;
-                }
-
-                public String getDataId() {
-                    return dataId;
-                }
-
-                public void setDataId(String dataId) {
-                    this.dataId = dataId;
-                }
-
-                public String getDescription() {
-                    return description;
-                }
-
-                public void setDescription(String description) {
-                    this.description = description;
-                }
-
-                public String getLoadURL() {
-                    return loadURL;
-                }
-
-                public void setLoadURL(String loadURL) {
-                    this.loadURL = loadURL;
-                }
-
-                public String getShareURL() {
-                    return shareURL;
-                }
-
-                public void setShareURL(String shareURL) {
-                    this.shareURL = shareURL;
-                }
-
-                public String getPic() {
-                    return pic;
-                }
-
-                public void setPic(String pic) {
-                    this.pic = pic;
-                }
-
-                public String getTitle() {
-                    return title;
-                }
-
-                public void setTitle(String title) {
-                    this.title = title;
-                }
-            }
-        }
-    }
-}

+ 0 - 68
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/presenter/MovieDetailPresenter.java

@@ -1,68 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.presenter;
-
-import android.app.Activity;
-
-import org.yczbj.ycvideoplayer.api.http.movie.MovieModel;
-import org.yczbj.ycvideoplayer.ui.movie.contract.MovieContract;
-import org.yczbj.ycvideoplayer.ui.movie.contract.MovieDetailContract;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieBean;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieDetailBean;
-
-import io.reactivex.android.schedulers.AndroidSchedulers;
-import io.reactivex.disposables.CompositeDisposable;
-import io.reactivex.disposables.Disposable;
-import io.reactivex.functions.Consumer;
-import io.reactivex.schedulers.Schedulers;
-
-
-/**
- * Description:
- * Update:2018/1/2
- * CreatedTime:2017/12/29
- * Author:yc
- */
-
-public class MovieDetailPresenter implements MovieDetailContract.Presenter {
-
-    private MovieDetailContract.View mView;
-    private CompositeDisposable mSubscriptions;
-    private Activity activity;
-
-    public MovieDetailPresenter(MovieDetailContract.View androidView) {
-        this.mView = androidView;
-        mSubscriptions = new CompositeDisposable();
-    }
-
-    @Override
-    public void subscribe() {
-
-    }
-
-
-    @Override
-    public void unSubscribe() {
-        mSubscriptions.clear();
-        if(activity!=null){
-            activity = null;
-        }
-    }
-
-    @Override
-    public void getData(String dataId) {
-        MovieModel model = MovieModel.getInstance();
-        Disposable subscribe = model.getVideoInfo(dataId)
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new Consumer<MovieDetailBean>() {
-                    @Override
-                    public void accept(MovieDetailBean movieDetailBean) throws Exception {
-                        if(movieDetailBean!=null){
-                            mView.setAdapterData(movieDetailBean);
-                        }
-                    }
-                });
-        mSubscriptions.add(subscribe);
-    }
-
-
-}

+ 0 - 92
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/presenter/MoviePresenter.java

@@ -1,92 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.presenter;
-
-import android.app.Activity;
-import android.text.TextUtils;
-
-import org.reactivestreams.Subscription;
-import org.yczbj.ycvideoplayer.api.http.movie.MovieModel;
-import org.yczbj.ycvideoplayer.ui.movie.contract.MovieContract;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieBean;
-import org.yczbj.ycvideoplayer.util.LogUtils;
-
-import io.reactivex.Observable;
-import io.reactivex.Scheduler;
-import io.reactivex.android.schedulers.AndroidSchedulers;
-import io.reactivex.disposables.CompositeDisposable;
-import io.reactivex.disposables.Disposable;
-import io.reactivex.functions.Action;
-import io.reactivex.functions.Consumer;
-import io.reactivex.schedulers.Schedulers;
-
-
-/**
- * Description:
- * Update:2018/1/2
- * CreatedTime:2017/12/29
- * Author:yc
- */
-
-public class MoviePresenter implements MovieContract.Presenter {
-
-    private static final String TAG = "MoviePresenter";
-    private MovieContract.View mView;
-    private CompositeDisposable mSubscriptions;
-    private Activity activity;
-
-    public MoviePresenter(MovieContract.View androidView) {
-        this.mView = androidView;
-        mSubscriptions = new CompositeDisposable();
-    }
-
-    @Override
-    public void subscribe() {
-
-    }
-
-
-    @Override
-    public void unSubscribe() {
-        mSubscriptions.clear();
-        if(activity!=null){
-            activity = null;
-        }
-    }
-
-    @Override
-    public void getData() {
-        MovieModel model = MovieModel.getInstance();
-        Disposable subscribe = model.getHomePage()
-                //线程控制(也称为调度 / 切换),即讲解功能性操作符中的:subscribeOn() & observeOn()
-                //功能性操作符subscribeOn() & observeOn()作用
-                //线程控制,即指定 被观察者 (Observable) / 观察者(Observer) 的工作线程类型
-                // 1. 指定被观察者 生产事件的线程
-                .subscribeOn(Schedulers.io())
-                // 2. 指定观察者 接收 & 响应事件的线程
-                // 第一次指定观察者线程 = 主线程
-                .observeOn(AndroidSchedulers.mainThread())
-                // 3. 最后再通过订阅(subscribe)连接观察者和被观察者
-                .subscribe(new Consumer<MovieBean>() {
-                    @Override
-                    public void accept(MovieBean movieBean) throws Exception {
-                        LogUtils.e(TAG+"----"+"accept(MovieBean movieBean)");
-                        if (movieBean != null && movieBean.getRet() != null) {
-                            mView.setAdapterData(movieBean);
-                        }
-                    }
-                }, new Consumer<Throwable>() {
-                    @Override
-                    public void accept(Throwable throwable) throws Exception {
-                        LogUtils.e(TAG+"----"+"accept(Throwable throwable)");
-                    }
-                }, new Action() {
-                    @Override
-                    public void run() throws Exception {
-                        LogUtils.e(TAG+"----"+"run()");
-                    }
-                });
-        mSubscriptions.add(subscribe);
-    }
-
-
-
-}

+ 0 - 363
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/activity/MovieDetailActivity.java

@@ -1,363 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.view.activity;
-
-import android.annotation.SuppressLint;
-import android.content.Intent;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.annotation.Nullable;
-import android.support.design.widget.FloatingActionButton;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.blankj.utilcode.util.SizeUtils;
-import com.pedaily.yc.ycdialoglib.customToast.ToastUtil;
-
-import org.yczbj.ycrefreshviewlib.YCRefreshView;
-import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
-import org.yczbj.ycrefreshviewlib.item.RecycleViewItemLine;
-import org.yczbj.ycrefreshviewlib.item.SpaceViewItemLine;
-import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.base.mvp1.BaseActivity;
-import org.yczbj.ycvideoplayer.ui.home.model.VideoPlayerFavorite;
-import org.yczbj.ycvideoplayer.ui.home.view.adapter.NarrowImageAdapter;
-import org.yczbj.ycvideoplayer.ui.movie.contract.MovieDetailContract;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieDetailBean;
-import org.yczbj.ycvideoplayer.ui.movie.presenter.MovieDetailPresenter;
-import org.yczbj.ycvideoplayer.ui.movie.view.adapter.MovieDetailAdapter;
-import org.yczbj.ycvideoplayer.util.ImageUtil;
-import org.yczbj.ycvideoplayerlib.player.VideoPlayer;
-import org.yczbj.ycvideoplayerlib.constant.ConstantKeys;
-import org.yczbj.ycvideoplayerlib.inter.listener.OnVideoBackListener;
-import org.yczbj.ycvideoplayerlib.controller.VideoPlayerController;
-import org.yczbj.ycvideoplayerlib.manager.VideoPlayerManager;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import butterknife.BindView;
-
-
-/**
- * Created by yc on 2018/3/2
- *
- */
-
-public class MovieDetailActivity extends BaseActivity implements MovieDetailContract.View{
-
-
-    @BindView(R.id.video_player)
-    VideoPlayer videoPlayer;
-    @BindView(R.id.recyclerView)
-    YCRefreshView recyclerView;
-    @BindView(R.id.fab)
-    FloatingActionButton fab;
-
-    private MovieDetailAdapter adapter;
-
-    private MovieDetailContract.Presenter presenter = new MovieDetailPresenter(this);
-    private String dataId;
-    private VideoPlayerController controller;
-
-    private TextView tvPlayerCurriculum;
-    private View mContentView;
-    private TextView tvName;
-    private TextView tvType;
-    private TextView tvAuthor;
-    private TextView tvTime;
-    private TextView tvCity;
-    private ImageView ivImageAd;
-    private TextView tvTitleAd;
-
-    @Override
-    protected void onCreate(@Nullable Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        presenter.subscribe();
-    }
-
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        presenter.unSubscribe();
-    }
-
-
-    @Override
-    protected void onStop() {
-        super.onStop();
-        VideoPlayerManager.instance().releaseVideoPlayer();
-    }
-
-
-    @Override
-    public void onBackPressed() {
-        if (VideoPlayerManager.instance().onBackPressed()) {
-            return;
-        }
-        super.onBackPressed();
-    }
-
-
-    @Override
-    public int getContentView() {
-        return R.layout.base_video_view;
-    }
-
-
-    @Override
-    public void initView() {
-        fab.setVisibility(View.VISIBLE);
-        initIntentData();
-        initVideoPlayer();
-        initYCRefreshView();
-    }
-
-
-    private void initIntentData() {
-        Intent intent = getIntent();
-        dataId = intent.getStringExtra("dataId");
-    }
-
-
-    @Override
-    public void initListener() {
-        adapter.setOnItemClickListener(new RecyclerArrayAdapter.OnItemClickListener() {
-            @Override
-            public void onItemClick(int position) {
-                if(adapter.getAllData()!=null && adapter.getAllData().size()>0){
-                    Intent intent = new Intent(MovieDetailActivity.this, MovieDetailActivity.class);
-                    intent.putExtra("dataId",adapter.getAllData().get(position).getDataId());
-                    startActivity(intent);
-                }
-            }
-        });
-    }
-
-
-    @Override
-    public void initData() {
-        recyclerView.showProgress();
-        presenter.getData(dataId);
-    }
-
-
-    private void initVideoPlayer() {
-        //设置播放类型
-        videoPlayer.setPlayerType(ConstantKeys.IjkPlayerType.TYPE_IJK);
-        //网络视频地址
-        //设置视频地址和请求头部
-        //创建视频控制器
-        controller = new VideoPlayerController(this);
-        controller.setOnVideoBackListener(new OnVideoBackListener() {
-            @Override
-            public void onBackClick() {
-                onBackPressed();
-            }
-        });
-        //设置视频控制器
-        videoPlayer.setController(controller);
-        //是否从上一次的位置继续播放
-        videoPlayer.continueFromLastPosition(true);
-        //设置播放速度
-        videoPlayer.setSpeed(1.0f);
-    }
-
-
-    private void initYCRefreshView() {
-        recyclerView.setLayoutManager(new LinearLayoutManager(this));
-        final RecycleViewItemLine line = new RecycleViewItemLine(this, LinearLayout.HORIZONTAL,
-                SizeUtils.dp2px(1), Color.parseColor("#f5f5f7"));
-        recyclerView.addItemDecoration(line);
-        adapter = new MovieDetailAdapter(this);
-        recyclerView.setAdapter(adapter);
-        recyclerView.setRefreshing(false);
-        addHeader();
-    }
-
-
-    private void addHeader() {
-        if(adapter.getHeaderCount()>0){
-            adapter.removeAllHeader();
-        }
-        initVideoContentView();
-        initHorizontalView();
-        initHeaderTitle();
-    }
-
-
-    private void initVideoContentView() {
-        adapter.addHeader(new RecyclerArrayAdapter.ItemView() {
-            @Override
-            public View onCreateView(ViewGroup parent) {
-                mContentView = LayoutInflater.from(MovieDetailActivity.this).inflate
-                        (R.layout.head_video_player_content, parent, false);
-                return mContentView;
-            }
-
-            @Override
-            public void onBindView(View headerView) {
-                tvPlayerCurriculum = headerView.findViewById(R.id.tv_player_curriculum);
-                tvName = headerView.findViewById(R.id.tv_name);
-                tvType = headerView.findViewById(R.id.tv_type);
-                tvAuthor = headerView.findViewById(R.id.tv_author);
-                tvTime = headerView.findViewById(R.id.tv_time);
-                tvCity = headerView.findViewById(R.id.tv_city);
-                ivImageAd = headerView.findViewById(R.id.iv_image_ad);
-                tvTitleAd = headerView.findViewById(R.id.tv_title_ad);
-            }
-        });
-    }
-
-
-
-    private void initHorizontalView() {
-        adapter.addHeader(new RecyclerArrayAdapter.ItemView() {
-            @Override
-            public View onCreateView(ViewGroup parent) {
-                RecyclerView recyclerView = new RecyclerView(parent.getContext()){
-                    //为了不打扰横向RecyclerView的滑动操作,可以这样处理
-                    @SuppressLint("ClickableViewAccessibility")
-                    @Override
-                    public boolean onTouchEvent(MotionEvent event) {
-                        super.onTouchEvent(event);
-                        return true;
-                    }
-                };
-                RecyclerView.LayoutParams layoutParams = new RecyclerView.LayoutParams(
-                        ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
-                layoutParams.setMargins(SizeUtils.dp2px(10),SizeUtils.dp2px(5),
-                        SizeUtils.dp2px(10),SizeUtils.dp2px(5));
-                recyclerView.setLayoutParams(layoutParams);
-                final NarrowImageAdapter narrowAdapter;
-                recyclerView.setAdapter(narrowAdapter = new NarrowImageAdapter(parent.getContext()));
-                recyclerView.setLayoutManager(new LinearLayoutManager(parent.getContext(), LinearLayoutManager.HORIZONTAL,false));
-                recyclerView.addItemDecoration(new SpaceViewItemLine(SizeUtils.dp2px(8)));
-
-                narrowAdapter.setMore(R.layout.view_video_more_horizontal, new RecyclerArrayAdapter.OnLoadMoreListener() {
-                    @Override
-                    public void onLoadMore() {
-                        new Handler().postDelayed(new Runnable() {
-                            @Override
-                            public void run() {
-                                ToastUtil.showToast(MovieDetailActivity.this,"没有更多呢!");
-                            }
-                        },1000);
-                    }
-                });
-                List<VideoPlayerFavorite> favoriteList = new ArrayList<>();
-                for(int a=0 ; a<10 ; a++){
-                    VideoPlayerFavorite videoPlayerFavorite = new VideoPlayerFavorite(
-                            "这个是猜你喜欢的标题",R.drawable.bg_small_tree_min,"");
-                    favoriteList.add(videoPlayerFavorite);
-                }
-                narrowAdapter.addAll(favoriteList);
-                return recyclerView;
-            }
-
-            @Override
-            public void onBindView(View headerView) {
-                //这里的处理别忘了
-                ((ViewGroup)headerView).requestDisallowInterceptTouchEvent(true);
-            }
-        });
-    }
-
-
-    private void initHeaderTitle() {
-        adapter.addHeader(new RecyclerArrayAdapter.ItemView() {
-            @Override
-            public View onCreateView(ViewGroup parent) {
-                return LayoutInflater.from(MovieDetailActivity.this).inflate
-                        (R.layout.head_video_player_title, parent, false);
-            }
-
-            @Override
-            public void onBindView(View headerView) {
-                TextView tvPlayerTitle = headerView.findViewById(R.id.tv_player_title);
-                tvPlayerTitle.setText("热门推荐");
-            }
-        });
-    }
-
-
-
-    @SuppressLint({"SimpleDateFormat", "SetTextI18n"})
-    @Override
-    public void setAdapterData(MovieDetailBean movieDetailBean) {
-        if(movieDetailBean!=null && movieDetailBean.getRet()!=null){
-            MovieDetailBean.RetBean ret = movieDetailBean.getRet();
-            String hdUrl = ret.getHDURL();
-            videoPlayer.setUp(hdUrl,null);
-            controller.setTitle(ret.getTitle());
-            String duration = ret.getDuration();
-            controller.setLength(duration);
-            controller.setLoadingType(ConstantKeys.Loading.LOADING_QQ);
-
-            if(mContentView!=null){
-                tvPlayerCurriculum.setText(ret.getDescription());
-                tvName.setText("电影名称:"+ret.getTitle());
-                tvAuthor.setText("人物主演:"+ret.getActors());
-                tvType.setText("电影类型:"+ret.getVideoType());
-                tvTime.setText("放映时间:"+ret.getAirTime());
-                tvCity.setText("上映国家:"+ret.getRegion());
-
-                if(ret.getAdv()!=null){
-                    ImageUtil.loadImgByPicasso(MovieDetailActivity.this,
-                            ret.getAdv().getImgURL(),R.drawable.bg_small_autumn_tree_min,ivImageAd);
-                    tvTitleAd.setText(ret.getAdv().getTitle());
-                }else {
-                    ImageUtil.loadImgByPicasso(MovieDetailActivity.this,R.drawable.bg_small_autumn_tree_min,ivImageAd);
-                    tvTitleAd.setText("潇湘剑雨");
-                }
-            }
-
-
-            ImageUtil.loadImgByPicasso(this,ret.getPic(),controller.imageView());
-
-            List<MovieDetailBean.RetBean.ListBean.ChildListBean> mLists = new ArrayList<>();
-            List<MovieDetailBean.RetBean.ListBean> list = ret.getList();
-            if(list!=null && list.size()>0){
-                for(int a=0 ; a<list.size() ; a++){
-                    switch (list.get(a).getTitle()){
-                        case "猜你喜欢":
-                            mLists.addAll(list.get(a).getChildList());
-                            break;
-                        case "":
-                            mLists.addAll(list.get(a).getChildList());
-                            break;
-                        default:
-                            break;
-                    }
-                }
-            }
-            if(adapter==null){
-                adapter = new MovieDetailAdapter(this);
-            }else {
-                adapter.clear();
-            }
-            adapter.addAll(mLists);
-            adapter.notifyDataSetChanged();
-            recyclerView.showRecycler();
-        }
-    }
-
-    @Override
-    public void setError() {
-        recyclerView.showError();
-    }
-
-    @Override
-    public void setEmptyView() {
-        recyclerView.showEmpty();
-    }
-
-
-}

+ 0 - 68
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/activity/MovieNewsActivity.java

@@ -1,68 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.view.activity;
-
-import android.support.design.widget.TabLayout;
-import android.support.v4.app.Fragment;
-import android.support.v4.view.ViewPager;
-import com.blankj.utilcode.util.Utils;
-import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.base.BasePagerAdapter;
-import org.yczbj.ycvideoplayer.base.mvp1.BaseActivity;
-import org.yczbj.ycvideoplayer.ui.movie.view.fragment.MovieNewsFragment;
-import org.yczbj.ycvideoplayer.util.SettingUtil;
-import java.util.ArrayList;
-import java.util.List;
-
-import butterknife.BindView;
-
-/**
- * Created by yc on 2018/3/6.
- *
- */
-
-public class MovieNewsActivity extends BaseActivity {
-
-    @BindView(R.id.tab_layout)
-    TabLayout tabLayout;
-    @BindView(R.id.view_pager)
-    ViewPager viewPager;
-
-    private List<Fragment> fragmentList = new ArrayList<>();
-
-    @Override
-    public void onResume() {
-        super.onResume();
-        tabLayout.setBackgroundColor(SettingUtil.getInstance().getColor());
-    }
-
-    @Override
-    public int getContentView() {
-        return R.layout.base_tab_view;
-    }
-
-    @Override
-    public void initView() {
-        tabLayout.setupWithViewPager(viewPager);
-        tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
-        tabLayout.setBackgroundColor(SettingUtil.getInstance().getColor());
-        viewPager.setOffscreenPageLimit(3);
-    }
-
-    @Override
-    public void initListener() {
-
-    }
-
-    @Override
-    public void initData() {
-        String[] movieNews = Utils.getContext().getResources().getStringArray(R.array.movie_news);
-        ArrayList<String> title = new ArrayList<>();
-        for (int i = 0; i < movieNews.length; i++) {
-            Fragment fragment = MovieNewsFragment.newInstance(movieNews[i]);
-            fragmentList.add(fragment);
-            title.add(movieNews[i]);
-        }
-        BasePagerAdapter adapter = new BasePagerAdapter(getSupportFragmentManager(), fragmentList, title);
-        viewPager.setAdapter(adapter);
-    }
-
-}

+ 0 - 62
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/adapter/MovieAdapter.java

@@ -1,62 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.view.adapter;
-
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
-import org.yczbj.ycrefreshviewlib.viewHolder.BaseViewHolder;
-import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieBean;
-import org.yczbj.ycvideoplayer.util.ImageUtil;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-
-public class MovieAdapter extends RecyclerArrayAdapter<MovieBean.RetBean.ListBean.ChildListBean> {
-
-    public MovieAdapter(Activity activity) {
-        super(activity);
-    }
-
-    @Override
-    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
-        return new MovieViewHolder(parent);
-    }
-
-    public class MovieViewHolder extends BaseViewHolder<MovieBean.RetBean.ListBean.ChildListBean> {
-
-        @BindView(R.id.iv_image)
-        ImageView ivImage;
-        @BindView(R.id.tv_title)
-        TextView tvTitle;
-        @BindView(R.id.tv_time)
-        TextView tvTime;
-        @BindView(R.id.tv_duration)
-        TextView tvDuration;
-        @BindView(R.id.tv_content)
-        TextView tvContent;
-
-        MovieViewHolder(ViewGroup parent) {
-            super(parent, R.layout.item_movie_news);
-            ButterKnife.bind(this, itemView);
-        }
-
-        @SuppressLint("SetTextI18n")
-        @Override
-        public void setData(MovieBean.RetBean.ListBean.ChildListBean data) {
-            super.setData(data);
-            if (data != null) {
-                ImageUtil.loadImgByPicasso(getContext(), data.getPic(), R.drawable.image_default, ivImage);
-                tvTitle.setText(data.getTitle());
-                tvTime.setText("影片上映日期:" + data.getAirTime());
-                tvDuration.setText(data.getDuration());
-            }
-        }
-    }
-
-
-}

+ 0 - 54
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/adapter/MovieBannerAdapter.java

@@ -1,54 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.view.adapter;
-
-import android.content.Context;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-
-import com.yc.cn.ycbannerlib.first.adapter.StaticPagerAdapter;
-
-import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieBean;
-import org.yczbj.ycvideoplayer.util.ImageUtil;
-
-import java.util.List;
-
-/**
- * ================================================
- * 作    者:杨充
- * 版    本:1.0
- * 创建日期:2016/11/12
- * 描    述:会议轮播图适配器
- * 修订历史:
- * ================================================
- */
-public class MovieBannerAdapter extends StaticPagerAdapter {
-
-    private Context ctx;
-    private List<MovieBean.RetBean.ListBean.ChildListBean> list;
-
-    public MovieBannerAdapter(Context ctx, List<MovieBean.RetBean.ListBean.ChildListBean> list) {
-        this.ctx = ctx;
-        this.list = list;
-    }
-
-    @Override
-    public View getView(ViewGroup container, final int position) {
-        ImageView imageView = new ImageView(ctx);
-        imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
-        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
-        //加载图片
-        if(list!=null){
-            ImageUtil.loadImgByPicasso(ctx,list.get(position).getPic(), R.drawable.image_default,imageView);
-        }else {
-            ImageUtil.loadImgByPicasso(ctx, R.drawable.image_default,imageView);
-        }
-        return imageView;
-    }
-
-    @Override
-    public int getCount() {
-        return list==null ? 0 : list.size();
-    }
-
-}

+ 0 - 68
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/adapter/MovieDetailAdapter.java

@@ -1,68 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.view.adapter;
-
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
-import org.yczbj.ycrefreshviewlib.viewHolder.BaseViewHolder;
-import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieDetailBean;
-import org.yczbj.ycvideoplayer.util.ImageUtil;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-
-public class MovieDetailAdapter extends RecyclerArrayAdapter<MovieDetailBean.RetBean.ListBean.ChildListBean> {
-
-    public MovieDetailAdapter(Activity activity) {
-        super(activity);
-    }
-
-    @Override
-    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
-        return new MovieViewHolder(parent);
-    }
-
-    public class MovieViewHolder extends BaseViewHolder<MovieDetailBean.RetBean.ListBean.ChildListBean> {
-
-
-        @BindView(R.id.iv_movie_photo)
-        ImageView ivMoviePhoto;
-        @BindView(R.id.tv_movie_title)
-        TextView tvMovieTitle;
-        @BindView(R.id.tv_movie_directors)
-        TextView tvMovieDirectors;
-        @BindView(R.id.tv_movie_casts)
-        TextView tvMovieCasts;
-        @BindView(R.id.tv_movie_genres)
-        TextView tvMovieGenres;
-
-        MovieViewHolder(ViewGroup parent) {
-            super(parent, R.layout.item_movie_detail_news);
-            ButterKnife.bind(this, itemView);
-        }
-
-        @SuppressLint("SetTextI18n")
-        @Override
-        public void setData(MovieDetailBean.RetBean.ListBean.ChildListBean data) {
-            super.setData(data);
-            if (data != null) {
-                ImageUtil.loadImgByPicasso(getContext(), data.getPic(), R.drawable.image_default, ivMoviePhoto);
-                tvMovieTitle.setText(data.getTitle());
-                tvMovieDirectors.setText("潇湘剑雨");
-                tvMovieCasts.setText("时间"+data.getAirTime());
-                tvMovieGenres.setText(data.getDescription());
-            }
-        }
-
-
-    }
-
-
-}

+ 0 - 40
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/adapter/MovieNewsAdapter.java

@@ -1,40 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.view.adapter;
-
-import android.app.Activity;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
-import org.yczbj.ycrefreshviewlib.viewHolder.BaseViewHolder;
-import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.ui.special.model.SpecialBean;
-
-public class MovieNewsAdapter extends RecyclerArrayAdapter<SpecialBean> {
-
-    public MovieNewsAdapter(Activity activity) {
-        super(activity);
-    }
-
-    @Override
-    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
-        return new ExpressDeliveryViewHolder(parent);
-    }
-
-    private class ExpressDeliveryViewHolder extends BaseViewHolder<SpecialBean> {
-
-        ImageView iv_topic_face;
-        TextView tv_topic_name , tv_topic_tips ,tv_topic_comment , tv_topic_node ,tv_topic_title;
-
-        ExpressDeliveryViewHolder(ViewGroup parent) {
-            super(parent, R.layout.view_vlayout_news);
-
-        }
-
-        @Override
-        public void setData(SpecialBean data) {
-            super.setData(data);
-
-        }
-    }
-}

+ 0 - 351
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/fragment/MovieFragment.java

@@ -1,351 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.view.fragment;
-
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.widget.SwipeRefreshLayout;
-import android.support.v7.widget.LinearLayoutManager;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.LinearLayout;
-
-import com.blankj.utilcode.util.NetworkUtils;
-import com.blankj.utilcode.util.SizeUtils;
-import com.pedaily.yc.ycdialoglib.customToast.ToastUtil;
-import com.yc.cn.ycbannerlib.first.BannerView;
-import com.yc.cn.ycbannerlib.first.util.SizeUtil;
-
-import org.yczbj.ycrefreshviewlib.YCRefreshView;
-import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
-import org.yczbj.ycrefreshviewlib.item.RecycleViewItemLine;
-import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.base.mvp1.BaseFragment;
-import org.yczbj.ycvideoplayer.ui.main.view.activity.MainActivity;
-import org.yczbj.ycvideoplayer.ui.movie.contract.MovieContract;
-import org.yczbj.ycvideoplayer.ui.movie.model.MovieBean;
-import org.yczbj.ycvideoplayer.ui.movie.presenter.MoviePresenter;
-import org.yczbj.ycvideoplayer.ui.movie.view.activity.MovieNewsActivity;
-import org.yczbj.ycvideoplayer.ui.movie.view.adapter.MovieAdapter;
-import org.yczbj.ycvideoplayer.ui.movie.view.adapter.MovieBannerAdapter;
-import org.yczbj.ycvideoplayer.ui.movie.view.activity.MovieDetailActivity;
-import org.yczbj.ycvideoplayer.ui.test.test4.MediaPlayerActivity;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import butterknife.BindView;
-
-
-/**
- * Created by yc on 2018/3/1.
- *
- */
-public class MovieFragment extends BaseFragment implements MovieContract.View{
-
-    @BindView(R.id.recyclerView)
-    YCRefreshView recyclerView;
-    private MainActivity activity;
-    private MovieAdapter adapter;
-    private BannerView mBanner;
-
-    private MovieContract.Presenter presenter = new MoviePresenter(this);
-
-    @Override
-    public void onAttach(Context context) {
-        super.onAttach(context);
-        activity = (MainActivity) context;
-    }
-
-
-    @Override
-    public void onDetach() {
-        super.onDetach();
-        activity = null;
-    }
-
-
-    @Override
-    public void onPause() {
-        super.onPause();
-        if(mBanner!=null){
-            mBanner.pause();
-        }
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-        if(mBanner!=null){
-            mBanner.resume();
-        }
-    }
-
-
-    @Override
-    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
-        super.onViewCreated(view, savedInstanceState);
-        presenter.subscribe();
-    }
-
-
-    @Override
-    public void onDestroy() {
-        super.onDestroy();
-        presenter.unSubscribe();
-    }
-
-
-    @Override
-    public int getContentView() {
-        return R.layout.fragment_movie;
-    }
-
-    @Override
-    public void initView() {
-        initYCRefreshView();
-    }
-
-    @Override
-    public void initListener() {
-        adapter.setOnItemClickListener(new RecyclerArrayAdapter.OnItemClickListener() {
-            @Override
-            public void onItemClick(int position) {
-                if(adapter.getAllData()!=null && adapter.getAllData().size()>0){
-                    Intent intent = new Intent(activity, MovieDetailActivity.class);
-                    intent.putExtra("dataId",adapter.getAllData().get(position).getDataId());
-                    startActivity(intent);
-                }
-            }
-        });
-    }
-
-
-    @Override
-    public void initData() {
-        recyclerView.showProgress();
-        presenter.getData();
-    }
-
-
-    private void initYCRefreshView() {
-        recyclerView.setLayoutManager(new LinearLayoutManager(activity));
-        final RecycleViewItemLine line = new RecycleViewItemLine(activity, LinearLayout.HORIZONTAL,
-                SizeUtils.dp2px(1), Color.parseColor("#f5f5f7"));
-        recyclerView.addItemDecoration(line);
-        adapter = new MovieAdapter(activity);
-        recyclerView.setAdapter(adapter);
-        addHeader();
-        recyclerView.setRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
-            @Override
-            public void onRefresh() {
-                SwipeRefreshLayout swipeToRefresh = recyclerView.getSwipeToRefresh();
-                if(swipeToRefresh.isRefreshing()){
-                    recyclerView.setRefreshing(false);
-                }
-            }
-        });
-        //加载更多
-        adapter.setMore(R.layout.view_recycle_more, new RecyclerArrayAdapter.OnMoreListener() {
-            @Override
-            public void onMoreShow() {
-                if (NetworkUtils.isConnected()) {
-
-                } else {
-                    adapter.pauseMore();
-                    ToastUtil.showToast(activity,"网络不可用");
-                }
-            }
-
-            @Override
-            public void onMoreClick() {
-
-            }
-        });
-
-        //设置没有数据
-        adapter.setNoMore(R.layout.view_recycle_no_more, new RecyclerArrayAdapter.OnNoMoreListener() {
-            @Override
-            public void onNoMoreShow() {
-                if (NetworkUtils.isConnected()) {
-                    adapter.resumeMore();
-                } else {
-                    ToastUtil.showToast(activity,"网络不可用");
-                }
-            }
-
-            @Override
-            public void onNoMoreClick() {
-                if (NetworkUtils.isConnected()) {
-                    adapter.resumeMore();
-                } else {
-                    ToastUtil.showToast(activity,"网络不可用");
-                }
-            }
-        });
-
-        //设置错误
-        adapter.setError(R.layout.view_recycle_error, new RecyclerArrayAdapter.OnErrorListener() {
-            @Override
-            public void onErrorShow() {
-                adapter.resumeMore();
-            }
-
-            @Override
-            public void onErrorClick() {
-                adapter.resumeMore();
-            }
-        });
-    }
-
-
-    /**
-     * 添加头部
-     */
-    private void addHeader() {
-        if(adapter.getHeaderCount()!=0){
-            adapter.removeAllHeader();
-        }
-        initTopHeaderView();
-        initContentView();
-    }
-
-
-    private void initTopHeaderView() {
-        adapter.addHeader(new RecyclerArrayAdapter.ItemView() {
-            @Override
-            public View onCreateView(ViewGroup parent) {
-                return LayoutInflater.from(activity).inflate(R.layout.head_video_banner, parent, false);
-            }
-
-
-            @Override
-            public void onBindView(View headerView) {
-                View.OnClickListener listener = new View.OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        switch (v.getId()){
-                            case R.id.tv_special_first:
-                                startActivity(MediaPlayerActivity.class);
-                                break;
-                            case R.id.tv_special_second:
-                                startActivity(MovieNewsActivity.class);
-                                break;
-                            case R.id.tv_special_third:
-
-                                break;
-                            case R.id.tv_special_four:
-
-                                break;
-                            case R.id.tv_special_five:
-
-                                break;
-                            default:
-                                break;
-                        }
-                    }
-                };
-                headerView.findViewById(R.id.tv_special_first).setOnClickListener(listener);
-                headerView.findViewById(R.id.tv_special_second).setOnClickListener(listener);
-                headerView.findViewById(R.id.tv_special_third).setOnClickListener(listener);
-                headerView.findViewById(R.id.tv_special_four).setOnClickListener(listener);
-                headerView.findViewById(R.id.tv_special_five).setOnClickListener(listener);
-
-                // 绑定数据
-                mBanner = headerView.findViewById(R.id.banner);
-                mBanner.setHintGravity(5);
-                mBanner.setAnimationDuration(1000);
-                mBanner.setPlayDelay(2000);
-                mBanner.setHintPadding(0,0, SizeUtil.dip2px(activity,10), SizeUtil.dip2px(activity,10));
-            }
-        });
-    }
-
-
-    private void initContentView() {
-        adapter.addHeader(new RecyclerArrayAdapter.ItemView() {
-            @Override
-            public View onCreateView(ViewGroup parent) {
-                return LayoutInflater.from(activity).inflate(R.layout.head_video_content, parent, false);
-            }
-
-            @Override
-            public void onBindView(View headerView) {
-
-            }
-        });
-    }
-
-
-    @Override
-    public void setAdapterData(MovieBean movieBean) {
-        final List<MovieBean.RetBean.ListBean.ChildListBean> bannerList = new ArrayList<>();
-        List<MovieBean.RetBean.ListBean.ChildListBean> movieList = new ArrayList<>();
-        List<MovieBean.RetBean.ListBean> list = movieBean.getRet().getList();
-        List<MovieBean.RetBean.HotSearchListBean> hotSearchList = movieBean.getRet().getHotSearchList();
-        for (int a=0 ; a<list.size() ; a++){
-            switch (list.get(a).getTitle()){
-                case "Banner":
-                    bannerList.addAll(list.get(a).getChildList());
-                    break;
-                case "免费推荐":
-                    movieList.addAll(list.get(a).getChildList());
-                    break;
-                case "热点资讯":
-                    movieList.addAll(list.get(a).getChildList());
-                    break;
-                case "精彩推荐":
-                    movieList.addAll(list.get(a).getChildList());
-                    break;
-                case "大咖剧场":
-                    movieList.addAll(list.get(a).getChildList());
-                    break;
-                case "电影资讯":
-                    movieList.addAll(list.get(a).getChildList());
-                    break;
-                case "大片抢先看":
-                    movieList.addAll(list.get(a).getChildList());
-                    break;
-                case "微电影":
-                    movieList.addAll(list.get(a).getChildList());
-                    break;
-                case "香港映象":
-                    movieList.addAll(list.get(a).getChildList());
-                    break;
-                case "好莱坞":
-                    movieList.addAll(list.get(a).getChildList());
-                    break;
-                default:
-                    break;
-            }
-        }
-        if(bannerList.size()>0){
-            if(mBanner!=null){
-                mBanner.setAdapter(new MovieBannerAdapter(activity, bannerList));
-                mBanner.setOnBannerClickListener(new BannerView.OnBannerClickListener() {
-                    @Override
-                    public void onItemClick(int position) {
-                        if(bannerList.size()>0){
-                            Intent intent = new Intent(activity, MovieDetailActivity.class);
-                            intent.putExtra("dataId",bannerList.get(position).getDataId());
-                            startActivity(intent);
-                        }
-                    }
-                });
-            }
-        }
-        if(movieList.size()>0){
-            adapter.clear();
-            adapter.addAll(movieList);
-            adapter.notifyDataSetChanged();
-            recyclerView.showRecycler();
-        }else{
-            recyclerView.showEmpty();
-            recyclerView.setEmptyView(R.layout.view_custom_empty_data);
-        }
-    }
-
-
-}

+ 0 - 114
app/src/main/java/org/yczbj/ycvideoplayer/ui/movie/view/fragment/MovieNewsFragment.java

@@ -1,114 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.movie.view.fragment;
-
-import android.content.Context;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.support.v4.widget.SwipeRefreshLayout;
-import android.support.v7.widget.LinearLayoutManager;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.LinearLayout;
-
-import com.blankj.utilcode.util.SizeUtils;
-
-import org.yczbj.ycrefreshviewlib.YCRefreshView;
-import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
-import org.yczbj.ycrefreshviewlib.item.RecycleViewItemLine;
-import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.base.mvp1.BaseLazyFragment;
-import org.yczbj.ycvideoplayer.ui.movie.view.activity.MovieNewsActivity;
-import org.yczbj.ycvideoplayer.ui.movie.view.adapter.MovieNewsAdapter;
-import org.yczbj.ycvideoplayer.ui.video.view.adapter.VideoArticleAdapter;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-/**
- * Created by yc on 2018/3/6.
- */
-
-public class MovieNewsFragment extends BaseLazyFragment {
-
-    @BindView(R.id.recyclerView)
-    YCRefreshView recyclerView;
-
-    private static final String TAG = "MovieNewsFragment";
-    private MovieNewsActivity activity;
-    private MovieNewsAdapter adapter;
-
-    @Override
-    public void onAttach(Context context) {
-        super.onAttach(context);
-        activity = (MovieNewsActivity) context;
-    }
-
-    @Override
-    public void onDetach() {
-        super.onDetach();
-        activity = null;
-    }
-
-    public static MovieNewsFragment newInstance(String categoryId) {
-        Bundle bundle = new Bundle();
-        bundle.putString(TAG, categoryId);
-        MovieNewsFragment fragment = new MovieNewsFragment();
-        fragment.setArguments(bundle);
-        return fragment;
-    }
-
-
-    @Override
-    public int getContentView() {
-        return R.layout.base_easy_recycle;
-    }
-
-
-    @Override
-    public void initView() {
-        initRecyclerView();
-    }
-
-    @Override
-    public void initListener() {
-        adapter.setOnItemClickListener(new RecyclerArrayAdapter.OnItemClickListener() {
-            @Override
-            public void onItemClick(int position) {
-
-            }
-        });
-    }
-
-    @Override
-    public void initData() {
-
-    }
-
-    @Override
-    public void onLazyLoad() {
-
-    }
-
-
-    private void initRecyclerView() {
-        recyclerView.setLayoutManager(new LinearLayoutManager(activity));
-        final RecycleViewItemLine line = new RecycleViewItemLine(activity, LinearLayout.HORIZONTAL,
-                SizeUtils.dp2px(1), Color.parseColor("#f5f5f7"));
-        recyclerView.addItemDecoration(line);
-        adapter = new MovieNewsAdapter(activity);
-        recyclerView.setAdapter(adapter);
-        recyclerView.setRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
-            @Override
-            public void onRefresh() {
-                SwipeRefreshLayout swipeToRefresh = recyclerView.getSwipeToRefresh();
-                if (swipeToRefresh.isRefreshing()) {
-                    recyclerView.setRefreshing(false);
-                }
-            }
-        });
-    }
-
-
-
-
-}

+ 0 - 43
app/src/main/java/org/yczbj/ycvideoplayer/ui/news/view/adapter/NewsArticleAdapter.java

@@ -1,43 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.news.view.adapter;
-
-import android.app.Activity;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
-import org.yczbj.ycrefreshviewlib.viewHolder.BaseViewHolder;
-import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.ui.home.model.VideoPlayerComment;
-
-
-public class NewsArticleAdapter extends RecyclerArrayAdapter<VideoPlayerComment> {
-
-    public NewsArticleAdapter(Activity activity) {
-        super(activity);
-    }
-
-    @Override
-    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
-        return new VideoPlayerViewHolder(parent);
-    }
-
-
-    private class VideoPlayerViewHolder extends BaseViewHolder<VideoPlayerComment> {
-
-        ImageView iv_movie_photo;
-        TextView tv_movie_title , tv_movie_directors ,tv_movie_casts,tv_movie_genres ,tv_movie_rating_rate;
-        View view_color;
-
-        VideoPlayerViewHolder(ViewGroup parent) {
-            super(parent, R.layout.item_video_player_com);
-        }
-
-        @Override
-        public void setData(VideoPlayerComment data) {
-            super.setData(data);
-
-        }
-    }
-}

+ 1 - 1
app/src/main/java/org/yczbj/ycvideoplayer/ui/news/NewsFragment.java → app/src/main/java/org/yczbj/ycvideoplayer/ui/news/view/fragment/NewsFragment.java

@@ -1,4 +1,4 @@
-package org.yczbj.ycvideoplayer.ui.news;
+package org.yczbj.ycvideoplayer.ui.news.view.fragment;
 
 import android.content.Context;
 import android.support.design.widget.TabLayout;

+ 0 - 344
app/src/main/java/org/yczbj/ycvideoplayer/ui/special/SpecialFragment.java

@@ -1,344 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.special;
-
-import android.annotation.SuppressLint;
-import android.content.Context;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.annotation.Nullable;
-import android.support.v4.widget.SwipeRefreshLayout;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.util.TypedValue;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.blankj.utilcode.util.SizeUtils;
-import com.pedaily.yc.ycdialoglib.customToast.ToastUtil;
-import com.yc.cn.ycbannerlib.first.BannerView;
-import com.yc.cn.ycbannerlib.first.util.SizeUtil;
-
-import org.yczbj.ycrefreshviewlib.YCRefreshView;
-import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
-import org.yczbj.ycrefreshviewlib.item.RecycleViewItemLine;
-import org.yczbj.ycrefreshviewlib.item.SpaceViewItemLine;
-import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.base.mvp1.BaseFragment;
-import org.yczbj.ycvideoplayer.ui.home.model.VideoPlayerFavorite;
-import org.yczbj.ycvideoplayer.ui.home.view.adapter.BannerPagerAdapter;
-import org.yczbj.ycvideoplayer.ui.home.view.adapter.NarrowImageAdapter;
-import org.yczbj.ycvideoplayer.ui.main.view.activity.MainActivity;
-import org.yczbj.ycvideoplayer.ui.special.contract.SpecialContract;
-import org.yczbj.ycvideoplayer.ui.special.model.SpecialBean;
-import org.yczbj.ycvideoplayer.ui.special.presenter.SpecialPresenter;
-import org.yczbj.ycvideoplayer.ui.special.view.SpecialAdapter;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import butterknife.BindView;
-
-
-/**
- * Description:
- * Update:2018/1/2
- * CreatedTime:2017/12/29
- * Author:yc
- */
-public class SpecialFragment extends BaseFragment implements SpecialContract.View {
-
-
-    @BindView(R.id.recyclerView)
-    YCRefreshView recyclerView;
-    private MainActivity activity;
-
-    private SpecialContract.Presenter presenter = new SpecialPresenter(this);
-    private SpecialAdapter adapter;
-    private BannerView mBanner;
-
-    @Override
-    public void onAttach(Context context) {
-        super.onAttach(context);
-        activity = (MainActivity) context;
-    }
-
-    @Override
-    public void onDetach() {
-        super.onDetach();
-        activity = null;
-    }
-
-    @Override
-    public void onPause() {
-        super.onPause();
-        if(mBanner!=null){
-            mBanner.pause();
-        }
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-        if(mBanner!=null){
-            mBanner.resume();
-        }
-    }
-
-    @Override
-    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
-        super.onViewCreated(view, savedInstanceState);
-        presenter.subscribe();
-    }
-
-    @Override
-    public void onDestroy() {
-        super.onDestroy();
-        presenter.unSubscribe();
-    }
-
-    @Override
-    public int getContentView() {
-        return R.layout.base_easy_recycle;
-    }
-
-    @Override
-    public void initView() {
-        initYCRefreshView();
-    }
-
-
-    @Override
-    public void initListener() {
-        adapter.setOnItemClickListener(new RecyclerArrayAdapter.OnItemClickListener() {
-            @Override
-            public void onItemClick(int position) {
-
-            }
-        });
-    }
-
-    @Override
-    public void initData() {
-        recyclerView.showProgress();
-        presenter.getData();
-    }
-
-
-    private void initYCRefreshView() {
-        recyclerView.setLayoutManager(new LinearLayoutManager(activity));
-        final RecycleViewItemLine line = new RecycleViewItemLine(activity, LinearLayout.HORIZONTAL,
-                SizeUtils.dp2px(1), Color.parseColor("#f5f5f7"));
-        recyclerView.addItemDecoration(line);
-        adapter = new SpecialAdapter(activity);
-        recyclerView.setAdapter(adapter);
-        addHeader();
-        recyclerView.setRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
-            @Override
-            public void onRefresh() {
-                SwipeRefreshLayout swipeToRefresh = recyclerView.getSwipeToRefresh();
-                if (swipeToRefresh.isRefreshing()) {
-                    recyclerView.setRefreshing(false);
-                }
-            }
-        });
-    }
-
-
-    private void addHeader() {
-        adapter.removeAllHeader();
-        initTopHeaderView();
-        initVideoContentView();
-        initHeaderTitle();
-        initHorizontalView();
-        initBottomHeaderView();
-    }
-
-
-    private void initTopHeaderView() {
-        final ArrayList<String> arrayList = new ArrayList<>();
-        arrayList.add("http://bpic.wotucdn.com/11/66/23/55bOOOPIC3c_1024.jpg!/fw/780/quality/90/unsharp/true/compress/true/watermark/url/L2xvZ28ud2F0ZXIudjIucG5n/repeat/true");
-        arrayList.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1505470629546&di=194a9a92bfcb7754c5e4d19ff1515355&imgtype=0&src=http%3A%2F%2Fpics.jiancai.com%2Fimgextra%2Fimg01%2F656928666%2Fi1%2FT2_IffXdxaXXXXXXXX_%2521%2521656928666.jpg");
-        arrayList.add("http://bpic.wotucdn.com/11/66/23/55bOOOPIC3c_1024.jpg!/fw/780/quality/90/unsharp/true/compress/true/watermark/url/L2xvZ28ud2F0ZXIudjIucG5n/repeat/true");
-        arrayList.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1505470629546&di=194a9a92bfcb7754c5e4d19ff1515355&imgtype=0&src=http%3A%2F%2Fpics.jiancai.com%2Fimgextra%2Fimg01%2F656928666%2Fi1%2FT2_IffXdxaXXXXXXXX_%2521%2521656928666.jpg");
-        adapter.addHeader(new RecyclerArrayAdapter.ItemView() {
-            @Override
-            public View onCreateView(ViewGroup parent) {
-                return LayoutInflater.from(activity).inflate(R.layout.head_special_top_view,
-                        parent, false);
-            }
-
-
-            @Override
-            public void onBindView(View headerView) {
-                View.OnClickListener listener = new View.OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        switch (v.getId()){
-                            //启动单任务下载
-                            case R.id.tv_special_first:
-                                break;
-                            //多任务下载
-                            case R.id.tv_special_second:
-                                break;
-                            case R.id.tv_special_third:
-                                break;
-                            case R.id.tv_special_four:
-                                break;
-                            case R.id.tv_special_five:
-                                break;
-                            default:
-                                break;
-                        }
-                    }
-                };
-                headerView.findViewById(R.id.tv_special_first).setOnClickListener(listener);
-                headerView.findViewById(R.id.tv_special_second).setOnClickListener(listener);
-                headerView.findViewById(R.id.tv_special_third).setOnClickListener(listener);
-                headerView.findViewById(R.id.tv_special_four).setOnClickListener(listener);
-                headerView.findViewById(R.id.tv_special_five).setOnClickListener(listener);
-
-
-
-                // 绑定数据
-                mBanner = (BannerView) headerView.findViewById(R.id.banner);
-                mBanner.setHintGravity(2);
-                mBanner.setAnimationDuration(1000);
-                mBanner.setPlayDelay(3000);
-                mBanner.setHintPadding(0,0,0, SizeUtil.dip2px(activity,10));
-                mBanner.setAdapter(new BannerPagerAdapter(activity, arrayList));
-            }
-        });
-    }
-
-    private void initHeaderTitle() {
-        adapter.addHeader(new RecyclerArrayAdapter.ItemView() {
-            @Override
-            public View onCreateView(ViewGroup parent) {
-                return LayoutInflater.from(activity).inflate
-                        (R.layout.head_video_player_title, parent, false);
-            }
-
-            @Override
-            public void onBindView(View headerView) {
-                TextView tvPlayerTitle = (TextView) headerView.findViewById(R.id.tv_player_title);
-                tvPlayerTitle.setText("热门推荐");
-            }
-        });
-    }
-
-
-    private void initHorizontalView() {
-        adapter.addHeader(new RecyclerArrayAdapter.ItemView() {
-            @Override
-            public View onCreateView(ViewGroup parent) {
-                RecyclerView recyclerView = new RecyclerView(parent.getContext()) {
-                    //为了不打扰横向RecyclerView的滑动操作,可以这样处理
-                    @SuppressLint("ClickableViewAccessibility")
-                    @Override
-                    public boolean onTouchEvent(MotionEvent event) {
-                        super.onTouchEvent(event);
-                        return true;
-                    }
-                };
-                RecyclerView.LayoutParams layoutParams = new RecyclerView.LayoutParams(
-                        ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
-                layoutParams.setMargins(SizeUtils.dp2px(10), SizeUtils.dp2px(5),
-                        SizeUtils.dp2px(10), SizeUtils.dp2px(5));
-                recyclerView.setLayoutParams(layoutParams);
-                final NarrowImageAdapter narrowAdapter;
-                recyclerView.setAdapter(narrowAdapter = new NarrowImageAdapter(parent.getContext()));
-                recyclerView.setLayoutManager(new LinearLayoutManager(parent.getContext(), LinearLayoutManager.HORIZONTAL, false));
-                recyclerView.addItemDecoration(new SpaceViewItemLine(SizeUtils.dp2px(8)));
-
-                narrowAdapter.setMore(R.layout.view_video_more_horizontal, new RecyclerArrayAdapter.OnLoadMoreListener() {
-                    @Override
-                    public void onLoadMore() {
-                        new Handler().postDelayed(new Runnable() {
-                            @Override
-                            public void run() {
-                                ToastUtil.showToast(activity, "没有更多呢!");
-                            }
-                        }, 1000);
-                    }
-                });
-                List<VideoPlayerFavorite> favoriteList = new ArrayList<>();
-                for (int a = 0; a < 10; a++) {
-                    VideoPlayerFavorite videoPlayerFavorite = new VideoPlayerFavorite(
-                            "这个是猜你喜欢的标题", R.drawable.bg_small_tree_min, "");
-                    favoriteList.add(videoPlayerFavorite);
-
-                }
-                narrowAdapter.addAll(favoriteList);
-                return recyclerView;
-            }
-
-            @Override
-            public void onBindView(View headerView) {
-                //这里的处理别忘了
-                ((ViewGroup) headerView).requestDisallowInterceptTouchEvent(true);
-            }
-        });
-    }
-
-
-    private void initVideoContentView() {
-        adapter.addHeader(new RecyclerArrayAdapter.ItemView() {
-            @Override
-            public View onCreateView(ViewGroup parent) {
-                return LayoutInflater.from(activity).inflate
-                        (R.layout.head_video_player_content, parent, false);
-            }
-
-            @Override
-            public void onBindView(View headerView) {
-                TextView tvPlayerCurriculum = (TextView) headerView.findViewById(R.id.tv_player_curriculum);
-            }
-        });
-    }
-
-
-    private void initBottomHeaderView() {
-        adapter.addFooter(new RecyclerArrayAdapter.ItemView() {
-            @Override
-            public View onCreateView(ViewGroup parent) {
-                TextView tv = new TextView(activity);
-                tv.setLayoutParams(new ViewGroup.LayoutParams(
-                        ViewGroup.LayoutParams.MATCH_PARENT, SizeUtils.dp2px(36)));
-                tv.setGravity(Gravity.CENTER);
-                tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
-                tv.setText("哥们,已经没有数据了……");
-                return tv;
-            }
-
-            @Override
-            public void onBindView(View headerView) {
-
-            }
-        });
-    }
-
-
-    @SuppressWarnings("AlibabaAvoidManuallyCreateThread")
-    @Override
-    public void setAdapterView(List<SpecialBean> list) {
-        adapter.addAll(list);
-        adapter.notifyDataSetChanged();
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    Thread.sleep(2000);
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }finally {
-                    recyclerView.showRecycler();
-                }
-            }
-        });
-    }
-}

+ 0 - 28
app/src/main/java/org/yczbj/ycvideoplayer/ui/special/contract/SpecialContract.java

@@ -1,28 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.special.contract;
-
-
-import org.yczbj.ycvideoplayer.base.mvp1.BasePresenter;
-import org.yczbj.ycvideoplayer.base.mvp1.BaseView;
-import org.yczbj.ycvideoplayer.ui.special.model.SpecialBean;
-
-import java.util.List;
-
-/**
- * Description:
- * Update:2018/1/2
- * CreatedTime:2017/12/29
- * Author:yc
- */
-
-public interface SpecialContract {
-
-    interface View extends BaseView {
-        void setAdapterView(List<SpecialBean> list);
-    }
-
-    interface Presenter extends BasePresenter {
-        void getData();
-    }
-
-
-}

+ 0 - 62
app/src/main/java/org/yczbj/ycvideoplayer/ui/special/model/SpecialBean.java

@@ -1,62 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.special.model;
-
-/**
- * Created by yc on 2018/1/12.
- */
-
-public class SpecialBean {
-
-    private String title;
-    private String content;
-    private String time;
-    private String author;
-    private int id;
-
-    public SpecialBean(String title, String content, String time, String author, int id) {
-        this.title = title;
-        this.content = content;
-        this.time = time;
-        this.author = author;
-        this.id = id;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public String getContent() {
-        return content;
-    }
-
-    public void setContent(String content) {
-        this.content = content;
-    }
-
-    public String getTime() {
-        return time;
-    }
-
-    public void setTime(String time) {
-        this.time = time;
-    }
-
-    public String getAuthor() {
-        return author;
-    }
-
-    public void setAuthor(String author) {
-        this.author = author;
-    }
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-}

+ 0 - 57
app/src/main/java/org/yczbj/ycvideoplayer/ui/special/presenter/SpecialPresenter.java

@@ -1,57 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.special.presenter;
-
-import android.app.Activity;
-
-import org.yczbj.ycvideoplayer.ui.home.contract.HomeContract;
-import org.yczbj.ycvideoplayer.ui.special.contract.SpecialContract;
-import org.yczbj.ycvideoplayer.ui.special.model.SpecialBean;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import io.reactivex.disposables.CompositeDisposable;
-
-
-/**
- * Description:
- * Update:2018/1/2
- * CreatedTime:2017/12/29
- * Author:yc
- */
-
-public class SpecialPresenter implements SpecialContract.Presenter {
-
-    private SpecialContract.View mView;
-    private CompositeDisposable mSubscriptions;
-    private Activity activity;
-
-    public SpecialPresenter(SpecialContract.View androidView) {
-        this.mView = androidView;
-        mSubscriptions = new CompositeDisposable();
-    }
-
-    @Override
-    public void subscribe() {
-
-    }
-
-
-    @Override
-    public void unSubscribe() {
-        mSubscriptions.clear();
-        if(activity!=null){
-            activity = null;
-        }
-    }
-
-
-    @Override
-    public void getData() {
-        List<SpecialBean> list = new ArrayList<>();
-        for(int a=0 ; a<10 ; a++){
-            SpecialBean bean = new SpecialBean("title","content","time","author",0);
-            list.add(bean);
-        }
-        mView.setAdapterView(list);
-    }
-}

+ 0 - 41
app/src/main/java/org/yczbj/ycvideoplayer/ui/special/view/SpecialAdapter.java

@@ -1,41 +0,0 @@
-package org.yczbj.ycvideoplayer.ui.special.view;
-
-import android.app.Activity;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-
-import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
-import org.yczbj.ycrefreshviewlib.viewHolder.BaseViewHolder;
-import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.ui.special.model.SpecialBean;
-
-public class SpecialAdapter extends RecyclerArrayAdapter<SpecialBean> {
-
-    public SpecialAdapter(Activity activity) {
-        super(activity);
-    }
-
-    @Override
-    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
-        return new ExpressDeliveryViewHolder(parent);
-    }
-
-    private class ExpressDeliveryViewHolder extends BaseViewHolder<SpecialBean> {
-
-        ImageView iv_topic_face;
-        TextView tv_topic_name , tv_topic_tips ,tv_topic_comment , tv_topic_node ,tv_topic_title;
-
-        ExpressDeliveryViewHolder(ViewGroup parent) {
-            super(parent, R.layout.view_vlayout_news);
-
-        }
-
-        @Override
-        public void setData(SpecialBean data) {
-            super.setData(data);
-
-        }
-    }
-}

+ 2 - 9
app/src/main/java/org/yczbj/ycvideoplayer/ui/video/view/adapter/VideoArticleAdapter.java

@@ -8,9 +8,8 @@ import android.widget.TextView;
 import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
 import org.yczbj.ycrefreshviewlib.viewHolder.BaseViewHolder;
 import org.yczbj.ycvideoplayer.R;
-import org.yczbj.ycvideoplayer.ui.special.model.SpecialBean;
 
-public class VideoArticleAdapter extends RecyclerArrayAdapter<SpecialBean> {
+public class VideoArticleAdapter extends RecyclerArrayAdapter<String> {
 
     public VideoArticleAdapter(Activity activity) {
         super(activity);
@@ -21,7 +20,7 @@ public class VideoArticleAdapter extends RecyclerArrayAdapter<SpecialBean> {
         return new ExpressDeliveryViewHolder(parent);
     }
 
-    private class ExpressDeliveryViewHolder extends BaseViewHolder<SpecialBean> {
+    private class ExpressDeliveryViewHolder extends BaseViewHolder<String> {
 
         ImageView iv_topic_face;
         TextView tv_topic_name , tv_topic_tips ,tv_topic_comment , tv_topic_node ,tv_topic_title;
@@ -30,11 +29,5 @@ public class VideoArticleAdapter extends RecyclerArrayAdapter<SpecialBean> {
             super(parent, R.layout.view_vlayout_news);
 
         }
-
-        @Override
-        public void setData(SpecialBean data) {
-            super.setData(data);
-
-        }
     }
 }

+ 0 - 76
app/src/main/java/org/yczbj/ycvideoplayer/util/ImageCropUtils.java

@@ -1,76 +0,0 @@
-package org.yczbj.ycvideoplayer.util;
-
-import android.graphics.Bitmap;
-import android.graphics.Matrix;
-import android.util.Log;
-
-public class ImageCropUtils {
-
-
-    /**
-     * 按宽/高缩放图片到指定大小并进行裁剪得到中间部分图片
-     * @param bitmap 源bitmap
-     * @param w 缩放后指定的宽度
-     * @param h 缩放后指定的高度
-     * @return 缩放后的中间部分图片 Bitmap
-     */
-    public static Bitmap zoomBitmap(Bitmap bitmap, int w, int h) {
-        int width = bitmap.getWidth();
-        int height = bitmap.getHeight();
-        Log.i("TAG", "zoomBitmap---" + "width:" + width + "---" + "height:" + height);
-        float scaleWidht, scaleHeight, x, y;
-        Bitmap newbmp;
-        Matrix matrix = new Matrix();
-        if (width > height) {
-            scaleWidht = ((float) h / height);
-            scaleHeight = ((float) h / height);
-            // 获取bitmap源文件中x做表需要偏移的像数大小
-            x = (width - w * height / h) / 2;
-            y = 0;
-        } else if (width < height) {
-            scaleWidht = ((float) w / width);
-            scaleHeight = ((float) w / width);
-            x = 0;
-            // 获取bitmap源文件中y做表需要偏移的像数大小
-            y = (height - h * width / w) / 2;
-        } else {
-            scaleWidht = ((float) w / width);
-            scaleHeight = ((float) w / width);
-            x = 0;
-            y = 0;
-        }
-        matrix.postScale(scaleWidht, scaleHeight);
-        try {
-            // createBitmap()方法中定义的参数x+width要小于或等于bitmap.getWidth(),y+height要小于或等于bitmap.getHeight()
-            newbmp = Bitmap.createBitmap(bitmap, (int) x, (int) y, (int) (width - x), (int) (height - y), matrix, true);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return null;
-        }
-        return newbmp;
-    }
-
-
-    /**
-     * 裁剪图片
-     */
-    public static Bitmap cutBitmap(Bitmap bm){
-        Bitmap bitmap = null;
-        if(bm!=null){
-            //对图片的进行裁剪
-            if((bm.getWidth()*2)/5+(bm.getWidth()*3)/5 <= bm.getWidth()){
-                Matrix matrix = new Matrix();
-                //缩放比例
-                matrix.postScale(1, 1);
-                bitmap = Bitmap.createBitmap(bm,(bm.getWidth()*2)/5,0,(bm.getWidth()*3)/5,bm.getHeight(),matrix,true);
-                LogUtils.e("图片image1    "+bitmap.getWidth());
-            }else {
-                bitmap = Bitmap.createBitmap(bm,0,0,bm.getWidth(),bm.getHeight());
-                LogUtils.e("图片image2    "+bitmap.getWidth());
-            }
-        }
-        return bitmap;
-    }
-
-
-}

+ 0 - 227
app/src/main/java/org/yczbj/ycvideoplayer/util/OkHttpUtils.java

@@ -1,227 +0,0 @@
-package org.yczbj.ycvideoplayer.util;
-
-
-
-import org.yczbj.ycvideoplayer.api.http.utils.InterceptorUtils;
-import org.yczbj.ycvideoplayer.base.BaseInterceptor;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.FileNameMap;
-import java.net.URLConnection;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import okhttp3.Call;
-import okhttp3.Callback;
-import okhttp3.MediaType;
-import okhttp3.MultipartBody;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.RequestBody;
-import okhttp3.Response;
-
-/**
- * ================================================
- * 作    者:杨充
- * 版    本:1.0
- * 创建日期:2018/1/9
- * 描    述:http简单请求工具类[没有封装],只是作为分析源码基础,不建议使用
- * 修订历史:
- * ================================================
- */
-public class OkHttpUtils {
-
-    private static OkHttpClient client = null;
-
-    private OkHttpUtils() {}
-
-    /**
-     * 恶汉式单例
-     * @return                  返回OkHttpClient实例对象
-     */
-    public static OkHttpClient getInstance() {
-        if (client == null) {
-            synchronized (OkHttpUtils.class) {
-                if (client == null){
-                    client = new OkHttpClient.Builder()
-                            .addInterceptor(InterceptorUtils.getHttpLoggingInterceptor(true))
-                            .addInterceptor(new BaseInterceptor())
-                            .connectTimeout(15, TimeUnit.SECONDS)
-                            .writeTimeout(20, TimeUnit.SECONDS)
-                            .readTimeout(20, TimeUnit.SECONDS)
-                            .build();
-                }
-            }
-        }
-        return client;
-    }
-
-    /**
-     * 普通的get请求
-     * @param url               请求地址,比如:http://api.tianapi.com/social/?key=APIKEY&num=10
-     * @param callback          callback
-     *
-     *                          使用场景:比如投资界,新芽的新闻,数据等详情页面用get请求
-     */
-    @SuppressWarnings("AlibabaRemoveCommentedCode")
-    public static void getWebRequest(String url , Callback callback){
-        Request request = new Request.Builder()
-                .url(url)
-                .build();
-        Call call = getInstance().newCall(request);
-        call.enqueue(callback);
-
-
-        try {
-            Response response = client.newCall(request).execute();
-            // getInstance().newCall(request).enqueue(callback);
-            // Response response = getInstance().newCall(request).execute();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-
-
-    /**
-     * 普通的post请求
-     * @param url               请求地址,比如:http://api.tianapi.com/social/
-     * @param mapParams         请求参数,比如key=APIKEY;num=10;……
-     * @param callback          callback
-     *
-     *                          使用场景:比如投资界,新芽list页面用post请求
-     */
-    public static void postWebRequest(String url, Map<String, Object> mapParams, Callback callback){
-        StringBuilder sb = new StringBuilder();
-        for (String key :mapParams.keySet()) {
-            sb.append(key)
-                    .append("=")
-                    .append("")
-                    .append(mapParams.get(key))
-                    .append("&");
-        }
-        RequestBody requestBody = RequestBody.create(
-                MediaType.parse("application/x-www-form-urlencoded"),sb.toString());
-        Request request = new Request.Builder()
-                .url(url)
-                .post(requestBody)
-                .build();
-        Call call = getInstance().newCall(request);
-        call.enqueue(callback);
-    }
-
-
-    /**
-     * 普通post的json请求
-     * @param url               请求地址
-     * @param json              请求参数,json
-     * @param callback          callback
-     *
-     *                          使用场景,还没遇到过
-     */
-    public static void postJsonRequest(String url , String json , Callback callback){
-        RequestBody body = RequestBody.create(
-                MediaType.parse("application/json; charset=utf-8"), json);
-        Request request = new Request.Builder()
-                .url(url)
-                .post(body)
-                .build();
-        Call call = getInstance().newCall(request);
-        call.enqueue(callback);
-    }
-
-
-    /**
-     * 上传文件,post请求
-     * @param url               请求地址
-     * @param pathName          文件路径名称
-     * @param fileName          文件名
-     * @param callback          callback
-     */
-    public static void postUploadFile(String url, String pathName, String fileName, Callback callback) {
-        //判断文件类型
-        MediaType mediaType = MediaType.parse(judgeType(pathName));
-        //创建文件参数
-        MultipartBody.Builder builder ;
-        if (mediaType != null) {
-            builder = new MultipartBody.Builder()
-                    .setType(MultipartBody.FORM)
-                    .addFormDataPart(mediaType.type(), fileName,
-                                    RequestBody.create(mediaType, new File(pathName)));
-            //发出请求参数
-            Request request = new Request.Builder()
-                    .url(url)
-                    .post(builder.build())
-                    .build();
-            Call call = getInstance().newCall(request);
-            call.enqueue(callback);
-        }
-    }
-
-
-    /**
-     * 下载文件
-     * @param url               请求地址
-     * @param fileDir           父路径名字符串
-     * @param fileName          子路径名的字符串
-     */
-    public static void downFile(String url, final String fileDir, final String fileName) {
-        Request request = new Request.Builder()
-                .url(url)
-                .build();
-        Call call = getInstance().newCall(request);
-        call.enqueue(new Callback() {
-            @Override
-            public void onFailure(Call call, IOException e) {
-
-            }
-
-            @Override
-            public void onResponse(Call call, Response response) throws IOException {
-                InputStream is = null;
-                byte[] buf = new byte[2048];
-                int len ;
-                FileOutputStream fos = null;
-                try {
-                    //noinspection ConstantConditions
-                    is = response.body().byteStream();
-                    File file = new File(fileDir, fileName);
-                    fos = new FileOutputStream(file);
-                    while ((len = is.read(buf)) != -1) {
-                        fos.write(buf, 0, len);
-                    }
-                    fos.flush();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                } finally {
-                    if (is != null){
-                        is.close();
-                    }
-                    if (fos != null){
-                        fos.close();
-                    }
-                }
-            }
-        });
-
-    }
-
-
-    /**
-     * 根据文件路径判断MediaType
-     * @param path              文件路径
-     * @return                  返回字符串类型的文件类型
-     */
-    private static String judgeType(String path) {
-        FileNameMap fileNameMap = URLConnection.getFileNameMap();
-        String contentTypeFor = fileNameMap.getContentTypeFor(path);
-        if (contentTypeFor == null) {
-            contentTypeFor = "application/octet-stream";
-        }
-        return contentTypeFor;
-    }
-
-
-}

+ 0 - 226
app/src/main/java/org/yczbj/ycvideoplayer/util/ScreenCaptureUtils.java

@@ -1,226 +0,0 @@
-package org.yczbj.ycvideoplayer.util;
-
-
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Picture;
-import android.graphics.drawable.ColorDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.Build;
-import android.support.v7.widget.RecyclerView;
-import android.util.LruCache;
-import android.view.View;
-import android.webkit.WebView;
-import android.widget.ListAdapter;
-import android.widget.ListView;
-import android.widget.ScrollView;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * ================================================
- * 作    者:杨充
- * 版    本:1.0
- * 创建日期:2018/1/9
- * 描    述:截屏工具类
- * 修订历史:
- * ================================================
- */
-public class ScreenCaptureUtils {
-
-    /**
-     * 用状态是可转换的方式拍摄当前屏幕
-     * @param activity              上下文
-     * @return                      返回bitmap对象
-     */
-    public static Bitmap shotActivity(Activity activity) {
-        View view = activity.getWindow().getDecorView();
-        view.setDrawingCacheEnabled(true);
-        view.buildDrawingCache();
-        Bitmap bp = Bitmap.createBitmap(view.getDrawingCache(), 0, 0,
-                view.getMeasuredWidth(), view.getMeasuredHeight());
-        view.setDrawingCacheEnabled(false);
-        view.destroyDrawingCache();    return bp;
-    }
-
-
-    /**
-     * 获取当前View的DrawingCache
-     * @param v                     当前view对象
-     * @return                      返回bitmap对象
-     */
-    @SuppressLint("ObsoleteSdkInt")
-    public static Bitmap getViewBp(View v) {
-        if (null == v) {
-            return null;
-        }
-        v.setDrawingCacheEnabled(true);
-        v.buildDrawingCache();
-        if (Build.VERSION.SDK_INT >= 11) {
-            v.measure(View.MeasureSpec.makeMeasureSpec(v.getWidth(),
-                    View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(
-                    v.getHeight(), View.MeasureSpec.EXACTLY));
-            v.layout((int) v.getX(), (int) v.getY(),
-                    (int) v.getX() + v.getMeasuredWidth(),
-                    (int) v.getY() + v.getMeasuredHeight());
-        } else {
-            v.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
-                    View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
-            v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
-        }
-        Bitmap b = Bitmap.createBitmap(v.getDrawingCache(), 0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
-        v.setDrawingCacheEnabled(false);
-        v.destroyDrawingCache();
-        return b;
-    }
-
-    /**
-     * 在滚动视图中,如果当前View并没有在视图中全部绘制出来,我们可以利用View的ScrollTo()和ScrollBy()方法
-     * 来移动画布,同时获取当前View的可视部分的DrawingCache,最后进行拼接得到其Bitmap。
-     * 参考demo:https://github.com/PGSSoft/scrollscreenshot
-     */
-
-    /**
-     * ScrollView截屏
-     * ScrollView最简单,因为ScrollView只有一个childView,虽然没有全部显示在界面上,但是已经全部渲染绘制,
-     * 因此可以直接调用scrollView.draw(canvas)`来完成截图
-     * @param scrollView            scrollView对象
-     * @return                      返回bitmap对象
-     */
-    public static Bitmap shotScrollView(ScrollView scrollView) {
-        int h = 0;
-        Bitmap bitmap = null;
-        for (int i = 0; i < scrollView.getChildCount(); i++) {
-            h += scrollView.getChildAt(i).getHeight();
-            scrollView.getChildAt(i).setBackgroundColor(Color.parseColor("#ffffff"));
-        }
-        bitmap = Bitmap.createBitmap(scrollView.getWidth(), h, Bitmap.Config.RGB_565);
-        final Canvas canvas = new Canvas(bitmap);
-        scrollView.draw(canvas);
-        return bitmap;
-    }
-
-
-    /**
-     * ListView截屏
-     * 而ListView就是会回收与重用Item,并且只会绘制在屏幕上显示的ItemView,根据stackoverflow上大神的建议,
-     * 采用一个List来存储Item的视图,这种方案依然不够好,当Item足够多的时候,可能会发生oom。
-     * @param listView              ListView对象
-     * @return                      返回bitmap对象
-     */
-    public static Bitmap shotListView(ListView listView) {
-        ListAdapter adapter = listView.getAdapter();
-        int itemsCount = adapter.getCount();
-        int itemHeight = 0;
-        List<Bitmap> bmp = new ArrayList<>();
-        for (int i = 0; i < itemsCount; i++) {
-            View childView = adapter.getView(i, null, listView);
-            childView.measure(
-                    View.MeasureSpec.makeMeasureSpec(listView.getWidth(), View.MeasureSpec.EXACTLY),
-                    View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
-            childView.layout(0, 0, childView.getMeasuredWidth(), childView.getMeasuredHeight());
-            childView.setDrawingCacheEnabled(true);
-            childView.buildDrawingCache();
-            bmp.add(childView.getDrawingCache());
-            itemHeight += childView.getMeasuredHeight();
-        }
-        Bitmap bigBitmap =
-                Bitmap.createBitmap(listView.getMeasuredWidth(), itemHeight, Bitmap.Config.ARGB_8888);
-        Canvas bigCanvas = new Canvas(bigBitmap);
-        Paint paint = new Paint();
-        int iHeight = 0;
-        for (int i = 0; i < bmp.size(); i++) {
-            Bitmap bp = bmp.get(i);
-            bigCanvas.drawBitmap(bp, 0, iHeight, paint);
-            iHeight += bp.getHeight();
-            bp.recycle();
-            bp = null;
-        }
-        return bigBitmap;
-    }
-
-
-    /**
-     * RecyclerView截屏
-     * 在新的Android版本中,已经可以用RecyclerView来代替使用ListView的场景,相比较ListView,
-     * RecyclerView对Item View的缓存支持的更好。可以采用和ListView相同的方案,
-     * 这里也是在stackoverflow上看到的方案。
-     * @param view                  RecyclerView对象
-     * @return                      返回bitmap对象
-     */
-    public static Bitmap shotRecyclerView(RecyclerView view) {
-        RecyclerView.Adapter adapter = view.getAdapter();
-        Bitmap bigBitmap = null;
-        if (adapter != null) {
-            int size = adapter.getItemCount();
-            int height = 0;
-            Paint paint = new Paint();
-            int iHeight = 0;
-            final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
-            // Use 1/8th of the available memory for this memory cache.
-            final int cacheSize = maxMemory / 8;
-            LruCache<String, Bitmap> bitmaCache = new LruCache<>(cacheSize);
-            for (int i = 0; i < size; i++) {
-                RecyclerView.ViewHolder holder = adapter.createViewHolder(view, adapter.getItemViewType(i));
-                //noinspection unchecked
-                adapter.onBindViewHolder(holder, i);
-                holder.itemView.measure(
-                        View.MeasureSpec.makeMeasureSpec(view.getWidth(), View.MeasureSpec.EXACTLY),
-                        View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
-                holder.itemView.layout(0, 0, holder.itemView.getMeasuredWidth(),
-                        holder.itemView.getMeasuredHeight());
-                holder.itemView.setDrawingCacheEnabled(true);
-                holder.itemView.buildDrawingCache();
-                Bitmap drawingCache = holder.itemView.getDrawingCache();
-                if (drawingCache != null) {
-                    bitmaCache.put(String.valueOf(i), drawingCache);
-                }
-                height += holder.itemView.getMeasuredHeight();
-            }
-            bigBitmap = Bitmap.createBitmap(view.getMeasuredWidth(), height, Bitmap.Config.ARGB_8888);
-            Canvas bigCanvas = new Canvas(bigBitmap);
-            Drawable lBackground = view.getBackground();
-            if (lBackground instanceof ColorDrawable) {
-                ColorDrawable lColorDrawable = (ColorDrawable) lBackground;
-                int lColor = lColorDrawable.getColor();
-                bigCanvas.drawColor(lColor);
-            }
-            for (int i = 0; i < size; i++) {
-                Bitmap bitmap = bitmaCache.get(String.valueOf(i));
-                bigCanvas.drawBitmap(bitmap, 0f, iHeight, paint);
-                iHeight += bitmap.getHeight();
-                bitmap.recycle();
-            }
-        }
-        return bigBitmap;
-    }
-
-
-    /**
-     * Android5.0以下版本
-     * 对WebView进行截屏,虽然使用过期方法,
-     * 但在当前Android版本中测试可行
-     * @param webView               WebView控件
-     * @return                      返回bitmap对象
-     */
-    private static Bitmap captureWebViewKitKat(WebView webView) {
-        Picture picture = webView.capturePicture();
-        int width = picture.getWidth();
-        int height = picture.getHeight();
-        if (width > 0 && height > 0) {
-            Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
-            Canvas canvas = new Canvas(bitmap);
-            picture.draw(canvas);
-            return bitmap;
-        }
-        return null;
-    }
-
-
-}

+ 0 - 117
app/src/main/java/org/yczbj/ycvideoplayer/util/animation/AnimationViewUtil.java

@@ -1,117 +0,0 @@
-package org.yczbj.ycvideoplayer.util.animation;
-
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.view.ViewAnimationUtils;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-
-public class AnimationViewUtil {
-
-    private static final long PERFECT_MILLS = 618;
-
-
-    public static void startActivity(Activity thisActivity, Intent intent,
-                                     View triggerView, int colorOrImageRes) {
-        startActivity(thisActivity, intent, triggerView, colorOrImageRes, PERFECT_MILLS);
-    }
-
-    public static void startActivity(Activity thisActivity, Intent intent,
-                                     View triggerView, int colorOrImageRes, long durationMills) {
-        startActivityForResult(thisActivity, intent, null, null,
-                triggerView, colorOrImageRes, durationMills);
-    }
-
-
-    /**
-     * 从指定View开始向四周伸张(伸张颜色或图片为colorOrImageRes), 然后进入另一个Activity,
-     * 返回至 @thisActivity 后显示收缩动画。
-     */
-    @SuppressLint("NewApi")
-    public static void startActivityForResult(final Activity thisActivity, final Intent intent,
-                                              final Integer requestCode, final Bundle bundle,
-                                              final View triggerView, int colorOrImageRes,
-                                              long durationMills) {
-        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
-            thisActivity.startActivity(intent);
-            return;
-        }
-
-        int[] location = new int[2];
-        triggerView.getLocationInWindow(location);
-        final int cx = location[0] + triggerView.getWidth() / 2;
-        final int cy = location[1] + triggerView.getHeight() / 2;
-        final ImageView view = new ImageView(thisActivity);
-        view.setScaleType(ImageView.ScaleType.CENTER_CROP);
-        view.setImageResource(colorOrImageRes);
-        final ViewGroup decorView = (ViewGroup) thisActivity.getWindow().getDecorView();
-        int w = decorView.getWidth();
-        int h = decorView.getHeight();
-        decorView.addView(view, w, h);
-
-        // 计算中心点至view边界的最大距离
-        int maxW = Math.max(cx, w - cx);
-        int maxH = Math.max(cy, h - cy);
-        final int finalRadius = (int) Math.sqrt(maxW * maxW + maxH * maxH) + 1;
-        Animator
-                anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius);
-        int maxRadius = (int) Math.sqrt(w * w + h * h) + 1;
-        // 若使用默认时长,则需要根据水波扩散的距离来计算实际时间
-        if (durationMills == PERFECT_MILLS) {
-            // 算出实际边距与最大边距的比率
-            double rate = 1d * finalRadius / maxRadius;
-            // 水波扩散的距离与扩散时间成正比
-            durationMills = (long) (PERFECT_MILLS * rate);
-        }
-        final long finalDuration = durationMills;
-        anim.setDuration(finalDuration);
-        anim.addListener(new AnimatorListenerAdapter() {
-            @Override
-            public void onAnimationEnd(Animator animation) {
-                super.onAnimationEnd(animation);
-
-                if (requestCode == null)
-                    thisActivity.startActivity(intent);
-                else if (bundle == null)
-                    thisActivity.startActivityForResult(intent, requestCode);
-                else
-                    thisActivity.startActivityForResult(intent, requestCode, bundle);
-
-                // 默认渐隐过渡动画.
-                thisActivity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
-
-                // 默认显示返回至当前Activity的动画.
-                triggerView.postDelayed(new Runnable() {
-                    @Override
-                    public void run() {
-                        Animator anim =
-                                ViewAnimationUtils.createCircularReveal(view, cx, cy, finalRadius, 0);
-                        anim.setDuration(finalDuration);
-                        anim.addListener(new AnimatorListenerAdapter() {
-                            @Override
-                            public void onAnimationEnd(Animator animation) {
-                                super.onAnimationEnd(animation);
-                                try {
-                                    decorView.removeView(view);
-                                } catch (Exception e) {
-                                    e.printStackTrace();
-                                }
-                            }
-                        });
-                        anim.start();
-                    }
-                }, 1000);
-
-            }
-        });
-        anim.start();
-    }
-
-
-}

+ 0 - 179
app/src/main/java/org/yczbj/ycvideoplayer/util/animation/AnimationsUtils.java

@@ -1,179 +0,0 @@
-package org.yczbj.ycvideoplayer.util.animation;
-
-import android.view.View;
-import android.view.animation.AlphaAnimation;
-import android.view.animation.Animation;
-import android.view.animation.AnimationSet;
-import android.view.animation.AnticipateInterpolator;
-import android.view.animation.OvershootInterpolator;
-import android.view.animation.RotateAnimation;
-import android.view.animation.ScaleAnimation;
-import android.view.animation.TranslateAnimation;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-
-/**
- * ================================================
- * 作    者:杨充
- * 版    本:1.0
- * 创建日期:2017/4/31
- * 描    述:补间动画工具类
- * 修订历史:
- * ================================================
- */
-public class AnimationsUtils {
-
-    /**
-     * 旋转 Rotate
-     */
-    public static Animation getRotateAnimation(float fromDegrees, float toDegrees, long durationMillis) {
-        RotateAnimation rotate = new RotateAnimation(fromDegrees, toDegrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
-        rotate.setDuration(durationMillis);
-        rotate.setFillAfter(true);
-        return rotate;
-    }
-
-    /**
-     * 透明度 Alpha
-     */
-    public static Animation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis) {
-        AlphaAnimation alpha = new AlphaAnimation(fromAlpha, toAlpha);
-        //设置持续时间
-        alpha.setDuration(durationMillis);
-        //动画结束后保留结束状态
-        alpha.setFillAfter(true);
-        //添加差值器
-        //alpha.setInterpolator(new AccelerateInterpolator());
-        return alpha;
-    }
-
-    /**
-     * 缩放 Scale
-     */
-    public static Animation getScaleAnimation(float scaleXY, long durationMillis) {
-        ScaleAnimation scale = new ScaleAnimation(1.0f, scaleXY, 1.0f, scaleXY, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
-        scale.setDuration(durationMillis);
-        //scale.setFillAfter(true);
-        return scale;
-    }
-
-    /**
-     * 位移 Translate
-     */
-    public static Animation getTranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta, long durationMillis) {
-        TranslateAnimation translate = new TranslateAnimation(fromXDelta, toXDelta, fromYDelta, toYDelta);
-        translate.setDuration(durationMillis);
-        translate.setFillAfter(true);
-        return translate;
-    }
-
-    public static Animation clickAnimation(float scaleXY, long durationMillis) {
-        AnimationSet set = new AnimationSet(true);
-        set.addAnimation(getScaleAnimation(scaleXY, durationMillis));
-        set.setDuration(durationMillis);
-        return set;
-    }
-
-    public static Animation shakeAnimation(int X) {
-        AnimationSet set = new AnimationSet(true);
-        Animation anim1 = getTranslateAnimation(0, -200, 0, 0, 100);
-        anim1.setStartOffset(100);
-        set.addAnimation(anim1);
-        Animation anim2 = getTranslateAnimation(-200, 400, 0, 0, 200);
-        anim2.setStartOffset(300);
-        set.addAnimation(anim2);
-        Animation anim3 = getTranslateAnimation(400, -200, 0, 0, 200);
-        anim3.setStartOffset(500);
-        set.addAnimation(anim3);
-        Animation anim4 = getTranslateAnimation(-200, 0, 0, 0, 100);
-        anim4.setStartOffset(600);
-        set.addAnimation(anim4);
-        set.setFillAfter(true);
-        set.setDuration(640);
-        return set;
-    }
-
-    /**
-     * 打开的动画
-     * 
-     * @param relativeLayout
-     *            子菜单容器
-     * @param menu
-     *            菜单按钮
-     * @param durationMillis
-     *            动画时间
-     */
-    public static void openAnimation(RelativeLayout relativeLayout, ImageView menu, long durationMillis) {
-        relativeLayout.setVisibility(View.VISIBLE);
-        for (int i = 1; i < relativeLayout.getChildCount(); i++) {
-            ImageView imageView = null;
-            if (relativeLayout.getChildAt(i) instanceof ImageView) {
-                imageView = (ImageView) relativeLayout.getChildAt(i);
-            } else {
-                continue;
-            }
-            int top = imageView.getTop();
-            int left = imageView.getLeft();
-            if (top == 0) {
-                top = (menu.getHeight() + 50) * i;
-            }
-            if (left == 0) {
-                left = menu.getLeft();
-            }
-            AnimationSet set = new AnimationSet(true);
-            set.addAnimation(getRotateAnimation(-360, 0, durationMillis));
-            set.addAnimation(getAlphaAnimation(0.5f, 1.0f, durationMillis));
-            // 加30是由于图片上部有一些透明高度
-            set.addAnimation(getTranslateAnimation(menu.getLeft() - left, 0, menu.getTop() - top + 30, 0, durationMillis));
-            set.setFillAfter(true);
-            set.setDuration(durationMillis);
-            set.setStartOffset((i * 100) / (-1 + relativeLayout.getChildCount()));
-            set.setInterpolator(new OvershootInterpolator(1f));
-            imageView.startAnimation(set);
-        }
-    }
-
-    /**
-     * 关闭的动画
-     * 
-     * @param relativeLayout
-     *            子菜单容器
-     * @param menu
-     *            菜单按钮
-     * @param durationMillis
-     *            动画时间
-     */
-    public static void closeAnimation(final RelativeLayout relativeLayout, final ImageView menu, long durationMillis) {
-        for (int i = 1; i < relativeLayout.getChildCount(); i++) {
-            ImageView imageView = null;
-            if (relativeLayout.getChildAt(i) instanceof ImageView) {
-                imageView = (ImageView) relativeLayout.getChildAt(i);
-            } else {
-                continue;
-            }
-            AnimationSet set = new AnimationSet(true);
-            set.addAnimation(getRotateAnimation(0, -360, durationMillis));
-            set.addAnimation(getAlphaAnimation(1.0f, 0.5f, durationMillis));
-            // 加30是由于图片上部有一些透明高度
-            set.addAnimation(getTranslateAnimation(0, menu.getLeft() - imageView.getLeft(), 0, menu.getTop() - imageView.getTop() + 30, durationMillis));
-            set.setFillAfter(true);
-            set.setDuration(durationMillis);
-            set.setStartOffset(((relativeLayout.getChildCount() - i) * 100) / (-1 + relativeLayout.getChildCount()));
-            set.setInterpolator(new AnticipateInterpolator(1f));
-            set.setAnimationListener(new Animation.AnimationListener() {
-                @Override
-                public void onAnimationStart(Animation arg0) {}
-
-                @Override
-                public void onAnimationRepeat(Animation arg0) {}
-
-                @Override
-                public void onAnimationEnd(Animation arg0) {
-                    relativeLayout.setVisibility(View.GONE);
-                }
-            });
-            imageView.startAnimation(set);
-        }
-    }
-
-}

+ 0 - 105
app/src/main/java/org/yczbj/ycvideoplayer/util/animation/AnimatorUtils.java

@@ -1,105 +0,0 @@
-package org.yczbj.ycvideoplayer.util.animation;
-
-import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
-import android.view.View;
-import android.view.animation.LinearInterpolator;
-
-/**
- * ================================================
- * 作    者:杨充
- * 版    本:1.0
- * 创建日期:2017/9/31
- * 描    述:属性动画工具类
- * 修订历史:
- * ================================================
- */
-public class AnimatorUtils {
-
-
-    /**
-     * 设置属性动画ValueAnimator
-     * @param view                      view
-     * @param start                     开始值
-     * @param end                       结束值
-     * @param time                      运行时间
-     * @param delay                     延迟播放时间
-     * @param count                     重复播放次数
-     * @return                          ValueAnimator的对象
-     */
-    public static ValueAnimator setValueAnimator(View view , int start , int end , int time , int delay , int count){
-        // 步骤1:设置动画属性的初始值 & 结束值
-        //ValueAnimator.oFloat()采用默认的浮点型估值器 (FloatEvaluator)
-        //ValueAnimator.ofInt()采用默认的整型估值器(IntEvaluator)
-        ValueAnimator mAnimator = ValueAnimator.ofInt(start, end);
-        // ofInt()作用有两个
-        // 1. 创建动画实例
-        // 2. 将传入的多个Int参数进行平滑过渡:此处传入0和1,表示将值从0平滑过渡到1
-        // 如果传入了3个Int参数 a,b,c ,则是先从a平滑过渡到b,再从b平滑过渡到C,以此类推
-        // ValueAnimator.ofInt()内置了整型估值器,直接采用默认的.不需要设置,即默认设置了如何从初始值 过渡到 结束值
-        // 关于自定义插值器我将在下节进行讲解
-        // 下面看看ofInt()的源码分析 ->>关注1
-        mAnimator.setTarget(view);
-
-        // 步骤2:设置动画的播放各种属性
-        mAnimator.setDuration(time);
-        // 设置动画运行的时长
-
-        mAnimator.setStartDelay(delay);
-        // 设置动画延迟播放时间
-
-        mAnimator.setRepeatCount(count);
-        // 设置动画重复播放次数 = 重放次数+1
-        // 动画播放次数 = infinite时,动画无限重复
-
-        mAnimator.setRepeatMode(ValueAnimator.RESTART);
-        // 设置重复播放动画模式
-        // ValueAnimator.RESTART(默认):正序重放
-        // ValueAnimator.REVERSE:倒序回放
-
-        // 步骤3:将改变的值手动赋值给对象的属性值:通过动画的更新监听器
-        // 设置 值的更新监听器
-        // 即:值每次改变、变化一次,该方法就会被调用一次
-        return mAnimator;
-    }
-
-    /**
-     * 设置属性动画ObjectAnimator
-     * @param view                      操作对象
-     * @param type                      对象属性
-     * @param start                     开始值
-     * @param end                       结束值
-     * @param time                      运行时长
-     * @return                          返回ObjectAnimator对象
-     */
-    public static ObjectAnimator setObjectAnimator(View view , String type , int start , int end , long time , int delay){
-        ObjectAnimator mAnimator = ObjectAnimator.ofFloat(view, type, start, end);
-        // ofFloat()作用有两个
-        // 1. 创建动画实例
-        // 2. 参数设置:参数说明如下
-        // Object object:需要操作的对象
-        // String property:需要操作的对象的属性
-        // property属性值常见有:此处先展示四种基本变换:平移、旋转、缩放 & 透明度   translationX  rotation scaleX alpha
-        // float ....values:动画初始值 & 结束值(不固定长度)
-        // 若是两个参数a,b,则动画效果则是从属性的a值到b值
-        // 若是三个参数a,b,c,则则动画效果则是从属性的a值到b值再到c值
-        // 以此类推
-        // 至于如何从初始值 过渡到 结束值,同样是由估值器决定,此处ObjectAnimator.ofFloat()是有系统内置的浮点型估值器FloatEvaluator,同ValueAnimator讲解
-
-        // 设置动画重复播放次数 = 重放次数+1
-        // 动画播放次数 = infinite时,动画无限重复
-        mAnimator.setRepeatCount(ValueAnimator.INFINITE);
-        // 设置动画运行的时长
-        mAnimator.setDuration(time);
-        // 设置动画延迟播放时间
-        mAnimator.setStartDelay(delay);
-        // 设置重复播放动画模式
-        mAnimator.setRepeatMode(ValueAnimator.RESTART);
-        // ValueAnimator.RESTART(默认):正序重放
-        // ValueAnimator.REVERSE:倒序回放
-        //设置差值器
-        mAnimator.setInterpolator(new LinearInterpolator());
-        return mAnimator;
-    }
-
-}

+ 14 - 0
app/src/main/res/layout/view_vlayout_recycler.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="match_parent"
+    android:layout_height="150dp">
+
+    <android.support.v7.widget.RecyclerView
+        android:id="@+id/recyclerView"
+        android:layout_width="match_parent"
+        android:layout_height="150dp"/>
+
+
+</LinearLayout>

+ 0 - 3
app/src/main/res/values/array.xml

@@ -6,7 +6,6 @@
     <integer-array name="main_tab_un_select">
         <item name="tab_home">@drawable/tab_home_unselect</item>
         <item name="tab_news">@drawable/tab_speech_unselect</item>
-        <item name="tab_find">@drawable/tab_contact_unselect</item>
         <item name="tab_data">@drawable/tab_speech_unselect</item>
         <item name="tab_me">@drawable/tab_more_unselect</item>
     </integer-array>
@@ -15,7 +14,6 @@
     <integer-array name="main_tab_select">
         <item name="tab_home">@drawable/tab_home_select</item>
         <item name="tab_news">@drawable/tab_speech_select</item>
-        <item name="tab_find">@drawable/tab_contact_select</item>
         <item name="tab_data">@drawable/tab_speech_select</item>
         <item name="tab_me">@drawable/tab_more_select</item>
     </integer-array>
@@ -24,7 +22,6 @@
     <string-array name="main_title">
         <item>首页</item>
         <item>新闻</item>
-        <item>电影</item>
         <item>视频</item>
         <item>案例</item>
     </string-array>

+ 0 - 3
build.gradle

@@ -13,9 +13,6 @@ buildscript {
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:3.2.1'
-        classpath "io.realm:realm-gradle-plugin:5.8.0"
-        // NOTE: Do not place your application dependencies here; they belong
-        // in the individual module build.gradle files
         //添加下面两句,进行配置
         classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
         classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'

+ 15 - 0
read/wiki4.md

@@ -1,4 +1,19 @@
 # 视频封装思路
+#### 目录介绍
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 

+ 2 - 0
read/wiki5.md

@@ -1,6 +1,8 @@
 # 视频问题处理
 #### 目录介绍
 - 01.视频全屏播放崩溃
+- 02.
+
 
 
 #### 01.视频全屏播放崩溃