From 19404d9d44dcef6e684f94c0c63f80a219d4adc4 Mon Sep 17 00:00:00 2001 From: LingASDJ <2735951230@qq.com> Date: Tue, 31 Jan 2023 15:36:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Demo=E6=8E=92=E5=88=97?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=8C=E8=87=B4=E8=B0=A2=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/coldmint/rust/pro/ThanksActivity.kt | 2 +- .../java/com/coldmint/rust/core/database/code/CodeInfo.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/coldmint/rust/pro/ThanksActivity.kt b/app/src/main/java/com/coldmint/rust/pro/ThanksActivity.kt index 0a192e8..90a4d79 100644 --- a/app/src/main/java/com/coldmint/rust/pro/ThanksActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/ThanksActivity.kt @@ -35,7 +35,7 @@ class ThanksActivity : BaseActivity() { viewBinding.recyclerView.layoutManager = LinearLayoutManager(this) val list = ArrayList() list.add(ThanksDataBean("空调大郎", "帮助翻译俄语版本。", 1491779490)) - list.add(ThanksDataBean("Ling ASDJ", "制作助手新手模板,已被整合至助手内置模版。跟随助手更新。", 2735951230)) + list.add(ThanksDataBean("JDSA Ling", "制作助手新手模板,已被整合至助手内置模版。跟随助手更新。", 2735951230)) list.add(ThanksDataBean("Alice's Dream", "帮助薄荷优化代码表。", 3372003670)) list.add(ThanksDataBean("克鲁鲁.采佩西", "帮助薄荷制作教程。", 2275140013)) list.add(ThanksDataBean("慕青","帮助薄荷修复助手bug,优化助手功能。",1966944300)) diff --git a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/database/code/CodeInfo.kt b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/database/code/CodeInfo.kt index 3aa56a0..73b9225 100644 --- a/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/database/code/CodeInfo.kt +++ b/assistantCoreLibrary/src/main/java/com/coldmint/rust/core/database/code/CodeInfo.kt @@ -13,9 +13,9 @@ data class CodeInfo( @PrimaryKey val code: String, @ColumnInfo(name = "translate") val translate: String, @ColumnInfo(name = "description") val description: String, - @ColumnInfo(name = "demo") val demo: String = "", @ColumnInfo(name = "type") val type: String, @ColumnInfo(name = "add_version") val addVersion: Int, @ColumnInfo(name = "remove_version") val removeVersion: Int = 1, - @ColumnInfo(name = "section") val section: String + @ColumnInfo(name = "section") val section: String, + @ColumnInfo(name = "demo") val demo: String = "", ) \ No newline at end of file From 9d56eec131c38937048a985325b9e7b433ee1b21 Mon Sep 17 00:00:00 2001 From: muqing153 <103228194+muqing153@users.noreply.github.com> Date: Tue, 31 Jan 2023 16:26:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=87=8D=E5=86=99=E4=BA=86=E5=8A=A9?= =?UTF-8?q?=E6=89=8B=E6=96=87=E4=BB=B6=E6=8E=92=E5=BA=8F=E5=8A=9F=E8=83=BD?= =?UTF-8?q?,=E6=94=AF=E6=8C=81=E4=BA=86=E6=96=87=E4=BB=B6=E5=A4=B9?= =?UTF-8?q?=E5=9C=A8=E5=89=8D=E9=9D=A2=E6=96=87=E4=BB=B6=E5=9C=A8=E5=90=8E?= =?UTF-8?q?=E9=9D=A2,=E6=B7=BB=E5=8A=A0=E6=99=BA=E8=83=BD=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=8E=92=E5=BA=8F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/coldmint/rust/pro/FileSort.java | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 app/src/main/java/com/coldmint/rust/pro/FileSort.java diff --git a/app/src/main/java/com/coldmint/rust/pro/FileSort.java b/app/src/main/java/com/coldmint/rust/pro/FileSort.java new file mode 100644 index 0000000..563a1c9 --- /dev/null +++ b/app/src/main/java/com/coldmint/rust/pro/FileSort.java @@ -0,0 +1,131 @@ +import java.io.File; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public class FileSort { + final int name=0,time=1,size=2,type=3; + public static String[] type_list; + public FileSort(List a,int manner){ + switch (manner){ + case name: + sort_name(a); + break; + case time: + sort_time(a); + break; + case size: + sort_size(a); + break; + case type: + sort_type(a); + break; + default: + } + } + public static void sort_front(List a){ + Collections.sort(a, new Comparator() { + @Override + public int compare(File o1, File o2) { + if (o1.isDirectory() && o2.isFile()) + return -1; + if (o1.isFile() && o2.isDirectory()) + return 1; + return 0; + } + }); + } + + public static void sort_name(List a){ + Collections.sort(a,new Comparator() { + @Override + public int compare(File o1, File o2) { + if (o1.isDirectory() && o2.isFile()) + return -1; + if (o1.isFile() && o2.isDirectory()) + return 1; + return o1.getName().compareTo(o2.getName()); + } + }); + sort_front(a); + } + public static void sort_time(List a){ + Collections.sort(a,new Comparator() { + @Override + public int compare(File f1, File f2) { + long diff = f1.lastModified() - f2.lastModified(); + if (diff > 0) + return 1; + else if (diff == 0) + return 0; + else + return -1; + //如果 if 中修改为 返回-1 同时此处修改为返回 1 排序就会是递减 + } + }); + sort_front(a); + } + + public void sort_size(List a){ + + Collections.sort(a, new Comparator() { + @Override + public int compare(File o1, File o2) { + long diff = o1.length() - o2.length(); + if (diff > 0) + return 1; + else if (diff == 0) + return 0; + else + return -1; + } + }); + sort_front(a); + } + public static void sort_type(List a){ + //文件类型排序 按照后缀优先级 +// System.out.println(type_list[0]); + Collections.sort(a, new Comparator() { + @Override + public int compare(File o1, File o2) { + if (o1.isFile()) { + String name_a = o1.getName(); + String o_z = name_a.substring(name_a.lastIndexOf(".")); +// System.out.println(o_z); + //获取 name_a文件名字的后缀 + int length=length(type_list,o_z); + System.out.println(length); + //查找后缀是不是存在于 type_list数据中 如果存在返回存在位置 如果不存在则返回<0的值 + if (length>=0) + return -1; + } else if (o2.isFile()) { + String name_a = o2.getName(); +// System.out.println(name_a); + String o_z = name_a.substring(name_a.lastIndexOf(".")); + + //获取 name_a文件名字的后缀 + int length=length(type_list,o_z); + if (length>=0) + return 1; + } + return 0; + } + }); + } + private static int length(String a){ + for (int i=0;i