├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── gif │ │ │ │ └── video.gif │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── return_black.png │ │ │ │ ├── return_white.png │ │ │ │ ├── share_black.png │ │ │ │ ├── share_white.png │ │ │ │ ├── title_close.png │ │ │ │ ├── carousel_mask.png │ │ │ │ ├── jc_loading_bg.png │ │ │ │ ├── wangzhe_icon.jpeg │ │ │ │ └── video_player_seekbar_bg.png │ │ │ ├── drawable │ │ │ │ ├── shape_white.xml │ │ │ │ ├── shape_change_bg.xml │ │ │ │ └── shape_video_play.xml │ │ │ └── layout │ │ │ │ ├── item_video_layout.xml │ │ │ │ ├── fragment_video.xml │ │ │ │ ├── fragment_hero_des.xml │ │ │ │ ├── header_hero_detail_layout.xml │ │ │ │ ├── activity_main.xml │ │ │ │ └── jc_layout_15w.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── jke │ │ │ └── coordinatorlayoutdemo │ │ │ ├── HeroDesFragment.java │ │ │ ├── HeroDetailPagerAdapter.java │ │ │ ├── HeroVideoFragment.java │ │ │ ├── NoScrollViewPager.java │ │ │ ├── VideoListAdapter.java │ │ │ ├── MainActivity.java │ │ │ └── JCVideoPlayer15w.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── jke │ │ │ └── coordinatorlayoutdemo │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── jke │ │ └── coordinatorlayoutdemo │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── .idea ├── copyright │ └── profiles_settings.xml ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml ├── compiler.xml └── misc.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── README.md ├── gradle.properties ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/gif/video.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/gif/video.gif -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | coordinatorlayoutDemo 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/return_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/drawable-xxxhdpi/return_black.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/return_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/drawable-xxxhdpi/return_white.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/share_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/drawable-xxxhdpi/share_black.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/share_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/drawable-xxxhdpi/share_white.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/title_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/drawable-xxxhdpi/title_close.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/carousel_mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/drawable-xxxhdpi/carousel_mask.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/jc_loading_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/drawable-xxxhdpi/jc_loading_bg.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/wangzhe_icon.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/drawable-xxxhdpi/wangzhe_icon.jpeg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/video_player_seekbar_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jingkegit/coordinatorlayoutDemo/HEAD/app/src/main/res/drawable-xxxhdpi/video_player_seekbar_bg.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_white.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # coordinatorlayout tablayout 仿微博个人页 2 | ### coordinatorlayout 的使用,头部背景会随着滑动距离而不断加深,看效果图 3 | ### 接入JieCaoPlayer 支持列表播放 全屏播放 小窗口播放等 4 | 5 | ![image](https://github.com/jingkegit/coordinatorlayoutDemo/blob/master/app/src/main/res/gif/video.gif) 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_change_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_video_play.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Jun 18 11:28:22 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 45dp 5 | 250dp 6 | 50dp 7 | 155dp 8 | 9 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/test/java/com/jke/coordinatorlayoutdemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.jke.coordinatorlayoutdemo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | #fd591b 8 | #f2f3f7 9 | #666666 10 | #ffffff 11 | #333333 12 | #e0e0e0 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_video_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_video.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/jke/coordinatorlayoutdemo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.jke.coordinatorlayoutdemo; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.jke.coordinatorlayoutdemo", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/jke/coordinatorlayoutdemo/HeroDesFragment.java: -------------------------------------------------------------------------------- 1 | package com.jke.coordinatorlayoutdemo; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.webkit.WebView; 10 | 11 | /** 12 | * Describes tab1 首页 13 | * Created by 荆柯 on 2017/3/10. 14 | */ 15 | 16 | public class HeroDesFragment extends Fragment { 17 | 18 | @Nullable 19 | @Override 20 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 21 | View view = inflater.inflate(R.layout.fragment_hero_des,container,false); 22 | WebView webView = (WebView) view.findViewById(R.id.web_view); 23 | webView.loadUrl("http://news.17173.com/z/pvp/content/03192017/142316675.shtml"); 24 | return view; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_hero_des.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/jke/coordinatorlayoutdemo/HeroDetailPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.jke.coordinatorlayoutdemo; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by jke on 2017/4/7. 11 | */ 12 | 13 | public class HeroDetailPagerAdapter extends FragmentPagerAdapter { 14 | 15 | private List fragments; 16 | private String[] titles = {"英雄首页","视频集锦","玩家攻略"}; 17 | 18 | public HeroDetailPagerAdapter(FragmentManager fm, List fragments) { 19 | super(fm); 20 | this.fragments = fragments; 21 | } 22 | 23 | @Override 24 | public Fragment getItem(int position) { 25 | return fragments==null ? null : fragments.get(position); 26 | } 27 | 28 | @Override 29 | public int getCount() { 30 | return fragments==null? 0 : fragments.size(); 31 | } 32 | 33 | @Override 34 | public CharSequence getPageTitle(int position) { 35 | return titles[position]; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/jke/coordinatorlayoutdemo/HeroVideoFragment.java: -------------------------------------------------------------------------------- 1 | package com.jke.coordinatorlayoutdemo; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | /** 13 | * Describes tab2 视频 tab3 攻略 14 | * Created by 荆柯 on 2017/3/10. 15 | */ 16 | 17 | public class HeroVideoFragment extends Fragment { 18 | 19 | @Nullable 20 | @Override 21 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 22 | View view = inflater.inflate(R.layout.fragment_video,container,false); 23 | RecyclerView lv = (RecyclerView) view.findViewById(R.id.data_lv); 24 | lv.setLayoutManager(new LinearLayoutManager(getActivity())); 25 | VideoListAdapter adapter = new VideoListAdapter(getActivity()); 26 | lv.setAdapter(adapter); 27 | return view; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.3" 6 | defaultConfig { 7 | applicationId "com.jke.coordinatorlayoutdemo" 8 | minSdkVersion 15 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | compile 'com.android.support:appcompat-v7:25.3.1' 28 | // compile 'com.android.support.constraint:constraint-layout:1.0.2' 29 | testCompile 'junit:junit:4.12' 30 | compile 'com.android.support:design:25.3.1' 31 | // JcVideoplayer 32 | compile 'fm.jiecao:jiecaovideoplayer:4.6.3' 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/jke/coordinatorlayoutdemo/NoScrollViewPager.java: -------------------------------------------------------------------------------- 1 | package com.jke.coordinatorlayoutdemo; 2 | 3 | import android.content.Context; 4 | import android.support.v4.view.ViewPager; 5 | import android.util.AttributeSet; 6 | import android.view.MotionEvent; 7 | 8 | /** 9 | * Created by jke on 2017/4/10. 10 | */ 11 | 12 | public class NoScrollViewPager extends ViewPager { 13 | 14 | private boolean isCanScroll = true; 15 | 16 | public NoScrollViewPager(Context context) { 17 | super(context); 18 | } 19 | 20 | public NoScrollViewPager(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public void setNoScroll(boolean noScroll) { 25 | this.isCanScroll = noScroll; 26 | } 27 | 28 | @Override 29 | public void scrollTo(int x, int y) { 30 | super.scrollTo(x, y); 31 | } 32 | 33 | @Override 34 | public boolean onTouchEvent(MotionEvent arg0) { 35 | if (isCanScroll){ 36 | return false; 37 | }else{ 38 | return super.onTouchEvent(arg0); 39 | } 40 | } 41 | 42 | @Override 43 | public boolean onInterceptTouchEvent(MotionEvent arg0) { 44 | if (isCanScroll){ 45 | return false; 46 | }else{ 47 | return super.onInterceptTouchEvent(arg0); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/jke/coordinatorlayoutdemo/VideoListAdapter.java: -------------------------------------------------------------------------------- 1 | package com.jke.coordinatorlayoutdemo; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard; 10 | 11 | /** 12 | * Describes 13 | * Created by 荆柯 on 2017/3/10. 14 | */ 15 | 16 | public class VideoListAdapter extends RecyclerView.Adapter { 17 | 18 | private Context mContext; 19 | 20 | public VideoListAdapter(Context mContext) { 21 | this.mContext = mContext; 22 | } 23 | 24 | @Override 25 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 26 | View view = LayoutInflater.from(mContext).inflate(R.layout.item_video_layout,null); 27 | ViewHolder holder = new ViewHolder(view); 28 | return holder; 29 | } 30 | 31 | @Override 32 | public void onBindViewHolder(ViewHolder holder, final int position) { 33 | String url = "http://124.193.230.153/vhot2.qqvideo.tc.qq.com/e0332xoc6v2.mp4?vkey=115" + 34 | "DDC4AAE3DD487387016FCD9AB4F6B99650BD7A02DFB11" + 35 | "946B65446C4F5828F7D9972B4277E223E795E3A1AFF70338F39" + 36 | "1A2E6DD67A7C7362DE43F620F1E4FFF14187BEC5541DA3BDF9C5453C6A673E18B60DE0D008BBA"; 37 | holder.player.setUp(url, JCVideoPlayerStandard.SCREEN_LAYOUT_LIST, 38 | "王者荣耀诸葛亮五杀视频视频集锦"); 39 | } 40 | 41 | @Override 42 | public int getItemCount() { 43 | return 10; 44 | } 45 | 46 | 47 | public class ViewHolder extends RecyclerView.ViewHolder { 48 | private JCVideoPlayer15w player; 49 | 50 | public ViewHolder(View itemView) { 51 | super(itemView); 52 | player = (JCVideoPlayer15w) itemView.findViewById(R.id.player); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/res/layout/header_hero_detail_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | 24 | 33 | 46 | 47 | 48 | 55 | 63 | 69 | 76 | 83 | 89 | 90 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 17 | 21 | 22 | 27 | 28 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 53 | 54 | 58 | 59 | 66 | 67 | 75 | 76 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /app/src/main/java/com/jke/coordinatorlayoutdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.jke.coordinatorlayoutdemo; 2 | 3 | import android.graphics.Rect; 4 | import android.os.Bundle; 5 | import android.support.design.widget.AppBarLayout; 6 | import android.support.design.widget.TabLayout; 7 | import android.support.v4.app.Fragment; 8 | import android.support.v4.view.ViewPager; 9 | import android.support.v7.app.AppCompatActivity; 10 | import android.support.v7.widget.Toolbar; 11 | import android.util.Log; 12 | import android.view.View; 13 | import android.widget.ImageView; 14 | import android.widget.TextView; 15 | 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | public class MainActivity extends AppCompatActivity implements View.OnClickListener{ 20 | 21 | private Toolbar toolbar; 22 | private AppBarLayout appBarLayout; 23 | private TabLayout tabLayout; 24 | private ViewPager viewPager; 25 | private TextView toolBar_title; 26 | private ImageView back_img,share_img; 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.activity_main); 32 | initView(); 33 | } 34 | private void initView(){ 35 | toolbar = (Toolbar) findViewById(R.id.toolbar); 36 | appBarLayout = (AppBarLayout) findViewById(R.id.appBar_layout); 37 | tabLayout = (TabLayout) findViewById(R.id.tabs); 38 | viewPager = (ViewPager) findViewById(R.id.viewpager); 39 | toolBar_title = (TextView) findViewById(R.id.toolbar_title); 40 | back_img = (ImageView) findViewById(R.id.toolbar_back); 41 | back_img.setOnClickListener(this); 42 | share_img = (ImageView) findViewById(R.id.toolbar_share); 43 | share_img.setOnClickListener(this); 44 | // AppBarLayout 滑动距离监听 使ToolBar背景色渐变 45 | appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { 46 | @Override 47 | public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { 48 | Log.e("TAG","=====verticalOffset==="+verticalOffset); 49 | Rect rect = new Rect(); 50 | getWindow().getDecorView().getWindowVisibleDisplayFrame(rect); 51 | int statusHeight = rect.top; 52 | int endOffset = appBarLayout.getHeight()-toolbar.getHeight()-tabLayout.getHeight()- statusHeight; 53 | Log.e("TAG","=====height==="+endOffset); 54 | int startOffset = 0; 55 | int offset = Math.abs(verticalOffset); 56 | if (offset <= startOffset) { //alpha为0 57 | toolbar.getBackground().setAlpha(0); 58 | toolBar_title.setVisibility(View.GONE); 59 | Log.e("TAG","=====setAlpha===0"); 60 | } else if (offset > startOffset && offset < endOffset) { //alpha为0到255 61 | float precent = (float) (offset - startOffset) / endOffset; 62 | int alpha = Math.round(precent * 255); 63 | toolbar.getBackground().setAlpha(alpha); 64 | toolBar_title.setVisibility(View.GONE); 65 | if(alpha<=126){ 66 | back_img.setImageResource(R.drawable.return_white); 67 | share_img.setImageResource(R.drawable.share_white); 68 | }else{ 69 | back_img.setImageResource(R.drawable.return_black); 70 | share_img.setImageResource(R.drawable.share_black); 71 | } 72 | Log.e("TAG","=====setAlpha===precent"+alpha); 73 | } else if (offset >= endOffset) { //alpha为255 74 | toolbar.getBackground().setAlpha(255); 75 | toolBar_title.setVisibility(View.VISIBLE); 76 | back_img.setImageResource(R.drawable.return_black); 77 | share_img.setImageResource(R.drawable.share_black); 78 | Log.e("TAG","=====setAlpha===255"); 79 | } 80 | } 81 | }); 82 | // ViewPager 与 TabLayout 关联 83 | List fragments = new ArrayList<>(); 84 | HeroDesFragment desFragment = new HeroDesFragment(); 85 | HeroVideoFragment videoFragment = new HeroVideoFragment(); 86 | HeroVideoFragment strategyFragment = new HeroVideoFragment(); 87 | fragments.add(desFragment);fragments.add(videoFragment);fragments.add(strategyFragment); 88 | HeroDetailPagerAdapter adapter = new HeroDetailPagerAdapter(getSupportFragmentManager(),fragments); 89 | viewPager.setAdapter(adapter); 90 | tabLayout.setupWithViewPager(viewPager); 91 | } 92 | 93 | @Override 94 | public void onClick(View view) { 95 | switch (view.getId()){ 96 | case R.id.toolbar_back:// 返回 97 | finish(); 98 | break; 99 | case R.id.toolbar_share:// 分享 100 | break; 101 | } 102 | } 103 | 104 | @Override 105 | protected void onDestroy() { 106 | super.onDestroy(); 107 | JCVideoPlayer15w.releaseAllVideos(); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /app/src/main/res/layout/jc_layout_15w.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 13 | 14 | 27 | 28 | 41 | 42 | 51 | 52 | 60 | 61 | 73 | 74 | 81 | 82 | 90 | 91 | 92 | 100 | 101 | 109 | 110 | 117 | 118 | 125 | 126 | 135 | 136 | 137 | 145 | 146 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /app/src/main/java/com/jke/coordinatorlayoutdemo/JCVideoPlayer15w.java: -------------------------------------------------------------------------------- 1 | package com.jke.coordinatorlayoutdemo; 2 | 3 | import android.app.Activity; 4 | import android.app.AlertDialog; 5 | import android.app.Dialog; 6 | import android.content.Context; 7 | import android.content.DialogInterface; 8 | import android.text.TextUtils; 9 | import android.util.AttributeSet; 10 | import android.util.Log; 11 | import android.view.Gravity; 12 | import android.view.LayoutInflater; 13 | import android.view.MotionEvent; 14 | import android.view.View; 15 | import android.view.ViewGroup; 16 | import android.view.Window; 17 | import android.view.WindowManager; 18 | import android.widget.ImageView; 19 | import android.widget.ProgressBar; 20 | import android.widget.SeekBar; 21 | import android.widget.TextView; 22 | 23 | import java.util.Timer; 24 | import java.util.TimerTask; 25 | 26 | import fm.jiecao.jcvideoplayer_lib.JCBuriedPoint; 27 | import fm.jiecao.jcvideoplayer_lib.JCBuriedPointStandard; 28 | import fm.jiecao.jcvideoplayer_lib.JCMediaManager; 29 | import fm.jiecao.jcvideoplayer_lib.JCUtils; 30 | import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer; 31 | 32 | /** 33 | * Created by pc on 2017/2/6. 34 | */ 35 | 36 | public class JCVideoPlayer15w extends JCVideoPlayer { 37 | protected static Timer DISSMISS_CONTROL_VIEW_TIMER; 38 | 39 | public ImageView backButton; 40 | public ProgressBar bottomProgressBar, loadingProgressBar; 41 | public TextView titleTextView; 42 | public ImageView thumbImageView; 43 | public ImageView tinyBackImageView; 44 | private TextView video_time; 45 | 46 | private String videoUrl = ""; 47 | private Context mContext; 48 | 49 | protected JCVideoPlayer15w.DismissControlViewTimerTask mDismissControlViewTimerTask; 50 | 51 | 52 | public JCVideoPlayer15w(Context context) { 53 | super(context); 54 | mContext = context; 55 | } 56 | 57 | public JCVideoPlayer15w(Context context, AttributeSet attrs) { 58 | super(context, attrs); 59 | mContext = context; 60 | } 61 | 62 | @Override 63 | public void init(Context context) { 64 | super.init(context); 65 | bottomProgressBar = (ProgressBar) findViewById(R.id.bottom_progressbar); 66 | titleTextView = (TextView) findViewById(R.id.title); 67 | backButton = (ImageView) findViewById(R.id.back); 68 | thumbImageView = (ImageView) findViewById(R.id.thumb); 69 | loadingProgressBar = (ProgressBar) findViewById(R.id.loading); 70 | tinyBackImageView = (ImageView) findViewById(R.id.back_tiny); 71 | 72 | video_time = (TextView) findViewById(R.id.video_time); 73 | 74 | thumbImageView.setOnClickListener(this); 75 | backButton.setOnClickListener(this); 76 | tinyBackImageView.setOnClickListener(this); 77 | 78 | startButton.setOnClickListener(new StartButtonClickListener()); 79 | textureViewContainer = (ViewGroup) findViewById(R.id.surface_container); 80 | textureViewContainer.setOnClickListener(new ViewContainerClickListener()); 81 | } 82 | 83 | @Override 84 | public boolean setUp(String url, int screen, Object... objects) { 85 | if (objects.length == 0) return false; 86 | if (super.setUp(url, screen, objects)) { 87 | titleTextView.setText(objects[0].toString()); 88 | videoUrl = url; 89 | this.url = videoUrl; 90 | if (currentScreen == SCREEN_WINDOW_FULLSCREEN) { 91 | fullscreenButton.setImageResource(R.drawable.jc_shrink); 92 | backButton.setVisibility(View.VISIBLE); 93 | tinyBackImageView.setVisibility(View.INVISIBLE); 94 | } else if (currentScreen == SCREEN_LAYOUT_LIST) { 95 | fullscreenButton.setImageResource(R.drawable.jc_enlarge); 96 | backButton.setVisibility(View.GONE); 97 | tinyBackImageView.setVisibility(View.INVISIBLE); 98 | } else if (currentScreen == SCREEN_WINDOW_TINY) { 99 | tinyBackImageView.setVisibility(View.VISIBLE); 100 | setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, 101 | View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); 102 | } 103 | return true; 104 | } 105 | return false; 106 | } 107 | 108 | @Override 109 | public int getLayoutId() { 110 | return R.layout.jc_layout_15w; 111 | } 112 | 113 | @Override 114 | public void setUiWitStateAndScreen(int state) { 115 | super.setUiWitStateAndScreen(state); 116 | switch (currentState) { 117 | case CURRENT_STATE_NORMAL: 118 | changeUiToNormal(); 119 | break; 120 | case CURRENT_STATE_PREPAREING: 121 | changeUiToPrepareingShow(); 122 | startDismissControlViewTimer(); 123 | break; 124 | case CURRENT_STATE_PLAYING: 125 | changeUiToPlayingShow(); 126 | startDismissControlViewTimer(); 127 | break; 128 | case CURRENT_STATE_PAUSE: 129 | changeUiToPauseShow(); 130 | cancelDismissControlViewTimer(); 131 | break; 132 | case CURRENT_STATE_ERROR: 133 | changeUiToError(); 134 | break; 135 | case CURRENT_STATE_AUTO_COMPLETE: 136 | changeUiToCompleteShow(); 137 | cancelDismissControlViewTimer(); 138 | bottomProgressBar.setProgress(100); 139 | break; 140 | case CURRENT_STATE_PLAYING_BUFFERING_START: 141 | changeUiToPlayingBufferingShow(); 142 | break; 143 | } 144 | } 145 | 146 | @Override 147 | public boolean onTouch(View v, MotionEvent event) { 148 | int id = v.getId(); 149 | if (id == fm.jiecao.jcvideoplayer_lib.R.id.surface_container) { 150 | switch (event.getAction()) { 151 | case MotionEvent.ACTION_DOWN: 152 | break; 153 | case MotionEvent.ACTION_MOVE: 154 | break; 155 | case MotionEvent.ACTION_UP: 156 | startDismissControlViewTimer(); 157 | if (mChangePosition) { 158 | int duration = getDuration(); 159 | int progress = mSeekTimePosition * 100 / (duration == 0 ? 1 : duration); 160 | bottomProgressBar.setProgress(progress); 161 | } 162 | if (!mChangePosition && !mChangeVolume) { 163 | onEvent(JCBuriedPointStandard.ON_CLICK_BLANK); 164 | onClickUiToggle(); 165 | } 166 | break; 167 | } 168 | } else if (id == fm.jiecao.jcvideoplayer_lib.R.id.progress) { 169 | switch (event.getAction()) { 170 | case MotionEvent.ACTION_DOWN: 171 | cancelDismissControlViewTimer(); 172 | break; 173 | case MotionEvent.ACTION_UP: 174 | startDismissControlViewTimer(); 175 | break; 176 | } 177 | } 178 | return super.onTouch(v, event); 179 | } 180 | 181 | @Override 182 | public void onClick(View v) { 183 | super.onClick(v); 184 | int i = v.getId(); 185 | if (i == R.id.thumb) { 186 | if (currentState == CURRENT_STATE_NORMAL) { 187 | if (!url.startsWith("file") && !JCUtils.isWifiConnected(getContext()) && !WIFI_TIP_DIALOG_SHOWED) { 188 | showWifiDialog(); 189 | return; 190 | } 191 | if(!TextUtils.isEmpty(videoUrl)){ 192 | JCVideoPlayer.releaseAllVideos(); 193 | setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.INVISIBLE, 194 | View.VISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE); 195 | startPlayLocic(); 196 | } 197 | } else if (currentState == CURRENT_STATE_AUTO_COMPLETE) { 198 | onClickUiToggle(); 199 | } 200 | } else if (i == fm.jiecao.jcvideoplayer_lib.R.id.surface_container) { 201 | startDismissControlViewTimer(); 202 | } else if (i == fm.jiecao.jcvideoplayer_lib.R.id.back) { 203 | backPress(); 204 | } else if (i == fm.jiecao.jcvideoplayer_lib.R.id.back_tiny) { 205 | backPress(); 206 | } 207 | } 208 | 209 | @Override 210 | public void showWifiDialog() { 211 | super.showWifiDialog(); 212 | AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); 213 | builder.setMessage(getResources().getString(fm.jiecao.jcvideoplayer_lib.R.string.tips_not_wifi)); 214 | builder.setPositiveButton(getResources().getString(fm.jiecao.jcvideoplayer_lib.R.string.tips_not_wifi_confirm), new DialogInterface.OnClickListener() { 215 | @Override 216 | public void onClick(DialogInterface dialog, int which) { 217 | dialog.dismiss(); 218 | startPlayLocic(); 219 | WIFI_TIP_DIALOG_SHOWED = true; 220 | } 221 | }); 222 | builder.setNegativeButton(getResources().getString(fm.jiecao.jcvideoplayer_lib.R.string.tips_not_wifi_cancel), new DialogInterface.OnClickListener() { 223 | @Override 224 | public void onClick(DialogInterface dialog, int which) { 225 | dialog.dismiss(); 226 | } 227 | }); 228 | builder.create().show(); 229 | } 230 | 231 | @Override 232 | public void onStartTrackingTouch(SeekBar seekBar) { 233 | super.onStartTrackingTouch(seekBar); 234 | cancelDismissControlViewTimer(); 235 | } 236 | 237 | @Override 238 | public void onStopTrackingTouch(SeekBar seekBar) { 239 | super.onStopTrackingTouch(seekBar); 240 | startDismissControlViewTimer(); 241 | } 242 | 243 | public void startPlayLocic() { 244 | prepareVideo(); 245 | startDismissControlViewTimer(); 246 | onEvent(JCBuriedPointStandard.ON_CLICK_START_THUMB); 247 | } 248 | 249 | public void onClickUiToggle() { 250 | if (currentState == CURRENT_STATE_PREPAREING) { 251 | if (bottomContainer.getVisibility() == View.VISIBLE) { 252 | changeUiToPrepareingClear(); 253 | } else { 254 | changeUiToPrepareingShow(); 255 | } 256 | } else if (currentState == CURRENT_STATE_PLAYING) { 257 | if (bottomContainer.getVisibility() == View.VISIBLE) { 258 | changeUiToPlayingClear(); 259 | } else { 260 | changeUiToPlayingShow(); 261 | } 262 | } else if (currentState == CURRENT_STATE_PAUSE) { 263 | if (bottomContainer.getVisibility() == View.VISIBLE) { 264 | changeUiToPauseClear(); 265 | } else { 266 | changeUiToPauseShow(); 267 | } 268 | } else if (currentState == CURRENT_STATE_AUTO_COMPLETE) { 269 | if (bottomContainer.getVisibility() == View.VISIBLE) { 270 | changeUiToCompleteClear(); 271 | } else { 272 | changeUiToCompleteShow(); 273 | } 274 | } else if (currentState == CURRENT_STATE_PLAYING_BUFFERING_START) { 275 | if (bottomContainer.getVisibility() == View.VISIBLE) { 276 | changeUiToPlayingBufferingClear(); 277 | } else { 278 | changeUiToPlayingBufferingShow(); 279 | } 280 | } 281 | } 282 | 283 | @Override 284 | public void setProgressAndTime(int progress, int secProgress, int currentTime, int totalTime) { 285 | super.setProgressAndTime(progress, secProgress, currentTime, totalTime); 286 | if (progress != 0) bottomProgressBar.setProgress(progress); 287 | if (secProgress != 0) bottomProgressBar.setSecondaryProgress(secProgress); 288 | } 289 | 290 | @Override 291 | public void resetProgressAndTime() { 292 | super.resetProgressAndTime(); 293 | bottomProgressBar.setProgress(0); 294 | bottomProgressBar.setSecondaryProgress(0); 295 | } 296 | 297 | //Unified management Ui 298 | public void changeUiToNormal() { 299 | switch (currentScreen) { 300 | case SCREEN_LAYOUT_LIST: 301 | setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.VISIBLE, 302 | View.INVISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE); 303 | updateStartImage(); 304 | break; 305 | case SCREEN_WINDOW_FULLSCREEN: 306 | setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.VISIBLE, 307 | View.INVISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE); 308 | updateStartImage(); 309 | break; 310 | case SCREEN_WINDOW_TINY: 311 | break; 312 | } 313 | } 314 | 315 | public void changeUiToPrepareingShow() { 316 | switch (currentScreen) { 317 | case SCREEN_LAYOUT_LIST: 318 | setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.INVISIBLE, 319 | View.VISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE); 320 | break; 321 | case SCREEN_WINDOW_FULLSCREEN: 322 | setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.INVISIBLE, 323 | View.VISIBLE, View.VISIBLE, View.VISIBLE, View.INVISIBLE); 324 | break; 325 | case SCREEN_WINDOW_TINY: 326 | break; 327 | } 328 | 329 | } 330 | 331 | public void changeUiToPrepareingClear() { 332 | switch (currentScreen) { 333 | case SCREEN_LAYOUT_LIST: 334 | setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, 335 | View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE); 336 | break; 337 | case SCREEN_WINDOW_FULLSCREEN: 338 | setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, 339 | View.VISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE); 340 | break; 341 | case SCREEN_WINDOW_TINY: 342 | break; 343 | } 344 | 345 | } 346 | 347 | public void changeUiToPlayingShow() { 348 | switch (currentScreen) { 349 | case SCREEN_LAYOUT_LIST: 350 | setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE, 351 | View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); 352 | updateStartImage(); 353 | break; 354 | case SCREEN_WINDOW_FULLSCREEN: 355 | setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE, 356 | View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); 357 | updateStartImage(); 358 | break; 359 | case SCREEN_WINDOW_TINY: 360 | break; 361 | } 362 | 363 | } 364 | 365 | public void changeUiToPlayingClear() { 366 | switch (currentScreen) { 367 | case SCREEN_LAYOUT_LIST: 368 | setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, 369 | View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE); 370 | break; 371 | case SCREEN_WINDOW_FULLSCREEN: 372 | setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, 373 | View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE); 374 | break; 375 | case SCREEN_WINDOW_TINY: 376 | break; 377 | } 378 | 379 | } 380 | 381 | public void changeUiToPauseShow() { 382 | switch (currentScreen) { 383 | case SCREEN_LAYOUT_LIST: 384 | setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE, 385 | View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); 386 | updateStartImage(); 387 | break; 388 | case SCREEN_WINDOW_FULLSCREEN: 389 | setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE, 390 | View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); 391 | updateStartImage(); 392 | break; 393 | case SCREEN_WINDOW_TINY: 394 | break; 395 | } 396 | 397 | } 398 | 399 | public void changeUiToPauseClear() { 400 | switch (currentScreen) { 401 | case SCREEN_LAYOUT_LIST: 402 | setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, 403 | View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); 404 | break; 405 | case SCREEN_WINDOW_FULLSCREEN: 406 | setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, 407 | View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); 408 | break; 409 | case SCREEN_WINDOW_TINY: 410 | break; 411 | } 412 | 413 | } 414 | 415 | public void changeUiToPlayingBufferingShow() { 416 | switch (currentScreen) { 417 | case SCREEN_LAYOUT_LIST: 418 | setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.INVISIBLE, 419 | View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); 420 | break; 421 | case SCREEN_WINDOW_FULLSCREEN: 422 | setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.INVISIBLE, 423 | View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.INVISIBLE); 424 | break; 425 | case SCREEN_WINDOW_TINY: 426 | break; 427 | } 428 | 429 | } 430 | 431 | public void changeUiToPlayingBufferingClear() { 432 | switch (currentScreen) { 433 | case SCREEN_LAYOUT_LIST: 434 | setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, 435 | View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE); 436 | updateStartImage(); 437 | break; 438 | case SCREEN_WINDOW_FULLSCREEN: 439 | setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.INVISIBLE, 440 | View.VISIBLE, View.INVISIBLE, View.INVISIBLE, View.VISIBLE); 441 | updateStartImage(); 442 | break; 443 | case SCREEN_WINDOW_TINY: 444 | break; 445 | } 446 | 447 | } 448 | 449 | public void changeUiToCompleteShow() { 450 | switch (currentScreen) { 451 | case SCREEN_LAYOUT_LIST: 452 | setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE, 453 | View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE); 454 | updateStartImage(); 455 | break; 456 | case SCREEN_WINDOW_FULLSCREEN: 457 | setAllControlsVisible(View.VISIBLE, View.VISIBLE, View.VISIBLE, 458 | View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE); 459 | updateStartImage(); 460 | break; 461 | case SCREEN_WINDOW_TINY: 462 | break; 463 | } 464 | 465 | } 466 | 467 | public void changeUiToCompleteClear() { 468 | switch (currentScreen) { 469 | case SCREEN_LAYOUT_LIST: 470 | setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE, 471 | View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE); 472 | updateStartImage(); 473 | break; 474 | case SCREEN_WINDOW_FULLSCREEN: 475 | setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE, 476 | View.INVISIBLE, View.VISIBLE, View.INVISIBLE, View.VISIBLE); 477 | updateStartImage(); 478 | break; 479 | case SCREEN_WINDOW_TINY: 480 | break; 481 | } 482 | 483 | } 484 | 485 | public void changeUiToError() { 486 | switch (currentScreen) { 487 | case SCREEN_LAYOUT_LIST: 488 | setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE, 489 | View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE); 490 | updateStartImage(); 491 | break; 492 | case SCREEN_WINDOW_FULLSCREEN: 493 | setAllControlsVisible(View.INVISIBLE, View.INVISIBLE, View.VISIBLE, 494 | View.INVISIBLE, View.INVISIBLE, View.VISIBLE, View.INVISIBLE); 495 | updateStartImage(); 496 | break; 497 | case SCREEN_WINDOW_TINY: 498 | break; 499 | } 500 | 501 | } 502 | 503 | public void setAllControlsVisible(int topCon, int bottomCon, int startBtn, int loadingPro, 504 | int thumbImg, int coverImg, int bottomPro) { 505 | topContainer.setVisibility(topCon); 506 | bottomContainer.setVisibility(bottomCon); 507 | startButton.setVisibility(startBtn); 508 | loadingProgressBar.setVisibility(loadingPro); 509 | thumbImageView.setVisibility(thumbImg); 510 | // bottomProgressBar.setVisibility(bottomPro); 511 | bottomProgressBar.setVisibility(GONE); 512 | if(bottomCon==VISIBLE){ 513 | video_time.setVisibility(GONE); 514 | } 515 | if(topCon==VISIBLE && bottomCon==INVISIBLE){ 516 | video_time.setVisibility(VISIBLE); 517 | } 518 | } 519 | 520 | public void updateStartImage() { 521 | if (currentState == CURRENT_STATE_PLAYING) { 522 | startButton.setImageResource(R.drawable.jc_click_pause_selector); 523 | } else if (currentState == CURRENT_STATE_ERROR) { 524 | startButton.setImageResource(fm.jiecao.jcvideoplayer_lib.R.drawable.jc_click_error_selector); 525 | } else { 526 | startButton.setImageResource(R.drawable.jc_click_play_selector); 527 | } 528 | } 529 | 530 | protected Dialog mProgressDialog; 531 | protected ProgressBar mDialogProgressBar; 532 | protected TextView mDialogSeekTime; 533 | protected TextView mDialogTotalTime; 534 | protected ImageView mDialogIcon; 535 | 536 | @Override 537 | public void showProgressDialog(float deltaX, String seekTime, int seekTimePosition, String totalTime, int totalTimeDuration) { 538 | super.showProgressDialog(deltaX, seekTime, seekTimePosition, totalTime, totalTimeDuration); 539 | if (mProgressDialog == null) { 540 | View localView = LayoutInflater.from(getContext()).inflate(fm.jiecao.jcvideoplayer_lib.R.layout.jc_progress_dialog, null); 541 | View content = localView.findViewById(fm.jiecao.jcvideoplayer_lib.R.id.content); 542 | content.setRotation(90); 543 | mDialogProgressBar = ((ProgressBar) localView.findViewById(fm.jiecao.jcvideoplayer_lib.R.id.duration_progressbar)); 544 | mDialogSeekTime = ((TextView) localView.findViewById(fm.jiecao.jcvideoplayer_lib.R.id.tv_current)); 545 | mDialogTotalTime = ((TextView) localView.findViewById(fm.jiecao.jcvideoplayer_lib.R.id.tv_duration)); 546 | mDialogIcon = ((ImageView) localView.findViewById(fm.jiecao.jcvideoplayer_lib.R.id.duration_image_tip)); 547 | mProgressDialog = new Dialog(getContext(), fm.jiecao.jcvideoplayer_lib.R.style.jc_style_dialog_progress); 548 | mProgressDialog.setContentView(localView); 549 | mProgressDialog.getWindow().addFlags(Window.FEATURE_ACTION_BAR); 550 | mProgressDialog.getWindow().addFlags(32); 551 | mProgressDialog.getWindow().addFlags(16); 552 | mProgressDialog.getWindow().setLayout(-2, -2); 553 | WindowManager.LayoutParams localLayoutParams = mProgressDialog.getWindow().getAttributes(); 554 | localLayoutParams.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT; 555 | localLayoutParams.x = getResources().getDimensionPixelOffset(fm.jiecao.jcvideoplayer_lib.R.dimen.jc_progress_dialog_margin_top) / 2; 556 | mProgressDialog.getWindow().setAttributes(localLayoutParams); 557 | } 558 | if (!mProgressDialog.isShowing()) { 559 | mProgressDialog.show(); 560 | } 561 | 562 | mDialogSeekTime.setText(seekTime); 563 | mDialogTotalTime.setText(" / " + totalTime); 564 | mDialogProgressBar.setProgress(totalTimeDuration <= 0 ? 0 : (seekTimePosition * 100 / totalTimeDuration)); 565 | if (deltaX > 0) { 566 | mDialogIcon.setBackgroundResource(fm.jiecao.jcvideoplayer_lib.R.drawable.jc_forward_icon); 567 | } else { 568 | mDialogIcon.setBackgroundResource(fm.jiecao.jcvideoplayer_lib.R.drawable.jc_backward_icon); 569 | } 570 | 571 | } 572 | 573 | @Override 574 | public void dismissProgressDialog() { 575 | super.dismissProgressDialog(); 576 | if (mProgressDialog != null) { 577 | mProgressDialog.dismiss(); 578 | } 579 | } 580 | 581 | 582 | protected Dialog mVolumeDialog; 583 | protected ProgressBar mDialogVolumeProgressBar; 584 | 585 | @Override 586 | public void showVolumDialog(float deltaY, int volumePercent) { 587 | super.showVolumDialog(deltaY, volumePercent); 588 | if (mVolumeDialog == null) { 589 | View localView = LayoutInflater.from(getContext()).inflate(fm.jiecao.jcvideoplayer_lib.R.layout.jc_volume_dialog, null); 590 | View content = localView.findViewById(fm.jiecao.jcvideoplayer_lib.R.id.content); 591 | content.setRotation(90); 592 | mDialogVolumeProgressBar = ((ProgressBar) localView.findViewById(fm.jiecao.jcvideoplayer_lib.R.id.volume_progressbar)); 593 | mVolumeDialog = new Dialog(getContext(), fm.jiecao.jcvideoplayer_lib.R.style.jc_style_dialog_progress); 594 | mVolumeDialog.setContentView(localView); 595 | mVolumeDialog.getWindow().addFlags(8); 596 | mVolumeDialog.getWindow().addFlags(32); 597 | mVolumeDialog.getWindow().addFlags(16); 598 | mVolumeDialog.getWindow().setLayout(-2, -2); 599 | WindowManager.LayoutParams localLayoutParams = mVolumeDialog.getWindow().getAttributes(); 600 | localLayoutParams.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP; 601 | // localLayoutParams.y = getContext().getResources().getDimensionPixelOffset(R.dimen.jc_volume_dialog_margin_left); 602 | mVolumeDialog.getWindow().setAttributes(localLayoutParams); 603 | } 604 | if (!mVolumeDialog.isShowing()) { 605 | mVolumeDialog.show(); 606 | } 607 | 608 | mDialogVolumeProgressBar.setProgress(volumePercent); 609 | } 610 | 611 | @Override 612 | public void dismissVolumDialog() { 613 | super.dismissVolumDialog(); 614 | if (mVolumeDialog != null) { 615 | mVolumeDialog.dismiss(); 616 | } 617 | } 618 | 619 | public void startDismissControlViewTimer() { 620 | cancelDismissControlViewTimer(); 621 | DISSMISS_CONTROL_VIEW_TIMER = new Timer(); 622 | mDismissControlViewTimerTask = new JCVideoPlayer15w.DismissControlViewTimerTask(); 623 | DISSMISS_CONTROL_VIEW_TIMER.schedule(mDismissControlViewTimerTask, 2500); 624 | } 625 | 626 | public void cancelDismissControlViewTimer() { 627 | if (DISSMISS_CONTROL_VIEW_TIMER != null) { 628 | DISSMISS_CONTROL_VIEW_TIMER.cancel(); 629 | } 630 | if (mDismissControlViewTimerTask != null) { 631 | mDismissControlViewTimerTask.cancel(); 632 | } 633 | 634 | } 635 | 636 | public class DismissControlViewTimerTask extends TimerTask { 637 | 638 | @Override 639 | public void run() { 640 | if (currentState != CURRENT_STATE_NORMAL 641 | && currentState != CURRENT_STATE_ERROR 642 | && currentState != CURRENT_STATE_AUTO_COMPLETE) { 643 | if (getContext() != null && getContext() instanceof Activity) { 644 | ((Activity) getContext()).runOnUiThread(new Runnable() { 645 | @Override 646 | public void run() { 647 | bottomContainer.setVisibility(View.INVISIBLE); 648 | topContainer.setVisibility(View.INVISIBLE); 649 | startButton.setVisibility(View.INVISIBLE); 650 | if (currentScreen != SCREEN_WINDOW_TINY) { 651 | // bottomProgressBar.setVisibility(View.VISIBLE); 652 | bottomProgressBar.setVisibility(GONE); 653 | } 654 | } 655 | }); 656 | } 657 | } 658 | } 659 | } 660 | 661 | private class ViewContainerClickListener implements OnClickListener { 662 | 663 | @Override 664 | public void onClick(View view) { 665 | if (currentState == CURRENT_STATE_ERROR) { 666 | if (!TextUtils.isEmpty(videoUrl)) { 667 | JCVideoPlayer.releaseAllVideos(); 668 | setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.INVISIBLE, 669 | View.VISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE); 670 | prepareVideo(); 671 | } 672 | } 673 | 674 | } 675 | } 676 | 677 | private class StartButtonClickListener implements OnClickListener { 678 | 679 | @Override 680 | public void onClick(View view) { 681 | Log.i(TAG, "onClick start [" + this.hashCode() + "] "); 682 | if (currentState == CURRENT_STATE_NORMAL || currentState == CURRENT_STATE_ERROR) { 683 | if (!url.startsWith("file") && !JCUtils.isWifiConnected(getContext()) && !WIFI_TIP_DIALOG_SHOWED) { 684 | showWifiDialog(); 685 | return; 686 | } 687 | if(!TextUtils.isEmpty(videoUrl)){ 688 | JCVideoPlayer.releaseAllVideos(); 689 | setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.INVISIBLE, 690 | View.VISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE); 691 | prepareVideo(); 692 | } 693 | } else if (currentState == CURRENT_STATE_PLAYING) { 694 | onEvent(JCBuriedPoint.ON_CLICK_PAUSE); 695 | Log.d(TAG, "pauseVideo [" + this.hashCode() + "] "); 696 | JCMediaManager.instance().mediaPlayer.pause(); 697 | setUiWitStateAndScreen(CURRENT_STATE_PAUSE); 698 | } else if (currentState == CURRENT_STATE_PAUSE) { 699 | onEvent(JCBuriedPoint.ON_CLICK_RESUME); 700 | JCMediaManager.instance().mediaPlayer.start(); 701 | setUiWitStateAndScreen(CURRENT_STATE_PLAYING); 702 | } else if (currentState == CURRENT_STATE_AUTO_COMPLETE) { 703 | if(!TextUtils.isEmpty(videoUrl)){ 704 | JCVideoPlayer.releaseAllVideos(); 705 | setAllControlsVisible(View.VISIBLE, View.INVISIBLE, View.INVISIBLE, 706 | View.VISIBLE, View.VISIBLE, View.INVISIBLE, View.INVISIBLE); 707 | prepareVideo(); 708 | } 709 | } 710 | 711 | } 712 | } 713 | } 714 | --------------------------------------------------------------------------------