Skip to content

Commit

Permalink
Merge pull request #273 from flauschtrud/feature/228-notes
Browse files Browse the repository at this point in the history
Feature: Notes
  • Loading branch information
flauschtrud authored Dec 12, 2024
2 parents a92b8c6 + 0204bc1 commit 81790ea
Show file tree
Hide file tree
Showing 24 changed files with 410 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses || true

- name: Run UI Tests
run: bash ./gradlew allDevicesFdroidDebugAndroidTest -Pandroid.testoptions.manageddevices.emulator.gpu=swiftshader_indirect -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true -Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1 -Pandroid.experimental.testOptions.managedDevices.setupTimeoutMinutes=180
run: bash ./gradlew pixel2api30FdroidDebugAndroidTest -Pandroid.testoptions.manageddevices.emulator.gpu=swiftshader_indirect -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true -Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1 -Pandroid.experimental.testOptions.managedDevices.setupTimeoutMinutes=180

- name: Assemble App Debug APK
run: ./gradlew assembleDebug
Expand Down
17 changes: 9 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ apply plugin: 'com.android.application'
apply plugin: "androidx.navigation.safeargs"
apply plugin: 'com.mikepenz.aboutlibraries.plugin'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'androidx.room'

android {
compileSdk 35
Expand All @@ -17,12 +18,6 @@ android {
versionName "1.2.12"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArgument "notAnnotation", "androidx.test.filters.FlakyTest"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation":
"$projectDir/schemas".toString()]
}
}
}
buildTypes {
release {
Expand Down Expand Up @@ -56,6 +51,9 @@ android {
applicationVariants.configureEach { variant ->
variant.resValue "string", "versionName", variant.versionName
}
room {
schemaDirectory "$projectDir/schemas"
}
testOptions {
animationsDisabled = true
managedDevices {
Expand All @@ -65,6 +63,11 @@ android {
apiLevel = 30
systemImageSource = "aosp-atd"
}
pixel8api35 {
device = "Pixel 8"
apiLevel = 35
systemImageSource = "aosp-atd"
}
}
}
}
Expand Down Expand Up @@ -93,15 +96,13 @@ dependencies {
runtimeOnly group: 'com.google.android.material', name: 'material', version: '1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'

def nav_version = "2.8.4"
implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"

implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation "androidx.viewpager2:viewpager2:1.1.0"
implementation 'id.zelory:compressor:2.1.1' // 3.0.0 does not work with Java

def room_version = "2.6.1"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
testImplementation "androidx.room:room-testing:$room_version"
Expand Down
244 changes: 244 additions & 0 deletions app/schemas/com.flauschcode.broccoli.BroccoliDatabase/2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
{
"formatVersion": 1,
"database": {
"version": 2,
"identityHash": "01b8721f1ac5a34ff8cafe8c4f516546",
"entities": [
{
"tableName": "recipes",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`recipeId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `title` TEXT, `imageName` TEXT, `description` TEXT, `servings` TEXT, `preparationTime` TEXT, `source` TEXT, `ingredients` TEXT, `directions` TEXT, `notes` TEXT, `favorite` INTEGER NOT NULL)",
"fields": [
{
"fieldPath": "recipeId",
"columnName": "recipeId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "imageName",
"columnName": "imageName",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "servings",
"columnName": "servings",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "preparationTime",
"columnName": "preparationTime",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "ingredients",
"columnName": "ingredients",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "directions",
"columnName": "directions",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "notes",
"columnName": "notes",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "favorite",
"columnName": "favorite",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"recipeId"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "categories",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`categoryId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT)",
"fields": [
{
"fieldPath": "categoryId",
"columnName": "categoryId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"categoryId"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "recipes_with_categories",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`recipeId` INTEGER NOT NULL, `categoryId` INTEGER NOT NULL, PRIMARY KEY(`recipeId`, `categoryId`), FOREIGN KEY(`recipeId`) REFERENCES `recipes`(`recipeId`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`categoryId`) REFERENCES `categories`(`categoryId`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "recipeId",
"columnName": "recipeId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "categoryId",
"columnName": "categoryId",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"recipeId",
"categoryId"
]
},
"indices": [
{
"name": "index_recipes_with_categories_recipeId",
"unique": false,
"columnNames": [
"recipeId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_recipes_with_categories_recipeId` ON `${TABLE_NAME}` (`recipeId`)"
},
{
"name": "index_recipes_with_categories_categoryId",
"unique": false,
"columnNames": [
"categoryId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_recipes_with_categories_categoryId` ON `${TABLE_NAME}` (`categoryId`)"
}
],
"foreignKeys": [
{
"table": "recipes",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"recipeId"
],
"referencedColumns": [
"recipeId"
]
},
{
"table": "categories",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"categoryId"
],
"referencedColumns": [
"categoryId"
]
}
]
},
{
"ftsVersion": "FTS4",
"ftsOptions": {
"tokenizer": "unicode61",
"tokenizerArgs": [
"tokenchars=#"
],
"contentTable": "recipes",
"languageIdColumnName": "",
"matchInfo": "FTS4",
"notIndexedColumns": [],
"prefixSizes": [],
"preferredOrder": "ASC"
},
"contentSyncTriggers": [
"CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_recipes_fts_BEFORE_UPDATE BEFORE UPDATE ON `recipes` BEGIN DELETE FROM `recipes_fts` WHERE `docid`=OLD.`rowid`; END",
"CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_recipes_fts_BEFORE_DELETE BEFORE DELETE ON `recipes` BEGIN DELETE FROM `recipes_fts` WHERE `docid`=OLD.`rowid`; END",
"CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_recipes_fts_AFTER_UPDATE AFTER UPDATE ON `recipes` BEGIN INSERT INTO `recipes_fts`(`docid`, `title`, `description`, `source`, `ingredients`) VALUES (NEW.`rowid`, NEW.`title`, NEW.`description`, NEW.`source`, NEW.`ingredients`); END",
"CREATE TRIGGER IF NOT EXISTS room_fts_content_sync_recipes_fts_AFTER_INSERT AFTER INSERT ON `recipes` BEGIN INSERT INTO `recipes_fts`(`docid`, `title`, `description`, `source`, `ingredients`) VALUES (NEW.`rowid`, NEW.`title`, NEW.`description`, NEW.`source`, NEW.`ingredients`); END"
],
"tableName": "recipes_fts",
"createSql": "CREATE VIRTUAL TABLE IF NOT EXISTS `${TABLE_NAME}` USING FTS4(`title` TEXT, `description` TEXT, `source` TEXT, `ingredients` TEXT, tokenize=unicode61 `tokenchars=#`, content=`recipes`)",
"fields": [
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "source",
"columnName": "source",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "ingredients",
"columnName": "ingredients",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": []
},
"indices": [],
"foreignKeys": []
}
],
"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, '01b8721f1ac5a34ff8cafe8c4f516546')"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import androidx.test.espresso.accessibility.AccessibilityChecks;
import androidx.test.espresso.matcher.ViewMatchers;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.FlakyTest;

import com.flauschcode.broccoli.util.RecyclerViewAssertions;
import com.flauschcode.broccoli.util.RecyclerViewMatcher;
Expand All @@ -28,7 +27,6 @@
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
@FlakyTest
public class CRUDIntegrationTest {

private ActivityScenario<MainActivity> scenario;
Expand Down
Loading

0 comments on commit 81790ea

Please sign in to comment.