├── .gitignore
├── DEVELOPER.md
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle.kts
├── proguard-rules.pro
├── schemas
│ └── com.hefengbao.jingmo.data.database.AppDatabase
│ │ ├── 1.json
│ │ ├── 10.json
│ │ ├── 11.json
│ │ ├── 12.json
│ │ ├── 13.json
│ │ ├── 14.json
│ │ ├── 15.json
│ │ ├── 16.json
│ │ ├── 17.json
│ │ ├── 18.json
│ │ ├── 19.json
│ │ ├── 2.json
│ │ ├── 20.json
│ │ ├── 21.json
│ │ ├── 22.json
│ │ ├── 23.json
│ │ ├── 24.json
│ │ ├── 25.json
│ │ ├── 26.json
│ │ ├── 27.json
│ │ ├── 3.json
│ │ ├── 4.json
│ │ ├── 5.json
│ │ ├── 6.json
│ │ ├── 7.json
│ │ ├── 8.json
│ │ └── 9.json
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── hefengbao
│ │ └── jingmo
│ │ └── ExampleInstrumentedTest.kt
│ ├── debug
│ └── res
│ │ └── values
│ │ └── strings.xml
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── hanzi
│ │ │ ├── bg.png
│ │ │ ├── hanzi-writer.min.js
│ │ │ ├── index.html
│ │ │ └── jquery-3.7.1.min.js
│ ├── ic_launcher-playstore.png
│ ├── java
│ │ └── com
│ │ │ └── hefengbao
│ │ │ └── jingmo
│ │ │ ├── App.kt
│ │ │ ├── MainActivity.kt
│ │ │ ├── MainActivityViewModel.kt
│ │ │ ├── base
│ │ │ └── BaseViewModel.kt
│ │ │ ├── common
│ │ │ ├── Constant.kt
│ │ │ ├── ElevationTokens.kt
│ │ │ ├── ext
│ │ │ │ ├── ColorScheme.kt
│ │ │ │ ├── ContextExt.kt
│ │ │ │ └── StringExt.kt
│ │ │ ├── network
│ │ │ │ ├── AppDispatchers.kt
│ │ │ │ ├── Result.kt
│ │ │ │ ├── SafeApiCall.kt
│ │ │ │ └── di
│ │ │ │ │ ├── CoroutineScopesModule.kt
│ │ │ │ │ └── DispatchersModule.kt
│ │ │ ├── storage
│ │ │ │ └── AndroidImageDownloader.kt
│ │ │ └── util
│ │ │ │ ├── ClipboardUtil.kt
│ │ │ │ ├── FileUtil.kt
│ │ │ │ └── SystemUtil.kt
│ │ │ ├── data
│ │ │ ├── database
│ │ │ │ ├── AppDatabase.kt
│ │ │ │ ├── dao
│ │ │ │ │ ├── ChinaWorldCulturalHeritageDao.kt
│ │ │ │ │ ├── ChineseAntitheticalCoupletDao.kt
│ │ │ │ │ ├── ChineseDictionaryDao.kt
│ │ │ │ │ ├── ChineseExpressionDao.kt
│ │ │ │ │ ├── ChineseIdiomDao.kt
│ │ │ │ │ ├── ChineseKnowledgeDao.kt
│ │ │ │ │ ├── ChineseLyricDao.kt
│ │ │ │ │ ├── ChineseModernPoetryDao.kt
│ │ │ │ │ ├── ChineseProverbDao.kt
│ │ │ │ │ ├── ChineseQuoteDao.kt
│ │ │ │ │ ├── ChineseRiddleDao.kt
│ │ │ │ │ ├── ChineseTongueTwisterDao.kt
│ │ │ │ │ ├── ChineseWisecrackDao.kt
│ │ │ │ │ ├── ClassicalLiteratureClassicPoemDao.kt
│ │ │ │ │ ├── ClassicalLiteraturePeopleDao.kt
│ │ │ │ │ ├── ClassicalLiteratureSentenceDao.kt
│ │ │ │ │ └── ClassicalLiteratureWritingDao.kt
│ │ │ │ ├── entity
│ │ │ │ │ ├── china
│ │ │ │ │ │ └── WorldCulturalHeritageEntity.kt
│ │ │ │ │ ├── chinese
│ │ │ │ │ │ ├── AntitheticalCoupletCollectionEntity.kt
│ │ │ │ │ │ ├── AntitheticalCoupletEntity.kt
│ │ │ │ │ │ ├── DictionaryCollectionEntity.kt
│ │ │ │ │ │ ├── DictionaryEntity.kt
│ │ │ │ │ │ ├── DictionaryPinyinEntity.kt
│ │ │ │ │ │ ├── ExpressionCollectionEntity.kt
│ │ │ │ │ │ ├── ExpressionEntity.kt
│ │ │ │ │ │ ├── IdiomCollectionEntity.kt
│ │ │ │ │ │ ├── IdiomEntity.kt
│ │ │ │ │ │ ├── KnowledgeCollectionEntity.kt
│ │ │ │ │ │ ├── KnowledgeEntity.kt
│ │ │ │ │ │ ├── KnowledgeFtsEntity.kt
│ │ │ │ │ │ ├── LyricCollectionEntity.kt
│ │ │ │ │ │ ├── LyricEntity.kt
│ │ │ │ │ │ ├── LyricFtsEntity.kt
│ │ │ │ │ │ ├── ModernPoetryCollectionEntity.kt
│ │ │ │ │ │ ├── ModernPoetryEntity.kt
│ │ │ │ │ │ ├── ModernPoetryFtsEntity.kt
│ │ │ │ │ │ ├── ProverbCollectionEntity.kt
│ │ │ │ │ │ ├── ProverbEntity.kt
│ │ │ │ │ │ ├── ProverbFtsEntity.kt
│ │ │ │ │ │ ├── QuoteCollectionEntity.kt
│ │ │ │ │ │ ├── QuoteEntity.kt
│ │ │ │ │ │ ├── QuoteFtsEntity.kt
│ │ │ │ │ │ ├── RiddleEntity.kt
│ │ │ │ │ │ ├── TongueTwisterEntity.kt
│ │ │ │ │ │ ├── WisecrackCollectionEntity.kt
│ │ │ │ │ │ └── WisecrackEntity.kt
│ │ │ │ │ └── classicalliterature
│ │ │ │ │ │ ├── ClassicPoemCollectionEntity.kt
│ │ │ │ │ │ ├── ClassicPoemEntity.kt
│ │ │ │ │ │ ├── ClassicPoemFtsEntity.kt
│ │ │ │ │ │ ├── PeopleEntity.kt
│ │ │ │ │ │ ├── SentenceCollectionEntity.kt
│ │ │ │ │ │ ├── SentenceEntity.kt
│ │ │ │ │ │ ├── WritingCollectionEntity.kt
│ │ │ │ │ │ ├── WritingEntity.kt
│ │ │ │ │ │ └── WritingFtsEntity.kt
│ │ │ │ └── util
│ │ │ │ │ ├── IntListConverter.kt
│ │ │ │ │ ├── PeopleAliasListConverter.kt
│ │ │ │ │ ├── PeopleDetailListConverter.kt
│ │ │ │ │ ├── PeopleHometownListConverter.kt
│ │ │ │ │ ├── StringListConverter.kt
│ │ │ │ │ ├── WritingAllusionListConverter.kt
│ │ │ │ │ ├── WritingClauseListConverter.kt
│ │ │ │ │ ├── WritingCommentListConverter.kt
│ │ │ │ │ └── WritingQuoteListConverter.kt
│ │ │ ├── datastore
│ │ │ │ ├── AppPreference.kt
│ │ │ │ ├── DatasetPreference.kt
│ │ │ │ ├── HomePreference.kt
│ │ │ │ └── ReadStatusPreference.kt
│ │ │ ├── enums
│ │ │ │ └── writing
│ │ │ │ │ └── CommentType.kt
│ │ │ ├── model
│ │ │ │ ├── AppStatus.kt
│ │ │ │ ├── Dataset.kt
│ │ │ │ ├── DatasetVersion.kt
│ │ │ │ ├── HomeItem.kt
│ │ │ │ ├── IdTitle.kt
│ │ │ │ ├── Link.kt
│ │ │ │ ├── ReadStatus.kt
│ │ │ │ ├── UserData.kt
│ │ │ │ ├── Version.kt
│ │ │ │ ├── china
│ │ │ │ │ └── WorldCulturalHeritage.kt
│ │ │ │ ├── chinese
│ │ │ │ │ ├── AntitheticalCouplet.kt
│ │ │ │ │ ├── Dictionary.kt
│ │ │ │ │ ├── Expression.kt
│ │ │ │ │ ├── ExpressionWrapper.kt
│ │ │ │ │ ├── Idiom.kt
│ │ │ │ │ ├── IdiomWrapper.kt
│ │ │ │ │ ├── Knowledge.kt
│ │ │ │ │ ├── Lyric.kt
│ │ │ │ │ ├── ModernPoetry.kt
│ │ │ │ │ ├── Proverb.kt
│ │ │ │ │ ├── Quote.kt
│ │ │ │ │ ├── Riddle.kt
│ │ │ │ │ ├── TongueTwister.kt
│ │ │ │ │ ├── Wisecrack.kt
│ │ │ │ │ └── character
│ │ │ │ │ │ ├── Pinyin.kt
│ │ │ │ │ │ ├── Radical.kt
│ │ │ │ │ │ └── Stroke.kt
│ │ │ │ ├── classicalliterature
│ │ │ │ │ ├── ClassicPoem.kt
│ │ │ │ │ ├── People.kt
│ │ │ │ │ ├── PeopleWrapper.kt
│ │ │ │ │ ├── Sentence.kt
│ │ │ │ │ ├── Writing.kt
│ │ │ │ │ ├── WritingWrapper.kt
│ │ │ │ │ ├── people
│ │ │ │ │ │ ├── Alias.kt
│ │ │ │ │ │ ├── Detail.kt
│ │ │ │ │ │ └── Hometown.kt
│ │ │ │ │ └── writing
│ │ │ │ │ │ ├── Allusion.kt
│ │ │ │ │ │ ├── CharDict.kt
│ │ │ │ │ │ ├── Clause.kt
│ │ │ │ │ │ ├── Comment.kt
│ │ │ │ │ │ ├── Quote.kt
│ │ │ │ │ │ ├── Tune.kt
│ │ │ │ │ │ └── WordDict.kt
│ │ │ │ ├── theme
│ │ │ │ │ ├── DarkThemeConfig.kt
│ │ │ │ │ └── ThemeBrand.kt
│ │ │ │ └── traditionalculture
│ │ │ │ │ ├── Color.kt
│ │ │ │ │ ├── Festival.kt
│ │ │ │ │ └── SolarTerm.kt
│ │ │ ├── network
│ │ │ │ ├── CustomDispatchers.kt
│ │ │ │ ├── JvmUnitTestFakeAssetManager.kt
│ │ │ │ ├── Network.kt
│ │ │ │ ├── NetworkDataSource.kt
│ │ │ │ ├── fake
│ │ │ │ │ ├── FakeAssetManager.kt
│ │ │ │ │ └── FakeNetworkDataSource.kt
│ │ │ │ └── retrofit
│ │ │ │ │ ├── Api.kt
│ │ │ │ │ └── NetworkImpl.kt
│ │ │ └── repository
│ │ │ │ ├── LinksRepository.kt
│ │ │ │ ├── LinksRepositoryImpl.kt
│ │ │ │ ├── china
│ │ │ │ ├── WorldCultureHeritageRepository.kt
│ │ │ │ └── WorldCultureHeritageRepositoryImpl.kt
│ │ │ │ ├── chinese
│ │ │ │ ├── AntitheticalCoupletRepository.kt
│ │ │ │ ├── AntitheticalCoupletRepositoryImpl.kt
│ │ │ │ ├── CharacterRepository.kt
│ │ │ │ ├── CharacterRepositoryImpl.kt
│ │ │ │ ├── ExpressionRepository.kt
│ │ │ │ ├── ExpressionRepositoryImpl.kt
│ │ │ │ ├── IdiomRepository.kt
│ │ │ │ ├── IdiomRepositoryImpl.kt
│ │ │ │ ├── KnowledgeRepository.kt
│ │ │ │ ├── KnowledgeRepositoryImpl.kt
│ │ │ │ ├── LyricRepository.kt
│ │ │ │ ├── LyricRepositoryImpl.kt
│ │ │ │ ├── ModernPoetryRepository.kt
│ │ │ │ ├── ModernPoetryRepositoryImpl.kt
│ │ │ │ ├── ProverbRepository.kt
│ │ │ │ ├── ProverbRepositoryImpl.kt
│ │ │ │ ├── QuoteRepository.kt
│ │ │ │ ├── QuoteRepositoryImpl.kt
│ │ │ │ ├── RiddleRepository.kt
│ │ │ │ ├── RiddleRepositoryImpl.kt
│ │ │ │ ├── TongueTwisterRepository.kt
│ │ │ │ ├── TongueTwisterRepositoryImpl.kt
│ │ │ │ ├── WisecrackRepository.kt
│ │ │ │ └── WisecrackRepositoryImpl.kt
│ │ │ │ ├── classicalliterature
│ │ │ │ ├── ClassicPoemRepository.kt
│ │ │ │ ├── ClassicPoemRepositoryImpl.kt
│ │ │ │ ├── PeopleRepository.kt
│ │ │ │ ├── PeopleRepositoryImpl.kt
│ │ │ │ ├── SentenceRepository.kt
│ │ │ │ ├── SentenceRepositoryImpl.kt
│ │ │ │ ├── WritingRepository.kt
│ │ │ │ └── WritingRepositoryImpl.kt
│ │ │ │ ├── settings
│ │ │ │ ├── HomeItemRepository.kt
│ │ │ │ ├── HomeItemRepositoryImpl.kt
│ │ │ │ ├── ImportRepository.kt
│ │ │ │ ├── ImportRepositoryImpl.kt
│ │ │ │ ├── NetworkDatasourceRepository.kt
│ │ │ │ ├── NetworkDatasourceRepositoryImpl.kt
│ │ │ │ ├── PreferenceRepository.kt
│ │ │ │ ├── PreferenceRepositoryImpl.kt
│ │ │ │ ├── ThemeRepository.kt
│ │ │ │ └── ThemeRepositoryImpl.kt
│ │ │ │ └── traditionalculture
│ │ │ │ ├── ColorRepository.kt
│ │ │ │ ├── ColorRepositoryImpl.kt
│ │ │ │ ├── FestivalRepository.kt
│ │ │ │ ├── FestivalRepositoryImpl.kt
│ │ │ │ ├── SolarTermsRepository.kt
│ │ │ │ └── SolarTermsRepositoryImpl.kt
│ │ │ ├── di
│ │ │ ├── AppModule.kt
│ │ │ ├── CoroutineDispatcherModule.kt
│ │ │ ├── CoroutineQualifier.kt
│ │ │ ├── CoroutineScopesModule.kt
│ │ │ ├── DataModule.kt
│ │ │ ├── DatabaseModule.kt
│ │ │ ├── DispatchersModule.kt
│ │ │ ├── NetworkDatasourceModule.kt
│ │ │ └── NetworkModule.kt
│ │ │ ├── route
│ │ │ └── AppNavHost.kt
│ │ │ ├── ui
│ │ │ ├── component
│ │ │ │ ├── BackgroundTitle.kt
│ │ │ │ ├── CaptureScaffold.kt
│ │ │ │ ├── SimpleScaffold.kt
│ │ │ │ ├── SimpleSearchScaffold.kt
│ │ │ │ └── webview
│ │ │ │ │ ├── JavaScriptInterface.kt
│ │ │ │ │ ├── RYWebView.kt
│ │ │ │ │ ├── WebViewClient.kt
│ │ │ │ │ ├── WebViewHtml.kt
│ │ │ │ │ ├── WebViewLayout.kt
│ │ │ │ │ ├── WebViewScript.kt
│ │ │ │ │ └── WebViewStyle.kt
│ │ │ ├── screen
│ │ │ │ ├── ReaderImageScreen.kt
│ │ │ │ ├── china
│ │ │ │ │ └── worldcultureheritage
│ │ │ │ │ │ ├── WorldCultureHeritageIndexScreen.kt
│ │ │ │ │ │ ├── WorldCultureHeritageIndexViewModel.kt
│ │ │ │ │ │ ├── WorldCultureHeritageShowScreen.kt
│ │ │ │ │ │ ├── WorldCultureHeritageShowViewModel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ ├── WorldCultureHeritageIndexNav.kt
│ │ │ │ │ │ └── WorldCultureHeritageShowNav.kt
│ │ │ │ ├── chinese
│ │ │ │ │ ├── antitheticalcouplet
│ │ │ │ │ │ ├── AntitheticalCoupletBookmarksScreen.kt
│ │ │ │ │ │ ├── AntitheticalCoupletBookmarksViewModel.kt
│ │ │ │ │ │ ├── AntitheticalCoupletCaptureScreen.kt
│ │ │ │ │ │ ├── AntitheticalCoupletCaptureViewModel.kt
│ │ │ │ │ │ ├── AntitheticalCoupletIndexScreen.kt
│ │ │ │ │ │ ├── AntitheticalCoupletIndexViewModel.kt
│ │ │ │ │ │ ├── AntitheticalCoupletReadScreen.kt
│ │ │ │ │ │ ├── AntitheticalCoupletReadViewModel.kt
│ │ │ │ │ │ ├── AntitheticalCoupletSearchScreen.kt
│ │ │ │ │ │ ├── AntitheticalCoupletSearchViewModel.kt
│ │ │ │ │ │ ├── AntitheticalCoupletShowScreen.kt
│ │ │ │ │ │ ├── AntitheticalCoupletShowViewModel.kt
│ │ │ │ │ │ ├── components
│ │ │ │ │ │ │ └── AntitheticalCoupletPanel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── AntitheticalCoupletBookmarksNav.kt
│ │ │ │ │ │ │ ├── AntitheticalCoupletCaptureNav.kt
│ │ │ │ │ │ │ ├── AntitheticalCoupletIndexNav.kt
│ │ │ │ │ │ │ ├── AntitheticalCoupletReadNav.kt
│ │ │ │ │ │ │ ├── AntitheticalCoupletSearchNav.kt
│ │ │ │ │ │ │ └── AntitheticalCoupletShowNav.kt
│ │ │ │ │ ├── character
│ │ │ │ │ │ ├── CharacterBookmarksScreen.kt
│ │ │ │ │ │ ├── CharacterBookmarksViewModel.kt
│ │ │ │ │ │ ├── CharacterIndexScreen.kt
│ │ │ │ │ │ ├── CharacterPinyinIndexScreen.kt
│ │ │ │ │ │ ├── CharacterPinyinIndexViewModel.kt
│ │ │ │ │ │ ├── CharacterRadicalIndexViewModel.kt
│ │ │ │ │ │ ├── CharacterRadicalndexScreen.kt
│ │ │ │ │ │ ├── CharacterSearchListScreen.kt
│ │ │ │ │ │ ├── CharacterSearchListViewModel.kt
│ │ │ │ │ │ ├── CharacterShowScreen.kt
│ │ │ │ │ │ ├── CharacterShowViewModel.kt
│ │ │ │ │ │ ├── CharacterStrokeIndexViewModel.kt
│ │ │ │ │ │ ├── CharacterStrokeScreen.kt
│ │ │ │ │ │ ├── CharacterStrokelndexScreen.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── CharacterBookmarksNav.kt
│ │ │ │ │ │ │ ├── CharacterIndexNav.kt
│ │ │ │ │ │ │ ├── CharacterPinyinIndexNav.kt
│ │ │ │ │ │ │ ├── CharacterRadicalIndexNav.kt
│ │ │ │ │ │ │ ├── CharacterSearchListNav.kt
│ │ │ │ │ │ │ ├── CharacterShowNav.kt
│ │ │ │ │ │ │ ├── CharacterStrokeIndexNav.kt
│ │ │ │ │ │ │ └── CharacterStrokeNav.kt
│ │ │ │ │ ├── expression
│ │ │ │ │ │ ├── ExpressionBookmarksScreen.kt
│ │ │ │ │ │ ├── ExpressionBookmarksViewModel.kt
│ │ │ │ │ │ ├── ExpressionIndexScreen.kt
│ │ │ │ │ │ ├── ExpressionIndexViewModel.kt
│ │ │ │ │ │ ├── ExpressionSearchScreen.kt
│ │ │ │ │ │ ├── ExpressionSearchViewModel.kt
│ │ │ │ │ │ ├── ExpressionShowScreen.kt
│ │ │ │ │ │ ├── ExpressionShowViewModel.kt
│ │ │ │ │ │ ├── components
│ │ │ │ │ │ │ └── ExpressionPanel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── ExpressionBookmarksNav.kt
│ │ │ │ │ │ │ ├── ExpressionIndexNav.kt
│ │ │ │ │ │ │ ├── ExpressionSearchNav.kt
│ │ │ │ │ │ │ └── ExpressionShowNav.kt
│ │ │ │ │ ├── idiom
│ │ │ │ │ │ ├── IdiomBookmarksScreen.kt
│ │ │ │ │ │ ├── IdiomBookmarksViewModel.kt
│ │ │ │ │ │ ├── IdiomCaptureScreen.kt
│ │ │ │ │ │ ├── IdiomCaptureViewModel.kt
│ │ │ │ │ │ ├── IdiomIndexScreen.kt
│ │ │ │ │ │ ├── IdiomIndexViewModel.kt
│ │ │ │ │ │ ├── IdiomReadScreen.kt
│ │ │ │ │ │ ├── IdiomReadViewModel.kt
│ │ │ │ │ │ ├── IdiomSearchScreen.kt
│ │ │ │ │ │ ├── IdiomSearchViewModel.kt
│ │ │ │ │ │ ├── IdiomShowScreen.kt
│ │ │ │ │ │ ├── IdiomShowViewModel.kt
│ │ │ │ │ │ ├── components
│ │ │ │ │ │ │ └── IdiomPanel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── IdiomBookmarksNav.kt
│ │ │ │ │ │ │ ├── IdiomCaptureNav.kt
│ │ │ │ │ │ │ ├── IdiomIndexNav.kt
│ │ │ │ │ │ │ ├── IdiomReadNav.kt
│ │ │ │ │ │ │ ├── IdiomSearchNav.kt
│ │ │ │ │ │ │ └── IdiomShowNav.kt
│ │ │ │ │ ├── knowledge
│ │ │ │ │ │ ├── KnowledgeBookmarksScreen.kt
│ │ │ │ │ │ ├── KnowledgeBookmarksViewModel.kt
│ │ │ │ │ │ ├── KnowledgeIndexScreen.kt
│ │ │ │ │ │ ├── KnowledgeIndexViewModel.kt
│ │ │ │ │ │ ├── KnowledgeReadScreen.kt
│ │ │ │ │ │ ├── KnowledgeReadViewModel.kt
│ │ │ │ │ │ ├── KnowledgeSearchScreen.kt
│ │ │ │ │ │ ├── KnowledgeSearchViewModel.kt
│ │ │ │ │ │ ├── KnowledgeShowScreen.kt
│ │ │ │ │ │ ├── KnowledgeShowViewModel.kt
│ │ │ │ │ │ ├── components
│ │ │ │ │ │ │ └── KnowledgePanel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── KnowledgeBookmarksNav.kt
│ │ │ │ │ │ │ ├── KnowledgeIndexNav.kt
│ │ │ │ │ │ │ ├── KnowledgeReadNav.kt
│ │ │ │ │ │ │ ├── KnowledgeSearchNav.kt
│ │ │ │ │ │ │ └── KnowledgeShowNav.kt
│ │ │ │ │ ├── lyric
│ │ │ │ │ │ ├── LyricBookmarksScreen.kt
│ │ │ │ │ │ ├── LyricBookmarksViewModel.kt
│ │ │ │ │ │ ├── LyricIndexScreen.kt
│ │ │ │ │ │ ├── LyricIndexViewModel.kt
│ │ │ │ │ │ ├── LyricReadScreen.kt
│ │ │ │ │ │ ├── LyricReadViewModel.kt
│ │ │ │ │ │ ├── LyricSearchScreen.kt
│ │ │ │ │ │ ├── LyricSearchViewModel.kt
│ │ │ │ │ │ ├── LyricShowScreen.kt
│ │ │ │ │ │ ├── LyricShowViewModel.kt
│ │ │ │ │ │ ├── components
│ │ │ │ │ │ │ └── LyricPanel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── LyricBookmarksNav.kt
│ │ │ │ │ │ │ ├── LyricIndexNav.kt
│ │ │ │ │ │ │ ├── LyricReadNav.kt
│ │ │ │ │ │ │ ├── LyricSearchNav.kt
│ │ │ │ │ │ │ └── LyricShowNav.kt
│ │ │ │ │ ├── poetry
│ │ │ │ │ │ ├── ModernPoetryBookmarksScreen.kt
│ │ │ │ │ │ ├── ModernPoetryBookmarksViewModel.kt
│ │ │ │ │ │ ├── ModernPoetryIndexScreen.kt
│ │ │ │ │ │ ├── ModernPoetryIndexViewModel.kt
│ │ │ │ │ │ ├── ModernPoetryReadScreen.kt
│ │ │ │ │ │ ├── ModernPoetryReadViewModel.kt
│ │ │ │ │ │ ├── ModernPoetrySearchScreen.kt
│ │ │ │ │ │ ├── ModernPoetrySearchViewModel.kt
│ │ │ │ │ │ ├── ModernPoetryShowScreen.kt
│ │ │ │ │ │ ├── ModernPoetryShowViewModel.kt
│ │ │ │ │ │ ├── components
│ │ │ │ │ │ │ └── ModernPoetryPanel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── ModernPoetryBookmarksNav.kt
│ │ │ │ │ │ │ ├── ModernPoetryIndexNav.kt
│ │ │ │ │ │ │ ├── ModernPoetryReadNav.kt
│ │ │ │ │ │ │ ├── ModernPoetrySearchNav.kt
│ │ │ │ │ │ │ └── ModernPoetryShowNav.kt
│ │ │ │ │ ├── proverb
│ │ │ │ │ │ ├── ProverbBookmarksScreen.kt
│ │ │ │ │ │ ├── ProverbBookmarksViewModel.kt
│ │ │ │ │ │ ├── ProverbIndexScreen.kt
│ │ │ │ │ │ ├── ProverbIndexViewModel.kt
│ │ │ │ │ │ ├── ProverbReadScreen.kt
│ │ │ │ │ │ ├── ProverbReadViewModel.kt
│ │ │ │ │ │ ├── ProverbSearchScreen.kt
│ │ │ │ │ │ ├── ProverbSearchViewModel.kt
│ │ │ │ │ │ ├── ProverbShowScreen.kt
│ │ │ │ │ │ ├── ProverbShowViewModel.kt
│ │ │ │ │ │ ├── components
│ │ │ │ │ │ │ └── ProverbPanel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── ProverbBookmarksNav.kt
│ │ │ │ │ │ │ ├── ProverbIndexNav.kt
│ │ │ │ │ │ │ ├── ProverbReadNav.kt
│ │ │ │ │ │ │ ├── ProverbSearchNav.kt
│ │ │ │ │ │ │ └── ProverbShowNav.kt
│ │ │ │ │ ├── quote
│ │ │ │ │ │ ├── QuoteBookmarksScreen.kt
│ │ │ │ │ │ ├── QuoteBookmarksViewModel.kt
│ │ │ │ │ │ ├── QuoteIndexScreen.kt
│ │ │ │ │ │ ├── QuoteIndexViewModel.kt
│ │ │ │ │ │ ├── QuoteReadScreen.kt
│ │ │ │ │ │ ├── QuoteReadViewModel.kt
│ │ │ │ │ │ ├── QuoteSearchScreen.kt
│ │ │ │ │ │ ├── QuoteSearchViewModel.kt
│ │ │ │ │ │ ├── QuoteShowScreen.kt
│ │ │ │ │ │ ├── QuoteShowViewModel.kt
│ │ │ │ │ │ ├── components
│ │ │ │ │ │ │ └── QuotePanel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── QuoteBookmarksNav.kt
│ │ │ │ │ │ │ ├── QuoteIndexNav.kt
│ │ │ │ │ │ │ ├── QuoteReadNav.kt
│ │ │ │ │ │ │ ├── QuoteSearchNav.kt
│ │ │ │ │ │ │ └── QuoteShowNav.kt
│ │ │ │ │ ├── riddle
│ │ │ │ │ │ ├── RiddleIndexScreen.kt
│ │ │ │ │ │ ├── RiddleIndexViewModel.kt
│ │ │ │ │ │ ├── RiddleInfoScreen.kt
│ │ │ │ │ │ ├── RiddleReadScreen.kt
│ │ │ │ │ │ ├── RiddleReadViewModel.kt
│ │ │ │ │ │ ├── RiddleSearchScreen.kt
│ │ │ │ │ │ ├── RiddleSearchViewModel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── RiddleIndexNav.kt
│ │ │ │ │ │ │ ├── RiddleInfoNav.kt
│ │ │ │ │ │ │ ├── RiddleReadNav.kt
│ │ │ │ │ │ │ └── RiddleSearchNav.kt
│ │ │ │ │ ├── tonguetwister
│ │ │ │ │ │ ├── TongueTwisterIndexScreen.kt
│ │ │ │ │ │ ├── TongueTwisterIndexViewModel.kt
│ │ │ │ │ │ ├── TongueTwisterShowScreen.kt
│ │ │ │ │ │ ├── TongueTwisterShowViewModel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── TongueTwisterIndexNav.kt
│ │ │ │ │ │ │ └── TongueTwisterShowNav.kt
│ │ │ │ │ └── wisecrack
│ │ │ │ │ │ ├── WisecrackBookmarksScreen.kt
│ │ │ │ │ │ ├── WisecrackBookmarksViewModel.kt
│ │ │ │ │ │ ├── WisecrackCaptureScreen.kt
│ │ │ │ │ │ ├── WisecrackCaptureViewModel.kt
│ │ │ │ │ │ ├── WisecrackIndexScreen.kt
│ │ │ │ │ │ ├── WisecrackIndexViewModel.kt
│ │ │ │ │ │ ├── WisecrackReadScreen.kt
│ │ │ │ │ │ ├── WisecrackReadViewModel.kt
│ │ │ │ │ │ ├── WisecrackSearchScreen.kt
│ │ │ │ │ │ ├── WisecrackSearchViewModel.kt
│ │ │ │ │ │ ├── WisecrackShowScreen.kt
│ │ │ │ │ │ ├── WisecrackShowViewModel.kt
│ │ │ │ │ │ ├── components
│ │ │ │ │ │ └── WisecrackShowPanel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ ├── WisecrackBookmarksNav.kt
│ │ │ │ │ │ ├── WisecrackCaptureNav.kt
│ │ │ │ │ │ ├── WisecrackIndexNav.kt
│ │ │ │ │ │ ├── WisecrackReadNav.kt
│ │ │ │ │ │ ├── WisecrackSearchNav.kt
│ │ │ │ │ │ └── WisecrackShowNav.kt
│ │ │ │ ├── classicalliterature
│ │ │ │ │ ├── classicpoem
│ │ │ │ │ │ ├── ClassicPoemBookmarksScreen.kt
│ │ │ │ │ │ ├── ClassicPoemBookmarksViewModel.kt
│ │ │ │ │ │ ├── ClassicPoemIndexScreen.kt
│ │ │ │ │ │ ├── ClassicPoemIndexViewModel.kt
│ │ │ │ │ │ ├── ClassicPoemReadScreen.kt
│ │ │ │ │ │ ├── ClassicPoemReadViewModel.kt
│ │ │ │ │ │ ├── ClassicPoemSearchScreen.kt
│ │ │ │ │ │ ├── ClassicPoemSearchScreenViewModel.kt
│ │ │ │ │ │ ├── ClassicPoemShowScreen.kt
│ │ │ │ │ │ ├── ClassicPoemShowViewModel.kt
│ │ │ │ │ │ ├── components
│ │ │ │ │ │ │ └── ClassicPoemPanel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── ClassicPoemBookmarksNav.kt
│ │ │ │ │ │ │ ├── ClassicPoemIndexNav.kt
│ │ │ │ │ │ │ ├── ClassicPoemReadNav.kt
│ │ │ │ │ │ │ ├── ClassicPoemSearchNav.kt
│ │ │ │ │ │ │ └── ClassicPoemShowNav.kt
│ │ │ │ │ ├── people
│ │ │ │ │ │ ├── PeopleIndexViewModel.kt
│ │ │ │ │ │ ├── PeopleSearchScreen.kt
│ │ │ │ │ │ ├── PeopleSearchViewModel.kt
│ │ │ │ │ │ ├── PeopleShowViewModel.kt
│ │ │ │ │ │ ├── PoepleIndexScreen.kt
│ │ │ │ │ │ ├── PoepleShowScreen.kt
│ │ │ │ │ │ ├── components
│ │ │ │ │ │ │ └── PeoplePanel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── PeopleIndexNav.kt
│ │ │ │ │ │ │ ├── PeopleSearchNav.kt
│ │ │ │ │ │ │ └── PoepleShowNav.kt
│ │ │ │ │ ├── sentence
│ │ │ │ │ │ ├── SentenceBookmarksScreen.kt
│ │ │ │ │ │ ├── SentenceBookmarksViewModel.kt
│ │ │ │ │ │ ├── SentenceCaptureScreen.kt
│ │ │ │ │ │ ├── SentenceCaptureViewModel.kt
│ │ │ │ │ │ ├── SentenceIndexScreen.kt
│ │ │ │ │ │ ├── SentenceIndexViewModel.kt
│ │ │ │ │ │ ├── SentenceReadScreen.kt
│ │ │ │ │ │ ├── SentenceReadViewModel.kt
│ │ │ │ │ │ ├── SentenceSearchScreen.kt
│ │ │ │ │ │ ├── SentenceSearchViewModel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ │ ├── SentenceBookmarksNav.kt
│ │ │ │ │ │ │ ├── SentenceCaptureNav.kt
│ │ │ │ │ │ │ ├── SentenceIndexNav.kt
│ │ │ │ │ │ │ ├── SentenceReadNav.kt
│ │ │ │ │ │ │ └── SentenceSearchNav.kt
│ │ │ │ │ └── writing
│ │ │ │ │ │ ├── WritingBookmarksScreen.kt
│ │ │ │ │ │ ├── WritingBookmarksViewModel.kt
│ │ │ │ │ │ ├── WritingCaptureScreen.kt
│ │ │ │ │ │ ├── WritingCaptureViewModel.kt
│ │ │ │ │ │ ├── WritingIndexScreen.kt
│ │ │ │ │ │ ├── WritingIndexViewModel.kt
│ │ │ │ │ │ ├── WritingReadScreen.kt
│ │ │ │ │ │ ├── WritingReadViewModel.kt
│ │ │ │ │ │ ├── WritingSearchScreen.kt
│ │ │ │ │ │ ├── WritingSearchViewModel.kt
│ │ │ │ │ │ ├── WritingShowScreen.kt
│ │ │ │ │ │ ├── WritingShowViewModel.kt
│ │ │ │ │ │ ├── components
│ │ │ │ │ │ └── WritingPanel.kt
│ │ │ │ │ │ └── nav
│ │ │ │ │ │ ├── WritingBookmarksNav.kt
│ │ │ │ │ │ ├── WritingCaptureNav.kt
│ │ │ │ │ │ ├── WritingIndexNav.kt
│ │ │ │ │ │ ├── WritingReadNav.kt
│ │ │ │ │ │ ├── WritingSearchNav.kt
│ │ │ │ │ │ └── WritingShowNav.kt
│ │ │ │ ├── home
│ │ │ │ │ ├── HomeScreen.kt
│ │ │ │ │ ├── HomeViewModel.kt
│ │ │ │ │ └── nav
│ │ │ │ │ │ └── HomeNav.kt
│ │ │ │ ├── link
│ │ │ │ │ ├── LinkIndexScreen.kt
│ │ │ │ │ ├── LinkIndexViewModel.kt
│ │ │ │ │ └── nav
│ │ │ │ │ │ └── LinkIndexNav.kt
│ │ │ │ ├── settings
│ │ │ │ │ ├── AboutScreen.kt
│ │ │ │ │ ├── HomeItemManagerScreen.kt
│ │ │ │ │ ├── HomeItemManagerViewModel.kt
│ │ │ │ │ ├── ImportDataScreen.kt
│ │ │ │ │ ├── ImportDataViewModel.kt
│ │ │ │ │ ├── PrivacyScreen.kt
│ │ │ │ │ ├── SettingsScreen.kt
│ │ │ │ │ ├── SyncDataScreen.kt
│ │ │ │ │ ├── SyncDataViewModel.kt
│ │ │ │ │ ├── ThemeDialog.kt
│ │ │ │ │ ├── ThemeDialogViewModel.kt
│ │ │ │ │ ├── components
│ │ │ │ │ │ └── SettingsTitle.kt
│ │ │ │ │ └── nav
│ │ │ │ │ │ ├── AboutNav.kt
│ │ │ │ │ │ ├── DataNav.kt
│ │ │ │ │ │ ├── HomeItemManagerNav.kt
│ │ │ │ │ │ ├── ImportNav.kt
│ │ │ │ │ │ ├── PrivacyNav.kt
│ │ │ │ │ │ └── SettingsNav.kt
│ │ │ │ └── traditionalculture
│ │ │ │ │ ├── calendar
│ │ │ │ │ ├── CalendarIndexScreen.kt
│ │ │ │ │ └── nav
│ │ │ │ │ │ └── CalendarIndexNav.kt
│ │ │ │ │ ├── color
│ │ │ │ │ ├── ColorIndexScreen.kt
│ │ │ │ │ ├── ColorIndexViewModel.kt
│ │ │ │ │ ├── ColorShowScreen.kt
│ │ │ │ │ ├── ColorShowViewModel.kt
│ │ │ │ │ └── nav
│ │ │ │ │ │ ├── ColorIndexNav.kt
│ │ │ │ │ │ └── ColorShowNav.kt
│ │ │ │ │ ├── festival
│ │ │ │ │ ├── FestivalIndexScreen.kt
│ │ │ │ │ ├── FestivalIndexViewModel.kt
│ │ │ │ │ ├── FestivalScreen.kt
│ │ │ │ │ ├── FestivalViewModel.kt
│ │ │ │ │ └── nav
│ │ │ │ │ │ ├── FestivalIndexNav.kt
│ │ │ │ │ │ └── FestivalShowNav.kt
│ │ │ │ │ └── solarterm
│ │ │ │ │ ├── SolarTermIndex.kt
│ │ │ │ │ ├── SolarTermIndexViewModel.kt
│ │ │ │ │ ├── SolarTermShowScreen.kt
│ │ │ │ │ ├── SolarTermShowViewModel.kt
│ │ │ │ │ └── nav
│ │ │ │ │ ├── SolarTermIndexNav.kt
│ │ │ │ │ └── SolarTermShowNav.kt
│ │ │ └── theme
│ │ │ │ ├── Background.kt
│ │ │ │ ├── Color.kt
│ │ │ │ ├── Gradient.kt
│ │ │ │ ├── Theme.kt
│ │ │ │ ├── Tint.kt
│ │ │ │ └── Type.kt
│ │ │ └── widgets
│ │ │ ├── ChineseIdiomWidget.kt
│ │ │ ├── ClassicalLiteraturePoemWidget.kt
│ │ │ └── ClassicalLiteratureSentenceWidget.kt
│ ├── proto
│ │ └── user_preferences.proto
│ └── res
│ │ ├── drawable-anydpi
│ │ └── ic_actionbar_tab.xml
│ │ ├── drawable-hdpi
│ │ └── ic_actionbar_tab.png
│ │ ├── drawable-mdpi
│ │ └── ic_actionbar_tab.png
│ │ ├── drawable-night
│ │ ├── ic_logo.xml
│ │ └── ic_splash.xml
│ │ ├── drawable-xhdpi
│ │ └── ic_actionbar_tab.png
│ │ ├── drawable-xxhdpi
│ │ └── ic_actionbar_tab.png
│ │ ├── drawable
│ │ ├── ic_launcher_foreground.xml
│ │ ├── ic_logo.xml
│ │ ├── ic_nowinlife.jpg
│ │ ├── ic_nowinlife_black.png
│ │ ├── ic_nowinlife_white.png
│ │ ├── ic_splash.xml
│ │ ├── widget_idiom_preview.png
│ │ ├── widget_poem_preview.png
│ │ └── widget_poem_sentence_preview.png
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── values
│ │ ├── colors.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── strings.xml
│ │ └── themes.xml
│ │ └── xml
│ │ ├── backup_rules.xml
│ │ ├── data_extraction_rules.xml
│ │ ├── idiom_widget_info.xml
│ │ ├── network_security_config.xml
│ │ ├── poem_sentence_widget_info.xml
│ │ └── poem_widget_info.xml
│ └── test
│ └── java
│ └── com
│ └── hefengbao
│ └── jingmo
│ └── ExampleUnitTest.kt
├── build.gradle.kts
├── gradle.properties
├── gradle
├── libs.versions.toml
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── screenshot
├── 1.png
├── 2.png
├── alipay.jpg
├── d
│ └── 1.jpg
├── logo.png
├── v1.13.0.png
├── v1.14.0.png
├── wechatpay.png
└── 公众号.png
└── settings.gradle.kts
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | .DS_Store
6 | /build
7 | /captures
8 | .externalNativeBuild
9 | .cxx
10 | local.properties
11 | keystore.properties
12 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /release
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/hefengbao/jingmo/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.hefengbao.jingmo
2 |
3 | import androidx.test.ext.junit.runners.AndroidJUnit4
4 | import androidx.test.platform.app.InstrumentationRegistry
5 | import org.junit.Assert.*
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | /**
10 | * Instrumented test, which will execute on an Android device.
11 | *
12 | * See [testing documentation](http://d.android.com/tools/testing).
13 | */
14 | @RunWith(AndroidJUnit4::class)
15 | class ExampleInstrumentedTest {
16 | @Test
17 | fun useAppContext() {
18 | // Context of the app under test.
19 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
20 | assertEquals("com.hefengbao.wenqu", appContext.packageName)
21 | }
22 | }
--------------------------------------------------------------------------------
/app/src/debug/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 京墨Debug
4 |
--------------------------------------------------------------------------------
/app/src/main/assets/hanzi/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hefengbao/jingmo/503b345369fbf80c9ac921bcf31cf0e073d2c64a/app/src/main/assets/hanzi/bg.png
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hefengbao/jingmo/503b345369fbf80c9ac921bcf31cf0e073d2c64a/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/App.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo
11 |
12 | import android.app.Application
13 | import com.tencent.bugly.crashreport.CrashReport
14 | import dagger.hilt.android.HiltAndroidApp
15 |
16 | @HiltAndroidApp
17 | class App : Application() {
18 | override fun onCreate() {
19 | super.onCreate()
20 |
21 | CrashReport.initCrashReport(applicationContext, "f75198f767", BuildConfig.DEBUG)
22 | }
23 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/base/BaseViewModel.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.base
11 |
12 | import androidx.lifecycle.ViewModel
13 |
14 | open class BaseViewModel : ViewModel()
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/common/Constant.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.common
11 |
12 | object Constant {
13 | const val DB_NAME = "jingmo.db"
14 | const val DATASTORE_NAME = "jingmo"
15 | const val DATASTORE_DATASET_NAME = "jingmo_dataset"
16 | const val DATASTORE_READ_STATUS_NAME = "jingmo_read_status"
17 | const val DATASTORE_HOME = "jingmo_home"
18 |
19 | const val URI = "https://hefengbao.github.io/jingmo"
20 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/common/ElevationTokens.kt:
--------------------------------------------------------------------------------
1 | package com.hefengbao.jingmo.common
2 |
3 | object ElevationTokens {
4 |
5 | const val Level0 = 0
6 | const val Level1 = 1
7 | const val Level2 = 3
8 | const val Level3 = 6
9 | const val Level4 = 8
10 | const val Level5 = 12
11 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/common/network/AppDispatchers.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.common.network
11 |
12 | import javax.inject.Qualifier
13 | import kotlin.annotation.AnnotationRetention.RUNTIME
14 |
15 | @Qualifier
16 | @Retention(RUNTIME)
17 | annotation class Dispatcher(val dispatcher: AppDispatchers)
18 |
19 | enum class AppDispatchers {
20 | Default,
21 | IO,
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/common/network/Result.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.common.network
11 |
12 | import kotlinx.coroutines.flow.Flow
13 | import kotlinx.coroutines.flow.catch
14 | import kotlinx.coroutines.flow.map
15 | import kotlinx.coroutines.flow.onStart
16 |
17 | sealed interface Result {
18 | data class Success(val data: T) : Result
19 | data class Error(val exception: Throwable? = null) : Result
20 | object Loading : Result
21 | }
22 |
23 | fun Flow.asResult(): Flow> {
24 | return this
25 | .map> {
26 | Result.Success(it)
27 | }
28 | .onStart { emit(Result.Loading) }
29 | .catch { emit(Result.Error(it)) }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/common/network/SafeApiCall.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.common.network
11 |
12 | import kotlinx.coroutines.CancellationException
13 | import kotlinx.coroutines.Dispatchers
14 | import kotlinx.coroutines.withContext
15 |
16 | interface SafeApiCall {
17 | suspend fun safeApiCall(
18 | apiCall: suspend () -> T
19 | ): Result {
20 | return withContext(Dispatchers.IO) {
21 | try {
22 | Result.Success(apiCall.invoke())
23 | } catch (cancellationException: CancellationException) {
24 | throw cancellationException
25 | } catch (throwable: Throwable) {
26 | Result.Error(throwable)
27 | }
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/common/network/di/DispatchersModule.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.common.network.di
11 |
12 | import com.hefengbao.jingmo.common.network.AppDispatchers.Default
13 | import com.hefengbao.jingmo.common.network.AppDispatchers.IO
14 | import com.hefengbao.jingmo.common.network.Dispatcher
15 | import dagger.Module
16 | import dagger.Provides
17 | import dagger.hilt.InstallIn
18 | import dagger.hilt.components.SingletonComponent
19 | import kotlinx.coroutines.CoroutineDispatcher
20 | import kotlinx.coroutines.Dispatchers
21 |
22 | @Module
23 | @InstallIn(SingletonComponent::class)
24 | object DispatchersModule {
25 | @Provides
26 | @Dispatcher(IO)
27 | fun providesIODispatcher(): CoroutineDispatcher = Dispatchers.IO
28 |
29 | @Provides
30 | @Dispatcher(Default)
31 | fun providesDefaultDispatcher(): CoroutineDispatcher = Dispatchers.Default
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/china/WorldCulturalHeritageEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.china
11 |
12 | import androidx.room.Entity
13 | import androidx.room.PrimaryKey
14 |
15 | @Entity(tableName = "china_world_cultural_heritage")
16 | data class WorldCulturalHeritageEntity(
17 | @PrimaryKey
18 | val id: Int,
19 | val name: String,
20 | val year: String,
21 | val year2: String?,
22 | val level: String,
23 | val address: String,
24 | val image: String,
25 | val content: String
26 | )
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/AntitheticalCoupletCollectionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Index
15 | import androidx.room.PrimaryKey
16 |
17 | /**
18 | * 对联书签
19 | */
20 | @Entity(tableName = "chinese_antithetical_couplet_collections", indices = [Index("collected_at")])
21 | data class AntitheticalCoupletCollectionEntity(
22 | @PrimaryKey
23 | val id: Int
24 | ) {
25 | @ColumnInfo(name = "collected_at")
26 | var collectedAt: Long = System.currentTimeMillis()
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/AntitheticalCoupletEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.Entity
13 | import androidx.room.PrimaryKey
14 |
15 | @Entity(tableName = "chinese_antithetical_couplets")
16 | data class AntitheticalCoupletEntity(
17 | @PrimaryKey
18 | val id: Int,
19 | val body: String,
20 | val description: String?,
21 | val image: String? = null
22 | )
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/DictionaryCollectionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Index
15 | import androidx.room.PrimaryKey
16 |
17 | /**
18 | * 字典书签
19 | */
20 | @Entity(tableName = "dictionary_collections", indices = [Index("collected_at")])
21 | data class DictionaryCollectionEntity(
22 | @PrimaryKey
23 | val id: Int
24 | ) {
25 | @ColumnInfo(name = "collected_at")
26 | var collectedAt: Long = System.currentTimeMillis()
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/DictionaryEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.PrimaryKey
15 |
16 | @Entity(tableName = "dictionary")
17 | data class DictionaryEntity(
18 | @PrimaryKey
19 | val id: Int,
20 | val char: String,
21 | val wubi: String?,
22 | val radical: String?,
23 | val stroke: Int,
24 | val pinyin: String?,
25 | @ColumnInfo("simple_explanation")
26 | val simpleExplanation: String?,
27 | val explanation: String?,
28 | val loanword: Boolean,
29 | )
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/DictionaryPinyinEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.PrimaryKey
15 |
16 | @Entity(tableName = "dictionary_pinyin")
17 | data class DictionaryPinyinEntity(
18 | @PrimaryKey(autoGenerate = true)
19 | val id: Int? = null,
20 | @ColumnInfo("dictionary_id")
21 | val dictionaryId: Int,
22 | val pinyin: String,
23 | )
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/ExpressionCollectionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Index
15 | import androidx.room.PrimaryKey
16 |
17 | /**
18 | * 字典书签
19 | */
20 | @Entity(tableName = "chinese_expression_collections", indices = [Index("collected_at")])
21 | data class ExpressionCollectionEntity(
22 | @PrimaryKey
23 | val id: Int
24 | ) {
25 | @ColumnInfo(name = "collected_at")
26 | var collectedAt: Long = System.currentTimeMillis()
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/ExpressionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.Entity
13 | import androidx.room.PrimaryKey
14 |
15 | /**
16 | * 词语
17 | */
18 | @Entity(tableName = "chinese_expressions")
19 | data class ExpressionEntity(
20 | @PrimaryKey
21 | val id: Int,
22 | val word: String,
23 | val pinyin: String,
24 | val abbr: String? = null,
25 | val explanation: String? = null
26 | )
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/IdiomCollectionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Index
15 | import androidx.room.PrimaryKey
16 |
17 | /**
18 | * 成语书签
19 | */
20 | @Entity(tableName = "idiom_collections", indices = [Index("collected_at")])
21 | data class IdiomCollectionEntity(
22 | @PrimaryKey
23 | val id: Int
24 | ) {
25 | @ColumnInfo(name = "collected_at")
26 | var collectedAt: Long = System.currentTimeMillis()
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/KnowledgeCollectionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Index
15 | import androidx.room.PrimaryKey
16 |
17 | /**
18 | * 知识卡片书签
19 | */
20 | @Entity(tableName = "chinese_knowledge_collections", indices = [Index("collected_at")])
21 | data class KnowledgeCollectionEntity(
22 | @PrimaryKey
23 | val id: Int
24 | ) {
25 | @ColumnInfo(name = "collected_at")
26 | var collectedAt: Long = System.currentTimeMillis()
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/KnowledgeEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.Entity
13 | import androidx.room.PrimaryKey
14 |
15 | @Entity(tableName = "chinese_knowledge")
16 | data class KnowledgeEntity(
17 | @PrimaryKey
18 | val id: Int,
19 | val content: String,
20 | val label: String,
21 | val url: String?,
22 | )
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/KnowledgeFtsEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Fts4
15 | import androidx.room.FtsOptions
16 | import androidx.room.PrimaryKey
17 |
18 | @Fts4(
19 | tokenizer = FtsOptions.TOKENIZER_ICU,
20 | contentEntity = KnowledgeEntity::class,
21 | )
22 | @Entity(tableName = "chinese_knowledge_fts")
23 | data class KnowledgeFtsEntity(
24 | @PrimaryKey
25 | @ColumnInfo("rowid")
26 | val id: Int,
27 | val content: String
28 | )
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/LyricCollectionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Index
15 | import androidx.room.PrimaryKey
16 |
17 | /**
18 | * 歌词书签
19 | */
20 | @Entity(tableName = "lyric_collections", indices = [Index("collected_at")])
21 | data class LyricCollectionEntity(
22 | @PrimaryKey
23 | val id: Int
24 | ) {
25 | @ColumnInfo(name = "collected_at")
26 | var collectedAt: Long = System.currentTimeMillis()
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/LyricEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.Entity
13 | import androidx.room.PrimaryKey
14 |
15 | @Entity(tableName = "lyrics")
16 | data class LyricEntity(
17 | @PrimaryKey
18 | val id: Int,
19 | val title: String,
20 | val writer: String?,
21 | val singer: String?,
22 | val content: String
23 | )
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/LyricFtsEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Fts4
15 | import androidx.room.FtsOptions
16 | import androidx.room.PrimaryKey
17 |
18 | @Fts4(
19 | tokenizer = FtsOptions.TOKENIZER_ICU,
20 | contentEntity = LyricEntity::class,
21 | )
22 | @Entity(tableName = "lyrics_fts")
23 | data class LyricFtsEntity(
24 | @PrimaryKey
25 | @ColumnInfo("rowid")
26 | val id: Int,
27 | val title: String,
28 | val writer: String?,
29 | val singer: String?,
30 | val content: String
31 | )
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/ModernPoetryCollectionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Index
15 | import androidx.room.PrimaryKey
16 |
17 | @Entity(tableName = "chinese_modern_poetry_collections", indices = [Index("collected_at")])
18 | data class ModernPoetryCollectionEntity(
19 | @PrimaryKey
20 | val id: Int
21 | ) {
22 | @ColumnInfo(name = "collected_at")
23 | var collectedAt: Long = System.currentTimeMillis()
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/ModernPoetryEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.PrimaryKey
15 |
16 | @Entity(tableName = "chinese_modern_poetry")
17 | data class ModernPoetryEntity(
18 | @PrimaryKey
19 | val id: Int,
20 | val title: String,
21 | val author: String,
22 | val content: String,
23 | val zhu: String?,
24 | val yi: String?,
25 | val shang: String?,
26 | @ColumnInfo("author_info")
27 | val authorInfo: String?
28 | )
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/ModernPoetryFtsEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Fts4
15 | import androidx.room.FtsOptions
16 | import androidx.room.PrimaryKey
17 |
18 | @Fts4(
19 | tokenizer = FtsOptions.TOKENIZER_ICU,
20 | contentEntity = ModernPoetryEntity::class
21 | )
22 | @Entity(tableName = "chinese_modern_poetry_fts")
23 | data class ModernPoetryFtsEntity(
24 | @PrimaryKey
25 | @ColumnInfo("rowid")
26 | val id: Int,
27 | val content: String
28 | )
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/ProverbCollectionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Index
15 | import androidx.room.PrimaryKey
16 |
17 | /**
18 | * 谚语书签
19 | */
20 | @Entity(tableName = "proverb_collections", indices = [Index("collected_at")])
21 | data class ProverbCollectionEntity(
22 | @PrimaryKey
23 | val id: Int
24 | ) {
25 | @ColumnInfo(name = "collected_at")
26 | var collectedAt: Long = System.currentTimeMillis()
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/ProverbEntity.kt:
--------------------------------------------------------------------------------
1 | package com.hefengbao.jingmo.data.database.entity.chinese
2 |
3 | import androidx.room.Entity
4 | import androidx.room.PrimaryKey
5 |
6 | @Entity(tableName = "proverbs")
7 | data class ProverbEntity(
8 | @PrimaryKey
9 | val id: Int,
10 | val content: String
11 | )
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/ProverbFtsEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Fts4
15 | import androidx.room.FtsOptions
16 | import androidx.room.PrimaryKey
17 |
18 | @Fts4(
19 | tokenizer = FtsOptions.TOKENIZER_ICU,
20 | contentEntity = ProverbEntity::class,
21 | )
22 | @Entity(tableName = "proverbs_fts")
23 | data class ProverbFtsEntity(
24 | @PrimaryKey
25 | @ColumnInfo("rowid")
26 | val id: Int,
27 | val content: String
28 | )
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/QuoteCollectionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Index
15 | import androidx.room.PrimaryKey
16 |
17 | /**
18 | * 句子书签
19 | */
20 | @Entity(tableName = "chinese_quote_collections", indices = [Index("collected_at")])
21 | data class QuoteCollectionEntity(
22 | @PrimaryKey
23 | val id: Int
24 | ) {
25 | @ColumnInfo(name = "collected_at")
26 | var collectedAt: Long = System.currentTimeMillis()
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/QuoteEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.Entity
13 | import androidx.room.PrimaryKey
14 |
15 | @Entity(tableName = "chinese_quotes")
16 | data class QuoteEntity(
17 | @PrimaryKey
18 | val id: Int,
19 | val content: String,
20 | val author: String,
21 | val from: String
22 | )
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/QuoteFtsEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Fts4
15 | import androidx.room.FtsOptions
16 | import androidx.room.PrimaryKey
17 |
18 | @Fts4(
19 | tokenizer = FtsOptions.TOKENIZER_ICU,
20 | contentEntity = QuoteEntity::class
21 | )
22 | @Entity(tableName = "chinese_quotes_fts")
23 | data class QuoteFtsEntity(
24 | @PrimaryKey
25 | @ColumnInfo("rowid")
26 | val id: Int,
27 | val content: String
28 | )
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/RiddleEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.Entity
13 | import androidx.room.PrimaryKey
14 |
15 | @Entity(tableName = "riddles")
16 | data class RiddleEntity(
17 | @PrimaryKey
18 | val id: Int,
19 | val puzzle: String,
20 | val answer: String
21 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/TongueTwisterEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.Entity
13 | import androidx.room.PrimaryKey
14 |
15 | @Entity(tableName = "tongue_twisters")
16 | data class TongueTwisterEntity(
17 | @PrimaryKey
18 | val id: Int,
19 | val title: String,
20 | val content: String,
21 | val content2: String?,
22 | )
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/WisecrackCollectionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Index
15 | import androidx.room.PrimaryKey
16 |
17 | /**
18 | * 歇后语书签
19 | */
20 | @Entity(tableName = "chinese_wisecrack_collections", indices = [Index("collected_at")])
21 | data class WisecrackCollectionEntity(
22 | @PrimaryKey
23 | val id: Int
24 | ) {
25 | @ColumnInfo(name = "collected_at")
26 | var collectedAt: Long = System.currentTimeMillis()
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/chinese/WisecrackEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.chinese
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.PrimaryKey
15 |
16 | /**
17 | * 歇后语
18 | */
19 | @Entity("chinese_wisecracks")
20 | data class WisecrackEntity(
21 | @PrimaryKey
22 | val id: Int,
23 | val riddle: String,
24 | val answer: String,
25 | @ColumnInfo(name = "first_word")
26 | val firstWord: String,
27 | @ColumnInfo(name = "first_letter")
28 | val firstLetter: String
29 | )
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/classicalliterature/ClassicPoemCollectionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.classicalliterature
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.PrimaryKey
15 |
16 | @Entity(tableName = "classic_poem_collections")
17 | data class ClassicPoemCollectionEntity(
18 | @PrimaryKey
19 | val id: Int,
20 | ) {
21 | @ColumnInfo(name = "collected_at")
22 | var collectedAt: Long = System.currentTimeMillis()
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/classicalliterature/ClassicPoemEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.classicalliterature
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.PrimaryKey
15 |
16 | /**
17 | * 经典诗文
18 | */
19 | @Entity(tableName = "classic_poems")
20 | data class ClassicPoemEntity(
21 | @PrimaryKey
22 | val id: Int,
23 | val dynasty: String,
24 | val writer: String,
25 | @ColumnInfo(name = "writer_introduction")
26 | val writerIntroduction: String?,
27 | val title: String,
28 | val subtitle: String?,
29 | val preface: String?,
30 | val content: String,
31 | val annotation: String?,
32 | val translation: String?,
33 | @ColumnInfo(name = "creative_background")
34 | val creativeBackground: String?,
35 | val explain: String?,
36 | val comment: String?,
37 | val collection: String,
38 | val category: String?
39 | )
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/classicalliterature/ClassicPoemFtsEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.classicalliterature
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Fts4
15 | import androidx.room.FtsOptions
16 | import androidx.room.PrimaryKey
17 |
18 | @Fts4(
19 | tokenizer = FtsOptions.TOKENIZER_ICU,
20 | contentEntity = ClassicPoemEntity::class,
21 | )
22 | @Entity(tableName = "classic_poems_fts")
23 | data class ClassicPoemFtsEntity(
24 | @PrimaryKey
25 | @ColumnInfo("rowid")
26 | val id: Int,
27 | val writer: String,
28 | val title: String,
29 | val content: String,
30 | )
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/classicalliterature/SentenceCollectionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.classicalliterature
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Index
15 | import androidx.room.PrimaryKey
16 |
17 | /**
18 | * 诗文名句书签
19 | */
20 | @Entity(tableName = "poem_sentence_collections", indices = [Index("collected_at")])
21 | data class SentenceCollectionEntity(
22 | @PrimaryKey
23 | val id: Int
24 | ) {
25 | @ColumnInfo(name = "collected_at")
26 | var collectedAt: Long = System.currentTimeMillis()
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/classicalliterature/SentenceEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.classicalliterature
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.PrimaryKey
15 |
16 | @Entity(tableName = "poem_sentences")
17 | data class SentenceEntity(
18 | @PrimaryKey
19 | val id: Int,
20 | val content: String,
21 | val from: String,
22 | @ColumnInfo("poem_id")
23 | val poemId: Int?
24 | )
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/classicalliterature/WritingCollectionEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.classicalliterature
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Index
15 | import androidx.room.PrimaryKey
16 |
17 | /**
18 | * 诗文书签
19 | */
20 | @Entity(tableName = "writing_collections", indices = [Index("collected_at")])
21 | data class WritingCollectionEntity(
22 | @PrimaryKey
23 | val id: Int
24 | ) {
25 | @ColumnInfo(name = "collected_at")
26 | var collectedAt: Long = System.currentTimeMillis()
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/entity/classicalliterature/WritingFtsEntity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.entity.classicalliterature
11 |
12 | import androidx.room.ColumnInfo
13 | import androidx.room.Entity
14 | import androidx.room.Fts4
15 | import androidx.room.FtsOptions
16 | import androidx.room.PrimaryKey
17 |
18 | @Fts4(
19 | tokenizer = FtsOptions.TOKENIZER_ICU,
20 | contentEntity = WritingEntity::class,
21 | )
22 | @Entity(tableName = "writing_fts")
23 | data class WritingFtsEntity(
24 | @PrimaryKey
25 | @ColumnInfo("rowid")
26 | val id: Int,
27 | val author: String?,
28 | val title2: String?,
29 | val content: String?,
30 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/util/IntListConverter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.util
11 |
12 | import androidx.room.TypeConverter
13 | import kotlinx.serialization.encodeToString
14 | import kotlinx.serialization.json.Json
15 |
16 | class IntListConverter {
17 | @TypeConverter
18 | fun listToString(list: List?): String? {
19 | return if (list == null) {
20 | null
21 | } else {
22 | Json.encodeToString(list)
23 | }
24 | }
25 |
26 | @TypeConverter
27 | fun stringToList(str: String?): List? {
28 | return if (str == null) {
29 | null
30 | } else {
31 | Json.decodeFromString(str)
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/util/PeopleAliasListConverter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.util
11 |
12 | import androidx.room.TypeConverter
13 | import com.hefengbao.jingmo.data.model.classicalliterature.people.Alias
14 | import kotlinx.serialization.encodeToString
15 | import kotlinx.serialization.json.Json
16 |
17 | class PeopleAliasListConverter {
18 | @TypeConverter
19 | fun listToString(list: List?): String? {
20 | return if (list == null) {
21 | null
22 | } else {
23 | Json.encodeToString(list)
24 | }
25 | }
26 |
27 | @TypeConverter
28 | fun stringToList(str: String?): List? {
29 | return if (str == null) {
30 | null
31 | } else {
32 | Json.decodeFromString(str)
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/util/PeopleDetailListConverter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.util
11 |
12 | import androidx.room.TypeConverter
13 | import com.hefengbao.jingmo.data.model.classicalliterature.people.Detail
14 | import kotlinx.serialization.encodeToString
15 | import kotlinx.serialization.json.Json
16 |
17 | class PeopleDetailListConverter {
18 | @TypeConverter
19 | fun listToString(list: List?): String? {
20 | return if (list == null) {
21 | null
22 | } else {
23 | Json.encodeToString(list)
24 | }
25 | }
26 |
27 | @TypeConverter
28 | fun stringToList(str: String?): List? {
29 | return if (str == null) {
30 | null
31 | } else {
32 | Json.decodeFromString(str)
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/util/PeopleHometownListConverter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.util
11 |
12 | import androidx.room.TypeConverter
13 | import com.hefengbao.jingmo.data.model.classicalliterature.people.Hometown
14 | import kotlinx.serialization.encodeToString
15 | import kotlinx.serialization.json.Json
16 |
17 | class PeopleHometownListConverter {
18 | @TypeConverter
19 | fun listToString(list: List?): String? {
20 | return if (list == null) {
21 | null
22 | } else {
23 | Json.encodeToString(list)
24 | }
25 | }
26 |
27 | @TypeConverter
28 | fun stringToList(str: String?): List? {
29 | return if (str == null) {
30 | null
31 | } else {
32 | Json.decodeFromString(str)
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/util/StringListConverter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.util
11 |
12 | import androidx.room.TypeConverter
13 | import kotlinx.serialization.encodeToString
14 | import kotlinx.serialization.json.Json
15 |
16 | class StringListConverter {
17 | @TypeConverter
18 | fun listToString(list: List?): String? {
19 | return if (list == null) {
20 | null
21 | } else {
22 | Json.encodeToString(list)
23 | }
24 | }
25 |
26 | @TypeConverter
27 | fun stringToList(str: String?): List? {
28 | return if (str == null) {
29 | null
30 | } else {
31 | Json.decodeFromString(str)
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/util/WritingAllusionListConverter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.util
11 |
12 | import androidx.room.TypeConverter
13 | import com.hefengbao.jingmo.data.model.classicalliterature.writing.Allusion
14 | import kotlinx.serialization.encodeToString
15 | import kotlinx.serialization.json.Json
16 |
17 | class WritingAllusionListConverter {
18 | @TypeConverter
19 | fun listToString(list: List?): String? {
20 | return if (list == null) {
21 | null
22 | } else {
23 | Json.encodeToString(list)
24 | }
25 | }
26 |
27 | @TypeConverter
28 | fun stringToList(str: String?): List? {
29 | return if (str == null) {
30 | null
31 | } else {
32 | Json.decodeFromString(str)
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/util/WritingClauseListConverter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.util
11 |
12 | import androidx.room.TypeConverter
13 | import com.hefengbao.jingmo.data.model.classicalliterature.writing.Clause
14 | import kotlinx.serialization.encodeToString
15 | import kotlinx.serialization.json.Json
16 |
17 | class WritingClauseListConverter {
18 | @TypeConverter
19 | fun listToString(list: List?): String? {
20 | return if (list == null) {
21 | null
22 | } else {
23 | Json.encodeToString(list)
24 | }
25 | }
26 |
27 | @TypeConverter
28 | fun stringToList(str: String?): List? {
29 | return if (str == null) {
30 | null
31 | } else {
32 | Json.decodeFromString(str)
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/util/WritingCommentListConverter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.util
11 |
12 | import androidx.room.TypeConverter
13 | import com.hefengbao.jingmo.data.model.classicalliterature.writing.Comment
14 | import kotlinx.serialization.encodeToString
15 | import kotlinx.serialization.json.Json
16 |
17 | class WritingCommentListConverter {
18 | @TypeConverter
19 | fun listToString(list: List?): String? {
20 | return if (list == null) {
21 | null
22 | } else {
23 | Json.encodeToString(list)
24 | }
25 | }
26 |
27 | @TypeConverter
28 | fun stringToList(str: String?): List? {
29 | return if (str == null) {
30 | null
31 | } else {
32 | Json.decodeFromString(str)
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/database/util/WritingQuoteListConverter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.database.util
11 |
12 | import androidx.room.TypeConverter
13 | import com.hefengbao.jingmo.data.model.classicalliterature.writing.Quote
14 | import kotlinx.serialization.encodeToString
15 | import kotlinx.serialization.json.Json
16 |
17 | class WritingQuoteListConverter {
18 | @TypeConverter
19 | fun listToString(list: List?): String? {
20 | return if (list == null) {
21 | null
22 | } else {
23 | Json.encodeToString(list)
24 | }
25 | }
26 |
27 | @TypeConverter
28 | fun stringToList(str: String?): List? {
29 | return if (str == null) {
30 | null
31 | } else {
32 | Json.decodeFromString(str)
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/enums/writing/CommentType.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.enums.writing
11 |
12 | enum class CommentType(val type: String) {
13 | Text("Text"),
14 | CharDictInJson("CharDictInJson"),
15 | WordDictInJson("WordDictInJson"),
16 | AllusionKey("AllusionKey"),
17 | Image("Image"),
18 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/AppStatus.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model
11 |
12 | import com.hefengbao.jingmo.data.model.theme.DarkThemeConfig
13 | import com.hefengbao.jingmo.data.model.theme.ThemeBrand
14 |
15 | data class AppStatus(
16 | val captureTextColor: String,
17 | val captureBackgroundColor: String,
18 | val themeBrand: ThemeBrand,
19 | val darkThemeConfig: DarkThemeConfig,
20 | val useDynamicColor: Boolean,
21 | val showSyncDataTip: Boolean,
22 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/Dataset.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model
11 |
12 | import kotlinx.serialization.Serializable
13 |
14 | @Serializable
15 | data class Dataset(
16 | val id: Int,
17 | val name: String,
18 | val count: Int,
19 | val version: Int
20 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/IdTitle.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model
11 |
12 | data class IdTitle(
13 | val id: Int,
14 | val title: String
15 | )
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/Link.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model
11 |
12 | data class Link(
13 | val title: String,
14 | val desc: String,
15 | val url: String
16 | )
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/ReadStatus.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information: Int, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model
11 |
12 | data class ReadStatus(
13 | val chineseAntitheticalCoupletLastReadId: Int,
14 | val chineseIdiomsLastReadId: Int,
15 | val chineseKnowledgeLastReadId: Int,
16 | val chineseLyricLastReadId: Int,
17 | val chineseModernPoetryLastReadId: Int,
18 | val chineseProverbLastReadId: Int,
19 | val chineseQuoteLastReadId: Int,
20 | val chineseRiddlesLastReadId: Int,
21 | val chineseTongueTwistersLastReadId: Int,
22 | val chineseWisecracksLastReadId: Int,
23 | val classicLiteratureClassicPoemsLastReadId: Int,
24 | val classicLiteraturePeopleLastReadId: Int,
25 | val classicLiteratureSentencesLastReadId: Int,
26 | val classicLiteratureWritingsLastReadId: Int,
27 | )
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/UserData.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model
11 |
12 | import com.hefengbao.jingmo.data.model.theme.DarkThemeConfig
13 | import com.hefengbao.jingmo.data.model.theme.ThemeBrand
14 |
15 | data class UserData(
16 | val themeBrand: ThemeBrand,
17 | val darkThemeConfig: DarkThemeConfig,
18 | val useDynamicColor: Boolean,
19 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/china/WorldCulturalHeritage.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.china
11 |
12 | import com.hefengbao.jingmo.data.database.entity.china.WorldCulturalHeritageEntity
13 | import kotlinx.serialization.Serializable
14 |
15 | /**
16 | * 中国的世界文化遗产
17 | */
18 | @Serializable
19 | data class WorldCulturalHeritage(
20 | val id: Int,
21 | val name: String,
22 | val year: String,
23 | val year2: String?,
24 | val level: String,
25 | val address: String,
26 | val image: String,
27 | val content: String
28 | )
29 |
30 | fun WorldCulturalHeritage.asWorldCulturalHeritageEntity() = WorldCulturalHeritageEntity(
31 | id, name, year, year2, level, address, image, content
32 | )
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/AntitheticalCouplet.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.entity.chinese.AntitheticalCoupletEntity
13 | import kotlinx.serialization.Serializable
14 |
15 | @Serializable
16 | data class AntitheticalCouplet(
17 | val id: Int,
18 | val body: String,
19 | val description: String?,
20 | val image: String? = null
21 | )
22 |
23 |
24 | fun AntitheticalCouplet.asAntitheticalCoupletEntity() = AntitheticalCoupletEntity(
25 | id, body, description, image
26 | )
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/Dictionary.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.entity.chinese.DictionaryEntity
13 | import kotlinx.serialization.SerialName
14 | import kotlinx.serialization.Serializable
15 |
16 | /**
17 | * 汉字
18 | */
19 | @Serializable
20 | data class Dictionary(
21 | val id: Int,
22 | val char: String,
23 | val wubi: String?,
24 | val radical: String?,
25 | val stroke: Int,
26 | val pinyin: String?,
27 | val pinyin2: List?,
28 | @SerialName("simple_explanation")
29 | val simpleExplanation: String?,
30 | val explanation: String?,
31 | val loanword: Boolean,
32 | )
33 |
34 | fun Dictionary.asDictionaryEntity() = DictionaryEntity(
35 | id, char, wubi, radical, stroke, pinyin, simpleExplanation, explanation, loanword
36 | )
37 |
38 | @Serializable
39 | data class DictionaryWrapper(
40 | val data: List,
41 | @SerialName("next_page")
42 | val nextPage: String?
43 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/Expression.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.entity.chinese.ExpressionEntity
13 | import kotlinx.serialization.Serializable
14 |
15 | /**
16 | * 词语
17 | */
18 | @Serializable
19 | data class ChineseExpression(
20 | val id: Int,
21 | val word: String,
22 | val pinyin: String,
23 | val abbr: String? = null,
24 | val explanation: String? = null
25 | )
26 |
27 | fun ChineseExpression.asChineseExpressionEntity() = ExpressionEntity(
28 | id, word, pinyin, abbr, explanation
29 | )
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/ExpressionWrapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese
11 |
12 | import kotlinx.serialization.SerialName
13 | import kotlinx.serialization.Serializable
14 |
15 | /**
16 | * 词语
17 | */
18 | @Serializable
19 | data class ExpressionWrapper(
20 | val data: List,
21 | @SerialName("next_page")
22 | val nextPage: String?
23 | )
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/IdiomWrapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese
11 |
12 | import kotlinx.serialization.SerialName
13 | import kotlinx.serialization.Serializable
14 |
15 | @Serializable
16 | data class IdiomWrapper(
17 | val data: List,
18 | @SerialName("next_page")
19 | val nextPage: String?
20 | )
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/Knowledge.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.entity.chinese.KnowledgeEntity
13 | import kotlinx.serialization.Serializable
14 |
15 | /**
16 | * 只是卡片
17 | */
18 | @Serializable
19 | data class ChineseKnowledge(
20 | val id: Int,
21 | val content: String,
22 | val label: String,
23 | val url: String?,
24 | )
25 |
26 | fun ChineseKnowledge.asChineseKnowledgeEntity() = KnowledgeEntity(
27 | id, content, label, url
28 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/Lyric.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.entity.chinese.LyricEntity
13 | import kotlinx.serialization.Serializable
14 |
15 | /**
16 | * 歌词
17 | */
18 | @Serializable
19 | data class Lyric(
20 | val id: Int,
21 | val title: String,
22 | val writer: String?,
23 | val singer: String?,
24 | val content: String
25 | )
26 |
27 | fun Lyric.asLyricEntity() = LyricEntity(
28 | id, title, writer, singer, content
29 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/ModernPoetry.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.entity.chinese.ModernPoetryEntity
13 | import kotlinx.serialization.SerialName
14 | import kotlinx.serialization.Serializable
15 |
16 | @Serializable
17 | data class ModernPoetry(
18 | val id: Int,
19 | val title: String,
20 | val author: String,
21 | val content: String,
22 | val zhu: String?,
23 | val yi: String?,
24 | val shang: String?,
25 | @SerialName("author_info")
26 | val authorInfo: String?
27 | )
28 |
29 | fun ModernPoetry.asModernPoetryEntity() = ModernPoetryEntity(
30 | id, title, author, content, zhu, yi, shang, authorInfo
31 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/Proverb.kt:
--------------------------------------------------------------------------------
1 | package com.hefengbao.jingmo.data.model.chinese
2 |
3 | import com.hefengbao.jingmo.data.database.entity.chinese.ProverbEntity
4 | import kotlinx.serialization.Serializable
5 |
6 | /**
7 | * 谚语
8 | */
9 | @Serializable
10 | data class Proverb(
11 | val id: Int,
12 | val content: String
13 | )
14 |
15 |
16 | fun Proverb.asProverbEntity() = ProverbEntity(
17 | id, content
18 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/Quote.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.entity.chinese.QuoteEntity
13 | import kotlinx.serialization.Serializable
14 |
15 | @Serializable
16 | data class Quote(
17 | val id: Int,
18 | val content: String,
19 | val author: String,
20 | val from: String
21 | )
22 |
23 | fun Quote.asQuoteEntity() = QuoteEntity(
24 | id, content, author, from
25 | )
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/Riddle.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.entity.chinese.RiddleEntity
13 | import kotlinx.serialization.Serializable
14 |
15 | /**
16 | * 谜语
17 | */
18 | @Serializable
19 | data class Riddle(
20 | val id: Int,
21 | val puzzle: String,
22 | val answer: String
23 | )
24 |
25 | fun Riddle.asRiddleEntity() = RiddleEntity(
26 | id, puzzle, answer
27 | )
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/TongueTwister.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.entity.chinese.TongueTwisterEntity
13 | import kotlinx.serialization.Serializable
14 |
15 | /**
16 | * 绕口令
17 | */
18 | @Serializable
19 | data class TongueTwister(
20 | val id: Int,
21 | val title: String,
22 | val content: String,
23 | val content2: String?,
24 | )
25 |
26 | fun TongueTwister.asTongueTwisterEntity() = TongueTwisterEntity(
27 | id = id,
28 | title = title,
29 | content = content,
30 | content2 = content2,
31 | )
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/Wisecrack.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.entity.chinese.WisecrackEntity
13 | import kotlinx.serialization.SerialName
14 | import kotlinx.serialization.Serializable
15 |
16 | /**
17 | * 歇后语
18 | */
19 | @Serializable
20 | data class ChineseWisecrack(
21 | val id: Int,
22 | val riddle: String,
23 | val answer: String,
24 | @SerialName("first_word")
25 | val firstWord: String = "",
26 | @SerialName("first_letter")
27 | val firstLetter: String = ""
28 | )
29 |
30 | fun ChineseWisecrack.asChineseWisecrackEntity() = WisecrackEntity(
31 | id, riddle, answer, firstWord, firstLetter
32 | )
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/character/Pinyin.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese.character
11 |
12 | data class Pinyin(
13 | val alphabet: String,
14 | val pinyin: List
15 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/character/Radical.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese.character
11 |
12 | data class Radical(
13 | val stroke: String,
14 | val radicals: List
15 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/chinese/character/Stroke.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.chinese.character
11 |
12 | data class Stroke(
13 | val label: String,
14 | val stroke: Int,
15 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/classicalliterature/PeopleWrapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.classicalliterature
11 |
12 | import kotlinx.serialization.SerialName
13 | import kotlinx.serialization.Serializable
14 |
15 | @Serializable
16 | data class PeopleWrapper(
17 | val data: List,
18 | @SerialName("next_page")
19 | val nextPage: String?
20 | )
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/classicalliterature/Sentence.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.classicalliterature
11 |
12 | import com.hefengbao.jingmo.data.database.entity.classicalliterature.SentenceEntity
13 | import kotlinx.serialization.SerialName
14 | import kotlinx.serialization.Serializable
15 |
16 | @Serializable
17 | data class PoemSentence(
18 | val id: Int,
19 | val content: String,
20 | val from: String,
21 | @SerialName("poem_id")
22 | val poemId: Int? = null
23 | )
24 |
25 | fun PoemSentence.asPoemSentenceEntity() = SentenceEntity(
26 | id, content, from, poemId
27 | )
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/classicalliterature/WritingWrapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.classicalliterature
11 |
12 | import kotlinx.serialization.SerialName
13 | import kotlinx.serialization.Serializable
14 |
15 | @Serializable
16 | data class WritingWrapper(
17 | val data: List,
18 | @SerialName("next_page")
19 | val nextPage: Int?
20 | )
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/classicalliterature/people/Alias.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.classicalliterature.people
11 |
12 | import kotlinx.serialization.SerialName
13 | import kotlinx.serialization.Serializable
14 |
15 | /**
16 | * 人物别名
17 | */
18 | @Serializable
19 | data class Alias(
20 | @SerialName("Name")
21 | val name: String,
22 | @SerialName("Type")
23 | val type: String
24 | )
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/classicalliterature/people/Detail.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.classicalliterature.people
11 |
12 | import kotlinx.serialization.SerialName
13 | import kotlinx.serialization.Serializable
14 |
15 | /**
16 | * 人物资料
17 | */
18 | @Serializable
19 | data class Detail(
20 | @SerialName("Book")
21 | val book: String,
22 | @SerialName("Section")
23 | val section: String?,
24 | @SerialName("Content")
25 | val content: String?,
26 | @SerialName("IsReview")
27 | val isReview: Boolean,
28 | @SerialName("ReferrenceUrls")
29 | val referenceUrls: List?
30 | )
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/classicalliterature/people/Hometown.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.classicalliterature.people
11 |
12 | import kotlinx.serialization.SerialName
13 | import kotlinx.serialization.Serializable
14 |
15 | /**
16 | * 人物家乡
17 | */
18 | @Serializable
19 | data class Hometown(
20 | @SerialName("RegionId")
21 | val regionId: String,
22 | @SerialName("Name")
23 | val name: String
24 | )
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/classicalliterature/writing/Allusion.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.classicalliterature.writing
11 |
12 | import kotlinx.serialization.SerialName
13 | import kotlinx.serialization.Serializable
14 |
15 | /**
16 | * 引用典故数据
17 | */
18 | @Serializable
19 | data class Allusion(
20 | @SerialName("AllusionIndex")
21 | val allusionIndex: Int,
22 | @SerialName("AllusionKey")
23 | val allusionKey: String,
24 | @SerialName("SentenceIndex")
25 | val sentenceIndex: Int,
26 | )
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/classicalliterature/writing/CharDict.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.classicalliterature.writing
11 |
12 | import kotlinx.serialization.Serializable
13 |
14 | @Serializable
15 | data class CharDict(
16 | val OriginalChar: String,
17 | val Comments: List
18 | )
19 |
20 | @Serializable
21 | data class CharComment(
22 | val Character: String,
23 | val Origin: String,
24 | val Explains: List
25 | )
26 |
27 | @Serializable
28 | data class Explain(
29 | val Type: String,// Example,Explain,Spell,KXSpell
30 | val Content: String,
31 | )
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/classicalliterature/writing/Clause.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.classicalliterature.writing
11 |
12 | import kotlinx.serialization.SerialName
13 | import kotlinx.serialization.Serializable
14 |
15 | @Serializable
16 | data class Clause(
17 | @SerialName("Content")
18 | val content: String,
19 | @SerialName("Comments")
20 | val comments: List?,
21 | @SerialName("BreakAfter")
22 | val breakAfter: Int?
23 | )
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/classicalliterature/writing/Comment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.classicalliterature.writing
11 |
12 | import kotlinx.serialization.SerialName
13 | import kotlinx.serialization.Serializable
14 |
15 | @Serializable
16 | data class Comment(
17 | @SerialName("Category")
18 | val category: String?,
19 | @SerialName("Content")
20 | val content: String,
21 | @SerialName("Type")
22 | val type: String,
23 | @SerialName("Index")
24 | val index: Int
25 | )
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/classicalliterature/writing/Quote.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.classicalliterature.writing
11 |
12 | import kotlinx.serialization.SerialName
13 | import kotlinx.serialization.Serializable
14 |
15 | @Serializable
16 | data class Quote(
17 | @SerialName("Book")
18 | val book: String?,
19 | @SerialName("Section")
20 | val section: String?,
21 | @SerialName("Content")
22 | val content: String?,
23 | @SerialName("IsComment")
24 | val isComment: Boolean = false,
25 | @SerialName("ReferrenceUrls")
26 | val referenceUrls: List?
27 | )
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/classicalliterature/writing/Tune.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.classicalliterature.writing
11 |
12 | import kotlinx.serialization.SerialName
13 | import kotlinx.serialization.Serializable
14 |
15 | @Serializable
16 | data class Tune(
17 | @SerialName("Name")
18 | val name: String? = null,
19 | @SerialName("Id")
20 | val id: Int?,
21 | )
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/classicalliterature/writing/WordDict.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.classicalliterature.writing
11 |
12 | import kotlinx.serialization.Serializable
13 |
14 | @Serializable
15 | data class WordDict(
16 | val Id: Int,
17 | val Text: String,
18 | val CountInPoem: Int,
19 | val Traditional: String? = null,
20 | val Explains: List,
21 | val Categories: List? = null,
22 | val Spells: String? = null,
23 | val ContainsUnknownSpell: Boolean
24 | )
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/theme/DarkThemeConfig.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.theme
11 |
12 | enum class DarkThemeConfig {
13 | FOLLOW_SYSTEM,
14 | LIGHT,
15 | DARK;
16 |
17 | companion object {
18 | infix fun from(value: String): DarkThemeConfig =
19 | DarkThemeConfig.entries.firstOrNull { it.name == value } ?: FOLLOW_SYSTEM
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/theme/ThemeBrand.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.theme
11 |
12 | enum class ThemeBrand {
13 | DEFAULT,
14 | ANDROID;
15 |
16 | companion object {
17 | infix fun from(value: String): ThemeBrand =
18 | ThemeBrand.entries.firstOrNull { it.name == value } ?: DEFAULT
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/traditionalculture/Color.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.traditionalculture
11 |
12 | data class Color(
13 | val id: String,
14 | val name: String,
15 | val traName: String,
16 | val colorSeries: String,
17 | val pinyin: String,
18 | val fontColor: String,
19 | val isBright: Boolean,
20 | val rgb: List,
21 | val hex: String,
22 | val cmyk: List,
23 | val desc: String,
24 | val figure: String
25 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/traditionalculture/Festival.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.traditionalculture
11 |
12 | data class Festival(
13 | val id: Int,
14 | val name: String,
15 | val alias: String,
16 | val desc: String,
17 | val images: List = emptyList(),
18 | val url: String,
19 | val comments: List = emptyList()
20 | )
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/model/traditionalculture/SolarTerm.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.model.traditionalculture
11 |
12 | data class SolarTerm(
13 | val id: Int,
14 | val type: String,
15 | val name: String,
16 | val alias: String,
17 | val desc: String,
18 | val url: String
19 | )
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/network/CustomDispatchers.kt:
--------------------------------------------------------------------------------
1 | package com.hefengbao.jingmo.data.network
2 |
3 | import javax.inject.Qualifier
4 | import kotlin.annotation.AnnotationRetention.RUNTIME
5 |
6 | @Qualifier
7 | @Retention(RUNTIME)
8 | annotation class Dispatcher(val dispatchers: CustomDispatchers)
9 |
10 | enum class CustomDispatchers {
11 | Default,
12 | IO,
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/network/NetworkDataSource.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.network
11 |
12 | interface NetworkDataSource
13 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/network/fake/FakeAssetManager.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.network.fake
11 |
12 | import java.io.InputStream
13 |
14 | fun interface FakeAssetManager {
15 | fun open(fileName: String): InputStream
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/network/fake/FakeNetworkDataSource.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.network.fake
11 |
12 | import com.hefengbao.jingmo.common.network.AppDispatchers
13 | import com.hefengbao.jingmo.common.network.Dispatcher
14 | import com.hefengbao.jingmo.data.network.JvmUnitTestFakeAssetManager
15 | import com.hefengbao.jingmo.data.network.NetworkDataSource
16 | import kotlinx.coroutines.CoroutineDispatcher
17 | import kotlinx.serialization.json.Json
18 | import javax.inject.Inject
19 |
20 | /**
21 | * [NetworkDataSource] implementation that provides static news resources to aid development
22 | */
23 | class FakeNetworkDataSource @Inject constructor(
24 | @Dispatcher(AppDispatchers.IO) private val ioDispatcher: CoroutineDispatcher,
25 | private val networkJson: Json,
26 | private val assets: FakeAssetManager = JvmUnitTestFakeAssetManager,
27 | ) : NetworkDataSource
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/LinksRepository.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository
11 |
12 | import com.hefengbao.jingmo.data.model.Link
13 |
14 | interface LinksRepository {
15 | fun list(): List
16 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/LinksRepositoryImpl.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository
11 |
12 | import com.hefengbao.jingmo.data.model.Link
13 | import javax.inject.Inject
14 |
15 | class LinksRepositoryImpl @Inject constructor() : LinksRepository {
16 | override fun list(): List {
17 | return listOf(
18 | Link(
19 | title = "智慧中小学",
20 | desc = "国家中小学智慧教育平台",
21 | url = "https://basic.smartedu.cn/"
22 | ),
23 | Link(
24 | title = "鲁迅博物馆",
25 | desc = "鲁迅说过这话吗?",
26 | url = "http://www.luxunmuseum.com.cn/cx/"
27 | ),
28 | Link(
29 | title = "中国大百科全书",
30 | desc = "第三版网络版",
31 | url = "https://www.zgbk.com"
32 | ),
33 | )
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/china/WorldCultureHeritageRepository.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.china
11 |
12 | import com.hefengbao.jingmo.data.database.entity.china.WorldCulturalHeritageEntity
13 | import kotlinx.coroutines.flow.Flow
14 |
15 | interface WorldCultureHeritageRepository {
16 | fun get(id: Int): Flow
17 | fun list(): Flow>
18 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/china/WorldCultureHeritageRepositoryImpl.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.china
11 |
12 | import com.hefengbao.jingmo.data.database.dao.ChinaWorldCulturalHeritageDao
13 | import com.hefengbao.jingmo.data.database.entity.china.WorldCulturalHeritageEntity
14 | import kotlinx.coroutines.flow.Flow
15 | import javax.inject.Inject
16 |
17 | class WorldCultureHeritageRepositoryImpl @Inject constructor(
18 | private val dao: ChinaWorldCulturalHeritageDao
19 | ) : WorldCultureHeritageRepository {
20 | override fun get(id: Int): Flow = dao.get(id)
21 |
22 | override fun list(): Flow> = dao.list()
23 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/chinese/ExpressionRepository.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.chinese
11 |
12 | import androidx.paging.PagingData
13 | import com.hefengbao.jingmo.data.database.entity.chinese.ExpressionCollectionEntity
14 | import com.hefengbao.jingmo.data.database.entity.chinese.ExpressionEntity
15 | import kotlinx.coroutines.flow.Flow
16 |
17 | interface ExpressionRepository {
18 | fun get(id: Int): Flow
19 | fun random(): Flow
20 | fun search(query: String): Flow>
21 | fun collections(): Flow>
22 | suspend fun collect(entity: ExpressionCollectionEntity)
23 | suspend fun uncollect(id: Int)
24 | fun isCollect(id: Int): Flow
25 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/chinese/IdiomRepository.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.chinese
11 |
12 | import androidx.paging.PagingData
13 | import com.hefengbao.jingmo.data.database.entity.chinese.IdiomCollectionEntity
14 | import com.hefengbao.jingmo.data.database.entity.chinese.IdiomEntity
15 | import kotlinx.coroutines.flow.Flow
16 |
17 | interface IdiomRepository {
18 | fun get(id: Int): Flow
19 | fun random(): Flow
20 | fun getNextId(id: Int): Flow
21 | fun getPrevId(id: Int): Flow
22 | fun list(): Flow>
23 | fun search(query: String): Flow>
24 | fun collections(): Flow>
25 | suspend fun collect(entity: IdiomCollectionEntity)
26 | suspend fun uncollect(id: Int)
27 | fun isCollect(id: Int): Flow
28 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/chinese/KnowledgeRepository.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.chinese
11 |
12 | import androidx.paging.PagingData
13 | import com.hefengbao.jingmo.data.database.entity.chinese.KnowledgeCollectionEntity
14 | import com.hefengbao.jingmo.data.database.entity.chinese.KnowledgeEntity
15 | import kotlinx.coroutines.flow.Flow
16 |
17 | interface KnowledgeRepository {
18 | suspend fun insert(entity: KnowledgeEntity)
19 | fun get(id: Int): Flow
20 | fun random(): Flow
21 | fun search(query: String): Flow>
22 | fun collections(): Flow>
23 | fun total(): Flow
24 | fun getNextId(id: Int): Flow
25 | fun getPrevId(id: Int): Flow
26 | fun isCollect(id: Int): Flow
27 | suspend fun collect(entity: KnowledgeCollectionEntity)
28 | suspend fun uncollect(id: Int)
29 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/chinese/LyricRepository.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.chinese
11 |
12 | import androidx.paging.PagingData
13 | import com.hefengbao.jingmo.data.database.entity.chinese.LyricCollectionEntity
14 | import com.hefengbao.jingmo.data.database.entity.chinese.LyricEntity
15 | import kotlinx.coroutines.flow.Flow
16 |
17 | interface LyricRepository {
18 | fun get(id: Int): Flow
19 | fun random(): Flow
20 | fun search(query: String): Flow>
21 | fun collections(): Flow>
22 | fun total(): Flow
23 | fun isCollect(id: Int): Flow
24 | fun prevId(id: Int): Flow
25 | fun nextId(id: Int): Flow
26 | suspend fun collect(entity: LyricCollectionEntity)
27 | suspend fun uncollect(id: Int)
28 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/chinese/ModernPoetryRepository.kt:
--------------------------------------------------------------------------------
1 | package com.hefengbao.jingmo.data.repository.chinese
2 |
3 | import androidx.paging.PagingData
4 | import com.hefengbao.jingmo.data.database.entity.chinese.ModernPoetryCollectionEntity
5 | import com.hefengbao.jingmo.data.database.entity.chinese.ModernPoetryEntity
6 | import kotlinx.coroutines.flow.Flow
7 |
8 | interface ModernPoetryRepository {
9 | suspend fun insert(entity: ModernPoetryEntity)
10 | fun get(id: Int): Flow
11 | fun random(): Flow
12 | fun search(query: String): Flow>
13 | fun collections(): Flow>
14 | fun total(): Flow
15 | fun prevId(id: Int): Flow
16 | fun nextId(id: Int): Flow
17 | fun isCollect(id: Int): Flow
18 | suspend fun collect(entity: ModernPoetryCollectionEntity)
19 | suspend fun uncollect(id: Int)
20 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/chinese/ProverbRepository.kt:
--------------------------------------------------------------------------------
1 | package com.hefengbao.jingmo.data.repository.chinese
2 |
3 | import androidx.paging.PagingData
4 | import com.hefengbao.jingmo.data.database.entity.chinese.ProverbCollectionEntity
5 | import com.hefengbao.jingmo.data.database.entity.chinese.ProverbEntity
6 | import kotlinx.coroutines.flow.Flow
7 |
8 | interface ProverbRepository {
9 | suspend fun insert(entity: ProverbEntity)
10 | fun get(id: Int): Flow
11 | fun random(): Flow
12 | fun search(query: String): Flow>
13 | fun collections(): Flow>
14 | fun total(): Flow
15 | fun prevId(id: Int): Flow
16 | fun nextId(id: Int): Flow
17 | fun isCollect(id: Int): Flow
18 | suspend fun collect(entity: ProverbCollectionEntity)
19 | suspend fun uncollect(id: Int)
20 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/chinese/QuoteRepository.kt:
--------------------------------------------------------------------------------
1 | package com.hefengbao.jingmo.data.repository.chinese
2 |
3 | import androidx.paging.PagingData
4 | import com.hefengbao.jingmo.data.database.entity.chinese.QuoteCollectionEntity
5 | import com.hefengbao.jingmo.data.database.entity.chinese.QuoteEntity
6 | import kotlinx.coroutines.flow.Flow
7 |
8 | interface QuoteRepository {
9 | suspend fun insert(entity: QuoteEntity)
10 | fun get(id: Int): Flow
11 | fun random(): Flow
12 | fun search(query: String): Flow>
13 | fun collections(): Flow>
14 | fun total(): Flow
15 | fun prevId(id: Int): Flow
16 | fun nextId(id: Int): Flow
17 | fun isCollect(id: Int): Flow
18 | suspend fun collect(entity: QuoteCollectionEntity)
19 | suspend fun uncollect(id: Int)
20 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/chinese/RiddleRepository.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.entity.chinese.RiddleEntity
13 | import kotlinx.coroutines.flow.Flow
14 |
15 | interface RiddleRepository {
16 | fun get(id: Int): Flow
17 | fun getNextId(id: Int): Flow
18 | fun getPrevId(id: Int): Flow
19 | fun random(): Flow
20 | fun search(query: String): Flow>
21 | suspend fun clear()
22 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/chinese/RiddleRepositoryImpl.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.dao.ChineseRiddleDao
13 | import com.hefengbao.jingmo.data.database.entity.chinese.RiddleEntity
14 | import kotlinx.coroutines.flow.Flow
15 | import javax.inject.Inject
16 |
17 | class RiddleRepositoryImpl @Inject constructor(
18 | private val dao: ChineseRiddleDao
19 | ) : RiddleRepository {
20 | override fun get(id: Int): Flow = dao.get(id)
21 |
22 | override fun getNextId(id: Int): Flow = dao.getNextId(id)
23 |
24 | override fun getPrevId(id: Int): Flow = dao.getPrevId(id)
25 |
26 | override fun random(): Flow = dao.random()
27 |
28 | override fun search(query: String): Flow> =
29 | dao.search("%$query%")
30 |
31 | override suspend fun clear() = dao.clear()
32 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/chinese/TongueTwisterRepository.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.entity.chinese.TongueTwisterEntity
13 | import kotlinx.coroutines.flow.Flow
14 |
15 | interface TongueTwisterRepository {
16 | fun get(id: Int): Flow
17 | fun getNextId(id: Int): Flow
18 | fun getPrevId(id: Int): Flow
19 | fun search(): Flow>
20 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/chinese/TongueTwisterRepositoryImpl.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.chinese
11 |
12 | import com.hefengbao.jingmo.data.database.dao.ChineseTongueTwisterDao
13 | import com.hefengbao.jingmo.data.database.entity.chinese.TongueTwisterEntity
14 | import kotlinx.coroutines.flow.Flow
15 | import javax.inject.Inject
16 |
17 | class TongueTwisterRepositoryImpl @Inject constructor(
18 | private val dao: ChineseTongueTwisterDao
19 | ) : TongueTwisterRepository {
20 | override fun get(id: Int): Flow = dao.get(id)
21 |
22 | override fun getNextId(id: Int): Flow = dao.getNextId(id)
23 |
24 | override fun getPrevId(id: Int): Flow = dao.getPrevId(id)
25 |
26 | override fun search(): Flow> =
27 | dao.list()
28 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/chinese/WisecrackRepository.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.chinese
11 |
12 | import androidx.paging.PagingData
13 | import com.hefengbao.jingmo.data.database.entity.chinese.WisecrackCollectionEntity
14 | import com.hefengbao.jingmo.data.database.entity.chinese.WisecrackEntity
15 | import kotlinx.coroutines.flow.Flow
16 |
17 | interface WisecrackRepository {
18 | fun get(id: Int): Flow
19 | fun random(): Flow
20 | fun getNextId(id: Int): Flow
21 | fun getPrevId(id: Int): Flow
22 | fun search(query: String): Flow>
23 | fun collections(): Flow>
24 | suspend fun collect(entity: WisecrackCollectionEntity)
25 | suspend fun uncollect(id: Int)
26 | fun isCollect(id: Int): Flow
27 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/classicalliterature/PeopleRepository.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.classicalliterature
11 |
12 | import com.hefengbao.jingmo.data.database.entity.classicalliterature.PeopleEntity
13 | import kotlinx.coroutines.flow.Flow
14 |
15 | interface PeopleRepository {
16 | fun random(): Flow
17 | fun get(id: Int): Flow
18 | fun getByName(name: String): Flow
19 | fun search(query: String): Flow>
20 | fun recommendList(): List
21 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/classicalliterature/SentenceRepository.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.classicalliterature
11 |
12 | import androidx.paging.PagingData
13 | import com.hefengbao.jingmo.data.database.entity.classicalliterature.SentenceCollectionEntity
14 | import com.hefengbao.jingmo.data.database.entity.classicalliterature.SentenceEntity
15 | import kotlinx.coroutines.flow.Flow
16 |
17 | interface SentenceRepository {
18 | fun get(id: Int): Flow
19 | fun random(): Flow
20 | fun getNextId(id: Int): Flow
21 | fun getPrevId(id: Int): Flow
22 | fun search(query: String): Flow>
23 | fun collections(): Flow>
24 | suspend fun collect(entity: SentenceCollectionEntity)
25 | suspend fun uncollect(id: Int)
26 | fun isCollect(id: Int): Flow
27 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/settings/ThemeRepository.kt:
--------------------------------------------------------------------------------
1 | package com.hefengbao.jingmo.data.repository.settings
2 |
3 | import com.hefengbao.jingmo.data.model.AppStatus
4 | import com.hefengbao.jingmo.data.model.theme.DarkThemeConfig
5 | import com.hefengbao.jingmo.data.model.theme.ThemeBrand
6 | import kotlinx.coroutines.flow.Flow
7 |
8 | interface ThemeRepository {
9 | val appStatus: Flow
10 |
11 | /**
12 | * Sets the desired theme brand.
13 | */
14 | suspend fun setThemeBrand(themeBrand: ThemeBrand)
15 |
16 | /**
17 | * Sets the desired dark theme config.
18 | */
19 | suspend fun setDarkThemeConfig(darkThemeConfig: DarkThemeConfig)
20 |
21 | /**
22 | * Sets the preferred dynamic color config.
23 | */
24 | suspend fun setDynamicColorPreference(useDynamicColor: Boolean)
25 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/settings/ThemeRepositoryImpl.kt:
--------------------------------------------------------------------------------
1 | package com.hefengbao.jingmo.data.repository.settings
2 |
3 | import com.hefengbao.jingmo.data.datastore.AppPreference
4 | import com.hefengbao.jingmo.data.model.AppStatus
5 | import com.hefengbao.jingmo.data.model.theme.DarkThemeConfig
6 | import com.hefengbao.jingmo.data.model.theme.ThemeBrand
7 | import kotlinx.coroutines.flow.Flow
8 | import javax.inject.Inject
9 |
10 | class ThemeRepositoryImpl @Inject constructor(
11 | private val preference: AppPreference
12 | ) : ThemeRepository {
13 | override val appStatus: Flow
14 | get() = preference.appStatus
15 |
16 | override suspend fun setThemeBrand(themeBrand: ThemeBrand) =
17 | preference.setThemeBrand(themeBrand)
18 |
19 | override suspend fun setDarkThemeConfig(darkThemeConfig: DarkThemeConfig) =
20 | preference.setDarkThemeConfig(darkThemeConfig)
21 |
22 | override suspend fun setDynamicColorPreference(useDynamicColor: Boolean) =
23 | preference.setUseDynamicColor(useDynamicColor)
24 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hefengbao/jingmo/data/repository/traditionalculture/ColorRepository.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of the 京墨(jingmo)APP.
3 | *
4 | * (c) 贺丰宝(hefengbao)
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | package com.hefengbao.jingmo.data.repository.traditionalculture
11 |
12 | import com.hefengbao.jingmo.data.model.traditionalculture.Color
13 |
14 | interface ColorRepository {
15 | fun list(): List