This commit is contained in:
2021-02-26 18:29:46 +08:00
commit a35d7977d5
62 changed files with 2170 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.uiui.videoplayer">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".base.MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".activity.PlayActivity"></activity>
<activity android:name=".activity.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.ActivityTikTok"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.NoActionBar" />
</application>
</manifest>

View File

@@ -0,0 +1,27 @@
package com.uiui.videoplayer.CustomJzvd;
import android.content.Context;
import android.util.AttributeSet;
import cn.jzvd.JzvdStd;
public class JzvdStdAssert extends JzvdStd {
public JzvdStdAssert(Context context) {
super(context);
}
public JzvdStdAssert(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onPrepared() {
state = STATE_PREPARED;
if (!preloading) {
mediaInterface.start();
preloading = false;
}
onStatePlaying();
}
}

View File

@@ -0,0 +1,101 @@
package com.uiui.videoplayer.CustomJzvd;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import com.uiui.videoplayer.R;
import cn.jzvd.JzvdStd;
public class JzvdStdTikTok extends JzvdStd {
public JzvdStdTikTok(Context context) {
super(context);
}
public JzvdStdTikTok(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void init(Context context) {
super.init(context);
bottomContainer.setVisibility(GONE);
topContainer.setVisibility(GONE);
bottomProgressBar.setVisibility(GONE);
posterImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
}
//changeUiTo 真能能修改ui的方法
@Override
public void changeUiToNormal() {
super.changeUiToNormal();
bottomContainer.setVisibility(GONE);
topContainer.setVisibility(GONE);
}
@Override
public void setAllControlsVisiblity(int topCon, int bottomCon, int startBtn, int loadingPro,
int posterImg, int bottomPro, int retryLayout) {
topContainer.setVisibility(INVISIBLE);
bottomContainer.setVisibility(INVISIBLE);
startButton.setVisibility(startBtn);
loadingProgressBar.setVisibility(loadingPro);
posterImageView.setVisibility(posterImg);
bottomProgressBar.setVisibility(GONE);
mRetryLayout.setVisibility(retryLayout);
}
@Override
public void dissmissControlView() {
if (state != STATE_NORMAL
&& state != STATE_ERROR
&& state != STATE_AUTO_COMPLETE) {
post(new Runnable() {
@Override
public void run() {
bottomContainer.setVisibility(View.INVISIBLE);
topContainer.setVisibility(View.INVISIBLE);
startButton.setVisibility(View.INVISIBLE);
if (clarityPopWindow != null) {
clarityPopWindow.dismiss();
}
if (screen != SCREEN_TINY) {
bottomProgressBar.setVisibility(View.GONE);
}
}
});
}
}
@Override
public void onClickUiToggle() {
super.onClickUiToggle();
Log.i(TAG, "click blank");
startButton.performClick();
bottomContainer.setVisibility(GONE);
topContainer.setVisibility(GONE);
}
public void updateStartImage() {
if (state == STATE_PLAYING) {
startButton.setVisibility(VISIBLE);
startButton.setImageResource(R.drawable.tiktok_play_tiktok);
replayTextView.setVisibility(GONE);
} else if (state == STATE_ERROR) {
startButton.setVisibility(INVISIBLE);
replayTextView.setVisibility(GONE);
} else if (state == STATE_AUTO_COMPLETE) {
startButton.setVisibility(VISIBLE);
startButton.setImageResource(R.drawable.tiktok_play_tiktok);
replayTextView.setVisibility(VISIBLE);
} else {
startButton.setImageResource(R.drawable.tiktok_play_tiktok);
replayTextView.setVisibility(GONE);
}
}
}

View File

@@ -0,0 +1,188 @@
package com.uiui.videoplayer.CustomJzvd;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.SeekBar;
import com.uiui.videoplayer.R;
import cn.jzvd.JzvdStd;
/**
* 这里可以监听到视频播放的生命周期和播放状态
* 所有关于视频的逻辑都应该写在这里
* Created by Nathen on 2017/7/2.
*/
public class MyJzvdStd extends JzvdStd {
public MyJzvdStd(Context context) {
super(context);
}
public MyJzvdStd(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void init(Context context) {
super.init(context);
}
@Override
public void onClick(View v) {
super.onClick(v);
int i = v.getId();
if (i == cn.jzvd.R.id.fullscreen) {
Log.i(TAG, "onClick: fullscreen button");
} else if (i == R.id.start) {
Log.i(TAG, "onClick: start button");
}
}
@Override
public boolean onTouch(View v, MotionEvent event) {
super.onTouch(v, event);
int id = v.getId();
if (id == cn.jzvd.R.id.surface_container) {
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
if (mChangePosition) {
Log.i(TAG, "Touch screen seek position");
}
if (mChangeVolume) {
Log.i(TAG, "Touch screen change volume");
}
break;
}
}
return false;
}
@Override
public int getLayoutId() {
return R.layout.jz_layout_std;
}
@Override
public void startVideo() {
super.startVideo();
Log.i(TAG, "startVideo");
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
super.onStopTrackingTouch(seekBar);
Log.i(TAG, "Seek position ");
}
@Override
public void gotoFullscreen() {
super.gotoFullscreen();
Log.i(TAG, "goto Fullscreen");
}
@Override
public void gotoNormalScreen() {
super.gotoNormalScreen();
Log.i(TAG, "quit Fullscreen");
}
@Override
public void autoFullscreen(float x) {
super.autoFullscreen(x);
Log.i(TAG, "auto Fullscreen");
}
@Override
public void onClickUiToggle() {
super.onClickUiToggle();
Log.i(TAG, "click blank");
}
//onState 代表了播放器引擎的回调,播放视频各个过程的状态的回调
@Override
public void onStateNormal() {
super.onStateNormal();
}
@Override
public void onStatePreparing() {
super.onStatePreparing();
}
@Override
public void onStatePlaying() {
super.onStatePlaying();
}
@Override
public void onStatePause() {
super.onStatePause();
}
@Override
public void onStateError() {
super.onStateError();
}
@Override
public void onStateAutoComplete() {
super.onStateAutoComplete();
Log.i(TAG, "Auto complete");
}
//changeUiTo 真能能修改ui的方法
@Override
public void changeUiToNormal() {
super.changeUiToNormal();
}
@Override
public void changeUiToPreparing() {
super.changeUiToPreparing();
}
@Override
public void changeUiToPlayingShow() {
super.changeUiToPlayingShow();
}
@Override
public void changeUiToPlayingClear() {
super.changeUiToPlayingClear();
}
@Override
public void changeUiToPauseShow() {
super.changeUiToPauseShow();
}
@Override
public void changeUiToPauseClear() {
super.changeUiToPauseClear();
}
@Override
public void changeUiToComplete() {
super.changeUiToComplete();
}
@Override
public void changeUiToError() {
super.changeUiToError();
}
@Override
public void onInfo(int what, int extra) {
super.onInfo(what, extra);
}
@Override
public void onError(int what, int extra) {
super.onError(what, extra);
}
}

View File

@@ -0,0 +1,137 @@
package com.uiui.videoplayer.activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowManager;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.OrientationHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.uiui.videoplayer.CustomJzvd.JzvdStdAssert;
import com.uiui.videoplayer.CustomJzvd.JzvdStdTikTok;
import com.uiui.videoplayer.R;
import com.uiui.videoplayer.adapter.TikTokRecyclerViewAdapter;
import com.uiui.videoplayer.base.ViewPagerLayoutManager;
import com.uiui.videoplayer.listener.OnViewPagerListener;
import java.util.ArrayList;
import java.util.List;
import cn.jzvd.Jzvd;
public class ActivityTikTok extends AppCompatActivity {
private RecyclerView rvTiktok;
private TikTokRecyclerViewAdapter mAdapter;
private ViewPagerLayoutManager mViewPagerLayoutManager;
private int mCurrentPosition = -1;
private int position = 0;
private List<String> videoPath = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_tiktok);
Intent intent = getIntent();
if (null != intent) {
position = intent.getIntExtra("position", 0);
videoPath = intent.getStringArrayListExtra("list");
}
rvTiktok = findViewById(R.id.rv_tiktok);
mAdapter = new TikTokRecyclerViewAdapter(this,videoPath );
mViewPagerLayoutManager = new ViewPagerLayoutManager(this, OrientationHelper.VERTICAL);
rvTiktok.setLayoutManager(mViewPagerLayoutManager);
rvTiktok.setAdapter(mAdapter);
rvTiktok.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
}
});
mViewPagerLayoutManager.setOnViewPagerListener(new OnViewPagerListener() {
@Override
public void onInitComplete() {
//自动播放第一条
autoPlayVideo(position);
}
@Override
public void onPageRelease(boolean isNext, int position) {
if (mCurrentPosition == position) {
Jzvd.releaseAllVideos();
}
}
@Override
public void onPageSelected(int position, boolean isBottom) {
if (mCurrentPosition == position) {
return;
}
autoPlayVideo(position);
mCurrentPosition = position;
}
});
rvTiktok.addOnChildAttachStateChangeListener(new RecyclerView.OnChildAttachStateChangeListener() {
@Override
public void onChildViewAttachedToWindow(View view) {
}
@Override
public void onChildViewDetachedFromWindow(View view) {
Jzvd jzvd = view.findViewById(R.id.videoplayer);
if (jzvd != null && Jzvd.CURRENT_JZVD != null && jzvd.jzDataSource != null &&
jzvd.jzDataSource.containsTheUrl(Jzvd.CURRENT_JZVD.jzDataSource.getCurrentUrl())) {
if (Jzvd.CURRENT_JZVD != null && Jzvd.CURRENT_JZVD.screen != Jzvd.SCREEN_FULLSCREEN) {
Jzvd.releaseAllVideos();
}
}
}
});
}
private void autoPlayVideo(int postion) {
if (rvTiktok == null || rvTiktok.getChildAt(0) == null) {
return;
}
JzvdStdAssert player = rvTiktok.getChildAt(0).findViewById(R.id.videoplayer);
if (player != null) {
player.startVideoAfterPreloading();
}
}
@Override
public void onBackPressed() {
if (Jzvd.backPress()) {
return;
}
super.onBackPressed();
}
@Override
protected void onPause() {
super.onPause();
Jzvd.releaseAllVideos();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
break;
}
return super.onOptionsItemSelected(item);
}
}

