version:1.1.3

bugfixes:修复图标大小,增加下载进度
update:
This commit is contained in:
2026-03-14 11:25:24 +08:00
parent 6b093de6c2
commit 7fd0760c79
13 changed files with 158 additions and 53 deletions

View File

@@ -18,8 +18,8 @@ android {
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature. //There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 29 targetSdkVersion 29
versionCode 12 versionCode 14
versionName "1.1.1" versionName "1.1.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -57,7 +57,8 @@
<activity <activity
android:name=".activity.category.online.CategoryVideoActivity" android:name=".activity.category.online.CategoryVideoActivity"
android:launchMode="singleTask" android:launchMode="singleTask"
android:screenOrientation="portrait" /> android:screenOrientation="portrait"
android:theme="@style/AppThemeWhite" />
<activity <activity
android:name=".activity.category.list.CategoryListActivity" android:name=".activity.category.list.CategoryListActivity"
android:launchMode="singleTask" android:launchMode="singleTask"

View File

@@ -34,7 +34,7 @@ public class CategoryListActivity extends BaseMvvmActivity<CategoryListViewModel
@Override @Override
protected void initView() { protected void initView() {
mCategoryAdapter = new CategoryAdapter(); mCategoryAdapter = new CategoryAdapter();
mViewDataBinding.rvCategory.setLayoutManager(new GridLayoutManager(CategoryListActivity.this, 5)); mViewDataBinding.rvCategory.setLayoutManager(new GridLayoutManager(CategoryListActivity.this, 4));
mViewDataBinding.rvCategory.setAdapter(mCategoryAdapter); mViewDataBinding.rvCategory.setAdapter(mCategoryAdapter);
} }

View File

@@ -3,6 +3,7 @@ package com.hainaos.vc.activity.player;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem; import com.google.android.exoplayer2.MediaItem;
@@ -24,6 +25,11 @@ public class DecryptionPlayerActivity extends BaseMvvmActivity<DecryptionPlayerV
private ExoPlayer mExoPlayer; private ExoPlayer mExoPlayer;
private String mUrl; private String mUrl;
@Override
public boolean setNightMode() {
return false;
}
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
return R.layout.activity_decryption_player; return R.layout.activity_decryption_player;
@@ -156,6 +162,9 @@ public class DecryptionPlayerActivity extends BaseMvvmActivity<DecryptionPlayerV
} }
public class BtnClick { public class BtnClick {
public void exit(View view) {
releasePlayer();
finish();
}
} }
} }

View File

