diff --git a/app/build/intermediates/dex/debug/mergeDexDebug/classes.dex b/app/build/intermediates/dex/debug/mergeDexDebug/classes.dex index 27757cb..7e1ecf3 100644 Binary files a/app/build/intermediates/dex/debug/mergeDexDebug/classes.dex and b/app/build/intermediates/dex/debug/mergeDexDebug/classes.dex differ diff --git a/app/build/intermediates/incremental/packageDebug/tmp/debug/dex-renamer-state.txt b/app/build/intermediates/incremental/packageDebug/tmp/debug/dex-renamer-state.txt index 7afb3f1..e1e5665 100644 --- a/app/build/intermediates/incremental/packageDebug/tmp/debug/dex-renamer-state.txt +++ b/app/build/intermediates/incremental/packageDebug/tmp/debug/dex-renamer-state.txt @@ -1,4 +1,4 @@ -#Fri Mar 31 15:48:56 CST 2023 -base.0=E\:\\AdvancedMiNotes\\app\\build\\intermediates\\dex\\debug\\mergeDexDebug\\classes.dex +#Fri Mar 31 16:49:37 CST 2023 +base.0=D\:\\Android_projects\\app\\build\\intermediates\\dex\\debug\\mergeDexDebug\\classes.dex renamed.0=classes.dex path.0=classes.dex diff --git a/app/build/intermediates/javac/debug/classes/net/micode/notes/data/Contact.class b/app/build/intermediates/javac/debug/classes/net/micode/notes/data/Contact.class index 393e865..4a446db 100644 Binary files a/app/build/intermediates/javac/debug/classes/net/micode/notes/data/Contact.class and b/app/build/intermediates/javac/debug/classes/net/micode/notes/data/Contact.class differ diff --git a/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/data/Contact.dex b/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/data/Contact.dex index 1f9ff81..4a523e4 100644 Binary files a/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/data/Contact.dex and b/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/data/Contact.dex differ diff --git a/app/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin b/app/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin index cf78007..9e3f619 100644 Binary files a/app/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin and b/app/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin differ diff --git a/app/src/main/java/net/micode/notes/data/Contact.java b/app/src/main/java/net/micode/notes/data/Contact.java index 5bd6ac3..b132d43 100644 --- a/app/src/main/java/net/micode/notes/data/Contact.java +++ b/app/src/main/java/net/micode/notes/data/Contact.java @@ -36,20 +36,23 @@ public class Contact { + " FROM phone_lookup" + " WHERE min_match = '+')"; -/*判断是否存在映射关系 -* 若不存在,创建并存储在哈希表中 -* 存在,则返回Phonenumber*/ + + /** + * 判断是否存在映射关系 + * 若不存在,创建并存储在哈希表中 + */ public static String getContact(Context context, String phoneNumber) { if (sContactCache == null) { sContactCache = new HashMap(); } - + // 查找HashMap中是否已有phoneNumber信息,如果存在则返回phoneNumber信息 if (sContactCache.containsKey(phoneNumber)) { return sContactCache.get(phoneNumber); } -/* -“+”号 -*/ + + /** + * 查找数据库中phoneNumber的信息 + */ String selection = CALLER_ID_SELECTION.replace("+", PhoneNumberUtils.toCallerIDMinMatch(phoneNumber)); Cursor cursor = context.getContentResolver().query( @@ -59,12 +62,22 @@ public class Contact { new String[]{phoneNumber}, null); + /** + * 判定查询结果,若不为空,moveToFirst()返回第一条;否则返回空 + */ if (cursor != null && cursor.moveToFirst()) { + /** + * 找到相关情况时 + */ try { String name = cursor.getString(0); sContactCache.put(phoneNumber, name); return name; - } catch (IndexOutOfBoundsException e) { + } + /** + * 异常 + */ + catch (IndexOutOfBoundsException e) { Log.e(TAG, " Cursor get string error " + e.toString()); return null; } finally {