From 4e930335a60c0a0893484daa13c89355e78e097f Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 22 Nov 2016 21:21:15 +0100 Subject: [PATCH] allow translating the "General note" string --- .../com/simplemobiletools/notes/databases/DBHelper.kt | 9 +++++---- app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-pt-rPT/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 8 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/databases/DBHelper.kt b/app/src/main/kotlin/com/simplemobiletools/notes/databases/DBHelper.kt index 4a124a09..df4f30be 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/databases/DBHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/databases/DBHelper.kt @@ -6,6 +6,7 @@ import android.database.Cursor import android.database.sqlite.SQLiteDatabase import android.database.sqlite.SQLiteOpenHelper import com.simplemobiletools.notes.PREFS_KEY +import com.simplemobiletools.notes.R import com.simplemobiletools.notes.TEXT import com.simplemobiletools.notes.TYPE_NOTE import com.simplemobiletools.notes.models.Note @@ -18,7 +19,6 @@ class DBHelper private constructor(private val mContext: Context) : SQLiteOpenHe private val DB_NAME = "notes.db" private val DB_VERSION = 2 private val TABLE_NAME = "notes" - private val NOTE = "General note" private val COL_ID = "id" private val COL_TITLE = "title" @@ -43,9 +43,10 @@ class DBHelper private constructor(private val mContext: Context) : SQLiteOpenHe } private fun insertFirstNote(db: SQLiteDatabase) { + val generalNote = mContext.resources.getString(R.string.general_note) val prefs = mContext.getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE) val text = prefs.getString(TEXT, "") - val note = Note(1, NOTE, text, TYPE_NOTE) + val note = Note(1, generalNote, text, TYPE_NOTE) insertNote(note, db) } @@ -68,12 +69,12 @@ class DBHelper private constructor(private val mContext: Context) : SQLiteOpenHe } fun deleteNote(id: Int) { - mDb.delete(TABLE_NAME, COL_ID + " = " + id, null) + mDb.delete(TABLE_NAME, "$COL_ID = $id", null) } fun doesTitleExist(title: String): Boolean { val cols = arrayOf(COL_ID) - val selection = COL_TITLE + " = ?" + val selection = "$COL_TITLE = ?" val selectionArgs = arrayOf(title) val cursor = mDb.query(TABLE_NAME, cols, selection, selectionArgs, null, null, null) ?: return false val cnt = cursor.count diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 4c702c5b..b5dc8723 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -23,6 +23,7 @@ Wähle Notiz für das Widget Rename Rename note + General note Einstellungen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index a99fc364..c485c8a3 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -23,6 +23,7 @@ Seleccione una nota para el widget Renombrar Renombrar nota + General note Opciones diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 1bc81771..03810418 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -23,6 +23,7 @@ Pick a note for the widget Rename Rename note + General note Impostazioni diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 23f864e5..78ea1491 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -23,6 +23,7 @@ ウィジェットのメモを選択 Rename Rename note + General note 設定 diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index b4e8429c..d0e6971b 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -23,6 +23,7 @@ Escolha uma nota para o widget Rename Rename note + General note Definições diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index c371cc2b..927be6dd 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -23,6 +23,7 @@ Pick a note for the widget Rename Rename note + General note Inställningar diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cbc8746a..a7dec6a0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -23,6 +23,7 @@ Pick a note for the widget Rename Rename note + General note Settings