From 7d566fd63e2396e7ea03bc11beb0a0799f9b6637 Mon Sep 17 00:00:00 2001 From: qianji <1535486312@qq.com> Date: Fri, 5 May 2023 09:31:38 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9Notes.java=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=B8=B8=E9=87=8F=E6=8E=A5=E5=8F=A3=E4=B8=BA=E5=B8=B8?= =?UTF-8?q?=E9=87=8F=E7=B1=BB=EF=BC=8C=E9=98=B2=E6=AD=A2=E7=BB=A7=E6=89=BF?= =?UTF-8?q?=E5=B8=B8=E9=87=8F=E6=8E=A5=E5=8F=A3=E7=B1=BB=E7=9A=84=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=9A=84=E6=B5=81=E5=A4=B1=EF=BC=8C=E6=8F=90=E9=AB=98?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=80=A7=EF=BC=8C=202.=E7=BB=99=E6=AF=8F?= =?UTF-8?q?=E4=B8=AA=E5=AE=9E=E7=94=A8=E7=A8=8B=E5=BA=8F=E7=B1=BB=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=80=E4=B8=AA=E6=9E=84=E9=80=A0=E5=87=BD=E6=95=B0?= =?UTF-8?q?=20Signed-off-by:=20qianji=20<1535486312@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.gradle/7.6.1/checksums/checksums.lock | Bin 17 -> 17 bytes .../.gradle/7.6.1/checksums/md5-checksums.bin | Bin 19897 -> 20147 bytes .../7.6.1/checksums/sha1-checksums.bin | Bin 28865 -> 29189 bytes .../executionHistory/executionHistory.bin | Bin 317530 -> 317877 bytes .../executionHistory/executionHistory.lock | Bin 17 -> 17 bytes .../.gradle/7.6.1/fileHashes/fileHashes.bin | Bin 68915 -> 68965 bytes .../.gradle/7.6.1/fileHashes/fileHashes.lock | Bin 17 -> 17 bytes .../buildOutputCleanup.lock | Bin 17 -> 17 bytes .../buildOutputCleanup/outputFiles.bin | Bin 22907 -> 23033 bytes .../java/net/micode/notes/data/Notes.java | 54 ++++++++++++++---- .../java/net/micode/notes/model/Note.java | 8 ++- 11 files changed, 47 insertions(+), 15 deletions(-) diff --git a/Notes-master1/.gradle/7.6.1/checksums/checksums.lock b/Notes-master1/.gradle/7.6.1/checksums/checksums.lock index 296bb814c4833e0cce26c2068c41baa7ba1c649a..526311e2f34854d80e0fa065aa6e8c3153244b7d 100644 GIT binary patch literal 17 UcmZSn?ag~f@9;Tm1_<~H05#YJA^-pY literal 17 UcmZSn?ag~f@9;Tm1_*ct05!=46951J diff --git a/Notes-master1/.gradle/7.6.1/checksums/md5-checksums.bin b/Notes-master1/.gradle/7.6.1/checksums/md5-checksums.bin index 5e449db34138cdf86d0ed33dde58fb70f9ffee83..53c7cc5d236f0c012428cabb7d0073c480c6db26 100644 GIT binary patch delta 395 zcmdlvn{o48#tkMCjEa*@B`P#la(rE{m?{~=00zE0|3krs^NIFpadH6=aX;C~OCFSMb#F;Y)U1gRQQy~-ZKW15F>7vA z{2{*4;Dg9!M~@2DdSjrhCJ-xvu)xBP>;5RuTM%L8xxM$jo7i#&2FCW6F=sYGj98@( zr1emBd|}XC&;N5P^JLW@&Nr2;ydXMG>p*k}9LCfUwqtA6y#p&2zvWnU->o`!X%Ixq z*}D)e>`|CnUjDtTQRivbko0!?Ha2G-9*B-}fe;o9d(nYhK+>vo-oJoD?*v0)~Y PAv(@mL3D7afOG%={r_{p delta 44 zcmV+{0Mq}oodLO<0kAX}0UVPx7W%nucuxtUeI zk(pm>)z7zATz5kS&u^|((q!ak`gh}K82=8aVDjd<$}5-z0?t?3u+N@%5F%ReeY34v zATz)8_iK?oM|MF44^D2?+|9Ufqv8+ojRqC0n;ktGH0q6klDa^w3c?~i(h9**Pmlfy z&9jlZ(SL9KQOy7m1_s9VmocYxAf^Z$2GT~Tx;DPidGR*1u+@h5E($rpm{5|E$){xH>oB!-loedF>pEbdf3Mj|LuKpZ>1L0TAeNoC Lg6QH<0qFt&2p*7m delta 60 zcmV-C0K@-<307{LRx4jdQ*vpyeq1GCN|AOW)mB%cDay(UQmlO8Iv S0THnw_!qG-2nMr3NPsAkz7&Z7 diff --git a/Notes-master1/.gradle/7.6.1/executionHistory/executionHistory.bin b/Notes-master1/.gradle/7.6.1/executionHistory/executionHistory.bin index e7f540871eafb478d06a86eca5d7c8a309a5a428..49322e7eaef770f6aa57e1c7fb4591692cca4c04 100644 GIT binary patch delta 418 zcmcb$L3rzC;SDAdjOLq7B^p=+qW=5T2cuQJkD)lAdFflw4VmQdFE@X`GgtZJt$; z2sV>J@*cwp#{8mmy{y!dq@u*kykfnAoYHg7_usGxPI`xfvL{^Gi!&3rb7eGILTHw>n$Jgche37039b=H-{=$2b-gxFnV& z#`xqXC+5V2q~;dHq#*f5FRM5|k3ry3-eK>OWx-ea%j%eaL~r`>dH&~9{|qL^vM>U} GGaLYOlAIa< delta 51 zcmdnGS@_ll;SDAdjAolnB^p>JpOu--sJPMah4@AX4&i1;k9J27Mj&PaV&?6R9xRd* E0OlMKB>(^b diff --git a/Notes-master1/.gradle/7.6.1/executionHistory/executionHistory.lock b/Notes-master1/.gradle/7.6.1/executionHistory/executionHistory.lock index fccb03f06433daad1a5fd092ad0c1c48b472a2ff..4fe69a063b0ccbf697d83083ee5951f918a5efe5 100644 GIT binary patch literal 17 VcmZQRy@mPptyb+n3}C?23;;fv1$+Pi literal 17 VcmZQRy@mPptyb+n3}C?2002Ig1$h7f diff --git a/Notes-master1/.gradle/7.6.1/fileHashes/fileHashes.bin b/Notes-master1/.gradle/7.6.1/fileHashes/fileHashes.bin index 6edb8b4e46232aa59c58b8df08b2e2d78dcd850c..5bdcceab535ee0f985898ea1bb3d007d8933dc24 100644 GIT binary patch delta 101 zcmdlyi{n+a diff --git a/Notes-master1/.gradle/7.6.1/fileHashes/fileHashes.lock b/Notes-master1/.gradle/7.6.1/fileHashes/fileHashes.lock index 37d54c0a4c04ff462bb336fdd32d44a34eb0c04d..2abd99dc02a87aeb6bde2dde6c152f8a01735c77 100644 GIT binary patch literal 17 VcmZSPx8jn#$#FHE0Svg#0RSDs17!dJ literal 17 VcmZSPx8jn#$#FHE0SvfK0RSDo17QFF diff --git a/Notes-master1/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/Notes-master1/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 2034ebd13157b79cbf3a1985c973cfdccf8e3e9d..7139512c81673aef924504c22bd735abf71b80d0 100644 GIT binary patch literal 17 UcmZQp-2Fy0<#0Ss750W6IJ^#A|> literal 17 UcmZQp-2Fy0<#0Ss7j04#(9>;M1& diff --git a/Notes-master1/.gradle/buildOutputCleanup/outputFiles.bin b/Notes-master1/.gradle/buildOutputCleanup/outputFiles.bin index dcff715a832cf5634f481462fbe491b2b63434be..71de02797616af06375a70c846c0435d9bec0916 100644 GIT binary patch delta 186 zcmeypiSg%V#tkMCjDI$pN(itD?0wJ5d|T|5FasDwR&TbI{lP5o=*#X`8=6}XMLnVTd2P!y!a<7Uaztkh4wJUQ Type: INTEGER (long)

