pull/11/head
ptg69kyl5 2 months ago
commit 3cc9d201b7

@ -4,6 +4,14 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-05-15T08:17:27.567875Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=C:\Users\Lenovo\.android\avd\Medium_Phone.avd" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState>
</selectionStates>
</component>

@ -53,9 +53,8 @@ android {
}
dependencies {
// libs build.gradle.kts settings.gradle
// HTTP Android 6.0+
// HTTP Apache HttpClient 4.5.14Android 6.0+
implementation("org.apache.httpcomponents:httpclient:4.5.14")
// AndroidX

@ -44,7 +44,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Notesmaster"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
tools:targetApi="31">
<!--
@ -59,7 +59,7 @@
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/NoteTheme"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
android:uiOptions="splitActionBarWhenNarrow"
android:windowSoftInputMode="adjustPan"
android:exported="true">

@ -1,17 +1,14 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
* (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Apache License, Version 2.0
* :
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* "原样"
*
*
*/
package net.micode.notes.data;
@ -25,49 +22,73 @@ import android.util.Log;
import java.util.HashMap;
/**
* -
*
*/
public class Contact {
// 联系人缓存:键为电话号码,值为对应的联系人姓名
private static HashMap<String, String> sContactCache;
private static final String TAG = "Contact";
// 联系人查询SQL模板用于查找与给定电话号码匹配的联系人
// 使用 PHONE_NUMBERS_EQUAL 函数处理号码格式差异(如区号、国际前缀等)
private static final String CALLER_ID_SELECTION = "PHONE_NUMBERS_EQUAL(" + Phone.NUMBER
+ ",?) AND " + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'"
+ " AND " + Data.RAW_CONTACT_ID + " IN "
+ ",?) AND " + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'"
+ " AND " + Data.RAW_CONTACT_ID + " IN "
+ "(SELECT raw_contact_id "
+ " FROM phone_lookup"
+ " WHERE min_match = '+')";
/**
*
*
* @param context
* @param phoneNumber
* @return null
*/
public static String getContact(Context context, String phoneNumber) {
// 初始化缓存
if(sContactCache == null) {
sContactCache = new HashMap<String, String>();
}
// 优先从缓存中获取结果,提高性能
if(sContactCache.containsKey(phoneNumber)) {
return sContactCache.get(phoneNumber);
}
// 构建动态查询条件(处理不同格式的电话号码)
String selection = CALLER_ID_SELECTION.replace("+",
PhoneNumberUtils.toCallerIDMinMatch(phoneNumber));
// 查询联系人数据库
Cursor cursor = context.getContentResolver().query(
Data.CONTENT_URI,
new String [] { Phone.DISPLAY_NAME },
selection,
new String[] { phoneNumber },
null);
Data.CONTENT_URI, // 查询的URI联系人数据
new String [] { Phone.DISPLAY_NAME }, // 需要返回的字段(联系人姓名)
selection, // 查询条件
new String[] { phoneNumber }, // 查询参数
null); // 排序方式
// 处理查询结果
if (cursor != null && cursor.moveToFirst()) {
try {
// 获取联系人姓名并加入缓存
String name = cursor.getString(0);
sContactCache.put(phoneNumber, name);
return name;
} catch (IndexOutOfBoundsException e) {
// 处理异常情况
Log.e(TAG, " Cursor get string error " + e.toString());
return null;
} finally {
// 确保游标资源被释放
cursor.close();
}
} else {
// 未找到匹配的联系人
Log.d(TAG, "No contact matched with number:" + phoneNumber);
return null;
}
}
}
}