View File

@@ -0,0 +1,195 @@
package com.uiui.videoplayer.activity;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.RecyclerView;
import android.Manifest;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import com.uiui.videoplayer.R;
import com.uiui.videoplayer.base.RecycleGridLayoutManager;
import com.uiui.videoplayer.base.SpacesItemDecoration;
import com.uiui.videoplayer.adapter.VideoAdapter;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private static final int REQUEST_PERMISSION_CODE = 200;
String[] permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE};
private RecyclerView recyclerView;
private VideoAdapter adapter;
private RecycleGridLayoutManager mManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
checkSelfPermission();
initView();
// String rootPath = Environment.getExternalStorageDirectory().getPath() + File.separator;
// traverseFolder(rootPath);
ScanTask scanTask = new ScanTask();
scanTask.execute();
}
private void initView() {
recyclerView = findViewById(R.id.recyclerView);
}
// private String[] getFolder(String folderPath) {
//
// }
public void traverseFolder(String path) {
int fileNum = 0, folderNum = 0;
File file = new File(path);
if (file.exists()) {
LinkedList<File> list = new LinkedList<File>();
File[] files = file.listFiles();
for (File file2 : files) {
if (file2.isDirectory()) {
Log.e("traverseFolder1", "文件夹:" + file2.getAbsolutePath());
list.add(file2);
folderNum++;
} else {
Log.e("traverseFolder1", "文件:" + file2.getAbsolutePath());
fileNum++;
}
}
File temp_file;
while (!list.isEmpty()) {
temp_file = list.removeFirst();
files = temp_file.listFiles();
for (File file2 : files) {
if (file2.isDirectory()) {
Log.e("traverseFolder2", "文件夹:" + file2.getAbsolutePath());
list.add(file2);
folderNum++;
} else {
Log.e("traverseFolder2", "文件:" + file2.getAbsolutePath());
fileNum++;
}
}
}
} else {
Log.e("traverseFolder1", "文件不存在!");
}
Log.e("traverseFolder1", "文件夹共有:" + folderNum + ",文件共有:" + fileNum);
}
private static final String[] extension = new String[]{
".3gp", ".flv", ".mkv", ".mov", ".mp4", ".webm"
};
private static boolean isVideoFormat(String filePath) {
for (String s : extension) {
if (filePath.endsWith(s)) {
return true;
}
}
return false;
}
public class ScanTask extends AsyncTask<Void, String, List<String>> {
@Override
protected List<String> doInBackground(Void... voids) {
List<String> fileList = new ArrayList<>();
String rootPath = Environment.getExternalStorageDirectory().getPath() + File.separator;
File file = new File(rootPath);
if (file.exists()) {
LinkedList<File> list = new LinkedList<File>();
File[] files = file.listFiles();
for (File file2 : files) {
publishProgress(file2.getAbsolutePath());
if (file2.isDirectory()) {
list.add(file2);
} else {
if (isVideoFormat(file2.getAbsolutePath())) {
fileList.add(file2.getAbsolutePath());
}
}
}
File temp_file;
while (!list.isEmpty()) {
temp_file = list.removeFirst();
files = temp_file.listFiles();
for (File file2 : files) {
publishProgress(file2.getAbsolutePath());
if (file2.isDirectory()) {
list.add(file2);
} else {
if (isVideoFormat(file2.getAbsolutePath())) {
fileList.add(file2.getAbsolutePath());
}
}
}
}
} else {
Log.e("traverseFolder1", "文件不存在!");
}
return fileList;
}
@Override
protected void onProgressUpdate(String... values) {
super.onProgressUpdate(values);
// Log.e("ScanTask", "onProgressUpdate: " + values[0]);
}
@Override
protected void onPostExecute(List<String> strings) {
super.onPostExecute(strings);
Log.e("ScanTask", "onPostExecute: " + strings);
adapter = new VideoAdapter(MainActivity.this, strings);
mManager = new RecycleGridLayoutManager(MainActivity.this, 2);
recyclerView.setLayoutManager(mManager);
recyclerView.setNestedScrollingEnabled(false);
recyclerView.addItemDecoration(new SpacesItemDecoration(getResources().getDimensionPixelSize(R.dimen.PX1x), getResources().getDimensionPixelSize(R.dimen.PX1x),
getResources().getDimensionPixelSize(R.dimen.PX1x), getResources().getDimensionPixelSize(R.dimen.PX1x)));
((DefaultItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
// recyclerView.setLayoutManager(new LinearLayoutManager(MainActivity.this));
recyclerView.setAdapter(adapter);
}
}
private void checkSelfPermission() {
List<String> mPermissionList = new ArrayList<>();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
for (String s : permissions) {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) {
mPermissionList.add(s);
}
}
if (mPermissionList.size() > 0) {//有权限没有通过,需要申请
ActivityCompat.requestPermissions(this, permissions, REQUEST_PERMISSION_CODE);
}
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_PERMISSION_CODE) {
//当然权限多了建议使用Switch不必纠结于此
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
} else if (grantResults[0] == PackageManager.PERMISSION_DENIED) {
}
}
}
}

