allow translating the "General note" string

This commit is contained in:
tibbi 2016-11-22 21:21:15 +01:00
parent 532013a1cf
commit 4e930335a6
8 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -23,6 +23,7 @@
<string name="pick_a_note_for_widget">Wähle Notiz für das Widget</string>
<string name="rename">Rename</string>
<string name="rename_note">Rename note</string>
<string name="general_note">General note</string>
<!-- Settings -->
<string name="settings">Einstellungen</string>

View File

@ -23,6 +23,7 @@
<string name="pick_a_note_for_widget">Seleccione una nota para el widget</string>
<string name="rename">Renombrar</string>
<string name="rename_note">Renombrar nota</string>
<string name="general_note">General note</string>
<!-- Settings -->
<string name="settings">Opciones</string>

View File

@ -23,6 +23,7 @@
<string name="pick_a_note_for_widget">Pick a note for the widget</string>
<string name="rename">Rename</string>
<string name="rename_note">Rename note</string>
<string name="general_note">General note</string>
<!-- Settings -->
<string name="settings">Impostazioni</string>

View File

@ -23,6 +23,7 @@
<string name="pick_a_note_for_widget">ウィジェットのメモを選択</string>
<string name="rename">Rename</string>
<string name="rename_note">Rename note</string>
<string name="general_note">General note</string>
<!-- Settings -->
<string name="settings">設定</string>

View File

@ -23,6 +23,7 @@
<string name="pick_a_note_for_widget">Escolha uma nota para o widget</string>
<string name="rename">Rename</string>
<string name="rename_note">Rename note</string>
<string name="general_note">General note</string>
<!-- Settings -->
<string name="settings">Definições</string>

View File

@ -23,6 +23,7 @@
<string name="pick_a_note_for_widget">Pick a note for the widget</string>
<string name="rename">Rename</string>
<string name="rename_note">Rename note</string>
<string name="general_note">General note</string>
<!-- Settings -->
<string name="settings">Inställningar</string>

View File

@ -23,6 +23,7 @@
<string name="pick_a_note_for_widget">Pick a note for the widget</string>
<string name="rename">Rename</string>
<string name="rename_note">Rename note</string>
<string name="general_note">General note</string>
<!-- Settings -->
<string name="settings">Settings</string>