From 7763e34b6b98be837b4d8c4c2f8d7dfec9e1f2cd Mon Sep 17 00:00:00 2001 From: tongtongstudio Date: Sat, 4 Jan 2025 09:53:53 +0800 Subject: [PATCH] =?UTF-8?q?version:=20update:=20bugfixes:=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E7=BC=A9=E7=95=A5=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 8 +- .../videoplayer/adapter/VideoAdapter.java | 124 ++++++++---------- app/src/main/res/drawable-hdpi/icon_back.png | Bin 0 -> 891 bytes app/src/main/res/layout/activity_main.xml | 10 +- app/src/main/res/layout/item_videofile.xml | 7 +- app/src/main/res/values/colors.xml | 2 +- .../com/uiui/sn/manager/RemoteManager.java | 10 +- 7 files changed, 77 insertions(+), 84 deletions(-) create mode 100644 app/src/main/res/drawable-hdpi/icon_back.png diff --git a/app/build.gradle b/app/build.gradle index a3f9e00..33429fb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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) } } diff --git a/app/src/main/java/com/uiui/videoplayer/adapter/VideoAdapter.java b/app/src/main/java/com/uiui/videoplayer/adapter/VideoAdapter.java index 0a19f72..1c16d97 100644 --- a/app/src/main/java/com/uiui/videoplayer/adapter/VideoAdapter.java +++ b/app/src/main/java/com/uiui/videoplayer/adapter/VideoAdapter.java @@ -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 { private static final String TAG = VideoAdapter.class.getSimpleName(); private Activity mContext; @@ -101,11 +88,11 @@ public class VideoAdapter extends RecyclerView.Adapter 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 File file = new File(localPath); if (file.exists()) { holder.iv_status.setVisibility(View.GONE); - Observable.create(new ObservableOnSubscribe() { - @Override - public void subscribe(ObservableEmitter 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() { - @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() { - @Override - public void onResourceReady(@NonNull Drawable resource, @Nullable Transition 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() { +// @Override +// public void subscribe(ObservableEmitter 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() { +// @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() { +// @Override +// public void onResourceReady(@NonNull Drawable resource, @Nullable Transition 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 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 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); diff --git a/app/src/main/res/drawable-hdpi/icon_back.png b/app/src/main/res/drawable-hdpi/icon_back.png new file mode 100644 index 0000000000000000000000000000000000000000..1375742399d16634b193871320f3cdfc2527b80b GIT binary patch literal 891 zcmV->1BCpEP)Px&HAzH4RCr$Poa=GiFbsr=PU24NN)lHRyAnH<#GS;QAi)eZqmeI1tO$|-?(|oW zlfGLJ3lb8Q8`+rov6S+?l=7{V@{5SxEgqdLF5>+f%=}hL`Ej_Z0|pxvfOJR2Lxu zDh;y9EHVP9b*zgltb{k!Ah*D|Fw%fQb_s8363GB>89>0}O)t%~p}Q=E0eH)*3k2fS zBm%%&ZjiMQrvZ#qU1;G=8v~Wqh1^dV;eE_jTcd*b5423#hfXf$0Cyp+Ni46?Ar1prL;BKN zlE)+?&EJw-LMm}6z*~Sg9AJg0eH|g3;hq9;2eIW9!&NQQ00I!@&@ffYRDcztyu+(8 z+##x#=>W4qTmmpt)v^p=7Klp$W~f?R0E}$7-2em(x2w|66+i%@8^i4mAYiy%Ky(Q( z5=6HEqZn@2070*~r1WzS5QI2=!72nm)NosT7f`#7910*{xTmePgahaeVn~31;T~SK zgartA#i0;G0|X!rt6IVX1Pu2Oh$#SqUeR>HDh)soqFL3F3Lt2>O?tLd0tCEbcQ~g7 zsD#)Z%BcY=4EG(Nrs%KlDNzPfu7{{pkNs$iD_ R&2#_&002ovPDHLkV1g @@ -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" diff --git a/app/src/main/res/layout/item_videofile.xml b/app/src/main/res/layout/item_videofile.xml index 7d73efd..f3c1a23 100644 --- a/app/src/main/res/layout/item_videofile.xml +++ b/app/src/main/res/layout/item_videofile.xml @@ -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" /> #6200EE #3700B3 #4880ff - #f3f3f3 + #000000 #FFFFFF #000000 diff --git a/app/src/uiuios/java/com/uiui/sn/manager/RemoteManager.java b/app/src/uiuios/java/com/uiui/sn/manager/RemoteManager.java index daa687d..221073a 100644 --- a/app/src/uiuios/java/com/uiui/sn/manager/RemoteManager.java +++ b/app/src/uiuios/java/com/uiui/sn/manager/RemoteManager.java @@ -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 {