View File

@@ -0,0 +1,16 @@
package com.uiui.videoplayer.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.uiui.videoplayer.R;
public class PlayActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play);
}
}

View File

@@ -0,0 +1,73 @@
package com.uiui.videoplayer.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.recyclerview.widget.RecyclerView;
import com.uiui.videoplayer.CustomJzvd.JzvdStdAssert;
import com.uiui.videoplayer.R;
import java.util.List;
import cn.jzvd.JZDataSource;
import cn.jzvd.Jzvd;
public class TikTokRecyclerViewAdapter extends RecyclerView.Adapter<TikTokRecyclerViewAdapter.MyViewHolder> {
public static final String TAG = "AdapterTikTokRecyclerView";
private List<String> videoPath;
private Context context;
public TikTokRecyclerViewAdapter(Context context) {
this.context = context;
}
public TikTokRecyclerViewAdapter(Context context, List<String> list) {
this.context = context;
this.videoPath = list;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
context).inflate(R.layout.item_tiktok, parent,
false));
return holder;
}
@SuppressLint("LongLogTag")
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
Log.i(TAG, "onBindViewHolder [" + holder.jzvdStdAssert.hashCode() + "] position=" + position);
final String path = videoPath.get(position);
JZDataSource jzDataSource = new JZDataSource(path, getFileName(path));
jzDataSource.looping = true;
holder.jzvdStdAssert.setUp(jzDataSource, Jzvd.SCREEN_NORMAL);
// Glide.with(holder.jzvdStd.getContext()).load(UrlsKt.getPl3()[position]).into(holder.jzvdStd.posterImageView);
}
@Override
public int getItemCount() {
return videoPath == null ? 0 : videoPath.size();
}
private String getFileName(String path) {
return path.substring(path.lastIndexOf("/") + 1);
}
class MyViewHolder extends RecyclerView.ViewHolder {
JzvdStdAssert jzvdStdAssert;
public MyViewHolder(View itemView) {
super(itemView);
jzvdStdAssert = itemView.findViewById(R.id.videoplayer);
}
}
}

