version:1.1.3
bugfixes:修复图标大小,增加下载进度 update:
This commit is contained in:
@@ -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.
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 29
|
||||
versionCode 12
|
||||
versionName "1.1.1"
|
||||
versionCode 14
|
||||
versionName "1.1.3"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -57,7 +57,8 @@
|
||||
<activity
|
||||
android:name=".activity.category.online.CategoryVideoActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppThemeWhite" />
|
||||
<activity
|
||||
android:name=".activity.category.list.CategoryListActivity"
|
||||
android:launchMode="singleTask"
|
||||
|
||||
@@ -34,7 +34,7 @@ public class CategoryListActivity extends BaseMvvmActivity<CategoryListViewModel
|
||||
@Override
|
||||
protected void initView() {
|
||||
mCategoryAdapter = new CategoryAdapter();
|
||||
mViewDataBinding.rvCategory.setLayoutManager(new GridLayoutManager(CategoryListActivity.this, 5));
|
||||
mViewDataBinding.rvCategory.setLayoutManager(new GridLayoutManager(CategoryListActivity.this, 4));
|
||||
mViewDataBinding.rvCategory.setAdapter(mCategoryAdapter);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.hainaos.vc.activity.player;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
import com.google.android.exoplayer2.MediaItem;
|
||||
@@ -24,6 +25,11 @@ public class DecryptionPlayerActivity extends BaseMvvmActivity<DecryptionPlayerV
|
||||
private ExoPlayer mExoPlayer;
|
||||
private String mUrl;
|
||||
|
||||
@Override
|
||||
public boolean setNightMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_decryption_player;
|
||||
@@ -156,6 +162,9 @@ public class DecryptionPlayerActivity extends BaseMvvmActivity<DecryptionPlayerV
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
|
||||
public void exit(View view) {
|
||||
releasePlayer();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.graphics.Bitmap;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.os.AsyncTask;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.Formatter;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -21,6 +22,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.arialyy.annotations.Download;
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.download.DownloadEntity;
|
||||
import com.arialyy.aria.core.task.DownloadTask;
|
||||
import com.hainaos.vc.R;
|
||||
import com.hainaos.vc.activity.player.DecryptionPlayerActivity;
|
||||
@@ -78,23 +80,58 @@ public class CategoryVideoAdapter extends RecyclerView.Adapter<CategoryVideoAdap
|
||||
CategoryVideoInfo categoryVideoInfo = mLocalVideoInfos.get(position);
|
||||
String name = categoryVideoInfo.getName();
|
||||
if (!TextUtils.isEmpty(name)) {
|
||||
holder.title.setText(name);
|
||||
holder.tv_title.setText(name);
|
||||
}
|
||||
String url = categoryVideoInfo.getFile_url();
|
||||
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);
|
||||
|
||||
File file = new File(FileUtils.getHainaVideoPath(mContext) + mDirName + File.separator + fileName);
|
||||
if (file.exists()) {
|
||||
holder.tv_download.setText("删除");
|
||||
holder.tv_download.setBackground(mContext.getDrawable(R.drawable.bg_delete_button));
|
||||
} else {
|
||||
|
||||
DownloadEntity entity = Aria.download(mContext).getFirstDownloadEntity(url);
|
||||
if (entity == null) {
|
||||
holder.tv_download.setText("下载");
|
||||
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();
|
||||
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() {
|
||||
@Override
|
||||
@@ -192,7 +229,7 @@ public class CategoryVideoAdapter extends RecyclerView.Adapter<CategoryVideoAdap
|
||||
dialog.dismiss();
|
||||
File file = new File(path);
|
||||
if (file.delete()) {
|
||||
removeItem(position);
|
||||
notifyItemChanged(position);
|
||||
ToastUtil.show("删除成功");
|
||||
} else {
|
||||
ToastUtil.show("删除失败,检查权限是否开启");
|
||||
@@ -231,16 +268,17 @@ public class CategoryVideoAdapter extends RecyclerView.Adapter<CategoryVideoAdap
|
||||
|
||||
static class VideoHolder extends RecyclerView.ViewHolder {
|
||||
NiceImageView video_image;
|
||||
TextView title, duration, tv_download;
|
||||
TextView tv_title, tv_duration, tv_download, tv_size;
|
||||
ConstraintLayout root;
|
||||
|
||||
public VideoHolder(@NonNull View 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);
|
||||
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
|
||||
void running(DownloadTask task) {
|
||||
Log.e(TAG, "running: " + "正在下载:" + task.getState() + "-" + task.getPercent() + "--" + task.getExtendField());
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class AppFragment extends BaseMvvmFragment<AppViewModel, FragmentAppBindi
|
||||
@Override
|
||||
protected void initView(Bundle bundle) {
|
||||
mHomeAppAdapter = new HomeAppAdapter();
|
||||
mViewDataBinding.rvApp.setLayoutManager(new GridLayoutManager(mContext, 5));
|
||||
mViewDataBinding.rvApp.setLayoutManager(new GridLayoutManager(mContext, 4));
|
||||
mViewDataBinding.rvApp.setAdapter(mHomeAppAdapter);
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class CategoryFragment extends BaseMvvmFragment<CategoryViewModel, Fragme
|
||||
protected void initView(Bundle bundle) {
|
||||
// mHomeAppAdapter = new HomeAppAdapter();
|
||||
mCategoryAdapter = new HomeCategoryAdapter();
|
||||
mViewDataBinding.rvApp.setLayoutManager(new GridLayoutManager(mContext, 5));
|
||||
mViewDataBinding.rvApp.setLayoutManager(new GridLayoutManager(mContext, 4));
|
||||
// mViewDataBinding.rvApp.setAdapter(mHomeAppAdapter);
|
||||
mViewDataBinding.rvApp.setAdapter(mCategoryAdapter);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
android:layout_marginStart="16dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_back_white"
|
||||
android:src="@drawable/icon_back_black"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -57,8 +57,8 @@
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@{title}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_total"
|
||||
@@ -72,8 +72,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="视频:0个"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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"
|
||||
tools:context=".activity.player.DecryptionPlayerActivity">
|
||||
|
||||
@@ -14,10 +15,35 @@
|
||||
android:layout_width="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
|
||||
android:id="@+id/player_view"
|
||||
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>
|
||||
</layout>
|
||||
@@ -16,14 +16,13 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="46dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@@ -43,8 +42,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_lock_icon"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
@@ -54,22 +53,34 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_app_name"
|
||||
android:layout_width="wrap_content"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
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_constraintEnd_toEndOf="parent"
|
||||
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>
|
||||
@@ -17,11 +17,12 @@
|
||||
|
||||
<com.shehuan.niv.NiceImageView
|
||||
android:id="@+id/video_image"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
app:corner_radius="4dp"
|
||||
app:is_cover_src="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -42,11 +43,11 @@
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:layout_marginVertical="8dp"
|
||||
android:maxLines="3"
|
||||
android:orientation="vertical"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -57,29 +58,36 @@
|
||||
app:layout_constraintVertical_bias="0.15">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text"
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="3"
|
||||
android:textColor="@color/white"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:text="标题" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/duration"
|
||||
android:id="@+id/tv_duration"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="00:00"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/video_image"
|
||||
app:layout_constraintEnd_toEndOf="@+id/video_image" />
|
||||
android:textColor="@color/text_content"
|
||||
android:textSize="10sp"
|
||||
tools:text="00:00" />
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<color name="btn_sure_pressed">#1E63FF</color>
|
||||
<color name="btn_cancel">#d0d0d0</color>
|
||||
<color name="btn_cancel_pressed">#9F9F9F</color>
|
||||
<color name="text_content">#bfbfbf</color>
|
||||
|
||||
<color name="home_background_color">#efefef</color>
|
||||
<color name="space_color">#3D54D9</color>
|
||||
|
||||
@@ -10,6 +10,16 @@
|
||||
<item name="android:fitsSystemWindows">true</item>
|
||||
</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>
|
||||
|
||||
<!-- <!– Base application theme. –>-->
|
||||
<!-- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">-->
|
||||
<!-- <!– Customize your theme here. –>-->
|
||||
|
||||
Reference in New Issue
Block a user