-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from babydots/add-contact
Add your own contacts, and disable the default ones.
- Loading branch information
Showing
100 changed files
with
2,078 additions
and
318 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
app/schemas/com.serwylo.babyphone.db.AppDatabase/1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
{ | ||
"formatVersion": 1, | ||
"database": { | ||
"version": 1, | ||
"identityHash": "dcf6b04473488094a535508daf201e79", | ||
"entities": [ | ||
{ | ||
"tableName": "Contact", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`name` TEXT NOT NULL, `avatarPath` TEXT NOT NULL, `isEnabled` INTEGER NOT NULL, `isDefault` INTEGER NOT NULL, `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL)", | ||
"fields": [ | ||
{ | ||
"fieldPath": "name", | ||
"columnName": "name", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "avatarPath", | ||
"columnName": "avatarPath", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "isEnabled", | ||
"columnName": "isEnabled", | ||
"affinity": "INTEGER", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "isDefault", | ||
"columnName": "isDefault", | ||
"affinity": "INTEGER", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "id", | ||
"columnName": "id", | ||
"affinity": "INTEGER", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"columnNames": [ | ||
"id" | ||
], | ||
"autoGenerate": true | ||
}, | ||
"indices": [], | ||
"foreignKeys": [] | ||
}, | ||
{ | ||
"tableName": "Recording", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`contactId` INTEGER NOT NULL, `soundFilePath` TEXT NOT NULL, `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, FOREIGN KEY(`contactId`) REFERENCES `Contact`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", | ||
"fields": [ | ||
{ | ||
"fieldPath": "contactId", | ||
"columnName": "contactId", | ||
"affinity": "INTEGER", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "soundFilePath", | ||
"columnName": "soundFilePath", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "id", | ||
"columnName": "id", | ||
"affinity": "INTEGER", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"columnNames": [ | ||
"id" | ||
], | ||
"autoGenerate": true | ||
}, | ||
"indices": [], | ||
"foreignKeys": [ | ||
{ | ||
"table": "Contact", | ||
"onDelete": "CASCADE", | ||
"onUpdate": "NO ACTION", | ||
"columns": [ | ||
"contactId" | ||
], | ||
"referencedColumns": [ | ||
"id" | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"tableName": "Settings", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`currentContactId` INTEGER NOT NULL, `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, FOREIGN KEY(`currentContactId`) REFERENCES `Contact`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL )", | ||
"fields": [ | ||
{ | ||
"fieldPath": "currentContactId", | ||
"columnName": "currentContactId", | ||
"affinity": "INTEGER", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "id", | ||
"columnName": "id", | ||
"affinity": "INTEGER", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"columnNames": [ | ||
"id" | ||
], | ||
"autoGenerate": true | ||
}, | ||
"indices": [], | ||
"foreignKeys": [ | ||
{ | ||
"table": "Contact", | ||
"onDelete": "SET NULL", | ||
"onUpdate": "NO ACTION", | ||
"columns": [ | ||
"currentContactId" | ||
], | ||
"referencedColumns": [ | ||
"id" | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"views": [], | ||
"setupQueries": [ | ||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", | ||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'dcf6b04473488094a535508daf201e79')" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.serwylo.babyphone | ||
|
||
import android.content.Context | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.preference.PreferenceManager | ||
import io.github.tonnyl.whatsnew.WhatsNew | ||
import io.github.tonnyl.whatsnew.item.WhatsNewItem | ||
import io.github.tonnyl.whatsnew.util.PresentationOption | ||
|
||
object Changelog { | ||
|
||
@JvmStatic | ||
fun show(activity: AppCompatActivity) { | ||
|
||
val whatsNew = buildDialog(activity) | ||
|
||
// Only show when upgrading Lexica for the first time, not when we first open Lexica from | ||
// a fresh install. | ||
whatsNew.presentationOption = if (isFirstRun(activity)) PresentationOption.NEVER else PresentationOption.IF_NEEDED | ||
whatsNew.presentAutomatically(activity) | ||
|
||
rememberLexicaHasRun(activity) | ||
|
||
} | ||
|
||
private fun buildDialog(context: Context): WhatsNew { | ||
|
||
return WhatsNew.newInstance( | ||
WhatsNewItem( | ||
"Add your own contacts!", | ||
"Personalise your baby phone via the settings to add family and friends for your baby to talk to.\n\nCompletely private, no photo or recording will ever leave your phone.", | ||
R.drawable.ic_person_add, | ||
), | ||
).apply { | ||
titleText = "What's New?" | ||
buttonText = "Continue" | ||
} | ||
|
||
} | ||
|
||
private fun isFirstRun(context: Context): Boolean { | ||
val prefs = PreferenceManager.getDefaultSharedPreferences(context) | ||
return !prefs.getBoolean(HAS_RUN, false) | ||
} | ||
|
||
private fun rememberLexicaHasRun(context: Context) { | ||
PreferenceManager.getDefaultSharedPreferences(context) | ||
.edit() | ||
.putBoolean(HAS_RUN, true) | ||
.apply() | ||
} | ||
|
||
private const val HAS_RUN = "lexica-has-run-before" | ||
|
||
} |
Oops, something went wrong.