@@ -7,6 +7,7 @@ import android.graphics.Bitmap;
import android.media.MediaMetadataRetriever; import android.media.MediaMetadataRetriever;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.format.Formatter;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@@ -21,6 +22,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.arialyy.annotations.Download; import com.arialyy.annotations.Download;
import com.arialyy.aria.core.Aria; import com.arialyy.aria.core.Aria;
import com.arialyy.aria.core.download.DownloadEntity;
import com.arialyy.aria.core.task.DownloadTask; import com.arialyy.aria.core.task.DownloadTask;
import com.hainaos.vc.R; import com.hainaos.vc.R;
import com.hainaos.vc.activity.player.DecryptionPlayerActivity; import com.hainaos.vc.activity.player.DecryptionPlayerActivity;
@@ -78,23 +80,58 @@ public class CategoryVideoAdapter extends RecyclerView.Adapter<CategoryVideoAdap
CategoryVideoInfo categoryVideoInfo = mLocalVideoInfos.get(position); CategoryVideoInfo categoryVideoInfo = mLocalVideoInfos.get(position);
String name = categoryVideoInfo.getName(); String name = categoryVideoInfo.getName();
if (!TextUtils.isEmpty(name)) { if (!TextUtils.isEmpty(name)) {
holder.title.setText(name); holder.tv_title.setText(name);
} }
String url = categoryVideoInfo.getFile_url(); String url = categoryVideoInfo.getFile_url();
String md5 = categoryVideoInfo.getMd5(); String md5 = categoryVideoInfo.getMd5();
long sizeBytes = categoryVideoInfo.getFile_size();
String fileSize = Formatter.formatFileSize(mContext, sizeBytes);
holder.tv_size.setText("视频大小: " + fileSize);
String fileName = FileUtils.getFileNamefromURL(url); String fileName = FileUtils.getFileNamefromURL(url);
File file = new File(FileUtils.getHainaVideoPath(mContext) + mDirName + File.separator + fileName); File file = new File(FileUtils.getHainaVideoPath(mContext) + mDirName + File.separator + fileName);
if (file.exists()) {
holder.tv_download.setText("删除"); DownloadEntity entity = Aria.download(mContext).getFirstDownloadEntity(url);
holder.tv_download.setBackground(mContext.getDrawable(R.drawable.bg_delete_button)); if (entity == null) {
} else {
holder.tv_download.setText("下载"); holder.tv_download.setText("下载");
holder.tv_download.setBackground(mContext.getDrawable(R.drawable.bg_download_button)); holder.tv_download.setBackground(mContext.getDrawable(R.drawable.bg_download_button));
} else {
int state = entity.getState();
switch (state) {
case 1:
if (file.exists()) {
holder.tv_download.setText("删除");
holder.tv_download.setBackground(mContext.getDrawable(R.drawable.bg_delete_button));
} else {
holder.tv_download.setText("下载");
holder.tv_download.setBackground(mContext.getDrawable(R.drawable.bg_download_button));
}
break;
case -1:
case 0:
case 2:
case 3:
case 5:
case 6:
case 7:
holder.tv_download.setText("下载");
holder.tv_download.setBackground(mContext.getDrawable(R.drawable.bg_download_button));
break;
case 4:
int percent = entity.getPercent();
holder.tv_download.setText(percent + "%");
holder.tv_download.setBackground(mContext.getDrawable(R.drawable.bg_download_button));
break;
}
} }
String cover = categoryVideoInfo.getCover(); String cover = categoryVideoInfo.getCover();
GlideLoadUtils.getInstance().glideLoad(mContext, cover, holder.video_image); GlideLoadUtils.getInstance().glideLoad(mContext, cover, holder.video_image);
holder.duration.setText("视频时长: " + TimeUtils.TimeFormat(categoryVideoInfo.getDuration() * 1000)); holder.tv_duration.setText("视频时长: " + TimeUtils.TimeFormat(categoryVideoInfo.getDuration() * 1000));
holder.tv_download.setOnClickListener(new View.OnClickListener() { holder.tv_download.setOnClickListener(new View.OnClickListener() {
@Override @Override
@@ -192,7 +229,7 @@ public class CategoryVideoAdapter extends RecyclerView.Adapter<CategoryVideoAdap
dialog.dismiss(); dialog.dismiss();
File file = new File(path); File file = new File(path);
if (file.delete()) { if (file.delete()) {
removeItem(position); notifyItemChanged(position);
ToastUtil.show("删除成功"); ToastUtil.show("删除成功");
} else { } else {
ToastUtil.show("删除失败,检查权限是否开启"); ToastUtil.show("删除失败,检查权限是否开启");
@@ -231,16 +268,17 @@ public class CategoryVideoAdapter extends RecyclerView.Adapter<CategoryVideoAdap
static class VideoHolder extends RecyclerView.ViewHolder { static class VideoHolder extends RecyclerView.ViewHolder {
NiceImageView video_image; NiceImageView video_image;
TextView title, duration, tv_download; TextView tv_title, tv_duration, tv_download, tv_size;
ConstraintLayout root; ConstraintLayout root;
public VideoHolder(@NonNull View itemView) { public VideoHolder(@NonNull View itemView) {
super(itemView); super(itemView);
video_image = itemView.findViewById(R.id.video_image);
title = itemView.findViewById(R.id.title_text);
duration = itemView.findViewById(R.id.duration);
tv_download = itemView.findViewById(R.id.tv_download);
root = itemView.findViewById(R.id.root); root = itemView.findViewById(R.id.root);
video_image = itemView.findViewById(R.id.video_image);
tv_title = itemView.findViewById(R.id.tv_title);
tv_duration = itemView.findViewById(R.id.tv_duration);
tv_download = itemView.findViewById(R.id.tv_download);
tv_size = itemView.findViewById(R.id.tv_size);
} }
} }
@@ -272,6 +310,7 @@ public class CategoryVideoAdapter extends RecyclerView.Adapter<CategoryVideoAdap
@Download.onTaskRunning @Download.onTaskRunning
void running(DownloadTask task) { void running(DownloadTask task) {
Log.e(TAG, "running: " + "正在下载:" + task.getState() + "-" + task.getPercent() + "--" + task.getExtendField()); Log.e(TAG, "running: " + "正在下载:" + task.getState() + "-" + task.getPercent() + "--" + task.getExtendField());
notifyDataSetChanged(); notifyDataSetChanged();
} }

View File

@@ -39,7 +39,7 @@ public class AppFragment extends BaseMvvmFragment<AppViewModel, FragmentAppBindi
@Override @Override
protected void initView(Bundle bundle) { protected void initView(Bundle bundle) {
mHomeAppAdapter = new HomeAppAdapter(); mHomeAppAdapter = new HomeAppAdapter();
mViewDataBinding.rvApp.setLayoutManager(new GridLayoutManager(mContext, 5)); mViewDataBinding.rvApp.setLayoutManager(new GridLayoutManager(mContext, 4));
mViewDataBinding.rvApp.setAdapter(mHomeAppAdapter); mViewDataBinding.rvApp.setAdapter(mHomeAppAdapter);

View File

@@ -41,7 +41,7 @@ public class CategoryFragment extends BaseMvvmFragment<CategoryViewModel, Fragme
protected void initView(Bundle bundle) { protected void initView(Bundle bundle) {
// mHomeAppAdapter = new HomeAppAdapter(); // mHomeAppAdapter = new HomeAppAdapter();
mCategoryAdapter = new HomeCategoryAdapter(); mCategoryAdapter = new HomeCategoryAdapter();
mViewDataBinding.rvApp.setLayoutManager(new GridLayoutManager(mContext, 5)); mViewDataBinding.rvApp.setLayoutManager(new GridLayoutManager(mContext, 4));
// mViewDataBinding.rvApp.setAdapter(mHomeAppAdapter); // mViewDataBinding.rvApp.setAdapter(mHomeAppAdapter);
mViewDataBinding.rvApp.setAdapter(mCategoryAdapter); mViewDataBinding.rvApp.setAdapter(mCategoryAdapter);
} }

View File

@@ -43,7 +43,7 @@
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/icon_back_white" android:src="@drawable/icon_back_black"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@@ -57,8 +57,8 @@
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:text="@{title}" android:text="@{title}"
android:textColor="@color/white" android:textColor="@color/black"
android:textSize="18sp" android:textSize="16sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tv_total" app:layout_constraintEnd_toStartOf="@+id/tv_total"
@@ -72,8 +72,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:text="视频:0个" android:text="视频:0个"
android:textColor="@color/white" android:textColor="@color/black"
android:textSize="16sp" android:textSize="14sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android" <layout 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" xmlns:tools="http://schemas.android.com/tools"
tools:context=".activity.player.DecryptionPlayerActivity"> tools:context=".activity.player.DecryptionPlayerActivity">
@@ -14,10 +15,35 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout3"
android:layout_width="match_parent"
android:layout_height="32dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_back"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="4dp"
android:adjustViewBounds="true"
android:onClick="@{click::exit}"
android:scaleType="centerCrop"
android:src="@drawable/icon_back_white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.exoplayer2.ui.PlayerView <com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/player_view" android:id="@+id/player_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout3" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

View File

@@ -16,14 +16,13 @@
<ImageView <ImageView
android:id="@+id/iv_icon" android:id="@+id/iv_icon"
android:layout_width="40dp" android:layout_width="46dp"
android:layout_height="40dp" android:layout_height="46dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginStart="4dp" android:layout_marginStart="4dp"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="fitCenter" android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
@@ -43,8 +42,8 @@
<ImageView <ImageView
android:id="@+id/iv_lock_icon" android:id="@+id/iv_lock_icon"
android:layout_width="8dp" android:layout_width="10dp"
android:layout_height="8dp" android:layout_height="10dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="fitCenter" android:scaleType="fitCenter"
@@ -54,22 +53,34 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/tv_app_name" android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginStart="4dp"
android:gravity="center_horizontal"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="8sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_lock_icon" app:layout_constraintStart_toEndOf="@+id/iv_lock_icon"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/tv_app_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="4dp"
android:gravity="center_horizontal"
android:maxLines="2"
android:textColor="@color/white"
android:textSize="8sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -17,11 +17,12 @@
<com.shehuan.niv.NiceImageView <com.shehuan.niv.NiceImageView
android:id="@+id/video_image" android:id="@+id/video_image"
android:layout_width="80dp" android:layout_width="72dp"
android:layout_height="80dp" android:layout_height="72dp"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="centerCrop" android:scaleType="centerCrop"
app:corner_radius="4dp"
app:is_cover_src="true" app:is_cover_src="true"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -42,11 +43,11 @@
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:orientation="vertical"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginHorizontal="8dp" android:layout_marginHorizontal="8dp"
android:layout_marginVertical="8dp" android:layout_marginVertical="8dp"
android:maxLines="3" android:maxLines="3"
android:orientation="vertical"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="15sp" android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
@@ -57,29 +58,36 @@
app:layout_constraintVertical_bias="0.15"> app:layout_constraintVertical_bias="0.15">
<TextView <TextView
android:id="@+id/title_text" android:id="@+id/tv_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="3" android:maxLines="3"
android:textColor="@color/white" android:textColor="@color/black"
android:textSize="13sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
android:textSize="15sp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="标题" /> tools:text="标题" />
<TextView <TextView
android:id="@+id/duration" android:id="@+id/tv_duration"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:maxLines="1" android:maxLines="1"
android:singleLine="true" android:singleLine="true"
android:text="00:00" android:textColor="@color/text_content"
android:textColor="@color/white" android:textSize="10sp"
android:textSize="12sp" tools:text="00:00" />
app:layout_constraintBottom_toBottomOf="@+id/video_image"
app:layout_constraintEnd_toEndOf="@+id/video_image" /> <TextView
android:id="@+id/tv_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:maxLines="1"
android:singleLine="true"
android:textColor="@color/text_content"
android:textSize="10sp"
tools:text="0kb" />
</LinearLayout> </LinearLayout>

View File

@@ -15,6 +15,7 @@
<color name="btn_sure_pressed">#1E63FF</color> <color name="btn_sure_pressed">#1E63FF</color>
<color name="btn_cancel">#d0d0d0</color> <color name="btn_cancel">#d0d0d0</color>
<color name="btn_cancel_pressed">#9F9F9F</color> <color name="btn_cancel_pressed">#9F9F9F</color>
<color name="text_content">#bfbfbf</color>
<color name="home_background_color">#efefef</color> <color name="home_background_color">#efefef</color>
<color name="space_color">#3D54D9</color> <color name="space_color">#3D54D9</color>

View File

@@ -10,6 +10,16 @@
<item name="android:fitsSystemWindows">true</item> <item name="android:fitsSystemWindows">true</item>
</style> </style>
<style name="AppThemeWhite" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@color/white</item>
<item name="android:navigationBarColor">?attr/colorPrimary</item>
<item name="android:fitsSystemWindows">true</item>
</style>
<!-- &lt;!&ndash; Base application theme. &ndash;&gt;--> <!-- &lt;!&ndash; Base application theme. &ndash;&gt;-->
<!-- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">--> <!-- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">-->
<!-- &lt;!&ndash; Customize your theme here. &ndash;&gt;--> <!-- &lt;!&ndash; Customize your theme here. &ndash;&gt;-->