version:
update: bugfixes:修复缩略图
This commit is contained in:
@@ -5,7 +5,7 @@ static def appName() {
|
||||
}
|
||||
|
||||
static def releaseTime() {
|
||||
return new Date().format("yyyyMMdd-HHmmss", TimeZone.getDefault())
|
||||
return new Date().format("yyyyMMdd_HHmmss", TimeZone.getDefault())
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -89,7 +89,7 @@ android {
|
||||
buildTypes {
|
||||
debug {
|
||||
buildConfigField "String", "platform", '"UMTK11"'
|
||||
versionNameSuffix "-debug"
|
||||
versionNameSuffix "_debug"
|
||||
//Zipalign优化
|
||||
zipAlignEnabled true
|
||||
minifyEnabled false
|
||||
@@ -97,7 +97,7 @@ android {
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
if (outputFile != null) {
|
||||
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk"
|
||||
def fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType.name}.apk"
|
||||
output.outputFileName = fileName
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ android {
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = ""
|
||||
if (outputFile != null) {
|
||||
def fileName = "${appName()}-${variant.versionCode}-V${variant.versionName}-${releaseTime()}-${buildType.name}.apk"
|
||||
def fileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType.name}.apk"
|
||||
output.outputFileName = new File(outputFile, fileName)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.uiui.videoplayer.adapter;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
@@ -15,13 +14,10 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.shehuan.niv.NiceImageView;
|
||||
@@ -37,15 +33,6 @@ import com.uiui.videoplayer.utils.VideoUtils;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.core.ObservableEmitter;
|
||||
import io.reactivex.rxjava3.core.ObservableOnSubscribe;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import wseemann.media.FFmpegMediaMetadataRetriever;
|
||||
|
||||
public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoHolder> {
|
||||
private static final String TAG = VideoAdapter.class.getSimpleName();
|
||||
private Activity mContext;
|
||||
@@ -101,11 +88,11 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoHolder>
|
||||
if (TextUtils.isEmpty(localPath)) {
|
||||
holder.iv_status.setVisibility(View.VISIBLE);
|
||||
if (!TextUtils.isEmpty(url)) {
|
||||
Glide.with(mContext).load(url).error(R.mipmap.ic_launcher).into(holder.video_image);
|
||||
Glide.with(mContext).load(url + "?x-oss-process=video/snapshot,t_0,f_jpg").error(R.mipmap.ic_launcher).into(holder.video_image);
|
||||
String fileName = localVideoInfo.getFile_name();
|
||||
if (TextUtils.isEmpty(fileName)){
|
||||
if (TextUtils.isEmpty(fileName)) {
|
||||
holder.title.setText(VideoUtils.getFileNameWithoutExtension(url));
|
||||
}else {
|
||||
} else {
|
||||
holder.title.setText(fileName);
|
||||
}
|
||||
holder.duration.setText(Utils.TimeFormat(localVideoInfo.getDuration() * 1000));
|
||||
@@ -115,56 +102,59 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoHolder>
|
||||
File file = new File(localPath);
|
||||
if (file.exists()) {
|
||||
holder.iv_status.setVisibility(View.GONE);
|
||||
Observable.create(new ObservableOnSubscribe<VideoResult>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<VideoResult> emitter) throws Exception {
|
||||
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
|
||||
mmr.setDataSource(localPath);
|
||||
String duration = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION);
|
||||
Bitmap bitmap = mmr.getFrameAtTime();//获得视频第一帧的Bitmap对象.
|
||||
Long time = Long.valueOf(duration);
|
||||
|
||||
mmr.release();
|
||||
VideoResult result = new VideoResult();
|
||||
result.frame = bitmap;
|
||||
result.time = time;
|
||||
emitter.onNext(result);
|
||||
}
|
||||
}).subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<VideoResult>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("VideoResult", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(VideoResult result) {
|
||||
Log.e("VideoResult", "onNext: " + result);
|
||||
try {
|
||||
Glide.with(holder.video_image).load(result.frame).skipMemoryCache(false).into(new SimpleTarget<Drawable>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||
holder.video_image.setImageDrawable(resource);
|
||||
}
|
||||
});
|
||||
holder.duration.setText(Utils.TimeFormat(result.time));
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("VideoResult", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("VideoResult", "onComplete: ");
|
||||
}
|
||||
});
|
||||
Glide.with(mContext).load(url + "?x-oss-process=video/snapshot,t_0,f_jpg").error(R.mipmap.ic_launcher).into(holder.video_image);
|
||||
holder.duration.setText(Utils.TimeFormat(localVideoInfo.getDuration() * 1000));
|
||||
// Observable.create(new ObservableOnSubscribe<VideoResult>() {
|
||||
// @Override
|
||||
// public void subscribe(ObservableEmitter<VideoResult> emitter) throws Exception {
|
||||
// FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
|
||||
// mmr.setDataSource(localPath);
|
||||
// String duration = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_DURATION);
|
||||
// Bitmap bitmap = mmr.getFrameAtTime();//获得视频第一帧的Bitmap对象.
|
||||
// Long time = Long.valueOf(duration);
|
||||
//
|
||||
// mmr.release();
|
||||
// VideoResult result = new VideoResult();
|
||||
// result.frame = bitmap;
|
||||
// result.time = time;
|
||||
// emitter.onNext(result);
|
||||
// }
|
||||
// }).subscribeOn(Schedulers.newThread())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(new Observer<VideoResult>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// Log.e("VideoResult", "onSubscribe: ");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(VideoResult result) {
|
||||
// Log.e("VideoResult", "onNext: " + result);
|
||||
// try {
|
||||
// Glide.with(holder.video_image).load(result.frame).skipMemoryCache(false).into(new SimpleTarget<Drawable>() {
|
||||
// @Override
|
||||
// public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||
// holder.video_image.setImageDrawable(resource);
|
||||
// }
|
||||
// });
|
||||
// holder.duration.setText(Utils.TimeFormat(result.time));
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Throwable e) {
|
||||
// Log.e("VideoResult", "onError: " + e.getMessage());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// Log.e("VideoResult", "onComplete: ");
|
||||
// }
|
||||
// });
|
||||
} else {
|
||||
holder.iv_status.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -180,7 +170,7 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoHolder>
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
JGYUtils.getInstance().ariaDownload(url, GsonUtils.getJsonObject(GsonUtils.toJSONString(localVideoInfo)));
|
||||
ToastUtil.show(String.format( mContext.getString(R.string.download_now), VideoUtils.getFileNameWithoutExtension(url)));
|
||||
ToastUtil.show(String.format(mContext.getString(R.string.download_now), VideoUtils.getFileNameWithoutExtension(url)));
|
||||
}
|
||||
} else {
|
||||
Intent intent = new Intent(mContext, ActivityTikTok.class);
|
||||
@@ -203,7 +193,7 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoHolder>
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
JGYUtils.getInstance().ariaDownload(url, GsonUtils.getJsonObject(GsonUtils.toJSONString(localVideoInfo)));
|
||||
ToastUtil.show(String.format( mContext.getString(R.string.download_now), VideoUtils.getFileNameWithoutExtension(url)));
|
||||
ToastUtil.show(String.format(mContext.getString(R.string.download_now), VideoUtils.getFileNameWithoutExtension(url)));
|
||||
}
|
||||
} else {
|
||||
Intent intent = new Intent(mContext, ActivityTikTok.class);
|
||||
|
||||
BIN
app/src/main/res/drawable-hdpi/icon_back.png
Normal file
BIN
app/src/main/res/drawable-hdpi/icon_back.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 891 B |
@@ -41,7 +41,7 @@
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/back"
|
||||
android:src="@drawable/icon_back"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -50,7 +50,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="家庭空间"
|
||||
android:textColor="@color/black"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_20"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -87,12 +87,12 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:tl_indicator_color="@color/black"
|
||||
app:tl_indicator_color="@color/white"
|
||||
app:tl_indicator_style="NORMAL"
|
||||
app:tl_indicator_width_equal_title="true"
|
||||
app:tl_tab_space_equal="true"
|
||||
app:tl_textBold="SELECT"
|
||||
app:tl_textSelectColor="@color/black"
|
||||
app:tl_textSelectColor="@color/white"
|
||||
app:tl_textSelectSize="@dimen/sp_18"
|
||||
app:tl_textSize="@dimen/sp_17"
|
||||
app:tl_textUnSelectColor="@color/gray"
|
||||
@@ -104,7 +104,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/black"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/main_sliding_tab_layout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -42,9 +42,12 @@
|
||||
android:singleLine="true"
|
||||
android:text="00:00"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_7"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/video_image"
|
||||
app:layout_constraintEnd_toEndOf="@+id/video_image" />
|
||||
app:layout_constraintEnd_toEndOf="@+id/video_image"
|
||||
app:layout_constraintHorizontal_bias="0.872"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<color name="colorPrimary">#6200EE</color>
|
||||
<color name="colorPrimaryDark">#3700B3</color>
|
||||
<color name="colorAccent">#4880ff</color>
|
||||
<color name="colorBackground">#f3f3f3</color>
|
||||
<color name="colorBackground">#000000</color>
|
||||
|
||||
<color name="white">#FFFFFF</color>
|
||||
<color name="black">#000000</color>
|
||||
|
||||
@@ -60,11 +60,11 @@ public class RemoteManager {
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
Log.e(TAG, "onServiceDisconnected: " + name);
|
||||
mIGetInfoInterface = null;
|
||||
bindinfoService();
|
||||
bindInfoService();
|
||||
}
|
||||
};
|
||||
if (mIGetInfoInterface == null) {
|
||||
bindinfoService();
|
||||
bindInfoService();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class RemoteManager {
|
||||
|
||||
public void checkAvailable() {
|
||||
if (mIGetInfoInterface == null) {
|
||||
bindinfoService();
|
||||
bindInfoService();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class RemoteManager {
|
||||
mListeners.remove(listener);
|
||||
}
|
||||
|
||||
private void bindinfoService() {
|
||||
private void bindInfoService() {
|
||||
//这是连接aidl服务的代码
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(AOLEYUNINFO_ACTION);
|
||||
@@ -123,7 +123,7 @@ public class RemoteManager {
|
||||
String sn = mMMKV.decodeString(serialKey, "");
|
||||
Log.e(TAG, "sn: " + sn);
|
||||
if (mIGetInfoInterface == null) {
|
||||
bindinfoService();
|
||||
bindInfoService();
|
||||
return sn;
|
||||
}
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user