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
Description="Bright Material" | |
Default = { Colour="#757575" } | |
Canvas = { Colour="#FAFAFA" } | |
Number = { Colour="#ff9100" } | |
Escape = { Colour="#6a5acd" } | |
String = { Colour="#ff9100" } | |
StringPreProc = { Colour="#ff9100" } | |
BlockComment = { Colour="#BDBDBD", Italic=true } | |
PreProcessor = { Colour="#9C27B0" } | |
LineNum = { Colour="#BDBDBD" } |
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
@Database(entities = { | |
Entry.class, Sense.class, CrossReference.class, EntryFts.class | |
}, version = 4, exportSchema = false) public abstract class AppDatabase extends RoomDatabase |
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
public LiveData<PagedList<SearchResultEntry>> search(String term) { | |
String wildcardQuery = String.format("*%s*", term); | |
return new LivePagedListBuilder<>(entryDao.searchByJapaneseTerm(wildcardQuery), PAGE_SIZE).build(); | |
} |
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
@Transaction @Query( | |
"SELECT entries.id, entries.primary_kanji, entries.primary_reading FROM entries " | |
+ "JOIN entriesFts ON (entries.id = entriesFts.docid) WHERE entriesFts MATCH :term") | |
DataSource.Factory<Integer, SearchResultEntry> searchByJapaneseTerm(String term); |
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
@Fts4(contentEntity = Entry.class) | |
@Entity(tableName = "entriesFts") | |
public class EntryFts { | |
@ColumnInfo(name = "primary_kanji") | |
private String primaryKanji; | |
@NonNull | |
@ColumnInfo(name = "primary_reading") | |
private String primaryReading; |
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
Room.databaseBuilder(...) | |
.addMigrations(new Migration(3, 4) { | |
@Override public void migrate(@NonNull SupportSQLiteDatabase database) { | |
database.execSQL("CREATE VIRTUAL TABLE IF NOT EXISTS `entriesFts` USING FTS4(`primary_kanji`, `primary_reading`, `other_kanji`, `other_readings`, content=`entries`)"); | |
database.execSQL("INSERT INTO entriesFts(entriesFts) VALUES ('rebuild')"); | |
} | |
}) | |
.build(); |
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
@Database(entities = { | |
Entry.class, Sense.class, CrossReference.class, EntryFts.class | |
}, version = 4, exportSchema = false) public abstract class AppDatabase extends RoomDatabase |