Compare commits
407 Commits
preview-175
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 509ace1a38 | |||
| 170358f88e | |||
| 5c14879c12 | |||
| 1682962703 | |||
| a1daf53188 | |||
| b0bdee8c72 | |||
| 72c091d317 | |||
| 1cc796a62e | |||
| cd40c0fb32 | |||
| 88edd18d02 | |||
| ba9d010f78 | |||
| 1ed375968e | |||
| 9e525515ea | |||
| bd7201cfb9 | |||
| d9ca2b69e8 | |||
| 925fb118af | |||
| 4552221020 | |||
| 24b66b7030 | |||
| 58decd076c | |||
| a7d93ae751 | |||
| d225b7c586 | |||
| 4c51d01236 | |||
| 4d46e84f54 | |||
| af51607053 | |||
| 1c8e6dcd6f | |||
| 7a398dabba | |||
| b7fcf7ccda | |||
| acbda604cc | |||
| 97f3dd3b25 | |||
| 60758f89ed | |||
| e96895345e | |||
| eec1236b8b | |||
| ee1e783126 | |||
| f3ab39cb1f | |||
| ba75395648 | |||
| fe0b14ab97 | |||
| 91d2140288 | |||
| 0417969dd6 | |||
| 5d8d2ce48a | |||
| b15277f134 | |||
| 76ca27f681 | |||
| 56923c76d4 | |||
| 32e19736b9 | |||
| 11b01b2771 | |||
| 460ff13e54 | |||
| 57f77c8105 | |||
| a2eb22964a | |||
| 7158bae26a | |||
| 807ce846d5 | |||
| 0b68f2c62a | |||
| b7d6cc8dd0 | |||
| 8b1fd30902 | |||
| aff43f3aeb | |||
| 0047d2e5d8 | |||
| d87385f5b3 | |||
| c17e9573b7 | |||
| 9c01119d24 | |||
| bbc839e234 | |||
| 917f20894b | |||
| 3a3b719b8b | |||
| 1903437ecf | |||
| 5c26bb3a52 | |||
| 07599ade3a | |||
| 0a9f36402b | |||
| d2b325cd02 | |||
| cdc64aceb7 | |||
| 4bfd6e4026 | |||
| 50eebdf7d3 | |||
| f843de28d7 | |||
| d250a9a680 | |||
| 4130db3920 | |||
| f2cbff04ab | |||
| 061e9359e8 | |||
| 73258e9e05 | |||
| 73e4982ffb | |||
| 185cd923c0 | |||
| 3cfc53bf11 | |||
| 1301acfdb7 | |||
| 9d9dbea48d | |||
| c1df3eb1d0 | |||
| 3154c97aee | |||
| ffe1b160de | |||
| 23272375b7 | |||
| 863b6ee784 | |||
| c4c8d4b9c3 | |||
| b2bbbca585 | |||
| df3b879cf6 | |||
| 47c4f2cc8c | |||
| 905a1c1230 | |||
| bcaf7f6415 | |||
| 4639b3ecc3 | |||
| 2034971cc0 | |||
| bb8698b2a6 | |||
| cd69b09dd0 | |||
| 462b2164e8 | |||
| fb1a4ad828 | |||
| 3bd89cee26 | |||
| 6f43e98fff | |||
| 6feeb4b1ee | |||
| fcfe750fcf | |||
| 6e314e3643 | |||
| 487ca49c11 | |||
| 698abe8667 | |||
| 13c9daf9a9 | |||
| eb21454d6d | |||
| 56347e6d52 | |||
| 5c085a36e8 | |||
| 65ab676946 | |||
| 1f51569a35 | |||
| b0d6e16ca3 | |||
| 85cf54ccc8 | |||
| 602df5a729 | |||
| c8102836ce | |||
| e641575941 | |||
| 83afcee4d1 | |||
| 2102e0594e | |||
| 14c91da6b3 | |||
| 46c1c6463a | |||
| 89a521b836 | |||
| 65c6ed21ab | |||
| 1b911e7e15 | |||
| 0535e41051 | |||
| 3fc802f837 | |||
| 976b5cc03e | |||
| a9fe971337 | |||
| 5d1dbcb390 | |||
| 8d11ef3244 | |||
| 724a61f513 | |||
| 724c774dc9 | |||
| 29e0b2e4a5 | |||
| 2776e41127 | |||
| af1f77418f | |||
| c1df5da062 | |||
| f8f645772d | |||
| b1e6fa65d6 | |||
| 01e8c6cc12 | |||
| b4668c6829 | |||
| 08d6c604bc | |||
| 02cec06535 | |||
| ebdb3f7478 | |||
| 3724d79825 | |||
| c3e2eb6672 | |||
| fa91695add | |||
| e7786bd16f | |||
| 3d70476b9f | |||
| e74e0de8f5 | |||
| a2f552d6d2 | |||
| a6bd0bbd2a | |||
| fd42bba188 | |||
| a0ec735066 | |||
| 89f5fce19d | |||
| bf711a995c | |||
| d977614b7a | |||
| d282df6973 | |||
| db5b3a69cc | |||
| c70c5dff25 | |||
| 25ace80419 | |||
| b8b468cea7 | |||
| 0ffc798e9a | |||
| ad5a76741a | |||
| 003c5ad39a | |||
| 582d0ef121 | |||
| 5566db160b | |||
| 6fb6838656 | |||
| 1e5d490c22 | |||
| 276aeb0f59 | |||
| c62d9d1446 | |||
| 4ff18364d9 | |||
| 6c8e4e951a | |||
| dc1fde628d | |||
| 241b70e5ce | |||
| 64c755ddf3 | |||
| 3ae6c0131b | |||
| e3b43de298 | |||
| 02ff6b4e2f | |||
| ee8379b12a | |||
| 20e1cc0a7d | |||
| 78b434e794 | |||
| 52c8b260e0 | |||
| cccdc99977 | |||
| ca15d2ccc5 | |||
| b7b0ffc885 | |||
| f1a57749c4 | |||
| 26d6c09d21 | |||
| 088e3b6800 | |||
| c8ee2dbff4 | |||
| 835a21b426 | |||
| 8d67c87639 | |||
| 73cd25e8ba | |||
| e9ed861f00 | |||
| e7c1d4deef | |||
| b8eb75fc68 | |||
| 3d34f3dd2f | |||
| 01dc277877 | |||
| b809ae5c6f | |||
| 4c563122f8 | |||
| 4c1124fdb0 | |||
| bdbaecd975 | |||
| 2b8641c1dd | |||
| f1a90000b2 | |||
| 3bd0f0b447 | |||
| cb5b618266 | |||
| c71c07690a | |||
| d85d77da01 | |||
| 164d7bc70f | |||
| db51b09f80 | |||
| 5f8d03ba9b | |||
| 4cae7b27a6 | |||
| edcf939611 | |||
| 208d291b3c | |||
| 19f049189a | |||
| c855276555 | |||
| 9e244e0889 | |||
| bf7a067908 | |||
| 67c4b71b88 | |||
| 1fa8a86cce | |||
| 73eb98960f | |||
| 59704221b7 | |||
| 19c23943ec | |||
| d068559dee | |||
| 8e6b5b8bee | |||
| c99ddbe10f | |||
| 23925c4ba6 | |||
| e71f0afd99 | |||
| 014bf97248 | |||
| fc0d666366 | |||
| eb7465e6f9 | |||
| ff6ad20a77 | |||
| 17c528a206 | |||
| 63f4034a7f | |||
| 6c1bfc2177 | |||
| 45ff1f06ba | |||
| 3e287a593a | |||
| 01420154be | |||
| 1e4c596d0e | |||
| 26cb2bbbd1 | |||
| 588db79a64 | |||
| e5aaf3b31f | |||
| 9c222b128b | |||
| c66e08d43e | |||
| 493d8fc45f | |||
| 47993cb55d | |||
| 4701cbea23 | |||
| 70efd6f2bf | |||
| b85b6a713c | |||
| 6291529a10 | |||
| 160907ab52 | |||
| bccd30a80f | |||
| ef4d3e6c4d | |||
| 4fe7a1375a | |||
| 02bc195068 | |||
| 1e20913237 | |||
| 48b488fa59 | |||
| 893f3b2e34 | |||
| 25be12852f | |||
| 4f0292b000 | |||
| f669fd9205 | |||
| c3e0646b61 | |||
| 0d2cad8693 | |||
| 237916a37b | |||
| 16653f9585 | |||
| 392b1009c9 | |||
| 10c184e58a | |||
| f6b8756dc0 | |||
| f2654807a4 | |||
| ab90b75d73 | |||
| 0b58a081af | |||
| ae98a5fe58 | |||
| 74fa4e3503 | |||
| c20b0f67a8 | |||
| 098c7196de | |||
| 99a25560c1 | |||
| 79d19a2d8b | |||
| 061d0809bd | |||
| 0ce0c45cc7 | |||
| e910362b16 | |||
| 96c05bf113 | |||
| 6d2bda5c9d | |||
| 4a080fba3f | |||
| ac5b3b164f | |||
| c43d7dbb31 | |||
| d218fdfcf4 | |||
| e59af2fd1f | |||
| 3d761b5bf4 | |||
| 1892101359 | |||
| d76d25379e | |||
| c96cf4b11a | |||
| 31601f523d | |||
| f9abe20b84 | |||
| f7030ed800 | |||
| f4173b3766 | |||
| 221a564644 | |||
| 7458eff2d8 | |||
| 187245885a | |||
| e5d8c2edbc | |||
| be4aa39c8a | |||
| 014c697773 | |||
| ea733de80e | |||
| 3ac5dcd66e | |||
| 054de1cc6f | |||
| b525c0988a | |||
| 691efe0831 | |||
| 8317a30d6e | |||
| 633937b0bc | |||
| 3152d2803a | |||
| 883c90adc8 | |||
| 8e658be7d7 | |||
| c27a4e2bf5 | |||
| 257f544a89 | |||
| f8cb08ce52 | |||
| d970eea7cf | |||
| a45fad81c8 | |||
| 76d6cf129a | |||
| 879427446f | |||
| 9edd7b0c04 | |||
| d97b83fe93 | |||
| 027e6bbb05 | |||
| 4cdead8006 | |||
| aaff472317 | |||
| 9b2febcd6d | |||
| 5de355238d | |||
| 644c8ec491 | |||
| 4b516ae4c5 | |||
| 223251f868 | |||
| 9b7d6bace1 | |||
| c15b8b65e5 | |||
| 4e9eaa5e81 | |||
| 066e10246f | |||
| 3294dd6ca8 | |||
| 2315295985 | |||
| 56ddf21107 | |||
| 3f47df21b8 | |||
| 712407f524 | |||
| 3a49a0a21a | |||
| 04b3e13ba1 | |||
| 39bc2b49c0 | |||
| 9765282640 | |||
| 320a620afa | |||
| ec2a720617 | |||
| 83d2ca7a54 | |||
| 891503c793 | |||
| 43abc6c797 | |||
| f916e94a4c | |||
| fc9b2b6e1e | |||
| 66bdd70485 | |||
| 29024ea03a | |||
| 6af33905be | |||
| f97d918728 | |||
| 6a38e501d9 | |||
| 8310733c4c | |||
| 28f0946877 | |||
| e135a0dc71 | |||
| 05a65773f0 | |||
| 8d794560a0 | |||
| 4341a98413 | |||
| 24f5a36350 | |||
| f125db6973 | |||
| 4ec969657e | |||
| cb7e790086 | |||
| 9012dafed4 | |||
| 8b24d7eded | |||
| dcc537accb | |||
| ab67775f13 | |||
| e105828e07 | |||
| 3c83edaad2 | |||
| b4f278e5fa | |||
| 29ca687a26 | |||
| ed975cae63 | |||
| 4fce0944b4 | |||
| 4a52898f08 | |||
| 92b48319ed | |||
| 9e113d80f7 | |||
| f960554cf8 | |||
| 0bdea705a5 | |||
| 33361ea7f6 | |||
| 717240f53c | |||
| 5156248a96 | |||
| e074df469e | |||
| d1277ecb02 | |||
| 8bcc235490 | |||
| aaa7171c10 | |||
| 887311b440 | |||
| 1c90aac059 | |||
| 3ad9765dcf | |||
| cc934607c8 | |||
| 5074e68b9c | |||
| ade41f113d | |||
| 95dc82594f | |||
| 80e585fa91 | |||
| 9f110f9db8 | |||
| 71470b9e02 | |||
| 4fd24accac | |||
| 31312fecac | |||
| b80d057922 | |||
| f01d8bc835 | |||
| ddffe71a22 | |||
| 649a19ec57 | |||
| e82fd99a09 | |||
| 67a9b8e2a0 | |||
| 2000f947c3 | |||
| f992ada0a8 | |||
| f876cdb037 | |||
| f919d42370 | |||
| ab5ff00c39 | |||
| 422738af56 | |||
| 81751fc9ce | |||
| 9b6c5effc9 |
+6
-3
@@ -7,7 +7,7 @@ indent_style = space
|
|||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
[*.{xml,sq,sqm}]
|
[*.{xml,sq,sqm,aidl}]
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
# noinspection EditorConfigKeyCorrectness
|
# noinspection EditorConfigKeyCorrectness
|
||||||
@@ -23,9 +23,14 @@ ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
|
|||||||
ktlint_code_style = intellij_idea
|
ktlint_code_style = intellij_idea
|
||||||
ktlint_function_naming_ignore_when_annotated_with = Composable
|
ktlint_function_naming_ignore_when_annotated_with = Composable
|
||||||
ktlint_standard_class-signature = disabled
|
ktlint_standard_class-signature = disabled
|
||||||
|
ktlint_standard_comment-wrapping = disabled
|
||||||
ktlint_standard_discouraged-comment-location = disabled
|
ktlint_standard_discouraged-comment-location = disabled
|
||||||
ktlint_standard_function-expression-body = disabled
|
ktlint_standard_function-expression-body = disabled
|
||||||
ktlint_standard_function-signature = disabled
|
ktlint_standard_function-signature = disabled
|
||||||
|
ktlint_standard_type-argument-comment = disabled
|
||||||
|
ktlint_standard_type-parameter-comment = disabled
|
||||||
|
ktlint_standard_blank-line-between-when-conditions = disabled
|
||||||
|
|
||||||
# SY
|
# SY
|
||||||
ktlint_standard_filename = disabled
|
ktlint_standard_filename = disabled
|
||||||
ktlint_standard_argument-list-wrapping = disabled
|
ktlint_standard_argument-list-wrapping = disabled
|
||||||
@@ -33,8 +38,6 @@ ktlint_standard_function-naming = disabled
|
|||||||
ktlint_standard_property-naming = disabled
|
ktlint_standard_property-naming = disabled
|
||||||
ktlint_standard_multiline-expression-wrapping = disabled
|
ktlint_standard_multiline-expression-wrapping = disabled
|
||||||
ktlint_standard_string-template-indent = disabled
|
ktlint_standard_string-template-indent = disabled
|
||||||
ktlint_standard_comment-wrapping = disabled
|
|
||||||
ktlint_standard_max-line-length = disabled
|
ktlint_standard_max-line-length = disabled
|
||||||
ktlint_standard_type-argument-comment = disabled
|
|
||||||
ktlint_standard_value-argument-comment = disabled
|
ktlint_standard_value-argument-comment = disabled
|
||||||
ktlint_standard_value-parameter-comment = disabled
|
ktlint_standard_value-parameter-comment = disabled
|
||||||
@@ -100,5 +100,5 @@ body:
|
|||||||
required: true
|
required: true
|
||||||
- label: I have filled out all of the requested information in this form, including specific version numbers.
|
- label: I have filled out all of the requested information in this form, including specific version numbers.
|
||||||
required: true
|
required: true
|
||||||
- label: I understand that **Mihon does not have or fix any extensions**, and I **will not receive help** for any issues related to sources or extensions.
|
- label: I understand that **TachiyomiSY does not have or fix any extensions**, and I **will not receive help** for any issues related to sources or extensions.
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
@@ -12,22 +12,22 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clone repo
|
- name: Clone repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up JDK
|
- name: Set up JDK
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
java-version: 17
|
java-version: 17
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
|
|
||||||
- name: Set up gradle
|
- name: Set up gradle
|
||||||
uses: gradle/actions/setup-gradle@v4
|
uses: gradle/actions/setup-gradle@v5
|
||||||
|
|
||||||
- name: Build app
|
- name: Build app
|
||||||
run: ./gradlew spotlessCheck assembleDevDebug
|
run: ./gradlew spotlessCheck assembleDevDebug
|
||||||
|
|
||||||
- name: Upload APK
|
- name: Upload APK
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: TachiyomiSY-${{ github.sha }}.apk
|
name: TachiyomiSY-${{ github.sha }}.apk
|
||||||
path: app/build/outputs/apk/dev/debug/app-dev-debug.apk
|
path: app/build/outputs/apk/dev/debug/app-dev-debug.apk
|
||||||
|
|||||||
@@ -15,20 +15,20 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clone repo
|
- name: Clone repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
run: |
|
run: |
|
||||||
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.3"
|
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.3"
|
||||||
|
|
||||||
- name: Set up JDK
|
- name: Set up JDK
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
java-version: 17
|
java-version: 17
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
|
|
||||||
- name: Set up gradle
|
- name: Set up gradle
|
||||||
uses: gradle/actions/setup-gradle@v4
|
uses: gradle/actions/setup-gradle@v5
|
||||||
|
|
||||||
# SY -->
|
# SY -->
|
||||||
- name: Write google-services.json
|
- name: Write google-services.json
|
||||||
@@ -71,24 +71,10 @@ jobs:
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
mv app/build/outputs/apk/standard/release/app-standard-universal-release-unsigned-signed.apk TachiyomiSY.apk
|
mv app/build/outputs/apk/standard/release/app-standard-universal-release-unsigned-signed.apk TachiyomiSY.apk
|
||||||
sha=`sha256sum TachiyomiSY.apk | awk '{ print $1 }'`
|
|
||||||
echo "APK_UNIVERSAL_SHA=$sha" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
mv app/build/outputs/apk/standard/release/app-standard-arm64-v8a-release-unsigned-signed.apk TachiyomiSY-arm64-v8a.apk
|
mv app/build/outputs/apk/standard/release/app-standard-arm64-v8a-release-unsigned-signed.apk TachiyomiSY-arm64-v8a.apk
|
||||||
sha=`sha256sum TachiyomiSY-arm64-v8a.apk | awk '{ print $1 }'`
|
|
||||||
echo "APK_ARM64_V8A_SHA=$sha" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
mv app/build/outputs/apk/standard/release/app-standard-armeabi-v7a-release-unsigned-signed.apk TachiyomiSY-armeabi-v7a.apk
|
mv app/build/outputs/apk/standard/release/app-standard-armeabi-v7a-release-unsigned-signed.apk TachiyomiSY-armeabi-v7a.apk
|
||||||
sha=`sha256sum TachiyomiSY-armeabi-v7a.apk | awk '{ print $1 }'`
|
|
||||||
echo "APK_ARMEABI_V7A_SHA=$sha" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
mv app/build/outputs/apk/standard/release/app-standard-x86-release-unsigned-signed.apk TachiyomiSY-x86.apk
|
mv app/build/outputs/apk/standard/release/app-standard-x86-release-unsigned-signed.apk TachiyomiSY-x86.apk
|
||||||
sha=`sha256sum TachiyomiSY-x86.apk | awk '{ print $1 }'`
|
|
||||||
echo "APK_X86_SHA=$sha" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
mv app/build/outputs/apk/standard/release/app-standard-x86_64-release-unsigned-signed.apk TachiyomiSY-x86_64.apk
|
mv app/build/outputs/apk/standard/release/app-standard-x86_64-release-unsigned-signed.apk TachiyomiSY-x86_64.apk
|
||||||
sha=`sha256sum TachiyomiSY-x86_64.apk | awk '{ print $1 }'`
|
|
||||||
echo "APK_X86_64_SHA=$sha" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
@@ -96,19 +82,10 @@ jobs:
|
|||||||
tag_name: ${{ github.run_number }}
|
tag_name: ${{ github.run_number }}
|
||||||
name: TachiyomiSY
|
name: TachiyomiSY
|
||||||
body: |
|
body: |
|
||||||
---
|
<!-->
|
||||||
|
> [!TIP]
|
||||||
### Checksums
|
>
|
||||||
|
> ### If you are unsure which version to download then go with `TachiyomiSY.apk`
|
||||||
| Variant | SHA-256 |
|
|
||||||
| ------- | ------- |
|
|
||||||
| Universal | ${{ env.APK_UNIVERSAL_SHA }} |
|
|
||||||
| arm64-v8a | ${{ env.APK_ARM64_V8A_SHA }} |
|
|
||||||
| armeabi-v7a | ${{ env.APK_ARMEABI_V7A_SHA }} |
|
|
||||||
| x86 | ${{ env.APK_X86_SHA }} |
|
|
||||||
| x86_64 | ${{ env.APK_X86_64_SHA }} |
|
|
||||||
|
|
||||||
## If you are unsure which version to choose then go with TachiyomiSY.apk
|
|
||||||
files: |
|
files: |
|
||||||
TachiyomiSY.apk
|
TachiyomiSY.apk
|
||||||
TachiyomiSY-arm64-v8a.apk
|
TachiyomiSY-arm64-v8a.apk
|
||||||
|
|||||||
@@ -12,16 +12,16 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Clone repo
|
- name: Clone repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up JDK
|
- name: Set up JDK
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v5
|
||||||
with:
|
with:
|
||||||
java-version: 17
|
java-version: 17
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
|
|
||||||
- name: Set up gradle
|
- name: Set up gradle
|
||||||
uses: gradle/actions/setup-gradle@v4
|
uses: gradle/actions/setup-gradle@v5
|
||||||
|
|
||||||
- name: Create Tag
|
- name: Create Tag
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check PR and Add Label
|
- name: Check PR and Add Label
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const prAuthor = context.payload.pull_request.user.login;
|
const prAuthor = context.payload.pull_request.user.login;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ Additional features for some extensions, features include custom description, op
|
|||||||
* Mangadex
|
* Mangadex
|
||||||
* NHentai
|
* NHentai
|
||||||
* Puruin
|
* Puruin
|
||||||
* Tsumino
|
* LANraragi
|
||||||
|
|
||||||
## Download
|
## Download
|
||||||
Get the app from our [releases page](https://github.com/jobobby04/tachiyomisy/releases/latest).
|
Get the app from our [releases page](https://github.com/jobobby04/tachiyomisy/releases/latest).
|
||||||
|
|||||||
+110
-89
@@ -1,16 +1,19 @@
|
|||||||
@file:Suppress("ChromeOsAbiSupport")
|
|
||||||
|
|
||||||
import mihon.buildlogic.getBuildTime
|
import mihon.gradle.getBuildTime
|
||||||
import mihon.buildlogic.getCommitCount
|
import mihon.gradle.getLatestCommitCount
|
||||||
import mihon.buildlogic.getGitSha
|
import mihon.gradle.getLatestCommitSha
|
||||||
|
import mihon.gradle.tasks.ReplaceShortcutsPlaceholderTask
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("mihon.android.application")
|
alias(mihonx.plugins.android.application)
|
||||||
id("mihon.android.application.compose")
|
alias(mihonx.plugins.compose)
|
||||||
|
alias(mihonx.plugins.spotless)
|
||||||
|
|
||||||
kotlin("plugin.parcelize")
|
kotlin("plugin.parcelize")
|
||||||
kotlin("plugin.serialization")
|
|
||||||
// id("com.github.zellius.shortcut-helper")
|
|
||||||
alias(libs.plugins.aboutLibraries)
|
alias(libs.plugins.aboutLibraries)
|
||||||
|
alias(libs.plugins.kotlin.serialization)
|
||||||
|
|
||||||
id("com.github.ben-manes.versions")
|
id("com.github.ben-manes.versions")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,42 +24,26 @@ if (gradle.startParameter.taskRequests.toString().contains("Standard")) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// shortcutHelper.setFilePath("./shortcuts.xml")
|
|
||||||
|
|
||||||
val supportedAbis = setOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "eu.kanade.tachiyomi"
|
namespace = "eu.kanade.tachiyomi"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "eu.kanade.tachiyomi.sy"
|
applicationId = "eu.kanade.tachiyomi.sy"
|
||||||
|
|
||||||
versionCode = 74
|
versionCode = 77
|
||||||
versionName = "1.12.0"
|
versionName = "1.12.0"
|
||||||
|
|
||||||
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
|
buildConfigField("String", "COMMIT_COUNT", "\"${getLatestCommitCount()}\"")
|
||||||
buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"")
|
buildConfigField("String", "COMMIT_SHA", "\"${getLatestCommitSha()}\"")
|
||||||
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime(useLastCommitTime = false)}\"")
|
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime(useLatestCommitTime = false)}\"")
|
||||||
buildConfigField("boolean", "INCLUDE_UPDATER", "false")
|
buildConfigField("boolean", "INCLUDE_UPDATER", "false")
|
||||||
|
|
||||||
ndk {
|
|
||||||
abiFilters += supportedAbis
|
|
||||||
}
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
splits {
|
|
||||||
abi {
|
|
||||||
isEnable = true
|
|
||||||
reset()
|
|
||||||
include(*supportedAbis.toTypedArray())
|
|
||||||
isUniversalApk = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
named("debug") {
|
named("debug") {
|
||||||
versionNameSuffix = "-${getCommitCount()}"
|
versionNameSuffix = "-${getLatestCommitCount()}"
|
||||||
applicationIdSuffix = ".debug"
|
applicationIdSuffix = ".debug"
|
||||||
isPseudoLocalesEnabled = true
|
isPseudoLocalesEnabled = true
|
||||||
}
|
}
|
||||||
@@ -72,7 +59,7 @@ android {
|
|||||||
isShrinkResources = true
|
isShrinkResources = true
|
||||||
setProguardFiles(listOf(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"))
|
setProguardFiles(listOf(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"))
|
||||||
|
|
||||||
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime(useLastCommitTime = true)}\"")
|
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime(useLatestCommitTime = true)}\"")
|
||||||
}
|
}
|
||||||
create("benchmark") {
|
create("benchmark") {
|
||||||
initWith(getByName("release"))
|
initWith(getByName("release"))
|
||||||
@@ -90,6 +77,15 @@ android {
|
|||||||
getByName("benchmark").res.srcDirs("src/debug/res")
|
getByName("benchmark").res.srcDirs("src/debug/res")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
splits {
|
||||||
|
abi {
|
||||||
|
isEnable = true
|
||||||
|
isUniversalApk = true
|
||||||
|
reset()
|
||||||
|
include("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
flavorDimensions.add("default")
|
flavorDimensions.add("default")
|
||||||
|
|
||||||
productFlavors {
|
productFlavors {
|
||||||
@@ -106,21 +102,32 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
packaging {
|
packaging {
|
||||||
resources.excludes.addAll(
|
jniLibs {
|
||||||
listOf(
|
keepDebugSymbols += listOf(
|
||||||
|
"libandroidx.graphics.path",
|
||||||
|
"libarchive-jni",
|
||||||
|
"libconscrypt_jni",
|
||||||
|
"libimagedecoder",
|
||||||
|
"libquickjs",
|
||||||
|
"libsqlite3x",
|
||||||
|
)
|
||||||
|
.map { "**/$it.so" }
|
||||||
|
}
|
||||||
|
resources {
|
||||||
|
excludes += setOf(
|
||||||
"kotlin-tooling-metadata.json",
|
"kotlin-tooling-metadata.json",
|
||||||
"META-INF/DEPENDENCIES",
|
|
||||||
"LICENSE.txt",
|
"LICENSE.txt",
|
||||||
"META-INF/LICENSE",
|
"META-INF/**/*.properties",
|
||||||
"META-INF/**/LICENSE.txt",
|
"META-INF/**/LICENSE.txt",
|
||||||
"META-INF/*.properties",
|
"META-INF/*.properties",
|
||||||
"META-INF/**/*.properties",
|
|
||||||
"META-INF/README.md",
|
|
||||||
"META-INF/NOTICE",
|
|
||||||
"META-INF/*.version",
|
"META-INF/*.version",
|
||||||
),
|
"META-INF/DEPENDENCIES",
|
||||||
|
"META-INF/LICENSE",
|
||||||
|
"META-INF/NOTICE",
|
||||||
|
"META-INF/README.md",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependenciesInfo {
|
dependenciesInfo {
|
||||||
includeInApk = false
|
includeInApk = false
|
||||||
@@ -129,9 +136,9 @@ android {
|
|||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding = true
|
viewBinding = true
|
||||||
buildConfig = true
|
buildConfig = true
|
||||||
|
aidl = true
|
||||||
|
|
||||||
// Disable some unused things
|
// Disable some unused things
|
||||||
aidl = false
|
|
||||||
renderScript = false
|
renderScript = false
|
||||||
shaders = false
|
shaders = false
|
||||||
}
|
}
|
||||||
@@ -150,12 +157,14 @@ kotlin {
|
|||||||
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
|
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
|
||||||
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
|
"-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi",
|
||||||
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
|
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
|
||||||
|
"-opt-in=androidx.compose.material3.ExperimentalMaterial3ExpressiveApi",
|
||||||
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
|
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
|
||||||
"-opt-in=coil3.annotation.ExperimentalCoilApi",
|
"-opt-in=coil3.annotation.ExperimentalCoilApi",
|
||||||
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
||||||
"-opt-in=kotlinx.coroutines.FlowPreview",
|
"-opt-in=kotlinx.coroutines.FlowPreview",
|
||||||
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
|
"-opt-in=kotlinx.coroutines.InternalCoroutinesApi",
|
||||||
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
|
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
|
||||||
|
"-Xannotation-default-target=param-property",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,97 +184,95 @@ dependencies {
|
|||||||
implementation(projects.presentationWidget)
|
implementation(projects.presentationWidget)
|
||||||
|
|
||||||
// Compose
|
// Compose
|
||||||
implementation(compose.activity)
|
implementation(libs.androidx.activity.compose)
|
||||||
implementation(compose.foundation)
|
implementation(libs.androidx.compose.foundation)
|
||||||
implementation(compose.material3.core)
|
implementation(libs.androidx.compose.material3)
|
||||||
implementation(compose.material.icons)
|
implementation(libs.androidx.compose.materialIcons)
|
||||||
implementation(compose.animation)
|
implementation(libs.androidx.compose.animation)
|
||||||
implementation(compose.animation.graphics)
|
implementation(libs.androidx.compose.animationGraphics)
|
||||||
debugImplementation(compose.ui.tooling)
|
debugImplementation(libs.androidx.compose.uiTooling)
|
||||||
implementation(compose.ui.tooling.preview)
|
implementation(libs.androidx.compose.uiToolingPreview)
|
||||||
implementation(compose.ui.util)
|
implementation(libs.androidx.compose.uiUtil)
|
||||||
|
|
||||||
implementation(androidx.interpolator)
|
implementation(libs.androidx.interpolator)
|
||||||
|
|
||||||
implementation(androidx.paging.runtime)
|
implementation(libs.androidx.paging.runtime)
|
||||||
implementation(androidx.paging.compose)
|
implementation(libs.androidx.paging.compose)
|
||||||
|
|
||||||
implementation(libs.bundles.sqlite)
|
implementation(libs.androidx.sqlite.bundled)
|
||||||
// SY -->
|
// SY -->
|
||||||
implementation(sylibs.sqlcipher)
|
implementation(sylibs.sqlcipher)
|
||||||
// SY <--
|
// SY <--
|
||||||
|
|
||||||
implementation(kotlinx.reflect)
|
implementation(libs.kotlin.reflect)
|
||||||
implementation(kotlinx.immutables)
|
implementation(libs.kotlinx.collections.immutable)
|
||||||
|
|
||||||
implementation(platform(kotlinx.coroutines.bom))
|
implementation(libs.bundles.kotlinx.coroutines)
|
||||||
implementation(kotlinx.bundles.coroutines)
|
|
||||||
|
|
||||||
// AndroidX libraries
|
// AndroidX libraries
|
||||||
implementation(androidx.annotation)
|
implementation(libs.androidx.annotation)
|
||||||
implementation(androidx.appcompat)
|
implementation(libs.androidx.appCompat)
|
||||||
implementation(androidx.biometricktx)
|
implementation(libs.androidx.biometric)
|
||||||
implementation(androidx.constraintlayout)
|
implementation(libs.androidx.constraintLayout)
|
||||||
implementation(androidx.corektx)
|
implementation(libs.androidx.core)
|
||||||
implementation(androidx.splashscreen)
|
implementation(libs.androidx.coreSplashScreen)
|
||||||
implementation(androidx.recyclerview)
|
implementation(libs.androidx.recyclerView)
|
||||||
implementation(androidx.viewpager)
|
implementation(libs.androidx.viewPager)
|
||||||
implementation(androidx.profileinstaller)
|
implementation(libs.androidx.profileInstaller)
|
||||||
|
|
||||||
implementation(androidx.bundles.lifecycle)
|
implementation(libs.bundles.androidx.lifecycle)
|
||||||
|
|
||||||
// Job scheduling
|
// Job scheduling
|
||||||
implementation(androidx.workmanager)
|
implementation(libs.androidx.work)
|
||||||
|
|
||||||
// RxJava
|
// RxJava
|
||||||
implementation(libs.rxjava)
|
implementation(libs.rxJava)
|
||||||
|
|
||||||
// Networking
|
// Networking
|
||||||
implementation(libs.bundles.okhttp)
|
implementation(libs.bundles.okhttp)
|
||||||
implementation(libs.okio)
|
implementation(libs.okio)
|
||||||
implementation(libs.conscrypt.android) // TLS 1.3 support for Android < 10
|
implementation(libs.conscrypt) // TLS 1.3 support for Android < 10
|
||||||
|
|
||||||
// Data serialization (JSON, protobuf, xml)
|
// Data serialization (JSON, protobuf, xml)
|
||||||
implementation(kotlinx.bundles.serialization)
|
implementation(libs.bundles.serialization)
|
||||||
|
|
||||||
// HTML parser
|
// HTML parser
|
||||||
implementation(libs.jsoup)
|
implementation(libs.jsoup)
|
||||||
|
|
||||||
// Disk
|
// Disk
|
||||||
implementation(libs.disklrucache)
|
implementation(libs.diskLruCache)
|
||||||
implementation(libs.unifile)
|
implementation(libs.unifile)
|
||||||
|
|
||||||
// Preferences
|
// Preferences
|
||||||
implementation(libs.preferencektx)
|
implementation(libs.androidx.preference)
|
||||||
|
|
||||||
// Dependency injection
|
// Dependency injection
|
||||||
implementation(libs.injekt)
|
implementation(libs.injekt)
|
||||||
|
|
||||||
// Image loading
|
// Image loading
|
||||||
implementation(platform(libs.coil.bom))
|
|
||||||
implementation(libs.bundles.coil)
|
implementation(libs.bundles.coil)
|
||||||
implementation(libs.subsamplingscaleimageview) {
|
implementation(libs.subsamplingScaleImageView) {
|
||||||
exclude(module = "image-decoder")
|
exclude(module = "image-decoder")
|
||||||
}
|
}
|
||||||
implementation(libs.image.decoder)
|
implementation(libs.image.decoder)
|
||||||
|
|
||||||
// UI libraries
|
// UI libraries
|
||||||
implementation(libs.material)
|
implementation(libs.material)
|
||||||
implementation(libs.flexible.adapter.core)
|
implementation(libs.flexibleAdapter)
|
||||||
implementation(libs.photoview)
|
implementation(libs.photoView)
|
||||||
implementation(libs.directionalviewpager) {
|
implementation(libs.directionalViewPager) {
|
||||||
exclude(group = "androidx.viewpager", module = "viewpager")
|
exclude(group = "androidx.viewpager", module = "viewpager")
|
||||||
}
|
}
|
||||||
implementation(libs.insetter)
|
implementation(libs.composeRichEditor)
|
||||||
implementation(libs.richeditor.compose)
|
|
||||||
implementation(libs.aboutLibraries.compose)
|
implementation(libs.aboutLibraries.compose)
|
||||||
implementation(libs.bundles.voyager)
|
implementation(libs.bundles.voyager)
|
||||||
implementation(libs.compose.materialmotion)
|
implementation(libs.composeMaterialMotion)
|
||||||
implementation(libs.swipe)
|
implementation(libs.swipe)
|
||||||
implementation(libs.compose.webview)
|
implementation(libs.composeWebview)
|
||||||
implementation(libs.compose.grid)
|
implementation(libs.composeGrid)
|
||||||
implementation(libs.reorderable)
|
implementation(libs.reorderable)
|
||||||
implementation(libs.bundles.markdown)
|
implementation(libs.bundles.markdown)
|
||||||
|
implementation(libs.materialKolor)
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
implementation(libs.logcat)
|
implementation(libs.logcat)
|
||||||
@@ -278,19 +285,20 @@ dependencies {
|
|||||||
// Shizuku
|
// Shizuku
|
||||||
implementation(libs.bundles.shizuku)
|
implementation(libs.bundles.shizuku)
|
||||||
|
|
||||||
|
// String similarity
|
||||||
|
implementation(libs.stringSimilarity)
|
||||||
|
|
||||||
// Tests
|
// Tests
|
||||||
testImplementation(libs.bundles.test)
|
testImplementation(libs.bundles.test)
|
||||||
|
testRuntimeOnly(libs.junit.platform.launcher)
|
||||||
|
|
||||||
// For detecting memory leaks; see https://square.github.io/leakcanary/
|
// For detecting memory leaks; see https://square.github.io/leakcanary/
|
||||||
// debugImplementation(libs.leakcanary.android)
|
// debugImplementation(libs.leakCanary.android)
|
||||||
implementation(libs.leakcanary.plumber)
|
implementation(libs.leakCanary.plumber)
|
||||||
|
|
||||||
testImplementation(kotlinx.coroutines.test)
|
testImplementation(libs.kotlinx.coroutines.test)
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
// Text distance (EH)
|
|
||||||
implementation(sylibs.simularity)
|
|
||||||
|
|
||||||
// Firebase (EH)
|
// Firebase (EH)
|
||||||
implementation(platform(libs.firebase.bom))
|
implementation(platform(libs.firebase.bom))
|
||||||
implementation(libs.firebase.analytics)
|
implementation(libs.firebase.analytics)
|
||||||
@@ -316,6 +324,19 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
androidComponents {
|
androidComponents {
|
||||||
|
onVariants { variant ->
|
||||||
|
val resSource = variant.sources.res ?: return@onVariants
|
||||||
|
|
||||||
|
val variantName = variant.name.replaceFirstChar { it.uppercase() }
|
||||||
|
val replaceShortcutsPlaceholderTask = tasks.register<ReplaceShortcutsPlaceholderTask>(
|
||||||
|
"replace${variantName}ShortcutPlaceholder",
|
||||||
|
) {
|
||||||
|
applicationId.set(variant.applicationId)
|
||||||
|
shortcutsFile.set(projectDir.resolve("src/main/shortcuts.xml"))
|
||||||
|
}
|
||||||
|
resSource.addGeneratedSourceDirectory(replaceShortcutsPlaceholderTask) { it.outputDir }
|
||||||
|
}
|
||||||
|
|
||||||
onVariants(selector().withFlavor("default" to "standard")) {
|
onVariants(selector().withFlavor("default" to "standard")) {
|
||||||
// Only excluding in standard flavor because this breaks
|
// Only excluding in standard flavor because this breaks
|
||||||
// Layout Inspector's Compose tree
|
// Layout Inspector's Compose tree
|
||||||
@@ -325,6 +346,6 @@ androidComponents {
|
|||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath(kotlinx.gradle)
|
classpath(libs.kotlin.gradle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
@@ -299,3 +299,5 @@
|
|||||||
-dontwarn org.ietf.jgss.GSSManager
|
-dontwarn org.ietf.jgss.GSSManager
|
||||||
-dontwarn org.ietf.jgss.GSSName
|
-dontwarn org.ietf.jgss.GSSName
|
||||||
-dontwarn org.ietf.jgss.Oid
|
-dontwarn org.ietf.jgss.Oid
|
||||||
|
-dontwarn com.google.re2j.Matcher
|
||||||
|
-dontwarn com.google.re2j.Pattern
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package mihon.app.shizuku;
|
||||||
|
|
||||||
|
interface IShellInterface {
|
||||||
|
void install(in AssetFileDescriptor apk) = 1;
|
||||||
|
|
||||||
|
void destroy() = 16777114;
|
||||||
|
}
|
||||||
@@ -38,6 +38,7 @@ import mihon.domain.extensionrepo.interactor.ReplaceExtensionRepo
|
|||||||
import mihon.domain.extensionrepo.interactor.UpdateExtensionRepo
|
import mihon.domain.extensionrepo.interactor.UpdateExtensionRepo
|
||||||
import mihon.domain.extensionrepo.repository.ExtensionRepoRepository
|
import mihon.domain.extensionrepo.repository.ExtensionRepoRepository
|
||||||
import mihon.domain.extensionrepo.service.ExtensionRepoService
|
import mihon.domain.extensionrepo.service.ExtensionRepoService
|
||||||
|
import mihon.domain.migration.usecases.MigrateMangaUseCase
|
||||||
import mihon.domain.upcoming.interactor.GetUpcomingManga
|
import mihon.domain.upcoming.interactor.GetUpcomingManga
|
||||||
import tachiyomi.data.category.CategoryRepositoryImpl
|
import tachiyomi.data.category.CategoryRepositoryImpl
|
||||||
import tachiyomi.data.chapter.ChapterRepositoryImpl
|
import tachiyomi.data.chapter.ChapterRepositoryImpl
|
||||||
@@ -59,6 +60,7 @@ import tachiyomi.domain.category.interactor.SetMangaCategories
|
|||||||
import tachiyomi.domain.category.interactor.SetSortModeForCategory
|
import tachiyomi.domain.category.interactor.SetSortModeForCategory
|
||||||
import tachiyomi.domain.category.interactor.UpdateCategory
|
import tachiyomi.domain.category.interactor.UpdateCategory
|
||||||
import tachiyomi.domain.category.repository.CategoryRepository
|
import tachiyomi.domain.category.repository.CategoryRepository
|
||||||
|
import tachiyomi.domain.chapter.interactor.GetBookmarkedChaptersByMangaId
|
||||||
import tachiyomi.domain.chapter.interactor.GetChapter
|
import tachiyomi.domain.chapter.interactor.GetChapter
|
||||||
import tachiyomi.domain.chapter.interactor.GetChapterByUrlAndMangaId
|
import tachiyomi.domain.chapter.interactor.GetChapterByUrlAndMangaId
|
||||||
import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId
|
import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId
|
||||||
@@ -133,6 +135,11 @@ class DomainModule : InjektModule {
|
|||||||
addFactory { SetMangaCategories(get()) }
|
addFactory { SetMangaCategories(get()) }
|
||||||
addFactory { GetExcludedScanlators(get()) }
|
addFactory { GetExcludedScanlators(get()) }
|
||||||
addFactory { SetExcludedScanlators(get()) }
|
addFactory { SetExcludedScanlators(get()) }
|
||||||
|
addFactory {
|
||||||
|
MigrateMangaUseCase(
|
||||||
|
get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(), get(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
addSingletonFactory<ReleaseService> { ReleaseServiceImpl(get(), get()) }
|
addSingletonFactory<ReleaseService> { ReleaseServiceImpl(get(), get()) }
|
||||||
addFactory { GetApplicationRelease(get(), get()) }
|
addFactory { GetApplicationRelease(get(), get()) }
|
||||||
@@ -150,6 +157,7 @@ class DomainModule : InjektModule {
|
|||||||
addSingletonFactory<ChapterRepository> { ChapterRepositoryImpl(get()) }
|
addSingletonFactory<ChapterRepository> { ChapterRepositoryImpl(get()) }
|
||||||
addFactory { GetChapter(get()) }
|
addFactory { GetChapter(get()) }
|
||||||
addFactory { GetChaptersByMangaId(get()) }
|
addFactory { GetChaptersByMangaId(get()) }
|
||||||
|
addFactory { GetBookmarkedChaptersByMangaId(get(), get(), get()) }
|
||||||
addFactory { GetChapterByUrlAndMangaId(get()) }
|
addFactory { GetChapterByUrlAndMangaId(get()) }
|
||||||
addFactory { UpdateChapter(get()) }
|
addFactory { UpdateChapter(get()) }
|
||||||
addFactory { SetReadStatus(get(), get(), get(), get(), get()) }
|
addFactory { SetReadStatus(get(), get(), get(), get(), get()) }
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import tachiyomi.data.source.SavedSearchRepositoryImpl
|
|||||||
import tachiyomi.domain.chapter.interactor.DeleteChapters
|
import tachiyomi.domain.chapter.interactor.DeleteChapters
|
||||||
import tachiyomi.domain.chapter.interactor.GetChapterByUrl
|
import tachiyomi.domain.chapter.interactor.GetChapterByUrl
|
||||||
import tachiyomi.domain.chapter.interactor.GetMergedChaptersByMangaId
|
import tachiyomi.domain.chapter.interactor.GetMergedChaptersByMangaId
|
||||||
import tachiyomi.domain.history.interactor.GetHistoryByMangaId
|
|
||||||
import tachiyomi.domain.manga.interactor.DeleteByMergeId
|
import tachiyomi.domain.manga.interactor.DeleteByMergeId
|
||||||
import tachiyomi.domain.manga.interactor.DeleteFavoriteEntries
|
import tachiyomi.domain.manga.interactor.DeleteFavoriteEntries
|
||||||
import tachiyomi.domain.manga.interactor.DeleteMangaById
|
import tachiyomi.domain.manga.interactor.DeleteMangaById
|
||||||
@@ -88,7 +87,6 @@ class SYDomainModule : InjektModule {
|
|||||||
addFactory { DeleteChapters(get()) }
|
addFactory { DeleteChapters(get()) }
|
||||||
addFactory { DeleteMangaById(get()) }
|
addFactory { DeleteMangaById(get()) }
|
||||||
addFactory { FilterSerializer() }
|
addFactory { FilterSerializer() }
|
||||||
addFactory { GetHistoryByMangaId(get()) }
|
|
||||||
addFactory { GetChapterByUrl(get()) }
|
addFactory { GetChapterByUrl(get()) }
|
||||||
addFactory { GetSourceCategories(get()) }
|
addFactory { GetSourceCategories(get()) }
|
||||||
addFactory { CreateSourceCategory(get()) }
|
addFactory { CreateSourceCategory(get()) }
|
||||||
|
|||||||
@@ -9,19 +9,22 @@ import tachiyomi.i18n.MR
|
|||||||
|
|
||||||
class BasePreferences(
|
class BasePreferences(
|
||||||
val context: Context,
|
val context: Context,
|
||||||
private val preferenceStore: PreferenceStore,
|
preferenceStore: PreferenceStore,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun downloadedOnly() = preferenceStore.getBoolean(
|
val downloadedOnly: Preference<Boolean> = preferenceStore.getBoolean(
|
||||||
Preference.appStateKey("pref_downloaded_only"),
|
Preference.appStateKey("pref_downloaded_only"),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun incognitoMode() = preferenceStore.getBoolean(Preference.appStateKey("incognito_mode"), false)
|
val incognitoMode: Preference<Boolean> = preferenceStore.getBoolean(Preference.appStateKey("incognito_mode"), false)
|
||||||
|
|
||||||
fun extensionInstaller() = ExtensionInstallerPreference(context, preferenceStore)
|
val extensionInstaller: ExtensionInstallerPreference = ExtensionInstallerPreference(context, preferenceStore)
|
||||||
|
|
||||||
fun shownOnboardingFlow() = preferenceStore.getBoolean(Preference.appStateKey("onboarding_complete"), false)
|
val shownOnboardingFlow: Preference<Boolean> = preferenceStore.getBoolean(
|
||||||
|
Preference.appStateKey("onboarding_complete"),
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
|
||||||
enum class ExtensionInstaller(val titleRes: StringResource, val requiresSystemPermission: Boolean) {
|
enum class ExtensionInstaller(val titleRes: StringResource, val requiresSystemPermission: Boolean) {
|
||||||
LEGACY(MR.strings.ext_installer_legacy, true),
|
LEGACY(MR.strings.ext_installer_legacy, true),
|
||||||
@@ -30,9 +33,17 @@ class BasePreferences(
|
|||||||
PRIVATE(MR.strings.ext_installer_private, false),
|
PRIVATE(MR.strings.ext_installer_private, false),
|
||||||
}
|
}
|
||||||
|
|
||||||
fun displayProfile() = preferenceStore.getString("pref_display_profile_key", "")
|
val displayProfile: Preference<String> = preferenceStore.getString("pref_display_profile_key", "")
|
||||||
|
|
||||||
fun hardwareBitmapThreshold() = preferenceStore.getInt("pref_hardware_bitmap_threshold", GLUtil.SAFE_TEXTURE_LIMIT)
|
val hardwareBitmapThreshold: Preference<Int> = preferenceStore.getInt(
|
||||||
|
"pref_hardware_bitmap_threshold",
|
||||||
|
GLUtil.SAFE_TEXTURE_LIMIT,
|
||||||
|
)
|
||||||
|
|
||||||
fun alwaysDecodeLongStripWithSSIV() = preferenceStore.getBoolean("pref_always_decode_long_strip_with_ssiv", false)
|
val alwaysDecodeLongStripWithSSIV: Preference<Boolean> = preferenceStore.getBoolean(
|
||||||
|
"pref_always_decode_long_strip_with_ssiv",
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
|
||||||
|
val installationId: Preference<String> = preferenceStore.getString(Preference.appStateKey("installation_id"), "")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class SetReadStatus(
|
|||||||
return@withNonCancellableContext Result.InternalError(e)
|
return@withNonCancellableContext Result.InternalError(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (read && downloadPreferences.removeAfterMarkedAsRead().get()) {
|
if (read && downloadPreferences.removeAfterMarkedAsRead.get()) {
|
||||||
chaptersToUpdate
|
chaptersToUpdate
|
||||||
.groupBy { it.mangaId }
|
.groupBy { it.mangaId }
|
||||||
.forEach { (mangaId, chapters) ->
|
.forEach { (mangaId, chapters) ->
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ class SyncChaptersWithSource(
|
|||||||
downloadManager.isChapterDownloaded(
|
downloadManager.isChapterDownloaded(
|
||||||
dbChapter.name,
|
dbChapter.name,
|
||||||
dbChapter.scanlator,
|
dbChapter.scanlator,
|
||||||
|
dbChapter.url,
|
||||||
/* SY --> */ manga.ogTitle /* SY <-- */,
|
/* SY --> */ manga.ogTitle /* SY <-- */,
|
||||||
manga.source,
|
manga.source,
|
||||||
)
|
)
|
||||||
@@ -126,12 +127,14 @@ class SyncChaptersWithSource(
|
|||||||
if (shouldRenameChapter) {
|
if (shouldRenameChapter) {
|
||||||
downloadManager.renameChapter(source, manga, dbChapter, chapter)
|
downloadManager.renameChapter(source, manga, dbChapter, chapter)
|
||||||
}
|
}
|
||||||
|
|
||||||
var toChangeChapter = dbChapter.copy(
|
var toChangeChapter = dbChapter.copy(
|
||||||
name = chapter.name,
|
name = chapter.name,
|
||||||
chapterNumber = chapter.chapterNumber,
|
chapterNumber = chapter.chapterNumber,
|
||||||
scanlator = chapter.scanlator,
|
scanlator = chapter.scanlator,
|
||||||
sourceOrder = chapter.sourceOrder,
|
sourceOrder = chapter.sourceOrder,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (chapter.dateUpload != 0L) {
|
if (chapter.dateUpload != 0L) {
|
||||||
toChangeChapter = toChangeChapter.copy(dateUpload = chapter.dateUpload)
|
toChangeChapter = toChangeChapter.copy(dateUpload = chapter.dateUpload)
|
||||||
}
|
}
|
||||||
@@ -173,7 +176,7 @@ class SyncChaptersWithSource(
|
|||||||
val deletedChapterNumberDateFetchMap = removedChapters.sortedByDescending { it.dateFetch }
|
val deletedChapterNumberDateFetchMap = removedChapters.sortedByDescending { it.dateFetch }
|
||||||
.associate { it.chapterNumber to it.dateFetch }
|
.associate { it.chapterNumber to it.dateFetch }
|
||||||
|
|
||||||
val markDuplicateAsRead = libraryPreferences.markDuplicateReadChapterAsRead().get()
|
val markDuplicateAsRead = libraryPreferences.markDuplicateReadChapterAsRead.get()
|
||||||
.contains(LibraryPreferences.MARK_DUPLICATE_CHAPTER_READ_NEW)
|
.contains(LibraryPreferences.MARK_DUPLICATE_CHAPTER_READ_NEW)
|
||||||
|
|
||||||
// Date fetch is set in such a way that the upper ones will have bigger value than the lower ones
|
// Date fetch is set in such a way that the upper ones will have bigger value than the lower ones
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ fun List<Chapter>.applyFilters(
|
|||||||
val downloaded = downloadManager.isChapterDownloaded(
|
val downloaded = downloadManager.isChapterDownloaded(
|
||||||
chapter.name,
|
chapter.name,
|
||||||
chapter.scanlator,
|
chapter.scanlator,
|
||||||
|
chapter.url,
|
||||||
/* SY --> */ manga.ogTitle /* SY <-- */,
|
/* SY --> */ manga.ogTitle /* SY <-- */,
|
||||||
manga.source,
|
manga.source,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class GetExtensionLanguages(
|
|||||||
) {
|
) {
|
||||||
fun subscribe(): Flow<List<String>> {
|
fun subscribe(): Flow<List<String>> {
|
||||||
return combine(
|
return combine(
|
||||||
preferences.enabledLanguages().changes(),
|
preferences.enabledLanguages.changes(),
|
||||||
extensionManager.availableExtensionsFlow,
|
extensionManager.availableExtensionsFlow,
|
||||||
) { enabledLanguage, availableExtensions ->
|
) { enabledLanguage, availableExtensions ->
|
||||||
availableExtensions
|
availableExtensions
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class GetExtensionSources(
|
|||||||
val isMultiLangSingleSource =
|
val isMultiLangSingleSource =
|
||||||
isMultiSource && extension.sources.map { it.name }.distinct().size == 1
|
isMultiSource && extension.sources.map { it.name }.distinct().size == 1
|
||||||
|
|
||||||
return preferences.disabledSources().changes().map { disabledSources ->
|
return preferences.disabledSources.changes().map { disabledSources ->
|
||||||
fun Source.isEnabled() = id.toString() !in disabledSources
|
fun Source.isEnabled() = id.toString() !in disabledSources
|
||||||
|
|
||||||
extension.sources
|
extension.sources
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ class GetExtensionsByType(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun subscribe(): Flow<Extensions> {
|
fun subscribe(): Flow<Extensions> {
|
||||||
val showNsfwSources = preferences.showNsfwSource().get()
|
val showNsfwSources = preferences.showNsfwSource.get()
|
||||||
|
|
||||||
return combine(
|
return combine(
|
||||||
preferences.enabledLanguages().changes(),
|
preferences.enabledLanguages.changes(),
|
||||||
extensionManager.installedExtensionsFlow,
|
extensionManager.installedExtensionsFlow,
|
||||||
extensionManager.untrustedExtensionsFlow,
|
extensionManager.untrustedExtensionsFlow,
|
||||||
extensionManager.availableExtensionsFlow,
|
extensionManager.availableExtensionsFlow,
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ class TrustExtension(
|
|||||||
suspend fun isTrusted(pkgInfo: PackageInfo, fingerprints: List<String>): Boolean {
|
suspend fun isTrusted(pkgInfo: PackageInfo, fingerprints: List<String>): Boolean {
|
||||||
val trustedFingerprints = extensionRepoRepository.getAll().map { it.signingKeyFingerprint }.toHashSet()
|
val trustedFingerprints = extensionRepoRepository.getAll().map { it.signingKeyFingerprint }.toHashSet()
|
||||||
val key = "${pkgInfo.packageName}:${PackageInfoCompat.getLongVersionCode(pkgInfo)}:${fingerprints.last()}"
|
val key = "${pkgInfo.packageName}:${PackageInfoCompat.getLongVersionCode(pkgInfo)}:${fingerprints.last()}"
|
||||||
return trustedFingerprints.any { fingerprints.contains(it) } || key in preferences.trustedExtensions().get()
|
return trustedFingerprints.any { fingerprints.contains(it) } || key in preferences.trustedExtensions.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun trust(pkgName: String, versionCode: Long, signatureHash: String) {
|
fun trust(pkgName: String, versionCode: Long, signatureHash: String) {
|
||||||
preferences.trustedExtensions().getAndSet { exts ->
|
preferences.trustedExtensions.getAndSet { exts ->
|
||||||
// Remove previously trusted versions
|
// Remove previously trusted versions
|
||||||
val removed = exts.filterNot { it.startsWith("$pkgName:") }.toMutableSet()
|
val removed = exts.filterNot { it.startsWith("$pkgName:") }.toMutableSet()
|
||||||
|
|
||||||
@@ -27,6 +27,6 @@ class TrustExtension(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun revokeAll() {
|
fun revokeAll() {
|
||||||
preferences.trustedExtensions().delete()
|
preferences.trustedExtensions.delete()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ class CreateSortTag(
|
|||||||
return Result.TagExists
|
return Result.TagExists
|
||||||
}
|
}
|
||||||
|
|
||||||
val size = preferences.sortTagsForLibrary().get().size
|
val size = preferences.sortTagsForLibrary.get().size
|
||||||
|
|
||||||
preferences.sortTagsForLibrary() += encodeTag(size, tag)
|
preferences.sortTagsForLibrary += encodeTag(size, tag)
|
||||||
|
|
||||||
return Result.Success
|
return Result.Success
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class DeleteSortTag(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun await(tag: String) {
|
fun await(tag: String) {
|
||||||
preferences.sortTagsForLibrary().set(
|
preferences.sortTagsForLibrary.set(
|
||||||
(getSortTag.await() - tag).mapIndexed { index, s ->
|
(getSortTag.await() - tag).mapIndexed { index, s ->
|
||||||
CreateSortTag.encodeTag(index, s)
|
CreateSortTag.encodeTag(index, s)
|
||||||
}.toSet(),
|
}.toSet(),
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class GetPagePreviews(
|
|||||||
return try {
|
return try {
|
||||||
val pagePreviews = try {
|
val pagePreviews = try {
|
||||||
pagePreviewCache.getPageListFromCache(manga, chapterIds, page)
|
pagePreviewCache.getPageListFromCache(manga, chapterIds, page)
|
||||||
} catch (e: Exception) {
|
} catch (_: Exception) {
|
||||||
source.getPagePreviewList(manga.toSManga(), chapters.map { it.toSChapter() }, page).also {
|
source.getPagePreviewList(manga.toSManga(), chapters.map { it.toSChapter() }, page).also {
|
||||||
pagePreviewCache.putPageListToCache(manga, chapterIds, it)
|
pagePreviewCache.putPageListToCache(manga, chapterIds, it)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ import tachiyomi.domain.library.service.LibraryPreferences
|
|||||||
class GetSortTag(private val preferences: LibraryPreferences) {
|
class GetSortTag(private val preferences: LibraryPreferences) {
|
||||||
|
|
||||||
fun subscribe(): Flow<List<String>> {
|
fun subscribe(): Flow<List<String>> {
|
||||||
return preferences.sortTagsForLibrary().changes()
|
return preferences.sortTagsForLibrary.changes()
|
||||||
.map(::mapSortTags)
|
.map(::mapSortTags)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun await() = getSortTags(preferences).let(::mapSortTags)
|
fun await() = getSortTags(preferences).let(::mapSortTags)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun getSortTags(preferences: LibraryPreferences) = preferences.sortTagsForLibrary().get()
|
fun getSortTags(preferences: LibraryPreferences) = preferences.sortTagsForLibrary.get()
|
||||||
|
|
||||||
fun mapSortTags(tags: Set<String>) = tags.mapNotNull {
|
fun mapSortTags(tags: Set<String>) = tags.mapNotNull {
|
||||||
val index = it.indexOf('|')
|
val index = it.indexOf('|')
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class ReorderSortTag(
|
|||||||
val reorderedTag = reorderedTags.removeAt(currentIndex)
|
val reorderedTag = reorderedTags.removeAt(currentIndex)
|
||||||
reorderedTags.add(newPosition, reorderedTag)
|
reorderedTags.add(newPosition, reorderedTag)
|
||||||
|
|
||||||
preferences.sortTagsForLibrary().set(
|
preferences.sortTagsForLibrary.set(
|
||||||
reorderedTags.mapIndexed { index, s ->
|
reorderedTags.mapIndexed { index, s ->
|
||||||
CreateSortTag.encodeTag(index, s)
|
CreateSortTag.encodeTag(index, s)
|
||||||
}.toSet(),
|
}.toSet(),
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class UpdateManga(
|
|||||||
|
|
||||||
// if the manga isn't a favorite (or 'update titles' preference is enabled), set its title from source and update in db
|
// if the manga isn't a favorite (or 'update titles' preference is enabled), set its title from source and update in db
|
||||||
val title =
|
val title =
|
||||||
if (remoteTitle.isNotEmpty() && (!localManga.favorite || libraryPreferences.updateMangaTitles().get())) {
|
if (remoteTitle.isNotEmpty() && (!localManga.favorite || libraryPreferences.updateMangaTitles.get())) {
|
||||||
remoteTitle
|
remoteTitle
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ val Manga.readerOrientation: Long
|
|||||||
|
|
||||||
val Manga.downloadedFilter: TriState
|
val Manga.downloadedFilter: TriState
|
||||||
get() {
|
get() {
|
||||||
if (Injekt.get<BasePreferences>().downloadedOnly().get()) return TriState.ENABLED_IS
|
if (Injekt.get<BasePreferences>().downloadedOnly.get()) return TriState.ENABLED_IS
|
||||||
return when (downloadedFilterRaw) {
|
return when (downloadedFilterRaw) {
|
||||||
Manga.CHAPTER_SHOW_DOWNLOADED -> TriState.ENABLED_IS
|
Manga.CHAPTER_SHOW_DOWNLOADED -> TriState.ENABLED_IS
|
||||||
Manga.CHAPTER_SHOW_NOT_DOWNLOADED -> TriState.ENABLED_NOT
|
Manga.CHAPTER_SHOW_NOT_DOWNLOADED -> TriState.ENABLED_NOT
|
||||||
@@ -38,12 +38,14 @@ fun Manga.chaptersFiltered(): Boolean {
|
|||||||
|
|
||||||
fun Manga.toSManga(): SManga = SManga.create().also {
|
fun Manga.toSManga(): SManga = SManga.create().also {
|
||||||
it.url = url
|
it.url = url
|
||||||
it.title = title
|
// SY -->
|
||||||
it.artist = artist
|
it.title = ogTitle
|
||||||
it.author = author
|
it.artist = ogArtist
|
||||||
it.description = description
|
it.author = ogAuthor
|
||||||
it.genre = genre.orEmpty().joinToString()
|
it.description = ogDescription
|
||||||
it.status = status.toInt()
|
it.genre = ogGenre.orEmpty().joinToString()
|
||||||
|
it.status = ogStatus.toInt()
|
||||||
|
// SY <--
|
||||||
it.thumbnail_url = thumbnailUrl
|
it.thumbnail_url = thumbnailUrl
|
||||||
it.initialized = initialized
|
it.initialized = initialized
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class CreateSourceCategory(private val preferences: SourcePreferences) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create category.
|
// Create category.
|
||||||
preferences.sourcesTabCategories() += category
|
preferences.sourcesTabCategories += category
|
||||||
|
|
||||||
return Result.Success
|
return Result.Success
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import tachiyomi.core.common.preference.minusAssign
|
|||||||
class DeleteSourceCategory(private val preferences: SourcePreferences) {
|
class DeleteSourceCategory(private val preferences: SourcePreferences) {
|
||||||
|
|
||||||
fun await(category: String) {
|
fun await(category: String) {
|
||||||
preferences.sourcesTabSourcesInCategories().getAndSet { sourcesInCategories ->
|
preferences.sourcesTabSourcesInCategories.getAndSet { sourcesInCategories ->
|
||||||
sourcesInCategories.filterNot { it.substringAfter("|") == category }.toSet()
|
sourcesInCategories.filterNot { it.substringAfter("|") == category }.toSet()
|
||||||
}
|
}
|
||||||
preferences.sourcesTabCategories() -= category
|
preferences.sourcesTabCategories -= category
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,17 +18,17 @@ class GetEnabledSources(
|
|||||||
|
|
||||||
fun subscribe(): Flow<List<Source>> {
|
fun subscribe(): Flow<List<Source>> {
|
||||||
return combine(
|
return combine(
|
||||||
preferences.pinnedSources().changes(),
|
preferences.pinnedSources.changes(),
|
||||||
combine(
|
combine(
|
||||||
preferences.enabledLanguages().changes(),
|
preferences.enabledLanguages.changes(),
|
||||||
preferences.disabledSources().changes(),
|
preferences.disabledSources.changes(),
|
||||||
preferences.lastUsedSource().changes(),
|
preferences.lastUsedSource.changes(),
|
||||||
) { a, b, c -> Triple(a, b, c) },
|
) { a, b, c -> Triple(a, b, c) },
|
||||||
// SY -->
|
// SY -->
|
||||||
combine(
|
combine(
|
||||||
preferences.dataSaverExcludedSources().changes(),
|
preferences.dataSaverExcludedSources.changes(),
|
||||||
preferences.sourcesTabSourcesInCategories().changes(),
|
preferences.sourcesTabSourcesInCategories.changes(),
|
||||||
preferences.sourcesTabCategoriesFilter().changes(),
|
preferences.sourcesTabCategoriesFilter.changes(),
|
||||||
) { a, b, c -> Triple(a, b, c) },
|
) { a, b, c -> Triple(a, b, c) },
|
||||||
// SY <--
|
// SY <--
|
||||||
repository.getSources(),
|
repository.getSources(),
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.flowOn
|
import kotlinx.coroutines.flow.flowOn
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import kotlinx.serialization.decodeFromString
|
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlinx.serialization.json.JsonArray
|
import kotlinx.serialization.json.JsonArray
|
||||||
import tachiyomi.core.common.util.lang.withIOContext
|
import tachiyomi.core.common.util.lang.withIOContext
|
||||||
|
|||||||
@@ -13,19 +13,19 @@ class GetIncognitoState(
|
|||||||
private val extensionManager: ExtensionManager,
|
private val extensionManager: ExtensionManager,
|
||||||
) {
|
) {
|
||||||
fun await(sourceId: Long?): Boolean {
|
fun await(sourceId: Long?): Boolean {
|
||||||
if (basePreferences.incognitoMode().get()) return true
|
if (basePreferences.incognitoMode.get()) return true
|
||||||
if (sourceId == null) return false
|
if (sourceId == null) return false
|
||||||
val extensionPackage = extensionManager.getExtensionPackage(sourceId) ?: return false
|
val extensionPackage = extensionManager.getExtensionPackage(sourceId) ?: return false
|
||||||
|
|
||||||
return extensionPackage in sourcePreferences.incognitoExtensions().get()
|
return extensionPackage in sourcePreferences.incognitoExtensions.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun subscribe(sourceId: Long?): Flow<Boolean> {
|
fun subscribe(sourceId: Long?): Flow<Boolean> {
|
||||||
if (sourceId == null) return basePreferences.incognitoMode().changes()
|
if (sourceId == null) return basePreferences.incognitoMode.changes()
|
||||||
|
|
||||||
return combine(
|
return combine(
|
||||||
basePreferences.incognitoMode().changes(),
|
basePreferences.incognitoMode.changes(),
|
||||||
sourcePreferences.incognitoExtensions().changes(),
|
sourcePreferences.incognitoExtensions.changes(),
|
||||||
extensionManager.getExtensionPackageAsFlow(sourceId),
|
extensionManager.getExtensionPackageAsFlow(sourceId),
|
||||||
) { incognito, incognitoExtensions, extensionPackage ->
|
) { incognito, incognitoExtensions, extensionPackage ->
|
||||||
incognito || (extensionPackage in incognitoExtensions)
|
incognito || (extensionPackage in incognitoExtensions)
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ class GetLanguagesWithSources(
|
|||||||
|
|
||||||
fun subscribe(): Flow<SortedMap<String, List<Source>>> {
|
fun subscribe(): Flow<SortedMap<String, List<Source>>> {
|
||||||
return combine(
|
return combine(
|
||||||
preferences.enabledLanguages().changes(),
|
preferences.enabledLanguages.changes(),
|
||||||
preferences.disabledSources().changes(),
|
preferences.disabledSources.changes(),
|
||||||
repository.getOnlineSources(),
|
repository.getOnlineSources(),
|
||||||
) { enabledLanguage, disabledSource, onlineSources ->
|
) { enabledLanguage, disabledSource, onlineSources ->
|
||||||
val sortedSources = onlineSources.filterNot { it.id in BlacklistedSources.HIDDEN_SOURCES }.sortedWith(
|
val sortedSources = onlineSources.filterNot { it.id in BlacklistedSources.HIDDEN_SOURCES }.sortedWith(
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class GetShowLatest(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun subscribe(hasSmartSearchConfig: Boolean): Flow<Boolean> {
|
fun subscribe(hasSmartSearchConfig: Boolean): Flow<Boolean> {
|
||||||
return preferences.useNewSourceNavigation().changes()
|
return preferences.useNewSourceNavigation.changes()
|
||||||
.map {
|
.map {
|
||||||
!hasSmartSearchConfig && !it
|
!hasSmartSearchConfig && !it
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ class GetSourceCategories(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun subscribe(): Flow<List<String>> {
|
fun subscribe(): Flow<List<String>> {
|
||||||
return preferences.sourcesTabCategories().changes().map { it.sortedWith(String.CASE_INSENSITIVE_ORDER) }
|
return preferences.sourcesTabCategories.changes().map { it.sortedWith(String.CASE_INSENSITIVE_ORDER) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ class GetSourcesWithFavoriteCount(
|
|||||||
|
|
||||||
fun subscribe(): Flow<List<Pair<Source, Long>>> {
|
fun subscribe(): Flow<List<Pair<Source, Long>>> {
|
||||||
return combine(
|
return combine(
|
||||||
preferences.migrationSortingDirection().changes(),
|
preferences.migrationSortingDirection.changes(),
|
||||||
preferences.migrationSortingMode().changes(),
|
preferences.migrationSortingMode.changes(),
|
||||||
repository.getSourcesWithFavoriteCount(),
|
repository.getSourcesWithFavoriteCount(),
|
||||||
) { direction, mode, list ->
|
) { direction, mode, list ->
|
||||||
list
|
list
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class RenameSourceCategory(
|
|||||||
CreateSourceCategory.Result.Success -> {}
|
CreateSourceCategory.Result.Success -> {}
|
||||||
}
|
}
|
||||||
|
|
||||||
preferences.sourcesTabSourcesInCategories().getAndSet { sourcesInCategories ->
|
preferences.sourcesTabSourcesInCategories.getAndSet { sourcesInCategories ->
|
||||||
sourcesInCategories.map {
|
sourcesInCategories.map {
|
||||||
val index = it.indexOf('|')
|
val index = it.indexOf('|')
|
||||||
if (index != -1 && it.substring(index + 1) == categoryOld) {
|
if (index != -1 && it.substring(index + 1) == categoryOld) {
|
||||||
@@ -24,7 +24,7 @@ class RenameSourceCategory(
|
|||||||
}
|
}
|
||||||
}.toSet()
|
}.toSet()
|
||||||
}
|
}
|
||||||
preferences.sourcesTabCategories().getAndSet {
|
preferences.sourcesTabCategories.getAndSet {
|
||||||
it.minus(categoryOld).plus(categoryNew)
|
it.minus(categoryOld).plus(categoryNew)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ class SetMigrateSorting(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun await(mode: Mode, direction: Direction) {
|
fun await(mode: Mode, direction: Direction) {
|
||||||
preferences.migrationSortingMode().set(mode)
|
preferences.migrationSortingMode.set(mode)
|
||||||
preferences.migrationSortingDirection().set(direction)
|
preferences.migrationSortingDirection.set(direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class Mode {
|
enum class Mode {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class SetSourceCategories(
|
|||||||
|
|
||||||
fun await(source: Source, sourceCategories: List<String>) {
|
fun await(source: Source, sourceCategories: List<String>) {
|
||||||
val sourceIdString = source.id.toString()
|
val sourceIdString = source.id.toString()
|
||||||
preferences.sourcesTabSourcesInCategories().getAndSet { sourcesInCategories ->
|
preferences.sourcesTabSourcesInCategories.getAndSet { sourcesInCategories ->
|
||||||
val currentSourceCategories = sourcesInCategories.filterNot {
|
val currentSourceCategories = sourcesInCategories.filterNot {
|
||||||
it.substringBefore('|') == sourceIdString
|
it.substringBefore('|') == sourceIdString
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class ToggleExcludeFromDataSaver(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun await(source: Source) {
|
fun await(source: Source) {
|
||||||
preferences.dataSaverExcludedSources().getAndSet {
|
preferences.dataSaverExcludedSources.getAndSet {
|
||||||
if (source.id.toString() in it) {
|
if (source.id.toString() in it) {
|
||||||
it - source.id.toString()
|
it - source.id.toString()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class ToggleIncognito(
|
|||||||
private val preferences: SourcePreferences,
|
private val preferences: SourcePreferences,
|
||||||
) {
|
) {
|
||||||
fun await(extensions: String, enable: Boolean) {
|
fun await(extensions: String, enable: Boolean) {
|
||||||
preferences.incognitoExtensions().getAndSet {
|
preferences.incognitoExtensions.getAndSet {
|
||||||
if (enable) it.plus(extensions) else it.minus(extensions)
|
if (enable) it.plus(extensions) else it.minus(extensions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ class ToggleLanguage(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun await(language: String) {
|
fun await(language: String) {
|
||||||
val isEnabled = language in preferences.enabledLanguages().get()
|
val isEnabled = language in preferences.enabledLanguages.get()
|
||||||
preferences.enabledLanguages().getAndSet { enabled ->
|
preferences.enabledLanguages.getAndSet { enabled ->
|
||||||
if (isEnabled) enabled.minus(language) else enabled.plus(language)
|
if (isEnabled) enabled.minus(language) else enabled.plus(language)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,19 +13,19 @@ class ToggleSource(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun await(sourceId: Long, enable: Boolean = isEnabled(sourceId)) {
|
fun await(sourceId: Long, enable: Boolean = isEnabled(sourceId)) {
|
||||||
preferences.disabledSources().getAndSet { disabled ->
|
preferences.disabledSources.getAndSet { disabled ->
|
||||||
if (enable) disabled.minus("$sourceId") else disabled.plus("$sourceId")
|
if (enable) disabled.minus("$sourceId") else disabled.plus("$sourceId")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun await(sourceIds: List<Long>, enable: Boolean) {
|
fun await(sourceIds: List<Long>, enable: Boolean) {
|
||||||
val transformedSourceIds = sourceIds.map { it.toString() }
|
val transformedSourceIds = sourceIds.map { it.toString() }
|
||||||
preferences.disabledSources().getAndSet { disabled ->
|
preferences.disabledSources.getAndSet { disabled ->
|
||||||
if (enable) disabled.minus(transformedSourceIds) else disabled.plus(transformedSourceIds)
|
if (enable) disabled.minus(transformedSourceIds) else disabled.plus(transformedSourceIds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isEnabled(sourceId: Long): Boolean {
|
private fun isEnabled(sourceId: Long): Boolean {
|
||||||
return sourceId.toString() in preferences.disabledSources().get()
|
return sourceId.toString() in preferences.disabledSources.get()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ class ToggleSourcePin(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun await(source: Source) {
|
fun await(source: Source) {
|
||||||
val isPinned = source.id.toString() in preferences.pinnedSources().get()
|
val isPinned = source.id.toString() in preferences.pinnedSources.get()
|
||||||
preferences.pinnedSources().getAndSet { pinned ->
|
preferences.pinnedSources.getAndSet { pinned ->
|
||||||
if (isPinned) pinned.minus("${source.id}") else pinned.plus("${source.id}")
|
if (isPinned) pinned.minus("${source.id}") else pinned.plus("${source.id}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,91 +2,133 @@ package eu.kanade.domain.source.service
|
|||||||
|
|
||||||
import eu.kanade.domain.source.interactor.SetMigrateSorting
|
import eu.kanade.domain.source.interactor.SetMigrateSorting
|
||||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
|
import mihon.domain.migration.models.MigrationFlag
|
||||||
import tachiyomi.core.common.preference.Preference
|
import tachiyomi.core.common.preference.Preference
|
||||||
import tachiyomi.core.common.preference.PreferenceStore
|
import tachiyomi.core.common.preference.PreferenceStore
|
||||||
import tachiyomi.core.common.preference.getEnum
|
import tachiyomi.core.common.preference.getEnum
|
||||||
|
import tachiyomi.core.common.preference.getLongArray
|
||||||
import tachiyomi.domain.library.model.LibraryDisplayMode
|
import tachiyomi.domain.library.model.LibraryDisplayMode
|
||||||
|
|
||||||
class SourcePreferences(
|
class SourcePreferences(
|
||||||
private val preferenceStore: PreferenceStore,
|
preferenceStore: PreferenceStore,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun sourceDisplayMode() = preferenceStore.getObject(
|
val sourceDisplayMode: Preference<LibraryDisplayMode> = preferenceStore.getObjectFromString(
|
||||||
"pref_display_mode_catalogue",
|
"pref_display_mode_catalogue",
|
||||||
LibraryDisplayMode.default,
|
LibraryDisplayMode.default,
|
||||||
LibraryDisplayMode.Serializer::serialize,
|
LibraryDisplayMode.Serializer::serialize,
|
||||||
LibraryDisplayMode.Serializer::deserialize,
|
LibraryDisplayMode.Serializer::deserialize,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun enabledLanguages() = preferenceStore.getStringSet("source_languages", LocaleHelper.getDefaultEnabledLanguages())
|
val enabledLanguages: Preference<Set<String>> = preferenceStore.getStringSet(
|
||||||
|
"source_languages",
|
||||||
|
LocaleHelper.getDefaultEnabledLanguages(),
|
||||||
|
)
|
||||||
|
|
||||||
fun disabledSources() = preferenceStore.getStringSet("hidden_catalogues", emptySet())
|
val disabledSources: Preference<Set<String>> = preferenceStore.getStringSet("hidden_catalogues", emptySet())
|
||||||
|
|
||||||
fun incognitoExtensions() = preferenceStore.getStringSet("incognito_extensions", emptySet())
|
val incognitoExtensions: Preference<Set<String>> = preferenceStore.getStringSet("incognito_extensions", emptySet())
|
||||||
|
|
||||||
fun pinnedSources() = preferenceStore.getStringSet("pinned_catalogues", emptySet())
|
val pinnedSources: Preference<Set<String>> = preferenceStore.getStringSet("pinned_catalogues", emptySet())
|
||||||
|
|
||||||
fun lastUsedSource() = preferenceStore.getLong(
|
val lastUsedSource: Preference<Long> = preferenceStore.getLong(
|
||||||
Preference.appStateKey("last_catalogue_source"),
|
Preference.appStateKey("last_catalogue_source"),
|
||||||
-1,
|
-1,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun showNsfwSource() = preferenceStore.getBoolean("show_nsfw_source", true)
|
val showNsfwSource: Preference<Boolean> = preferenceStore.getBoolean("show_nsfw_source", true)
|
||||||
|
|
||||||
fun migrationSortingMode() = preferenceStore.getEnum("pref_migration_sorting", SetMigrateSorting.Mode.ALPHABETICAL)
|
val migrationSortingMode: Preference<SetMigrateSorting.Mode> = preferenceStore.getEnum(
|
||||||
|
"pref_migration_sorting",
|
||||||
|
SetMigrateSorting.Mode.ALPHABETICAL,
|
||||||
|
)
|
||||||
|
|
||||||
fun migrationSortingDirection() = preferenceStore.getEnum(
|
val migrationSortingDirection: Preference<SetMigrateSorting.Direction> = preferenceStore.getEnum(
|
||||||
"pref_migration_direction",
|
"pref_migration_direction",
|
||||||
SetMigrateSorting.Direction.ASCENDING,
|
SetMigrateSorting.Direction.ASCENDING,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun hideInLibraryItems() = preferenceStore.getBoolean("browse_hide_in_library_items", false)
|
val hideInLibraryItems: Preference<Boolean> = preferenceStore.getBoolean("browse_hide_in_library_items", false)
|
||||||
|
|
||||||
fun extensionRepos() = preferenceStore.getStringSet("extension_repos", emptySet())
|
val extensionRepos: Preference<Set<String>> = preferenceStore.getStringSet("extension_repos", emptySet())
|
||||||
|
|
||||||
fun extensionUpdatesCount() = preferenceStore.getInt("ext_updates_count", 0)
|
val extensionUpdatesCount: Preference<Int> = preferenceStore.getInt("ext_updates_count", 0)
|
||||||
|
|
||||||
fun trustedExtensions() = preferenceStore.getStringSet(
|
val trustedExtensions: Preference<Set<String>> = preferenceStore.getStringSet(
|
||||||
Preference.appStateKey("trusted_extensions"),
|
Preference.appStateKey("trusted_extensions"),
|
||||||
emptySet(),
|
emptySet(),
|
||||||
)
|
)
|
||||||
|
|
||||||
fun globalSearchFilterState() = preferenceStore.getBoolean(
|
val globalSearchFilterState: Preference<Boolean> = preferenceStore.getBoolean(
|
||||||
Preference.appStateKey("has_filters_toggle_state"),
|
Preference.appStateKey("has_filters_toggle_state"),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
fun enableSourceBlacklist() = preferenceStore.getBoolean("eh_enable_source_blacklist", true)
|
val enableSourceBlacklist: Preference<Boolean> = preferenceStore.getBoolean("eh_enable_source_blacklist", true)
|
||||||
|
|
||||||
fun sourcesTabCategories() = preferenceStore.getStringSet("sources_tab_categories", mutableSetOf())
|
val sourcesTabCategories: Preference<Set<String>> = preferenceStore.getStringSet("sources_tab_categories", mutableSetOf())
|
||||||
|
|
||||||
fun sourcesTabCategoriesFilter() = preferenceStore.getBoolean("sources_tab_categories_filter", false)
|
val sourcesTabCategoriesFilter: Preference<Boolean> = preferenceStore.getBoolean("sources_tab_categories_filter", false)
|
||||||
|
|
||||||
fun sourcesTabSourcesInCategories() = preferenceStore.getStringSet("sources_tab_source_categories", mutableSetOf())
|
val sourcesTabSourcesInCategories: Preference<Set<String>> = preferenceStore.getStringSet("sources_tab_source_categories", mutableSetOf())
|
||||||
|
|
||||||
fun dataSaver() = preferenceStore.getEnum("data_saver", DataSaver.NONE)
|
val dataSaver: Preference<DataSaver> = preferenceStore.getEnum("data_saver", DataSaver.NONE)
|
||||||
|
|
||||||
fun dataSaverIgnoreJpeg() = preferenceStore.getBoolean("ignore_jpeg", false)
|
val dataSaverIgnoreJpeg: Preference<Boolean> = preferenceStore.getBoolean("ignore_jpeg", false)
|
||||||
|
|
||||||
fun dataSaverIgnoreGif() = preferenceStore.getBoolean("ignore_gif", true)
|
val dataSaverIgnoreGif: Preference<Boolean> = preferenceStore.getBoolean("ignore_gif", true)
|
||||||
|
|
||||||
fun dataSaverImageQuality() = preferenceStore.getInt("data_saver_image_quality", 80)
|
val dataSaverImageQuality: Preference<Int> = preferenceStore.getInt("data_saver_image_quality", 80)
|
||||||
|
|
||||||
fun dataSaverImageFormatJpeg() = preferenceStore.getBoolean("data_saver_image_format_jpeg", false)
|
val dataSaverImageFormatJpeg: Preference<Boolean> = preferenceStore.getBoolean("data_saver_image_format_jpeg", false)
|
||||||
|
|
||||||
fun dataSaverServer() = preferenceStore.getString("data_saver_server", "")
|
val dataSaverServer: Preference<String> = preferenceStore.getString("data_saver_server", "")
|
||||||
|
|
||||||
fun dataSaverColorBW() = preferenceStore.getBoolean("data_saver_color_bw", false)
|
val dataSaverColorBW: Preference<Boolean> = preferenceStore.getBoolean("data_saver_color_bw", false)
|
||||||
|
|
||||||
fun dataSaverExcludedSources() = preferenceStore.getStringSet("data_saver_excluded", emptySet())
|
val dataSaverExcludedSources: Preference<Set<String>> = preferenceStore.getStringSet("data_saver_excluded", emptySet())
|
||||||
|
|
||||||
fun dataSaverDownloader() = preferenceStore.getBoolean("data_saver_downloader", true)
|
val dataSaverDownloader: Preference<Boolean> = preferenceStore.getBoolean("data_saver_downloader", true)
|
||||||
|
|
||||||
enum class DataSaver {
|
enum class DataSaver {
|
||||||
NONE,
|
NONE,
|
||||||
BANDWIDTH_HERO,
|
BANDWIDTH_HERO,
|
||||||
WSRV_NL,
|
WSRV_NL,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val allowLocalSourceHiddenFolders: Preference<Boolean> = preferenceStore.getBoolean("allow_local_source_hidden_folders", false)
|
||||||
|
|
||||||
|
val preferredMangaDexId: Preference<String> = preferenceStore.getString("preferred_mangaDex_id", "0")
|
||||||
|
|
||||||
|
val mangadexSyncToLibraryIndexes: Preference<Set<String>> = preferenceStore.getStringSet(
|
||||||
|
"pref_mangadex_sync_to_library_indexes",
|
||||||
|
emptySet(),
|
||||||
|
)
|
||||||
|
|
||||||
|
val recommendationSearchFlags: Preference<Int> = preferenceStore.getInt("rec_search_flags", Int.MAX_VALUE)
|
||||||
// SY <--
|
// SY <--
|
||||||
|
|
||||||
|
val migrationSources: Preference<List<Long>> = preferenceStore.getLongArray("migration_sources", emptyList())
|
||||||
|
|
||||||
|
val migrationFlags: Preference<Set<MigrationFlag>> = preferenceStore.getObjectFromInt(
|
||||||
|
key = "migration_flags",
|
||||||
|
defaultValue = MigrationFlag.entries.toSet(),
|
||||||
|
serializer = { MigrationFlag.toBit(it) },
|
||||||
|
deserializer = { value: Int -> MigrationFlag.fromBit(value) },
|
||||||
|
)
|
||||||
|
|
||||||
|
val migrationDeepSearchMode: Preference<Boolean> = preferenceStore.getBoolean("migration_deep_search", false)
|
||||||
|
|
||||||
|
val migrationPrioritizeByChapters: Preference<Boolean> = preferenceStore.getBoolean(
|
||||||
|
"migration_prioritize_by_chapters",
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
|
||||||
|
val migrationHideUnmatched: Preference<Boolean> = preferenceStore.getBoolean("migration_hide_unmatched", false)
|
||||||
|
|
||||||
|
val migrationHideWithoutUpdates: Preference<Boolean> = preferenceStore.getBoolean(
|
||||||
|
"migration_hide_without_updates",
|
||||||
|
false,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,21 +9,21 @@ import java.util.UUID
|
|||||||
class SyncPreferences(
|
class SyncPreferences(
|
||||||
private val preferenceStore: PreferenceStore,
|
private val preferenceStore: PreferenceStore,
|
||||||
) {
|
) {
|
||||||
fun clientHost() = preferenceStore.getString("sync_client_host", "https://sync.tachiyomi.org")
|
val clientHost: Preference<String> = preferenceStore.getString("sync_client_host", "https://sync.tachiyomi.org")
|
||||||
fun clientAPIKey() = preferenceStore.getString("sync_client_api_key", "")
|
val clientAPIKey: Preference<String> = preferenceStore.getString("sync_client_api_key", "")
|
||||||
fun lastSyncTimestamp() = preferenceStore.getLong(Preference.appStateKey("last_sync_timestamp"), 0L)
|
val lastSyncTimestamp: Preference<Long> = preferenceStore.getLong(Preference.appStateKey("last_sync_timestamp"), 0L)
|
||||||
|
|
||||||
fun lastSyncEtag() = preferenceStore.getString("sync_etag", "")
|
val lastSyncEtag: Preference<String> = preferenceStore.getString("sync_etag", "")
|
||||||
|
|
||||||
fun syncInterval() = preferenceStore.getInt("sync_interval", 0)
|
val syncInterval: Preference<Int> = preferenceStore.getInt("sync_interval", 0)
|
||||||
fun syncService() = preferenceStore.getInt("sync_service", 0)
|
val syncService: Preference<Int> = preferenceStore.getInt("sync_service", 0)
|
||||||
|
|
||||||
fun googleDriveAccessToken() = preferenceStore.getString(
|
val googleDriveAccessToken: Preference<String> = preferenceStore.getString(
|
||||||
Preference.appStateKey("google_drive_access_token"),
|
Preference.appStateKey("google_drive_access_token"),
|
||||||
"",
|
"",
|
||||||
)
|
)
|
||||||
|
|
||||||
fun googleDriveRefreshToken() = preferenceStore.getString(
|
val googleDriveRefreshToken: Preference<String> = preferenceStore.getString(
|
||||||
Preference.appStateKey("google_drive_refresh_token"),
|
Preference.appStateKey("google_drive_refresh_token"),
|
||||||
"",
|
"",
|
||||||
)
|
)
|
||||||
@@ -42,7 +42,7 @@ class SyncPreferences(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun isSyncEnabled(): Boolean {
|
fun isSyncEnabled(): Boolean {
|
||||||
return syncService().get() != 0
|
return syncService.get() != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getSyncSettings(): SyncSettings {
|
fun getSyncSettings(): SyncSettings {
|
||||||
|
|||||||
@@ -34,17 +34,17 @@ class TrackPreferences(
|
|||||||
|
|
||||||
fun trackToken(tracker: Tracker) = preferenceStore.getString(Preference.privateKey("track_token_${tracker.id}"), "")
|
fun trackToken(tracker: Tracker) = preferenceStore.getString(Preference.privateKey("track_token_${tracker.id}"), "")
|
||||||
|
|
||||||
fun anilistScoreType() = preferenceStore.getString("anilist_score_type", Anilist.POINT_10)
|
val anilistScoreType: Preference<String> = preferenceStore.getString("anilist_score_type", Anilist.POINT_10)
|
||||||
|
|
||||||
fun autoUpdateTrack() = preferenceStore.getBoolean("pref_auto_update_manga_sync_key", true)
|
val autoUpdateTrack: Preference<Boolean> = preferenceStore.getBoolean("pref_auto_update_manga_sync_key", true)
|
||||||
|
|
||||||
fun autoUpdateTrackOnMarkRead() = preferenceStore.getEnum(
|
val autoUpdateTrackOnMarkRead: Preference<AutoTrackState> = preferenceStore.getEnum(
|
||||||
"pref_auto_update_manga_on_mark_read",
|
"pref_auto_update_manga_on_mark_read",
|
||||||
AutoTrackState.ALWAYS,
|
AutoTrackState.ALWAYS,
|
||||||
)
|
)
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
fun resolveUsingSourceMetadata() = preferenceStore.getBoolean(
|
val resolveUsingSourceMetadata: Preference<Boolean> = preferenceStore.getBoolean(
|
||||||
"pref_resolve_using_source_metadata_key",
|
"pref_resolve_using_source_metadata_key",
|
||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import eu.kanade.domain.ui.model.TabletUiMode
|
|||||||
import eu.kanade.domain.ui.model.ThemeMode
|
import eu.kanade.domain.ui.model.ThemeMode
|
||||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||||
import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable
|
import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable
|
||||||
|
import tachiyomi.core.common.preference.Preference
|
||||||
import tachiyomi.core.common.preference.PreferenceStore
|
import tachiyomi.core.common.preference.PreferenceStore
|
||||||
import tachiyomi.core.common.preference.getEnum
|
import tachiyomi.core.common.preference.getEnum
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
@@ -13,10 +14,10 @@ import java.time.format.FormatStyle
|
|||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class UiPreferences(
|
class UiPreferences(
|
||||||
private val preferenceStore: PreferenceStore,
|
preferenceStore: PreferenceStore,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun themeMode() = preferenceStore.getEnum(
|
val themeMode = preferenceStore.getEnum(
|
||||||
"pref_theme_mode_key",
|
"pref_theme_mode_key",
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
ThemeMode.SYSTEM
|
ThemeMode.SYSTEM
|
||||||
@@ -25,7 +26,7 @@ class UiPreferences(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
fun appTheme() = preferenceStore.getEnum(
|
val appTheme: Preference<AppTheme> = preferenceStore.getEnum(
|
||||||
"pref_app_theme",
|
"pref_app_theme",
|
||||||
if (DeviceUtil.isDynamicColorAvailable) {
|
if (DeviceUtil.isDynamicColorAvailable) {
|
||||||
AppTheme.MONET
|
AppTheme.MONET
|
||||||
@@ -34,35 +35,37 @@ class UiPreferences(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
fun themeDarkAmoled() = preferenceStore.getBoolean("pref_theme_dark_amoled_key", false)
|
val themeDarkAmoled: Preference<Boolean> = preferenceStore.getBoolean("pref_theme_dark_amoled_key", false)
|
||||||
|
|
||||||
fun relativeTime() = preferenceStore.getBoolean("relative_time_v2", true)
|
val relativeTime: Preference<Boolean> = preferenceStore.getBoolean("relative_time_v2", true)
|
||||||
|
|
||||||
fun dateFormat() = preferenceStore.getString("app_date_format", "")
|
val dateFormat: Preference<String> = preferenceStore.getString("app_date_format", "")
|
||||||
|
|
||||||
fun tabletUiMode() = preferenceStore.getEnum("tablet_ui_mode", TabletUiMode.AUTOMATIC)
|
val tabletUiMode: Preference<TabletUiMode> = preferenceStore.getEnum("tablet_ui_mode", TabletUiMode.AUTOMATIC)
|
||||||
|
|
||||||
|
val imagesInDescription: Preference<Boolean> = preferenceStore.getBoolean("pref_render_images_description", true)
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
|
|
||||||
fun expandFilters() = preferenceStore.getBoolean("eh_expand_filters", false)
|
val expandFilters: Preference<Boolean> = preferenceStore.getBoolean("eh_expand_filters", false)
|
||||||
|
|
||||||
fun hideFeedTab() = preferenceStore.getBoolean("hide_latest_tab", false)
|
val hideFeedTab: Preference<Boolean> = preferenceStore.getBoolean("hide_latest_tab", false)
|
||||||
|
|
||||||
fun feedTabInFront() = preferenceStore.getBoolean("latest_tab_position", false)
|
val feedTabInFront: Preference<Boolean> = preferenceStore.getBoolean("latest_tab_position", false)
|
||||||
|
|
||||||
fun recommendsInOverflow() = preferenceStore.getBoolean("recommends_in_overflow", false)
|
val recommendsInOverflow: Preference<Boolean> = preferenceStore.getBoolean("recommends_in_overflow", false)
|
||||||
|
|
||||||
fun mergeInOverflow() = preferenceStore.getBoolean("merge_in_overflow", true)
|
val mergeInOverflow: Preference<Boolean> = preferenceStore.getBoolean("merge_in_overflow", true)
|
||||||
|
|
||||||
fun previewsRowCount() = preferenceStore.getInt("pref_previews_row_count", 4)
|
val previewsRowCount: Preference<Int> = preferenceStore.getInt("pref_previews_row_count", 4)
|
||||||
|
|
||||||
fun useNewSourceNavigation() = preferenceStore.getBoolean("use_new_source_navigation", true)
|
val useNewSourceNavigation: Preference<Boolean> = preferenceStore.getBoolean("use_new_source_navigation", true)
|
||||||
|
|
||||||
fun bottomBarLabels() = preferenceStore.getBoolean("pref_show_bottom_bar_labels", true)
|
val bottomBarLabels: Preference<Boolean> = preferenceStore.getBoolean("pref_show_bottom_bar_labels", true)
|
||||||
|
|
||||||
fun showNavUpdates() = preferenceStore.getBoolean("pref_show_updates_button", true)
|
val showNavUpdates: Preference<Boolean> = preferenceStore.getBoolean("pref_show_updates_button", true)
|
||||||
|
|
||||||
fun showNavHistory() = preferenceStore.getBoolean("pref_show_history_button", true)
|
val showNavHistory: Preference<Boolean> = preferenceStore.getBoolean("pref_show_history_button", true)
|
||||||
|
|
||||||
// SY <--
|
// SY <--
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import tachiyomi.i18n.MR
|
|||||||
enum class AppTheme(val titleRes: StringResource?) {
|
enum class AppTheme(val titleRes: StringResource?) {
|
||||||
DEFAULT(MR.strings.label_default),
|
DEFAULT(MR.strings.label_default),
|
||||||
MONET(MR.strings.theme_monet),
|
MONET(MR.strings.theme_monet),
|
||||||
|
CATPPUCCIN(MR.strings.theme_catppuccin),
|
||||||
GREEN_APPLE(MR.strings.theme_greenapple),
|
GREEN_APPLE(MR.strings.theme_greenapple),
|
||||||
LAVENDER(MR.strings.theme_lavender),
|
LAVENDER(MR.strings.theme_lavender),
|
||||||
MIDNIGHT_DUSK(MR.strings.theme_midnightdusk),
|
MIDNIGHT_DUSK(MR.strings.theme_midnightdusk),
|
||||||
|
|||||||
@@ -351,13 +351,17 @@ private fun ExtensionItemContent(
|
|||||||
horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall),
|
horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall),
|
||||||
) {
|
) {
|
||||||
ProvideTextStyle(value = MaterialTheme.typography.bodySmall) {
|
ProvideTextStyle(value = MaterialTheme.typography.bodySmall) {
|
||||||
|
var hasAlreadyShownAnElement by remember { mutableStateOf(false) }
|
||||||
if (extension is Extension.Installed && extension.lang.isNotEmpty()) {
|
if (extension is Extension.Installed && extension.lang.isNotEmpty()) {
|
||||||
|
hasAlreadyShownAnElement = true
|
||||||
Text(
|
Text(
|
||||||
text = LocaleHelper.getSourceDisplayName(extension.lang, LocalContext.current),
|
text = LocaleHelper.getSourceDisplayName(extension.lang, LocalContext.current),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extension.versionName.isNotEmpty()) {
|
if (extension.versionName.isNotEmpty()) {
|
||||||
|
if (hasAlreadyShownAnElement) DotSeparatorNoSpaceText()
|
||||||
|
hasAlreadyShownAnElement = true
|
||||||
Text(
|
Text(
|
||||||
text = extension.versionName,
|
text = extension.versionName,
|
||||||
)
|
)
|
||||||
@@ -373,6 +377,8 @@ private fun ExtensionItemContent(
|
|||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
if (warning != null) {
|
if (warning != null) {
|
||||||
|
if (hasAlreadyShownAnElement) DotSeparatorNoSpaceText()
|
||||||
|
hasAlreadyShownAnElement = true
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(warning).uppercase(),
|
text = stringResource(warning).uppercase(),
|
||||||
color = MaterialTheme.colorScheme.error,
|
color = MaterialTheme.colorScheme.error,
|
||||||
@@ -380,6 +386,12 @@ private fun ExtensionItemContent(
|
|||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
if (extension is Extension.Installed && !extension.isShared) {
|
||||||
|
if (hasAlreadyShownAnElement) DotSeparatorNoSpaceText()
|
||||||
|
Text(
|
||||||
|
text = stringResource(MR.strings.ext_installer_private),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (!installStep.isCompleted()) {
|
if (!installStep.isCompleted()) {
|
||||||
DotSeparatorNoSpaceText()
|
DotSeparatorNoSpaceText()
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ fun GlobalSearchScreen(
|
|||||||
navigateUp = navigateUp,
|
navigateUp = navigateUp,
|
||||||
onChangeSearchQuery = onChangeSearchQuery,
|
onChangeSearchQuery = onChangeSearchQuery,
|
||||||
onSearch = onSearch,
|
onSearch = onSearch,
|
||||||
|
hideSourceFilter = false,
|
||||||
sourceFilter = state.sourceFilter,
|
sourceFilter = state.sourceFilter,
|
||||||
onChangeSearchFilter = onChangeSearchFilter,
|
onChangeSearchFilter = onChangeSearchFilter,
|
||||||
onlyShowHasResults = state.onlyShowHasResults,
|
onlyShowHasResults = state.onlyShowHasResults,
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
package eu.kanade.presentation.browse
|
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.lazy.items
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import eu.kanade.presentation.components.AppBar
|
|
||||||
import eu.kanade.presentation.manga.components.BaseMangaListItem
|
|
||||||
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaScreenModel
|
|
||||||
import tachiyomi.domain.manga.model.Manga
|
|
||||||
import tachiyomi.i18n.MR
|
|
||||||
import tachiyomi.presentation.core.components.FastScrollLazyColumn
|
|
||||||
import tachiyomi.presentation.core.components.material.Scaffold
|
|
||||||
import tachiyomi.presentation.core.screens.EmptyScreen
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun MigrateMangaScreen(
|
|
||||||
navigateUp: () -> Unit,
|
|
||||||
title: String?,
|
|
||||||
state: MigrateMangaScreenModel.State,
|
|
||||||
onClickItem: (Manga) -> Unit,
|
|
||||||
onClickCover: (Manga) -> Unit,
|
|
||||||
) {
|
|
||||||
Scaffold(
|
|
||||||
topBar = { scrollBehavior ->
|
|
||||||
AppBar(
|
|
||||||
title = title,
|
|
||||||
navigateUp = navigateUp,
|
|
||||||
scrollBehavior = scrollBehavior,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
) { contentPadding ->
|
|
||||||
if (state.isEmpty) {
|
|
||||||
EmptyScreen(
|
|
||||||
stringRes = MR.strings.empty_screen,
|
|
||||||
modifier = Modifier.padding(contentPadding),
|
|
||||||
)
|
|
||||||
return@Scaffold
|
|
||||||
}
|
|
||||||
|
|
||||||
MigrateMangaContent(
|
|
||||||
contentPadding = contentPadding,
|
|
||||||
state = state,
|
|
||||||
onClickItem = onClickItem,
|
|
||||||
onClickCover = onClickCover,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun MigrateMangaContent(
|
|
||||||
contentPadding: PaddingValues,
|
|
||||||
state: MigrateMangaScreenModel.State,
|
|
||||||
onClickItem: (Manga) -> Unit,
|
|
||||||
onClickCover: (Manga) -> Unit,
|
|
||||||
) {
|
|
||||||
FastScrollLazyColumn(
|
|
||||||
contentPadding = contentPadding,
|
|
||||||
) {
|
|
||||||
items(state.titles) { manga ->
|
|
||||||
MigrateMangaItem(
|
|
||||||
manga = manga,
|
|
||||||
onClickItem = onClickItem,
|
|
||||||
onClickCover = onClickCover,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun MigrateMangaItem(
|
|
||||||
manga: Manga,
|
|
||||||
onClickItem: (Manga) -> Unit,
|
|
||||||
onClickCover: (Manga) -> Unit,
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
|
||||||
BaseMangaListItem(
|
|
||||||
modifier = modifier,
|
|
||||||
manga = manga,
|
|
||||||
onClickItem = { onClickItem(manga) },
|
|
||||||
onClickCover = { onClickCover(manga) },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -32,6 +32,7 @@ fun MigrateSearchScreen(
|
|||||||
navigateUp = navigateUp,
|
navigateUp = navigateUp,
|
||||||
onChangeSearchQuery = onChangeSearchQuery,
|
onChangeSearchQuery = onChangeSearchQuery,
|
||||||
onSearch = onSearch,
|
onSearch = onSearch,
|
||||||
|
hideSourceFilter = true,
|
||||||
sourceFilter = state.sourceFilter,
|
sourceFilter = state.sourceFilter,
|
||||||
onChangeSearchFilter = onChangeSearchFilter,
|
onChangeSearchFilter = onChangeSearchFilter,
|
||||||
onlyShowHasResults = state.onlyShowHasResults,
|
onlyShowHasResults = state.onlyShowHasResults,
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.outlined.ArrowForward
|
import androidx.compose.material.icons.automirrored.outlined.ArrowForward
|
||||||
import androidx.compose.material.icons.outlined.ArrowForward
|
|
||||||
import androidx.compose.material.icons.outlined.ContentCopy
|
import androidx.compose.material.icons.outlined.ContentCopy
|
||||||
import androidx.compose.material.icons.outlined.CopyAll
|
import androidx.compose.material.icons.outlined.CopyAll
|
||||||
import androidx.compose.material.icons.outlined.Done
|
import androidx.compose.material.icons.outlined.Done
|
||||||
|
|||||||
+13
-12
@@ -30,8 +30,8 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.paging.LoadState
|
import androidx.paging.LoadState
|
||||||
import androidx.paging.compose.LazyPagingItems
|
import androidx.paging.compose.LazyPagingItems
|
||||||
import com.gowtham.ratingbar.RatingBar
|
import com.gowtham.ratingbar.ComposeStars
|
||||||
import com.gowtham.ratingbar.RatingBarConfig
|
import com.gowtham.ratingbar.RatingBarStyle
|
||||||
import dev.icerock.moko.resources.StringResource
|
import dev.icerock.moko.resources.StringResource
|
||||||
import eu.kanade.presentation.manga.components.MangaCover
|
import eu.kanade.presentation.manga.components.MangaCover
|
||||||
import exh.metadata.MetadataUtil
|
import exh.metadata.MetadataUtil
|
||||||
@@ -222,17 +222,18 @@ fun BrowseSourceEHentaiListItem(
|
|||||||
verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small),
|
verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small),
|
||||||
horizontalAlignment = Alignment.Start,
|
horizontalAlignment = Alignment.Start,
|
||||||
) {
|
) {
|
||||||
RatingBar(
|
ComposeStars(
|
||||||
value = rating,
|
value = rating,
|
||||||
onValueChange = {},
|
numOfStars = 5,
|
||||||
onRatingChanged = {},
|
size = 18.dp,
|
||||||
config = RatingBarConfig().apply {
|
spaceBetween = 2.dp,
|
||||||
isIndicator(true)
|
hideInactiveStars = false,
|
||||||
numStars(5)
|
style = RatingBarStyle.Fill(
|
||||||
size(18.dp)
|
activeColor = Color(0xFF005ED7),
|
||||||
activeColor(Color(0xFF005ED7))
|
inActiveColor = Color(0xE1E2ECFF),
|
||||||
inactiveColor(Color(0xE1E2ECFF))
|
),
|
||||||
},
|
painterEmpty = null,
|
||||||
|
painterFilled = null,
|
||||||
)
|
)
|
||||||
val color = genre?.first?.color
|
val color = genre?.first?.color
|
||||||
val res = genre?.second
|
val res = genre?.second
|
||||||
|
|||||||
+2
-2
@@ -3,12 +3,12 @@ package eu.kanade.presentation.browse.components
|
|||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.FilterList
|
import androidx.compose.material.icons.outlined.FilterList
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.SmallExtendedFloatingActionButton
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.i18n.sy.SYMR
|
import tachiyomi.i18n.sy.SYMR
|
||||||
import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton
|
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -17,7 +17,7 @@ fun BrowseSourceFloatingActionButton(
|
|||||||
onFabClick: () -> Unit,
|
onFabClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
ExtendedFloatingActionButton(
|
SmallExtendedFloatingActionButton(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
text = {
|
text = {
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import androidx.compose.material.icons.Icons
|
|||||||
import androidx.compose.material.icons.automirrored.filled.ViewList
|
import androidx.compose.material.icons.automirrored.filled.ViewList
|
||||||
import androidx.compose.material.icons.automirrored.outlined.Help
|
import androidx.compose.material.icons.automirrored.outlined.Help
|
||||||
import androidx.compose.material.icons.filled.ViewModule
|
import androidx.compose.material.icons.filled.ViewModule
|
||||||
import androidx.compose.material.icons.outlined.Help
|
|
||||||
import androidx.compose.material.icons.outlined.Public
|
import androidx.compose.material.icons.outlined.Public
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TopAppBarScrollBehavior
|
import androidx.compose.material3.TopAppBarScrollBehavior
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ fun GlobalSearchToolbar(
|
|||||||
navigateUp: () -> Unit,
|
navigateUp: () -> Unit,
|
||||||
onChangeSearchQuery: (String?) -> Unit,
|
onChangeSearchQuery: (String?) -> Unit,
|
||||||
onSearch: (String) -> Unit,
|
onSearch: (String) -> Unit,
|
||||||
|
hideSourceFilter: Boolean,
|
||||||
sourceFilter: SourceFilter,
|
sourceFilter: SourceFilter,
|
||||||
onChangeSearchFilter: (SourceFilter) -> Unit,
|
onChangeSearchFilter: (SourceFilter) -> Unit,
|
||||||
onlyShowHasResults: Boolean,
|
onlyShowHasResults: Boolean,
|
||||||
@@ -73,6 +74,7 @@ fun GlobalSearchToolbar(
|
|||||||
horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small),
|
horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small),
|
||||||
) {
|
) {
|
||||||
// TODO: make this UX better; it only applies when triggering a new search
|
// TODO: make this UX better; it only applies when triggering a new search
|
||||||
|
if (!hideSourceFilter) {
|
||||||
FilterChip(
|
FilterChip(
|
||||||
selected = sourceFilter == SourceFilter.PinnedOnly,
|
selected = sourceFilter == SourceFilter.PinnedOnly,
|
||||||
onClick = { onChangeSearchFilter(SourceFilter.PinnedOnly) },
|
onClick = { onChangeSearchFilter(SourceFilter.PinnedOnly) },
|
||||||
@@ -105,6 +107,7 @@ fun GlobalSearchToolbar(
|
|||||||
)
|
)
|
||||||
|
|
||||||
VerticalDivider()
|
VerticalDivider()
|
||||||
|
}
|
||||||
|
|
||||||
FilterChip(
|
FilterChip(
|
||||||
selected = onlyShowHasResults,
|
selected = onlyShowHasResults,
|
||||||
|
|||||||
+2
-2
@@ -4,11 +4,11 @@ import androidx.compose.foundation.lazy.LazyListState
|
|||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.Add
|
import androidx.compose.material.icons.outlined.Add
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.SmallExtendedFloatingActionButton
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton
|
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
import tachiyomi.presentation.core.util.shouldExpandFAB
|
import tachiyomi.presentation.core.util.shouldExpandFAB
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ fun CategoryFloatingActionButton(
|
|||||||
onCreate: () -> Unit,
|
onCreate: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
ExtendedFloatingActionButton(
|
SmallExtendedFloatingActionButton(
|
||||||
text = { Text(text = stringResource(MR.strings.action_add)) },
|
text = { Text(text = stringResource(MR.strings.action_add)) },
|
||||||
icon = { Icon(imageVector = Icons.Outlined.Add, contentDescription = null) },
|
icon = { Icon(imageVector = Icons.Outlined.Add, contentDescription = null) },
|
||||||
onClick = onCreate,
|
onClick = onCreate,
|
||||||
|
|||||||
-1
@@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.outlined.Label
|
import androidx.compose.material.icons.automirrored.outlined.Label
|
||||||
import androidx.compose.material.icons.outlined.Delete
|
import androidx.compose.material.icons.outlined.Delete
|
||||||
import androidx.compose.material.icons.outlined.Label
|
|
||||||
import androidx.compose.material3.ElevatedCard
|
import androidx.compose.material3.ElevatedCard
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import androidx.compose.material.icons.automirrored.outlined.Label
|
|||||||
import androidx.compose.material.icons.outlined.ArrowDropDown
|
import androidx.compose.material.icons.outlined.ArrowDropDown
|
||||||
import androidx.compose.material.icons.outlined.ArrowDropUp
|
import androidx.compose.material.icons.outlined.ArrowDropUp
|
||||||
import androidx.compose.material.icons.outlined.Delete
|
import androidx.compose.material.icons.outlined.Delete
|
||||||
import androidx.compose.material.icons.outlined.Label
|
|
||||||
import androidx.compose.material3.ElevatedCard
|
import androidx.compose.material3.ElevatedCard
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
|
|||||||
-1
@@ -9,7 +9,6 @@ import androidx.compose.material.icons.Icons
|
|||||||
import androidx.compose.material.icons.automirrored.outlined.Label
|
import androidx.compose.material.icons.automirrored.outlined.Label
|
||||||
import androidx.compose.material.icons.outlined.Delete
|
import androidx.compose.material.icons.outlined.Delete
|
||||||
import androidx.compose.material.icons.outlined.Edit
|
import androidx.compose.material.icons.outlined.Edit
|
||||||
import androidx.compose.material.icons.outlined.Label
|
|
||||||
import androidx.compose.material3.ElevatedCard
|
import androidx.compose.material3.ElevatedCard
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package eu.kanade.presentation.components
|
package eu.kanade.presentation.components
|
||||||
|
|
||||||
import androidx.compose.animation.SizeTransform
|
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.animation.fadeIn
|
import androidx.compose.animation.fadeIn
|
||||||
import androidx.compose.animation.fadeOut
|
import androidx.compose.animation.fadeOut
|
||||||
|
import androidx.compose.animation.togetherWith
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.window.Dialog
|
import androidx.compose.ui.window.Dialog
|
||||||
@@ -32,9 +32,10 @@ fun NavigatorAdaptiveSheet(
|
|||||||
) {
|
) {
|
||||||
ScreenTransition(
|
ScreenTransition(
|
||||||
navigator = sheetNavigator,
|
navigator = sheetNavigator,
|
||||||
enterTransition = { fadeIn(animationSpec = tween(220, delayMillis = 90)) },
|
transition = {
|
||||||
exitTransition = { fadeOut(animationSpec = tween(90)) },
|
fadeIn(animationSpec = tween(220, delayMillis = 90)) togetherWith
|
||||||
sizeTransform = { SizeTransform() },
|
fadeOut(animationSpec = tween(90))
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,9 @@ import androidx.compose.material3.MaterialTheme
|
|||||||
import androidx.compose.material3.PlainTooltip
|
import androidx.compose.material3.PlainTooltip
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextFieldDefaults
|
import androidx.compose.material3.TextFieldDefaults
|
||||||
|
import androidx.compose.material3.TooltipAnchorPosition
|
||||||
import androidx.compose.material3.TooltipBox
|
import androidx.compose.material3.TooltipBox
|
||||||
import androidx.compose.material3.TooltipDefaults
|
import androidx.compose.material3.TooltipDefaults.rememberTooltipPositionProvider
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
import androidx.compose.material3.TopAppBarDefaults
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
import androidx.compose.material3.TopAppBarScrollBehavior
|
import androidx.compose.material3.TopAppBarScrollBehavior
|
||||||
@@ -195,7 +196,7 @@ fun AppBarActions(
|
|||||||
|
|
||||||
actions.filterIsInstance<AppBar.Action>().map {
|
actions.filterIsInstance<AppBar.Action>().map {
|
||||||
TooltipBox(
|
TooltipBox(
|
||||||
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
|
positionProvider = rememberTooltipPositionProvider(TooltipAnchorPosition.Above),
|
||||||
tooltip = {
|
tooltip = {
|
||||||
PlainTooltip {
|
PlainTooltip {
|
||||||
Text(it.title)
|
Text(it.title)
|
||||||
@@ -220,7 +221,7 @@ fun AppBarActions(
|
|||||||
val overflowActions = actions.filterIsInstance<AppBar.OverflowAction>()
|
val overflowActions = actions.filterIsInstance<AppBar.OverflowAction>()
|
||||||
if (overflowActions.isNotEmpty()) {
|
if (overflowActions.isNotEmpty()) {
|
||||||
TooltipBox(
|
TooltipBox(
|
||||||
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
|
positionProvider = rememberTooltipPositionProvider(TooltipAnchorPosition.Above),
|
||||||
tooltip = {
|
tooltip = {
|
||||||
PlainTooltip {
|
PlainTooltip {
|
||||||
Text(stringResource(MR.strings.action_menu_overflow_description))
|
Text(stringResource(MR.strings.action_menu_overflow_description))
|
||||||
@@ -349,7 +350,7 @@ fun SearchToolbar(
|
|||||||
// Don't show search action
|
// Don't show search action
|
||||||
} else if (searchQuery == null) {
|
} else if (searchQuery == null) {
|
||||||
TooltipBox(
|
TooltipBox(
|
||||||
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
|
positionProvider = rememberTooltipPositionProvider(TooltipAnchorPosition.Above),
|
||||||
tooltip = {
|
tooltip = {
|
||||||
PlainTooltip {
|
PlainTooltip {
|
||||||
Text(stringResource(MR.strings.action_search))
|
Text(stringResource(MR.strings.action_search))
|
||||||
@@ -369,7 +370,7 @@ fun SearchToolbar(
|
|||||||
}
|
}
|
||||||
} else if (searchQuery.isNotEmpty()) {
|
} else if (searchQuery.isNotEmpty()) {
|
||||||
TooltipBox(
|
TooltipBox(
|
||||||
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
|
positionProvider = rememberTooltipPositionProvider(TooltipAnchorPosition.Above),
|
||||||
tooltip = {
|
tooltip = {
|
||||||
PlainTooltip {
|
PlainTooltip {
|
||||||
Text(stringResource(MR.strings.action_reset))
|
Text(stringResource(MR.strings.action_reset))
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ fun relativeDateText(
|
|||||||
Instant.ofEpochMilli(dateEpochMillis),
|
Instant.ofEpochMilli(dateEpochMillis),
|
||||||
ZoneId.systemDefault(),
|
ZoneId.systemDefault(),
|
||||||
)
|
)
|
||||||
.takeIf { dateEpochMillis > 0L },
|
.takeIf { dateEpochMillis != 0L },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,8 +33,8 @@ fun relativeDateText(
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
val preferences = remember { Injekt.get<UiPreferences>() }
|
val preferences = remember { Injekt.get<UiPreferences>() }
|
||||||
val relativeTime = remember { preferences.relativeTime().get() }
|
val relativeTime = remember { preferences.relativeTime.get() }
|
||||||
val dateFormat = remember { UiPreferences.dateFormat(preferences.dateFormat().get()) }
|
val dateFormat = remember { UiPreferences.dateFormat(preferences.dateFormat.get()) }
|
||||||
|
|
||||||
return localDate?.toRelativeString(
|
return localDate?.toRelativeString(
|
||||||
context = context,
|
context = context,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import androidx.compose.material3.DropdownMenuItem
|
|||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.unit.DpOffset
|
||||||
import eu.kanade.presentation.manga.DownloadAction
|
import eu.kanade.presentation.manga.DownloadAction
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
@@ -12,10 +13,44 @@ import tachiyomi.presentation.core.i18n.stringResource
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DownloadDropdownMenu(
|
fun DownloadDropdownMenu(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
expanded: Boolean,
|
expanded: Boolean,
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
onDownloadClicked: (DownloadAction) -> Unit,
|
onDownloadClicked: (DownloadAction) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
offset: DpOffset? = null,
|
||||||
|
) {
|
||||||
|
if (offset != null) {
|
||||||
|
DropdownMenu(
|
||||||
|
expanded = expanded,
|
||||||
|
onDismissRequest = onDismissRequest,
|
||||||
|
modifier = modifier,
|
||||||
|
offset = offset,
|
||||||
|
content = {
|
||||||
|
DownloadDropdownMenuItems(
|
||||||
|
onDismissRequest = onDismissRequest,
|
||||||
|
onDownloadClicked = onDownloadClicked,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
DropdownMenu(
|
||||||
|
expanded = expanded,
|
||||||
|
onDismissRequest = onDismissRequest,
|
||||||
|
modifier = modifier,
|
||||||
|
content = {
|
||||||
|
DownloadDropdownMenuItems(
|
||||||
|
onDismissRequest = onDismissRequest,
|
||||||
|
onDownloadClicked = onDownloadClicked,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun DownloadDropdownMenuItems(
|
||||||
|
onDismissRequest: () -> Unit,
|
||||||
|
onDownloadClicked: (DownloadAction) -> Unit,
|
||||||
) {
|
) {
|
||||||
val options = persistentListOf(
|
val options = persistentListOf(
|
||||||
DownloadAction.NEXT_1_CHAPTER to pluralStringResource(MR.plurals.download_amount, 1, 1),
|
DownloadAction.NEXT_1_CHAPTER to pluralStringResource(MR.plurals.download_amount, 1, 1),
|
||||||
@@ -23,13 +58,9 @@ fun DownloadDropdownMenu(
|
|||||||
DownloadAction.NEXT_10_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 10, 10),
|
DownloadAction.NEXT_10_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 10, 10),
|
||||||
DownloadAction.NEXT_25_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 25, 25),
|
DownloadAction.NEXT_25_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 25, 25),
|
||||||
DownloadAction.UNREAD_CHAPTERS to stringResource(MR.strings.download_unread),
|
DownloadAction.UNREAD_CHAPTERS to stringResource(MR.strings.download_unread),
|
||||||
|
DownloadAction.BOOKMARKED_CHAPTERS to stringResource(MR.strings.download_bookmarked),
|
||||||
)
|
)
|
||||||
|
|
||||||
DropdownMenu(
|
|
||||||
expanded = expanded,
|
|
||||||
onDismissRequest = onDismissRequest,
|
|
||||||
modifier = modifier,
|
|
||||||
) {
|
|
||||||
options.map { (downloadAction, string) ->
|
options.map { (downloadAction, string) ->
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text(text = string) },
|
text = { Text(text = string) },
|
||||||
@@ -40,4 +71,3 @@ fun DownloadDropdownMenu(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -100,9 +100,9 @@ fun LibrarySettingsDialog(
|
|||||||
private fun ColumnScope.FilterPage(
|
private fun ColumnScope.FilterPage(
|
||||||
screenModel: LibrarySettingsScreenModel,
|
screenModel: LibrarySettingsScreenModel,
|
||||||
) {
|
) {
|
||||||
val filterDownloaded by screenModel.libraryPreferences.filterDownloaded().collectAsState()
|
val filterDownloaded by screenModel.libraryPreferences.filterDownloaded.collectAsState()
|
||||||
val downloadedOnly by screenModel.preferences.downloadedOnly().collectAsState()
|
val downloadedOnly by screenModel.preferences.downloadedOnly.collectAsState()
|
||||||
val autoUpdateMangaRestrictions by screenModel.libraryPreferences.autoUpdateMangaRestrictions().collectAsState()
|
val autoUpdateMangaRestrictions by screenModel.libraryPreferences.autoUpdateMangaRestrictions.collectAsState()
|
||||||
|
|
||||||
TriStateItem(
|
TriStateItem(
|
||||||
label = stringResource(MR.strings.label_downloaded),
|
label = stringResource(MR.strings.label_downloaded),
|
||||||
@@ -114,25 +114,25 @@ private fun ColumnScope.FilterPage(
|
|||||||
enabled = !downloadedOnly,
|
enabled = !downloadedOnly,
|
||||||
onClick = { screenModel.toggleFilter(LibraryPreferences::filterDownloaded) },
|
onClick = { screenModel.toggleFilter(LibraryPreferences::filterDownloaded) },
|
||||||
)
|
)
|
||||||
val filterUnread by screenModel.libraryPreferences.filterUnread().collectAsState()
|
val filterUnread by screenModel.libraryPreferences.filterUnread.collectAsState()
|
||||||
TriStateItem(
|
TriStateItem(
|
||||||
label = stringResource(MR.strings.action_filter_unread),
|
label = stringResource(MR.strings.action_filter_unread),
|
||||||
state = filterUnread,
|
state = filterUnread,
|
||||||
onClick = { screenModel.toggleFilter(LibraryPreferences::filterUnread) },
|
onClick = { screenModel.toggleFilter(LibraryPreferences::filterUnread) },
|
||||||
)
|
)
|
||||||
val filterStarted by screenModel.libraryPreferences.filterStarted().collectAsState()
|
val filterStarted by screenModel.libraryPreferences.filterStarted.collectAsState()
|
||||||
TriStateItem(
|
TriStateItem(
|
||||||
label = stringResource(MR.strings.label_started),
|
label = stringResource(MR.strings.label_started),
|
||||||
state = filterStarted,
|
state = filterStarted,
|
||||||
onClick = { screenModel.toggleFilter(LibraryPreferences::filterStarted) },
|
onClick = { screenModel.toggleFilter(LibraryPreferences::filterStarted) },
|
||||||
)
|
)
|
||||||
val filterBookmarked by screenModel.libraryPreferences.filterBookmarked().collectAsState()
|
val filterBookmarked by screenModel.libraryPreferences.filterBookmarked.collectAsState()
|
||||||
TriStateItem(
|
TriStateItem(
|
||||||
label = stringResource(MR.strings.action_filter_bookmarked),
|
label = stringResource(MR.strings.action_filter_bookmarked),
|
||||||
state = filterBookmarked,
|
state = filterBookmarked,
|
||||||
onClick = { screenModel.toggleFilter(LibraryPreferences::filterBookmarked) },
|
onClick = { screenModel.toggleFilter(LibraryPreferences::filterBookmarked) },
|
||||||
)
|
)
|
||||||
val filterCompleted by screenModel.libraryPreferences.filterCompleted().collectAsState()
|
val filterCompleted by screenModel.libraryPreferences.filterCompleted.collectAsState()
|
||||||
TriStateItem(
|
TriStateItem(
|
||||||
label = stringResource(MR.strings.completed),
|
label = stringResource(MR.strings.completed),
|
||||||
state = filterCompleted,
|
state = filterCompleted,
|
||||||
@@ -143,7 +143,7 @@ private fun ColumnScope.FilterPage(
|
|||||||
(isDevFlavor || isPreviewBuildType) &&
|
(isDevFlavor || isPreviewBuildType) &&
|
||||||
LibraryPreferences.MANGA_OUTSIDE_RELEASE_PERIOD in autoUpdateMangaRestrictions
|
LibraryPreferences.MANGA_OUTSIDE_RELEASE_PERIOD in autoUpdateMangaRestrictions
|
||||||
) {
|
) {
|
||||||
val filterIntervalCustom by screenModel.libraryPreferences.filterIntervalCustom().collectAsState()
|
val filterIntervalCustom by screenModel.libraryPreferences.filterIntervalCustom.collectAsState()
|
||||||
TriStateItem(
|
TriStateItem(
|
||||||
label = stringResource(MR.strings.action_filter_interval_custom),
|
label = stringResource(MR.strings.action_filter_interval_custom),
|
||||||
state = filterIntervalCustom,
|
state = filterIntervalCustom,
|
||||||
@@ -151,7 +151,7 @@ private fun ColumnScope.FilterPage(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
// SY -->
|
// SY -->
|
||||||
val filterLewd by screenModel.libraryPreferences.filterLewd().collectAsState()
|
val filterLewd by screenModel.libraryPreferences.filterLewd.collectAsState()
|
||||||
TriStateItem(
|
TriStateItem(
|
||||||
label = stringResource(SYMR.strings.lewd),
|
label = stringResource(SYMR.strings.lewd),
|
||||||
state = filterLewd,
|
state = filterLewd,
|
||||||
@@ -194,7 +194,7 @@ private fun ColumnScope.SortPage(
|
|||||||
) {
|
) {
|
||||||
val trackers by screenModel.trackersFlow.collectAsState()
|
val trackers by screenModel.trackersFlow.collectAsState()
|
||||||
// SY -->
|
// SY -->
|
||||||
val globalSortMode by screenModel.libraryPreferences.sortingMode().collectAsState()
|
val globalSortMode by screenModel.libraryPreferences.sortingMode.collectAsState()
|
||||||
val sortingMode = if (screenModel.grouping == LibraryGroup.BY_DEFAULT) {
|
val sortingMode = if (screenModel.grouping == LibraryGroup.BY_DEFAULT) {
|
||||||
category.sort.type
|
category.sort.type
|
||||||
} else {
|
} else {
|
||||||
@@ -206,9 +206,9 @@ private fun ColumnScope.SortPage(
|
|||||||
!globalSortMode.isAscending
|
!globalSortMode.isAscending
|
||||||
}
|
}
|
||||||
val hasSortTags by remember {
|
val hasSortTags by remember {
|
||||||
screenModel.libraryPreferences.sortTagsForLibrary().changes()
|
screenModel.libraryPreferences.sortTagsForLibrary.changes()
|
||||||
.map { it.isNotEmpty() }
|
.map { it.isNotEmpty() }
|
||||||
}.collectAsState(initial = screenModel.libraryPreferences.sortTagsForLibrary().get().isNotEmpty())
|
}.collectAsState(initial = screenModel.libraryPreferences.sortTagsForLibrary.get().isNotEmpty())
|
||||||
// SY <--
|
// SY <--
|
||||||
|
|
||||||
val options = remember(trackers.isEmpty()/* SY --> */, hasSortTags/* SY <-- */) {
|
val options = remember(trackers.isEmpty()/* SY --> */, hasSortTags/* SY <-- */) {
|
||||||
@@ -287,7 +287,7 @@ private val displayModes = listOf(
|
|||||||
private fun ColumnScope.DisplayPage(
|
private fun ColumnScope.DisplayPage(
|
||||||
screenModel: LibrarySettingsScreenModel,
|
screenModel: LibrarySettingsScreenModel,
|
||||||
) {
|
) {
|
||||||
val displayMode by screenModel.libraryPreferences.displayMode().collectAsState()
|
val displayMode by screenModel.libraryPreferences.displayMode.collectAsState()
|
||||||
SettingsChipRow(MR.strings.action_display_mode) {
|
SettingsChipRow(MR.strings.action_display_mode) {
|
||||||
displayModes.map { (titleRes, mode) ->
|
displayModes.map { (titleRes, mode) ->
|
||||||
FilterChip(
|
FilterChip(
|
||||||
@@ -302,9 +302,9 @@ private fun ColumnScope.DisplayPage(
|
|||||||
val configuration = LocalConfiguration.current
|
val configuration = LocalConfiguration.current
|
||||||
val columnPreference = remember {
|
val columnPreference = remember {
|
||||||
if (configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
if (configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
screenModel.libraryPreferences.landscapeColumns()
|
screenModel.libraryPreferences.landscapeColumns
|
||||||
} else {
|
} else {
|
||||||
screenModel.libraryPreferences.portraitColumns()
|
screenModel.libraryPreferences.portraitColumns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ private fun ColumnScope.DisplayPage(
|
|||||||
value = columns,
|
value = columns,
|
||||||
valueRange = 0..10,
|
valueRange = 0..10,
|
||||||
label = stringResource(MR.strings.pref_library_columns),
|
label = stringResource(MR.strings.pref_library_columns),
|
||||||
valueText = if (columns > 0) {
|
valueString = if (columns > 0) {
|
||||||
columns.toString()
|
columns.toString()
|
||||||
} else {
|
} else {
|
||||||
stringResource(MR.strings.label_auto)
|
stringResource(MR.strings.label_auto)
|
||||||
@@ -326,33 +326,33 @@ private fun ColumnScope.DisplayPage(
|
|||||||
HeadingItem(MR.strings.overlay_header)
|
HeadingItem(MR.strings.overlay_header)
|
||||||
CheckboxItem(
|
CheckboxItem(
|
||||||
label = stringResource(MR.strings.action_display_download_badge),
|
label = stringResource(MR.strings.action_display_download_badge),
|
||||||
pref = screenModel.libraryPreferences.downloadBadge(),
|
pref = screenModel.libraryPreferences.downloadBadge,
|
||||||
)
|
)
|
||||||
CheckboxItem(
|
CheckboxItem(
|
||||||
label = stringResource(MR.strings.action_display_unread_badge),
|
label = stringResource(MR.strings.action_display_unread_badge),
|
||||||
pref = screenModel.libraryPreferences.unreadBadge(),
|
pref = screenModel.libraryPreferences.unreadBadge,
|
||||||
)
|
)
|
||||||
CheckboxItem(
|
CheckboxItem(
|
||||||
label = stringResource(MR.strings.action_display_local_badge),
|
label = stringResource(MR.strings.action_display_local_badge),
|
||||||
pref = screenModel.libraryPreferences.localBadge(),
|
pref = screenModel.libraryPreferences.localBadge,
|
||||||
)
|
)
|
||||||
CheckboxItem(
|
CheckboxItem(
|
||||||
label = stringResource(MR.strings.action_display_language_badge),
|
label = stringResource(MR.strings.action_display_language_badge),
|
||||||
pref = screenModel.libraryPreferences.languageBadge(),
|
pref = screenModel.libraryPreferences.languageBadge,
|
||||||
)
|
)
|
||||||
CheckboxItem(
|
CheckboxItem(
|
||||||
label = stringResource(MR.strings.action_display_show_continue_reading_button),
|
label = stringResource(MR.strings.action_display_show_continue_reading_button),
|
||||||
pref = screenModel.libraryPreferences.showContinueReadingButton(),
|
pref = screenModel.libraryPreferences.showContinueReadingButton,
|
||||||
)
|
)
|
||||||
|
|
||||||
HeadingItem(MR.strings.tabs_header)
|
HeadingItem(MR.strings.tabs_header)
|
||||||
CheckboxItem(
|
CheckboxItem(
|
||||||
label = stringResource(MR.strings.action_display_show_tabs),
|
label = stringResource(MR.strings.action_display_show_tabs),
|
||||||
pref = screenModel.libraryPreferences.categoryTabs(),
|
pref = screenModel.libraryPreferences.categoryTabs,
|
||||||
)
|
)
|
||||||
CheckboxItem(
|
CheckboxItem(
|
||||||
label = stringResource(MR.strings.action_display_show_number_of_items),
|
label = stringResource(MR.strings.action_display_show_number_of_items),
|
||||||
pref = screenModel.libraryPreferences.categoryNumberOfItems(),
|
pref = screenModel.libraryPreferences.categoryNumberOfItems,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|||||||
import androidx.compose.foundation.lazy.grid.items
|
import androidx.compose.foundation.lazy.grid.items
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.util.fastAny
|
|
||||||
import eu.kanade.tachiyomi.ui.library.LibraryItem
|
import eu.kanade.tachiyomi.ui.library.LibraryItem
|
||||||
import tachiyomi.domain.library.model.LibraryManga
|
import tachiyomi.domain.library.model.LibraryManga
|
||||||
import tachiyomi.domain.manga.model.MangaCover
|
import tachiyomi.domain.manga.model.MangaCover
|
||||||
@@ -15,7 +14,7 @@ internal fun LibraryComfortableGrid(
|
|||||||
items: List<LibraryItem>,
|
items: List<LibraryItem>,
|
||||||
columns: Int,
|
columns: Int,
|
||||||
contentPadding: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
selection: List<LibraryManga>,
|
selection: Set<Long>,
|
||||||
onClick: (LibraryManga) -> Unit,
|
onClick: (LibraryManga) -> Unit,
|
||||||
onLongClick: (LibraryManga) -> Unit,
|
onLongClick: (LibraryManga) -> Unit,
|
||||||
onClickContinueReading: ((LibraryManga) -> Unit)?,
|
onClickContinueReading: ((LibraryManga) -> Unit)?,
|
||||||
@@ -35,7 +34,7 @@ internal fun LibraryComfortableGrid(
|
|||||||
) { libraryItem ->
|
) { libraryItem ->
|
||||||
val manga = libraryItem.libraryManga.manga
|
val manga = libraryItem.libraryManga.manga
|
||||||
MangaComfortableGridItem(
|
MangaComfortableGridItem(
|
||||||
isSelected = selection.fastAny { it.id == libraryItem.libraryManga.id },
|
isSelected = manga.id in selection,
|
||||||
title = manga.title,
|
title = manga.title,
|
||||||
coverData = MangaCover(
|
coverData = MangaCover(
|
||||||
mangaId = manga.id,
|
mangaId = manga.id,
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|||||||
import androidx.compose.foundation.lazy.grid.items
|
import androidx.compose.foundation.lazy.grid.items
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.util.fastAny
|
|
||||||
import eu.kanade.tachiyomi.ui.library.LibraryItem
|
import eu.kanade.tachiyomi.ui.library.LibraryItem
|
||||||
import tachiyomi.domain.library.model.LibraryManga
|
import tachiyomi.domain.library.model.LibraryManga
|
||||||
import tachiyomi.domain.manga.model.MangaCover
|
import tachiyomi.domain.manga.model.MangaCover
|
||||||
@@ -16,7 +15,7 @@ internal fun LibraryCompactGrid(
|
|||||||
showTitle: Boolean,
|
showTitle: Boolean,
|
||||||
columns: Int,
|
columns: Int,
|
||||||
contentPadding: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
selection: List<LibraryManga>,
|
selection: Set<Long>,
|
||||||
onClick: (LibraryManga) -> Unit,
|
onClick: (LibraryManga) -> Unit,
|
||||||
onLongClick: (LibraryManga) -> Unit,
|
onLongClick: (LibraryManga) -> Unit,
|
||||||
onClickContinueReading: ((LibraryManga) -> Unit)?,
|
onClickContinueReading: ((LibraryManga) -> Unit)?,
|
||||||
@@ -36,7 +35,7 @@ internal fun LibraryCompactGrid(
|
|||||||
) { libraryItem ->
|
) { libraryItem ->
|
||||||
val manga = libraryItem.libraryManga.manga
|
val manga = libraryItem.libraryManga.manga
|
||||||
MangaCompactGridItem(
|
MangaCompactGridItem(
|
||||||
isSelected = selection.fastAny { it.id == libraryItem.libraryManga.id },
|
isSelected = manga.id in selection,
|
||||||
title = manga.title.takeIf { showTitle },
|
title = manga.title.takeIf { showTitle },
|
||||||
coverData = MangaCover(
|
coverData = MangaCover(
|
||||||
mangaId = manga.id,
|
mangaId = manga.id,
|
||||||
|
|||||||
@@ -29,22 +29,22 @@ import kotlin.time.Duration.Companion.seconds
|
|||||||
fun LibraryContent(
|
fun LibraryContent(
|
||||||
categories: List<Category>,
|
categories: List<Category>,
|
||||||
searchQuery: String?,
|
searchQuery: String?,
|
||||||
selection: List<LibraryManga>,
|
selection: Set<Long>,
|
||||||
contentPadding: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
currentPage: () -> Int,
|
currentPage: Int,
|
||||||
hasActiveFilters: Boolean,
|
hasActiveFilters: Boolean,
|
||||||
showPageTabs: Boolean,
|
showPageTabs: Boolean,
|
||||||
onChangeCurrentPage: (Int) -> Unit,
|
onChangeCurrentPage: (Int) -> Unit,
|
||||||
onMangaClicked: (Long) -> Unit,
|
onClickManga: (Long) -> Unit,
|
||||||
onContinueReadingClicked: ((LibraryManga) -> Unit)?,
|
onContinueReadingClicked: ((LibraryManga) -> Unit)?,
|
||||||
onToggleSelection: (LibraryManga) -> Unit,
|
onToggleSelection: (Category, LibraryManga) -> Unit,
|
||||||
onToggleRangeSelection: (LibraryManga) -> Unit,
|
onToggleRangeSelection: (Category, LibraryManga) -> Unit,
|
||||||
onRefresh: (Category?) -> Boolean,
|
onRefresh: () -> Boolean,
|
||||||
onGlobalSearchClicked: () -> Unit,
|
onGlobalSearchClicked: () -> Unit,
|
||||||
getNumberOfMangaForCategory: (Category) -> Int?,
|
getItemCountForCategory: (Category) -> Int?,
|
||||||
getDisplayMode: (Int) -> PreferenceMutableState<LibraryDisplayMode>,
|
getDisplayMode: (Int) -> PreferenceMutableState<LibraryDisplayMode>,
|
||||||
getColumnsForOrientation: (Boolean) -> PreferenceMutableState<Int>,
|
getColumnsForOrientation: (Boolean) -> PreferenceMutableState<Int>,
|
||||||
getLibraryForPage: (Int) -> List<LibraryItem>,
|
getItemsForCategory: (Category) -> List<LibraryItem>,
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.padding(
|
modifier = Modifier.padding(
|
||||||
@@ -53,15 +53,14 @@ fun LibraryContent(
|
|||||||
end = contentPadding.calculateEndPadding(LocalLayoutDirection.current),
|
end = contentPadding.calculateEndPadding(LocalLayoutDirection.current),
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
// SY -->
|
val coercedCurrentPage = remember(categories, currentPage) { currentPage.coerceIn(0, categories.lastIndex) }
|
||||||
val coercedCurrentPage = remember(categories) { currentPage().coerceIn(0, categories.lastIndex) }
|
|
||||||
val pagerState = rememberPagerState(coercedCurrentPage) { categories.size }
|
|
||||||
// SY <--
|
// SY <--
|
||||||
|
val pagerState = rememberPagerState(coercedCurrentPage) { categories.size }
|
||||||
|
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
var isRefreshing by remember(pagerState.currentPage) { mutableStateOf(false) }
|
var isRefreshing by remember(pagerState.currentPage) { mutableStateOf(false) }
|
||||||
|
|
||||||
if (showPageTabs && categories.size > 1) {
|
if (showPageTabs && categories.isNotEmpty() && (categories.size > 1 || !categories.first().isSystemCategory)) {
|
||||||
LaunchedEffect(categories) {
|
LaunchedEffect(categories) {
|
||||||
if (categories.size <= pagerState.currentPage) {
|
if (categories.size <= pagerState.currentPage) {
|
||||||
pagerState.scrollToPage(categories.size - 1)
|
pagerState.scrollToPage(categories.size - 1)
|
||||||
@@ -70,23 +69,20 @@ fun LibraryContent(
|
|||||||
LibraryTabs(
|
LibraryTabs(
|
||||||
categories = categories,
|
categories = categories,
|
||||||
pagerState = pagerState,
|
pagerState = pagerState,
|
||||||
getNumberOfMangaForCategory = getNumberOfMangaForCategory,
|
getItemCountForCategory = getItemCountForCategory,
|
||||||
) { scope.launch { pagerState.animateScrollToPage(it) } }
|
onTabItemClick = {
|
||||||
}
|
scope.launch {
|
||||||
|
pagerState.animateScrollToPage(it)
|
||||||
val notSelectionMode = selection.isEmpty()
|
|
||||||
val onClickManga = { manga: LibraryManga ->
|
|
||||||
if (notSelectionMode) {
|
|
||||||
onMangaClicked(manga.manga.id)
|
|
||||||
} else {
|
|
||||||
onToggleSelection(manga)
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
PullRefresh(
|
PullRefresh(
|
||||||
refreshing = isRefreshing,
|
refreshing = isRefreshing,
|
||||||
|
enabled = selection.isEmpty(),
|
||||||
onRefresh = {
|
onRefresh = {
|
||||||
val started = onRefresh(categories.getOrNull(currentPage()) ?: return@PullRefresh)
|
val started = onRefresh()
|
||||||
if (!started) return@PullRefresh
|
if (!started) return@PullRefresh
|
||||||
scope.launch {
|
scope.launch {
|
||||||
// Fake refresh status but hide it after a second as it's a long running task
|
// Fake refresh status but hide it after a second as it's a long running task
|
||||||
@@ -95,19 +91,25 @@ fun LibraryContent(
|
|||||||
isRefreshing = false
|
isRefreshing = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enabled = notSelectionMode,
|
|
||||||
) {
|
) {
|
||||||
LibraryPager(
|
LibraryPager(
|
||||||
state = pagerState,
|
state = pagerState,
|
||||||
contentPadding = PaddingValues(bottom = contentPadding.calculateBottomPadding()),
|
contentPadding = PaddingValues(bottom = contentPadding.calculateBottomPadding()),
|
||||||
hasActiveFilters = hasActiveFilters,
|
hasActiveFilters = hasActiveFilters,
|
||||||
selectedManga = selection,
|
selection = selection,
|
||||||
searchQuery = searchQuery,
|
searchQuery = searchQuery,
|
||||||
onGlobalSearchClicked = onGlobalSearchClicked,
|
onGlobalSearchClicked = onGlobalSearchClicked,
|
||||||
|
getCategoryForPage = { page -> categories[page] },
|
||||||
getDisplayMode = getDisplayMode,
|
getDisplayMode = getDisplayMode,
|
||||||
getColumnsForOrientation = getColumnsForOrientation,
|
getColumnsForOrientation = getColumnsForOrientation,
|
||||||
getLibraryForPage = getLibraryForPage,
|
getItemsForCategory = getItemsForCategory,
|
||||||
onClickManga = onClickManga,
|
onClickManga = { category, manga ->
|
||||||
|
if (selection.isNotEmpty()) {
|
||||||
|
onToggleSelection(category, manga)
|
||||||
|
} else {
|
||||||
|
onClickManga(manga.manga.id)
|
||||||
|
}
|
||||||
|
},
|
||||||
onLongClickManga = onToggleRangeSelection,
|
onLongClickManga = onToggleRangeSelection,
|
||||||
onClickContinueReading = onContinueReadingClicked,
|
onClickContinueReading = onContinueReadingClicked,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import androidx.compose.foundation.lazy.items
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.util.fastAny
|
|
||||||
import eu.kanade.tachiyomi.ui.library.LibraryItem
|
import eu.kanade.tachiyomi.ui.library.LibraryItem
|
||||||
import tachiyomi.domain.library.model.LibraryManga
|
import tachiyomi.domain.library.model.LibraryManga
|
||||||
import tachiyomi.domain.manga.model.MangaCover
|
import tachiyomi.domain.manga.model.MangaCover
|
||||||
@@ -18,7 +17,7 @@ import tachiyomi.presentation.core.util.plus
|
|||||||
internal fun LibraryList(
|
internal fun LibraryList(
|
||||||
items: List<LibraryItem>,
|
items: List<LibraryItem>,
|
||||||
contentPadding: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
selection: List<LibraryManga>,
|
selection: Set<Long>,
|
||||||
onClick: (LibraryManga) -> Unit,
|
onClick: (LibraryManga) -> Unit,
|
||||||
onLongClick: (LibraryManga) -> Unit,
|
onLongClick: (LibraryManga) -> Unit,
|
||||||
onClickContinueReading: ((LibraryManga) -> Unit)?,
|
onClickContinueReading: ((LibraryManga) -> Unit)?,
|
||||||
@@ -45,7 +44,7 @@ internal fun LibraryList(
|
|||||||
) { libraryItem ->
|
) { libraryItem ->
|
||||||
val manga = libraryItem.libraryManga.manga
|
val manga = libraryItem.libraryManga.manga
|
||||||
MangaListItem(
|
MangaListItem(
|
||||||
isSelected = selection.fastAny { it.id == libraryItem.libraryManga.id },
|
isSelected = manga.id in selection,
|
||||||
title = manga.title,
|
title = manga.title,
|
||||||
coverData = MangaCover(
|
coverData = MangaCover(
|
||||||
mangaId = manga.id,
|
mangaId = manga.id,
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import androidx.compose.ui.platform.LocalConfiguration
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import eu.kanade.core.preference.PreferenceMutableState
|
import eu.kanade.core.preference.PreferenceMutableState
|
||||||
import eu.kanade.tachiyomi.ui.library.LibraryItem
|
import eu.kanade.tachiyomi.ui.library.LibraryItem
|
||||||
|
import tachiyomi.domain.category.model.Category
|
||||||
import tachiyomi.domain.library.model.LibraryDisplayMode
|
import tachiyomi.domain.library.model.LibraryDisplayMode
|
||||||
import tachiyomi.domain.library.model.LibraryManga
|
import tachiyomi.domain.library.model.LibraryManga
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
@@ -31,14 +32,15 @@ fun LibraryPager(
|
|||||||
state: PagerState,
|
state: PagerState,
|
||||||
contentPadding: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
hasActiveFilters: Boolean,
|
hasActiveFilters: Boolean,
|
||||||
selectedManga: List<LibraryManga>,
|
selection: Set<Long>,
|
||||||
searchQuery: String?,
|
searchQuery: String?,
|
||||||
onGlobalSearchClicked: () -> Unit,
|
onGlobalSearchClicked: () -> Unit,
|
||||||
|
getCategoryForPage: (Int) -> Category,
|
||||||
getDisplayMode: (Int) -> PreferenceMutableState<LibraryDisplayMode>,
|
getDisplayMode: (Int) -> PreferenceMutableState<LibraryDisplayMode>,
|
||||||
getColumnsForOrientation: (Boolean) -> PreferenceMutableState<Int>,
|
getColumnsForOrientation: (Boolean) -> PreferenceMutableState<Int>,
|
||||||
getLibraryForPage: (Int) -> List<LibraryItem>,
|
getItemsForCategory: (Category) -> List<LibraryItem>,
|
||||||
onClickManga: (LibraryManga) -> Unit,
|
onClickManga: (Category, LibraryManga) -> Unit,
|
||||||
onLongClickManga: (LibraryManga) -> Unit,
|
onLongClickManga: (Category, LibraryManga) -> Unit,
|
||||||
onClickContinueReading: ((LibraryManga) -> Unit)?,
|
onClickContinueReading: ((LibraryManga) -> Unit)?,
|
||||||
) {
|
) {
|
||||||
HorizontalPager(
|
HorizontalPager(
|
||||||
@@ -50,9 +52,10 @@ fun LibraryPager(
|
|||||||
// To make sure only one offscreen page is being composed
|
// To make sure only one offscreen page is being composed
|
||||||
return@HorizontalPager
|
return@HorizontalPager
|
||||||
}
|
}
|
||||||
val library = getLibraryForPage(page)
|
val category = getCategoryForPage(page)
|
||||||
|
val items = getItemsForCategory(category)
|
||||||
|
|
||||||
if (library.isEmpty()) {
|
if (items.isEmpty()) {
|
||||||
LibraryPagerEmptyScreen(
|
LibraryPagerEmptyScreen(
|
||||||
searchQuery = searchQuery,
|
searchQuery = searchQuery,
|
||||||
hasActiveFilters = hasActiveFilters,
|
hasActiveFilters = hasActiveFilters,
|
||||||
@@ -72,12 +75,15 @@ fun LibraryPager(
|
|||||||
remember { mutableIntStateOf(0) }
|
remember { mutableIntStateOf(0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val onClickManga: (LibraryManga) -> Unit = { onClickManga(category, it) }
|
||||||
|
val onLongClickManga: (LibraryManga) -> Unit = { onLongClickManga(category, it) }
|
||||||
|
|
||||||
when (displayMode) {
|
when (displayMode) {
|
||||||
LibraryDisplayMode.List -> {
|
LibraryDisplayMode.List -> {
|
||||||
LibraryList(
|
LibraryList(
|
||||||
items = library,
|
items = items,
|
||||||
contentPadding = contentPadding,
|
contentPadding = contentPadding,
|
||||||
selection = selectedManga,
|
selection = selection,
|
||||||
onClick = onClickManga,
|
onClick = onClickManga,
|
||||||
onLongClick = onLongClickManga,
|
onLongClick = onLongClickManga,
|
||||||
onClickContinueReading = onClickContinueReading,
|
onClickContinueReading = onClickContinueReading,
|
||||||
@@ -87,11 +93,11 @@ fun LibraryPager(
|
|||||||
}
|
}
|
||||||
LibraryDisplayMode.CompactGrid, LibraryDisplayMode.CoverOnlyGrid -> {
|
LibraryDisplayMode.CompactGrid, LibraryDisplayMode.CoverOnlyGrid -> {
|
||||||
LibraryCompactGrid(
|
LibraryCompactGrid(
|
||||||
items = library,
|
items = items,
|
||||||
showTitle = displayMode is LibraryDisplayMode.CompactGrid,
|
showTitle = displayMode is LibraryDisplayMode.CompactGrid,
|
||||||
columns = columns,
|
columns = columns,
|
||||||
contentPadding = contentPadding,
|
contentPadding = contentPadding,
|
||||||
selection = selectedManga,
|
selection = selection,
|
||||||
onClick = onClickManga,
|
onClick = onClickManga,
|
||||||
onLongClick = onLongClickManga,
|
onLongClick = onLongClickManga,
|
||||||
onClickContinueReading = onClickContinueReading,
|
onClickContinueReading = onClickContinueReading,
|
||||||
@@ -101,10 +107,10 @@ fun LibraryPager(
|
|||||||
}
|
}
|
||||||
LibraryDisplayMode.ComfortableGrid -> {
|
LibraryDisplayMode.ComfortableGrid -> {
|
||||||
LibraryComfortableGrid(
|
LibraryComfortableGrid(
|
||||||
items = library,
|
items = items,
|
||||||
columns = columns,
|
columns = columns,
|
||||||
contentPadding = contentPadding,
|
contentPadding = contentPadding,
|
||||||
selection = selectedManga,
|
selection = selection,
|
||||||
onClick = onClickManga,
|
onClick = onClickManga,
|
||||||
onLongClick = onLongClickManga,
|
onLongClick = onLongClickManga,
|
||||||
onClickContinueReading = onClickContinueReading,
|
onClickContinueReading = onClickContinueReading,
|
||||||
|
|||||||
@@ -18,13 +18,11 @@ import tachiyomi.presentation.core.components.material.TabText
|
|||||||
internal fun LibraryTabs(
|
internal fun LibraryTabs(
|
||||||
categories: List<Category>,
|
categories: List<Category>,
|
||||||
pagerState: PagerState,
|
pagerState: PagerState,
|
||||||
getNumberOfMangaForCategory: (Category) -> Int?,
|
getItemCountForCategory: (Category) -> Int?,
|
||||||
onTabItemClick: (Int) -> Unit,
|
onTabItemClick: (Int) -> Unit,
|
||||||
) {
|
) {
|
||||||
val currentPageIndex = pagerState.currentPage.coerceAtMost(categories.lastIndex)
|
val currentPageIndex = pagerState.currentPage.coerceAtMost(categories.lastIndex)
|
||||||
Column(
|
Column(modifier = Modifier.zIndex(2f)) {
|
||||||
modifier = Modifier.zIndex(1f),
|
|
||||||
) {
|
|
||||||
PrimaryScrollableTabRow(
|
PrimaryScrollableTabRow(
|
||||||
selectedTabIndex = currentPageIndex,
|
selectedTabIndex = currentPageIndex,
|
||||||
edgePadding = 0.dp,
|
edgePadding = 0.dp,
|
||||||
@@ -39,7 +37,7 @@ internal fun LibraryTabs(
|
|||||||
text = {
|
text = {
|
||||||
TabText(
|
TabText(
|
||||||
text = category.visualName,
|
text = category.visualName,
|
||||||
badgeCount = getNumberOfMangaForCategory(category),
|
badgeCount = getItemCountForCategory(category),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
unselectedContentColor = MaterialTheme.colorScheme.onSurface,
|
unselectedContentColor = MaterialTheme.colorScheme.onSurface,
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ fun ChapterSettingsDialog(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val downloadedOnly = remember { Injekt.get<BasePreferences>().downloadedOnly().get() }
|
val downloadedOnly = remember { Injekt.get<BasePreferences>().downloadedOnly.get() }
|
||||||
|
|
||||||
TabbedDialog(
|
TabbedDialog(
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package eu.kanade.presentation.manga
|
package eu.kanade.presentation.manga
|
||||||
|
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
|
||||||
import androidx.compose.animation.core.animateFloatAsState
|
import androidx.compose.animation.core.animateFloatAsState
|
||||||
import androidx.compose.animation.fadeIn
|
|
||||||
import androidx.compose.animation.fadeOut
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
@@ -27,9 +24,11 @@ import androidx.compose.foundation.verticalScroll
|
|||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.PlayArrow
|
import androidx.compose.material.icons.filled.PlayArrow
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.SmallExtendedFloatingActionButton
|
||||||
import androidx.compose.material3.SnackbarHost
|
import androidx.compose.material3.SnackbarHost
|
||||||
import androidx.compose.material3.SnackbarHostState
|
import androidx.compose.material3.SnackbarHostState
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.animateFloatingActionButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.derivedStateOf
|
import androidx.compose.runtime.derivedStateOf
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
@@ -69,6 +68,7 @@ import eu.kanade.tachiyomi.source.Source
|
|||||||
import eu.kanade.tachiyomi.source.getNameForMangaInfo
|
import eu.kanade.tachiyomi.source.getNameForMangaInfo
|
||||||
import eu.kanade.tachiyomi.source.online.MetadataSource
|
import eu.kanade.tachiyomi.source.online.MetadataSource
|
||||||
import eu.kanade.tachiyomi.source.online.all.EHentai
|
import eu.kanade.tachiyomi.source.online.all.EHentai
|
||||||
|
import eu.kanade.tachiyomi.source.online.all.Lanraragi
|
||||||
import eu.kanade.tachiyomi.source.online.all.MangaDex
|
import eu.kanade.tachiyomi.source.online.all.MangaDex
|
||||||
import eu.kanade.tachiyomi.source.online.all.NHentai
|
import eu.kanade.tachiyomi.source.online.all.NHentai
|
||||||
import eu.kanade.tachiyomi.source.online.english.EightMuses
|
import eu.kanade.tachiyomi.source.online.english.EightMuses
|
||||||
@@ -87,6 +87,7 @@ import exh.source.isEhBasedManga
|
|||||||
import exh.ui.metadata.adapters.EHentaiDescription
|
import exh.ui.metadata.adapters.EHentaiDescription
|
||||||
import exh.ui.metadata.adapters.EightMusesDescription
|
import exh.ui.metadata.adapters.EightMusesDescription
|
||||||
import exh.ui.metadata.adapters.HBrowseDescription
|
import exh.ui.metadata.adapters.HBrowseDescription
|
||||||
|
import exh.ui.metadata.adapters.LanraragiDescription
|
||||||
import exh.ui.metadata.adapters.MangaDexDescription
|
import exh.ui.metadata.adapters.MangaDexDescription
|
||||||
import exh.ui.metadata.adapters.NHentaiDescription
|
import exh.ui.metadata.adapters.NHentaiDescription
|
||||||
import exh.ui.metadata.adapters.PururinDescription
|
import exh.ui.metadata.adapters.PururinDescription
|
||||||
@@ -99,7 +100,6 @@ import tachiyomi.domain.source.model.StubSource
|
|||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.TwoPanelBox
|
import tachiyomi.presentation.core.components.TwoPanelBox
|
||||||
import tachiyomi.presentation.core.components.VerticalFastScroller
|
import tachiyomi.presentation.core.components.VerticalFastScroller
|
||||||
import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton
|
|
||||||
import tachiyomi.presentation.core.components.material.PullRefresh
|
import tachiyomi.presentation.core.components.material.PullRefresh
|
||||||
import tachiyomi.presentation.core.components.material.Scaffold
|
import tachiyomi.presentation.core.components.material.Scaffold
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
@@ -165,7 +165,7 @@ fun MangaScreen(
|
|||||||
onChapterSwipe: (ChapterList.Item, LibraryPreferences.ChapterSwipeAction) -> Unit,
|
onChapterSwipe: (ChapterList.Item, LibraryPreferences.ChapterSwipeAction) -> Unit,
|
||||||
|
|
||||||
// Chapter selection
|
// Chapter selection
|
||||||
onChapterSelected: (ChapterList.Item, Boolean, Boolean, Boolean) -> Unit,
|
onChapterSelected: (ChapterList.Item, Boolean, Boolean) -> Unit,
|
||||||
onAllChapterSelected: (Boolean) -> Unit,
|
onAllChapterSelected: (Boolean) -> Unit,
|
||||||
onInvertSelection: () -> Unit,
|
onInvertSelection: () -> Unit,
|
||||||
) {
|
) {
|
||||||
@@ -329,7 +329,7 @@ private fun MangaScreenSmallImpl(
|
|||||||
onChapterSwipe: (ChapterList.Item, LibraryPreferences.ChapterSwipeAction) -> Unit,
|
onChapterSwipe: (ChapterList.Item, LibraryPreferences.ChapterSwipeAction) -> Unit,
|
||||||
|
|
||||||
// Chapter selection
|
// Chapter selection
|
||||||
onChapterSelected: (ChapterList.Item, Boolean, Boolean, Boolean) -> Unit,
|
onChapterSelected: (ChapterList.Item, Boolean, Boolean) -> Unit,
|
||||||
onAllChapterSelected: (Boolean) -> Unit,
|
onAllChapterSelected: (Boolean) -> Unit,
|
||||||
onInvertSelection: () -> Unit,
|
onInvertSelection: () -> Unit,
|
||||||
) {
|
) {
|
||||||
@@ -416,12 +416,7 @@ private fun MangaScreenSmallImpl(
|
|||||||
val isFABVisible = remember(chapters) {
|
val isFABVisible = remember(chapters) {
|
||||||
chapters.fastAny { !it.chapter.read } && !isAnySelected
|
chapters.fastAny { !it.chapter.read } && !isAnySelected
|
||||||
}
|
}
|
||||||
AnimatedVisibility(
|
SmallExtendedFloatingActionButton(
|
||||||
visible = isFABVisible,
|
|
||||||
enter = fadeIn(),
|
|
||||||
exit = fadeOut(),
|
|
||||||
) {
|
|
||||||
ExtendedFloatingActionButton(
|
|
||||||
text = {
|
text = {
|
||||||
val isReading = remember(state.chapters) {
|
val isReading = remember(state.chapters) {
|
||||||
state.chapters.fastAny { it.chapter.read }
|
state.chapters.fastAny { it.chapter.read }
|
||||||
@@ -433,8 +428,11 @@ private fun MangaScreenSmallImpl(
|
|||||||
icon = { Icon(imageVector = Icons.Filled.PlayArrow, contentDescription = null) },
|
icon = { Icon(imageVector = Icons.Filled.PlayArrow, contentDescription = null) },
|
||||||
onClick = onContinueReading,
|
onClick = onContinueReading,
|
||||||
expanded = chapterListState.shouldExpandFAB(),
|
expanded = chapterListState.shouldExpandFAB(),
|
||||||
|
modifier = Modifier.animateFloatingActionButton(
|
||||||
|
visible = isFABVisible,
|
||||||
|
alignment = Alignment.BottomEnd,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
) { contentPadding ->
|
) { contentPadding ->
|
||||||
val topPadding = contentPadding.calculateTopPadding()
|
val topPadding = contentPadding.calculateTopPadding()
|
||||||
@@ -527,7 +525,7 @@ private fun MangaScreenSmallImpl(
|
|||||||
// SY -->
|
// SY -->
|
||||||
doSearch = onSearch,
|
doSearch = onSearch,
|
||||||
searchMetadataChips = remember(state.meta, state.source.id, state.manga.genre) {
|
searchMetadataChips = remember(state.meta, state.source.id, state.manga.genre) {
|
||||||
SearchMetadataChips(state.meta, state.source, state.manga.genre)
|
SearchMetadataChips(state.meta, state.source.id, state.manga.genre)
|
||||||
},
|
},
|
||||||
// SY <--
|
// SY <--
|
||||||
)
|
)
|
||||||
@@ -652,7 +650,7 @@ fun MangaScreenLargeImpl(
|
|||||||
onChapterSwipe: (ChapterList.Item, LibraryPreferences.ChapterSwipeAction) -> Unit,
|
onChapterSwipe: (ChapterList.Item, LibraryPreferences.ChapterSwipeAction) -> Unit,
|
||||||
|
|
||||||
// Chapter selection
|
// Chapter selection
|
||||||
onChapterSelected: (ChapterList.Item, Boolean, Boolean, Boolean) -> Unit,
|
onChapterSelected: (ChapterList.Item, Boolean, Boolean) -> Unit,
|
||||||
onAllChapterSelected: (Boolean) -> Unit,
|
onAllChapterSelected: (Boolean) -> Unit,
|
||||||
onInvertSelection: () -> Unit,
|
onInvertSelection: () -> Unit,
|
||||||
) {
|
) {
|
||||||
@@ -735,12 +733,7 @@ fun MangaScreenLargeImpl(
|
|||||||
val isFABVisible = remember(chapters) {
|
val isFABVisible = remember(chapters) {
|
||||||
chapters.fastAny { !it.chapter.read } && !isAnySelected
|
chapters.fastAny { !it.chapter.read } && !isAnySelected
|
||||||
}
|
}
|
||||||
AnimatedVisibility(
|
SmallExtendedFloatingActionButton(
|
||||||
visible = isFABVisible,
|
|
||||||
enter = fadeIn(),
|
|
||||||
exit = fadeOut(),
|
|
||||||
) {
|
|
||||||
ExtendedFloatingActionButton(
|
|
||||||
text = {
|
text = {
|
||||||
val isReading = remember(state.chapters) {
|
val isReading = remember(state.chapters) {
|
||||||
state.chapters.fastAny { it.chapter.read }
|
state.chapters.fastAny { it.chapter.read }
|
||||||
@@ -754,8 +747,11 @@ fun MangaScreenLargeImpl(
|
|||||||
icon = { Icon(imageVector = Icons.Filled.PlayArrow, contentDescription = null) },
|
icon = { Icon(imageVector = Icons.Filled.PlayArrow, contentDescription = null) },
|
||||||
onClick = onContinueReading,
|
onClick = onContinueReading,
|
||||||
expanded = chapterListState.shouldExpandFAB(),
|
expanded = chapterListState.shouldExpandFAB(),
|
||||||
|
modifier = Modifier.animateFloatingActionButton(
|
||||||
|
visible = isFABVisible,
|
||||||
|
alignment = Alignment.BottomEnd,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
) { contentPadding ->
|
) { contentPadding ->
|
||||||
PullRefresh(
|
PullRefresh(
|
||||||
@@ -822,7 +818,7 @@ fun MangaScreenLargeImpl(
|
|||||||
// SY -->
|
// SY -->
|
||||||
doSearch = onSearch,
|
doSearch = onSearch,
|
||||||
searchMetadataChips = remember(state.meta, state.source.id, state.manga.genre) {
|
searchMetadataChips = remember(state.meta, state.source.id, state.manga.genre) {
|
||||||
SearchMetadataChips(state.meta, state.source, state.manga.genre)
|
SearchMetadataChips(state.meta, state.source.id, state.manga.genre)
|
||||||
},
|
},
|
||||||
// SY <--
|
// SY <--
|
||||||
)
|
)
|
||||||
@@ -951,7 +947,7 @@ private fun LazyListScope.sharedChapterItems(
|
|||||||
// SY <--
|
// SY <--
|
||||||
onChapterClicked: (Chapter) -> Unit,
|
onChapterClicked: (Chapter) -> Unit,
|
||||||
onDownloadChapter: ((List<ChapterList.Item>, ChapterDownloadAction) -> Unit)?,
|
onDownloadChapter: ((List<ChapterList.Item>, ChapterDownloadAction) -> Unit)?,
|
||||||
onChapterSelected: (ChapterList.Item, Boolean, Boolean, Boolean) -> Unit,
|
onChapterSelected: (ChapterList.Item, Boolean, Boolean) -> Unit,
|
||||||
onChapterSwipe: (ChapterList.Item, LibraryPreferences.ChapterSwipeAction) -> Unit,
|
onChapterSwipe: (ChapterList.Item, LibraryPreferences.ChapterSwipeAction) -> Unit,
|
||||||
) {
|
) {
|
||||||
items(
|
items(
|
||||||
@@ -1018,14 +1014,14 @@ private fun LazyListScope.sharedChapterItems(
|
|||||||
chapterSwipeStartAction = chapterSwipeStartAction,
|
chapterSwipeStartAction = chapterSwipeStartAction,
|
||||||
chapterSwipeEndAction = chapterSwipeEndAction,
|
chapterSwipeEndAction = chapterSwipeEndAction,
|
||||||
onLongClick = {
|
onLongClick = {
|
||||||
onChapterSelected(item, !item.selected, true, true)
|
onChapterSelected(item, !item.selected, true)
|
||||||
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||||
},
|
},
|
||||||
onClick = {
|
onClick = {
|
||||||
onChapterItemClick(
|
onChapterItemClick(
|
||||||
chapterItem = item,
|
chapterItem = item,
|
||||||
isAnyChapterSelected = isAnyChapterSelected,
|
isAnyChapterSelected = isAnyChapterSelected,
|
||||||
onToggleSelection = { onChapterSelected(item, !item.selected, true, false) },
|
onToggleSelection = { onChapterSelected(item, !item.selected, false) },
|
||||||
onChapterClicked = onChapterClicked,
|
onChapterClicked = onChapterClicked,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -1089,6 +1085,9 @@ fun metadataDescription(source: Source): MetadataDescriptionComposable? {
|
|||||||
is Tsumino -> { state, openMetadataViewer, _ ->
|
is Tsumino -> { state, openMetadataViewer, _ ->
|
||||||
TsuminoDescription(state, openMetadataViewer)
|
TsuminoDescription(state, openMetadataViewer)
|
||||||
}
|
}
|
||||||
|
is Lanraragi -> { state, openMetadataViewer, _ ->
|
||||||
|
LanraragiDescription(state, openMetadataViewer)
|
||||||
|
}
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ enum class DownloadAction {
|
|||||||
NEXT_10_CHAPTERS,
|
NEXT_10_CHAPTERS,
|
||||||
NEXT_25_CHAPTERS,
|
NEXT_25_CHAPTERS,
|
||||||
UNREAD_CHAPTERS,
|
UNREAD_CHAPTERS,
|
||||||
|
BOOKMARKED_CHAPTERS,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class EditCoverAction {
|
enum class EditCoverAction {
|
||||||
|
|||||||
+21
-23
@@ -9,6 +9,7 @@ import androidx.compose.animation.fadeOut
|
|||||||
import androidx.compose.animation.shrinkVertically
|
import androidx.compose.animation.shrinkVertically
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.RowScope
|
import androidx.compose.foundation.layout.RowScope
|
||||||
@@ -30,7 +31,6 @@ import androidx.compose.material.icons.outlined.DoneAll
|
|||||||
import androidx.compose.material.icons.outlined.Download
|
import androidx.compose.material.icons.outlined.Download
|
||||||
import androidx.compose.material.icons.outlined.MoreVert
|
import androidx.compose.material.icons.outlined.MoreVert
|
||||||
import androidx.compose.material.icons.outlined.RemoveDone
|
import androidx.compose.material.icons.outlined.RemoveDone
|
||||||
import androidx.compose.material.icons.outlined.SwapCalls
|
|
||||||
import androidx.compose.material3.DropdownMenuItem
|
import androidx.compose.material3.DropdownMenuItem
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
@@ -52,6 +52,7 @@ import androidx.compose.ui.platform.LocalConfiguration
|
|||||||
import androidx.compose.ui.platform.LocalHapticFeedback
|
import androidx.compose.ui.platform.LocalHapticFeedback
|
||||||
import androidx.compose.ui.res.vectorResource
|
import androidx.compose.ui.res.vectorResource
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.unit.DpOffset
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import eu.kanade.presentation.components.DownloadDropdownMenu
|
import eu.kanade.presentation.components.DownloadDropdownMenu
|
||||||
import eu.kanade.presentation.components.DropdownMenu
|
import eu.kanade.presentation.components.DropdownMenu
|
||||||
@@ -92,10 +93,10 @@ fun MangaBottomActionMenu(
|
|||||||
) {
|
) {
|
||||||
val haptic = LocalHapticFeedback.current
|
val haptic = LocalHapticFeedback.current
|
||||||
val confirm = remember { mutableStateListOf(false, false, false, false, false, false, false) }
|
val confirm = remember { mutableStateListOf(false, false, false, false, false, false, false) }
|
||||||
var resetJob: Job? = remember { null }
|
var resetJob by remember { mutableStateOf<Job?>(null) }
|
||||||
val onLongClickItem: (Int) -> Unit = { toConfirmIndex ->
|
val onLongClickItem: (Int) -> Unit = { toConfirmIndex ->
|
||||||
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||||
(0..<7).forEach { i -> confirm[i] = i == toConfirmIndex }
|
confirm.indices.forEach { i -> confirm[i] = i == toConfirmIndex }
|
||||||
resetJob?.cancel()
|
resetJob?.cancel()
|
||||||
resetJob = scope.launch {
|
resetJob = scope.launch {
|
||||||
delay(1.seconds)
|
delay(1.seconds)
|
||||||
@@ -192,7 +193,7 @@ private fun RowScope.Button(
|
|||||||
targetValue = if (toConfirm) 2f else 1f,
|
targetValue = if (toConfirm) 2f else 1f,
|
||||||
label = "weight",
|
label = "weight",
|
||||||
)
|
)
|
||||||
Column(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(48.dp)
|
.size(48.dp)
|
||||||
.weight(animatedWeight)
|
.weight(animatedWeight)
|
||||||
@@ -202,6 +203,9 @@ private fun RowScope.Button(
|
|||||||
onLongClick = onLongClick,
|
onLongClick = onLongClick,
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
),
|
),
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
) {
|
) {
|
||||||
@@ -221,6 +225,7 @@ private fun RowScope.Button(
|
|||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
content?.invoke()
|
content?.invoke()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -233,9 +238,9 @@ fun LibraryBottomActionMenu(
|
|||||||
onMarkAsUnreadClicked: () -> Unit,
|
onMarkAsUnreadClicked: () -> Unit,
|
||||||
onDownloadClicked: ((DownloadAction) -> Unit)?,
|
onDownloadClicked: ((DownloadAction) -> Unit)?,
|
||||||
onDeleteClicked: () -> Unit,
|
onDeleteClicked: () -> Unit,
|
||||||
|
onMigrateClicked: (() -> Unit)?,
|
||||||
// SY -->
|
// SY -->
|
||||||
onClickCleanTitles: (() -> Unit)?,
|
onClickCleanTitles: (() -> Unit)?,
|
||||||
onClickMigrate: (() -> Unit)?,
|
|
||||||
onClickCollectRecommendations: (() -> Unit)?,
|
onClickCollectRecommendations: (() -> Unit)?,
|
||||||
onClickAddToMangaDex: (() -> Unit)?,
|
onClickAddToMangaDex: (() -> Unit)?,
|
||||||
onClickResetInfo: (() -> Unit)?,
|
onClickResetInfo: (() -> Unit)?,
|
||||||
@@ -254,12 +259,11 @@ fun LibraryBottomActionMenu(
|
|||||||
color = MaterialTheme.colorScheme.surfaceContainerHigh,
|
color = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||||
) {
|
) {
|
||||||
val haptic = LocalHapticFeedback.current
|
val haptic = LocalHapticFeedback.current
|
||||||
val confirm =
|
val confirm = remember { mutableStateListOf(false, false, false, false, false, false) }
|
||||||
remember { mutableStateListOf(false, false, false, false, false /* SY --> */, false /* SY <-- */) }
|
var resetJob by remember { mutableStateOf<Job?>(null) }
|
||||||
var resetJob: Job? = remember { null }
|
|
||||||
val onLongClickItem: (Int) -> Unit = { toConfirmIndex ->
|
val onLongClickItem: (Int) -> Unit = { toConfirmIndex ->
|
||||||
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||||
(0..<5).forEach { i -> confirm[i] = i == toConfirmIndex }
|
confirm.indices.forEach { i -> confirm[i] = i == toConfirmIndex }
|
||||||
resetJob?.cancel()
|
resetJob?.cancel()
|
||||||
resetJob = scope.launch {
|
resetJob = scope.launch {
|
||||||
delay(1.seconds)
|
delay(1.seconds)
|
||||||
@@ -270,7 +274,8 @@ fun LibraryBottomActionMenu(
|
|||||||
val showOverflow = onClickCleanTitles != null ||
|
val showOverflow = onClickCleanTitles != null ||
|
||||||
onClickAddToMangaDex != null ||
|
onClickAddToMangaDex != null ||
|
||||||
onClickResetInfo != null ||
|
onClickResetInfo != null ||
|
||||||
onClickCollectRecommendations != null
|
onClickCollectRecommendations != null ||
|
||||||
|
onMigrateClicked != null
|
||||||
val configuration = LocalConfiguration.current
|
val configuration = LocalConfiguration.current
|
||||||
val moveMarkPrev = remember { !configuration.isTabletUi() }
|
val moveMarkPrev = remember { !configuration.isTabletUi() }
|
||||||
var overFlowOpen by remember { mutableStateOf(false) }
|
var overFlowOpen by remember { mutableStateOf(false) }
|
||||||
@@ -299,11 +304,11 @@ fun LibraryBottomActionMenu(
|
|||||||
onLongClick = { onLongClickItem(3) },
|
onLongClick = { onLongClickItem(3) },
|
||||||
onClick = { downloadExpanded = !downloadExpanded },
|
onClick = { downloadExpanded = !downloadExpanded },
|
||||||
) {
|
) {
|
||||||
val onDismissRequest = { downloadExpanded = false }
|
|
||||||
DownloadDropdownMenu(
|
DownloadDropdownMenu(
|
||||||
expanded = downloadExpanded,
|
expanded = downloadExpanded,
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = { downloadExpanded = false },
|
||||||
onDownloadClicked = onDownloadClicked,
|
onDownloadClicked = onDownloadClicked,
|
||||||
|
offset = BottomBarMenuDpOffset,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -355,10 +360,10 @@ fun LibraryBottomActionMenu(
|
|||||||
onClick = onClickCleanTitles,
|
onClick = onClickCleanTitles,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (onClickMigrate != null) {
|
if (onMigrateClicked != null) {
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text(stringResource(MR.strings.migrate)) },
|
text = { Text(stringResource(MR.strings.migrate)) },
|
||||||
onClick = onClickMigrate,
|
onClick = onMigrateClicked,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (onClickCollectRecommendations != null) {
|
if (onClickCollectRecommendations != null) {
|
||||||
@@ -388,18 +393,11 @@ fun LibraryBottomActionMenu(
|
|||||||
onLongClick = { onLongClickItem(2) },
|
onLongClick = { onLongClickItem(2) },
|
||||||
onClick = onMarkAsUnreadClicked,
|
onClick = onMarkAsUnreadClicked,
|
||||||
)
|
)
|
||||||
if (onClickMigrate != null) {
|
|
||||||
Button(
|
|
||||||
title = stringResource(MR.strings.migrate),
|
|
||||||
icon = Icons.Outlined.SwapCalls,
|
|
||||||
toConfirm = confirm[5],
|
|
||||||
onLongClick = { onLongClickItem(5) },
|
|
||||||
onClick = onClickMigrate,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// SY <--
|
// SY <--
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val BottomBarMenuDpOffset = DpOffset(0.dp, 0.dp)
|
||||||
|
|||||||
@@ -3,9 +3,6 @@ package eu.kanade.presentation.manga.components
|
|||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.drawable.BitmapDrawable
|
import android.graphics.drawable.BitmapDrawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.activity.compose.PredictiveBackHandler
|
|
||||||
import androidx.compose.animation.core.animate
|
|
||||||
import androidx.compose.animation.core.tween
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
@@ -28,18 +25,15 @@ import androidx.compose.material3.SnackbarHostState
|
|||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableFloatStateOf
|
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.graphicsLayer
|
|
||||||
import androidx.compose.ui.platform.LocalDensity
|
import androidx.compose.ui.platform.LocalDensity
|
||||||
import androidx.compose.ui.unit.DpOffset
|
import androidx.compose.ui.unit.DpOffset
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.util.lerp
|
|
||||||
import androidx.compose.ui.viewinterop.AndroidView
|
import androidx.compose.ui.viewinterop.AndroidView
|
||||||
import androidx.compose.ui.window.Dialog
|
import androidx.compose.ui.window.Dialog
|
||||||
import androidx.compose.ui.window.DialogProperties
|
import androidx.compose.ui.window.DialogProperties
|
||||||
@@ -56,14 +50,11 @@ import eu.kanade.presentation.components.DropdownMenu
|
|||||||
import eu.kanade.presentation.manga.EditCoverAction
|
import eu.kanade.presentation.manga.EditCoverAction
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderPageImageView
|
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderPageImageView
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
import soup.compose.material.motion.MotionConstants
|
|
||||||
import tachiyomi.domain.manga.model.Manga
|
import tachiyomi.domain.manga.model.Manga
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.material.Scaffold
|
import tachiyomi.presentation.core.components.material.Scaffold
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
import tachiyomi.presentation.core.util.PredictiveBack
|
|
||||||
import tachiyomi.presentation.core.util.clickableNoIndication
|
import tachiyomi.presentation.core.util.clickableNoIndication
|
||||||
import kotlin.coroutines.cancellation.CancellationException
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MangaCoverDialog(
|
fun MangaCoverDialog(
|
||||||
@@ -162,32 +153,10 @@ fun MangaCoverDialog(
|
|||||||
val statusBarPaddingPx = with(LocalDensity.current) { contentPadding.calculateTopPadding().roundToPx() }
|
val statusBarPaddingPx = with(LocalDensity.current) { contentPadding.calculateTopPadding().roundToPx() }
|
||||||
val bottomPaddingPx = with(LocalDensity.current) { contentPadding.calculateBottomPadding().roundToPx() }
|
val bottomPaddingPx = with(LocalDensity.current) { contentPadding.calculateBottomPadding().roundToPx() }
|
||||||
|
|
||||||
var scale by remember { mutableFloatStateOf(1f) }
|
|
||||||
PredictiveBackHandler { progress ->
|
|
||||||
try {
|
|
||||||
progress.collect { backEvent ->
|
|
||||||
scale = lerp(1f, 0.8f, PredictiveBack.transform(backEvent.progress))
|
|
||||||
}
|
|
||||||
onDismissRequest()
|
|
||||||
} catch (e: CancellationException) {
|
|
||||||
animate(
|
|
||||||
initialValue = scale,
|
|
||||||
targetValue = 1f,
|
|
||||||
animationSpec = tween(durationMillis = MotionConstants.DefaultMotionDuration),
|
|
||||||
) { value, _ ->
|
|
||||||
scale = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.clickableNoIndication(onClick = onDismissRequest)
|
.clickableNoIndication(onClick = onDismissRequest),
|
||||||
.graphicsLayer {
|
|
||||||
scaleX = scale
|
|
||||||
scaleY = scale
|
|
||||||
},
|
|
||||||
) {
|
) {
|
||||||
AndroidView(
|
AndroidView(
|
||||||
factory = {
|
factory = {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import androidx.compose.foundation.layout.size
|
|||||||
import androidx.compose.foundation.layout.sizeIn
|
import androidx.compose.foundation.layout.sizeIn
|
||||||
import androidx.compose.foundation.lazy.LazyRow
|
import androidx.compose.foundation.lazy.LazyRow
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.foundation.text.appendInlineContent
|
||||||
import androidx.compose.foundation.text.selection.SelectionContainer
|
import androidx.compose.foundation.text.selection.SelectionContainer
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.outlined.CallMerge
|
import androidx.compose.material.icons.automirrored.outlined.CallMerge
|
||||||
@@ -33,7 +34,6 @@ import androidx.compose.material.icons.filled.PersonOutline
|
|||||||
import androidx.compose.material.icons.filled.Warning
|
import androidx.compose.material.icons.filled.Warning
|
||||||
import androidx.compose.material.icons.outlined.AttachMoney
|
import androidx.compose.material.icons.outlined.AttachMoney
|
||||||
import androidx.compose.material.icons.outlined.Block
|
import androidx.compose.material.icons.outlined.Block
|
||||||
import androidx.compose.material.icons.outlined.CallMerge
|
|
||||||
import androidx.compose.material.icons.outlined.Close
|
import androidx.compose.material.icons.outlined.Close
|
||||||
import androidx.compose.material.icons.outlined.Done
|
import androidx.compose.material.icons.outlined.Done
|
||||||
import androidx.compose.material.icons.outlined.DoneAll
|
import androidx.compose.material.icons.outlined.DoneAll
|
||||||
@@ -52,6 +52,7 @@ import androidx.compose.material3.Text
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
@@ -67,9 +68,13 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
import androidx.compose.ui.layout.Layout
|
import androidx.compose.ui.layout.Layout
|
||||||
|
import androidx.compose.ui.layout.onSizeChanged
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.text.LinkAnnotation
|
||||||
|
import androidx.compose.ui.text.SpanStyle
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.text.withLink
|
||||||
import androidx.compose.ui.unit.Constraints
|
import androidx.compose.ui.unit.Constraints
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -79,10 +84,15 @@ import coil3.request.ImageRequest
|
|||||||
import coil3.request.crossfade
|
import coil3.request.crossfade
|
||||||
import com.mikepenz.markdown.model.markdownAnnotator
|
import com.mikepenz.markdown.model.markdownAnnotator
|
||||||
import com.mikepenz.markdown.model.markdownAnnotatorConfig
|
import com.mikepenz.markdown.model.markdownAnnotatorConfig
|
||||||
|
import com.mikepenz.markdown.utils.getUnescapedTextInNode
|
||||||
|
import eu.kanade.domain.ui.UiPreferences
|
||||||
import eu.kanade.presentation.components.DropdownMenu
|
import eu.kanade.presentation.components.DropdownMenu
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||||
|
import org.intellij.markdown.MarkdownElementTypes
|
||||||
|
import org.intellij.markdown.MarkdownTokenTypes
|
||||||
|
import org.intellij.markdown.ast.findChildOfType
|
||||||
import tachiyomi.domain.manga.model.Manga
|
import tachiyomi.domain.manga.model.Manga
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.i18n.sy.SYMR
|
import tachiyomi.i18n.sy.SYMR
|
||||||
@@ -93,6 +103,8 @@ import tachiyomi.presentation.core.i18n.pluralStringResource
|
|||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
import tachiyomi.presentation.core.util.clickableNoIndication
|
import tachiyomi.presentation.core.util.clickableNoIndication
|
||||||
import tachiyomi.presentation.core.util.secondaryItemAlpha
|
import tachiyomi.presentation.core.util.secondaryItemAlpha
|
||||||
|
import uy.kohesive.injekt.Injekt
|
||||||
|
import uy.kohesive.injekt.api.get
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.temporal.ChronoUnit
|
import java.time.temporal.ChronoUnit
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
@@ -593,8 +605,35 @@ private fun ColumnScope.MangaContentInfo(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val descriptionAnnotator = markdownAnnotator(
|
@Composable
|
||||||
|
private fun descriptionAnnotator(loadImages: Boolean, linkStyle: SpanStyle) = remember(loadImages, linkStyle) {
|
||||||
|
markdownAnnotator(
|
||||||
annotate = { content, child ->
|
annotate = { content, child ->
|
||||||
|
if (!loadImages && child.type == MarkdownElementTypes.IMAGE) {
|
||||||
|
val inlineLink = child.findChildOfType(MarkdownElementTypes.INLINE_LINK)
|
||||||
|
|
||||||
|
val url = inlineLink?.findChildOfType(MarkdownElementTypes.LINK_DESTINATION)
|
||||||
|
?.getUnescapedTextInNode(content)
|
||||||
|
?: inlineLink?.findChildOfType(MarkdownElementTypes.AUTOLINK)
|
||||||
|
?.findChildOfType(MarkdownTokenTypes.AUTOLINK)
|
||||||
|
?.getUnescapedTextInNode(content)
|
||||||
|
?: return@markdownAnnotator false
|
||||||
|
|
||||||
|
val textNode = inlineLink?.findChildOfType(MarkdownElementTypes.LINK_TITLE)
|
||||||
|
?: inlineLink?.findChildOfType(MarkdownElementTypes.LINK_TEXT)
|
||||||
|
val altText = textNode?.findChildOfType(MarkdownTokenTypes.TEXT)
|
||||||
|
?.getUnescapedTextInNode(content).orEmpty()
|
||||||
|
|
||||||
|
withLink(LinkAnnotation.Url(url = url)) {
|
||||||
|
pushStyle(linkStyle)
|
||||||
|
appendInlineContent(MARKDOWN_INLINE_IMAGE_TAG)
|
||||||
|
append(altText)
|
||||||
|
pop()
|
||||||
|
}
|
||||||
|
|
||||||
|
return@markdownAnnotator true
|
||||||
|
}
|
||||||
|
|
||||||
if (child.type in DISALLOWED_MARKDOWN_TYPES) {
|
if (child.type in DISALLOWED_MARKDOWN_TYPES) {
|
||||||
append(content.substring(child.startOffset, child.endOffset))
|
append(content.substring(child.startOffset, child.endOffset))
|
||||||
return@markdownAnnotator true
|
return@markdownAnnotator true
|
||||||
@@ -606,6 +645,7 @@ private val descriptionAnnotator = markdownAnnotator(
|
|||||||
eolAsNewLine = true,
|
eolAsNewLine = true,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MangaSummary(
|
private fun MangaSummary(
|
||||||
@@ -615,10 +655,13 @@ private fun MangaSummary(
|
|||||||
onEditNotesClicked: () -> Unit,
|
onEditNotesClicked: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
|
val preferences = remember { Injekt.get<UiPreferences>() }
|
||||||
|
val loadImages = remember { preferences.imagesInDescription.get() }
|
||||||
val animProgress by animateFloatAsState(
|
val animProgress by animateFloatAsState(
|
||||||
targetValue = if (expanded) 1f else 0f,
|
targetValue = if (expanded) 1f else 0f,
|
||||||
label = "summary",
|
label = "summary",
|
||||||
)
|
)
|
||||||
|
var infoHeight by remember { mutableIntStateOf(0) }
|
||||||
Layout(
|
Layout(
|
||||||
modifier = modifier.clipToBounds(),
|
modifier = modifier.clipToBounds(),
|
||||||
contents = listOf(
|
contents = listOf(
|
||||||
@@ -631,21 +674,11 @@ private fun MangaSummary(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Column {
|
Column(
|
||||||
MangaNotesSection(
|
modifier = Modifier.onSizeChanged { size ->
|
||||||
content = notes,
|
infoHeight = size.height
|
||||||
expanded = true,
|
|
||||||
onEditNotes = onEditNotesClicked,
|
|
||||||
)
|
|
||||||
MarkdownRender(
|
|
||||||
content = description,
|
|
||||||
modifier = Modifier.secondaryItemAlpha(),
|
|
||||||
annotator = descriptionAnnotator,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
) {
|
||||||
Column {
|
|
||||||
MangaNotesSection(
|
MangaNotesSection(
|
||||||
content = notes,
|
content = notes,
|
||||||
expanded = expanded,
|
expanded = expanded,
|
||||||
@@ -655,7 +688,11 @@ private fun MangaSummary(
|
|||||||
MarkdownRender(
|
MarkdownRender(
|
||||||
content = description,
|
content = description,
|
||||||
modifier = Modifier.secondaryItemAlpha(),
|
modifier = Modifier.secondaryItemAlpha(),
|
||||||
annotator = descriptionAnnotator,
|
annotator = descriptionAnnotator(
|
||||||
|
loadImages = loadImages,
|
||||||
|
linkStyle = getMarkdownLinkStyle().toSpanStyle(),
|
||||||
|
),
|
||||||
|
loadImages = loadImages,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -678,14 +715,11 @@ private fun MangaSummary(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
) { (shrunk, expanded, actual, scrim), constraints ->
|
) { (shrunk, actual, scrim), constraints ->
|
||||||
val shrunkHeight = shrunk.single()
|
val shrunkHeight = shrunk.single()
|
||||||
.measure(constraints)
|
.measure(constraints)
|
||||||
.height
|
.height
|
||||||
val expandedHeight = expanded.single()
|
val heightDelta = infoHeight - shrunkHeight
|
||||||
.measure(constraints)
|
|
||||||
.height
|
|
||||||
val heightDelta = expandedHeight - shrunkHeight
|
|
||||||
val scrimHeight = 24.dp.roundToPx()
|
val scrimHeight = 24.dp.roundToPx()
|
||||||
|
|
||||||
val actualPlaceable = actual.single()
|
val actualPlaceable = actual.single()
|
||||||
|
|||||||
@@ -4,14 +4,19 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.text.InlineTextContent
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.outlined.Image
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.ReadOnlyComposable
|
import androidx.compose.runtime.ReadOnlyComposable
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.layout.FirstBaseline
|
import androidx.compose.ui.layout.FirstBaseline
|
||||||
|
import androidx.compose.ui.text.Placeholder
|
||||||
|
import androidx.compose.ui.text.PlaceholderVerticalAlign
|
||||||
import androidx.compose.ui.text.SpanStyle
|
import androidx.compose.ui.text.SpanStyle
|
||||||
import androidx.compose.ui.text.TextLinkStyles
|
import androidx.compose.ui.text.TextLinkStyles
|
||||||
import androidx.compose.ui.text.font.FontFamily
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
@@ -32,11 +37,13 @@ import com.mikepenz.markdown.compose.elements.MarkdownTableRow
|
|||||||
import com.mikepenz.markdown.compose.elements.MarkdownText
|
import com.mikepenz.markdown.compose.elements.MarkdownText
|
||||||
import com.mikepenz.markdown.compose.elements.listDepth
|
import com.mikepenz.markdown.compose.elements.listDepth
|
||||||
import com.mikepenz.markdown.model.DefaultMarkdownColors
|
import com.mikepenz.markdown.model.DefaultMarkdownColors
|
||||||
|
import com.mikepenz.markdown.model.DefaultMarkdownInlineContent
|
||||||
import com.mikepenz.markdown.model.DefaultMarkdownTypography
|
import com.mikepenz.markdown.model.DefaultMarkdownTypography
|
||||||
import com.mikepenz.markdown.model.MarkdownAnnotator
|
import com.mikepenz.markdown.model.MarkdownAnnotator
|
||||||
import com.mikepenz.markdown.model.MarkdownColors
|
import com.mikepenz.markdown.model.MarkdownColors
|
||||||
import com.mikepenz.markdown.model.MarkdownPadding
|
import com.mikepenz.markdown.model.MarkdownPadding
|
||||||
import com.mikepenz.markdown.model.MarkdownTypography
|
import com.mikepenz.markdown.model.MarkdownTypography
|
||||||
|
import com.mikepenz.markdown.model.NoOpImageTransformerImpl
|
||||||
import com.mikepenz.markdown.model.markdownAnnotator
|
import com.mikepenz.markdown.model.markdownAnnotator
|
||||||
import com.mikepenz.markdown.model.rememberMarkdownState
|
import com.mikepenz.markdown.model.rememberMarkdownState
|
||||||
import org.intellij.markdown.MarkdownTokenTypes.Companion.HTML_TAG
|
import org.intellij.markdown.MarkdownTokenTypes.Companion.HTML_TAG
|
||||||
@@ -59,12 +66,15 @@ import org.intellij.markdown.parser.markerblocks.providers.ListMarkerProvider
|
|||||||
import org.intellij.markdown.parser.markerblocks.providers.SetextHeaderProvider
|
import org.intellij.markdown.parser.markerblocks.providers.SetextHeaderProvider
|
||||||
import tachiyomi.presentation.core.components.material.padding
|
import tachiyomi.presentation.core.components.material.padding
|
||||||
|
|
||||||
|
const val MARKDOWN_INLINE_IMAGE_TAG = "MARKDOWN_INLINE_IMAGE"
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MarkdownRender(
|
fun MarkdownRender(
|
||||||
content: String,
|
content: String,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
flavour: MarkdownFlavourDescriptor = SimpleMarkdownFlavourDescriptor,
|
flavour: MarkdownFlavourDescriptor = SimpleMarkdownFlavourDescriptor,
|
||||||
annotator: MarkdownAnnotator = remember { markdownAnnotator() },
|
annotator: MarkdownAnnotator = remember { markdownAnnotator() },
|
||||||
|
loadImages: Boolean = true,
|
||||||
) {
|
) {
|
||||||
Markdown(
|
Markdown(
|
||||||
markdownState = rememberMarkdownState(
|
markdownState = rememberMarkdownState(
|
||||||
@@ -77,7 +87,10 @@ fun MarkdownRender(
|
|||||||
typography = getMarkdownTypography(),
|
typography = getMarkdownTypography(),
|
||||||
padding = markdownPadding,
|
padding = markdownPadding,
|
||||||
components = markdownComponents,
|
components = markdownComponents,
|
||||||
imageTransformer = Coil3ImageTransformerImpl,
|
imageTransformer = remember(loadImages) {
|
||||||
|
if (loadImages) Coil3ImageTransformerImpl else NoOpImageTransformerImpl()
|
||||||
|
},
|
||||||
|
inlineContent = getMarkdownInlineContent(),
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -88,24 +101,24 @@ private fun getMarkdownColors(): MarkdownColors {
|
|||||||
val codeBackground = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.1f)
|
val codeBackground = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.1f)
|
||||||
return DefaultMarkdownColors(
|
return DefaultMarkdownColors(
|
||||||
text = MaterialTheme.colorScheme.onSurface,
|
text = MaterialTheme.colorScheme.onSurface,
|
||||||
codeText = Color.Unspecified,
|
|
||||||
inlineCodeText = Color.Unspecified,
|
|
||||||
linkText = Color.Unspecified,
|
|
||||||
codeBackground = codeBackground,
|
codeBackground = codeBackground,
|
||||||
inlineCodeBackground = codeBackground,
|
inlineCodeBackground = codeBackground,
|
||||||
dividerColor = MaterialTheme.colorScheme.outlineVariant,
|
dividerColor = MaterialTheme.colorScheme.outlineVariant,
|
||||||
tableText = Color.Unspecified,
|
|
||||||
tableBackground = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.05f),
|
tableBackground = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.05f),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun getMarkdownTypography(): MarkdownTypography {
|
fun getMarkdownLinkStyle() = MaterialTheme.typography.bodyMedium.copy(
|
||||||
val link = MaterialTheme.typography.bodyMedium.copy(
|
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = MaterialTheme.colorScheme.primary,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
@ReadOnlyComposable
|
||||||
|
private fun getMarkdownTypography(): MarkdownTypography {
|
||||||
|
val link = getMarkdownLinkStyle()
|
||||||
return DefaultMarkdownTypography(
|
return DefaultMarkdownTypography(
|
||||||
h1 = MaterialTheme.typography.headlineMedium,
|
h1 = MaterialTheme.typography.headlineMedium,
|
||||||
h2 = MaterialTheme.typography.headlineSmall,
|
h2 = MaterialTheme.typography.headlineSmall,
|
||||||
@@ -121,7 +134,6 @@ private fun getMarkdownTypography(): MarkdownTypography {
|
|||||||
ordered = MaterialTheme.typography.bodyMedium,
|
ordered = MaterialTheme.typography.bodyMedium,
|
||||||
bullet = MaterialTheme.typography.bodyMedium,
|
bullet = MaterialTheme.typography.bodyMedium,
|
||||||
list = MaterialTheme.typography.bodyMedium,
|
list = MaterialTheme.typography.bodyMedium,
|
||||||
link = link,
|
|
||||||
textLink = TextLinkStyles(style = link.toSpanStyle()),
|
textLink = TextLinkStyles(style = link.toSpanStyle()),
|
||||||
table = MaterialTheme.typography.bodyMedium,
|
table = MaterialTheme.typography.bodyMedium,
|
||||||
)
|
)
|
||||||
@@ -216,6 +228,27 @@ private val markdownComponents = markdownComponents(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
@ReadOnlyComposable
|
||||||
|
private fun getMarkdownInlineContent() = DefaultMarkdownInlineContent(
|
||||||
|
inlineContent = mapOf(
|
||||||
|
MARKDOWN_INLINE_IMAGE_TAG to InlineTextContent(
|
||||||
|
placeholder = Placeholder(
|
||||||
|
width = MaterialTheme.typography.bodyMedium.fontSize * 1.25,
|
||||||
|
height = MaterialTheme.typography.bodyMedium.fontSize * 1.25,
|
||||||
|
placeholderVerticalAlign = PlaceholderVerticalAlign.TextCenter,
|
||||||
|
),
|
||||||
|
children = {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Outlined.Image,
|
||||||
|
contentDescription = null,
|
||||||
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
private object SimpleMarkdownFlavourDescriptor : CommonMarkFlavourDescriptor() {
|
private object SimpleMarkdownFlavourDescriptor : CommonMarkFlavourDescriptor() {
|
||||||
override val markerProcessorFactory: MarkerProcessorFactory = SimpleMarkdownProcessFactory
|
override val markerProcessorFactory: MarkerProcessorFactory = SimpleMarkdownProcessFactory
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import androidx.compose.runtime.CompositionLocalProvider
|
|||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Immutable
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalContext
|
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -25,8 +24,6 @@ import eu.kanade.presentation.components.ChipBorder
|
|||||||
import eu.kanade.presentation.components.SuggestionChip
|
import eu.kanade.presentation.components.SuggestionChip
|
||||||
import eu.kanade.presentation.components.SuggestionChipDefaults
|
import eu.kanade.presentation.components.SuggestionChipDefaults
|
||||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||||
import eu.kanade.tachiyomi.source.Source
|
|
||||||
import eu.kanade.tachiyomi.source.online.all.EHentai
|
|
||||||
import exh.metadata.metadata.EHentaiSearchMetadata
|
import exh.metadata.metadata.EHentaiSearchMetadata
|
||||||
import exh.metadata.metadata.RaisedSearchMetadata
|
import exh.metadata.metadata.RaisedSearchMetadata
|
||||||
import exh.metadata.metadata.base.RaisedTag
|
import exh.metadata.metadata.base.RaisedTag
|
||||||
@@ -49,7 +46,7 @@ value class SearchMetadataChips(
|
|||||||
val tags: Map<String, List<DisplayTag>>,
|
val tags: Map<String, List<DisplayTag>>,
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
operator fun invoke(meta: RaisedSearchMetadata?, source: Source, tags: List<String>?): SearchMetadataChips? {
|
operator fun invoke(meta: RaisedSearchMetadata?, sourceId: Long, tags: List<String>?): SearchMetadataChips? {
|
||||||
return if (meta != null) {
|
return if (meta != null) {
|
||||||
SearchMetadataChips(
|
SearchMetadataChips(
|
||||||
meta.tags
|
meta.tags
|
||||||
@@ -59,11 +56,11 @@ value class SearchMetadataChips(
|
|||||||
namespace = it.namespace,
|
namespace = it.namespace,
|
||||||
text = it.name,
|
text = it.name,
|
||||||
search = if (!it.namespace.isNullOrEmpty()) {
|
search = if (!it.namespace.isNullOrEmpty()) {
|
||||||
SourceTagsUtil.getWrappedTag(source.id, namespace = it.namespace, tag = it.name)
|
SourceTagsUtil.getWrappedTag(sourceId, namespace = it.namespace, tag = it.name)
|
||||||
} else {
|
} else {
|
||||||
SourceTagsUtil.getWrappedTag(source.id, fullTag = it.name)
|
SourceTagsUtil.getWrappedTag(sourceId, fullTag = it.name)
|
||||||
} ?: it.name,
|
} ?: it.name,
|
||||||
border = if (source.id == EXH_SOURCE_ID || source.id == EH_SOURCE_ID) {
|
border = if (sourceId == EXH_SOURCE_ID || sourceId == EH_SOURCE_ID) {
|
||||||
when (it.type) {
|
when (it.type) {
|
||||||
EHentaiSearchMetadata.TAG_TYPE_NORMAL -> 2
|
EHentaiSearchMetadata.TAG_TYPE_NORMAL -> 2
|
||||||
EHentaiSearchMetadata.TAG_TYPE_LIGHT -> 1
|
EHentaiSearchMetadata.TAG_TYPE_LIGHT -> 1
|
||||||
@@ -178,7 +175,6 @@ fun TagsChip(
|
|||||||
fun NamespaceTagsPreview() {
|
fun NamespaceTagsPreview() {
|
||||||
TachiyomiPreviewTheme {
|
TachiyomiPreviewTheme {
|
||||||
Surface {
|
Surface {
|
||||||
val context = LocalContext.current
|
|
||||||
NamespaceTags(
|
NamespaceTags(
|
||||||
tags = remember {
|
tags = remember {
|
||||||
EHentaiSearchMetadata().apply {
|
EHentaiSearchMetadata().apply {
|
||||||
@@ -216,7 +212,7 @@ fun NamespaceTagsPreview() {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}.let { SearchMetadataChips(it, EHentai(EXH_SOURCE_ID, true, context), emptyList()) }!!
|
}.let { SearchMetadataChips(it, EXH_SOURCE_ID, emptyList()) }!!
|
||||||
},
|
},
|
||||||
onClick = {},
|
onClick = {},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,12 +7,9 @@ import androidx.compose.material.icons.automirrored.outlined.Label
|
|||||||
import androidx.compose.material.icons.automirrored.outlined.PlaylistAdd
|
import androidx.compose.material.icons.automirrored.outlined.PlaylistAdd
|
||||||
import androidx.compose.material.icons.outlined.CloudOff
|
import androidx.compose.material.icons.outlined.CloudOff
|
||||||
import androidx.compose.material.icons.outlined.GetApp
|
import androidx.compose.material.icons.outlined.GetApp
|
||||||
import androidx.compose.material.icons.outlined.HelpOutline
|
|
||||||
import androidx.compose.material.icons.outlined.History
|
import androidx.compose.material.icons.outlined.History
|
||||||
import androidx.compose.material.icons.outlined.Info
|
import androidx.compose.material.icons.outlined.Info
|
||||||
import androidx.compose.material.icons.outlined.Label
|
|
||||||
import androidx.compose.material.icons.outlined.NewReleases
|
import androidx.compose.material.icons.outlined.NewReleases
|
||||||
import androidx.compose.material.icons.outlined.PlaylistAdd
|
|
||||||
import androidx.compose.material.icons.outlined.QueryStats
|
import androidx.compose.material.icons.outlined.QueryStats
|
||||||
import androidx.compose.material.icons.outlined.Settings
|
import androidx.compose.material.icons.outlined.Settings
|
||||||
import androidx.compose.material.icons.outlined.Storage
|
import androidx.compose.material.icons.outlined.Storage
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ internal class PermissionStep : OnboardingStep {
|
|||||||
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
color = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||||
)
|
)
|
||||||
|
|
||||||
val crashlyticsPref = privacyPreferences.crashlytics()
|
val crashlyticsPref = privacyPreferences.crashlytics
|
||||||
val crashlytics by crashlyticsPref.collectAsState()
|
val crashlytics by crashlyticsPref.collectAsState()
|
||||||
PermissionSwitch(
|
PermissionSwitch(
|
||||||
title = stringResource(MR.strings.onboarding_permission_crashlytics),
|
title = stringResource(MR.strings.onboarding_permission_crashlytics),
|
||||||
@@ -131,7 +131,7 @@ internal class PermissionStep : OnboardingStep {
|
|||||||
onToggleChange = crashlyticsPref::set,
|
onToggleChange = crashlyticsPref::set,
|
||||||
)
|
)
|
||||||
|
|
||||||
val analyticsPref = privacyPreferences.analytics()
|
val analyticsPref = privacyPreferences.analytics
|
||||||
val analytics by analyticsPref.collectAsState()
|
val analytics by analyticsPref.collectAsState()
|
||||||
PermissionSwitch(
|
PermissionSwitch(
|
||||||
title = stringResource(MR.strings.onboarding_permission_analytics),
|
title = stringResource(MR.strings.onboarding_permission_analytics),
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import uy.kohesive.injekt.api.get
|
|||||||
|
|
||||||
internal class StorageStep : OnboardingStep {
|
internal class StorageStep : OnboardingStep {
|
||||||
|
|
||||||
private val storagePref = Injekt.get<StoragePreferences>().baseStorageDirectory()
|
private val storagePref = Injekt.get<StoragePreferences>().baseStorageDirectory
|
||||||
|
|
||||||
private var _isComplete by mutableStateOf(false)
|
private var _isComplete by mutableStateOf(false)
|
||||||
|
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ internal class ThemeStep : OnboardingStep {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun Content() {
|
override fun Content() {
|
||||||
val themeModePref = uiPreferences.themeMode()
|
val themeModePref = uiPreferences.themeMode
|
||||||
val themeMode by themeModePref.collectAsState()
|
val themeMode by themeModePref.collectAsState()
|
||||||
|
|
||||||
val appThemePref = uiPreferences.appTheme()
|
val appThemePref = uiPreferences.appTheme
|
||||||
val appTheme by appThemePref.collectAsState()
|
val appTheme by appThemePref.collectAsState()
|
||||||
|
|
||||||
val amoledPref = uiPreferences.themeDarkAmoled()
|
val amoledPref = uiPreferences.themeDarkAmoled
|
||||||
val amoled by amoledPref.collectAsState()
|
val amoled by amoledPref.collectAsState()
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ sealed class Preference {
|
|||||||
abstract val title: String
|
abstract val title: String
|
||||||
abstract val enabled: Boolean
|
abstract val enabled: Boolean
|
||||||
|
|
||||||
sealed class PreferenceItem<T> : Preference() {
|
sealed class PreferenceItem<T, R> : Preference() {
|
||||||
// SY -->
|
// SY -->
|
||||||
abstract val subtitle: CharSequence?
|
abstract val subtitle: CharSequence?
|
||||||
|
|
||||||
// SY <--
|
// SY <--
|
||||||
abstract val icon: ImageVector?
|
abstract val icon: ImageVector?
|
||||||
abstract val onValueChanged: suspend (value: T) -> Boolean
|
abstract val onValueChanged: suspend (value: T) -> R
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A basic [PreferenceItem] that only displays texts.
|
* A basic [PreferenceItem] that only displays texts.
|
||||||
@@ -30,10 +30,11 @@ sealed class Preference {
|
|||||||
override val title: String,
|
override val title: String,
|
||||||
override val subtitle: CharSequence? = null,
|
override val subtitle: CharSequence? = null,
|
||||||
override val enabled: Boolean = true,
|
override val enabled: Boolean = true,
|
||||||
|
val widget: @Composable (() -> Unit)? = null,
|
||||||
val onClick: (() -> Unit)? = null,
|
val onClick: (() -> Unit)? = null,
|
||||||
) : PreferenceItem<String>() {
|
) : PreferenceItem<String, Unit>() {
|
||||||
override val icon: ImageVector? = null
|
override val icon: ImageVector? = null
|
||||||
override val onValueChanged: suspend (value: String) -> Boolean = { true }
|
override val onValueChanged: suspend (value: String) -> Unit = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,7 +46,7 @@ sealed class Preference {
|
|||||||
override val subtitle: CharSequence? = null,
|
override val subtitle: CharSequence? = null,
|
||||||
override val enabled: Boolean = true,
|
override val enabled: Boolean = true,
|
||||||
override val onValueChanged: suspend (value: Boolean) -> Boolean = { true },
|
override val onValueChanged: suspend (value: Boolean) -> Boolean = { true },
|
||||||
) : PreferenceItem<Boolean>() {
|
) : PreferenceItem<Boolean, Boolean>() {
|
||||||
override val icon: ImageVector? = null
|
override val icon: ImageVector? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,12 +56,13 @@ sealed class Preference {
|
|||||||
data class SliderPreference(
|
data class SliderPreference(
|
||||||
val value: Int,
|
val value: Int,
|
||||||
override val title: String,
|
override val title: String,
|
||||||
|
override val subtitle: String? = null,
|
||||||
|
val valueString: String? = null,
|
||||||
val valueRange: IntProgression = 0..1,
|
val valueRange: IntProgression = 0..1,
|
||||||
@IntRange(from = 0) val steps: Int = with(valueRange) { (last - first) - 1 },
|
@IntRange(from = 0) val steps: Int = with(valueRange) { (last - first) - 1 },
|
||||||
override val subtitle: String? = null,
|
|
||||||
override val enabled: Boolean = true,
|
override val enabled: Boolean = true,
|
||||||
override val onValueChanged: suspend (value: Int) -> Boolean = { true },
|
override val onValueChanged: suspend (value: Int) -> Unit = {},
|
||||||
) : PreferenceItem<Int>() {
|
) : PreferenceItem<Int, Unit>() {
|
||||||
override val icon: ImageVector? = null
|
override val icon: ImageVector? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +80,7 @@ sealed class Preference {
|
|||||||
override val icon: ImageVector? = null,
|
override val icon: ImageVector? = null,
|
||||||
override val enabled: Boolean = true,
|
override val enabled: Boolean = true,
|
||||||
override val onValueChanged: suspend (value: T) -> Boolean = { true },
|
override val onValueChanged: suspend (value: T) -> Boolean = { true },
|
||||||
) : PreferenceItem<T>() {
|
) : PreferenceItem<T, Boolean>() {
|
||||||
internal fun internalSet(value: Any) = preference.set(value as T)
|
internal fun internalSet(value: Any) = preference.set(value as T)
|
||||||
internal suspend fun internalOnValueChanged(value: Any) = onValueChanged(value as T)
|
internal suspend fun internalOnValueChanged(value: Any) = onValueChanged(value as T)
|
||||||
|
|
||||||
@@ -99,8 +101,8 @@ sealed class Preference {
|
|||||||
{ v, e -> subtitle?.format(e[v]) },
|
{ v, e -> subtitle?.format(e[v]) },
|
||||||
override val icon: ImageVector? = null,
|
override val icon: ImageVector? = null,
|
||||||
override val enabled: Boolean = true,
|
override val enabled: Boolean = true,
|
||||||
override val onValueChanged: suspend (value: String) -> Boolean = { true },
|
override val onValueChanged: suspend (value: String) -> Unit = {},
|
||||||
) : PreferenceItem<String>()
|
) : PreferenceItem<String, Unit>()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A [PreferenceItem] that displays a list of entries as a dialog.
|
* A [PreferenceItem] that displays a list of entries as a dialog.
|
||||||
@@ -124,7 +126,7 @@ sealed class Preference {
|
|||||||
override val icon: ImageVector? = null,
|
override val icon: ImageVector? = null,
|
||||||
override val enabled: Boolean = true,
|
override val enabled: Boolean = true,
|
||||||
override val onValueChanged: suspend (value: Set<String>) -> Boolean = { true },
|
override val onValueChanged: suspend (value: Set<String>) -> Boolean = { true },
|
||||||
) : PreferenceItem<Set<String>>()
|
) : PreferenceItem<Set<String>, Boolean>()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A [PreferenceItem] that shows a EditText in the dialog.
|
* A [PreferenceItem] that shows a EditText in the dialog.
|
||||||
@@ -135,7 +137,7 @@ sealed class Preference {
|
|||||||
override val subtitle: String? = "%s",
|
override val subtitle: String? = "%s",
|
||||||
override val enabled: Boolean = true,
|
override val enabled: Boolean = true,
|
||||||
override val onValueChanged: suspend (value: String) -> Boolean = { true },
|
override val onValueChanged: suspend (value: String) -> Boolean = { true },
|
||||||
) : PreferenceItem<String>() {
|
) : PreferenceItem<String, Boolean>() {
|
||||||
override val icon: ImageVector? = null
|
override val icon: ImageVector? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,31 +148,31 @@ sealed class Preference {
|
|||||||
val tracker: Tracker,
|
val tracker: Tracker,
|
||||||
val login: () -> Unit,
|
val login: () -> Unit,
|
||||||
val logout: () -> Unit,
|
val logout: () -> Unit,
|
||||||
) : PreferenceItem<String>() {
|
) : PreferenceItem<String, Unit>() {
|
||||||
override val title: String = ""
|
override val title: String = ""
|
||||||
override val enabled: Boolean = true
|
override val enabled: Boolean = true
|
||||||
override val subtitle: String? = null
|
override val subtitle: String? = null
|
||||||
override val icon: ImageVector? = null
|
override val icon: ImageVector? = null
|
||||||
override val onValueChanged: suspend (value: String) -> Boolean = { true }
|
override val onValueChanged: suspend (value: String) -> Unit = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class InfoPreference(
|
data class InfoPreference(
|
||||||
override val title: String,
|
override val title: String,
|
||||||
) : PreferenceItem<String>() {
|
) : PreferenceItem<String, Unit>() {
|
||||||
override val enabled: Boolean = true
|
override val enabled: Boolean = true
|
||||||
override val subtitle: String? = null
|
override val subtitle: String? = null
|
||||||
override val icon: ImageVector? = null
|
override val icon: ImageVector? = null
|
||||||
override val onValueChanged: suspend (value: String) -> Boolean = { true }
|
override val onValueChanged: suspend (value: String) -> Unit = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class CustomPreference(
|
data class CustomPreference(
|
||||||
override val title: String,
|
override val title: String,
|
||||||
val content: @Composable () -> Unit,
|
val content: @Composable () -> Unit,
|
||||||
) : PreferenceItem<Unit>() {
|
) : PreferenceItem<Unit, Unit>() {
|
||||||
override val enabled: Boolean = true
|
override val enabled: Boolean = true
|
||||||
override val subtitle: String? = null
|
override val subtitle: String? = null
|
||||||
override val icon: ImageVector? = null
|
override val icon: ImageVector? = null
|
||||||
override val onValueChanged: suspend (value: Unit) -> Boolean = { true }
|
override val onValueChanged: suspend (value: Unit) -> Unit = {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,6 +180,6 @@ sealed class Preference {
|
|||||||
override val title: String,
|
override val title: String,
|
||||||
override val enabled: Boolean = true,
|
override val enabled: Boolean = true,
|
||||||
|
|
||||||
val preferenceItems: ImmutableList<PreferenceItem<out Any>>,
|
val preferenceItems: ImmutableList<PreferenceItem<out Any, out Any>>,
|
||||||
) : Preference()
|
) : Preference()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ val LocalPreferenceMinHeight = compositionLocalOf(structuralEqualityPolicy()) {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun StatusWrapper(
|
fun StatusWrapper(
|
||||||
item: Preference.PreferenceItem<*>,
|
item: Preference.PreferenceItem<*, *>,
|
||||||
highlightKey: String?,
|
highlightKey: String?,
|
||||||
content: @Composable () -> Unit,
|
content: @Composable () -> Unit,
|
||||||
) {
|
) {
|
||||||
@@ -56,7 +56,7 @@ fun StatusWrapper(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun PreferenceItem(
|
internal fun PreferenceItem(
|
||||||
item: Preference.PreferenceItem<*>,
|
item: Preference.PreferenceItem<*, *>,
|
||||||
highlightKey: String?,
|
highlightKey: String?,
|
||||||
) {
|
) {
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
@@ -83,17 +83,18 @@ internal fun PreferenceItem(
|
|||||||
}
|
}
|
||||||
is Preference.PreferenceItem.SliderPreference -> {
|
is Preference.PreferenceItem.SliderPreference -> {
|
||||||
BaseSliderItem(
|
BaseSliderItem(
|
||||||
label = item.title,
|
|
||||||
value = item.value,
|
value = item.value,
|
||||||
valueRange = item.valueRange,
|
valueRange = item.valueRange,
|
||||||
valueText = item.subtitle.takeUnless { it.isNullOrEmpty() } ?: item.value.toString(),
|
|
||||||
steps = item.steps,
|
steps = item.steps,
|
||||||
labelStyle = MaterialTheme.typography.titleLarge.copy(fontSize = TitleFontSize),
|
title = item.title,
|
||||||
|
subtitle = item.subtitle,
|
||||||
|
valueString = item.valueString.takeUnless { it.isNullOrEmpty() } ?: item.value.toString(),
|
||||||
onChange = {
|
onChange = {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
item.onValueChanged(it)
|
item.onValueChanged(it)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
titleStyle = MaterialTheme.typography.titleLarge.copy(fontSize = TitleFontSize),
|
||||||
modifier = Modifier.padding(
|
modifier = Modifier.padding(
|
||||||
horizontal = PrefsHorizontalPadding,
|
horizontal = PrefsHorizontalPadding,
|
||||||
vertical = PrefsVerticalPadding,
|
vertical = PrefsVerticalPadding,
|
||||||
@@ -146,6 +147,7 @@ internal fun PreferenceItem(
|
|||||||
title = item.title,
|
title = item.title,
|
||||||
subtitle = item.subtitle,
|
subtitle = item.subtitle,
|
||||||
icon = item.icon,
|
icon = item.icon,
|
||||||
|
widget = item.widget,
|
||||||
onPreferenceClick = item.onClick,
|
onPreferenceClick = item.onClick,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ fun PreferenceScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create Preference Item
|
// Create Preference Item
|
||||||
is Preference.PreferenceItem<*> -> item {
|
is Preference.PreferenceItem<*, *> -> item {
|
||||||
PreferenceItem(
|
PreferenceItem(
|
||||||
item = preference,
|
item = preference,
|
||||||
highlightKey = highlightKey,
|
highlightKey = highlightKey,
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ import androidx.compose.ui.platform.LocalContext
|
|||||||
import androidx.compose.ui.window.DialogProperties
|
import androidx.compose.ui.window.DialogProperties
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import exh.log.xLogE
|
import exh.log.xLogE
|
||||||
|
import exh.source.ExhPreferences
|
||||||
import exh.uconfig.EHConfigurator
|
import exh.uconfig.EHConfigurator
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.NonCancellable
|
import kotlinx.coroutines.NonCancellable
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import tachiyomi.core.common.util.lang.launchUI
|
import tachiyomi.core.common.util.lang.launchUI
|
||||||
import tachiyomi.domain.UnsortedPreferences
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.i18n.sy.SYMR
|
import tachiyomi.i18n.sy.SYMR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
@@ -29,8 +29,8 @@ import kotlin.time.Duration.Companion.seconds
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ConfigureExhDialog(run: Boolean, onRunning: () -> Unit) {
|
fun ConfigureExhDialog(run: Boolean, onRunning: () -> Unit) {
|
||||||
val unsortedPreferences = remember {
|
val exhPreferences = remember {
|
||||||
Injekt.get<UnsortedPreferences>()
|
Injekt.get<ExhPreferences>()
|
||||||
}
|
}
|
||||||
var warnDialogOpen by remember { mutableStateOf(false) }
|
var warnDialogOpen by remember { mutableStateOf(false) }
|
||||||
var configureDialogOpen by remember { mutableStateOf(false) }
|
var configureDialogOpen by remember { mutableStateOf(false) }
|
||||||
@@ -38,7 +38,7 @@ fun ConfigureExhDialog(run: Boolean, onRunning: () -> Unit) {
|
|||||||
|
|
||||||
LaunchedEffect(run) {
|
LaunchedEffect(run) {
|
||||||
if (run) {
|
if (run) {
|
||||||
if (unsortedPreferences.exhShowSettingsUploadWarning().get()) {
|
if (exhPreferences.exhShowSettingsUploadWarning.get()) {
|
||||||
warnDialogOpen = true
|
warnDialogOpen = true
|
||||||
} else {
|
} else {
|
||||||
configureDialogOpen = true
|
configureDialogOpen = true
|
||||||
@@ -57,7 +57,7 @@ fun ConfigureExhDialog(run: Boolean, onRunning: () -> Unit) {
|
|||||||
confirmButton = {
|
confirmButton = {
|
||||||
TextButton(
|
TextButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
unsortedPreferences.exhShowSettingsUploadWarning().set(false)
|
exhPreferences.exhShowSettingsUploadWarning.set(false)
|
||||||
configureDialogOpen = true
|
configureDialogOpen = true
|
||||||
warnDialogOpen = false
|
warnDialogOpen = false
|
||||||
},
|
},
|
||||||
|
|||||||
+64
-28
@@ -3,6 +3,7 @@ package eu.kanade.presentation.more.settings.screen
|
|||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.ActivityNotFoundException
|
import android.content.ActivityNotFoundException
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.os.Build
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.webkit.WebStorage
|
import android.webkit.WebStorage
|
||||||
import android.webkit.WebView
|
import android.webkit.WebView
|
||||||
@@ -72,6 +73,7 @@ import exh.pref.DelegateSourcePreferences
|
|||||||
import exh.source.BlacklistedSources
|
import exh.source.BlacklistedSources
|
||||||
import exh.source.EH_SOURCE_ID
|
import exh.source.EH_SOURCE_ID
|
||||||
import exh.source.EXH_SOURCE_ID
|
import exh.source.EXH_SOURCE_ID
|
||||||
|
import exh.source.ExhPreferences
|
||||||
import exh.util.toAnnotatedString
|
import exh.util.toAnnotatedString
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
import kotlinx.collections.immutable.persistentMapOf
|
import kotlinx.collections.immutable.persistentMapOf
|
||||||
@@ -86,8 +88,8 @@ import tachiyomi.core.common.util.lang.launchNonCancellable
|
|||||||
import tachiyomi.core.common.util.lang.withUIContext
|
import tachiyomi.core.common.util.lang.withUIContext
|
||||||
import tachiyomi.core.common.util.system.ImageUtil
|
import tachiyomi.core.common.util.system.ImageUtil
|
||||||
import tachiyomi.core.common.util.system.logcat
|
import tachiyomi.core.common.util.system.logcat
|
||||||
import tachiyomi.domain.UnsortedPreferences
|
|
||||||
import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId
|
import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId
|
||||||
|
import tachiyomi.domain.download.service.DownloadPreferences
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences
|
import tachiyomi.domain.library.service.LibraryPreferences
|
||||||
import tachiyomi.domain.manga.interactor.GetAllManga
|
import tachiyomi.domain.manga.interactor.GetAllManga
|
||||||
import tachiyomi.domain.manga.interactor.ResetViewerFlags
|
import tachiyomi.domain.manga.interactor.ResetViewerFlags
|
||||||
@@ -116,6 +118,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
val basePreferences = remember { Injekt.get<BasePreferences>() }
|
val basePreferences = remember { Injekt.get<BasePreferences>() }
|
||||||
val networkPreferences = remember { Injekt.get<NetworkPreferences>() }
|
val networkPreferences = remember { Injekt.get<NetworkPreferences>() }
|
||||||
val libraryPreferences = remember { Injekt.get<LibraryPreferences>() }
|
val libraryPreferences = remember { Injekt.get<LibraryPreferences>() }
|
||||||
|
val downloadPreferences = remember { Injekt.get<DownloadPreferences>() }
|
||||||
|
|
||||||
return listOf(
|
return listOf(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
@@ -128,7 +131,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
/* SY --> Preference.PreferenceItem.SwitchPreference(
|
/* SY --> Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = networkPreferences.verboseLogging(),
|
preference = networkPreferences.verboseLogging,
|
||||||
title = stringResource(MR.strings.pref_verbose_logging),
|
title = stringResource(MR.strings.pref_verbose_logging),
|
||||||
subtitle = stringResource(MR.strings.pref_verbose_logging_summary),
|
subtitle = stringResource(MR.strings.pref_verbose_logging_summary),
|
||||||
onValueChanged = {
|
onValueChanged = {
|
||||||
@@ -147,9 +150,18 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.pref_manage_notifications),
|
title = stringResource(MR.strings.pref_manage_notifications),
|
||||||
onClick = {
|
onClick = {
|
||||||
val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply {
|
// SY -->
|
||||||
|
val intent = Intent().apply {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS)
|
||||||
putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName)
|
putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName)
|
||||||
|
} else {
|
||||||
|
setAction("android.settings.APP_NOTIFICATION_SETTINGS")
|
||||||
|
putExtra("app_package", context.packageName)
|
||||||
|
putExtra("app_uid", context.applicationInfo.uid)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// SY <--
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -157,6 +169,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
getDataGroup(),
|
getDataGroup(),
|
||||||
getNetworkGroup(networkPreferences = networkPreferences),
|
getNetworkGroup(networkPreferences = networkPreferences),
|
||||||
getLibraryGroup(libraryPreferences = libraryPreferences),
|
getLibraryGroup(libraryPreferences = libraryPreferences),
|
||||||
|
getDownloadsGroup(downloadPreferences = downloadPreferences),
|
||||||
getReaderGroup(basePreferences = basePreferences),
|
getReaderGroup(basePreferences = basePreferences),
|
||||||
getExtensionsGroup(basePreferences = basePreferences),
|
getExtensionsGroup(basePreferences = basePreferences),
|
||||||
// SY -->
|
// SY -->
|
||||||
@@ -238,7 +251,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val networkHelper = remember { Injekt.get<NetworkHelper>() }
|
val networkHelper = remember { Injekt.get<NetworkHelper>() }
|
||||||
|
|
||||||
val userAgentPref = networkPreferences.defaultUserAgent()
|
val userAgentPref = networkPreferences.defaultUserAgent
|
||||||
val userAgent by userAgentPref.collectAsState()
|
val userAgent by userAgentPref.collectAsState()
|
||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
@@ -274,7 +287,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = networkPreferences.dohProvider(),
|
preference = networkPreferences.dohProvider,
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
-1 to stringResource(MR.strings.disabled),
|
-1 to stringResource(MR.strings.disabled),
|
||||||
PREF_DOH_CLOUDFLARE to "Cloudflare",
|
PREF_DOH_CLOUDFLARE to "Cloudflare",
|
||||||
@@ -355,14 +368,37 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = libraryPreferences.updateMangaTitles(),
|
preference = libraryPreferences.updateMangaTitles,
|
||||||
title = stringResource(MR.strings.pref_update_library_manga_titles),
|
title = stringResource(MR.strings.pref_update_library_manga_titles),
|
||||||
subtitle = stringResource(MR.strings.pref_update_library_manga_titles_summary),
|
subtitle = stringResource(MR.strings.pref_update_library_manga_titles_summary),
|
||||||
),
|
),
|
||||||
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
|
preference = libraryPreferences.disallowNonAsciiFilenames,
|
||||||
|
title = stringResource(MR.strings.pref_disallow_non_ascii_filenames),
|
||||||
|
subtitle = stringResource(MR.strings.pref_disallow_non_ascii_filenames_details),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SY ->
|
||||||
|
@Composable
|
||||||
|
private fun getDownloadsGroup(
|
||||||
|
downloadPreferences: DownloadPreferences,
|
||||||
|
): Preference.PreferenceGroup {
|
||||||
|
return Preference.PreferenceGroup(
|
||||||
|
title = stringResource(MR.strings.pref_category_downloads),
|
||||||
|
preferenceItems = persistentListOf(
|
||||||
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
|
preference = downloadPreferences.includeChapterUrlHash,
|
||||||
|
title = stringResource(SYMR.strings.pref_include_chapter_url_hash),
|
||||||
|
subtitle = stringResource(SYMR.strings.pref_include_chapter_url_hash_desc),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
// <- SY
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun getReaderGroup(
|
private fun getReaderGroup(
|
||||||
basePreferences: BasePreferences,
|
basePreferences: BasePreferences,
|
||||||
@@ -374,14 +410,14 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
uri?.let {
|
uri?.let {
|
||||||
val flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
|
val flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||||
context.contentResolver.takePersistableUriPermission(uri, flags)
|
context.contentResolver.takePersistableUriPermission(uri, flags)
|
||||||
basePreferences.displayProfile().set(uri.toString())
|
basePreferences.displayProfile.set(uri.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_category_reader),
|
title = stringResource(MR.strings.pref_category_reader),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = basePreferences.hardwareBitmapThreshold(),
|
preference = basePreferences.hardwareBitmapThreshold,
|
||||||
entries = GLUtil.CUSTOM_TEXTURE_LIMIT_OPTIONS
|
entries = GLUtil.CUSTOM_TEXTURE_LIMIT_OPTIONS
|
||||||
.mapIndexed { index, option ->
|
.mapIndexed { index, option ->
|
||||||
val display = if (index == 0) {
|
val display = if (index == 0) {
|
||||||
@@ -401,13 +437,13 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
GLUtil.DEVICE_TEXTURE_LIMIT > GLUtil.SAFE_TEXTURE_LIMIT,
|
GLUtil.DEVICE_TEXTURE_LIMIT > GLUtil.SAFE_TEXTURE_LIMIT,
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = basePreferences.alwaysDecodeLongStripWithSSIV(),
|
preference = basePreferences.alwaysDecodeLongStripWithSSIV,
|
||||||
title = stringResource(MR.strings.pref_always_decode_long_strip_with_ssiv_2),
|
title = stringResource(MR.strings.pref_always_decode_long_strip_with_ssiv_2),
|
||||||
subtitle = stringResource(MR.strings.pref_always_decode_long_strip_with_ssiv_summary),
|
subtitle = stringResource(MR.strings.pref_always_decode_long_strip_with_ssiv_summary),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.pref_display_profile),
|
title = stringResource(MR.strings.pref_display_profile),
|
||||||
subtitle = basePreferences.displayProfile().get(),
|
subtitle = basePreferences.displayProfile.get(),
|
||||||
onClick = {
|
onClick = {
|
||||||
chooseColorProfile.launch(arrayOf("*/*"))
|
chooseColorProfile.launch(arrayOf("*/*"))
|
||||||
},
|
},
|
||||||
@@ -422,7 +458,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
): Preference.PreferenceGroup {
|
): Preference.PreferenceGroup {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val uriHandler = LocalUriHandler.current
|
val uriHandler = LocalUriHandler.current
|
||||||
val extensionInstallerPref = basePreferences.extensionInstaller()
|
val extensionInstallerPref = basePreferences.extensionInstaller
|
||||||
var shizukuMissing by rememberSaveable { mutableStateOf(false) }
|
var shizukuMissing by rememberSaveable { mutableStateOf(false) }
|
||||||
val trustExtension = remember { Injekt.get<TrustExtension>() }
|
val trustExtension = remember { Injekt.get<TrustExtension>() }
|
||||||
|
|
||||||
@@ -622,12 +658,12 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
@Composable
|
@Composable
|
||||||
private fun getDataSaverGroup(): Preference.PreferenceGroup {
|
private fun getDataSaverGroup(): Preference.PreferenceGroup {
|
||||||
val sourcePreferences = remember { Injekt.get<SourcePreferences>() }
|
val sourcePreferences = remember { Injekt.get<SourcePreferences>() }
|
||||||
val dataSaver by sourcePreferences.dataSaver().collectAsState()
|
val dataSaver by sourcePreferences.dataSaver.collectAsState()
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(SYMR.strings.data_saver),
|
title = stringResource(SYMR.strings.data_saver),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = sourcePreferences.dataSaver(),
|
preference = sourcePreferences.dataSaver,
|
||||||
title = stringResource(SYMR.strings.data_saver),
|
title = stringResource(SYMR.strings.data_saver),
|
||||||
subtitle = stringResource(SYMR.strings.data_saver_summary),
|
subtitle = stringResource(SYMR.strings.data_saver_summary),
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
@@ -637,28 +673,28 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.EditTextPreference(
|
Preference.PreferenceItem.EditTextPreference(
|
||||||
preference = sourcePreferences.dataSaverServer(),
|
preference = sourcePreferences.dataSaverServer,
|
||||||
title = stringResource(SYMR.strings.bandwidth_data_saver_server),
|
title = stringResource(SYMR.strings.bandwidth_data_saver_server),
|
||||||
subtitle = stringResource(SYMR.strings.data_saver_server_summary),
|
subtitle = stringResource(SYMR.strings.data_saver_server_summary),
|
||||||
enabled = dataSaver == DataSaver.BANDWIDTH_HERO,
|
enabled = dataSaver == DataSaver.BANDWIDTH_HERO,
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = sourcePreferences.dataSaverDownloader(),
|
preference = sourcePreferences.dataSaverDownloader,
|
||||||
title = stringResource(SYMR.strings.data_saver_downloader),
|
title = stringResource(SYMR.strings.data_saver_downloader),
|
||||||
enabled = dataSaver != DataSaver.NONE,
|
enabled = dataSaver != DataSaver.NONE,
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = sourcePreferences.dataSaverIgnoreJpeg(),
|
preference = sourcePreferences.dataSaverIgnoreJpeg,
|
||||||
title = stringResource(SYMR.strings.data_saver_ignore_jpeg),
|
title = stringResource(SYMR.strings.data_saver_ignore_jpeg),
|
||||||
enabled = dataSaver != DataSaver.NONE,
|
enabled = dataSaver != DataSaver.NONE,
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = sourcePreferences.dataSaverIgnoreGif(),
|
preference = sourcePreferences.dataSaverIgnoreGif,
|
||||||
title = stringResource(SYMR.strings.data_saver_ignore_gif),
|
title = stringResource(SYMR.strings.data_saver_ignore_gif),
|
||||||
enabled = dataSaver != DataSaver.NONE,
|
enabled = dataSaver != DataSaver.NONE,
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = sourcePreferences.dataSaverImageQuality(),
|
preference = sourcePreferences.dataSaverImageQuality,
|
||||||
title = stringResource(SYMR.strings.data_saver_image_quality),
|
title = stringResource(SYMR.strings.data_saver_image_quality),
|
||||||
subtitle = stringResource(SYMR.strings.data_saver_image_quality_summary),
|
subtitle = stringResource(SYMR.strings.data_saver_image_quality_summary),
|
||||||
entries = listOf(
|
entries = listOf(
|
||||||
@@ -674,10 +710,10 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
enabled = dataSaver != DataSaver.NONE,
|
enabled = dataSaver != DataSaver.NONE,
|
||||||
),
|
),
|
||||||
kotlin.run {
|
kotlin.run {
|
||||||
val dataSaverImageFormatJpeg by sourcePreferences.dataSaverImageFormatJpeg()
|
val dataSaverImageFormatJpeg by sourcePreferences.dataSaverImageFormatJpeg
|
||||||
.collectAsState()
|
.collectAsState()
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = sourcePreferences.dataSaverImageFormatJpeg(),
|
preference = sourcePreferences.dataSaverImageFormatJpeg,
|
||||||
title = stringResource(SYMR.strings.data_saver_image_format),
|
title = stringResource(SYMR.strings.data_saver_image_format),
|
||||||
subtitle = if (dataSaverImageFormatJpeg) {
|
subtitle = if (dataSaverImageFormatJpeg) {
|
||||||
stringResource(SYMR.strings.data_saver_image_format_summary_on)
|
stringResource(SYMR.strings.data_saver_image_format_summary_on)
|
||||||
@@ -688,7 +724,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = sourcePreferences.dataSaverColorBW(),
|
preference = sourcePreferences.dataSaverColorBW,
|
||||||
title = stringResource(SYMR.strings.data_saver_color_bw),
|
title = stringResource(SYMR.strings.data_saver_color_bw),
|
||||||
enabled = dataSaver == DataSaver.BANDWIDTH_HERO,
|
enabled = dataSaver == DataSaver.BANDWIDTH_HERO,
|
||||||
),
|
),
|
||||||
@@ -701,14 +737,14 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val navigator = LocalNavigator.currentOrThrow
|
val navigator = LocalNavigator.currentOrThrow
|
||||||
val sourcePreferences = remember { Injekt.get<SourcePreferences>() }
|
val sourcePreferences = remember { Injekt.get<SourcePreferences>() }
|
||||||
val unsortedPreferences = remember { Injekt.get<UnsortedPreferences>() }
|
val exhPreferences = remember { Injekt.get<ExhPreferences>() }
|
||||||
val delegateSourcePreferences = remember { Injekt.get<DelegateSourcePreferences>() }
|
val delegateSourcePreferences = remember { Injekt.get<DelegateSourcePreferences>() }
|
||||||
val securityPreferences = remember { Injekt.get<SecurityPreferences>() }
|
val securityPreferences = remember { Injekt.get<SecurityPreferences>() }
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(SYMR.strings.developer_tools),
|
title = stringResource(SYMR.strings.developer_tools),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = unsortedPreferences.isHentaiEnabled(),
|
preference = exhPreferences.isHentaiEnabled,
|
||||||
title = stringResource(SYMR.strings.toggle_hentai_features),
|
title = stringResource(SYMR.strings.toggle_hentai_features),
|
||||||
subtitle = stringResource(SYMR.strings.toggle_hentai_features_summary),
|
subtitle = stringResource(SYMR.strings.toggle_hentai_features_summary),
|
||||||
onValueChanged = {
|
onValueChanged = {
|
||||||
@@ -723,7 +759,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = delegateSourcePreferences.delegateSources(),
|
preference = delegateSourcePreferences.delegateSources,
|
||||||
title = stringResource(SYMR.strings.toggle_delegated_sources),
|
title = stringResource(SYMR.strings.toggle_delegated_sources),
|
||||||
subtitle = stringResource(
|
subtitle = stringResource(
|
||||||
SYMR.strings.toggle_delegated_sources_summary,
|
SYMR.strings.toggle_delegated_sources_summary,
|
||||||
@@ -733,7 +769,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = unsortedPreferences.logLevel(),
|
preference = exhPreferences.logLevel,
|
||||||
title = stringResource(SYMR.strings.log_level),
|
title = stringResource(SYMR.strings.log_level),
|
||||||
subtitle = stringResource(SYMR.strings.log_level_summary),
|
subtitle = stringResource(SYMR.strings.log_level_summary),
|
||||||
entries = EHLogLevel.entries.mapIndexed { index, ehLogLevel ->
|
entries = EHLogLevel.entries.mapIndexed { index, ehLogLevel ->
|
||||||
@@ -743,7 +779,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
}.toMap().toImmutableMap(),
|
}.toMap().toImmutableMap(),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = sourcePreferences.enableSourceBlacklist(),
|
preference = sourcePreferences.enableSourceBlacklist,
|
||||||
title = stringResource(SYMR.strings.enable_source_blacklist),
|
title = stringResource(SYMR.strings.enable_source_blacklist),
|
||||||
subtitle = stringResource(
|
subtitle = stringResource(
|
||||||
SYMR.strings.enable_source_blacklist_summary,
|
SYMR.strings.enable_source_blacklist_summary,
|
||||||
@@ -777,7 +813,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
TextButton(
|
TextButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
dismiss()
|
dismiss()
|
||||||
securityPreferences.encryptDatabase().set(true)
|
securityPreferences.encryptDatabase.set(true)
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
Text(text = stringResource(MR.strings.action_ok))
|
Text(text = stringResource(MR.strings.action_ok))
|
||||||
@@ -787,7 +823,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
}
|
}
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
title = stringResource(SYMR.strings.encrypt_database),
|
title = stringResource(SYMR.strings.encrypt_database),
|
||||||
preference = securityPreferences.encryptDatabase(),
|
preference = securityPreferences.encryptDatabase,
|
||||||
subtitle = stringResource(SYMR.strings.encrypt_database_subtitle),
|
subtitle = stringResource(SYMR.strings.encrypt_database_subtitle),
|
||||||
onValueChanged = {
|
onValueChanged = {
|
||||||
if (it) {
|
if (it) {
|
||||||
|
|||||||
+19
-15
@@ -56,13 +56,13 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||||||
): Preference.PreferenceGroup {
|
): Preference.PreferenceGroup {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
val themeModePref = uiPreferences.themeMode()
|
val themeModePref = uiPreferences.themeMode
|
||||||
val themeMode by themeModePref.collectAsState()
|
val themeMode by themeModePref.collectAsState()
|
||||||
|
|
||||||
val appThemePref = uiPreferences.appTheme()
|
val appThemePref = uiPreferences.appTheme
|
||||||
val appTheme by appThemePref.collectAsState()
|
val appTheme by appThemePref.collectAsState()
|
||||||
|
|
||||||
val amoledPref = uiPreferences.themeDarkAmoled()
|
val amoledPref = uiPreferences.themeDarkAmoled
|
||||||
val amoled by amoledPref.collectAsState()
|
val amoled by amoledPref.collectAsState()
|
||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
@@ -109,7 +109,7 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||||||
|
|
||||||
val now = remember { LocalDate.now() }
|
val now = remember { LocalDate.now() }
|
||||||
|
|
||||||
val dateFormat by uiPreferences.dateFormat().collectAsState()
|
val dateFormat by uiPreferences.dateFormat.collectAsState()
|
||||||
val formattedNow = remember(dateFormat) {
|
val formattedNow = remember(dateFormat) {
|
||||||
UiPreferences.dateFormat(dateFormat).format(now)
|
UiPreferences.dateFormat(dateFormat).format(now)
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||||||
onClick = { navigator.push(AppLanguageScreen()) },
|
onClick = { navigator.push(AppLanguageScreen()) },
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = uiPreferences.tabletUiMode(),
|
preference = uiPreferences.tabletUiMode,
|
||||||
entries = TabletUiMode.entries
|
entries = TabletUiMode.entries
|
||||||
.associateWith { stringResource(it.titleRes) }
|
.associateWith { stringResource(it.titleRes) }
|
||||||
.toImmutableMap(),
|
.toImmutableMap(),
|
||||||
@@ -133,7 +133,7 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = uiPreferences.dateFormat(),
|
preference = uiPreferences.dateFormat,
|
||||||
entries = DateFormats
|
entries = DateFormats
|
||||||
.associateWith {
|
.associateWith {
|
||||||
val formattedDate = UiPreferences.dateFormat(it).format(now)
|
val formattedDate = UiPreferences.dateFormat(it).format(now)
|
||||||
@@ -143,7 +143,7 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_date_format),
|
title = stringResource(MR.strings.pref_date_format),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = uiPreferences.relativeTime(),
|
preference = uiPreferences.relativeTime,
|
||||||
title = stringResource(MR.strings.pref_relative_format),
|
title = stringResource(MR.strings.pref_relative_format),
|
||||||
subtitle = stringResource(
|
subtitle = stringResource(
|
||||||
MR.strings.pref_relative_format_summary,
|
MR.strings.pref_relative_format_summary,
|
||||||
@@ -151,6 +151,10 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||||||
formattedNow,
|
formattedNow,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
|
preference = uiPreferences.imagesInDescription,
|
||||||
|
title = stringResource(MR.strings.pref_display_images_description),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -158,22 +162,22 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||||||
// SY -->
|
// SY -->
|
||||||
@Composable
|
@Composable
|
||||||
fun getForkGroup(uiPreferences: UiPreferences): Preference.PreferenceGroup {
|
fun getForkGroup(uiPreferences: UiPreferences): Preference.PreferenceGroup {
|
||||||
val previewsRowCount by uiPreferences.previewsRowCount().collectAsState()
|
val previewsRowCount by uiPreferences.previewsRowCount.collectAsState()
|
||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
stringResource(SYMR.strings.pref_category_fork),
|
stringResource(SYMR.strings.pref_category_fork),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = uiPreferences.expandFilters(),
|
preference = uiPreferences.expandFilters,
|
||||||
title = stringResource(SYMR.strings.toggle_expand_search_filters),
|
title = stringResource(SYMR.strings.toggle_expand_search_filters),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = uiPreferences.recommendsInOverflow(),
|
preference = uiPreferences.recommendsInOverflow,
|
||||||
title = stringResource(SYMR.strings.put_recommends_in_overflow),
|
title = stringResource(SYMR.strings.put_recommends_in_overflow),
|
||||||
subtitle = stringResource(SYMR.strings.put_recommends_in_overflow_summary),
|
subtitle = stringResource(SYMR.strings.put_recommends_in_overflow_summary),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = uiPreferences.mergeInOverflow(),
|
preference = uiPreferences.mergeInOverflow,
|
||||||
title = stringResource(SYMR.strings.put_merge_in_overflow),
|
title = stringResource(SYMR.strings.put_merge_in_overflow),
|
||||||
subtitle = stringResource(SYMR.strings.put_merge_in_overflow_summary),
|
subtitle = stringResource(SYMR.strings.put_merge_in_overflow_summary),
|
||||||
),
|
),
|
||||||
@@ -191,7 +195,7 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
valueRange = 0..10,
|
valueRange = 0..10,
|
||||||
onValueChanged = {
|
onValueChanged = {
|
||||||
uiPreferences.previewsRowCount().set(it)
|
uiPreferences.previewsRowCount.set(it)
|
||||||
true
|
true
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -205,15 +209,15 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||||||
stringResource(SYMR.strings.pref_category_navbar),
|
stringResource(SYMR.strings.pref_category_navbar),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = uiPreferences.showNavUpdates(),
|
preference = uiPreferences.showNavUpdates,
|
||||||
title = stringResource(SYMR.strings.pref_hide_updates_button),
|
title = stringResource(SYMR.strings.pref_hide_updates_button),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = uiPreferences.showNavHistory(),
|
preference = uiPreferences.showNavHistory,
|
||||||
title = stringResource(SYMR.strings.pref_hide_history_button),
|
title = stringResource(SYMR.strings.pref_hide_history_button),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = uiPreferences.bottomBarLabels(),
|
preference = uiPreferences.bottomBarLabels,
|
||||||
title = stringResource(SYMR.strings.pref_show_bottom_bar_labels),
|
title = stringResource(SYMR.strings.pref_show_bottom_bar_labels),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
+9
-11
@@ -20,7 +20,6 @@ import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.authenticate
|
|||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
import mihon.domain.extensionrepo.interactor.GetExtensionRepoCount
|
import mihon.domain.extensionrepo.interactor.GetExtensionRepoCount
|
||||||
import tachiyomi.core.common.i18n.stringResource
|
import tachiyomi.core.common.i18n.stringResource
|
||||||
import tachiyomi.domain.UnsortedPreferences
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.i18n.sy.SYMR
|
import tachiyomi.i18n.sy.SYMR
|
||||||
import tachiyomi.presentation.core.i18n.pluralStringResource
|
import tachiyomi.presentation.core.i18n.pluralStringResource
|
||||||
@@ -47,9 +46,8 @@ object SettingsBrowseScreen : SearchableSettings {
|
|||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
val hideFeedTab by remember { Injekt.get<UiPreferences>().hideFeedTab().asState(scope) }
|
val hideFeedTab by remember { Injekt.get<UiPreferences>().hideFeedTab.asState(scope) }
|
||||||
val uiPreferences = remember { Injekt.get<UiPreferences>() }
|
val uiPreferences = remember { Injekt.get<UiPreferences>() }
|
||||||
val unsortedPreferences = remember { Injekt.get<UnsortedPreferences>() }
|
|
||||||
// SY <--
|
// SY <--
|
||||||
return listOf(
|
return listOf(
|
||||||
// SY -->
|
// SY -->
|
||||||
@@ -57,7 +55,7 @@ object SettingsBrowseScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.label_sources),
|
title = stringResource(MR.strings.label_sources),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
kotlin.run {
|
kotlin.run {
|
||||||
val count by sourcePreferences.sourcesTabCategories().collectAsState()
|
val count by sourcePreferences.sourcesTabCategories.collectAsState()
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.action_edit_categories),
|
title = stringResource(MR.strings.action_edit_categories),
|
||||||
subtitle = pluralStringResource(MR.plurals.num_categories, count.size, count.size),
|
subtitle = pluralStringResource(MR.plurals.num_categories, count.size, count.size),
|
||||||
@@ -67,17 +65,17 @@ object SettingsBrowseScreen : SearchableSettings {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = sourcePreferences.sourcesTabCategoriesFilter(),
|
preference = sourcePreferences.sourcesTabCategoriesFilter,
|
||||||
title = stringResource(SYMR.strings.pref_source_source_filtering),
|
title = stringResource(SYMR.strings.pref_source_source_filtering),
|
||||||
subtitle = stringResource(SYMR.strings.pref_source_source_filtering_summery),
|
subtitle = stringResource(SYMR.strings.pref_source_source_filtering_summery),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = uiPreferences.useNewSourceNavigation(),
|
preference = uiPreferences.useNewSourceNavigation,
|
||||||
title = stringResource(SYMR.strings.pref_source_navigation),
|
title = stringResource(SYMR.strings.pref_source_navigation),
|
||||||
subtitle = stringResource(SYMR.strings.pref_source_navigation_summery),
|
subtitle = stringResource(SYMR.strings.pref_source_navigation_summery),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = unsortedPreferences.allowLocalSourceHiddenFolders(),
|
preference = sourcePreferences.allowLocalSourceHiddenFolders,
|
||||||
title = stringResource(SYMR.strings.pref_local_source_hidden_folders),
|
title = stringResource(SYMR.strings.pref_local_source_hidden_folders),
|
||||||
subtitle = stringResource(SYMR.strings.pref_local_source_hidden_folders_summery),
|
subtitle = stringResource(SYMR.strings.pref_local_source_hidden_folders_summery),
|
||||||
),
|
),
|
||||||
@@ -87,11 +85,11 @@ object SettingsBrowseScreen : SearchableSettings {
|
|||||||
title = stringResource(SYMR.strings.feed),
|
title = stringResource(SYMR.strings.feed),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = uiPreferences.hideFeedTab(),
|
preference = uiPreferences.hideFeedTab,
|
||||||
title = stringResource(SYMR.strings.pref_hide_feed),
|
title = stringResource(SYMR.strings.pref_hide_feed),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = uiPreferences.feedTabInFront(),
|
preference = uiPreferences.feedTabInFront,
|
||||||
title = stringResource(SYMR.strings.pref_feed_position),
|
title = stringResource(SYMR.strings.pref_feed_position),
|
||||||
subtitle = stringResource(SYMR.strings.pref_feed_position_summery),
|
subtitle = stringResource(SYMR.strings.pref_feed_position_summery),
|
||||||
enabled = hideFeedTab.not(),
|
enabled = hideFeedTab.not(),
|
||||||
@@ -103,7 +101,7 @@ object SettingsBrowseScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.label_sources),
|
title = stringResource(MR.strings.label_sources),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = sourcePreferences.hideInLibraryItems(),
|
preference = sourcePreferences.hideInLibraryItems,
|
||||||
title = stringResource(MR.strings.pref_hide_in_library_items),
|
title = stringResource(MR.strings.pref_hide_in_library_items),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
@@ -119,7 +117,7 @@ object SettingsBrowseScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_category_nsfw_content),
|
title = stringResource(MR.strings.pref_category_nsfw_content),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = sourcePreferences.showNsfwSource(),
|
preference = sourcePreferences.showNsfwSource,
|
||||||
title = stringResource(MR.strings.pref_show_nsfw_source),
|
title = stringResource(MR.strings.pref_show_nsfw_source),
|
||||||
subtitle = stringResource(MR.strings.requires_app_restart),
|
subtitle = stringResource(MR.strings.requires_app_restart),
|
||||||
onValueChanged = {
|
onValueChanged = {
|
||||||
|
|||||||
+14
-14
@@ -119,7 +119,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
val storagePreferences = Injekt.get<StoragePreferences>()
|
val storagePreferences = Injekt.get<StoragePreferences>()
|
||||||
|
|
||||||
val syncPreferences = remember { Injekt.get<SyncPreferences>() }
|
val syncPreferences = remember { Injekt.get<SyncPreferences>() }
|
||||||
val syncService by syncPreferences.syncService().collectAsState()
|
val syncService by syncPreferences.syncService.collectAsState()
|
||||||
|
|
||||||
return persistentListOf(
|
return persistentListOf(
|
||||||
getStorageLocationPref(storagePreferences = storagePreferences),
|
getStorageLocationPref(storagePreferences = storagePreferences),
|
||||||
@@ -185,11 +185,11 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
storagePreferences: StoragePreferences,
|
storagePreferences: StoragePreferences,
|
||||||
): Preference.PreferenceItem.TextPreference {
|
): Preference.PreferenceItem.TextPreference {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val pickStorageLocation = storageLocationPicker(storagePreferences.baseStorageDirectory())
|
val pickStorageLocation = storageLocationPicker(storagePreferences.baseStorageDirectory)
|
||||||
|
|
||||||
return Preference.PreferenceItem.TextPreference(
|
return Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.pref_storage_location),
|
title = stringResource(MR.strings.pref_storage_location),
|
||||||
subtitle = storageLocationText(storagePreferences.baseStorageDirectory()),
|
subtitle = storageLocationText(storagePreferences.baseStorageDirectory),
|
||||||
onClick = {
|
onClick = {
|
||||||
try {
|
try {
|
||||||
pickStorageLocation.launch(null)
|
pickStorageLocation.launch(null)
|
||||||
@@ -205,7 +205,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val navigator = LocalNavigator.currentOrThrow
|
val navigator = LocalNavigator.currentOrThrow
|
||||||
|
|
||||||
val lastAutoBackup by backupPreferences.lastAutoBackupTimestamp().collectAsState()
|
val lastAutoBackup by backupPreferences.lastAutoBackupTimestamp.collectAsState()
|
||||||
|
|
||||||
val chooseBackup = rememberLauncherForActivityResult(
|
val chooseBackup = rememberLauncherForActivityResult(
|
||||||
object : ActivityResultContracts.GetContent() {
|
object : ActivityResultContracts.GetContent() {
|
||||||
@@ -272,7 +272,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
|
|
||||||
// Automatic backups
|
// Automatic backups
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = backupPreferences.backupInterval(),
|
preference = backupPreferences.backupInterval,
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
0 to stringResource(MR.strings.off),
|
0 to stringResource(MR.strings.off),
|
||||||
6 to stringResource(MR.strings.update_6hour),
|
6 to stringResource(MR.strings.update_6hour),
|
||||||
@@ -365,7 +365,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
// SY <--
|
// SY <--
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = libraryPreferences.autoClearChapterCache(),
|
preference = libraryPreferences.autoClearChapterCache,
|
||||||
title = stringResource(MR.strings.pref_auto_clear_chapter_cache),
|
title = stringResource(MR.strings.pref_auto_clear_chapter_cache),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -517,7 +517,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
title = stringResource(SYMR.strings.pref_sync_service_category),
|
title = stringResource(SYMR.strings.pref_sync_service_category),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = syncPreferences.syncService(),
|
preference = syncPreferences.syncService,
|
||||||
title = stringResource(SYMR.strings.pref_sync_service),
|
title = stringResource(SYMR.strings.pref_sync_service),
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
SyncManager.SyncService.NONE.value to stringResource(MR.strings.off),
|
SyncManager.SyncService.NONE.value to stringResource(MR.strings.off),
|
||||||
@@ -660,7 +660,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
|
|
||||||
val qrScanLauncher = rememberLauncherForActivityResult(ScanContract()) {
|
val qrScanLauncher = rememberLauncherForActivityResult(ScanContract()) {
|
||||||
if (it.contents != null && it.contents.isNotEmpty()) {
|
if (it.contents != null && it.contents.isNotEmpty()) {
|
||||||
syncPreferences.clientAPIKey().set(it.contents)
|
syncPreferences.clientAPIKey.set(it.contents)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
@@ -677,13 +677,13 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
Preference.PreferenceItem.EditTextPreference(
|
Preference.PreferenceItem.EditTextPreference(
|
||||||
title = stringResource(SYMR.strings.pref_sync_host),
|
title = stringResource(SYMR.strings.pref_sync_host),
|
||||||
subtitle = stringResource(SYMR.strings.pref_sync_host_summ),
|
subtitle = stringResource(SYMR.strings.pref_sync_host_summ),
|
||||||
preference = syncPreferences.clientHost(),
|
preference = syncPreferences.clientHost,
|
||||||
onValueChanged = { newValue ->
|
onValueChanged = { newValue ->
|
||||||
scope.launch {
|
scope.launch {
|
||||||
// Trim spaces at the beginning and end, then remove trailing slash if present
|
// Trim spaces at the beginning and end, then remove trailing slash if present
|
||||||
val trimmedValue = newValue.trim()
|
val trimmedValue = newValue.trim()
|
||||||
val modifiedValue = trimmedValue.trimEnd { it == '/' }
|
val modifiedValue = trimmedValue.trimEnd { it == '/' }
|
||||||
syncPreferences.clientHost().set(modifiedValue)
|
syncPreferences.clientHost.set(modifiedValue)
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
},
|
},
|
||||||
@@ -691,12 +691,12 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
Preference.PreferenceItem.CustomPreference(
|
Preference.PreferenceItem.CustomPreference(
|
||||||
title = stringResource(SYMR.strings.pref_sync_api_key),
|
title = stringResource(SYMR.strings.pref_sync_api_key),
|
||||||
) {
|
) {
|
||||||
val values by syncPreferences.clientAPIKey().collectAsState()
|
val values by syncPreferences.clientAPIKey.collectAsState()
|
||||||
EditTextPreferenceWidget(
|
EditTextPreferenceWidget(
|
||||||
title = stringResource(SYMR.strings.pref_sync_api_key),
|
title = stringResource(SYMR.strings.pref_sync_api_key),
|
||||||
subtitle = stringResource(SYMR.strings.pref_sync_api_key_summ),
|
subtitle = stringResource(SYMR.strings.pref_sync_api_key_summ),
|
||||||
onConfirm = {
|
onConfirm = {
|
||||||
syncPreferences.clientAPIKey().set(it)
|
syncPreferences.clientAPIKey.set(it)
|
||||||
true
|
true
|
||||||
},
|
},
|
||||||
icon = null,
|
icon = null,
|
||||||
@@ -752,8 +752,8 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
@Composable
|
@Composable
|
||||||
private fun getAutomaticSyncGroup(syncPreferences: SyncPreferences): Preference.PreferenceGroup {
|
private fun getAutomaticSyncGroup(syncPreferences: SyncPreferences): Preference.PreferenceGroup {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val syncIntervalPref = syncPreferences.syncInterval()
|
val syncIntervalPref = syncPreferences.syncInterval
|
||||||
val lastSync by syncPreferences.lastSyncTimestamp().collectAsState()
|
val lastSync by syncPreferences.lastSyncTimestamp.collectAsState()
|
||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(SYMR.strings.pref_sync_automatic_category),
|
title = stringResource(SYMR.strings.pref_sync_automatic_category),
|
||||||
|
|||||||
+27
-12
@@ -37,20 +37,35 @@ object SettingsDownloadScreen : SearchableSettings {
|
|||||||
val allCategories by getCategories.subscribe().collectAsState(initial = emptyList())
|
val allCategories by getCategories.subscribe().collectAsState(initial = emptyList())
|
||||||
|
|
||||||
val downloadPreferences = remember { Injekt.get<DownloadPreferences>() }
|
val downloadPreferences = remember { Injekt.get<DownloadPreferences>() }
|
||||||
|
val parallelSourceLimit by downloadPreferences.parallelSourceLimit.collectAsState()
|
||||||
|
val parallelPageLimit by downloadPreferences.parallelPageLimit.collectAsState()
|
||||||
return listOf(
|
return listOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = downloadPreferences.downloadOnlyOverWifi(),
|
preference = downloadPreferences.downloadOnlyOverWifi,
|
||||||
title = stringResource(MR.strings.connected_to_wifi),
|
title = stringResource(MR.strings.connected_to_wifi),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = downloadPreferences.saveChaptersAsCBZ(),
|
preference = downloadPreferences.saveChaptersAsCBZ,
|
||||||
title = stringResource(MR.strings.save_chapter_as_cbz),
|
title = stringResource(MR.strings.save_chapter_as_cbz),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = downloadPreferences.splitTallImages(),
|
preference = downloadPreferences.splitTallImages,
|
||||||
title = stringResource(MR.strings.split_tall_images),
|
title = stringResource(MR.strings.split_tall_images),
|
||||||
subtitle = stringResource(MR.strings.split_tall_images_summary),
|
subtitle = stringResource(MR.strings.split_tall_images_summary),
|
||||||
),
|
),
|
||||||
|
Preference.PreferenceItem.SliderPreference(
|
||||||
|
value = parallelSourceLimit,
|
||||||
|
valueRange = 1..10,
|
||||||
|
title = stringResource(MR.strings.pref_download_concurrent_sources),
|
||||||
|
onValueChanged = { downloadPreferences.parallelSourceLimit.set(it) },
|
||||||
|
),
|
||||||
|
Preference.PreferenceItem.SliderPreference(
|
||||||
|
value = parallelPageLimit,
|
||||||
|
valueRange = 1..15,
|
||||||
|
title = stringResource(MR.strings.pref_download_concurrent_pages),
|
||||||
|
subtitle = stringResource(MR.strings.pref_download_concurrent_pages_summary),
|
||||||
|
onValueChanged = { downloadPreferences.parallelPageLimit.set(it) },
|
||||||
|
),
|
||||||
getDeleteChaptersGroup(
|
getDeleteChaptersGroup(
|
||||||
downloadPreferences = downloadPreferences,
|
downloadPreferences = downloadPreferences,
|
||||||
categories = allCategories,
|
categories = allCategories,
|
||||||
@@ -72,11 +87,11 @@ object SettingsDownloadScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_category_delete_chapters),
|
title = stringResource(MR.strings.pref_category_delete_chapters),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = downloadPreferences.removeAfterMarkedAsRead(),
|
preference = downloadPreferences.removeAfterMarkedAsRead,
|
||||||
title = stringResource(MR.strings.pref_remove_after_marked_as_read),
|
title = stringResource(MR.strings.pref_remove_after_marked_as_read),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = downloadPreferences.removeAfterReadSlots(),
|
preference = downloadPreferences.removeAfterReadSlots,
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
-1 to stringResource(MR.strings.disabled),
|
-1 to stringResource(MR.strings.disabled),
|
||||||
0 to stringResource(MR.strings.last_read_chapter),
|
0 to stringResource(MR.strings.last_read_chapter),
|
||||||
@@ -88,7 +103,7 @@ object SettingsDownloadScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_remove_after_read),
|
title = stringResource(MR.strings.pref_remove_after_read),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = downloadPreferences.removeBookmarkedChapters(),
|
preference = downloadPreferences.removeBookmarkedChapters,
|
||||||
title = stringResource(MR.strings.pref_remove_bookmarked_chapters),
|
title = stringResource(MR.strings.pref_remove_bookmarked_chapters),
|
||||||
),
|
),
|
||||||
getExcludedCategoriesPreference(
|
getExcludedCategoriesPreference(
|
||||||
@@ -105,7 +120,7 @@ object SettingsDownloadScreen : SearchableSettings {
|
|||||||
categories: () -> List<Category>,
|
categories: () -> List<Category>,
|
||||||
): Preference.PreferenceItem.MultiSelectListPreference {
|
): Preference.PreferenceItem.MultiSelectListPreference {
|
||||||
return Preference.PreferenceItem.MultiSelectListPreference(
|
return Preference.PreferenceItem.MultiSelectListPreference(
|
||||||
preference = downloadPreferences.removeExcludeCategories(),
|
preference = downloadPreferences.removeExcludeCategories,
|
||||||
entries = categories()
|
entries = categories()
|
||||||
.associate { it.id.toString() to it.visualName }
|
.associate { it.id.toString() to it.visualName }
|
||||||
.toImmutableMap(),
|
.toImmutableMap(),
|
||||||
@@ -118,10 +133,10 @@ object SettingsDownloadScreen : SearchableSettings {
|
|||||||
downloadPreferences: DownloadPreferences,
|
downloadPreferences: DownloadPreferences,
|
||||||
allCategories: List<Category>,
|
allCategories: List<Category>,
|
||||||
): Preference.PreferenceGroup {
|
): Preference.PreferenceGroup {
|
||||||
val downloadNewChaptersPref = downloadPreferences.downloadNewChapters()
|
val downloadNewChaptersPref = downloadPreferences.downloadNewChapters
|
||||||
val downloadNewUnreadChaptersOnlyPref = downloadPreferences.downloadNewUnreadChaptersOnly()
|
val downloadNewUnreadChaptersOnlyPref = downloadPreferences.downloadNewUnreadChaptersOnly
|
||||||
val downloadNewChapterCategoriesPref = downloadPreferences.downloadNewChapterCategories()
|
val downloadNewChapterCategoriesPref = downloadPreferences.downloadNewChapterCategories
|
||||||
val downloadNewChapterCategoriesExcludePref = downloadPreferences.downloadNewChapterCategoriesExclude()
|
val downloadNewChapterCategoriesExcludePref = downloadPreferences.downloadNewChapterCategoriesExclude
|
||||||
|
|
||||||
val downloadNewChapters by downloadNewChaptersPref.collectAsState()
|
val downloadNewChapters by downloadNewChaptersPref.collectAsState()
|
||||||
|
|
||||||
@@ -179,7 +194,7 @@ object SettingsDownloadScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.download_ahead),
|
title = stringResource(MR.strings.download_ahead),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = downloadPreferences.autoDownloadWhileReading(),
|
preference = downloadPreferences.autoDownloadWhileReading,
|
||||||
entries = listOf(0, 2, 3, 5, 10)
|
entries = listOf(0, 2, 3, 5, 10)
|
||||||
.associateWith {
|
.associateWith {
|
||||||
if (it == 0) {
|
if (it == 0) {
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ import exh.eh.EHentaiUpdateWorker
|
|||||||
import exh.eh.EHentaiUpdateWorkerConstants
|
import exh.eh.EHentaiUpdateWorkerConstants
|
||||||
import exh.eh.EHentaiUpdaterStats
|
import exh.eh.EHentaiUpdaterStats
|
||||||
import exh.metadata.metadata.EHentaiSearchMetadata
|
import exh.metadata.metadata.EHentaiSearchMetadata
|
||||||
|
import exh.source.ExhPreferences
|
||||||
import exh.ui.login.EhLoginActivity
|
import exh.ui.login.EhLoginActivity
|
||||||
import exh.util.nullIfBlank
|
import exh.util.nullIfBlank
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
@@ -63,7 +64,6 @@ import tachiyomi.core.common.util.lang.launchNonCancellable
|
|||||||
import tachiyomi.core.common.util.lang.withIOContext
|
import tachiyomi.core.common.util.lang.withIOContext
|
||||||
import tachiyomi.core.common.util.lang.withUIContext
|
import tachiyomi.core.common.util.lang.withUIContext
|
||||||
import tachiyomi.core.common.util.system.logcat
|
import tachiyomi.core.common.util.system.logcat
|
||||||
import tachiyomi.domain.UnsortedPreferences
|
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_CHARGING
|
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_CHARGING
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_ONLY_ON_WIFI
|
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_ONLY_ON_WIFI
|
||||||
import tachiyomi.domain.manga.interactor.DeleteFavoriteEntries
|
import tachiyomi.domain.manga.interactor.DeleteFavoriteEntries
|
||||||
@@ -88,22 +88,22 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
@Composable
|
@Composable
|
||||||
override fun getTitleRes() = SYMR.strings.pref_category_eh
|
override fun getTitleRes() = SYMR.strings.pref_category_eh
|
||||||
|
|
||||||
override fun isEnabled(): Boolean = Injekt.get<UnsortedPreferences>().isHentaiEnabled().get()
|
override fun isEnabled(): Boolean = Injekt.get<ExhPreferences>().isHentaiEnabled.get()
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Reconfigure(
|
fun Reconfigure(
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
openWarnConfigureDialogController: () -> Unit,
|
openWarnConfigureDialogController: () -> Unit,
|
||||||
) {
|
) {
|
||||||
var initialLoadGuard by remember { mutableStateOf(false) }
|
var initialLoadGuard by remember { mutableStateOf(false) }
|
||||||
val useHentaiAtHome by unsortedPreferences.useHentaiAtHome().collectAsState()
|
val useHentaiAtHome by exhPreferences.useHentaiAtHome.collectAsState()
|
||||||
val useJapaneseTitle by unsortedPreferences.useJapaneseTitle().collectAsState()
|
val useJapaneseTitle by exhPreferences.useJapaneseTitle.collectAsState()
|
||||||
val useOriginalImages by unsortedPreferences.exhUseOriginalImages().collectAsState()
|
val useOriginalImages by exhPreferences.exhUseOriginalImages.collectAsState()
|
||||||
val ehTagFilterValue by unsortedPreferences.ehTagFilterValue().collectAsState()
|
val ehTagFilterValue by exhPreferences.ehTagFilterValue.collectAsState()
|
||||||
val ehTagWatchingValue by unsortedPreferences.ehTagWatchingValue().collectAsState()
|
val ehTagWatchingValue by exhPreferences.ehTagWatchingValue.collectAsState()
|
||||||
val settingsLanguages by unsortedPreferences.exhSettingsLanguages().collectAsState()
|
val settingsLanguages by exhPreferences.exhSettingsLanguages.collectAsState()
|
||||||
val enabledCategories by unsortedPreferences.exhEnabledCategories().collectAsState()
|
val enabledCategories by exhPreferences.exhEnabledCategories.collectAsState()
|
||||||
val imageQuality by unsortedPreferences.imageQuality().collectAsState()
|
val imageQuality by exhPreferences.imageQuality.collectAsState()
|
||||||
DisposableEffect(
|
DisposableEffect(
|
||||||
useHentaiAtHome,
|
useHentaiAtHome,
|
||||||
useJapaneseTitle,
|
useJapaneseTitle,
|
||||||
@@ -124,15 +124,15 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun getPreferences(): List<Preference> {
|
override fun getPreferences(): List<Preference> {
|
||||||
val unsortedPreferences: UnsortedPreferences = remember { Injekt.get() }
|
val exhPreferences: ExhPreferences = remember { Injekt.get() }
|
||||||
val getFlatMetadataById: GetFlatMetadataById = remember { Injekt.get() }
|
val getFlatMetadataById: GetFlatMetadataById = remember { Injekt.get() }
|
||||||
val deleteFavoriteEntries: DeleteFavoriteEntries = remember { Injekt.get() }
|
val deleteFavoriteEntries: DeleteFavoriteEntries = remember { Injekt.get() }
|
||||||
val getExhFavoriteMangaWithMetadata: GetExhFavoriteMangaWithMetadata = remember { Injekt.get() }
|
val getExhFavoriteMangaWithMetadata: GetExhFavoriteMangaWithMetadata = remember { Injekt.get() }
|
||||||
val exhentaiEnabled by unsortedPreferences.enableExhentai().collectAsState()
|
val exhentaiEnabled by exhPreferences.enableExhentai.collectAsState()
|
||||||
var runConfigureDialog by remember { mutableStateOf(false) }
|
var runConfigureDialog by remember { mutableStateOf(false) }
|
||||||
val openWarnConfigureDialogController = { runConfigureDialog = true }
|
val openWarnConfigureDialogController = { runConfigureDialog = true }
|
||||||
|
|
||||||
Reconfigure(unsortedPreferences, openWarnConfigureDialogController)
|
Reconfigure(exhPreferences, openWarnConfigureDialogController)
|
||||||
|
|
||||||
ConfigureExhDialog(run = runConfigureDialog, onRunning = { runConfigureDialog = false })
|
ConfigureExhDialog(run = runConfigureDialog, onRunning = { runConfigureDialog = false })
|
||||||
|
|
||||||
@@ -140,36 +140,36 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
Preference.PreferenceGroup(
|
Preference.PreferenceGroup(
|
||||||
stringResource(SYMR.strings.ehentai_prefs_account_settings),
|
stringResource(SYMR.strings.ehentai_prefs_account_settings),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
getLoginPreference(unsortedPreferences, openWarnConfigureDialogController),
|
getLoginPreference(exhPreferences, openWarnConfigureDialogController),
|
||||||
useHentaiAtHome(exhentaiEnabled, unsortedPreferences),
|
useHentaiAtHome(exhentaiEnabled, exhPreferences),
|
||||||
useJapaneseTitle(exhentaiEnabled, unsortedPreferences),
|
useJapaneseTitle(exhentaiEnabled, exhPreferences),
|
||||||
useOriginalImages(exhentaiEnabled, unsortedPreferences),
|
useOriginalImages(exhentaiEnabled, exhPreferences),
|
||||||
watchedTags(exhentaiEnabled),
|
watchedTags(exhentaiEnabled),
|
||||||
tagFilterThreshold(exhentaiEnabled, unsortedPreferences),
|
tagFilterThreshold(exhentaiEnabled, exhPreferences),
|
||||||
tagWatchingThreshold(exhentaiEnabled, unsortedPreferences),
|
tagWatchingThreshold(exhentaiEnabled, exhPreferences),
|
||||||
settingsLanguages(exhentaiEnabled, unsortedPreferences),
|
settingsLanguages(exhentaiEnabled, exhPreferences),
|
||||||
enabledCategories(exhentaiEnabled, unsortedPreferences),
|
enabledCategories(exhentaiEnabled, exhPreferences),
|
||||||
watchedListDefaultState(exhentaiEnabled, unsortedPreferences),
|
watchedListDefaultState(exhentaiEnabled, exhPreferences),
|
||||||
imageQuality(exhentaiEnabled, unsortedPreferences),
|
imageQuality(exhentaiEnabled, exhPreferences),
|
||||||
enhancedEhentaiView(unsortedPreferences),
|
enhancedEhentaiView(exhPreferences),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Preference.PreferenceGroup(
|
Preference.PreferenceGroup(
|
||||||
stringResource(SYMR.strings.favorites_sync),
|
stringResource(SYMR.strings.favorites_sync),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
readOnlySync(unsortedPreferences),
|
readOnlySync(exhPreferences),
|
||||||
syncFavoriteNotes(),
|
syncFavoriteNotes(),
|
||||||
lenientSync(unsortedPreferences),
|
lenientSync(exhPreferences),
|
||||||
forceSyncReset(deleteFavoriteEntries),
|
forceSyncReset(deleteFavoriteEntries),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Preference.PreferenceGroup(
|
Preference.PreferenceGroup(
|
||||||
stringResource(SYMR.strings.gallery_update_checker),
|
stringResource(SYMR.strings.gallery_update_checker),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
updateCheckerFrequency(unsortedPreferences),
|
updateCheckerFrequency(exhPreferences),
|
||||||
autoUpdateRequirements(unsortedPreferences),
|
autoUpdateRequirements(exhPreferences),
|
||||||
updaterStatistics(
|
updaterStatistics(
|
||||||
unsortedPreferences,
|
exhPreferences,
|
||||||
getExhFavoriteMangaWithMetadata,
|
getExhFavoriteMangaWithMetadata,
|
||||||
getFlatMetadataById,
|
getFlatMetadataById,
|
||||||
),
|
),
|
||||||
@@ -180,7 +180,7 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun getLoginPreference(
|
fun getLoginPreference(
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
openWarnConfigureDialogController: () -> Unit,
|
openWarnConfigureDialogController: () -> Unit,
|
||||||
): Preference.PreferenceItem.SwitchPreference {
|
): Preference.PreferenceItem.SwitchPreference {
|
||||||
val activityResultContract =
|
val activityResultContract =
|
||||||
@@ -191,9 +191,9 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val value by unsortedPreferences.enableExhentai().collectAsState()
|
val value by exhPreferences.enableExhentai.collectAsState()
|
||||||
return Preference.PreferenceItem.SwitchPreference(
|
return Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = unsortedPreferences.enableExhentai(),
|
preference = exhPreferences.enableExhentai,
|
||||||
title = stringResource(SYMR.strings.enable_exhentai),
|
title = stringResource(SYMR.strings.enable_exhentai),
|
||||||
subtitle = if (!value) {
|
subtitle = if (!value) {
|
||||||
stringResource(SYMR.strings.requires_login)
|
stringResource(SYMR.strings.requires_login)
|
||||||
@@ -202,7 +202,7 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
onValueChanged = { newVal ->
|
onValueChanged = { newVal ->
|
||||||
if (!newVal) {
|
if (!newVal) {
|
||||||
unsortedPreferences.enableExhentai().set(false)
|
exhPreferences.enableExhentai.set(false)
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
activityResultContract.launch(EhLoginActivity.newIntent(context))
|
activityResultContract.launch(EhLoginActivity.newIntent(context))
|
||||||
@@ -215,10 +215,10 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
@Composable
|
@Composable
|
||||||
fun useHentaiAtHome(
|
fun useHentaiAtHome(
|
||||||
exhentaiEnabled: Boolean,
|
exhentaiEnabled: Boolean,
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
): Preference.PreferenceItem.ListPreference<Int> {
|
): Preference.PreferenceItem.ListPreference<Int> {
|
||||||
return Preference.PreferenceItem.ListPreference(
|
return Preference.PreferenceItem.ListPreference(
|
||||||
preference = unsortedPreferences.useHentaiAtHome(),
|
preference = exhPreferences.useHentaiAtHome,
|
||||||
title = stringResource(SYMR.strings.use_hentai_at_home),
|
title = stringResource(SYMR.strings.use_hentai_at_home),
|
||||||
subtitle = stringResource(SYMR.strings.use_hentai_at_home_summary),
|
subtitle = stringResource(SYMR.strings.use_hentai_at_home_summary),
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
@@ -232,11 +232,11 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
@Composable
|
@Composable
|
||||||
fun useJapaneseTitle(
|
fun useJapaneseTitle(
|
||||||
exhentaiEnabled: Boolean,
|
exhentaiEnabled: Boolean,
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
): Preference.PreferenceItem.SwitchPreference {
|
): Preference.PreferenceItem.SwitchPreference {
|
||||||
val value by unsortedPreferences.useJapaneseTitle().collectAsState()
|
val value by exhPreferences.useJapaneseTitle.collectAsState()
|
||||||
return Preference.PreferenceItem.SwitchPreference(
|
return Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = unsortedPreferences.useJapaneseTitle(),
|
preference = exhPreferences.useJapaneseTitle,
|
||||||
title = stringResource(SYMR.strings.show_japanese_titles),
|
title = stringResource(SYMR.strings.show_japanese_titles),
|
||||||
subtitle = if (value) {
|
subtitle = if (value) {
|
||||||
stringResource(SYMR.strings.show_japanese_titles_option_1)
|
stringResource(SYMR.strings.show_japanese_titles_option_1)
|
||||||
@@ -250,11 +250,11 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
@Composable
|
@Composable
|
||||||
fun useOriginalImages(
|
fun useOriginalImages(
|
||||||
exhentaiEnabled: Boolean,
|
exhentaiEnabled: Boolean,
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
): Preference.PreferenceItem.SwitchPreference {
|
): Preference.PreferenceItem.SwitchPreference {
|
||||||
val value by unsortedPreferences.exhUseOriginalImages().collectAsState()
|
val value by exhPreferences.exhUseOriginalImages.collectAsState()
|
||||||
return Preference.PreferenceItem.SwitchPreference(
|
return Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = unsortedPreferences.exhUseOriginalImages(),
|
preference = exhPreferences.exhUseOriginalImages,
|
||||||
title = stringResource(SYMR.strings.use_original_images),
|
title = stringResource(SYMR.strings.use_original_images),
|
||||||
subtitle = if (value) {
|
subtitle = if (value) {
|
||||||
stringResource(SYMR.strings.use_original_images_on)
|
stringResource(SYMR.strings.use_original_images_on)
|
||||||
@@ -351,9 +351,9 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
@Composable
|
@Composable
|
||||||
fun tagFilterThreshold(
|
fun tagFilterThreshold(
|
||||||
exhentaiEnabled: Boolean,
|
exhentaiEnabled: Boolean,
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
): Preference.PreferenceItem.TextPreference {
|
): Preference.PreferenceItem.TextPreference {
|
||||||
val value by unsortedPreferences.ehTagFilterValue().collectAsState()
|
val value by exhPreferences.ehTagFilterValue.collectAsState()
|
||||||
var dialogOpen by remember { mutableStateOf(false) }
|
var dialogOpen by remember { mutableStateOf(false) }
|
||||||
if (dialogOpen) {
|
if (dialogOpen) {
|
||||||
TagThresholdDialog(
|
TagThresholdDialog(
|
||||||
@@ -364,7 +364,7 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
outsideRangeError = stringResource(SYMR.strings.tag_filtering_threshhold_error),
|
outsideRangeError = stringResource(SYMR.strings.tag_filtering_threshhold_error),
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
dialogOpen = false
|
dialogOpen = false
|
||||||
unsortedPreferences.ehTagFilterValue().set(it)
|
exhPreferences.ehTagFilterValue.set(it)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -381,9 +381,9 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
@Composable
|
@Composable
|
||||||
fun tagWatchingThreshold(
|
fun tagWatchingThreshold(
|
||||||
exhentaiEnabled: Boolean,
|
exhentaiEnabled: Boolean,
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
): Preference.PreferenceItem.TextPreference {
|
): Preference.PreferenceItem.TextPreference {
|
||||||
val value by unsortedPreferences.ehTagWatchingValue().collectAsState()
|
val value by exhPreferences.ehTagWatchingValue.collectAsState()
|
||||||
var dialogOpen by remember { mutableStateOf(false) }
|
var dialogOpen by remember { mutableStateOf(false) }
|
||||||
if (dialogOpen) {
|
if (dialogOpen) {
|
||||||
TagThresholdDialog(
|
TagThresholdDialog(
|
||||||
@@ -394,7 +394,7 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
outsideRangeError = stringResource(SYMR.strings.tag_watching_threshhold_error),
|
outsideRangeError = stringResource(SYMR.strings.tag_watching_threshhold_error),
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
dialogOpen = false
|
dialogOpen = false
|
||||||
unsortedPreferences.ehTagWatchingValue().set(it)
|
exhPreferences.ehTagWatchingValue.set(it)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -604,9 +604,9 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
@Composable
|
@Composable
|
||||||
fun settingsLanguages(
|
fun settingsLanguages(
|
||||||
exhentaiEnabled: Boolean,
|
exhentaiEnabled: Boolean,
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
): Preference.PreferenceItem.TextPreference {
|
): Preference.PreferenceItem.TextPreference {
|
||||||
val value by unsortedPreferences.exhSettingsLanguages().collectAsState()
|
val value by exhPreferences.exhSettingsLanguages.collectAsState()
|
||||||
var dialogOpen by remember { mutableStateOf(false) }
|
var dialogOpen by remember { mutableStateOf(false) }
|
||||||
if (dialogOpen) {
|
if (dialogOpen) {
|
||||||
LanguagesDialog(
|
LanguagesDialog(
|
||||||
@@ -614,7 +614,7 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
initialValue = value,
|
initialValue = value,
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
dialogOpen = false
|
dialogOpen = false
|
||||||
unsortedPreferences.exhSettingsLanguages().set(it)
|
exhPreferences.exhSettingsLanguages.set(it)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -770,9 +770,9 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
@Composable
|
@Composable
|
||||||
fun enabledCategories(
|
fun enabledCategories(
|
||||||
exhentaiEnabled: Boolean,
|
exhentaiEnabled: Boolean,
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
): Preference.PreferenceItem.TextPreference {
|
): Preference.PreferenceItem.TextPreference {
|
||||||
val value by unsortedPreferences.exhEnabledCategories().collectAsState()
|
val value by exhPreferences.exhEnabledCategories.collectAsState()
|
||||||
var dialogOpen by remember { mutableStateOf(false) }
|
var dialogOpen by remember { mutableStateOf(false) }
|
||||||
if (dialogOpen) {
|
if (dialogOpen) {
|
||||||
FrontPageCategoriesDialog(
|
FrontPageCategoriesDialog(
|
||||||
@@ -780,7 +780,7 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
initialValue = value,
|
initialValue = value,
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
dialogOpen = false
|
dialogOpen = false
|
||||||
unsortedPreferences.exhEnabledCategories().set(it)
|
exhPreferences.exhEnabledCategories.set(it)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -797,10 +797,10 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
@Composable
|
@Composable
|
||||||
fun watchedListDefaultState(
|
fun watchedListDefaultState(
|
||||||
exhentaiEnabled: Boolean,
|
exhentaiEnabled: Boolean,
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
): Preference.PreferenceItem.SwitchPreference {
|
): Preference.PreferenceItem.SwitchPreference {
|
||||||
return Preference.PreferenceItem.SwitchPreference(
|
return Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = unsortedPreferences.exhWatchedListDefaultState(),
|
preference = exhPreferences.exhWatchedListDefaultState,
|
||||||
title = stringResource(SYMR.strings.watched_list_default),
|
title = stringResource(SYMR.strings.watched_list_default),
|
||||||
subtitle = stringResource(SYMR.strings.watched_list_state_summary),
|
subtitle = stringResource(SYMR.strings.watched_list_state_summary),
|
||||||
enabled = exhentaiEnabled,
|
enabled = exhentaiEnabled,
|
||||||
@@ -810,10 +810,10 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
@Composable
|
@Composable
|
||||||
fun imageQuality(
|
fun imageQuality(
|
||||||
exhentaiEnabled: Boolean,
|
exhentaiEnabled: Boolean,
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
): Preference.PreferenceItem.ListPreference<String> {
|
): Preference.PreferenceItem.ListPreference<String> {
|
||||||
return Preference.PreferenceItem.ListPreference(
|
return Preference.PreferenceItem.ListPreference(
|
||||||
preference = unsortedPreferences.imageQuality(),
|
preference = exhPreferences.imageQuality,
|
||||||
title = stringResource(SYMR.strings.eh_image_quality_summary),
|
title = stringResource(SYMR.strings.eh_image_quality_summary),
|
||||||
subtitle = stringResource(SYMR.strings.eh_image_quality),
|
subtitle = stringResource(SYMR.strings.eh_image_quality),
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
@@ -829,18 +829,18 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun enhancedEhentaiView(unsortedPreferences: UnsortedPreferences): Preference.PreferenceItem.SwitchPreference {
|
fun enhancedEhentaiView(exhPreferences: ExhPreferences): Preference.PreferenceItem.SwitchPreference {
|
||||||
return Preference.PreferenceItem.SwitchPreference(
|
return Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = unsortedPreferences.enhancedEHentaiView(),
|
preference = exhPreferences.enhancedEHentaiView,
|
||||||
title = stringResource(SYMR.strings.pref_enhanced_e_hentai_view),
|
title = stringResource(SYMR.strings.pref_enhanced_e_hentai_view),
|
||||||
subtitle = stringResource(SYMR.strings.pref_enhanced_e_hentai_view_summary),
|
subtitle = stringResource(SYMR.strings.pref_enhanced_e_hentai_view_summary),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun readOnlySync(unsortedPreferences: UnsortedPreferences): Preference.PreferenceItem.SwitchPreference {
|
fun readOnlySync(exhPreferences: ExhPreferences): Preference.PreferenceItem.SwitchPreference {
|
||||||
return Preference.PreferenceItem.SwitchPreference(
|
return Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = unsortedPreferences.exhReadOnlySync(),
|
preference = exhPreferences.exhReadOnlySync,
|
||||||
title = stringResource(SYMR.strings.disable_favorites_uploading),
|
title = stringResource(SYMR.strings.disable_favorites_uploading),
|
||||||
subtitle = stringResource(SYMR.strings.disable_favorites_uploading_summary),
|
subtitle = stringResource(SYMR.strings.disable_favorites_uploading_summary),
|
||||||
)
|
)
|
||||||
@@ -863,9 +863,9 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun lenientSync(unsortedPreferences: UnsortedPreferences): Preference.PreferenceItem.SwitchPreference {
|
fun lenientSync(exhPreferences: ExhPreferences): Preference.PreferenceItem.SwitchPreference {
|
||||||
return Preference.PreferenceItem.SwitchPreference(
|
return Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = unsortedPreferences.exhLenientSync(),
|
preference = exhPreferences.exhLenientSync,
|
||||||
title = stringResource(SYMR.strings.ignore_sync_errors),
|
title = stringResource(SYMR.strings.ignore_sync_errors),
|
||||||
subtitle = stringResource(SYMR.strings.ignore_sync_errors_summary),
|
subtitle = stringResource(SYMR.strings.ignore_sync_errors_summary),
|
||||||
)
|
)
|
||||||
@@ -935,12 +935,12 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun updateCheckerFrequency(
|
fun updateCheckerFrequency(
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
): Preference.PreferenceItem.ListPreference<Int> {
|
): Preference.PreferenceItem.ListPreference<Int> {
|
||||||
val value by unsortedPreferences.exhAutoUpdateFrequency().collectAsState()
|
val value by exhPreferences.exhAutoUpdateFrequency.collectAsState()
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
return Preference.PreferenceItem.ListPreference(
|
return Preference.PreferenceItem.ListPreference(
|
||||||
preference = unsortedPreferences.exhAutoUpdateFrequency(),
|
preference = exhPreferences.exhAutoUpdateFrequency,
|
||||||
title = stringResource(SYMR.strings.time_between_batches),
|
title = stringResource(SYMR.strings.time_between_batches),
|
||||||
subtitle = if (value == 0) {
|
subtitle = if (value == 0) {
|
||||||
stringResource(SYMR.strings.time_between_batches_summary_1, stringResource(MR.strings.app_name))
|
stringResource(SYMR.strings.time_between_batches_summary_1, stringResource(MR.strings.app_name))
|
||||||
@@ -971,12 +971,12 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun autoUpdateRequirements(
|
fun autoUpdateRequirements(
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
): Preference.PreferenceItem.MultiSelectListPreference {
|
): Preference.PreferenceItem.MultiSelectListPreference {
|
||||||
val value by unsortedPreferences.exhAutoUpdateRequirements().collectAsState()
|
val value by exhPreferences.exhAutoUpdateRequirements.collectAsState()
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
return Preference.PreferenceItem.MultiSelectListPreference(
|
return Preference.PreferenceItem.MultiSelectListPreference(
|
||||||
preference = unsortedPreferences.exhAutoUpdateRequirements(),
|
preference = exhPreferences.exhAutoUpdateRequirements,
|
||||||
title = stringResource(SYMR.strings.auto_update_restrictions),
|
title = stringResource(SYMR.strings.auto_update_restrictions),
|
||||||
subtitle = remember(value) {
|
subtitle = remember(value) {
|
||||||
context.stringResource(
|
context.stringResource(
|
||||||
@@ -1139,7 +1139,7 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun updaterStatistics(
|
fun updaterStatistics(
|
||||||
unsortedPreferences: UnsortedPreferences,
|
exhPreferences: ExhPreferences,
|
||||||
getExhFavoriteMangaWithMetadata: GetExhFavoriteMangaWithMetadata,
|
getExhFavoriteMangaWithMetadata: GetExhFavoriteMangaWithMetadata,
|
||||||
getFlatMetadataById: GetFlatMetadataById,
|
getFlatMetadataById: GetFlatMetadataById,
|
||||||
): Preference.PreferenceItem.TextPreference {
|
): Preference.PreferenceItem.TextPreference {
|
||||||
@@ -1150,7 +1150,7 @@ object SettingsEhScreen : SearchableSettings {
|
|||||||
value = withIOContext {
|
value = withIOContext {
|
||||||
try {
|
try {
|
||||||
val stats =
|
val stats =
|
||||||
unsortedPreferences.exhAutoUpdateStats().get().nullIfBlank()?.let {
|
exhPreferences.exhAutoUpdateStats.get().nullIfBlank()?.let {
|
||||||
Json.decodeFromString<EHentaiUpdaterStats>(it)
|
Json.decodeFromString<EHentaiUpdaterStats>(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-37
@@ -25,7 +25,6 @@ import kotlinx.collections.immutable.persistentListOf
|
|||||||
import kotlinx.collections.immutable.persistentMapOf
|
import kotlinx.collections.immutable.persistentMapOf
|
||||||
import kotlinx.collections.immutable.toImmutableMap
|
import kotlinx.collections.immutable.toImmutableMap
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import tachiyomi.domain.UnsortedPreferences
|
|
||||||
import tachiyomi.domain.category.interactor.GetCategories
|
import tachiyomi.domain.category.interactor.GetCategories
|
||||||
import tachiyomi.domain.category.interactor.ResetCategoryFlags
|
import tachiyomi.domain.category.interactor.ResetCategoryFlags
|
||||||
import tachiyomi.domain.category.model.Category
|
import tachiyomi.domain.category.model.Category
|
||||||
@@ -59,9 +58,6 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
val getCategories = remember { Injekt.get<GetCategories>() }
|
val getCategories = remember { Injekt.get<GetCategories>() }
|
||||||
val libraryPreferences = remember { Injekt.get<LibraryPreferences>() }
|
val libraryPreferences = remember { Injekt.get<LibraryPreferences>() }
|
||||||
val allCategories by getCategories.subscribe().collectAsState(initial = emptyList())
|
val allCategories by getCategories.subscribe().collectAsState(initial = emptyList())
|
||||||
// SY -->
|
|
||||||
val unsortedPreferences = remember { Injekt.get<UnsortedPreferences>() }
|
|
||||||
// SY <--
|
|
||||||
|
|
||||||
return listOf(
|
return listOf(
|
||||||
getCategoriesGroup(LocalNavigator.currentOrThrow, allCategories, libraryPreferences),
|
getCategoriesGroup(LocalNavigator.currentOrThrow, allCategories, libraryPreferences),
|
||||||
@@ -69,7 +65,6 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
getBehaviorGroup(libraryPreferences),
|
getBehaviorGroup(libraryPreferences),
|
||||||
// SY -->
|
// SY -->
|
||||||
getSortingCategory(LocalNavigator.currentOrThrow, libraryPreferences),
|
getSortingCategory(LocalNavigator.currentOrThrow, libraryPreferences),
|
||||||
getMigrationCategory(unsortedPreferences),
|
|
||||||
// SY <--
|
// SY <--
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -84,7 +79,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
val userCategoriesCount = allCategories.filterNot(Category::isSystemCategory).size
|
val userCategoriesCount = allCategories.filterNot(Category::isSystemCategory).size
|
||||||
|
|
||||||
// For default category
|
// For default category
|
||||||
val ids = listOf(libraryPreferences.defaultCategory().defaultValue()) +
|
val ids = listOf(libraryPreferences.defaultCategory.defaultValue()) +
|
||||||
allCategories.fastMap { it.id.toInt() }
|
allCategories.fastMap { it.id.toInt() }
|
||||||
val labels = listOf(stringResource(MR.strings.default_category_summary)) +
|
val labels = listOf(stringResource(MR.strings.default_category_summary)) +
|
||||||
allCategories.fastMap { it.visualName }
|
allCategories.fastMap { it.visualName }
|
||||||
@@ -102,12 +97,12 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
onClick = { navigator.push(CategoryScreen()) },
|
onClick = { navigator.push(CategoryScreen()) },
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = libraryPreferences.defaultCategory(),
|
preference = libraryPreferences.defaultCategory,
|
||||||
entries = ids.zip(labels).toMap().toImmutableMap(),
|
entries = ids.zip(labels).toMap().toImmutableMap(),
|
||||||
title = stringResource(MR.strings.default_category),
|
title = stringResource(MR.strings.default_category),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = libraryPreferences.categorizedDisplaySettings(),
|
preference = libraryPreferences.categorizedDisplaySettings,
|
||||||
title = stringResource(MR.strings.categorized_display_settings),
|
title = stringResource(MR.strings.categorized_display_settings),
|
||||||
onValueChanged = {
|
onValueChanged = {
|
||||||
if (!it) {
|
if (!it) {
|
||||||
@@ -129,9 +124,9 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
): Preference.PreferenceGroup {
|
): Preference.PreferenceGroup {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
val autoUpdateIntervalPref = libraryPreferences.autoUpdateInterval()
|
val autoUpdateIntervalPref = libraryPreferences.autoUpdateInterval
|
||||||
val autoUpdateCategoriesPref = libraryPreferences.updateCategories()
|
val autoUpdateCategoriesPref = libraryPreferences.updateCategories
|
||||||
val autoUpdateCategoriesExcludePref = libraryPreferences.updateCategoriesExclude()
|
val autoUpdateCategoriesExcludePref = libraryPreferences.updateCategoriesExclude
|
||||||
|
|
||||||
val autoUpdateInterval by autoUpdateIntervalPref.collectAsState()
|
val autoUpdateInterval by autoUpdateIntervalPref.collectAsState()
|
||||||
|
|
||||||
@@ -175,7 +170,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.MultiSelectListPreference(
|
Preference.PreferenceItem.MultiSelectListPreference(
|
||||||
preference = libraryPreferences.autoUpdateDeviceRestrictions(),
|
preference = libraryPreferences.autoUpdateDeviceRestrictions,
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
DEVICE_ONLY_ON_WIFI to stringResource(MR.strings.connected_to_wifi),
|
DEVICE_ONLY_ON_WIFI to stringResource(MR.strings.connected_to_wifi),
|
||||||
DEVICE_NETWORK_NOT_METERED to stringResource(MR.strings.network_not_metered),
|
DEVICE_NETWORK_NOT_METERED to stringResource(MR.strings.network_not_metered),
|
||||||
@@ -201,7 +196,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
// SY -->
|
// SY -->
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = libraryPreferences.groupLibraryUpdateType(),
|
preference = libraryPreferences.groupLibraryUpdateType,
|
||||||
title = stringResource(SYMR.strings.library_group_updates),
|
title = stringResource(SYMR.strings.library_group_updates),
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
GroupLibraryMode.GLOBAL to stringResource(SYMR.strings.library_group_updates_global),
|
GroupLibraryMode.GLOBAL to stringResource(SYMR.strings.library_group_updates_global),
|
||||||
@@ -212,12 +207,12 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
// SY <--
|
// SY <--
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = libraryPreferences.autoUpdateMetadata(),
|
preference = libraryPreferences.autoUpdateMetadata,
|
||||||
title = stringResource(MR.strings.pref_library_update_refresh_metadata),
|
title = stringResource(MR.strings.pref_library_update_refresh_metadata),
|
||||||
subtitle = stringResource(MR.strings.pref_library_update_refresh_metadata_summary),
|
subtitle = stringResource(MR.strings.pref_library_update_refresh_metadata_summary),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.MultiSelectListPreference(
|
Preference.PreferenceItem.MultiSelectListPreference(
|
||||||
preference = libraryPreferences.autoUpdateMangaRestrictions(),
|
preference = libraryPreferences.autoUpdateMangaRestrictions,
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
MANGA_HAS_UNREAD to stringResource(MR.strings.pref_update_only_completely_read),
|
MANGA_HAS_UNREAD to stringResource(MR.strings.pref_update_only_completely_read),
|
||||||
MANGA_NON_READ to stringResource(MR.strings.pref_update_only_started),
|
MANGA_NON_READ to stringResource(MR.strings.pref_update_only_started),
|
||||||
@@ -227,7 +222,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_library_update_smart_update),
|
title = stringResource(MR.strings.pref_library_update_smart_update),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = libraryPreferences.newShowUpdatesCount(),
|
preference = libraryPreferences.newShowUpdatesCount,
|
||||||
title = stringResource(MR.strings.pref_library_update_show_tab_badge),
|
title = stringResource(MR.strings.pref_library_update_show_tab_badge),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -242,7 +237,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_behavior),
|
title = stringResource(MR.strings.pref_behavior),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = libraryPreferences.swipeToStartAction(),
|
preference = libraryPreferences.swipeToStartAction,
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
LibraryPreferences.ChapterSwipeAction.Disabled to
|
LibraryPreferences.ChapterSwipeAction.Disabled to
|
||||||
stringResource(MR.strings.disabled),
|
stringResource(MR.strings.disabled),
|
||||||
@@ -256,7 +251,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_chapter_swipe_start),
|
title = stringResource(MR.strings.pref_chapter_swipe_start),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = libraryPreferences.swipeToEndAction(),
|
preference = libraryPreferences.swipeToEndAction,
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
LibraryPreferences.ChapterSwipeAction.Disabled to
|
LibraryPreferences.ChapterSwipeAction.Disabled to
|
||||||
stringResource(MR.strings.disabled),
|
stringResource(MR.strings.disabled),
|
||||||
@@ -270,7 +265,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_chapter_swipe_end),
|
title = stringResource(MR.strings.pref_chapter_swipe_end),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.MultiSelectListPreference(
|
Preference.PreferenceItem.MultiSelectListPreference(
|
||||||
preference = libraryPreferences.markDuplicateReadChapterAsRead(),
|
preference = libraryPreferences.markDuplicateReadChapterAsRead,
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
MARK_DUPLICATE_CHAPTER_READ_EXISTING to
|
MARK_DUPLICATE_CHAPTER_READ_EXISTING to
|
||||||
stringResource(MR.strings.pref_mark_duplicate_read_chapter_read_existing),
|
stringResource(MR.strings.pref_mark_duplicate_read_chapter_read_existing),
|
||||||
@@ -286,7 +281,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
// SY -->
|
// SY -->
|
||||||
@Composable
|
@Composable
|
||||||
fun getSortingCategory(navigator: Navigator, libraryPreferences: LibraryPreferences): Preference.PreferenceGroup {
|
fun getSortingCategory(navigator: Navigator, libraryPreferences: LibraryPreferences): Preference.PreferenceGroup {
|
||||||
val tagCount by libraryPreferences.sortTagsForLibrary().collectAsState()
|
val tagCount by libraryPreferences.sortTagsForLibrary.collectAsState()
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
stringResource(SYMR.strings.pref_sorting_settings),
|
stringResource(SYMR.strings.pref_sorting_settings),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
@@ -300,22 +295,5 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun getMigrationCategory(unsortedPreferences: UnsortedPreferences): Preference.PreferenceGroup {
|
|
||||||
val skipPreMigration by unsortedPreferences.skipPreMigration().collectAsState()
|
|
||||||
val migrationSources by unsortedPreferences.migrationSources().collectAsState()
|
|
||||||
return Preference.PreferenceGroup(
|
|
||||||
stringResource(SYMR.strings.migration),
|
|
||||||
enabled = skipPreMigration || migrationSources.isNotEmpty(),
|
|
||||||
preferenceItems = persistentListOf(
|
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
|
||||||
preference = unsortedPreferences.skipPreMigration(),
|
|
||||||
title = stringResource(SYMR.strings.skip_pre_migration),
|
|
||||||
subtitle = stringResource(SYMR.strings.pref_skip_pre_migration_summary),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// SY <--
|
// SY <--
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import androidx.compose.foundation.lazy.rememberLazyListState
|
|||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.outlined.ChromeReaderMode
|
import androidx.compose.material.icons.automirrored.outlined.ChromeReaderMode
|
||||||
import androidx.compose.material.icons.outlined.ChromeReaderMode
|
|
||||||
import androidx.compose.material.icons.outlined.Code
|
import androidx.compose.material.icons.outlined.Code
|
||||||
import androidx.compose.material.icons.outlined.CollectionsBookmark
|
import androidx.compose.material.icons.outlined.CollectionsBookmark
|
||||||
import androidx.compose.material.icons.outlined.Explore
|
import androidx.compose.material.icons.outlined.Explore
|
||||||
|
|||||||
+6
-9
@@ -44,7 +44,6 @@ import logcat.LogPriority
|
|||||||
import tachiyomi.core.common.util.lang.launchIO
|
import tachiyomi.core.common.util.lang.launchIO
|
||||||
import tachiyomi.core.common.util.lang.withUIContext
|
import tachiyomi.core.common.util.lang.withUIContext
|
||||||
import tachiyomi.core.common.util.system.logcat
|
import tachiyomi.core.common.util.system.logcat
|
||||||
import tachiyomi.domain.UnsortedPreferences
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.i18n.sy.SYMR
|
import tachiyomi.i18n.sy.SYMR
|
||||||
import tachiyomi.presentation.core.components.material.padding
|
import tachiyomi.presentation.core.components.material.padding
|
||||||
@@ -65,14 +64,13 @@ object SettingsMangadexScreen : SearchableSettings {
|
|||||||
@Composable
|
@Composable
|
||||||
override fun getPreferences(): List<Preference> {
|
override fun getPreferences(): List<Preference> {
|
||||||
val sourcePreferences: SourcePreferences = remember { Injekt.get() }
|
val sourcePreferences: SourcePreferences = remember { Injekt.get() }
|
||||||
val unsortedPreferences: UnsortedPreferences = remember { Injekt.get() }
|
|
||||||
val trackPreferences: TrackPreferences = remember { Injekt.get() }
|
val trackPreferences: TrackPreferences = remember { Injekt.get() }
|
||||||
val mdex = remember { MdUtil.getEnabledMangaDex(unsortedPreferences, sourcePreferences) } ?: return emptyList()
|
val mdex = remember { MdUtil.getEnabledMangaDex(sourcePreferences) } ?: return emptyList()
|
||||||
|
|
||||||
return listOf(
|
return listOf(
|
||||||
loginPreference(mdex, trackPreferences),
|
loginPreference(mdex, trackPreferences),
|
||||||
preferredMangaDexId(unsortedPreferences, sourcePreferences),
|
preferredMangaDexId(sourcePreferences),
|
||||||
syncMangaDexIntoThis(unsortedPreferences),
|
syncMangaDexIntoThis(sourcePreferences),
|
||||||
syncLibraryToMangaDex(),
|
syncLibraryToMangaDex(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -174,11 +172,10 @@ object SettingsMangadexScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun preferredMangaDexId(
|
fun preferredMangaDexId(
|
||||||
unsortedPreferences: UnsortedPreferences,
|
|
||||||
sourcePreferences: SourcePreferences,
|
sourcePreferences: SourcePreferences,
|
||||||
): Preference.PreferenceItem.ListPreference<String> {
|
): Preference.PreferenceItem.ListPreference<String> {
|
||||||
return Preference.PreferenceItem.ListPreference(
|
return Preference.PreferenceItem.ListPreference(
|
||||||
preference = unsortedPreferences.preferredMangaDexId(),
|
preference = sourcePreferences.preferredMangaDexId,
|
||||||
title = stringResource(SYMR.strings.mangadex_preffered_source),
|
title = stringResource(SYMR.strings.mangadex_preffered_source),
|
||||||
subtitle = stringResource(SYMR.strings.mangadex_preffered_source_summary),
|
subtitle = stringResource(SYMR.strings.mangadex_preffered_source_summary),
|
||||||
entries = MdUtil.getEnabledMangaDexs(sourcePreferences)
|
entries = MdUtil.getEnabledMangaDexs(sourcePreferences)
|
||||||
@@ -250,7 +247,7 @@ object SettingsMangadexScreen : SearchableSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun syncMangaDexIntoThis(unsortedPreferences: UnsortedPreferences): Preference.PreferenceItem.TextPreference {
|
fun syncMangaDexIntoThis(sourcePreferences: SourcePreferences): Preference.PreferenceItem.TextPreference {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
var dialogOpen by remember { mutableStateOf(false) }
|
var dialogOpen by remember { mutableStateOf(false) }
|
||||||
if (dialogOpen) {
|
if (dialogOpen) {
|
||||||
@@ -258,7 +255,7 @@ object SettingsMangadexScreen : SearchableSettings {
|
|||||||
onDismissRequest = { dialogOpen = false },
|
onDismissRequest = { dialogOpen = false },
|
||||||
onSelectionConfirmed = { items ->
|
onSelectionConfirmed = { items ->
|
||||||
dialogOpen = false
|
dialogOpen = false
|
||||||
unsortedPreferences.mangadexSyncToLibraryIndexes().set(
|
sourcePreferences.mangadexSyncToLibraryIndexes.set(
|
||||||
List(items.size) { index -> (index + 1).toString() }.toSet(),
|
List(items.size) { index -> (index + 1).toString() }.toSet(),
|
||||||
)
|
)
|
||||||
LibraryUpdateJob.startNow(
|
LibraryUpdateJob.startNow(
|
||||||
|
|||||||
+76
-94
@@ -1,6 +1,5 @@
|
|||||||
package eu.kanade.presentation.more.settings.screen
|
package eu.kanade.presentation.more.settings.screen
|
||||||
|
|
||||||
import android.os.Build
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.ReadOnlyComposable
|
import androidx.compose.runtime.ReadOnlyComposable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
@@ -12,6 +11,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation
|
|||||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
||||||
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
|
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerConfig
|
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerConfig
|
||||||
|
import eu.kanade.tachiyomi.util.system.hasDisplayCutout
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
import kotlinx.collections.immutable.persistentMapOf
|
import kotlinx.collections.immutable.persistentMapOf
|
||||||
import kotlinx.collections.immutable.toImmutableMap
|
import kotlinx.collections.immutable.toImmutableMap
|
||||||
@@ -34,19 +34,19 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
override fun getPreferences(): List<Preference> {
|
override fun getPreferences(): List<Preference> {
|
||||||
val readerPref = remember { Injekt.get<ReaderPreferences>() }
|
val readerPref = remember { Injekt.get<ReaderPreferences>() }
|
||||||
// SY -->
|
// SY -->
|
||||||
val forceHorizontalSeekbar by readerPref.forceHorizontalSeekbar().collectAsState()
|
val forceHorizontalSeekbar by readerPref.forceHorizontalSeekbar.collectAsState()
|
||||||
// SY <--
|
// SY <--
|
||||||
|
|
||||||
return listOf(
|
return listOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPref.defaultReadingMode(),
|
preference = readerPref.defaultReadingMode,
|
||||||
entries = ReadingMode.entries.drop(1)
|
entries = ReadingMode.entries.drop(1)
|
||||||
.associate { it.flagValue to stringResource(it.stringRes) }
|
.associate { it.flagValue to stringResource(it.stringRes) }
|
||||||
.toImmutableMap(),
|
.toImmutableMap(),
|
||||||
title = stringResource(MR.strings.pref_viewer_type),
|
title = stringResource(MR.strings.pref_viewer_type),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPref.doubleTapAnimSpeed(),
|
preference = readerPref.doubleTapAnimSpeed,
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
1 to stringResource(MR.strings.double_tap_anim_speed_0),
|
1 to stringResource(MR.strings.double_tap_anim_speed_0),
|
||||||
500 to stringResource(MR.strings.double_tap_anim_speed_normal),
|
500 to stringResource(MR.strings.double_tap_anim_speed_normal),
|
||||||
@@ -55,29 +55,29 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_double_tap_anim_speed),
|
title = stringResource(MR.strings.pref_double_tap_anim_speed),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPref.showReadingMode(),
|
preference = readerPref.showReadingMode,
|
||||||
title = stringResource(MR.strings.pref_show_reading_mode),
|
title = stringResource(MR.strings.pref_show_reading_mode),
|
||||||
subtitle = stringResource(MR.strings.pref_show_reading_mode_summary),
|
subtitle = stringResource(MR.strings.pref_show_reading_mode_summary),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPref.showNavigationOverlayOnStart(),
|
preference = readerPref.showNavigationOverlayOnStart,
|
||||||
title = stringResource(MR.strings.pref_show_navigation_mode),
|
title = stringResource(MR.strings.pref_show_navigation_mode),
|
||||||
subtitle = stringResource(MR.strings.pref_show_navigation_mode_summary),
|
subtitle = stringResource(MR.strings.pref_show_navigation_mode_summary),
|
||||||
),
|
),
|
||||||
// SY -->
|
// SY -->
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPref.forceHorizontalSeekbar(),
|
preference = readerPref.forceHorizontalSeekbar,
|
||||||
title = stringResource(SYMR.strings.pref_force_horz_seekbar),
|
title = stringResource(SYMR.strings.pref_force_horz_seekbar),
|
||||||
subtitle = stringResource(SYMR.strings.pref_force_horz_seekbar_summary),
|
subtitle = stringResource(SYMR.strings.pref_force_horz_seekbar_summary),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPref.landscapeVerticalSeekbar(),
|
preference = readerPref.landscapeVerticalSeekbar,
|
||||||
title = stringResource(SYMR.strings.pref_show_vert_seekbar_landscape),
|
title = stringResource(SYMR.strings.pref_show_vert_seekbar_landscape),
|
||||||
subtitle = stringResource(SYMR.strings.pref_show_vert_seekbar_landscape_summary),
|
subtitle = stringResource(SYMR.strings.pref_show_vert_seekbar_landscape_summary),
|
||||||
enabled = !forceHorizontalSeekbar,
|
enabled = !forceHorizontalSeekbar,
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPref.leftVerticalSeekbar(),
|
preference = readerPref.leftVerticalSeekbar,
|
||||||
title = stringResource(SYMR.strings.pref_left_handed_vertical_seekbar),
|
title = stringResource(SYMR.strings.pref_left_handed_vertical_seekbar),
|
||||||
subtitle = stringResource(SYMR.strings.pref_left_handed_vertical_seekbar_summary),
|
subtitle = stringResource(SYMR.strings.pref_left_handed_vertical_seekbar_summary),
|
||||||
enabled = !forceHorizontalSeekbar,
|
enabled = !forceHorizontalSeekbar,
|
||||||
@@ -85,7 +85,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
// SY <--
|
// SY <--
|
||||||
/* SY -->
|
/* SY -->
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPref.pageTransitions(),
|
preference = readerPref.pageTransitions,
|
||||||
title = stringResource(MR.strings.pref_page_transitions),
|
title = stringResource(MR.strings.pref_page_transitions),
|
||||||
),
|
),
|
||||||
SY <-- */
|
SY <-- */
|
||||||
@@ -108,20 +108,20 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun getDisplayGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
private fun getDisplayGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
||||||
val fullscreenPref = readerPreferences.fullscreen()
|
val fullscreenPref = readerPreferences.fullscreen
|
||||||
val fullscreen by fullscreenPref.collectAsState()
|
val fullscreen by fullscreenPref.collectAsState()
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_category_display),
|
title = stringResource(MR.strings.pref_category_display),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.defaultOrientationType(),
|
preference = readerPreferences.defaultOrientationType,
|
||||||
entries = ReaderOrientation.entries.drop(1)
|
entries = ReaderOrientation.entries.drop(1)
|
||||||
.associate { it.flagValue to stringResource(it.stringRes) }
|
.associate { it.flagValue to stringResource(it.stringRes) }
|
||||||
.toImmutableMap(),
|
.toImmutableMap(),
|
||||||
title = stringResource(MR.strings.pref_rotation_type),
|
title = stringResource(MR.strings.pref_rotation_type),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.readerTheme(),
|
preference = readerPreferences.readerTheme,
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
1 to stringResource(MR.strings.black_background),
|
1 to stringResource(MR.strings.black_background),
|
||||||
2 to stringResource(MR.strings.gray_background),
|
2 to stringResource(MR.strings.gray_background),
|
||||||
@@ -135,18 +135,16 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_fullscreen),
|
title = stringResource(MR.strings.pref_fullscreen),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.cutoutShort(),
|
preference = readerPreferences.drawUnderCutout,
|
||||||
title = stringResource(MR.strings.pref_cutout_short),
|
title = stringResource(MR.strings.pref_cutout_short),
|
||||||
enabled = fullscreen &&
|
enabled = LocalView.current.hasDisplayCutout() && fullscreen,
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.P &&
|
|
||||||
LocalView.current.rootWindowInsets?.displayCutout != null, // has cutout
|
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.keepScreenOn(),
|
preference = readerPreferences.keepScreenOn,
|
||||||
title = stringResource(MR.strings.pref_keep_screen_on),
|
title = stringResource(MR.strings.pref_keep_screen_on),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.showPageNumber(),
|
preference = readerPreferences.showPageNumber,
|
||||||
title = stringResource(MR.strings.pref_show_page_number),
|
title = stringResource(MR.strings.pref_show_page_number),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -155,21 +153,21 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun getEInkGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
private fun getEInkGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
||||||
val flashPageState by readerPreferences.flashOnPageChange().collectAsState()
|
val flashPageState by readerPreferences.flashOnPageChange.collectAsState()
|
||||||
|
|
||||||
val flashMillisPref = readerPreferences.flashDurationMillis()
|
val flashMillisPref = readerPreferences.flashDurationMillis
|
||||||
val flashMillis by flashMillisPref.collectAsState()
|
val flashMillis by flashMillisPref.collectAsState()
|
||||||
|
|
||||||
val flashIntervalPref = readerPreferences.flashPageInterval()
|
val flashIntervalPref = readerPreferences.flashPageInterval
|
||||||
val flashInterval by flashIntervalPref.collectAsState()
|
val flashInterval by flashIntervalPref.collectAsState()
|
||||||
|
|
||||||
val flashColorPref = readerPreferences.flashColor()
|
val flashColorPref = readerPreferences.flashColor
|
||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = "E-Ink",
|
title = "E-Ink",
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.flashOnPageChange(),
|
preference = readerPreferences.flashOnPageChange,
|
||||||
title = stringResource(MR.strings.pref_flash_page),
|
title = stringResource(MR.strings.pref_flash_page),
|
||||||
subtitle = stringResource(MR.strings.pref_flash_page_summ),
|
subtitle = stringResource(MR.strings.pref_flash_page_summ),
|
||||||
),
|
),
|
||||||
@@ -177,23 +175,17 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
value = flashMillis / ReaderPreferences.MILLI_CONVERSION,
|
value = flashMillis / ReaderPreferences.MILLI_CONVERSION,
|
||||||
valueRange = 1..15,
|
valueRange = 1..15,
|
||||||
title = stringResource(MR.strings.pref_flash_duration),
|
title = stringResource(MR.strings.pref_flash_duration),
|
||||||
subtitle = stringResource(MR.strings.pref_flash_duration_summary, flashMillis),
|
valueString = stringResource(MR.strings.pref_flash_duration_summary, flashMillis),
|
||||||
enabled = flashPageState,
|
enabled = flashPageState,
|
||||||
onValueChanged = {
|
onValueChanged = { flashMillisPref.set(it * ReaderPreferences.MILLI_CONVERSION) },
|
||||||
flashMillisPref.set(it * ReaderPreferences.MILLI_CONVERSION)
|
|
||||||
true
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SliderPreference(
|
Preference.PreferenceItem.SliderPreference(
|
||||||
value = flashInterval,
|
value = flashInterval,
|
||||||
valueRange = 1..10,
|
valueRange = 1..10,
|
||||||
title = stringResource(MR.strings.pref_flash_page_interval),
|
title = stringResource(MR.strings.pref_flash_page_interval),
|
||||||
subtitle = pluralStringResource(MR.plurals.pref_pages, flashInterval, flashInterval),
|
valueString = pluralStringResource(MR.plurals.pref_pages, flashInterval, flashInterval),
|
||||||
enabled = flashPageState,
|
enabled = flashPageState,
|
||||||
onValueChanged = {
|
onValueChanged = { flashIntervalPref.set(it) },
|
||||||
flashIntervalPref.set(it)
|
|
||||||
true
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = flashColorPref,
|
preference = flashColorPref,
|
||||||
@@ -216,26 +208,19 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_category_reading),
|
title = stringResource(MR.strings.pref_category_reading),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.skipRead(),
|
preference = readerPreferences.skipRead,
|
||||||
title = stringResource(MR.strings.pref_skip_read_chapters),
|
title = stringResource(MR.strings.pref_skip_read_chapters),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.skipFiltered(),
|
preference = readerPreferences.skipFiltered,
|
||||||
title = stringResource(MR.strings.pref_skip_filtered_chapters),
|
title = stringResource(MR.strings.pref_skip_filtered_chapters),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.skipDupe(),
|
preference = readerPreferences.skipDupe,
|
||||||
title = stringResource(MR.strings.pref_skip_dupe_chapters),
|
title = stringResource(MR.strings.pref_skip_dupe_chapters),
|
||||||
),
|
),
|
||||||
// SY -->
|
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.markReadDupe(),
|
preference = readerPreferences.alwaysShowChapterTransition,
|
||||||
title = stringResource(SYMR.strings.pref_mark_read_dupe_chapters),
|
|
||||||
subtitle = stringResource(SYMR.strings.pref_mark_read_dupe_chapters_summary),
|
|
||||||
),
|
|
||||||
// SY <--
|
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
|
||||||
preference = readerPreferences.alwaysShowChapterTransition(),
|
|
||||||
title = stringResource(MR.strings.pref_always_show_chapter_transition),
|
title = stringResource(MR.strings.pref_always_show_chapter_transition),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -244,10 +229,10 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun getPagedGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
private fun getPagedGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
||||||
val navModePref = readerPreferences.navigationModePager()
|
val navModePref = readerPreferences.navigationModePager
|
||||||
val imageScaleTypePref = readerPreferences.imageScaleType()
|
val imageScaleTypePref = readerPreferences.imageScaleType
|
||||||
val dualPageSplitPref = readerPreferences.dualPageSplitPaged()
|
val dualPageSplitPref = readerPreferences.dualPageSplitPaged
|
||||||
val rotateToFitPref = readerPreferences.dualPageRotateToFit()
|
val rotateToFitPref = readerPreferences.dualPageRotateToFit
|
||||||
|
|
||||||
val navMode by navModePref.collectAsState()
|
val navMode by navModePref.collectAsState()
|
||||||
val imageScaleType by imageScaleTypePref.collectAsState()
|
val imageScaleType by imageScaleTypePref.collectAsState()
|
||||||
@@ -266,7 +251,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_viewer_nav),
|
title = stringResource(MR.strings.pref_viewer_nav),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.pagerNavInverted(),
|
preference = readerPreferences.pagerNavInverted,
|
||||||
entries = persistentListOf(
|
entries = persistentListOf(
|
||||||
ReaderPreferences.TappingInvertMode.NONE,
|
ReaderPreferences.TappingInvertMode.NONE,
|
||||||
ReaderPreferences.TappingInvertMode.HORIZONTAL,
|
ReaderPreferences.TappingInvertMode.HORIZONTAL,
|
||||||
@@ -287,7 +272,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_image_scale_type),
|
title = stringResource(MR.strings.pref_image_scale_type),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.zoomStart(),
|
preference = readerPreferences.zoomStart,
|
||||||
entries = ReaderPreferences.ZoomStart
|
entries = ReaderPreferences.ZoomStart
|
||||||
.mapIndexed { index, it -> index + 1 to stringResource(it) }
|
.mapIndexed { index, it -> index + 1 to stringResource(it) }
|
||||||
.toMap()
|
.toMap()
|
||||||
@@ -295,22 +280,22 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_zoom_start),
|
title = stringResource(MR.strings.pref_zoom_start),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.cropBorders(),
|
preference = readerPreferences.cropBorders,
|
||||||
title = stringResource(MR.strings.pref_crop_borders),
|
title = stringResource(MR.strings.pref_crop_borders),
|
||||||
),
|
),
|
||||||
// SY -->
|
// SY -->
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.pageTransitionsPager(),
|
preference = readerPreferences.pageTransitionsPager,
|
||||||
title = stringResource(MR.strings.pref_page_transitions),
|
title = stringResource(MR.strings.pref_page_transitions),
|
||||||
),
|
),
|
||||||
// SY <--
|
// SY <--
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.landscapeZoom(),
|
preference = readerPreferences.landscapeZoom,
|
||||||
title = stringResource(MR.strings.pref_landscape_zoom),
|
title = stringResource(MR.strings.pref_landscape_zoom),
|
||||||
enabled = imageScaleType == 1,
|
enabled = imageScaleType == 1,
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.navigateToPan(),
|
preference = readerPreferences.navigateToPan,
|
||||||
title = stringResource(MR.strings.pref_navigate_pan),
|
title = stringResource(MR.strings.pref_navigate_pan),
|
||||||
enabled = navMode != 5,
|
enabled = navMode != 5,
|
||||||
),
|
),
|
||||||
@@ -323,7 +308,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.dualPageInvertPaged(),
|
preference = readerPreferences.dualPageInvertPaged,
|
||||||
title = stringResource(MR.strings.pref_dual_page_invert),
|
title = stringResource(MR.strings.pref_dual_page_invert),
|
||||||
subtitle = stringResource(MR.strings.pref_dual_page_invert_summary),
|
subtitle = stringResource(MR.strings.pref_dual_page_invert_summary),
|
||||||
enabled = dualPageSplit,
|
enabled = dualPageSplit,
|
||||||
@@ -337,7 +322,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.dualPageRotateToFitInvert(),
|
preference = readerPreferences.dualPageRotateToFitInvert,
|
||||||
title = stringResource(MR.strings.pref_page_rotate_invert),
|
title = stringResource(MR.strings.pref_page_rotate_invert),
|
||||||
enabled = rotateToFit,
|
enabled = rotateToFit,
|
||||||
),
|
),
|
||||||
@@ -349,10 +334,10 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
private fun getWebtoonGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
private fun getWebtoonGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
||||||
val numberFormat = remember { NumberFormat.getPercentInstance() }
|
val numberFormat = remember { NumberFormat.getPercentInstance() }
|
||||||
|
|
||||||
val navModePref = readerPreferences.navigationModeWebtoon()
|
val navModePref = readerPreferences.navigationModeWebtoon
|
||||||
val dualPageSplitPref = readerPreferences.dualPageSplitWebtoon()
|
val dualPageSplitPref = readerPreferences.dualPageSplitWebtoon
|
||||||
val rotateToFitPref = readerPreferences.dualPageRotateToFitWebtoon()
|
val rotateToFitPref = readerPreferences.dualPageRotateToFitWebtoon
|
||||||
val webtoonSidePaddingPref = readerPreferences.webtoonSidePadding()
|
val webtoonSidePaddingPref = readerPreferences.webtoonSidePadding
|
||||||
|
|
||||||
val navMode by navModePref.collectAsState()
|
val navMode by navModePref.collectAsState()
|
||||||
val dualPageSplit by dualPageSplitPref.collectAsState()
|
val dualPageSplit by dualPageSplitPref.collectAsState()
|
||||||
@@ -371,7 +356,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_viewer_nav),
|
title = stringResource(MR.strings.pref_viewer_nav),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.webtoonNavInverted(),
|
preference = readerPreferences.webtoonNavInverted,
|
||||||
entries = persistentListOf(
|
entries = persistentListOf(
|
||||||
ReaderPreferences.TappingInvertMode.NONE,
|
ReaderPreferences.TappingInvertMode.NONE,
|
||||||
ReaderPreferences.TappingInvertMode.HORIZONTAL,
|
ReaderPreferences.TappingInvertMode.HORIZONTAL,
|
||||||
@@ -389,14 +374,11 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
it.WEBTOON_PADDING_MIN..it.WEBTOON_PADDING_MAX
|
it.WEBTOON_PADDING_MIN..it.WEBTOON_PADDING_MAX
|
||||||
},
|
},
|
||||||
title = stringResource(MR.strings.pref_webtoon_side_padding),
|
title = stringResource(MR.strings.pref_webtoon_side_padding),
|
||||||
subtitle = numberFormat.format(webtoonSidePadding / 100f),
|
valueString = numberFormat.format(webtoonSidePadding / 100f),
|
||||||
onValueChanged = {
|
onValueChanged = { webtoonSidePaddingPref.set(it) },
|
||||||
webtoonSidePaddingPref.set(it)
|
|
||||||
true
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.readerHideThreshold(),
|
preference = readerPreferences.readerHideThreshold,
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
ReaderPreferences.ReaderHideThreshold.HIGHEST to stringResource(MR.strings.pref_highest),
|
ReaderPreferences.ReaderHideThreshold.HIGHEST to stringResource(MR.strings.pref_highest),
|
||||||
ReaderPreferences.ReaderHideThreshold.HIGH to stringResource(MR.strings.pref_high),
|
ReaderPreferences.ReaderHideThreshold.HIGH to stringResource(MR.strings.pref_high),
|
||||||
@@ -406,7 +388,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_hide_threshold),
|
title = stringResource(MR.strings.pref_hide_threshold),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.cropBordersWebtoon(),
|
preference = readerPreferences.cropBordersWebtoon,
|
||||||
title = stringResource(MR.strings.pref_crop_borders),
|
title = stringResource(MR.strings.pref_crop_borders),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
@@ -418,7 +400,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.dualPageInvertWebtoon(),
|
preference = readerPreferences.dualPageInvertWebtoon,
|
||||||
title = stringResource(MR.strings.pref_dual_page_invert),
|
title = stringResource(MR.strings.pref_dual_page_invert),
|
||||||
subtitle = stringResource(MR.strings.pref_dual_page_invert_summary),
|
subtitle = stringResource(MR.strings.pref_dual_page_invert_summary),
|
||||||
enabled = dualPageSplit,
|
enabled = dualPageSplit,
|
||||||
@@ -432,21 +414,21 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.dualPageRotateToFitInvertWebtoon(),
|
preference = readerPreferences.dualPageRotateToFitInvertWebtoon,
|
||||||
title = stringResource(MR.strings.pref_page_rotate_invert),
|
title = stringResource(MR.strings.pref_page_rotate_invert),
|
||||||
enabled = rotateToFit,
|
enabled = rotateToFit,
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.webtoonDoubleTapZoomEnabled(),
|
preference = readerPreferences.webtoonDoubleTapZoomEnabled,
|
||||||
title = stringResource(MR.strings.pref_double_tap_zoom),
|
title = stringResource(MR.strings.pref_double_tap_zoom),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.webtoonDisableZoomOut(),
|
preference = readerPreferences.webtoonDisableZoomOut,
|
||||||
title = stringResource(MR.strings.pref_webtoon_disable_zoom_out),
|
title = stringResource(MR.strings.pref_webtoon_disable_zoom_out),
|
||||||
),
|
),
|
||||||
// SY -->
|
// SY -->
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.pageTransitionsWebtoon(),
|
preference = readerPreferences.pageTransitionsWebtoon,
|
||||||
title = stringResource(MR.strings.pref_page_transitions),
|
title = stringResource(MR.strings.pref_page_transitions),
|
||||||
),
|
),
|
||||||
// SY <--
|
// SY <--
|
||||||
@@ -461,12 +443,12 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.vertical_plus_viewer),
|
title = stringResource(MR.strings.vertical_plus_viewer),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.continuousVerticalTappingByPage(),
|
preference = readerPreferences.continuousVerticalTappingByPage,
|
||||||
title = stringResource(SYMR.strings.tap_scroll_page),
|
title = stringResource(SYMR.strings.tap_scroll_page),
|
||||||
subtitle = stringResource(SYMR.strings.tap_scroll_page_summary),
|
subtitle = stringResource(SYMR.strings.tap_scroll_page_summary),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.cropBordersContinuousVertical(),
|
preference = readerPreferences.cropBordersContinuousVertical,
|
||||||
title = stringResource(MR.strings.pref_crop_borders),
|
title = stringResource(MR.strings.pref_crop_borders),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -476,7 +458,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun getNavigationGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
private fun getNavigationGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
||||||
val readWithVolumeKeysPref = readerPreferences.readWithVolumeKeys()
|
val readWithVolumeKeysPref = readerPreferences.readWithVolumeKeys
|
||||||
val readWithVolumeKeys by readWithVolumeKeysPref.collectAsState()
|
val readWithVolumeKeys by readWithVolumeKeysPref.collectAsState()
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_reader_navigation),
|
title = stringResource(MR.strings.pref_reader_navigation),
|
||||||
@@ -486,7 +468,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_read_with_volume_keys),
|
title = stringResource(MR.strings.pref_read_with_volume_keys),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.readWithVolumeKeysInverted(),
|
preference = readerPreferences.readWithVolumeKeysInverted,
|
||||||
title = stringResource(MR.strings.pref_read_with_volume_keys_inverted),
|
title = stringResource(MR.strings.pref_read_with_volume_keys_inverted),
|
||||||
enabled = readWithVolumeKeys,
|
enabled = readWithVolumeKeys,
|
||||||
),
|
),
|
||||||
@@ -500,11 +482,11 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
title = stringResource(MR.strings.pref_reader_actions),
|
title = stringResource(MR.strings.pref_reader_actions),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.readWithLongTap(),
|
preference = readerPreferences.readWithLongTap,
|
||||||
title = stringResource(MR.strings.pref_read_with_long_tap),
|
title = stringResource(MR.strings.pref_read_with_long_tap),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.folderPerManga(),
|
preference = readerPreferences.folderPerManga,
|
||||||
title = stringResource(MR.strings.pref_create_folder_per_manga),
|
title = stringResource(MR.strings.pref_create_folder_per_manga),
|
||||||
subtitle = stringResource(MR.strings.pref_create_folder_per_manga_summary),
|
subtitle = stringResource(MR.strings.pref_create_folder_per_manga_summary),
|
||||||
),
|
),
|
||||||
@@ -519,7 +501,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
title = stringResource(SYMR.strings.page_downloading),
|
title = stringResource(SYMR.strings.page_downloading),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.preloadSize(),
|
preference = readerPreferences.preloadSize,
|
||||||
title = stringResource(SYMR.strings.reader_preload_amount),
|
title = stringResource(SYMR.strings.reader_preload_amount),
|
||||||
subtitle = stringResource(SYMR.strings.reader_preload_amount_summary),
|
subtitle = stringResource(SYMR.strings.reader_preload_amount_summary),
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
@@ -534,13 +516,13 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.readerThreads(),
|
preference = readerPreferences.readerThreads,
|
||||||
title = stringResource(SYMR.strings.download_threads),
|
title = stringResource(SYMR.strings.download_threads),
|
||||||
subtitle = stringResource(SYMR.strings.download_threads_summary),
|
subtitle = stringResource(SYMR.strings.download_threads_summary),
|
||||||
entries = List(5) { it }.associateWith { it.toString() }.toImmutableMap(),
|
entries = List(5) { it }.associateWith { it.toString() }.toImmutableMap(),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.cacheSize(),
|
preference = readerPreferences.cacheSize,
|
||||||
title = stringResource(SYMR.strings.reader_cache_size),
|
title = stringResource(SYMR.strings.reader_cache_size),
|
||||||
subtitle = stringResource(SYMR.strings.reader_cache_size_summary),
|
subtitle = stringResource(SYMR.strings.reader_cache_size_summary),
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
@@ -563,7 +545,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.aggressivePageLoading(),
|
preference = readerPreferences.aggressivePageLoading,
|
||||||
title = stringResource(SYMR.strings.aggressively_load_pages),
|
title = stringResource(SYMR.strings.aggressively_load_pages),
|
||||||
subtitle = stringResource(SYMR.strings.aggressively_load_pages_summary),
|
subtitle = stringResource(SYMR.strings.aggressively_load_pages_summary),
|
||||||
),
|
),
|
||||||
@@ -573,26 +555,26 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun getForkSettingsGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
private fun getForkSettingsGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
||||||
val pageLayout by readerPreferences.pageLayout().collectAsState()
|
val pageLayout by readerPreferences.pageLayout.collectAsState()
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(SYMR.strings.pref_category_fork),
|
title = stringResource(SYMR.strings.pref_category_fork),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.readerInstantRetry(),
|
preference = readerPreferences.readerInstantRetry,
|
||||||
title = stringResource(SYMR.strings.skip_queue_on_retry),
|
title = stringResource(SYMR.strings.skip_queue_on_retry),
|
||||||
subtitle = stringResource(SYMR.strings.skip_queue_on_retry_summary),
|
subtitle = stringResource(SYMR.strings.skip_queue_on_retry_summary),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.preserveReadingPosition(),
|
preference = readerPreferences.preserveReadingPosition,
|
||||||
title = stringResource(SYMR.strings.preserve_reading_position),
|
title = stringResource(SYMR.strings.preserve_reading_position),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.useAutoWebtoon(),
|
preference = readerPreferences.useAutoWebtoon,
|
||||||
title = stringResource(SYMR.strings.auto_webtoon_mode),
|
title = stringResource(SYMR.strings.auto_webtoon_mode),
|
||||||
subtitle = stringResource(SYMR.strings.auto_webtoon_mode_summary),
|
subtitle = stringResource(SYMR.strings.auto_webtoon_mode_summary),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.MultiSelectListPreference(
|
Preference.PreferenceItem.MultiSelectListPreference(
|
||||||
preference = readerPreferences.readerBottomButtons(),
|
preference = readerPreferences.readerBottomButtons,
|
||||||
title = stringResource(SYMR.strings.reader_bottom_buttons),
|
title = stringResource(SYMR.strings.reader_bottom_buttons),
|
||||||
subtitle = stringResource(SYMR.strings.reader_bottom_buttons_summary),
|
subtitle = stringResource(SYMR.strings.reader_bottom_buttons_summary),
|
||||||
entries = ReaderBottomButton.entries
|
entries = ReaderBottomButton.entries
|
||||||
@@ -600,21 +582,21 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
.toImmutableMap(),
|
.toImmutableMap(),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.pageLayout(),
|
preference = readerPreferences.pageLayout,
|
||||||
title = stringResource(SYMR.strings.page_layout),
|
title = stringResource(SYMR.strings.page_layout),
|
||||||
subtitle = stringResource(SYMR.strings.automatic_can_still_switch),
|
subtitle = stringResource(SYMR.strings.automatic_can_still_switch),
|
||||||
entries = ReaderPreferences.PageLayouts
|
entries = ReaderPreferences.PageLayouts
|
||||||
.mapIndexed { index, it -> index + 1 to stringResource(it) }
|
.mapIndexed { index, it -> index to stringResource(it) }
|
||||||
.toMap()
|
.toMap()
|
||||||
.toImmutableMap(),
|
.toImmutableMap(),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.invertDoublePages(),
|
preference = readerPreferences.invertDoublePages,
|
||||||
title = stringResource(SYMR.strings.invert_double_pages),
|
title = stringResource(SYMR.strings.invert_double_pages),
|
||||||
enabled = pageLayout != PagerConfig.PageLayout.SINGLE_PAGE,
|
enabled = pageLayout != PagerConfig.PageLayout.SINGLE_PAGE,
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.centerMarginType(),
|
preference = readerPreferences.centerMarginType,
|
||||||
title = stringResource(SYMR.strings.center_margin),
|
title = stringResource(SYMR.strings.center_margin),
|
||||||
subtitle = stringResource(SYMR.strings.pref_center_margin_summary),
|
subtitle = stringResource(SYMR.strings.pref_center_margin_summary),
|
||||||
entries = ReaderPreferences.CenterMarginTypes
|
entries = ReaderPreferences.CenterMarginTypes
|
||||||
@@ -623,7 +605,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
.toImmutableMap(),
|
.toImmutableMap(),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.archiveReaderMode(),
|
preference = readerPreferences.archiveReaderMode,
|
||||||
title = stringResource(SYMR.strings.pref_archive_reader_mode),
|
title = stringResource(SYMR.strings.pref_archive_reader_mode),
|
||||||
subtitle = stringResource(SYMR.strings.pref_archive_reader_mode_summary),
|
subtitle = stringResource(SYMR.strings.pref_archive_reader_mode_summary),
|
||||||
entries = ReaderPreferences.archiveModeTypes
|
entries = ReaderPreferences.archiveModeTypes
|
||||||
|
|||||||
+1
-1
@@ -183,7 +183,7 @@ private fun SearchResult(
|
|||||||
emptySequence()
|
emptySequence()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Preference.PreferenceItem<*> -> sequenceOf(null to p)
|
is Preference.PreferenceItem<*, *> -> sequenceOf(null to p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Don't show info preference
|
// Don't show info preference
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user