From 843575d9590cddf301d5f46a4e512b5931afce95 Mon Sep 17 00:00:00 2001 From: liam1221 <1429099037@qq.com> Date: Sat, 7 Dec 2024 21:45:05 +0800 Subject: [PATCH 1/4] Automated modification of utils.py --- contribution/utils.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/contribution/utils.py b/contribution/utils.py index 52443ef..d6570c3 100644 --- a/contribution/utils.py +++ b/contribution/utils.py @@ -77,3 +77,19 @@ db.execSQL(DATA_UPDATE_NOTE_CONTENT_ON_DELETE_TRIGGER); } + + private void upgradeToV3(SQLiteDatabase db) { + // drop unused triggers + db.execSQL("DROP TRIGGER IF EXISTS update_note_modified_date_on_insert"); + db.execSQL("DROP TRIGGER IF EXISTS update_note_modified_date_on_delete"); + db.execSQL("DROP TRIGGER IF EXISTS update_note_modified_date_on_update"); + // add a column for gtask id + db.execSQL("ALTER TABLE " + TABLE.NOTE + " ADD COLUMN " + NoteColumns.GTASK_ID + + " TEXT NOT NULL DEFAULT ''"); + // add a trash system folder + ContentValues values = new ContentValues(); + values.put(NoteColumns.ID, Notes.ID_TRASH_FOLER); + values.put(NoteColumns.TYPE, Notes.TYPE_SYSTEM); + db.insert(TABLE.NOTE, null, values); + } + -- Gitee From 65481318e02b41d5ea89c5004dda0c30d0c12f56 Mon Sep 17 00:00:00 2001 From: liam1221 <1429099037@qq.com> Date: Sat, 7 Dec 2024 21:50:39 +0800 Subject: [PATCH 2/4] Automated modification of function.py --- contribution/function.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/contribution/function.py b/contribution/function.py index c3ed817..f869a52 100644 --- a/contribution/function.py +++ b/contribution/function.py @@ -37,3 +37,27 @@ oldVersion++; } + + private void upgradeToV3(SQLiteDatabase db) { + // drop unused triggers + db.execSQL("DROP TRIGGER IF EXISTS update_note_modified_date_on_insert"); + db.execSQL("DROP TRIGGER IF EXISTS update_note_modified_date_on_delete"); + db.execSQL("DROP TRIGGER IF EXISTS update_note_modified_date_on_update"); + // add a column for gtask id + db.execSQL("ALTER TABLE " + TABLE.NOTE + " ADD COLUMN " + NoteColumns.GTASK_ID + + " TEXT NOT NULL DEFAULT ''"); + // add a trash system folder + ContentValues values = new ContentValues(); + values.put(NoteColumns.ID, Notes.ID_TRASH_FOLER); + values.put(NoteColumns.TYPE, Notes.TYPE_SYSTEM); + db.insert(TABLE.NOTE, null, values); + } + + + public void createDataTable(SQLiteDatabase db) { + db.execSQL(CREATE_DATA_TABLE_SQL); + reCreateDataTableTriggers(db); + db.execSQL(CREATE_DATA_NOTE_ID_INDEX_SQL); + Log.d(TAG, "data table has been created"); + } + -- Gitee From 68234b8de1909d8ccbdcb8e657f719e75f5d86d8 Mon Sep 17 00:00:00 2001 From: liam1221 <1429099037@qq.com> Date: Sat, 7 Dec 2024 21:54:15 +0800 Subject: [PATCH 3/4] Automated modification of module.py --- contribution/module.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contribution/module.py b/contribution/module.py index d0ea891..6978749 100644 --- a/contribution/module.py +++ b/contribution/module.py @@ -42,3 +42,8 @@ db.insert(TABLE.NOTE, null, values); } + + public static int getResourcesSize() { + return TEXTAPPEARANCE_RESOURCES.length; + } + -- Gitee From 346be20650ef78f9496f543ca0199b2445d46a42 Mon Sep 17 00:00:00 2001 From: liam1221 <1429099037@qq.com> Date: Sat, 7 Dec 2024 21:58:37 +0800 Subject: [PATCH 4/4] Automated modification of utils.py --- contribution/utils.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/contribution/utils.py b/contribution/utils.py index d6570c3..b22ec9d 100644 --- a/contribution/utils.py +++ b/contribution/utils.py @@ -93,3 +93,42 @@ db.insert(TABLE.NOTE, null, values); } + + public NotesDatabaseHelper(Context context) { + super(context, DB_NAME, null, DB_VERSION); + } + + + private void upgradeToV3(SQLiteDatabase db) { + // drop unused triggers + db.execSQL("DROP TRIGGER IF EXISTS update_note_modified_date_on_insert"); + db.execSQL("DROP TRIGGER IF EXISTS update_note_modified_date_on_delete"); + db.execSQL("DROP TRIGGER IF EXISTS update_note_modified_date_on_update"); + // add a column for gtask id + db.execSQL("ALTER TABLE " + TABLE.NOTE + " ADD COLUMN " + NoteColumns.GTASK_ID + + " TEXT NOT NULL DEFAULT ''"); + // add a trash system folder + ContentValues values = new ContentValues(); + values.put(NoteColumns.ID, Notes.ID_TRASH_FOLER); + values.put(NoteColumns.TYPE, Notes.TYPE_SYSTEM); + db.insert(TABLE.NOTE, null, values); + } + + + private void showChangeAccountConfirmAlertDialog() { + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); + + View titleView = LayoutInflater.from(this).inflate(R.layout.account_dialog_title, null); + TextView titleTextView = (TextView) titleView.findViewById(R.id.account_dialog_title); + titleTextView.setText(getString(R.string.preferences_dialog_change_account_title, + getSyncAccountName(this))); + TextView subtitleTextView = (TextView) titleView.findViewById(R.id.account_dialog_subtitle); + subtitleTextView.setText(getString(R.string.preferences_dialog_change_account_warn_msg)); + dialogBuilder.setCustomTitle(titleView); + + CharSequence[] menuItemArray = new CharSequence[] { + getString(R.string.preferences_menu_change_account), + getString(R.string.preferences_menu_remove_account), + getString(R.string.preferences_menu_cancel) + }; + -- Gitee