View File

@@ -0,0 +1,168 @@
package com.uiui.videoplayer.adapter;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.media.Image;
import android.media.MediaMetadataRetriever;
import android.os.AsyncTask;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.uiui.videoplayer.R;
import com.uiui.videoplayer.activity.ActivityTikTok;
import com.uiui.videoplayer.utils.ToastUtil;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoHolder> {
private Context mContext;
private List<String> videoPath;
public VideoAdapter() {
}
public VideoAdapter(Context context) {
this.mContext = context;
}
public VideoAdapter(Context context, List<String> path) {
this.mContext = context;
this.videoPath = path;
}
@NonNull
@Override
public VideoHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
VideoHolder holder = new VideoHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_videofile, parent, false));
return holder;
}
@Override
public void onBindViewHolder(@NonNull final VideoHolder holder, final int position) {
final String path = videoPath.get(position);
File file = new File(path);
if (file.exists() && file.isFile()) {
// BitmapRetultListener bitmapRetultListener = new BitmapRetultListener() {
// @Override
// public void onScanCompleted(Bitmap bitmap) {
// Glide.with(holder.video_image).load(bitmap).into(holder.video_image);
// }
// };
Observable.create(new ObservableOnSubscribe<Bitmap>() {
@Override
public void subscribe(ObservableEmitter<Bitmap> emitter) throws Exception {
MediaMetadataRetriever mmr = new MediaMetadataRetriever();
mmr.setDataSource(path);
String duration = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
Long time = Long.valueOf(duration);
Bitmap bitmap = mmr.getFrameAtTime();//获得视频第一帧的Bitmap对象
emitter.onNext(bitmap);
}
}).subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<Bitmap>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(Bitmap bitmap) {
Glide.with(holder.video_image).load(bitmap).into(holder.video_image);
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
// this.listener = bitmapRetultListener;
holder.title.setText(getFileName(path));
}
holder.root.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// ToastUtil.show(path);
Intent intent = new Intent(mContext, ActivityTikTok.class);
intent.putExtra("position", position);
intent.putStringArrayListExtra("list", (ArrayList<String>) videoPath);
mContext.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return videoPath == null ? 0 : videoPath.size();
}
private String getFileName(String path) {
return path.substring(path.lastIndexOf("/") + 1);
}
static class VideoHolder extends RecyclerView.ViewHolder {
ImageView video_image;
TextView title;
ConstraintLayout root;
public VideoHolder(@NonNull View itemView) {
super(itemView);
video_image = itemView.findViewById(R.id.video_image);
title = itemView.findViewById(R.id.title_text);
root = itemView.findViewById(R.id.root);
}
}
private BitmapRetultListener listener;
class BitmapTask extends AsyncTask<String, Void, Bitmap> {
@Override
protected Bitmap doInBackground(String... strings) {
MediaMetadataRetriever mmr = new MediaMetadataRetriever();
mmr.setDataSource(strings[0]);
Bitmap bitmap = mmr.getFrameAtTime();//获得视频第一帧的Bitmap对象
return bitmap;
}
@Override
protected void onPostExecute(Bitmap bitmap) {
listener.onScanCompleted(bitmap);
}
}
interface BitmapRetultListener {
void onScanCompleted(Bitmap bitmap);
}
}

