-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NF: improve the readability of some strings #17592
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,16 +71,27 @@ object MetaDB { | |
|
||
// Create tables if not exist | ||
metaDb.execSQL( | ||
"CREATE TABLE IF NOT EXISTS languages (" + " _id INTEGER PRIMARY KEY AUTOINCREMENT, " + | ||
"did INTEGER NOT NULL, ord INTEGER, " + "qa INTEGER, " + "language TEXT)", | ||
"""CREATE TABLE IF NOT EXISTS languages ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have all the changes to this file been tested (or are they under coverage)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can at least start a new version of ankidroid on emulator, add and review a card. So it works at least in the sense that if there is a change, it's still compatible with the schema created here. Which seems quite improbable |
||
_id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
did INTEGER NOT NULL, | ||
ord INTEGER, | ||
qa INTEGER, | ||
language TEXT | ||
)""", | ||
) | ||
metaDb.execSQL( | ||
"CREATE TABLE IF NOT EXISTS smallWidgetStatus (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + | ||
"due INTEGER NOT NULL, eta INTEGER NOT NULL)", | ||
"""CREATE TABLE IF NOT EXISTS smallWidgetStatus ( | ||
id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
due INTEGER NOT NULL, | ||
eta INTEGER NOT NULL | ||
)""", | ||
) | ||
metaDb.execSQL( | ||
"CREATE TABLE IF NOT EXISTS micToolbarState (" + "_id INTEGER PRIMARY KEY AUTOINCREMENT, " + | ||
"did INTEGER NOT NULL, state INTEGER NOT NULL)", | ||
"""CREATE TABLE IF NOT EXISTS micToolbarState ( | ||
_id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
did INTEGER NOT NULL, | ||
state INTEGER NOT NULL | ||
)""", | ||
) | ||
|
||
updateWidgetStatus(metaDb) | ||
|
@@ -94,8 +105,14 @@ object MetaDB { | |
val columnCount = DatabaseUtil.getTableColumnCount(metaDb, "whiteboardState") | ||
if (columnCount <= 0) { | ||
metaDb.execSQL( | ||
"CREATE TABLE IF NOT EXISTS whiteboardState (_id INTEGER PRIMARY KEY AUTOINCREMENT, " + | ||
"did INTEGER NOT NULL, state INTEGER, visible INTEGER, lightpencolor INTEGER, darkpencolor INTEGER, stylus INTEGER)", | ||
"""CREATE TABLE IF NOT EXISTS whiteboardState ( | ||
_id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
did INTEGER NOT NULL, state INTEGER, | ||
visible INTEGER, | ||
lightpencolor INTEGER, | ||
darkpencolor INTEGER, | ||
stylus INTEGER | ||
)""", | ||
) | ||
return | ||
} | ||
|
@@ -120,14 +137,20 @@ object MetaDB { | |
val columnCount = DatabaseUtil.getTableColumnCount(metaDb, "widgetStatus") | ||
if (columnCount > 0) { | ||
if (columnCount < 7) { | ||
metaDb.execSQL("ALTER TABLE widgetStatus " + "ADD COLUMN eta INTEGER NOT NULL DEFAULT '0'") | ||
metaDb.execSQL("ALTER TABLE widgetStatus " + "ADD COLUMN time INTEGER NOT NULL DEFAULT '0'") | ||
metaDb.execSQL("ALTER TABLE widgetStatus ADD COLUMN eta INTEGER NOT NULL DEFAULT '0'") | ||
metaDb.execSQL("ALTER TABLE widgetStatus ADD COLUMN time INTEGER NOT NULL DEFAULT '0'") | ||
} | ||
} else { | ||
metaDb.execSQL( | ||
"CREATE TABLE IF NOT EXISTS widgetStatus (" + "deckId INTEGER NOT NULL PRIMARY KEY, " + | ||
"deckName TEXT NOT NULL, " + "newCards INTEGER NOT NULL, " + "lrnCards INTEGER NOT NULL, " + | ||
"dueCards INTEGER NOT NULL, " + "progress INTEGER NOT NULL, " + "eta INTEGER NOT NULL)", | ||
"""CREATE TABLE IF NOT EXISTS widgetStatus ( | ||
deckId INTEGER NOT NULL PRIMARY KEY, | ||
deckName TEXT NOT NULL, | ||
newCards INTEGER NOT NULL, | ||
lrnCards INTEGER NOT NULL, | ||
dueCards INTEGER NOT NULL, | ||
progress INTEGER NOT NULL, | ||
eta INTEGER NOT NULL | ||
)""", | ||
) | ||
} | ||
} | ||
|
@@ -225,7 +248,7 @@ object MetaDB { | |
try { | ||
if ("" == getLanguage(context, did, ord, qa)) { | ||
mMetaDb!!.execSQL( | ||
"INSERT INTO languages (did, ord, qa, language) " + " VALUES (?, ?, ?, ?);", | ||
"INSERT INTO languages (did, ord, qa, language) VALUES (?, ?, ?, ?);", | ||
arrayOf<Any>( | ||
did, | ||
ord, | ||
|
@@ -520,9 +543,7 @@ object MetaDB { | |
).use { cur -> | ||
if (cur.moveToNext()) { | ||
metaDb.execSQL( | ||
"UPDATE whiteboardState SET did = ?, " + | ||
columnName + "= ? " + | ||
" WHERE _id=?;", | ||
"UPDATE whiteboardState SET did = ?, $columnName= ? WHERE _id=?;", | ||
arrayOf<Any?>(did, value, cur.getString(0)), | ||
) | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this been tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can open the about page and still see the changes.

Appart from that, it's exactly the same code as before, except that it uses triple-quote and
I'd suggest to use android studio commit tool instead of github one. Because this way you can easily check that everything removed were
\
before the"
, the" +
and+ "
and everything added are$
before the variables.The idea is really that we have the same string, but more readable