@@ -167,7 +185,11 @@ public class Notes { public static final String VERSION = "version"; } - public interface DataColumns { + public final class DataColumns { + private DataColumns() + { + throw new IllegalStateException(UTILITY_CLASS); + } /** * The unique ID for a row *

Type: INTEGER (long)

@@ -241,12 +263,16 @@ public class Notes { public static final String DATA5 = "data5"; } - public static final class TextNote implements DataColumns { + public static final class TextNote { + private TextNote() + { + throw new IllegalStateException(UTILITY_CLASS); + } /** * Mode to indicate the text in check list mode or not *

Type: Integer 1:check list mode 0: normal mode

*/ - public static final String MODE = DATA1; + public static final String MODE = DataColumns.DATA1; public static final int MODE_CHECK_LIST = 1; @@ -254,26 +280,30 @@ public class Notes { public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/text_note"; - public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note"); + public static final Uri CONTENT_URI = Uri.parse(CONTENT + AUTHORITY + "/text_note"); } - public static final class CallNote implements DataColumns { + public static final class CallNote { + private CallNote() + { + throw new IllegalStateException(UTILITY_CLASS); + } /** * Call date for this record *

Type: INTEGER (long)

*/ - public static final String CALL_DATE = DATA1; + public static final String CALL_DATE = DataColumns.DATA1; /** * Phone number for this record *

Type: TEXT

*/ - public static final String PHONE_NUMBER = DATA3; + public static final String PHONE_NUMBER = DataColumns.DATA3; public static final String CONTENT_TYPE = "vnd.android.cursor.dir/call_note"; public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/call_note"; - public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note"); + public static final Uri CONTENT_URI = Uri.parse(CONTENT + AUTHORITY + "/call_note"); } } diff --git a/Notes-master1/app/src/main/java/net/micode/notes/model/Note.java b/Notes-master1/app/src/main/java/net/micode/notes/model/Note.java index 6706cf6..bd17f50 100644 --- a/Notes-master1/app/src/main/java/net/micode/notes/model/Note.java +++ b/Notes-master1/app/src/main/java/net/micode/notes/model/Note.java @@ -35,6 +35,8 @@ import java.util.ArrayList; public class Note { + //重复字符串定义为常量 + private static final String WRONG_NOTE_ID = "Wrong note id:"; private ContentValues mNoteDiffValues; private NoteData mNoteData; private static final String TAG = "Note"; @@ -60,7 +62,7 @@ public class Note { noteId = 0; } if (noteId == -1) { - throw new IllegalStateException("Wrong note id:" + noteId); + throw new IllegalStateException(WRONG_NOTE_ID + noteId); } return noteId; } @@ -102,7 +104,7 @@ public class Note { public boolean syncNote(Context context, long noteId) { if (noteId <= 0) { - throw new IllegalArgumentException("Wrong note id:" + noteId); + throw new IllegalArgumentException(WRONG_NOTE_ID + noteId); } if (!isLocalModified()) { @@ -183,7 +185,7 @@ public class Note { * Check for safety */ if (noteId <= 0) { - throw new IllegalArgumentException("Wrong note id:" + noteId); + throw new IllegalArgumentException(WRONG_NOTE_ID + noteId); } ArrayList operationList = new ArrayList();