View File

@@ -0,0 +1,13 @@
package com.uiui.videoplayer.base;
import android.app.Application;
import com.uiui.videoplayer.utils.ToastUtil;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
ToastUtil.init(this);
}
}

View File

@@ -0,0 +1,116 @@
package com.uiui.videoplayer.base;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
/**
* Created by Administrator on 2016/11/18.
*/
public class RecycleGridLayoutManager extends GridLayoutManager {
private int mwidth = 0;
private int mheight = 0;
private int[] mMeasuredDimension = new int[2];
public RecycleGridLayoutManager(Context context, int spanCount) {
super(context, spanCount);
}
public RecycleGridLayoutManager(Context context, int spanCount, int orientation, boolean reverseLayout) {
super(context, spanCount, orientation, reverseLayout);
}
public int getMwidth() {
return mwidth;
}
public void setMwidth(int mwidth) {
this.mwidth = mwidth;
}
public int getMheight() {
return mheight;
}
public void setMheight(int mheight) {
this.mheight = mheight;
}
@Override
public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state, int widthSpec, int heightSpec) {
final int widthMode = View.MeasureSpec.getMode(widthSpec);
final int heightMode = View.MeasureSpec.getMode(heightSpec);
final int widthSize = View.MeasureSpec.getSize(widthSpec);
final int heightSize = View.MeasureSpec.getSize(heightSpec);
int width = 0;
int height = 0;
int count = getItemCount();
int span = getSpanCount();
for (int i = 0; i < count; i++) {
measureScrapChild(recycler, i,
View.MeasureSpec.makeMeasureSpec(i, View.MeasureSpec.UNSPECIFIED),
View.MeasureSpec.makeMeasureSpec(i, View.MeasureSpec.UNSPECIFIED),
mMeasuredDimension);
if (getOrientation() == HORIZONTAL) {
if (i % span == 0) {
width = width + mMeasuredDimension[0];
}
if (i == 0) {
height = mMeasuredDimension[1];
}
} else {
if (i % span == 0) {
height = height + mMeasuredDimension[1];
}
if (i == 0) {
width = mMeasuredDimension[0];
}
}
}
switch (widthMode) {
case View.MeasureSpec.EXACTLY:
width = widthSize;
case View.MeasureSpec.AT_MOST:
case View.MeasureSpec.UNSPECIFIED:
}
switch (heightMode) {
case View.MeasureSpec.EXACTLY:
height = heightSize;
case View.MeasureSpec.AT_MOST:
case View.MeasureSpec.UNSPECIFIED:
}
setMheight(height);
setMwidth(width);
setMeasuredDimension(width, height);
}
private void measureScrapChild(RecyclerView.Recycler recycler, int position, int widthSpec,
int heightSpec, int[] measuredDimension) {
if (position < getItemCount()) {
try {
View view = recycler.getViewForPosition(0);//fix 动态添加时报IndexOutOfBoundsException
if (view != null) {
RecyclerView.LayoutParams p = (RecyclerView.LayoutParams) view.getLayoutParams();
int childWidthSpec = ViewGroup.getChildMeasureSpec(widthSpec,
getPaddingLeft() + getPaddingRight(), p.width);
int childHeightSpec = ViewGroup.getChildMeasureSpec(heightSpec,
getPaddingTop() + getPaddingBottom(), p.height);
view.measure(childWidthSpec, childHeightSpec);
measuredDimension[0] = view.getMeasuredWidth() + p.leftMargin + p.rightMargin;
measuredDimension[1] = view.getMeasuredHeight() + p.bottomMargin + p.topMargin;
recycler.recycleView(view);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

View File

@@ -0,0 +1,50 @@
package com.uiui.videoplayer.base;
import android.graphics.Rect;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
/**
* RecycleView item 间距设置
*/
public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
private int left, right, bottom, top;
public SpacesItemDecoration(int space) {
this.left = space;
this.right = space;
this.bottom = space;
this.top = space;
}
public SpacesItemDecoration(int top, int bottom, boolean flag) {
this.top = top;
this.bottom = bottom;
this.left = 0;
this.right = 0;
}
public SpacesItemDecoration(int left, int right) {
this.left = left;
this.right = right;
this.bottom = 0;
this.top = 0;
}
public SpacesItemDecoration(int left, int right, int bottom, int top) {
this.left = left;
this.right = right;
this.bottom = bottom;
this.top = top;
}
@Override
public void getItemOffsets(Rect outRect, View view,
RecyclerView parent, RecyclerView.State state) {
outRect.left = left;
outRect.right = right;
outRect.bottom = bottom;
outRect.top = top;
}
}

View File

@@ -0,0 +1,132 @@
package com.uiui.videoplayer.base;
import android.content.Context;
import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.uiui.videoplayer.listener.OnViewPagerListener;
/**
* Created by 钉某人
* github: https://github.com/DingMouRen
* email: naildingmouren@gmail.com
*/
public class ViewPagerLayoutManager extends LinearLayoutManager {
private static final String TAG = "ViewPagerLayoutManager";
private PagerSnapHelper mPagerSnapHelper;
private OnViewPagerListener mOnViewPagerListener;
private RecyclerView mRecyclerView;
private int mDrift;//位移,用来判断移动方向
private RecyclerView.OnChildAttachStateChangeListener mChildAttachStateChangeListener = new RecyclerView.OnChildAttachStateChangeListener() {
@Override
public void onChildViewAttachedToWindow(View view) {
if (mOnViewPagerListener != null && getChildCount() == 1) {
mOnViewPagerListener.onInitComplete();
}
}
@Override
public void onChildViewDetachedFromWindow(View view) {
if (mDrift >= 0) {
if (mOnViewPagerListener != null)
mOnViewPagerListener.onPageRelease(true, getPosition(view));
} else {
if (mOnViewPagerListener != null)
mOnViewPagerListener.onPageRelease(false, getPosition(view));
}
}
};
public ViewPagerLayoutManager(Context context, int orientation) {
super(context, orientation, false);
init();
}
public ViewPagerLayoutManager(Context context, int orientation, boolean reverseLayout) {
super(context, orientation, reverseLayout);
init();
}
private void init() {
mPagerSnapHelper = new PagerSnapHelper();
}
@Override
public void onAttachedToWindow(RecyclerView view) {
super.onAttachedToWindow(view);
mPagerSnapHelper.attachToRecyclerView(view);
this.mRecyclerView = view;
mRecyclerView.addOnChildAttachStateChangeListener(mChildAttachStateChangeListener);
}
@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
super.onLayoutChildren(recycler, state);
}
/**
* 滑动状态的改变
* 缓慢拖拽-> SCROLL_STATE_DRAGGING
* 快速滚动-> SCROLL_STATE_SETTLING
* 空闲状态-> SCROLL_STATE_IDLE
*
* @param state
*/
@Override
public void onScrollStateChanged(int state) {
switch (state) {
case RecyclerView.SCROLL_STATE_IDLE:
View viewIdle = mPagerSnapHelper.findSnapView(this);
if (viewIdle != null) {
int positionIdle = getPosition(viewIdle);
if (mOnViewPagerListener != null && getChildCount() == 1) {
mOnViewPagerListener.onPageSelected(positionIdle, positionIdle == getItemCount() - 1);
}
}
break;
}
}
/**
* 监听竖直方向的相对偏移量
*
* @param dy
* @param recycler
* @param state
* @return
*/
@Override
public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
this.mDrift = dy;
return super.scrollVerticallyBy(dy, recycler, state);
}
/**
* 监听水平方向的相对偏移量
*
* @param dx
* @param recycler
* @param state
* @return
*/
@Override
public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, RecyclerView.State state) {
this.mDrift = dx;
return super.scrollHorizontallyBy(dx, recycler, state);
}
/**
* 设置监听
*
* @param listener
*/
public void setOnViewPagerListener(OnViewPagerListener listener) {
this.mOnViewPagerListener = listener;
}
}

