├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── congren │ │ └── littlevideo │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── congren │ │ │ └── littlevideo │ │ │ ├── MainActivity.java │ │ │ ├── SplashActivity.java │ │ │ ├── adapter │ │ │ └── LittleVideoAdapter.java │ │ │ ├── bean │ │ │ └── VideoBean.java │ │ │ └── widget │ │ │ ├── LittleVideoView.java │ │ │ └── PagerLayoutManager.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── activity_splash.xml │ │ ├── empty_control_video.xml │ │ └── littlevideo_recyclerview_item.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.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 │ │ ├── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ ├── file_paths.xml │ │ ├── network_config.xml │ │ └── provider_paths.xml │ └── test │ └── java │ └── com │ └── congren │ └── littlevideo │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── image └── 短视频.gif └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/navEditor.xml 5 | /.idea/assetWizardSettings.xml 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | .cxx 11 | /.idea/ 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LittleVideo 2 | Android短视频滑动播放 3 | 4 | 项目采用了Androidx架构,主要介绍采用RecyclerView配合PagerSnapHelper实现短视频滑动播放内容。 5 | 6 | ![短视频.gif](https://raw.githubusercontent.com/MickJson/LittleVideo/master/image/%E7%9F%AD%E8%A7%86%E9%A2%91.gif) 7 | 8 | PagerSnapHelper可以帮助实现与以下类似的行为 ViewPager。 将RecyclerView和RecyclerView.Adapter的项目都设置为具 9 | 有android.view.ViewGroup.LayoutParams#MATCH_PARENT的高度和宽度,然后使用#attachToRecyclerView(RecyclerView)} 10 | 将PagerSnapHelper附加到RecyclerView。 11 | 12 | 13 | 详细内容请点击博客查看: 14 | [Android短视频滑动播放(一)](https://www.cnblogs.com/jqnl/p/12131965.html) 15 | [Android短视频滑动播放(二)](https://www.cnblogs.com/jqnl/p/12131971.html) 16 | 17 | 欢迎关注公众号:几圈年轮,查看更多有趣的技术、工具、闲言、资源。 18 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 29 5 | buildToolsVersion "29.0.2" 6 | defaultConfig { 7 | applicationId "com.congren.littlevideo" 8 | minSdkVersion 19 9 | targetSdkVersion 29 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | android { 21 | compileOptions { 22 | sourceCompatibility 1.8 23 | targetCompatibility 1.8 24 | } 25 | } 26 | } 27 | 28 | dependencies { 29 | implementation fileTree(dir: 'libs', include: ['*.jar']) 30 | implementation 'androidx.appcompat:appcompat:1.1.0' 31 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 32 | testImplementation 'junit:junit:4.12' 33 | androidTestImplementation 'androidx.test.ext:junit:1.1.0' 34 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 35 | 36 | //RecyclerView万能适配器 37 | implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.45-androidx' 38 | implementation 'androidx.recyclerview:recyclerview:1.1.0' 39 | 40 | // 图片加载 41 | implementation 'com.github.bumptech.glide:glide:4.10.0' 42 | // 权限申请 43 | implementation 'com.qw:soulpermission:1.1.6' 44 | implementation 'me.wangyuwei:ParticleView:1.0.4' 45 | 46 | // 视频播放器 47 | implementation 'com.shuyu:GSYVideoPlayer:7.1.2' 48 | 49 | implementation 'com.google.android.material:material:1.0.0' 50 | } 51 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/congren/littlevideo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.congren.littlevideo; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | 25 | assertEquals("com.congren.littlevideo", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/congren/littlevideo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.congren.littlevideo; 2 | 3 | import android.os.Bundle; 4 | import android.os.Handler; 5 | import android.os.Message; 6 | import android.util.Log; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.view.ViewParent; 10 | import android.widget.FrameLayout; 11 | import android.widget.ImageView; 12 | import android.widget.Toast; 13 | 14 | import androidx.annotation.NonNull; 15 | import androidx.appcompat.app.AppCompatActivity; 16 | import androidx.recyclerview.widget.RecyclerView; 17 | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; 18 | 19 | import com.chad.library.adapter.base.BaseViewHolder; 20 | import com.congren.littlevideo.adapter.LittleVideoAdapter; 21 | import com.congren.littlevideo.bean.VideoBean; 22 | import com.congren.littlevideo.widget.LittleVideoView; 23 | import com.congren.littlevideo.widget.PagerLayoutManager; 24 | import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder; 25 | import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack; 26 | import com.shuyu.gsyvideoplayer.utils.GSYVideoType; 27 | 28 | import java.util.List; 29 | 30 | /** 31 | * @author 几圈年轮 32 | */ 33 | public class MainActivity extends AppCompatActivity implements PagerLayoutManager.OnPageChangedListener { 34 | 35 | /** 36 | * 预加载条目数 37 | */ 38 | private static final int DEFAULT_PRELOAD_NUMBER = 5; 39 | 40 | private SwipeRefreshLayout mRefreshView; 41 | private RecyclerView mRvLittleVideo; 42 | 43 | private LittleVideoAdapter mLittleVideoAdapter; 44 | private PagerLayoutManager mPagerLayoutManager; 45 | private int mCurrentPosition; 46 | private GSYVideoOptionBuilder mGsySmallVideoHelperBuilder; 47 | private LittleVideoView mVideoView; 48 | 49 | /** 50 | * 是否正在加载数据 51 | */ 52 | private boolean isLoadingData = false; 53 | /** 54 | * 是否加载完毕 55 | */ 56 | private boolean isEnd; 57 | /** 58 | * 是否是最后视频位置 59 | */ 60 | private int mLastStopPosition; 61 | /** 62 | * 数据请求是否为加载更多数据 63 | */ 64 | private boolean isLoadMoreData = false; 65 | /** 66 | * 请求视频内容页下标 67 | */ 68 | private int mLastProductIndex; 69 | 70 | /** 71 | * 模拟网络请求完毕,数据更新 72 | */ 73 | Handler mHandler = new Handler(new Handler.Callback() { 74 | @Override 75 | public boolean handleMessage(@NonNull Message msg) { 76 | onVideoListUpdate(VideoBean.getTikTokVideoList()); 77 | return false; 78 | } 79 | }); 80 | private boolean isLoopPlay = false; 81 | 82 | @Override 83 | protected void onCreate(Bundle savedInstanceState) { 84 | super.onCreate(savedInstanceState); 85 | setContentView(R.layout.activity_main); 86 | initView(); 87 | initData(); 88 | initVideo(); 89 | initListener(); 90 | } 91 | 92 | private void initView() { 93 | mRvLittleVideo = findViewById(R.id.rv_little_video); 94 | mRefreshView = findViewById(R.id.srf_video_list); 95 | } 96 | 97 | 98 | private void initData() { 99 | mPagerLayoutManager = new PagerLayoutManager(this); 100 | mPagerLayoutManager.setOnPageChangedListener(this); 101 | 102 | mRvLittleVideo.setLayoutManager(mPagerLayoutManager); 103 | 104 | mLittleVideoAdapter = new LittleVideoAdapter(); 105 | mRvLittleVideo.setAdapter(mLittleVideoAdapter); 106 | 107 | requestNewData(); 108 | } 109 | 110 | /** 111 | * 初始化播放器内容,采用了GSY播放器 112 | */ 113 | private void initVideo() { 114 | 115 | mVideoView = new LittleVideoView(this); 116 | GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_FULL); 117 | mGsySmallVideoHelperBuilder = new GSYVideoOptionBuilder(); 118 | mGsySmallVideoHelperBuilder 119 | .setLooping(isLoopPlay) 120 | .setCacheWithPlay(true) 121 | .setIsTouchWiget(false) 122 | .setVideoAllCallBack(new GSYSampleCallBack() { 123 | @Override 124 | public void onPrepared(String url, Object... objects) { 125 | super.onPrepared(url, objects); 126 | 127 | new Handler().postDelayed(new Runnable() { 128 | @Override 129 | public void run() { 130 | BaseViewHolder viewHolder = (BaseViewHolder) mRvLittleVideo.findViewHolderForLayoutPosition(mCurrentPosition); 131 | if (viewHolder != null) { 132 | ImageView mVideoThumb = viewHolder.getView(R.id.iv_thumb_item); 133 | if (mVideoThumb != null) { 134 | mVideoThumb.setVisibility(View.INVISIBLE); 135 | } 136 | } 137 | } 138 | }, 100); 139 | 140 | 141 | } 142 | 143 | @Override 144 | public void onAutoComplete(String url, Object... objects) { 145 | super.onAutoComplete(url, objects); 146 | 147 | if (!isLoopPlay) { 148 | if (mCurrentPosition + 1 < mLittleVideoAdapter.getItemCount() ) { 149 | mRvLittleVideo.smoothScrollToPosition(mCurrentPosition + 1); 150 | } 151 | } 152 | 153 | } 154 | }); 155 | } 156 | 157 | /** 158 | * 设置数据刷新监听,回归初始状态 159 | */ 160 | private void initListener() { 161 | mRefreshView.setOnRefreshListener(() -> { 162 | isLoadMoreData = false; 163 | mLastProductIndex = 0; 164 | requestNewData(); 165 | }); 166 | } 167 | 168 | /** 169 | * 数据请求 170 | */ 171 | private void requestNewData() { 172 | if (!isLoadMoreData) { 173 | mRefreshView.setRefreshing(true); 174 | } 175 | 176 | isLoadingData = true; 177 | 178 | // 模拟网络请求,2秒后进行数据返回 179 | Log.e("PageIndex", String.valueOf(mLastProductIndex)); 180 | mHandler.sendEmptyMessageDelayed(0, 2000); 181 | 182 | } 183 | 184 | /** 185 | * 数据更新 186 | * 187 | * @param videoList 网络回调获取数据 188 | */ 189 | public void onVideoListUpdate(List videoList) { 190 | isEnd = videoList == null || videoList.size() < 10; 191 | isLoadingData = false; 192 | if (mRefreshView != null && mRefreshView.isRefreshing()) { 193 | mRefreshView.setRefreshing(false); 194 | } 195 | if (videoList == null) { 196 | return; 197 | } 198 | mLastProductIndex += videoList.size(); 199 | if (isLoadMoreData) { 200 | // 加载更多数据 201 | if (mLittleVideoAdapter != null) { 202 | mLittleVideoAdapter.addData(videoList); 203 | } 204 | } else { 205 | // 刷新数据 206 | isEnd = false; 207 | mLittleVideoAdapter.setNewData(videoList); 208 | } 209 | } 210 | 211 | /** 212 | * 初始化加载完成,进行视频播放 213 | */ 214 | @Override 215 | public void onPageInitComplete() { 216 | int position = mPagerLayoutManager.findFirstVisibleItemPosition(); 217 | if (position != -1) { 218 | mCurrentPosition = position; 219 | } 220 | 221 | // 预加载,请求数据内容 222 | int itemCount = mLittleVideoAdapter.getItemCount(); 223 | if (itemCount - position < DEFAULT_PRELOAD_NUMBER && !isLoadingData && !isEnd) { 224 | requestNewData(); 225 | } 226 | 227 | startPlay(mCurrentPosition); 228 | 229 | mLastStopPosition = -1; 230 | } 231 | 232 | /** 233 | * 页面脱离,内容释放 234 | * 235 | * @param position 子布局在RecyclerView位置 236 | * @param isNext 是否有下一个 237 | */ 238 | @Override 239 | public void onPageRelease(int position, boolean isNext) { 240 | if (mCurrentPosition == position) { 241 | mLastStopPosition = position; 242 | stopPlay(); 243 | BaseViewHolder viewHolder = (BaseViewHolder) mRvLittleVideo.findViewHolderForLayoutPosition(mCurrentPosition); 244 | if (viewHolder != null) { 245 | ImageView mVideoThumb = viewHolder.getView(R.id.iv_thumb_item); 246 | if (mVideoThumb != null) { 247 | mVideoThumb.setVisibility(View.VISIBLE); 248 | } 249 | } 250 | } 251 | } 252 | 253 | /** 254 | * 页面附着,内容展示 255 | * 256 | * @param position 子布局在RecyclerView位置 257 | * @param isLast 是否最后一个 258 | */ 259 | @Override 260 | public void onPageSelected(int position, boolean isLast) { 261 | if (mCurrentPosition == position && mLastStopPosition != position) { 262 | return; 263 | } 264 | 265 | // 预加载,请求数据内容 266 | int itemCount = mLittleVideoAdapter.getItemCount(); 267 | if (itemCount - position < DEFAULT_PRELOAD_NUMBER && !isLoadingData && !isEnd) { 268 | // 正在加载中, 防止网络太慢或其他情况造成重复请求列表 269 | isLoadMoreData = true; 270 | isLoadingData = true; 271 | requestNewData(); 272 | } 273 | if (itemCount == position + 1 && isEnd) { 274 | Toast.makeText(MainActivity.this, "No more video.", Toast.LENGTH_SHORT).show(); 275 | } 276 | startPlay(position); 277 | mCurrentPosition = position; 278 | } 279 | 280 | /** 281 | * 停止播放,移除视图 282 | */ 283 | private void stopPlay() { 284 | mVideoView.release(); 285 | ViewParent parent = mVideoView.getParent(); 286 | if (parent instanceof FrameLayout) { 287 | ((FrameLayout) parent).removeView(mVideoView); 288 | } 289 | } 290 | 291 | /** 292 | * 开始播放视频内容,进行播放器视图加载 293 | */ 294 | private void startPlay(int position) { 295 | if (position < 0 || position >= mLittleVideoAdapter.getData().size()) { 296 | return; 297 | } 298 | BaseViewHolder holder = (BaseViewHolder) mRvLittleVideo.findViewHolderForLayoutPosition(position); 299 | ViewParent parent = mVideoView.getParent(); 300 | if (parent instanceof FrameLayout) { 301 | ((ViewGroup) parent).removeView(mVideoView); 302 | } 303 | if (holder != null) { 304 | FrameLayout mVideoContent = holder.getView(R.id.fl_content_item); 305 | mVideoContent.addView(mVideoView, 0); 306 | mGsySmallVideoHelperBuilder.setUrl(mLittleVideoAdapter.getData().get(position).getUrl()); 307 | mGsySmallVideoHelperBuilder.build(mVideoView); 308 | mVideoView.startPlayLogic(); 309 | 310 | } 311 | } 312 | 313 | } 314 | -------------------------------------------------------------------------------- /app/src/main/java/com/congren/littlevideo/SplashActivity.java: -------------------------------------------------------------------------------- 1 | package com.congren.littlevideo; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.Manifest; 6 | import android.content.Intent; 7 | import android.os.Bundle; 8 | import android.view.View; 9 | import android.widget.Toast; 10 | 11 | import com.qw.soul.permission.SoulPermission; 12 | import com.qw.soul.permission.bean.Permission; 13 | import com.qw.soul.permission.bean.Permissions; 14 | import com.qw.soul.permission.callbcak.CheckRequestPermissionsListener; 15 | 16 | import me.wangyuwei.particleview.ParticleView; 17 | 18 | public class SplashActivity extends AppCompatActivity { 19 | 20 | @Override 21 | protected void onCreate(Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | setContentView(R.layout.activity_splash); 24 | 25 | final ParticleView mParticleView = findViewById(R.id.particle_view); 26 | mParticleView.setOnParticleAnimListener(new ParticleView.ParticleAnimListener() { 27 | @Override 28 | public void onAnimationEnd() { 29 | startActivity(new Intent(SplashActivity.this, MainActivity.class)); 30 | finish(); 31 | } 32 | }); 33 | 34 | SoulPermission.init(getApplication()); 35 | 36 | Permissions permissions = Permissions.build( 37 | Manifest.permission.READ_EXTERNAL_STORAGE, 38 | Manifest.permission.WRITE_EXTERNAL_STORAGE); 39 | 40 | SoulPermission.getInstance().checkAndRequestPermissions(permissions, new CheckRequestPermissionsListener() { 41 | @Override 42 | public void onAllPermissionOk(Permission[] allPermissions) { 43 | mParticleView.startAnim(); 44 | } 45 | 46 | @Override 47 | public void onPermissionDenied(Permission[] refusedPermissions) { 48 | Toast.makeText(SplashActivity.this, "请给与权限", Toast.LENGTH_SHORT).show(); 49 | } 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/congren/littlevideo/adapter/LittleVideoAdapter.java: -------------------------------------------------------------------------------- 1 | package com.congren.littlevideo.adapter; 2 | 3 | import android.widget.ImageView; 4 | 5 | import com.bumptech.glide.Glide; 6 | import com.chad.library.adapter.base.BaseQuickAdapter; 7 | import com.chad.library.adapter.base.BaseViewHolder; 8 | import com.congren.littlevideo.R; 9 | import com.congren.littlevideo.bean.VideoBean; 10 | 11 | import java.util.ArrayList; 12 | 13 | /** 14 | * @author 几圈年轮 15 | * @date 2019/12/18. 16 | * description:适配器内容 17 | */ 18 | public class LittleVideoAdapter extends BaseQuickAdapter { 19 | 20 | public LittleVideoAdapter() { 21 | super(R.layout.littlevideo_recyclerview_item, new ArrayList<>()); 22 | } 23 | 24 | @Override 25 | protected void convert(BaseViewHolder helper, VideoBean item) { 26 | Glide.with(mContext).load(item.getThumb()).into((ImageView) helper.getView(R.id.iv_thumb_item)); 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/congren/littlevideo/bean/VideoBean.java: -------------------------------------------------------------------------------- 1 | package com.congren.littlevideo.bean; 2 | 3 | 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | /** 8 | * @author 几圈年轮 9 | */ 10 | public class VideoBean { 11 | 12 | private String title; 13 | private String url; 14 | private String thumb; 15 | 16 | public String getTitle() { 17 | return title; 18 | } 19 | 20 | public void setTitle(String title) { 21 | this.title = title; 22 | } 23 | 24 | public String getUrl() { 25 | return url; 26 | } 27 | 28 | public void setUrl(String url) { 29 | this.url = url; 30 | } 31 | 32 | public String getThumb() { 33 | return thumb; 34 | } 35 | 36 | public void setThumb(String thumb) { 37 | this.thumb = thumb; 38 | } 39 | 40 | private VideoBean(String title, String thumb, String url) { 41 | this.title = title; 42 | this.url = url; 43 | this.thumb = thumb; 44 | 45 | } 46 | 47 | /** 48 | * 抖音演示数据 49 | */ 50 | public static List getTikTokVideoList() { 51 | { 52 | List videoList = new ArrayList<>(); 53 | 54 | videoList.add(new VideoBean("", 55 | "http://xp.qpic.cn/oscar_pic/0/1047_33356432363063372d633237642pict/480.jpg", 56 | "http://123.125.244.84/v.weishi.qq.com/shg_1043539964_1047_eae031f17be34dfea6038db252a8vide.f20.mp4")); 57 | 58 | videoList.add(new VideoBean("", 59 | "http://xp.qpic.cn/oscar_pic/0/1047_63323637383439642d636634302pict/480", 60 | "http://123.125.244.84/v.weishi.qq.com/tjg_660467533_1047_88ae7ef740f14486872229d22dd5vide.f20.mp4")); 61 | 62 | videoList.add(new VideoBean("", 63 | "http://xp.qpic.cn/oscar_pic/0/1047_30646239313130382d306330392pict/480", 64 | "http://123.125.10.236/v.weishi.qq.com/shg_193622498_1047_65b2a00f51c14956b602b7275757vide.f20.mp4")); 65 | 66 | videoList.add(new VideoBean("", 67 | "http://xp.qpic.cn/oscar_pic/0/1047_35653531343037612d653235392pict/480", 68 | "http://123.125.244.84/v.weishi.qq.com/shg_1638682606_1047_36ff81db2b394c8faa295f40e04dvide.f20.mp4")); 69 | 70 | 71 | videoList.add(new VideoBean("", 72 | "http://xp.qpic.cn/oscar_pic/0/1047_33356432363063372d633237642pict/480.jpg", 73 | "http://123.125.244.84/v.weishi.qq.com/shg_1043539964_1047_eae031f17be34dfea6038db252a8vide.f20.mp4")); 74 | 75 | videoList.add(new VideoBean("", 76 | "http://xp.qpic.cn/oscar_pic/0/1047_63323637383439642d636634302pict/480", 77 | "http://123.125.244.84/v.weishi.qq.com/tjg_660467533_1047_88ae7ef740f14486872229d22dd5vide.f20.mp4")); 78 | 79 | videoList.add(new VideoBean("", 80 | "http://xp.qpic.cn/oscar_pic/0/1047_30646239313130382d306330392pict/480", 81 | "http://123.125.10.236/v.weishi.qq.com/shg_193622498_1047_65b2a00f51c14956b602b7275757vide.f20.mp4")); 82 | 83 | videoList.add(new VideoBean("", 84 | "http://xp.qpic.cn/oscar_pic/0/1047_35653531343037612d653235392pict/480", 85 | "http://123.125.244.84/v.weishi.qq.com/shg_1638682606_1047_36ff81db2b394c8faa295f40e04dvide.f20.mp4")); 86 | 87 | 88 | return videoList; 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /app/src/main/java/com/congren/littlevideo/widget/LittleVideoView.java: -------------------------------------------------------------------------------- 1 | package com.congren.littlevideo.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | 7 | import com.congren.littlevideo.R; 8 | import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer; 9 | 10 | /** 11 | * @author 几圈年轮 12 | * @date 2019/12/18. 13 | * description: 14 | */ 15 | public class LittleVideoView extends StandardGSYVideoPlayer { 16 | 17 | public LittleVideoView(Context context, Boolean fullFlag) { 18 | super(context, fullFlag); 19 | 20 | init(); 21 | } 22 | 23 | public LittleVideoView(Context context) { 24 | super(context); 25 | 26 | init(); 27 | } 28 | 29 | public LittleVideoView(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | 32 | init(); 33 | } 34 | 35 | @Override 36 | public int getLayoutId() { 37 | return R.layout.empty_control_video; 38 | } 39 | 40 | @Override 41 | protected void changeUiToNormal() { 42 | 43 | } 44 | 45 | @Override 46 | protected void changeUiToPlayingShow() { 47 | 48 | } 49 | 50 | private void init() { 51 | mTextureViewContainer.setOnClickListener(new OnClickListener() { 52 | @Override 53 | public void onClick(View v) { 54 | if (getGSYVideoManager().isPlaying()) { 55 | getGSYVideoManager().pause(); 56 | mStartButton.setVisibility(View.VISIBLE); 57 | } else { 58 | getGSYVideoManager().start(); 59 | mStartButton.setVisibility(View.GONE); 60 | } 61 | } 62 | }); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/com/congren/littlevideo/widget/PagerLayoutManager.java: -------------------------------------------------------------------------------- 1 | package com.congren.littlevideo.widget; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | 6 | import androidx.annotation.NonNull; 7 | import androidx.recyclerview.widget.LinearLayoutManager; 8 | import androidx.recyclerview.widget.PagerSnapHelper; 9 | import androidx.recyclerview.widget.RecyclerView; 10 | 11 | /** 12 | * @author 几圈年轮 13 | * @date 2019/12/18. 14 | * description:RecyclerView实现ViewPager式样滑动管理 15 | */ 16 | public class PagerLayoutManager extends LinearLayoutManager implements RecyclerView.OnChildAttachStateChangeListener { 17 | 18 | private OnPageChangedListener mOnPageChangedListener; 19 | 20 | private PagerSnapHelper mSnapHelper; 21 | 22 | /** 23 | * 移动方向标记 24 | */ 25 | private int direction; 26 | 27 | public PagerLayoutManager(Context context) { 28 | super(context); 29 | mSnapHelper = new PagerSnapHelper(); 30 | } 31 | 32 | /** 33 | * PagerSnapHelper绑定RecyclerView,同时为监听RecyclerView子布局附着,脱离,进行滑动页面内容控制 34 | * 35 | * @param view RecyclerView 36 | */ 37 | @Override 38 | public void onAttachedToWindow(RecyclerView view) { 39 | super.onAttachedToWindow(view); 40 | mSnapHelper.attachToRecyclerView(view); 41 | view.addOnChildAttachStateChangeListener(this); 42 | } 43 | 44 | /** 45 | * 滑动状态改变监听,滑动完毕后进行播放控制 46 | * 47 | * @param state 滑动状态 48 | */ 49 | @Override 50 | public void onScrollStateChanged(int state) { 51 | super.onScrollStateChanged(state); 52 | 53 | if (state == RecyclerView.SCROLL_STATE_IDLE) { 54 | View view = mSnapHelper.findSnapView(this); 55 | if (view == null) { 56 | return; 57 | } 58 | int position = getPosition(view); 59 | if (mOnPageChangedListener != null && getChildCount() == 1) { 60 | mOnPageChangedListener.onPageSelected(position, position == getItemCount() - 1); 61 | } 62 | } 63 | 64 | } 65 | 66 | @Override 67 | public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) { 68 | direction = dx; 69 | return super.scrollHorizontallyBy(dx, recycler, state); 70 | } 71 | 72 | @Override 73 | public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) { 74 | direction = dy; 75 | return super.scrollVerticallyBy(dy, recycler, state); 76 | } 77 | 78 | @Override 79 | public void onChildViewAttachedToWindow(@NonNull View view) { 80 | if (mOnPageChangedListener != null && getChildCount() == 1) { 81 | mOnPageChangedListener.onPageInitComplete(); 82 | } 83 | } 84 | 85 | @Override 86 | public void onChildViewDetachedFromWindow(@NonNull View view) { 87 | if (mOnPageChangedListener != null) { 88 | mOnPageChangedListener.onPageRelease(getPosition(view), direction >= 0); 89 | } 90 | } 91 | 92 | public void setOnPageChangedListener(OnPageChangedListener mOnPageChangedListener) { 93 | this.mOnPageChangedListener = mOnPageChangedListener; 94 | } 95 | 96 | public interface OnPageChangedListener { 97 | 98 | /** 99 | * 初始化子布局加载完成 100 | */ 101 | void onPageInitComplete(); 102 | 103 | /** 104 | * 子布局脱离 105 | * 106 | * @param position 子布局在RecyclerView位置 107 | * @param isNext 是否有下一个 108 | */ 109 | void onPageRelease(int position, boolean isNext); 110 | 111 | /** 112 | * 子布局附着 113 | * 114 | * @param position 子布局在RecyclerView位置 115 | * @param isLast 是否最后一个 116 | */ 117 | void onPageSelected(int position, boolean isLast); 118 | } 119 | 120 | 121 | } 122 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/empty_control_video.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/littlevideo_recyclerview_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MickJson/LittleVideo/52ae58263a9c56ab96f068439436807e53115844/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MickJson/LittleVideo/52ae58263a9c56ab96f068439436807e53115844/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MickJson/LittleVideo/52ae58263a9c56ab96f068439436807e53115844/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MickJson/LittleVideo/52ae58263a9c56ab96f068439436807e53115844/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MickJson/LittleVideo/52ae58263a9c56ab96f068439436807e53115844/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MickJson/LittleVideo/52ae58263a9c56ab96f068439436807e53115844/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MickJson/LittleVideo/52ae58263a9c56ab96f068439436807e53115844/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MickJson/LittleVideo/52ae58263a9c56ab96f068439436807e53115844/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MickJson/LittleVideo/52ae58263a9c56ab96f068439436807e53115844/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MickJson/LittleVideo/52ae58263a9c56ab96f068439436807e53115844/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | LittleVideo 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/xml/file_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/xml/network_config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/xml/provider_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/test/java/com/congren/littlevideo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.congren.littlevideo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.5.1' 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | maven { url "https://jitpack.io" } 22 | maven { 23 | url 'https://dl.bintray.com/wangyuwei/maven' 24 | } 25 | } 26 | } 27 | 28 | task clean(type: Delete) { 29 | delete rootProject.buildDir 30 | } 31 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | 21 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MickJson/LittleVideo/52ae58263a9c56ab96f068439436807e53115844/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Dec 17 19:32:45 CST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /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 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 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 Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /image/短视频.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MickJson/LittleVideo/52ae58263a9c56ab96f068439436807e53115844/image/短视频.gif -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name='LittleVideo' 3 | --------------------------------------------------------------------------------