6.7.0 - Alpha12 - 文件管理器/任务面板支持显示文件/任务数量统计信息
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -39,7 +39,7 @@ public abstract class TaskGroup implements Parent<Task> {
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return mTitle;
|
||||
return mTitle + " [ " + mTasks.size() + " ]";
|
||||
}
|
||||
|
||||
public abstract Context getContext();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user