From 971c304015aaec519954d677ed2ce730a50683cf Mon Sep 17 00:00:00 2001 From: ranhao <2352406715@qq.com> Date: Mon, 19 Jan 2026 09:59:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E8=80=81=E5=B9=B4?= =?UTF-8?q?=E4=BA=BA=E7=95=8C=E9=9D=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/notes/MainActivity.java | 1 - src/notes/data/Contact.java | 2 +- src/notes/data/Notes.java | 2 +- src/notes/data/NotesDatabaseHelper.java | 8 +++---- src/notes/data/NotesProvider.java | 2 +- src/notes/gtask/remote/GTaskManager.java | 8 +++---- src/notes/tool/BackupUtils.java | 4 ++-- src/notes/tool/DataUtils.java | 8 +++---- src/notes/tool/GTaskStringUtils.java | 2 +- src/notes/tool/ResourceParser.java | 2 +- src/notes/ui/AlarmAlertActivity.java | 2 +- src/notes/ui/AlarmInitReceiver.java | 2 +- src/notes/ui/AlarmReceiver.java | 2 +- src/notes/ui/DateTimePicker.java | 2 +- src/notes/ui/DateTimePickerDialog.java | 2 +- src/notes/ui/DropdownMenu.java | 2 +- src/notes/ui/FoldersListAdapter.java | 2 +- src/notes/ui/NoteEditActivity.java | 12 +++++++--- src/notes/ui/NoteEditText.java | 2 +- src/notes/ui/NoteItemData.java | 2 +- src/notes/ui/NotesListActivity.java | 19 ++++++++++++---- src/notes/ui/NotesListAdapter.java | 2 +- src/notes/ui/NotesListItem.java | 2 +- src/notes/ui/NotesPreferenceActivity.java | 25 +++++---------------- src/notes/widget/NoteWidgetProvider.java | 4 ++-- src/notes/widget/NoteWidgetProvider_2x.java | 2 +- src/notes/widget/NoteWidgetProvider_4x.java | 2 +- 27 files changed, 63 insertions(+), 62 deletions(-) diff --git a/src/notes/MainActivity.java b/src/notes/MainActivity.java index e47a88a..1582fca 100644 --- a/src/notes/MainActivity.java +++ b/src/notes/MainActivity.java @@ -22,4 +22,3 @@ public class MainActivity extends AppCompatActivity { }); } } - diff --git a/src/notes/data/Contact.java b/src/notes/data/Contact.java index d984246..1390a32 100644 --- a/src/notes/data/Contact.java +++ b/src/notes/data/Contact.java @@ -91,4 +91,4 @@ public class Contact { return null; } } -} \ No newline at end of file +} diff --git a/src/notes/data/Notes.java b/src/notes/data/Notes.java index ff453f2..0be82f2 100644 --- a/src/notes/data/Notes.java +++ b/src/notes/data/Notes.java @@ -70,7 +70,7 @@ public class Notes { /** * 回收站文件夹ID,用于存放已删除的笔记 */ - public static final int ID_TRASH_FOLER = -3; + public static final int ID_TRASH_FOLDER = -3; /** * Intent额外参数定义,用于组件间传递数据 diff --git a/src/notes/data/NotesDatabaseHelper.java b/src/notes/data/NotesDatabaseHelper.java index f64297b..e43f452 100644 --- a/src/notes/data/NotesDatabaseHelper.java +++ b/src/notes/data/NotesDatabaseHelper.java @@ -224,10 +224,10 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { private static final String FOLDER_MOVE_NOTES_ON_TRASH_TRIGGER = "CREATE TRIGGER folder_move_notes_on_trash " + " AFTER UPDATE ON " + TABLE.NOTE + - " WHEN new." + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER + + " WHEN new." + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLDER + " BEGIN" + " UPDATE " + TABLE.NOTE + - " SET " + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER + + " SET " + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLDER + " WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" + " END"; @@ -311,7 +311,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { * create trash folder */ values.clear(); - values.put(NoteColumns.ID, Notes.ID_TRASH_FOLER); + values.put(NoteColumns.ID, Notes.ID_TRASH_FOLDER); values.put(NoteColumns.TYPE, Notes.TYPE_SYSTEM); db.insert(TABLE.NOTE, null, values); } @@ -432,7 +432,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { + " TEXT NOT NULL DEFAULT ''"); // add a trash system folder ContentValues values = new ContentValues(); - values.put(NoteColumns.ID, Notes.ID_TRASH_FOLER); + values.put(NoteColumns.ID, Notes.ID_TRASH_FOLDER); values.put(NoteColumns.TYPE, Notes.TYPE_SYSTEM); db.insert(TABLE.NOTE, null, values); } diff --git a/src/notes/data/NotesProvider.java b/src/notes/data/NotesProvider.java index 213a6d1..8810f7a 100644 --- a/src/notes/data/NotesProvider.java +++ b/src/notes/data/NotesProvider.java @@ -118,7 +118,7 @@ public class NotesProvider extends ContentProvider { private static String NOTES_SNIPPET_SEARCH_QUERY = "SELECT " + NOTES_SEARCH_PROJECTION + " FROM " + TABLE.NOTE + " WHERE " + NoteColumns.SNIPPET + " LIKE ?" - + " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER + + " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLDER + " AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE; /** diff --git a/src/notes/gtask/remote/GTaskManager.java b/src/notes/gtask/remote/GTaskManager.java index 94ddb1e..0cced43 100644 --- a/src/notes/gtask/remote/GTaskManager.java +++ b/src/notes/gtask/remote/GTaskManager.java @@ -324,7 +324,7 @@ public class GTaskManager { try { c = mContentResolver.query(Notes.CONTENT_NOTE_URI, SqlNote.PROJECTION_NOTE, "(type<>? AND parent_id=?)", new String[] { - String.valueOf(Notes.TYPE_SYSTEM), String.valueOf(Notes.ID_TRASH_FOLER) + String.valueOf(Notes.TYPE_SYSTEM), String.valueOf(Notes.ID_TRASH_FOLDER) }, null); if (c != null) { while (c.moveToNext()) { @@ -354,7 +354,7 @@ public class GTaskManager { try { c = mContentResolver.query(Notes.CONTENT_NOTE_URI, SqlNote.PROJECTION_NOTE, "(type=? AND parent_id<>?)", new String[] { - String.valueOf(Notes.TYPE_NOTE), String.valueOf(Notes.ID_TRASH_FOLER) + String.valueOf(Notes.TYPE_NOTE), String.valueOf(Notes.ID_TRASH_FOLDER) }, NoteColumns.TYPE + " DESC"); if (c != null) { while (c.moveToNext()) { @@ -489,7 +489,7 @@ public class GTaskManager { try { c = mContentResolver.query(Notes.CONTENT_NOTE_URI, SqlNote.PROJECTION_NOTE, "(type=? AND parent_id<>?)", new String[] { - String.valueOf(Notes.TYPE_FOLDER), String.valueOf(Notes.ID_TRASH_FOLER) + String.valueOf(Notes.TYPE_FOLDER), String.valueOf(Notes.ID_TRASH_FOLDER) }, NoteColumns.TYPE + " DESC"); if (c != null) { while (c.moveToNext()) { @@ -822,7 +822,7 @@ public class GTaskManager { try { c = mContentResolver.query(Notes.CONTENT_NOTE_URI, SqlNote.PROJECTION_NOTE, "(type<>? AND parent_id<>?)", new String[] { - String.valueOf(Notes.TYPE_SYSTEM), String.valueOf(Notes.ID_TRASH_FOLER) + String.valueOf(Notes.TYPE_SYSTEM), String.valueOf(Notes.ID_TRASH_FOLDER) }, NoteColumns.TYPE + " DESC"); if (c != null) { while (c.moveToNext()) { diff --git a/src/notes/tool/BackupUtils.java b/src/notes/tool/BackupUtils.java index b869743..b77d37b 100644 --- a/src/notes/tool/BackupUtils.java +++ b/src/notes/tool/BackupUtils.java @@ -249,7 +249,7 @@ public class BackupUtils { Notes.CONTENT_NOTE_URI, NOTE_PROJECTION, "(" + NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER + " AND " - + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER + ") OR " + + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLDER + ") OR " + NoteColumns.ID + "=" + Notes.ID_CALL_RECORD_FOLDER, null, null); if (folderCursor != null) { @@ -370,4 +370,4 @@ public class BackupUtils { return null; } -} \ No newline at end of file +} diff --git a/src/notes/tool/DataUtils.java b/src/notes/tool/DataUtils.java index b4cdb3d..2b9dbea 100644 --- a/src/notes/tool/DataUtils.java +++ b/src/notes/tool/DataUtils.java @@ -148,7 +148,7 @@ public class DataUtils { Cursor cursor =resolver.query(Notes.CONTENT_NOTE_URI, new String[] { "COUNT(*)" }, NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>?", - new String[] { String.valueOf(Notes.TYPE_FOLDER), String.valueOf(Notes.ID_TRASH_FOLER)}, + new String[] { String.valueOf(Notes.TYPE_FOLDER), String.valueOf(Notes.ID_TRASH_FOLDER)}, null); int count = 0; @@ -177,7 +177,7 @@ public class DataUtils { // 查询指定ID和类型,且不在回收站中的笔记 Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), null, - NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER, + NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLDER, new String [] {String.valueOf(type)}, null); @@ -243,7 +243,7 @@ public class DataUtils { // 查询类型为文件夹、不在回收站中且名称匹配的记录 Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, null, NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER + - " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER + + " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLDER + " AND " + NoteColumns.SNIPPET + "=?", new String[] { name }, null); boolean exist = false; @@ -386,4 +386,4 @@ public class DataUtils { } return snippet; } -} \ No newline at end of file +} diff --git a/src/notes/tool/GTaskStringUtils.java b/src/notes/tool/GTaskStringUtils.java index 6e7159c..204bca8 100644 --- a/src/notes/tool/GTaskStringUtils.java +++ b/src/notes/tool/GTaskStringUtils.java @@ -85,4 +85,4 @@ public class GTaskStringUtils { public final static String META_HEAD_NOTE = "meta_note"; // 笔记元数据头 public final static String META_HEAD_DATA = "meta_data"; // 数据元数据头 public final static String META_NOTE_NAME = "[META INFO] DON'T UPDATE AND DELETE"; // 元数据笔记名称(用户不应修改或删除) -} \ No newline at end of file +} diff --git a/src/notes/tool/ResourceParser.java b/src/notes/tool/ResourceParser.java index f86f4a8..68741b2 100644 --- a/src/notes/tool/ResourceParser.java +++ b/src/notes/tool/ResourceParser.java @@ -268,4 +268,4 @@ public class ResourceParser { return TEXTAPPEARANCE_RESOURCES.length; } } -} \ No newline at end of file +} diff --git a/src/notes/ui/AlarmAlertActivity.java b/src/notes/ui/AlarmAlertActivity.java index a3a56a9..5caabf9 100644 --- a/src/notes/ui/AlarmAlertActivity.java +++ b/src/notes/ui/AlarmAlertActivity.java @@ -206,4 +206,4 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD mPlayer = null; // 置空引用 } } -} \ No newline at end of file +} diff --git a/src/notes/ui/AlarmInitReceiver.java b/src/notes/ui/AlarmInitReceiver.java index 07d348f..0998bc7 100644 --- a/src/notes/ui/AlarmInitReceiver.java +++ b/src/notes/ui/AlarmInitReceiver.java @@ -87,4 +87,4 @@ public class AlarmInitReceiver extends BroadcastReceiver { // 当设备重启后,所有之前设置的AlarmManager闹钟都会被清除 // 所以需要这个Receiver来重新设置所有未触发的闹钟 } -} \ No newline at end of file +} diff --git a/src/notes/ui/AlarmReceiver.java b/src/notes/ui/AlarmReceiver.java index 93bd92e..89f537f 100644 --- a/src/notes/ui/AlarmReceiver.java +++ b/src/notes/ui/AlarmReceiver.java @@ -44,4 +44,4 @@ public class AlarmReceiver extends BroadcastReceiver { // sender.setData(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, c.getLong(COLUMN_ID))) // 所以AlarmAlertActivity可以通过getIntent().getData()获取到笔记信息 } -} \ No newline at end of file +} diff --git a/src/notes/ui/DateTimePicker.java b/src/notes/ui/DateTimePicker.java index 49856df..fe5039b 100644 --- a/src/notes/ui/DateTimePicker.java +++ b/src/notes/ui/DateTimePicker.java @@ -575,4 +575,4 @@ public class DateTimePicker extends FrameLayout { getCurrentMonth(), getCurrentDay(), getCurrentHourOfDay(), getCurrentMinute()); } } -} \ No newline at end of file +} diff --git a/src/notes/ui/DateTimePickerDialog.java b/src/notes/ui/DateTimePickerDialog.java index 9fd2ef5..b68a7ed 100644 --- a/src/notes/ui/DateTimePickerDialog.java +++ b/src/notes/ui/DateTimePickerDialog.java @@ -138,4 +138,4 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener mOnDateTimeSetListener.OnDateTimeSet(this, mDate.getTimeInMillis()); } } -} \ No newline at end of file +} diff --git a/src/notes/ui/DropdownMenu.java b/src/notes/ui/DropdownMenu.java index 88a6167..385d59c 100644 --- a/src/notes/ui/DropdownMenu.java +++ b/src/notes/ui/DropdownMenu.java @@ -88,4 +88,4 @@ public class DropdownMenu { public void setTitle(CharSequence title) { mButton.setText(title); } -} \ No newline at end of file +} diff --git a/src/notes/ui/FoldersListAdapter.java b/src/notes/ui/FoldersListAdapter.java index fcab924..b813f4d 100644 --- a/src/notes/ui/FoldersListAdapter.java +++ b/src/notes/ui/FoldersListAdapter.java @@ -133,4 +133,4 @@ public class FoldersListAdapter extends CursorAdapter { mName.setText(name); } } -} \ No newline at end of file +} diff --git a/src/notes/ui/NoteEditActivity.java b/src/notes/ui/NoteEditActivity.java index d2c00a0..afd6110 100644 --- a/src/notes/ui/NoteEditActivity.java +++ b/src/notes/ui/NoteEditActivity.java @@ -53,6 +53,7 @@ import android.widget.TextView; import android.widget.Toast; import net.micode.notes.R; +import net.micode.notes.tool.ElderModeUtils; import net.micode.notes.data.Notes; import net.micode.notes.data.Notes.TextNote; import net.micode.notes.model.WorkingNote; @@ -281,6 +282,8 @@ public class NoteEditActivity extends Activity implements OnClickListener, protected void onResume() { super.onResume(); initNoteScreen(); // 初始化笔记界面 + // 每次恢复时应用老年人模式 + ElderModeUtils.applyElderMode(this, findViewById(android.R.id.content)); } /** @@ -438,6 +441,9 @@ public class NoteEditActivity extends Activity implements OnClickListener, } mEditTextList = (LinearLayout) findViewById(R.id.note_edit_list); + + // 应用老年人模式 + ElderModeUtils.applyElderMode(this, findViewById(android.R.id.content)); } @Override @@ -449,7 +455,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, } clearSettingState(); // 清除设置状态 } - + /** * 更新桌面小部件 */ @@ -702,7 +708,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, } } else { // 同步模式:移动到回收站 - if (!DataUtils.batchMoveToFolder(getContentResolver(), ids, Notes.ID_TRASH_FOLER)) { + if (!DataUtils.batchMoveToFolder(getContentResolver(), ids, Notes.ID_TRASH_FOLDER)) { Log.e(TAG, "Move notes to trash folder error, should not happens"); } } @@ -1043,4 +1049,4 @@ public class NoteEditActivity extends Activity implements OnClickListener, private void showToast(int resId, int duration) { Toast.makeText(this, resId, duration).show(); } -} \ No newline at end of file +} diff --git a/src/notes/ui/NoteEditText.java b/src/notes/ui/NoteEditText.java index fa862f1..2e144d1 100644 --- a/src/notes/ui/NoteEditText.java +++ b/src/notes/ui/NoteEditText.java @@ -291,4 +291,4 @@ public class NoteEditText extends EditText { } super.onCreateContextMenu(menu); } -} \ No newline at end of file +} diff --git a/src/notes/ui/NoteItemData.java b/src/notes/ui/NoteItemData.java index 988bc9c..41a2b4b 100644 --- a/src/notes/ui/NoteItemData.java +++ b/src/notes/ui/NoteItemData.java @@ -347,4 +347,4 @@ public class NoteItemData { public static int getNoteType(Cursor cursor) { return cursor.getInt(TYPE_COLUMN); } -} \ No newline at end of file +} diff --git a/src/notes/ui/NotesListActivity.java b/src/notes/ui/NotesListActivity.java index 6bbb470..414a16c 100644 --- a/src/notes/ui/NotesListActivity.java +++ b/src/notes/ui/NotesListActivity.java @@ -67,6 +67,7 @@ import net.micode.notes.gtask.remote.GTaskSyncService; import net.micode.notes.model.WorkingNote; import net.micode.notes.tool.BackupUtils; import net.micode.notes.tool.DataUtils; +import net.micode.notes.tool.ElderModeUtils; import net.micode.notes.tool.ResourceParser; import net.micode.notes.ui.NotesListAdapter.AppWidgetAttribute; import net.micode.notes.widget.NoteWidgetProvider_2x; @@ -227,6 +228,13 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt // 启动异步查询笔记列表 startAsyncNotesListQuery(); } + + @Override + protected void onResume() { + super.onResume(); + // 每次恢复时应用老年人模式 + ElderModeUtils.applyElderMode(this, findViewById(android.R.id.content)); + } /** * 初始化资源 @@ -252,6 +260,9 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt mTitleBar = (TextView) findViewById(R.id.tv_title_bar); mState = ListEditState.NOTE_LIST; // 初始状态为普通笔记列表 mModeCallBack = new ModeCallback(); // 多选模式回调 + + // 应用老年人模式 + ElderModeUtils.applyElderMode(this, findViewById(android.R.id.content)); } /** @@ -551,7 +562,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } else { // 同步模式下将笔记移动到回收站 if (!DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter - .getSelectedItemIds(), Notes.ID_TRASH_FOLER)) { + .getSelectedItemIds(), Notes.ID_TRASH_FOLDER)) { Log.e(TAG, "Move notes to trash folder error, should not happens"); } } @@ -593,7 +604,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt DataUtils.batchDeleteNotes(mContentResolver, ids); } else { // 同步模式下将文件夹移动到回收站 - DataUtils.batchMoveToFolder(mContentResolver, ids, Notes.ID_TRASH_FOLER); + DataUtils.batchMoveToFolder(mContentResolver, ids, Notes.ID_TRASH_FOLDER); } // 更新相关小部件 if (widgets != null) { @@ -1049,7 +1060,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt selection, new String[] { String.valueOf(Notes.TYPE_FOLDER), - String.valueOf(Notes.ID_TRASH_FOLER), + String.valueOf(Notes.ID_TRASH_FOLDER), String.valueOf(mCurrentFolderId) }, NoteColumns.MODIFIED_DATE + " DESC"); @@ -1074,4 +1085,4 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } return false; } -} \ No newline at end of file +} diff --git a/src/notes/ui/NotesListAdapter.java b/src/notes/ui/NotesListAdapter.java index 9a6fe82..260d68a 100644 --- a/src/notes/ui/NotesListAdapter.java +++ b/src/notes/ui/NotesListAdapter.java @@ -248,4 +248,4 @@ public class NotesListAdapter extends CursorAdapter { } } } -} \ No newline at end of file +} diff --git a/src/notes/ui/NotesListItem.java b/src/notes/ui/NotesListItem.java index a141f91..83e8f00 100644 --- a/src/notes/ui/NotesListItem.java +++ b/src/notes/ui/NotesListItem.java @@ -162,4 +162,4 @@ public class NotesListItem extends LinearLayout { public NoteItemData getItemData() { return mItemData; } -} \ No newline at end of file +} diff --git a/src/notes/ui/NotesPreferenceActivity.java b/src/notes/ui/NotesPreferenceActivity.java index 7cd21a9..8b229d0 100644 --- a/src/notes/ui/NotesPreferenceActivity.java +++ b/src/notes/ui/NotesPreferenceActivity.java @@ -16,7 +16,6 @@ package net.micode.notes.ui; -import androidx.core.content.ContextCompat; import android.accounts.Account; import android.accounts.AccountManager; import android.app.ActionBar; @@ -55,12 +54,14 @@ import net.micode.notes.gtask.remote.GTaskSyncService; public class NotesPreferenceActivity extends PreferenceActivity { // 偏好设置文件名 public static final String PREFERENCE_NAME = "notes_preferences"; - // 同步账户名称的键 + // 同步账户名称的键11 public static final String PREFERENCE_SYNC_ACCOUNT_NAME = "pref_key_account_name"; // 上次同步时间的键 public static final String PREFERENCE_LAST_SYNC_TIME = "pref_last_sync_time"; // 背景颜色设置的键 public static final String PREFERENCE_SET_BG_COLOR_KEY = "pref_key_bg_random_appear"; + // 老年人模式的键 + public static final String PREFERENCE_ELDER_MODE_KEY = "pref_key_elder_mode"; // 同步账户设置的键 private static final String PREFERENCE_SYNC_ACCOUNT_KEY = "pref_sync_account_key"; // 账户授权过滤器的键 @@ -71,9 +72,6 @@ public class NotesPreferenceActivity extends PreferenceActivity { private Account[] mOriAccounts; // 原始账户列表(用于检测新添加的账户) private boolean mHasAddedAccount; // 标记是否添加了新账户 -// 在文件顶部添加这个 import -// import androidx.core.content.ContextCompat; - @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); @@ -86,28 +84,15 @@ public class NotesPreferenceActivity extends PreferenceActivity { mAccountCategory = (PreferenceCategory) findPreference(PREFERENCE_SYNC_ACCOUNT_KEY); mReceiver = new GTaskReceiver(); // 创建广播接收器 IntentFilter filter = new IntentFilter(); -<<<<<<< HEAD filter.addAction(GTaskSyncService.GTASK_SERVICE_BROADCAST_NAME); // 注册同步服务广播 registerReceiver(mReceiver, filter); // 注册广播接收器 -======= - filter.addAction(GTaskSyncService.GTASK_SERVICE_BROADCAST_NAME); - - // 修复:兼容 Android 13+ 的广播注册方式 - ContextCompat.registerReceiver( - this, - mReceiver, - filter, - null, - null, - ContextCompat.RECEIVER_NOT_EXPORTED // 内部广播,更安全 - ); ->>>>>>> ce8801278409c0c99db42eb507f3f732202b6249 mOriAccounts = null; // 添加设置界面的头部视图 View header = LayoutInflater.from(this).inflate(R.layout.settings_header, null); getListView().addHeaderView(header, null, true); } + @Override protected void onResume() { super.onResume(); @@ -473,4 +458,4 @@ public class NotesPreferenceActivity extends PreferenceActivity { return false; } } -} \ No newline at end of file +} diff --git a/src/notes/widget/NoteWidgetProvider.java b/src/notes/widget/NoteWidgetProvider.java index 477e582..7206c15 100644 --- a/src/notes/widget/NoteWidgetProvider.java +++ b/src/notes/widget/NoteWidgetProvider.java @@ -78,7 +78,7 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider { PROJECTION, // 查询条件:小部件ID匹配且不在回收站中 NoteColumns.WIDGET_ID + "=? AND " + NoteColumns.PARENT_ID + "<>?", - new String[] { String.valueOf(widgetId), String.valueOf(Notes.ID_TRASH_FOLER) }, + new String[] { String.valueOf(widgetId), String.valueOf(Notes.ID_TRASH_FOLDER) }, null); } @@ -179,4 +179,4 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider { * @return 小部件类型(如Notes.TYPE_WIDGET_2X, Notes.TYPE_WIDGET_4X) */ protected abstract int getWidgetType(); -} \ No newline at end of file +} diff --git a/src/notes/widget/NoteWidgetProvider_2x.java b/src/notes/widget/NoteWidgetProvider_2x.java index 8a6aa64..c13b020 100644 --- a/src/notes/widget/NoteWidgetProvider_2x.java +++ b/src/notes/widget/NoteWidgetProvider_2x.java @@ -68,4 +68,4 @@ public class NoteWidgetProvider_2x extends NoteWidgetProvider { protected int getWidgetType() { return Notes.TYPE_WIDGET_2X; // 返回2x小部件的类型标识 } -} \ No newline at end of file +} diff --git a/src/notes/widget/NoteWidgetProvider_4x.java b/src/notes/widget/NoteWidgetProvider_4x.java index 744b359..2483429 100644 --- a/src/notes/widget/NoteWidgetProvider_4x.java +++ b/src/notes/widget/NoteWidgetProvider_4x.java @@ -68,4 +68,4 @@ public class NoteWidgetProvider_4x extends NoteWidgetProvider { protected int getWidgetType() { return Notes.TYPE_WIDGET_4X; // 返回4x小部件的类型标识 } -} \ No newline at end of file +}