View File

@@ -0,0 +1,22 @@
package com.uiui.videoplayer.listener;
/**
* Created by 钉某人
* github: https://github.com/DingMouRen
* email: naildingmouren@gmail.com
* 用于ViewPagerLayoutManager的监听
*/
public interface OnViewPagerListener {
/*初始化完成*/
void onInitComplete();
/*释放的监听*/
void onPageRelease(boolean isNext, int position);
/*选中的监听以及判断是否滑动到底部*/
void onPageSelected(int position, boolean isBottom);
}

View File

@@ -0,0 +1,14 @@
package com.uiui.videoplayer.utils;
import android.os.AsyncTask;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class FileUtils {
}

View File

@@ -0,0 +1,101 @@
package com.uiui.videoplayer.utils;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.Toast;
import com.uiui.videoplayer.BuildConfig;
/**
* Created by haoge on 2017/3/2.
*/
public class ToastUtil {
private static Handler mainHandler = new Handler(Looper.getMainLooper());
private static Toast toast;
private static Context mContext;
@SuppressLint("ShowToast")
public static void init(Context context) {
mContext = context;
toast = Toast.makeText(mContext, "", Toast.LENGTH_SHORT);
debugToast = Toast.makeText(mContext, "", Toast.LENGTH_SHORT);
}
private static long time1 = 0L;
private static long time2 = 0L;
public static void show(final String msg) {
mainHandler.post(new Runnable() {
@Override
public void run() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
time2 = System.currentTimeMillis();
if ((time2 - time1) > 3499) {
showToast(mContext, msg, Toast.LENGTH_LONG);
Log.e("fht", "LENGTH_LONG");
time1 = time2;
}
} else {
if (toast != null) {
toast.setText(msg);
toast.show();
}
}
}
});
}
private static Toast mToast = null;
//android 8.0以后限制
//https://www.jianshu.com/p/d9813ad03d59
//https://www.jianshu.com/p/050ce052b873
public static void showToast(Context context, String text, int duration) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.P) {
Toast.makeText(context, text, duration).show();
} else {
if (mToast == null) {
mToast = Toast.makeText(context, text, duration);
} else {
mToast.setText(text);
mToast.setDuration(duration);
}
mToast.show();
}
}
// public static void showInCenter(String msg) {
// mainHandler.post(() -> {
// if (toast != null) {
// toast.setGravity(Gravity.CENTER, 0, 0);
// toast.setText(msg);
// toast.show();
// }
// });
// }
static Handler debugHandler = new Handler(Looper.getMainLooper());
static Toast debugToast;
public static void debugShow(final String msg) {
mainHandler.post(new Runnable() {
@Override
public void run() {
if (BuildConfig.DEBUG) {
if (toast != null) {
toast.setText(msg);
toast.show();
}
}
}
});
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

View File

@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@android:color/white" />
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
</shape>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp" />
<solid android:color="@android:color/holo_red_light" />
</shape>

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/tiktok_star_selected" android:state_selected="true" />
<item android:drawable="@drawable/tiktok_star_normal" />
</selector>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.MainActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.recyclerview.widget.RecyclerView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.PlayActivity">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#333333"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_tiktok"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none" />
</RelativeLayout>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.uiui.videoplayer.CustomJzvd.JzvdStdAssert
android:id="@+id/videoplayer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<ImageView
android:id="@+id/video_image"
android:layout_width="288dp"
android:layout_height="162dp"
android:layout_marginTop="4dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/title_text"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
android:maxLines="2"
android:text="dsadasdadasdasdasddsadsadasdassdsad"
android:textColor="@color/black"
app:layout_constraintEnd_toEndOf="@+id/video_image"
app:layout_constraintStart_toStartOf="@+id/video_image"
app:layout_constraintTop_toBottomOf="@+id/video_image" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
</resources>

View File

@@ -0,0 +1,24 @@
<resources>
<dimen name="PX0x">0dp</dimen>
<dimen name="PX1x">1dp</dimen>
<dimen name="PX5x">5dp</dimen>
</resources>

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">视频播放器</string>
</resources>

View File

@@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>