Skip to content

Commit

Permalink
冷启动默认tab
Browse files Browse the repository at this point in the history
  • Loading branch information
15dd committed Oct 7, 2024
1 parent fa24859 commit efa8cdf
Show file tree
Hide file tree
Showing 58 changed files with 486 additions and 103 deletions.
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2024 15dd

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
> 本软件是轻小说文库的第三方客户端,与轻小说文库官方无关,本软件数据全部来自[轻小说文库](https://www.wenku8.cc)\
> 支持的安卓版本:Android 7+ (API 24+)
> [!WARNING]\
> 使用本软件时,建议使用中国的ip访问
> [!NOTE]\
> 觉得好用别忘了star哦,你的star是对我最大的激励\
> 欢迎加入[Telegram交流群](https://t.me/+JH2H3VpET7ozMTU9),一起讨论本软件的功能,使用体验等
Expand Down
10 changes: 5 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ android {

defaultConfig {
applicationId = "com.cyh128.hikari_novel"
minSdk = 25
minSdk = 24
targetSdk = 34
versionCode = 241001
versionName = "3.0.0"
versionCode = 241007
versionName = "3.1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -84,8 +84,8 @@ dependencies {
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.recyclerview:recyclerview:1.3.2")
implementation("androidx.viewpager2:viewpager2:1.1.0")
implementation("androidx.navigation:navigation-fragment-ktx:2.8.1")
implementation("androidx.navigation:navigation-ui-ktx:2.8.1")
implementation("androidx.navigation:navigation-fragment-ktx:2.8.2")
implementation("androidx.navigation:navigation-ui-ktx:2.8.2")

//数据库
implementation("androidx.room:room-ktx:2.6.1")
Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
Binary file modified app/release/baselineProfiles/0/app-release.dm
Binary file not shown.
Binary file modified app/release/baselineProfiles/1/app-release.dm
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 241001,
"versionName": "3.0.0",
"versionCode": 241007,
"versionName": "3.1.0",
"outputFile": "app-release.apk"
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "074c1196e614f61ed2fcb76be1af54fe",
"entities": [
{
"tableName": "horizontal_read_history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cid` TEXT NOT NULL, `aid` TEXT NOT NULL, `volume` INTEGER NOT NULL, `chapter` INTEGER NOT NULL, `location` INTEGER NOT NULL, `progress_percent` INTEGER NOT NULL, `is_latest` INTEGER NOT NULL, PRIMARY KEY(`cid`))",
"fields": [
{
"fieldPath": "cid",
"columnName": "cid",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "aid",
"columnName": "aid",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "volume",
"columnName": "volume",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapter",
"columnName": "chapter",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "location",
"columnName": "location",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "progressPercent",
"columnName": "progress_percent",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isLatest",
"columnName": "is_latest",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"cid"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '074c1196e614f61ed2fcb76be1af54fe')"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "3e54711b8b4cccdba4b54b850ccf1302",
"entities": [
{
"tableName": "vertical_read_history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cid` TEXT NOT NULL, `aid` TEXT NOT NULL, `volume` INTEGER NOT NULL, `chapter` INTEGER NOT NULL, `location` INTEGER NOT NULL, `progress_percent` INTEGER NOT NULL, `is_latest` INTEGER NOT NULL, PRIMARY KEY(`cid`))",
"fields": [
{
"fieldPath": "cid",
"columnName": "cid",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "aid",
"columnName": "aid",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "volume",
"columnName": "volume",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "chapter",
"columnName": "chapter",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "location",
"columnName": "location",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "progressPercent",
"columnName": "progress_percent",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isLatest",
"columnName": "is_latest",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"cid"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '3e54711b8b4cccdba4b54b850ccf1302')"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "e54553c00436bf9f275a0f17161eb0f5",
"entities": [
{
"tableName": "search_history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`keyword` TEXT NOT NULL, PRIMARY KEY(`keyword`))",
"fields": [
{
"fieldPath": "keyword",
"columnName": "keyword",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"keyword"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'e54553c00436bf9f275a0f17161eb0f5')"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "783eff35ce7697cbd13712af6331f9c9",
"entities": [
{
"tableName": "visit_history",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`aid` TEXT NOT NULL, `title` TEXT NOT NULL, `img` TEXT NOT NULL, `time` TEXT NOT NULL, PRIMARY KEY(`aid`))",
"fields": [
{
"fieldPath": "aid",
"columnName": "aid",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "img",
"columnName": "img",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "time",
"columnName": "time",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"aid"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '783eff35ce7697cbd13712af6331f9c9')"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ExampleInstrumentedTest {
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.cyh128.hikarinovel", appContext.packageName)
assertEquals("com.cyh128.hikari_novel", appContext.packageName)
}

}
8 changes: 4 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
android:name=".ui.view.splash.LoginActivity"
android:windowSoftInputMode="adjustPan"/>

<activity android:name=".ui.view.main.main.more.more.account.AccountActivity"/>
<activity android:name=".ui.view.main.more.more.account.AccountActivity"/>

<activity android:name=".ui.view.main.main.more.more.about.AboutActivity"/>
<activity android:name=".ui.view.main.more.more.about.AboutActivity"/>

<activity
android:name=".ui.view.main.MainActivity"
Expand All @@ -47,11 +47,11 @@

<activity android:name=".ui.view.detail.comment.CommentActivity"/>

<activity android:name=".ui.view.main.main.more.more.setting.SettingActivity" />
<activity android:name=".ui.view.main.more.more.setting.SettingActivity" />

<activity android:name=".ui.view.other.PhotoViewActivity"/>

<activity android:name=".ui.view.main.main.home.search.SearchActivity"/>
<activity android:name=".ui.view.main.home.search.SearchActivity"/>

<activity android:name=".ui.view.read.vertical.ReadActivity"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.cyh128.hikarinovel.data.model

enum class DefaultTab {
Home,
Bookshelf,
History,
More
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.cyh128.hikarinovel.data.repository
import android.accounts.NetworkErrorException
import android.content.pm.PackageManager
import com.cyh128.hikarinovel.HikariApp
import com.cyh128.hikarinovel.data.model.DefaultTab
import com.cyh128.hikarinovel.data.model.Language
import com.cyh128.hikarinovel.data.model.ReaderOrientation
import com.cyh128.hikarinovel.data.source.local.mmkv.AppConfig
Expand Down Expand Up @@ -55,6 +56,12 @@ class AppRepository @Inject constructor(
appConfig.language = language.ordinal
}

fun getDefaultTab() = enumValues<DefaultTab>()[appConfig.defaultTab]

fun setDefaultTab(defaultTab: DefaultTab) {
appConfig.defaultTab = defaultTab.ordinal
}

//检查更新
suspend fun checkUpdate(): Result<Boolean> {
network.getData("https://api.github.com/repos/15dd/wenku8reader/releases/latest")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.cyh128.hikarinovel.data.source.local.mmkv

import com.cyh128.hikarinovel.data.model.DefaultTab
import com.cyh128.hikarinovel.data.model.Language
import com.cyh128.hikarinovel.data.model.ReaderOrientation
import com.tencent.mmkv.MMKV
Expand Down Expand Up @@ -46,4 +47,10 @@ class AppConfig @Inject constructor() {
set(value) {
cursor.encode("language", value)
}

var defaultTab: Int
get() = cursor.decodeInt("default_tab", DefaultTab.Home.ordinal)
set(value) {
cursor.encode("default_tab", value)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.cyh128.hikarinovel.data.model.ReadParcel
import com.cyh128.hikarinovel.data.model.ReaderOrientation
import com.cyh128.hikarinovel.databinding.ActivityNovelInfoBinding
import com.cyh128.hikarinovel.ui.view.detail.comment.CommentActivity
import com.cyh128.hikarinovel.ui.view.main.main.home.search.SearchActivity
import com.cyh128.hikarinovel.ui.view.main.home.search.SearchActivity
import com.cyh128.hikarinovel.ui.view.other.PhotoViewActivity
import com.cyh128.hikarinovel.util.launchWithLifecycle
import com.cyh128.hikarinovel.util.openUrl
Expand Down
Loading

0 comments on commit efa8cdf

Please sign in to comment.