6.7.0 - Alpha12 - 文件管理器/任务面板支持显示文件/任务数量统计信息

This commit is contained in:
SuperMonster003
2025-12-23 18:49:30 +08:00
parent b1dcb59824
commit 32dbaa65e2
5 changed files with 83 additions and 65 deletions

View File

@@ -1,7 +1,7 @@
{
"$data": {
"v6.7.0": {
"released_date": "2025/11/28",
"released_date": "2025/12/23",
"feature": [
"插件中心功能, 支持插件的安装/卸载/更新等操作 (入口: 主页抽屉按钮)",
"cvt 模块, 用于数据单位转换 (参阅 项目文档 > [单位转换](https://docs.autojs6.com/#/cvt))",
@@ -77,6 +77,7 @@
"控制台浮动窗口内部实现进行无锁化及队列化处理以提升其参数设置效率与成功率",
"控制台浮动窗口背景色彩行为相关 API (透明度/着色/基色) 更符合安卓设计规范 _[`issue #458`](http://issues.autojs6.com/458)_",
"文件管理器浮动按钮展开后点击菜单项时优化菜单收起时机",
"文件管理器/任务面板支持显示文件/任务数量统计信息",
"崩溃报告页面支持双指缩放调整字体大小并添加常用功能按钮",
"应用启动器图标支持自适应图标特性 _[`issue #405`](http://issues.autojs6.com/405)_",
"使用 LiveData 及 SharedFlow 替代已弃用的 LocalBroadcastManager",

View File

@@ -187,11 +187,15 @@ open class ExplorerView : ThemeColorSwipeRefreshLayout, SwipeRefreshLayout.OnRef
ExplorerChangeEvent.CREATE -> {
explorerItemManager.insertAtFront(event.newItem)
mExplorerAdapter.notifyItemInserted(event.newItem, 0)
mExplorerAdapter.notifyItemChanged(positionOfCategoryDir)
mExplorerAdapter.notifyItemChanged(positionOfCategoryFile())
}
ExplorerChangeEvent.REMOVE -> {
i = explorerItemManager.remove(item)
if (i >= 0) {
mExplorerAdapter.notifyItemRemoved(item, i)
mExplorerAdapter.notifyItemChanged(positionOfCategoryDir)
mExplorerAdapter.notifyItemChanged(positionOfCategoryFile())
}
}
}
@@ -1077,7 +1081,9 @@ open class ExplorerView : ThemeColorSwipeRefreshLayout, SwipeRefreshLayout.OnRef
@Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")
override fun bind(isDirCategory: Any, position: Int) {
if (isDirCategory !is Boolean) return
binding.title.setText(if (isDirCategory) R.string.text_directory else R.string.text_file)
val titleRes = if (isDirCategory) R.string.text_directory else R.string.text_file
val count = if (isDirCategory) explorerItemManager.groupCount() else explorerItemManager.itemCount()
binding.title.text = "${context.getString(titleRes)} [ $count ]"
mIsDir = isDirCategory
if (isDirCategory && canGoUp()) {
binding.goUp.visibility = VISIBLE

View File

@@ -39,7 +39,7 @@ public abstract class TaskGroup implements Parent<Task> {
}
public String getTitle() {
return mTitle;
return mTitle + " [ " + mTasks.size() + " ]";
}
public abstract Context getContext();

View File

@@ -59,7 +59,10 @@ public class TaskListRecyclerView extends ThemeColorRecyclerView {
try {
int i = mRunningTaskGroup.addTask(execution);
if (i != -1) {
post(() -> mAdapter.notifyChildInserted(0, i));
post(() -> {
mAdapter.notifyChildInserted(0, i);
mAdapter.notifyParentChanged(0);
});
}
} catch (Exception e) {
e.printStackTrace();
@@ -81,6 +84,7 @@ public class TaskListRecyclerView extends ThemeColorRecyclerView {
final int i = mRunningTaskGroup.removeTask(execution);
if (i >= 0) {
mAdapter.notifyChildRemoved(0, i);
mAdapter.notifyParentChanged(0);
} else {
refresh();
}
@@ -167,10 +171,12 @@ public class TaskListRecyclerView extends ThemeColorRecyclerView {
void onTaskChange(ModelChange<?> taskChange) {
if (taskChange.getAction() == ModelChange.INSERT) {
mAdapter.notifyChildInserted(1, mPendingTaskGroup.addTask(taskChange.getData()));
mAdapter.notifyParentChanged(1);
} else if (taskChange.getAction() == ModelChange.DELETE) {
final int i = mPendingTaskGroup.removeTask(taskChange.getData());
if (i >= 0) {
mAdapter.notifyChildRemoved(1, i);
mAdapter.notifyParentChanged(1);
} else {
Log.w(LOG_TAG, "data inconsistent on change: " + taskChange);
refresh();

View File

@@ -1,76 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/title_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal"
android:paddingVertical="8dp">
android:id="@+id/title_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal"
android:paddingVertical="8dp">
<ImageView
android:id="@+id/arrow_icon"
android:layout_width="17dp"
android:layout_height="17dp"
android:layout_gravity="center_vertical"
android:layout_marginHorizontal="9dp"
android:src="@drawable/ic_expanded"
app:tint="#828384" />
android:id="@+id/arrow_icon"
android:layout_width="17dp"
android:layout_height="17dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="9dp"
android:layout_marginEnd="6dp"
android:src="@drawable/ic_expanded"
android:translationY="1.2dp"
app:tint="#828384" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/text_directory"
android:textColor="#828384"
android:textSize="13sp" />
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/text_directory"
android:textColor="#828384"
android:textSize="13sp" />
</LinearLayout>
<ImageView
android:id="@+id/go_up"
android:layout_width="32dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:padding="8dp"
android:layout_marginHorizontal="3dp"
android:src="@drawable/ic_dir_up"
android:focusable="true"
app:tint="#828384" />
android:id="@+id/go_up"
android:layout_width="32dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:padding="8dp"
android:layout_marginHorizontal="3dp"
android:src="@drawable/ic_dir_up"
android:focusable="true"
app:tint="#828384" />
<ImageView
android:id="@+id/sort_order"
android:layout_width="32dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:padding="8dp"
android:layout_marginHorizontal="3dp"
android:src="@drawable/ic_ascending_order"
android:focusable="true"
app:tint="#828384" />
android:id="@+id/sort_order"
android:layout_width="32dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:padding="8dp"
android:layout_marginHorizontal="3dp"
android:src="@drawable/ic_ascending_order"
android:focusable="true"
app:tint="#828384" />
<ImageView
android:id="@+id/sort_type"
android:layout_width="32dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:padding="8dp"
android:layout_marginHorizontal="3dp"
android:src="@drawable/ic_sort"
android:focusable="true"
app:tint="#828384" />
android:id="@+id/sort_type"
android:layout_width="32dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:padding="8dp"
android:layout_marginHorizontal="3dp"
android:src="@drawable/ic_sort"
android:focusable="true"
app:tint="#828384" />
</LinearLayout>