Skip to content

Commit ef56ff3

Browse files
committed
feat: 升级v1.8.8
1 parent bc18384 commit ef56ff3

10 files changed

Lines changed: 54 additions & 33 deletions

File tree

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ android {
2929
applicationId "com.lanzou.cloud"
3030
minSdk 24
3131
targetSdk 35
32-
versionCode 26
33-
versionName "1.8.7"
32+
versionCode 27
33+
versionName "1.8.8"
3434

3535
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3636
signingConfig signingConfigs.debug

app/src/main/java/com/lanzou/cloud/data/Upload.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import androidx.annotation.NonNull;
77

8+
import com.google.gson.annotations.Expose;
89
import com.google.gson.annotations.Since;
910
import com.lanzou.cloud.event.OnUploadListener;
1011
import com.lanzou.cloud.utils.FileJavaUtils;
@@ -75,7 +76,8 @@ public class Upload extends LitePalSupport implements Parcelable, Comparable<Upl
7576
private final String comment = "如需完整下载此文件,请下载app(https://github.com/Yu2002s/SplitLanzou)";
7677

7778
@Column(ignore = true)
78-
private OnUploadListener listener;
79+
@Expose(serialize = false, deserialize = false)
80+
private transient OnUploadListener listener;
7981

8082
public Upload() {
8183
}

app/src/main/java/com/lanzou/cloud/model/PathModel.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ sealed class PathModel(
1010
/**
1111
* 路径名称
1212
*/
13-
val name: String,
13+
val name: String = "",
1414
/**
1515
* 文件 Fragment 实例
1616
*/
@@ -20,7 +20,6 @@ sealed class PathModel(
2020
*/
2121
val path: String? = null,
2222
) {
23-
2423
/**
2524
* 路径 ID, 用于标识唯一
2625
*/

app/src/main/java/com/lanzou/cloud/service/DownloadService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ private Upload readJsonToUpload(InputStream inputStream, int len, Download downl
555555
download.setUploadJson(json);
556556
}
557557
} catch (Exception e) {
558-
Log.e(TAG, "获取上传信息失败,尝试写入文本文件");
558+
Log.e(TAG, "获取上传信息失败,尝试写入文本文件: " + e);
559559
// 如果读取上传文件出错了,就直接下载文本内容到本地
560560
writeTextFileToLocal(download, json);
561561
}

app/src/main/java/com/lanzou/cloud/ui/cloud/file/FileAction.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,20 @@ default void getFiles() {
124124
*/
125125
void moveFiles();
126126

127+
/**
128+
* 选择所有文件
129+
*/
130+
int selectAll();
131+
127132
/**
128133
* 订阅
129134
*
130135
* @param context fragment 实例
131136
*/
132137
void observable(Fragment context);
133138

139+
void unSelectAll();
140+
134141
/**
135142
* 操作回调
136143
*/

app/src/main/java/com/lanzou/cloud/ui/cloud/file/FileFragment.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ public void onPrepareMenu(@NonNull Menu menu) {
389389
menu.findItem(R.id.download).setVisible(multiMode);
390390
menu.findItem(R.id.move).setVisible(multiMode);
391391
menu.findItem(R.id.detail).setVisible(!multiMode && getCurrentPage().getFolderId() > 0);
392+
menu.findItem(R.id.all_select).setVisible(multiMode);
393+
menu.findItem(R.id.all_unselect).setVisible(multiMode);
392394
}
393395

394396
@Override
@@ -440,6 +442,13 @@ public boolean onMenuItemSelected(@NonNull MenuItem item) {
440442
// 显示详情对话框
441443
new FileDetailDialog(requireContext(), getCurrentPage().getFolderId())
442444
.setFileName(getCurrentPage().getName());
445+
} else if (item.getItemId() == R.id.all_select) {
446+
selectCount = fileAction.selectAll();
447+
changeSelect();
448+
} else if (item.getItemId() == R.id.all_unselect) {
449+
selectCount = 0;
450+
changeSelect();
451+
fileAction.unSelectAll();
443452
}
444453
return true;
445454
}

app/src/main/java/com/lanzou/cloud/ui/cloud/file/imple/FileActionImpl.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,4 +459,22 @@ private void handleMoveFiles(long id) {
459459
public void moveFiles() {
460460
FolderSelectorActivity.moveFiles(mActivity, moveActivityResultLauncher);
461461
}
462+
463+
@SuppressLint("NotifyDataSetChanged")
464+
@Override
465+
public int selectAll() {
466+
for (LanzouFile file : lanzouFiles) {
467+
file.setSelected(true);
468+
}
469+
adapter.notifyDataSetChanged();
470+
return lanzouFiles.size();
471+
}
472+
473+
@Override
474+
public void unSelectAll() {
475+
for (LanzouFile file : lanzouFiles) {
476+
file.setSelected(false);
477+
}
478+
adapter.notifyDataSetChanged();
479+
}
462480
}

app/src/main/java/com/lanzou/cloud/ui/fragment/HomeFragment.kt

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import com.lanzou.cloud.enums.FileSortRule
4343
import com.lanzou.cloud.enums.LayoutPosition
4444
import com.lanzou.cloud.event.OnFileNavigateListener
4545
import com.lanzou.cloud.event.OnUploadListener
46-
import com.lanzou.cloud.manager.FilePageManager
4746
import com.lanzou.cloud.model.FileInfoModel
4847
import com.lanzou.cloud.model.LocalPathModel
4948
import com.lanzou.cloud.model.PathModel
@@ -389,14 +388,6 @@ class HomeFragment : EngineNavFragment<FragmentHomeBinding>(R.layout.fragment_ho
389388
leftLp.width = contentWidth
390389
rightLp.width = contentWidth
391390

392-
val onFilePageLayoutChangeListener = object : FilePageManager.OnFilePageLayoutChangeListener {
393-
override fun onFilePageSelected(position: Int, layoutPosition: LayoutPosition) {
394-
homeViewModel.focusPosition(layoutPosition)
395-
requireActivity().invalidateMenu()
396-
currentFileFragment.refreshPathSubTitle()
397-
}
398-
}
399-
400391
initPage(binding.tabLeft, binding.vpLeft, leftPaths)
401392
initPage(binding.tabRight, binding.vpRight, rightPaths)
402393

@@ -520,24 +511,6 @@ class HomeFragment : EngineNavFragment<FragmentHomeBinding>(R.layout.fragment_ho
520511
downloadFiles(currentPath, currentFileFragment.getCheckedFiles())
521512
}
522513
}
523-
524-
/*R.id.fab_right -> {
525-
val checkedFiles = currentFileFragment.getCheckedFiles()
526-
if (checkedFiles.isEmpty()) {
527-
toast("选中文件为空")
528-
return
529-
}
530-
if (currentFilePageType == targetFilePageType) {
531-
if (currentFilePageType == FilePageType.LOCAL) {
532-
moveFiles(currentFileFragment.getCheckedFiles(false))
533-
} else {
534-
moveFiles(checkedFiles)
535-
}
536-
return
537-
}
538-
val currentPath = targetFileFragment.getCurrentPath()
539-
downloadFiles(currentPath, checkedFiles)
540-
}*/
541514
}
542515
}
543516

app/src/main/res/menu/menu_cloud.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,14 @@
2727
android:title="@string/delete"
2828
android:visible="false"
2929
app:showAsAction="ifRoom" />
30+
31+
<item
32+
android:id="@+id/all_select"
33+
android:title="@string/all_select"
34+
android:visible="false" />
35+
36+
<item
37+
android:id="@+id/all_unselect"
38+
android:title="@string/all_unselect"
39+
android:visible="false" />
3040
</menu>

app/src/main/res/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,8 @@
5454
<string name="sort">排序</string>
5555
<string name="password_update_success">密码修改成功</string>
5656
<string name="tip_cache_path">请前往设置,设置缓存路径</string>
57+
<string name="all_select">全选</string>
58+
<string name="reverse_select">反选</string>
59+
<string name="all_unselect">全不选</string>
5760

5861
</resources>

0 commit comments

Comments
 (0)