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

View File

@@ -187,11 +187,15 @@ open class ExplorerView : ThemeColorSwipeRefreshLayout, SwipeRefreshLayout.OnRef
ExplorerChangeEvent.CREATE -> { ExplorerChangeEvent.CREATE -> {
explorerItemManager.insertAtFront(event.newItem) explorerItemManager.insertAtFront(event.newItem)
mExplorerAdapter.notifyItemInserted(event.newItem, 0) mExplorerAdapter.notifyItemInserted(event.newItem, 0)
mExplorerAdapter.notifyItemChanged(positionOfCategoryDir)
mExplorerAdapter.notifyItemChanged(positionOfCategoryFile())
} }
ExplorerChangeEvent.REMOVE -> { ExplorerChangeEvent.REMOVE -> {
i = explorerItemManager.remove(item) i = explorerItemManager.remove(item)
if (i >= 0) { if (i >= 0) {
mExplorerAdapter.notifyItemRemoved(item, i) 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") @Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")
override fun bind(isDirCategory: Any, position: Int) { override fun bind(isDirCategory: Any, position: Int) {
if (isDirCategory !is Boolean) return 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 mIsDir = isDirCategory
if (isDirCategory && canGoUp()) { if (isDirCategory && canGoUp()) {
binding.goUp.visibility = VISIBLE binding.goUp.visibility = VISIBLE

View File

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

View File

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

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -21,8 +22,10 @@
android:layout_width="17dp" android:layout_width="17dp"
android:layout_height="17dp" android:layout_height="17dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginHorizontal="9dp" android:layout_marginStart="9dp"
android:layout_marginEnd="6dp"
android:src="@drawable/ic_expanded" android:src="@drawable/ic_expanded"
android:translationY="1.2dp"
app:tint="#828384" /> app:tint="#828384" />
<TextView <TextView
@@ -33,6 +36,7 @@
android:text="@string/text_directory" android:text="@string/text_directory"
android:textColor="#828384" android:textColor="#828384"
android:textSize="13sp" /> android:textSize="13sp" />
</LinearLayout> </LinearLayout>
<ImageView <ImageView
@@ -73,4 +77,5 @@
android:src="@drawable/ic_sort" android:src="@drawable/ic_sort"
android:focusable="true" android:focusable="true"
app:tint="#828384" /> app:tint="#828384" />
</LinearLayout> </LinearLayout>