@ -74,6 +74,7 @@ import java.util.regex.Pattern;
public class NoteEditActivity extends Activity implements OnClickListener,
NoteSettingChangedListener, OnTextViewChangeListener {
private class HeadViewHolder {
public TextView tvModified;

@ -60,6 +60,8 @@ import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import net.micode.notes.R;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.NoteColumns;
@ -78,7 +80,8 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashSet;
public class NotesListActivity extends Activity implements OnClickListener, OnItemLongClickListener {
public class NotesListActivity extends AppCompatActivity implements OnClickListener, OnItemLongClickListener {
private int mode=-1;
private static final int FOLDER_NOTE_LIST_QUERY_TOKEN = 0;
private static final int FOLDER_LIST_QUERY_TOKEN = 1;
@ -139,6 +142,9 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.note_list);
getWindow().setBackgroundDrawableResource(R.drawable.beijing);
getWindow().setBackgroundDrawableResource(R.drawable.bb);
initResources();
/**
@ -775,12 +781,27 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
} else {
Log.e(TAG, "Wrong state:" + mState);
}
if(mode==-1)
menu.findItem(R.id.menu_beijing).setVisible(false);
else if(mode==0)
menu.findItem(R.id.menu_bb).setVisible(false);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_beijing:{
mode=-1;
getWindow().setBackgroundDrawableResource(R.drawable.beijing);
break;
}
case R.id.menu_bb:{
mode=0;
getWindow().setBackgroundDrawableResource(R.drawable.bb);
break;
}
case R.id.menu_new_folder: {
showCreateOrModifyFolderDialog(true);
break;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

@ -18,8 +18,8 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/list_background">
android:layout_height="fill_parent">
<!-- android:background="@drawable/list_background">-->
<LinearLayout
android:layout_width="fill_parent"

@ -36,4 +36,10 @@
<item
android:id="@+id/menu_search"
android:title="@string/menu_search"/>
<item
android:id="@+id/menu_beijing"
android:title="@string/menu_beijing"/>
<item
android:id="@+id/menu_bb"
android:title="@string/menu_bb"/>
</menu>

@ -120,6 +120,9 @@
<string name="call_record_folder_name">Call notes</string>
<string name="hint_foler_name">Input name</string>
<string name="menu_beijing">Background: beijing</string>
<string name="menu_bb">Background: bb</string>
<string name="search_label">Searching Notes</string>
<string name="search_hint">Search notes</string>
<string name="search_setting_description">Text in your notes</string>

@ -49,7 +49,7 @@
</style>
<style name="HighlightTextAppearancePrimary">
<item name="android:textSize">@dimen/text_font_size_normal</item>
<item name="android:textSize">@dimen/text_font_size_normal</item>
<item name="android:textColor">@color/primary_text_dark</item>
</style>
@ -66,4 +66,7 @@
<item name="android:displayOptions" />
<item name="android:visibility">gone</item>
</style>
</resources>
</resources>
<!--<style name="NoteActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">-->
<!-- <item name="android:visibility">visible</item>-->
<!--</style>-->

@ -1,35 +1,59 @@
// Gradle
pluginManagement {
//
repositories {
// Maven -
maven { setUrl("https://maven.aliyun.com/repository/central") }
// Maven - JCenter ()
maven { setUrl("https://maven.aliyun.com/repository/jcenter") }
// Maven - Google
maven { setUrl("https://maven.aliyun.com/repository/google") }
// Maven - Gradle
maven { setUrl("https://maven.aliyun.com/repository/gradle-plugin") }
// -
maven { setUrl("https://maven.aliyun.com/repository/public") }
// JitPack - GitHub
maven { setUrl("https://jitpack.io") }
// Google Android
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
includeGroupByRegex("com\\.android.*") // Android SDK
includeGroupByRegex("com\\.google.*") // Google
includeGroupByRegex("androidx.*") // AndroidX
}
}
// Maven
mavenCentral()
// Gradle
gradlePluginPortal()
}
}
//
dependencyResolutionManagement {
// 使 settings.gradle
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
//
repositories {
// ( pluginManagement)
maven { setUrl("https://maven.aliyun.com/repository/central") }
maven { setUrl("https://maven.aliyun.com/repository/jcenter") }
maven { setUrl("https://maven.aliyun.com/repository/google") }
maven { setUrl("https://maven.aliyun.com/repository/gradle-plugin") }
maven { setUrl("https://maven.aliyun.com/repository/public") }
maven { setUrl("https://jitpack.io") }
// Google ()
google()
// Maven
mavenCentral()
}
}
//
rootProject.name = "Notes-master"
include ':app'
//
include ':app'
Loading…
Cancel
Save