diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 830df70..938d32b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -14,8 +14,8 @@ android { minSdk = 26 // targetSdk = 28 targetSdk = 34 - versionCode = 55 - versionName = "1.4.0" + versionCode = 56 + versionName = "1.4.1" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { diff --git a/app/src/main/assets/licenses.html b/app/src/main/assets/licenses.html index e24db23..6a79357 100644 --- a/app/src/main/assets/licenses.html +++ b/app/src/main/assets/licenses.html @@ -1553,6 +1553,500 @@

APPENDIX: How to apply the Apache License to your work.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+
+ +

core-splashscreen

+

https://developer.android.com/jetpack/androidx/releases/core#1.1.0-rc01 +

+ +
+

+ Apache License +
+ Version 2.0, January 2004 +
+ http://www.apache.org/licenses/ +

+

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

1. Definitions.

+

+ "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. +

+

+ "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. +

+

+ "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. +

+

+ "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. +

+

+ "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. +

+

+ "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. +

+

+ "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). +

+

+ "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. +

+

+ "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." +

+

+ "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. +

+
+

2. Grant of Copyright License.

+

+ Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. +

+
+
+

3. Grant of Patent License.

+

+ Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. +

+
+
+

4. Redistribution.

+

+ You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: +

+
+ +

+ You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. +

+
+

5. Submission of Contributions.

+

+ Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. +

+
+
+

6. Trademarks.

+

+ This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. +

+
+
+

7. Disclaimer of Warranty.

+

+ Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. +

+
+
+

8. Limitation of Liability.

+

+ In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. +

+
+
+

9. Accepting Warranty or Additional Liability.

+

+ While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. +

+
+

END OF TERMS AND CONDITIONS

+

APPENDIX: How to apply the Apache License to your work.

+

+ To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. +

+
Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+
+
+
+ +

documentfile

+

http://developer.android.com/tools/extras/support-library.html +

+ +
+

+ Apache License +
+ Version 2.0, January 2004 +
+ http://www.apache.org/licenses/ +

+

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

1. Definitions.

+

+ "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. +

+

+ "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. +

+

+ "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. +

+

+ "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. +

+

+ "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. +

+

+ "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. +

+

+ "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). +

+

+ "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. +

+

+ "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." +

+

+ "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. +

+
+

2. Grant of Copyright License.

+

+ Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. +

+
+
+

3. Grant of Patent License.

+

+ Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. +

+
+
+

4. Redistribution.

+

+ You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: +

+
+ +

+ You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. +

+
+

5. Submission of Contributions.

+

+ Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. +

+
+
+

6. Trademarks.

+

+ This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. +

+
+
+

7. Disclaimer of Warranty.

+

+ Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. +

+
+
+

8. Limitation of Liability.

+

+ In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. +

+
+
+

9. Accepting Warranty or Additional Liability.

+

+ While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. +

+
+

END OF TERMS AND CONDITIONS

+

APPENDIX: How to apply the Apache License to your work.

+

+ To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. +

+
Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+
+

kotlinx-coroutines-core-jvm

diff --git a/app/src/main/assets/licenses_dark.html b/app/src/main/assets/licenses_dark.html index 9895df2..80096ef 100644 --- a/app/src/main/assets/licenses_dark.html +++ b/app/src/main/assets/licenses_dark.html @@ -1562,6 +1562,500 @@

APPENDIX: How to apply the Apache License to your work.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+
+ +

core-splashscreen

+

https://developer.android.com/jetpack/androidx/releases/core#1.1.0-rc01 +

+ +
+

+ Apache License +
+ Version 2.0, January 2004 +
+ http://www.apache.org/licenses/ +

+

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

1. Definitions.

+

+ "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. +

+

+ "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. +

+

+ "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. +

+

+ "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. +

+

+ "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. +

+

+ "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. +

+

+ "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). +

+

+ "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. +

+

+ "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." +

+

+ "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. +

+
+

2. Grant of Copyright License.

+

+ Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. +

+
+
+

3. Grant of Patent License.

+

+ Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. +

+
+
+

4. Redistribution.

+

+ You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: +

+
+ +

+ You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. +

+
+

5. Submission of Contributions.

+

+ Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. +

+
+
+

6. Trademarks.

+

+ This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. +

+
+
+

7. Disclaimer of Warranty.

+

+ Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. +

+
+
+

8. Limitation of Liability.

+

+ In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. +

+
+
+

9. Accepting Warranty or Additional Liability.

+

+ While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. +

+
+

END OF TERMS AND CONDITIONS

+

APPENDIX: How to apply the Apache License to your work.

+

+ To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. +

+
Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+
+
+
+ +

documentfile

+

http://developer.android.com/tools/extras/support-library.html +

+ +
+

+ Apache License +
+ Version 2.0, January 2004 +
+ http://www.apache.org/licenses/ +

+

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

1. Definitions.

+

+ "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. +

+

+ "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. +

+

+ "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. +

+

+ "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. +

+

+ "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. +

+

+ "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. +

+

+ "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). +

+

+ "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. +

+

+ "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." +

+

+ "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. +

+
+

2. Grant of Copyright License.

+

+ Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. +

+
+
+

3. Grant of Patent License.

+

+ Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. +

+
+
+

4. Redistribution.

+

+ You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: +

+
+ +

+ You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. +

+
+

5. Submission of Contributions.

+

+ Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. +

+
+
+

6. Trademarks.

+

+ This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. +

+
+
+

7. Disclaimer of Warranty.

+

+ Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. +

+
+
+

8. Limitation of Liability.

+

+ In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. +

+
+
+

9. Accepting Warranty or Additional Liability.

+

+ While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. +

+
+

END OF TERMS AND CONDITIONS

+

APPENDIX: How to apply the Apache License to your work.

+

+ To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. +

+
Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+
+

kotlinx-coroutines-core-jvm

diff --git a/app/src/main/java/com/hwinzniej/musichelper/MainActivity.kt b/app/src/main/java/com/hwinzniej/musichelper/MainActivity.kt index 03b93f9..d29ac21 100644 --- a/app/src/main/java/com/hwinzniej/musichelper/MainActivity.kt +++ b/app/src/main/java/com/hwinzniej/musichelper/MainActivity.kt @@ -38,11 +38,13 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.MutableState import androidx.compose.runtime.SideEffect import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableFloatStateOf import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -253,7 +255,7 @@ class MainActivity : ComponentActivity() { dynamicDarkColorScheme(this) ) else darkSaltColors() - 2 -> + 2 -> { if (isSystemInDarkTheme()) if (enableDynamicColor.value) saltColorsByColorScheme( dynamicDarkColorScheme(this) @@ -262,6 +264,7 @@ class MainActivity : ComponentActivity() { if (enableDynamicColor.value) saltColorsByColorScheme( dynamicLightColorScheme(this) ) else lightSaltColors() + } else -> if (enableDynamicColor.value) saltColorsByColorScheme( dynamicLightColorScheme(this) @@ -357,7 +360,6 @@ private fun Pages( listOf("0", "1", "2", "3", "4") else listOf("0", "1", "2", "3") - val pageState = rememberPagerState(pageCount = { pages.size }) val coroutineScope = rememberCoroutineScope() val settingsPages = listOf("0", "1") val settingsPageState = rememberPagerState(pageCount = { settingsPages.size }) @@ -373,8 +375,12 @@ private fun Pages( val arranger = remember { mutableStateOf(true) } val slow = remember { mutableStateOf(false) } val sortMethod = remember { mutableIntStateOf(0) } + var loadUI by remember { mutableStateOf(false) } mainPage.dataStore.data.collectAsState(initial = null).value?.let { preferences -> + settingsPage.initialPage.intValue = + preferences[DataStoreConstants.INITIAL_PAGE] ?: 0 + loadUI = true mainPage.enableDynamicColor.value = preferences[DataStoreConstants.KEY_ENABLE_DYNAMIC_COLOR] ?: false mainPage.selectedThemeMode.intValue = preferences[DataStoreConstants.KEY_THEME_MODE] ?: 2 @@ -411,6 +417,13 @@ private fun Pages( preferences[DataStoreConstants.LUNA_DEVICE_ID] ?: "" convertPage.lunaCookie.value = preferences[DataStoreConstants.LUNA_COOKIE] ?: "" + convertPage.convertMode.intValue = + preferences[DataStoreConstants.CONVERT_MODE] ?: 1 + convertPage.selectedSourceLocalApp.intValue = + preferences[DataStoreConstants.SELECTED_SOURCE_APP] ?: 2 + convertPage.selectedTargetApp.intValue = + preferences[DataStoreConstants.SELECTED_TARGET_APP] ?: 0 + coroutineScope.launch(Dispatchers.Default) { delay(248L) mainPage.isDataLoaded.value = true @@ -431,7 +444,6 @@ private fun Pages( ) } - if (showNewVersionAvailableDialog.value) { YesNoDialog( onDismiss = { showNewVersionAvailableDialog.value = false }, @@ -531,7 +543,7 @@ private fun Pages( } } - LaunchedEffect(key1 = checkUpdate.value) { // TODO targetSdk版本不同,更新包下载地址不同 + LaunchedEffect(key1 = checkUpdate.value) { if (checkUpdate.value) { coroutineScope.launch(Dispatchers.IO) { checkUpdate.value = false @@ -595,91 +607,96 @@ private fun Pages( } } - Box( - modifier = Modifier - .fillMaxSize() - .systemBarsPadding() - .background(SaltTheme.colors.background) - ) { - HorizontalPager( - state = pageState, + if (loadUI) { + val pageState = rememberPagerState( + initialPage = settingsPage.initialPage.intValue, + pageCount = { pages.size } + ) + Box( modifier = Modifier .fillMaxSize() - .padding(bottom = 56.dp), - beyondBoundsPageCount = 2 - ) { page -> - when (page) { - 0 -> { - ScanPageUi( - scanPage = scanPage, - scanResult = scanPage.scanResult, - showLoadingProgressBar = scanPage.showLoadingProgressBar, - progressPercent = scanPage.progressPercent, - showConflictDialog = scanPage.showConflictDialog, - exportResultFile = scanPage.exportResultFile, - selectedExportFormat = scanPage.selectedExportFormat, - enableHaptic = mainPage.enableHaptic, - hapticStrength = mainPage.hapticStrength, - ) - } + .systemBarsPadding() + .background(SaltTheme.colors.background) + ) { + HorizontalPager( + state = pageState, + modifier = Modifier + .fillMaxSize() + .padding(bottom = 56.dp), + beyondBoundsPageCount = 2 + ) { page -> + when (page) { + 0 -> { + ScanPageUi( + scanPage = scanPage, + scanResult = scanPage.scanResult, + showLoadingProgressBar = scanPage.showLoadingProgressBar, + progressPercent = scanPage.progressPercent, + showConflictDialog = scanPage.showConflictDialog, + exportResultFile = scanPage.exportResultFile, + selectedExportFormat = scanPage.selectedExportFormat, + enableHaptic = mainPage.enableHaptic, + hapticStrength = mainPage.hapticStrength, + ) + } - 1 -> { - ConvertPageUi( - convertPage = convertPage, - selectedSourceApp = convertPage.selectedSourceApp, - databaseFileName = convertPage.databaseFileName, - useCustomResultFile = convertPage.useCustomResultFile, - customResultFileName = convertPage.customResultFileName, - showLoadingProgressBar = convertPage.showLoadingProgressBar, - showErrorDialog = convertPage.showErrorDialog, - errorDialogTitle = convertPage.errorDialogTitle, - errorDialogContent = convertPage.errorDialogContent, - playlistName = convertPage.playlistName, - playlistEnabled = convertPage.playlistEnabled, - playlistSum = convertPage.playlistSum, - currentPage = convertPage.currentPage, - selectedMatchingMode = convertPage.selectedMatchingMode, - enableBracketRemoval = convertPage.enableBracketRemoval, - enableArtistNameMatch = convertPage.enableArtistNameMatch, - enableAlbumNameMatch = convertPage.enableAlbumNameMatch, - similarity = convertPage.similarity, - convertResult = convertPage.convertResult, - inputSearchWords = convertPage.inputSearchWords, - searchResult = convertPage.searchResult, - showDialogProgressBar = convertPage.showDialogProgressBar, - showSaveDialog = convertPage.showSaveDialog, - mainActivityPageState = pageState, - enableHaptic = mainPage.enableHaptic, - useRootAccess = convertPage.useRootAccess, - databaseFilePath = convertPage.databaseFilePath, - showSelectSourceDialog = convertPage.showSelectSourceDialog, - multiSource = convertPage.multiSource, - showNumberProgressBar = convertPage.showNumberProgressBar, - selectedMethod = convertPage.selectedMethod, - selectedLoginMethod = convertPage.selectedLoginMethod, - showLoginDialog = convertPage.showLoginDialog, - dataStore = mainPage.dataStore, - showSongNumMismatchDialog = convertPage.showSongNumMismatchDialog, - hapticStrength = mainPage.hapticStrength, - ) - } + 1 -> { + ConvertPageUi( + convertPage = convertPage, + selectedSourceApp = convertPage.selectedSourceApp, + databaseFileName = convertPage.databaseFileName, + useCustomResultFile = convertPage.useCustomResultFile, + customResultFileName = convertPage.customResultFileName, + showLoadingProgressBar = convertPage.showLoadingProgressBar, + showErrorDialog = convertPage.showErrorDialog, + errorDialogTitle = convertPage.errorDialogTitle, + errorDialogContent = convertPage.errorDialogContent, + playlistName = convertPage.playlistName, + playlistEnabled = convertPage.playlistEnabled, + playlistSum = convertPage.playlistSum, + currentPage = convertPage.currentPage, + selectedMatchingMode = convertPage.selectedMatchingMode, + enableBracketRemoval = convertPage.enableBracketRemoval, + enableArtistNameMatch = convertPage.enableArtistNameMatch, + enableAlbumNameMatch = convertPage.enableAlbumNameMatch, + similarity = convertPage.similarity, + convertResult = convertPage.convertResult, + inputSearchWords = convertPage.inputSearchWords, + searchResult = convertPage.searchResult, + showDialogProgressBar = convertPage.showDialogProgressBar, + showSaveDialog = convertPage.showSaveDialog, + mainActivityPageState = pageState, + enableHaptic = mainPage.enableHaptic, + useRootAccess = convertPage.useRootAccess, + databaseFilePath = convertPage.databaseFilePath, + showSelectSourceDialog = convertPage.showSelectSourceDialog, + multiSource = convertPage.multiSource, + showNumberProgressBar = convertPage.showNumberProgressBar, + selectedMethod = convertPage.selectedMethod, + selectedLoginMethod = convertPage.selectedLoginMethod, + showLoginDialog = convertPage.showLoginDialog, + dataStore = mainPage.dataStore, + showSongNumMismatchDialog = convertPage.showSongNumMismatchDialog, + hapticStrength = mainPage.hapticStrength, + ) + } - 2 -> { - TagPageUi( - tagPage = tagPage, - enableHaptic = mainPage.enableHaptic, - hapticStrength = mainPage.hapticStrength, - scanPage = scanPage, - pageState = pageState, - overwrite = overwrite, - lyricist = lyricist, - composer = composer, - arranger = arranger, - sortMethod = sortMethod, - dataStore = mainPage.dataStore, - slow = slow - ) - } + 2 -> { + TagPageUi( + tagPage = tagPage, + enableHaptic = mainPage.enableHaptic, + hapticStrength = mainPage.hapticStrength, + scanPage = scanPage, + pageState = pageState, + overwrite = overwrite, + lyricist = lyricist, + composer = composer, + arranger = arranger, + sortMethod = sortMethod, + dataStore = mainPage.dataStore, + slow = slow + ) + } // 2 -> { // ProcessPageUi( @@ -699,168 +716,168 @@ private fun Pages( // ) // } - 3 -> { - if (targetSdkVersion <= 28) { - UnlockPageUi( - unlockPage = unlockPage, - enableHaptic = mainPage.enableHaptic, - settingsPage = settingsPage, - hapticStrength = mainPage.hapticStrength, - ) - } else { - HorizontalPager( - state = settingsPageState, - modifier = Modifier - .fillMaxSize(), - userScrollEnabled = false, - beyondBoundsPageCount = 1 - ) { settingPage -> - when (settingPage) { - 0 -> { - SettingsPageUi( - settingsPage = settingsPage, - enableDynamicColor = mainPage.enableDynamicColor, - selectedThemeMode = mainPage.selectedThemeMode, - selectedLanguage = mainPage.language, - useRootAccess = convertPage.useRootAccess, - enableAutoCheckUpdate = settingsPage.enableAutoCheckUpdate, - settingsPageState = settingsPageState, - enableHaptic = mainPage.enableHaptic, - dataStore = mainPage.dataStore, - encryptServer = settingsPage.encryptServer, - hapticStrength = mainPage.hapticStrength, - ) - } - - 1 -> { - AboutPageUi( - settingsPageState = settingsPageState, - showNewVersionAvailableDialog = showNewVersionAvailableDialog, - latestVersion = latestVersion, - latestDescription = latestDescription, - latestDownloadLink = latestDownloadLink, - enableHaptic = mainPage.enableHaptic, - language = mainPage.language, - updateFileSize = mainPage.updateFileSize, - hapticStrength = mainPage.hapticStrength, - ) + 3 -> { + if (targetSdkVersion <= 28) { + UnlockPageUi( + unlockPage = unlockPage, + enableHaptic = mainPage.enableHaptic, + settingsPage = settingsPage, + hapticStrength = mainPage.hapticStrength, + ) + } else { + HorizontalPager( + state = settingsPageState, + modifier = Modifier + .fillMaxSize(), + userScrollEnabled = false, + beyondBoundsPageCount = 1 + ) { settingPage -> + when (settingPage) { + 0 -> { + SettingsPageUi( + settingsPage = settingsPage, + enableDynamicColor = mainPage.enableDynamicColor, + selectedThemeMode = mainPage.selectedThemeMode, + selectedLanguage = mainPage.language, + useRootAccess = convertPage.useRootAccess, + enableAutoCheckUpdate = settingsPage.enableAutoCheckUpdate, + settingsPageState = settingsPageState, + enableHaptic = mainPage.enableHaptic, + dataStore = mainPage.dataStore, + encryptServer = settingsPage.encryptServer, + hapticStrength = mainPage.hapticStrength, + ) + } + + 1 -> { + AboutPageUi( + settingsPageState = settingsPageState, + showNewVersionAvailableDialog = showNewVersionAvailableDialog, + latestVersion = latestVersion, + latestDescription = latestDescription, + latestDownloadLink = latestDownloadLink, + enableHaptic = mainPage.enableHaptic, + language = mainPage.language, + updateFileSize = mainPage.updateFileSize, + hapticStrength = mainPage.hapticStrength, + ) + } } } } } - } - - 4 -> { - if (targetSdkVersion <= 28) { - HorizontalPager( - state = settingsPageState, - modifier = Modifier - .fillMaxSize(), - userScrollEnabled = false, - beyondBoundsPageCount = 0 //保证切换语言后,页面自动应用新语言 - ) { settingPage -> - when (settingPage) { - 0 -> { - SettingsPageUi( - settingsPage = settingsPage, - enableDynamicColor = mainPage.enableDynamicColor, - selectedThemeMode = mainPage.selectedThemeMode, - selectedLanguage = mainPage.language, - useRootAccess = convertPage.useRootAccess, - enableAutoCheckUpdate = settingsPage.enableAutoCheckUpdate, - settingsPageState = settingsPageState, - enableHaptic = mainPage.enableHaptic, - dataStore = mainPage.dataStore, - encryptServer = settingsPage.encryptServer, - hapticStrength = mainPage.hapticStrength, - ) - } - 1 -> { - AboutPageUi( - settingsPageState = settingsPageState, - showNewVersionAvailableDialog = showNewVersionAvailableDialog, - latestVersion = latestVersion, - latestDescription = latestDescription, - latestDownloadLink = latestDownloadLink, - enableHaptic = mainPage.enableHaptic, - language = mainPage.language, - updateFileSize = mainPage.updateFileSize, - hapticStrength = mainPage.hapticStrength, - ) + 4 -> { + if (targetSdkVersion <= 28) { + HorizontalPager( + state = settingsPageState, + modifier = Modifier + .fillMaxSize(), + userScrollEnabled = false, + beyondBoundsPageCount = 0 //保证切换语言后,页面自动应用新语言 + ) { settingPage -> + when (settingPage) { + 0 -> { + SettingsPageUi( + settingsPage = settingsPage, + enableDynamicColor = mainPage.enableDynamicColor, + selectedThemeMode = mainPage.selectedThemeMode, + selectedLanguage = mainPage.language, + useRootAccess = convertPage.useRootAccess, + enableAutoCheckUpdate = settingsPage.enableAutoCheckUpdate, + settingsPageState = settingsPageState, + enableHaptic = mainPage.enableHaptic, + dataStore = mainPage.dataStore, + encryptServer = settingsPage.encryptServer, + hapticStrength = mainPage.hapticStrength, + ) + } + + 1 -> { + AboutPageUi( + settingsPageState = settingsPageState, + showNewVersionAvailableDialog = showNewVersionAvailableDialog, + latestVersion = latestVersion, + latestDescription = latestDescription, + latestDownloadLink = latestDownloadLink, + enableHaptic = mainPage.enableHaptic, + language = mainPage.language, + updateFileSize = mainPage.updateFileSize, + hapticStrength = mainPage.hapticStrength, + ) + } } } } } } - } - } + } - BottomBar(modifier = Modifier.align(Alignment.BottomCenter)) { - BottomBarItem( - state = pageState.currentPage == 0, - onClick = { - MyVibrationEffect( - context, - mainPage.enableHaptic.value, - mainPage.hapticStrength.intValue - ).click() - coroutineScope.launch { - settingsPageState.scrollToPage(0) - } - coroutineScope.launch { - pageState.animateScrollToPage( - 0, - animationSpec = spring(2f) - ) - } - }, - painter = painterResource(id = R.drawable.scan), - text = stringResource(R.string.scan_function_name) - ) - BottomBarItem( - state = pageState.currentPage == 1, - onClick = { - MyVibrationEffect( - context, - mainPage.enableHaptic.value, - mainPage.hapticStrength.intValue - ).click() - coroutineScope.launch { - settingsPageState.scrollToPage(0) - } - coroutineScope.launch { - pageState.animateScrollToPage( - 1, - animationSpec = spring(2f) - ) - } - }, - painter = painterResource(id = R.drawable.convert), - text = stringResource(R.string.convert_function_name) - ) - BottomBarItem( - state = pageState.currentPage == 2, - onClick = { - MyVibrationEffect( - context, - mainPage.enableHaptic.value, - mainPage.hapticStrength.intValue - ).click() - coroutineScope.launch { - settingsPageState.scrollToPage(0) - } - coroutineScope.launch { - pageState.animateScrollToPage( - 2, - animationSpec = spring(2f) - ) - } - }, - painter = painterResource(id = R.drawable.tag), - text = stringResource(R.string.tag_function_name) - ) + BottomBar(modifier = Modifier.align(Alignment.BottomCenter)) { + BottomBarItem( + state = pageState.currentPage == 0, + onClick = { + MyVibrationEffect( + context, + mainPage.enableHaptic.value, + mainPage.hapticStrength.intValue + ).click() + coroutineScope.launch { + settingsPageState.scrollToPage(0) + } + coroutineScope.launch { + pageState.animateScrollToPage( + 0, + animationSpec = spring(2f) + ) + } + }, + painter = painterResource(id = R.drawable.scan), + text = stringResource(R.string.scan_function_name) + ) + BottomBarItem( + state = pageState.currentPage == 1, + onClick = { + MyVibrationEffect( + context, + mainPage.enableHaptic.value, + mainPage.hapticStrength.intValue + ).click() + coroutineScope.launch { + settingsPageState.scrollToPage(0) + } + coroutineScope.launch { + pageState.animateScrollToPage( + 1, + animationSpec = spring(2f) + ) + } + }, + painter = painterResource(id = R.drawable.convert), + text = stringResource(R.string.convert_function_name) + ) + BottomBarItem( + state = pageState.currentPage == 2, + onClick = { + MyVibrationEffect( + context, + mainPage.enableHaptic.value, + mainPage.hapticStrength.intValue + ).click() + coroutineScope.launch { + settingsPageState.scrollToPage(0) + } + coroutineScope.launch { + pageState.animateScrollToPage( + 2, + animationSpec = spring(2f) + ) + } + }, + painter = painterResource(id = R.drawable.tag), + text = stringResource(R.string.tag_function_name) + ) // BottomBarItem( // state = pageState.currentPage == 2, // onClick = { @@ -878,9 +895,34 @@ private fun Pages( // painter = painterResource(id = R.drawable.ic_launcher_foreground), // text = stringResource(R.string.process_function_name) // ) - if (targetSdkVersion <= 28) { + if (targetSdkVersion <= 28) { + BottomBarItem( + state = pageState.currentPage == 3, + onClick = { + MyVibrationEffect( + context, + mainPage.enableHaptic.value, + mainPage.hapticStrength.intValue + ).click() + coroutineScope.launch { + settingsPageState.scrollToPage(0) + } + coroutineScope.launch { + pageState.animateScrollToPage( + 3, + animationSpec = spring(2f) + ) + } + }, + painter = painterResource(id = R.drawable.um), + text = stringResource(R.string.unlock_function_name) + ) + } BottomBarItem( - state = pageState.currentPage == 3, + state = if (targetSdkVersion <= 28) + pageState.currentPage == 4 + else + pageState.currentPage == 3, onClick = { MyVibrationEffect( context, @@ -888,49 +930,25 @@ private fun Pages( mainPage.hapticStrength.intValue ).click() coroutineScope.launch { - settingsPageState.scrollToPage(0) + settingsPageState.animateScrollToPage( + 0, + animationSpec = spring(2f) + ) } coroutineScope.launch { pageState.animateScrollToPage( - 3, + if (targetSdkVersion <= 28) + 4 + else + 3, animationSpec = spring(2f) ) } }, - painter = painterResource(id = R.drawable.unlock), - text = stringResource(R.string.unlock_function_name) + painter = painterResource(id = R.drawable.settings), + text = stringResource(R.string.settings_function_name) ) } - BottomBarItem( - state = if (targetSdkVersion <= 28) - pageState.currentPage == 4 - else - pageState.currentPage == 3, - onClick = { - MyVibrationEffect( - context, - mainPage.enableHaptic.value, - mainPage.hapticStrength.intValue - ).click() - coroutineScope.launch { - settingsPageState.animateScrollToPage( - 0, - animationSpec = spring(2f) - ) - } - coroutineScope.launch { - pageState.animateScrollToPage( - if (targetSdkVersion <= 28) - 4 - else - 3, - animationSpec = spring(2f) - ) - } - }, - painter = painterResource(id = R.drawable.settings), - text = stringResource(R.string.settings_function_name) - ) } } } \ No newline at end of file diff --git a/app/src/main/java/com/hwinzniej/musichelper/activity/ConvertPage.kt b/app/src/main/java/com/hwinzniej/musichelper/activity/ConvertPage.kt index 0f98f42..d235d84 100644 --- a/app/src/main/java/com/hwinzniej/musichelper/activity/ConvertPage.kt +++ b/app/src/main/java/com/hwinzniej/musichelper/activity/ConvertPage.kt @@ -119,6 +119,9 @@ class ConvertPage( var lunaCookie = mutableStateOf("") var showLunaVerifyDialog = mutableStateOf(false) var lunaVerifyRelated = mutableStateMapOf() + val convertMode = mutableIntStateOf(1) + val selectedSourceLocalApp = mutableIntStateOf(2) + val selectedTargetApp = mutableIntStateOf(0) /** * 请求存储权限 @@ -224,11 +227,11 @@ class ConvertPage( } } - fun selectPlaylistFile(selectedSourceLocalApp: Int) { + fun selectPlaylistFile() { try { openPlaylistFileLauncher.launch( arrayOf( - when (selectedSourceLocalApp) { + when (selectedSourceLocalApp.intValue) { 0 -> "text/plain" 1 -> "audio/x-mpegurl" 2 -> "audio/x-mpegurl" @@ -501,13 +504,13 @@ class ConvertPage( Tools().execShellCmd( "find '/data/data/${appExists.split(":")[1]}/cache/NetCacheLoader' -type f -exec cp {} '${ tempPath - }/lunaJsonDir' \\; && chmod -R 777 '${tempPath}/lunaJsonDir'" + }/lunaJsonDir' \\; && chmod -R +r '${tempPath}/lunaJsonDir'" ) } else { Tools().execShellCmd( "cp -f '/data/data/${appExists.split(":")[1]}/databases/${ sourceApp.databaseName - }' '${dir.absolutePath}/${sourceApp.sourceEng}_temp.db' && chmod 777 '${dir.absolutePath}/${sourceApp.sourceEng}_temp.db'" + }' '${dir.absolutePath}/${sourceApp.sourceEng}_temp.db' && chmod +r '${dir.absolutePath}/${sourceApp.sourceEng}_temp.db'" ) } @@ -2918,14 +2921,17 @@ class ConvertPage( } } - fun launchLocalPlayer(targetApp: Int) { + fun launchLocalPlayer() { val targetAppList = listOf( arrayOf("com.salt.music", "com.salt.music.ui.MainActivity"), arrayOf("remix.myplayer", "remix.myplayer.ui.activity.MainActivity"), arrayOf("com.maxmpz.audioplayer", "com.maxmpz.audioplayer.MainActivity"), ) val intent = Intent(Intent.ACTION_MAIN).apply { - setClassName(targetAppList[targetApp][0], targetAppList[targetApp][1]) + setClassName( + targetAppList[selectedTargetApp.intValue][0], + targetAppList[selectedTargetApp.intValue][1] + ) addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) } try { @@ -2934,7 +2940,7 @@ class ConvertPage( Toast.makeText( context, context.getString(R.string.other_app_not_installed).replace( - "#", when (targetApp) { + "#", when (selectedTargetApp.intValue) { 0 -> "Salt Player" 1 -> "APlayer" 2 -> "Poweramp" @@ -3229,10 +3235,7 @@ class ConvertPage( return result } - fun convertLocalPlaylist( - sourceApp: Int, - targetApp: Int, - ): String { + fun convertLocalPlaylist(): String { val targetFile = File( "${Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)}/${ context.getString( @@ -3247,7 +3250,7 @@ class ConvertPage( sourcePlaylistFileName.value.lastIndexOf(".") ) }.${ - when (targetApp) { + when (selectedTargetApp.intValue) { 0 -> "txt" 1 -> "m3u" 2 -> "m3u8" @@ -3260,7 +3263,7 @@ class ConvertPage( if (targetFile.parentFile?.exists() == false) targetFile.parentFile?.mkdirs() val sourceFile = File(sourcePlaylistFilePath) - when (sourceApp) { + when (selectedSourceApp.intValue) { 0 -> { //来源:Salt Player sourceFile.copyTo(targetFile, true) return targetFile.absolutePath.replace("/storage/emulated/0/", "") @@ -3272,10 +3275,11 @@ class ConvertPage( } 2 -> { //来源:Poweramp - val extRegex = "#.*((\\r\\n)|\\r|\\n)".toRegex() var powerampPlaylist = sourceFile.readText() - powerampPlaylist = extRegex.replace(powerampPlaylist, "") - powerampPlaylist = powerampPlaylist.replace("primary/", "/storage/emulated/0/") + powerampPlaylist = powerampPlaylist + .replace("#.*((\\r\\n)|\\r|\\n)".toRegex(), "") + .replace("(\\r\\n)|\\r".toRegex(), "\n") + .replace("primary/", "/storage/emulated/0/") val fileWriter = FileWriter(targetFile, true) fileWriter.write(powerampPlaylist) fileWriter.close() diff --git a/app/src/main/java/com/hwinzniej/musichelper/activity/SettingsPage.kt b/app/src/main/java/com/hwinzniej/musichelper/activity/SettingsPage.kt index a58ce3b..900977d 100644 --- a/app/src/main/java/com/hwinzniej/musichelper/activity/SettingsPage.kt +++ b/app/src/main/java/com/hwinzniej/musichelper/activity/SettingsPage.kt @@ -4,6 +4,7 @@ import android.content.Context import android.net.Uri import android.widget.Toast import androidx.activity.result.ActivityResultLauncher +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateMapOf import androidx.compose.runtime.mutableStateOf import androidx.datastore.core.DataStore @@ -27,14 +28,15 @@ class SettingsPage( val openUmExecutableFileLauncher: ActivityResultLauncher>, val dataStore: DataStore, ) { - var enableAutoCheckUpdate = mutableStateOf(true) - var encryptServer = mutableStateOf("") - var serverPing = mutableStateMapOf( + val enableAutoCheckUpdate = mutableStateOf(true) + val encryptServer = mutableStateOf("") + val serverPing = mutableStateMapOf( 0 to context.getString(R.string.pinging), 1 to context.getString(R.string.pinging), 2 to context.getString(R.string.pinging) ) - var showDialogProgressBar = mutableStateOf(false) + val showDialogProgressBar = mutableStateOf(false) + val initialPage = mutableIntStateOf(0) fun checkServerPing() { lifecycleOwner.lifecycleScope.launch(Dispatchers.IO) { diff --git a/app/src/main/java/com/hwinzniej/musichelper/data/DataStoreConstants.kt b/app/src/main/java/com/hwinzniej/musichelper/data/DataStoreConstants.kt index a3dfdc3..2af9892 100644 --- a/app/src/main/java/com/hwinzniej/musichelper/data/DataStoreConstants.kt +++ b/app/src/main/java/com/hwinzniej/musichelper/data/DataStoreConstants.kt @@ -32,4 +32,8 @@ object DataStoreConstants { val LUNA_DEVICE_ID = stringPreferencesKey("luna_device_id") val LUNA_INSTALL_ID = stringPreferencesKey("luna_install_id") val LUNA_COOKIE = stringPreferencesKey("luna_cookie") + val CONVERT_MODE = intPreferencesKey("convert_mode") + val SELECTED_TARGET_APP = intPreferencesKey("selected_target_app") + val SELECTED_SOURCE_APP = intPreferencesKey("selected_source_app") + val INITIAL_PAGE = intPreferencesKey("initial_page") } \ No newline at end of file diff --git a/app/src/main/java/com/hwinzniej/musichelper/ui/AboutPageUi.kt b/app/src/main/java/com/hwinzniej/musichelper/ui/AboutPageUi.kt index 4ec0200..258a9ad 100644 --- a/app/src/main/java/com/hwinzniej/musichelper/ui/AboutPageUi.kt +++ b/app/src/main/java/com/hwinzniej/musichelper/ui/AboutPageUi.kt @@ -100,6 +100,14 @@ fun AboutPageUi( BackHandler(enabled = settingsPageState.currentPage == 1) { + if (showLoadingProgressBar) { + Toast.makeText( + context, + context.getString(R.string.wait_operate_end), + Toast.LENGTH_SHORT + ).show() + return@BackHandler + } coroutineScope.launch { settingsPageState.animateScrollToPage( 0, animationSpec = spring(2f) @@ -384,7 +392,7 @@ fun AboutPageUi( Item( onClick = { yesDialogCustomContent = { - val currentTheme = SaltTheme.colors.text.red + val isDarkTheme = SaltTheme.colors.text.red Column( modifier = Modifier .heightIn( @@ -393,20 +401,13 @@ fun AboutPageUi( ) ) { AndroidView(factory = { WebView(context) }) { webView -> - val licensesHtml = if (currentTheme < 0.5f) { - context.assets.open("licenses.html") - .use { inputStream -> - inputStream.bufferedReader().use { - it.readText() - } - } - } else { - context.assets.open("licenses_dark.html") - .use { inputStream -> - inputStream.bufferedReader().use { - it.readText() - } - } + val licensesHtml = context.assets.open( + if (isDarkTheme < 0.5f) "licenses.html" + else "licenses_dark.html" + ).use { inputStream -> + inputStream.bufferedReader().use { + it.readText() + } } webView.setBackgroundColor(0) webView.settings.javaScriptEnabled = false diff --git a/app/src/main/java/com/hwinzniej/musichelper/ui/ConvertPageUi.kt b/app/src/main/java/com/hwinzniej/musichelper/ui/ConvertPageUi.kt index 3273156..efe1cdb 100644 --- a/app/src/main/java/com/hwinzniej/musichelper/ui/ConvertPageUi.kt +++ b/app/src/main/java/com/hwinzniej/musichelper/ui/ConvertPageUi.kt @@ -166,8 +166,6 @@ fun ConvertPageUi( var selectedFilterIndex by remember { mutableIntStateOf(0) } var showOriginalSonglist by remember { mutableIntStateOf(1) } val originalSonglistPopupMenuState = rememberPopupState() - var selectedTargetApp by remember { mutableIntStateOf(0) } - var selectedSourceLocalApp by remember { mutableIntStateOf(2) } val targetAppPopupMenuState = rememberPopupState() val sourceLocalAppPopupMenuState = rememberPopupState() var selectedMultiSourceApp by remember { mutableIntStateOf(-1) } @@ -178,7 +176,6 @@ fun ConvertPageUi( var kugouCurrentIp by remember { mutableStateOf("") } val kugouUserRelated = remember { mutableStateMapOf() } val convertModePopupMenuState = rememberPopupState() - val selectedConvertMode = remember { mutableIntStateOf(1) } fun init(delay: Long = 0L) { coroutine.launch { @@ -202,9 +199,7 @@ fun ConvertPageUi( selectedSongIndex = -1 selectedSearchResult = -1 showOriginalSonglist = 1 - selectedTargetApp = 0 selectedMultiSourceApp = -1 - selectedSourceLocalApp = 2 convertPage.sourcePlaylistFileName.value = "" } } @@ -607,7 +602,7 @@ fun ConvertPageUi( saveCautionSongs, saveManualSongs, "${playlistName[playlistEnabled.indexOfFirst { it == 1 }]}${ - when (selectedTargetApp) { + when (convertPage.selectedTargetApp.intValue) { 0 -> ".txt" 1 -> ".m3u" 2 -> ".m3u8" @@ -1755,7 +1750,7 @@ fun ConvertPageUi( state = convertModePopupMenuState, text = stringResource(R.string.choose_convert_mode), sub = null, - selectedItem = when (selectedConvertMode.intValue) { + selectedItem = when (convertPage.convertMode.intValue) { 1 -> stringResource(R.string.online_to_local) 2 -> stringResource(R.string.local_to_local) else -> "" @@ -1770,11 +1765,15 @@ fun ConvertPageUi( enableHaptic.value, hapticStrength.intValue ).click() - selectedConvertMode.intValue = 1 + coroutine.launch { + dataStore.edit { settings -> + settings[DataStoreConstants.CONVERT_MODE] = 1 + } + } convertModePopupMenuState.dismiss() init() }, - selected = selectedConvertMode.intValue == 1, + selected = convertPage.convertMode.intValue == 1, text = stringResource(R.string.online_to_local), ) PopupMenuItem( @@ -1784,17 +1783,21 @@ fun ConvertPageUi( enableHaptic.value, hapticStrength.intValue ).click() - selectedConvertMode.intValue = 2 + coroutine.launch { + dataStore.edit { settings -> + settings[DataStoreConstants.CONVERT_MODE] = 2 + } + } convertModePopupMenuState.dismiss() init() }, - selected = selectedConvertMode.intValue == 2, + selected = convertPage.convertMode.intValue == 2, text = stringResource(R.string.local_to_local), ) } } AnimatedContent( - targetState = selectedConvertMode.intValue, + targetState = convertPage.convertMode.intValue, label = "", transitionSpec = { fadeIn() togetherWith fadeOut() @@ -2036,7 +2039,8 @@ fun ConvertPageUi( ) { ItemValue( text = stringResource(R.string.you_have_selected), - rightSub = databaseFileName.value + rightSub = databaseFileName.value, + rightSubWeight = 2f ) } } @@ -2074,7 +2078,8 @@ fun ConvertPageUi( ) { ItemValue( text = stringResource(R.string.you_have_selected), - rightSub = customResultFileName.value + rightSub = customResultFileName.value, + rightSubWeight = 2f ) } } @@ -2087,7 +2092,7 @@ fun ConvertPageUi( ItemPopup( state = sourceLocalAppPopupMenuState, text = stringResource(R.string.source_music_player), - selectedItem = when (selectedSourceLocalApp) { + selectedItem = when (convertPage.selectedSourceLocalApp.intValue) { 0 -> "Salt Player" 1 -> "APlayer" 2 -> "Poweramp" @@ -2102,10 +2107,15 @@ fun ConvertPageUi( enableHaptic.value, hapticStrength.intValue ).click() - selectedSourceLocalApp = 0 + coroutine.launch { + dataStore.edit { settings -> + settings[DataStoreConstants.SELECTED_SOURCE_APP] = + 0 + } + } sourceLocalAppPopupMenuState.dismiss() }, - selected = selectedSourceLocalApp == 0, + selected = convertPage.selectedSourceLocalApp.intValue == 0, text = "Salt Player", iconPainter = painterResource(id = R.drawable.saltplayer), iconColor = SaltTheme.colors.text, @@ -2123,10 +2133,15 @@ fun ConvertPageUi( enableHaptic.value, hapticStrength.intValue ).click() - selectedSourceLocalApp = 1 + coroutine.launch { + dataStore.edit { settings -> + settings[DataStoreConstants.SELECTED_SOURCE_APP] = + 1 + } + } sourceLocalAppPopupMenuState.dismiss() }, - selected = selectedSourceLocalApp == 1, + selected = convertPage.selectedSourceLocalApp.intValue == 1, text = "APlayer", iconPainter = painterResource(id = R.drawable.aplayer), iconColor = SaltTheme.colors.text, @@ -2139,10 +2154,15 @@ fun ConvertPageUi( enableHaptic.value, hapticStrength.intValue ).click() - selectedSourceLocalApp = 2 + coroutine.launch { + dataStore.edit { settings -> + settings[DataStoreConstants.SELECTED_SOURCE_APP] = + 2 + } + } sourceLocalAppPopupMenuState.dismiss() }, - selected = selectedSourceLocalApp == 2, + selected = convertPage.selectedSourceLocalApp.intValue == 2, text = "Poweramp", iconPainter = painterResource(id = R.drawable.poweramp), iconColor = SaltTheme.colors.text, @@ -2151,13 +2171,11 @@ fun ConvertPageUi( } Item( onClick = { - convertPage.selectPlaylistFile( - selectedSourceLocalApp - ) + convertPage.selectPlaylistFile() }, text = stringResource(R.string.select_playlist_file_match_to_source).replace( "#", - when (selectedSourceLocalApp) { + when (convertPage.selectedSourceLocalApp.intValue) { 0 -> "Salt Player" 1 -> "APlayer" 2 -> "Poweramp" @@ -2170,7 +2188,8 @@ fun ConvertPageUi( ) { ItemValue( text = stringResource(R.string.you_have_selected), - rightSub = convertPage.sourcePlaylistFileName.value + rightSub = convertPage.sourcePlaylistFileName.value, + rightSubWeight = 2f ) } } @@ -2182,7 +2201,7 @@ fun ConvertPageUi( ItemPopup( state = targetAppPopupMenuState, text = stringResource(R.string.using_player), - selectedItem = when (selectedTargetApp) { + selectedItem = when (convertPage.selectedTargetApp.intValue) { 0 -> "Salt Player" 1 -> "APlayer" 2 -> "Poweramp" @@ -2197,10 +2216,15 @@ fun ConvertPageUi( enableHaptic.value, hapticStrength.intValue ).click() - selectedTargetApp = 0 + coroutine.launch { + dataStore.edit { settings -> + settings[DataStoreConstants.SELECTED_TARGET_APP] = + 0 + } + } targetAppPopupMenuState.dismiss() }, - selected = selectedTargetApp == 0, + selected = convertPage.selectedTargetApp.intValue == 0, text = "Salt Player", iconPainter = painterResource(id = R.drawable.saltplayer), iconColor = SaltTheme.colors.text, @@ -2218,10 +2242,15 @@ fun ConvertPageUi( enableHaptic.value, hapticStrength.intValue ).click() - selectedTargetApp = 1 + coroutine.launch { + dataStore.edit { settings -> + settings[DataStoreConstants.SELECTED_TARGET_APP] = + 1 + } + } targetAppPopupMenuState.dismiss() }, - selected = selectedTargetApp == 1, + selected = convertPage.selectedTargetApp.intValue == 1, text = "APlayer", iconPainter = painterResource(id = R.drawable.aplayer), iconColor = SaltTheme.colors.text, @@ -2234,10 +2263,15 @@ fun ConvertPageUi( enableHaptic.value, hapticStrength.intValue ).click() - selectedTargetApp = 2 + coroutine.launch { + dataStore.edit { settings -> + settings[DataStoreConstants.SELECTED_TARGET_APP] = + 2 + } + } targetAppPopupMenuState.dismiss() }, - selected = selectedTargetApp == 2, + selected = convertPage.selectedTargetApp.intValue == 2, text = "Poweramp", iconPainter = painterResource(id = R.drawable.poweramp), iconColor = SaltTheme.colors.text, @@ -2255,11 +2289,11 @@ fun ConvertPageUi( ItemContainer { TextButton( onClick = { - if (selectedConvertMode.intValue == 1) { + if (convertPage.convertMode.intValue == 1) { selectedMultiSourceApp = -1 convertPage.requestPermission() } else { - if (selectedSourceLocalApp == selectedTargetApp) { + if (convertPage.selectedSourceLocalApp.intValue == convertPage.selectedTargetApp.intValue) { Toast.makeText( context, context.getString(R.string.source_target_same), @@ -2269,15 +2303,23 @@ fun ConvertPageUi( context, enableHaptic.value, hapticStrength.intValue - ).done() + ).dialog() + } else if (convertPage.sourcePlaylistFileName.value.isBlank()) { + Toast.makeText( + context, + context.getString(R.string.please_select_playlist_file), + Toast.LENGTH_SHORT + ).show() + MyVibrationEffect( + context, + enableHaptic.value, + hapticStrength.intValue + ).dialog() } else { coroutine.launch(Dispatchers.IO) { showDialogProgressBar.value = true val convertSuccess = - convertPage.convertLocalPlaylist( - sourceApp = selectedSourceLocalApp, - targetApp = selectedTargetApp - ) + convertPage.convertLocalPlaylist() if (convertSuccess.isBlank()) { withContext(Dispatchers.Main) { Toast.makeText( @@ -2294,6 +2336,8 @@ fun ConvertPageUi( Toast.LENGTH_LONG ).show() } + convertPage.sourcePlaylistFileName.value = + "" } MyVibrationEffect( context, @@ -2305,7 +2349,7 @@ fun ConvertPageUi( } } }, - text = if (selectedConvertMode.intValue == 1) stringResource( + text = if (convertPage.convertMode.intValue == 1) stringResource( R.string.next_step_text ) else stringResource(R.string.start_text), enabled = !it, @@ -3247,10 +3291,10 @@ fun ConvertPageUi( ) Spacer(modifier = Modifier.width(12.dp)) TextButton( - onClick = { convertPage.launchLocalPlayer(selectedTargetApp) }, + onClick = { convertPage.launchLocalPlayer() }, modifier = Modifier.weight(1f), text = stringResource(id = R.string.open_other_app).replace( - "#", when (selectedTargetApp) { + "#", when (convertPage.selectedTargetApp.intValue) { 0 -> "Salt Player" 1 -> "APlayer" 2 -> "Poweramp" diff --git a/app/src/main/java/com/hwinzniej/musichelper/ui/ScanPageUi.kt b/app/src/main/java/com/hwinzniej/musichelper/ui/ScanPageUi.kt index 99e637d..e031614 100644 --- a/app/src/main/java/com/hwinzniej/musichelper/ui/ScanPageUi.kt +++ b/app/src/main/java/com/hwinzniej/musichelper/ui/ScanPageUi.kt @@ -1,5 +1,7 @@ package com.hwinzniej.musichelper.ui +import android.widget.Toast +import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedContent import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn @@ -57,6 +59,15 @@ fun ScanPageUi( hapticStrength: MutableIntState ) { val context = LocalContext.current + + BackHandler(enabled = showLoadingProgressBar.value) { + Toast.makeText( + context, + context.getString(R.string.wait_operate_end), + Toast.LENGTH_SHORT + ).show() + } + if (showConflictDialog.value) { YesNoDialog( onDismiss = { showConflictDialog.value = false }, diff --git a/app/src/main/java/com/hwinzniej/musichelper/ui/SettingsPageUi.kt b/app/src/main/java/com/hwinzniej/musichelper/ui/SettingsPageUi.kt index f1f749d..62595d6 100644 --- a/app/src/main/java/com/hwinzniej/musichelper/ui/SettingsPageUi.kt +++ b/app/src/main/java/com/hwinzniej/musichelper/ui/SettingsPageUi.kt @@ -68,9 +68,14 @@ fun SettingsPageUi( hapticStrength: MutableIntState ) { val context = LocalContext.current + val targetSdkVersion = context.packageManager.getApplicationInfo( + context.packageName, + 0 + ).targetSdkVersion val themeModePopupMenuState = rememberPopupState() val languagePopupMenuState = rememberPopupState() val hapticStrengthPopupMenuState = rememberPopupState() + val initialPagePopupMenuState = rememberPopupState() val coroutineScope = rememberCoroutineScope() var showSelectEncryptServerDialog by remember { mutableStateOf(false) } var umFileLegal by remember { mutableStateOf(false) } @@ -94,11 +99,10 @@ fun SettingsPageUi( onDismiss = { showSelectEncryptServerDialog = false }, onCancel = { showSelectEncryptServerDialog = false }, onConfirm = { - encryptServer.value = selectedEncryptServer coroutineScope.launch(Dispatchers.IO) { dataStore.edit { settings -> settings[DataStoreConstants.KEY_ENCRYPT_SERVER] = - encryptServer.value + selectedEncryptServer } } showSelectEncryptServerDialog = false @@ -223,7 +227,7 @@ fun SettingsPageUi( ItemPopup( state = themeModePopupMenuState, iconPainter = painterResource(id = R.drawable.app_theme), - iconPaddingValues = PaddingValues(all = 2.dp), + iconPaddingValues = PaddingValues(all = 1.8.dp), iconColor = SaltTheme.colors.text, text = stringResource(R.string.theme_mode_switcher_text), selectedItem = when (selectedThemeMode.intValue) { @@ -293,6 +297,131 @@ fun SettingsPageUi( iconPaddingValues = PaddingValues(all = 1.dp) ) } + ItemPopup( + state = initialPagePopupMenuState, + iconPainter = painterResource(id = R.drawable.home_screen), + iconPaddingValues = PaddingValues(all = 1.5.dp), + iconColor = SaltTheme.colors.text, + text = stringResource(R.string.home_screen), + selectedItem = if (targetSdkVersion <= 28) { + when (settingsPage.initialPage.intValue) { + 0 -> stringResource(R.string.scan_function_name) + 1 -> stringResource(R.string.convert_function_name) + 2 -> stringResource(R.string.tag_function_name) + 3 -> stringResource(R.string.unlock_function_name) + 4 -> stringResource(R.string.settings_function_name) + else -> "" + } + } else { + when (settingsPage.initialPage.intValue) { + 0 -> stringResource(R.string.scan_function_name) + 1 -> stringResource(R.string.convert_function_name) + 2 -> stringResource(R.string.tag_function_name) + 3 -> stringResource(R.string.settings_function_name) + else -> "" + } + }, + popupWidth = 150 + ) { + PopupMenuItem( + onClick = { + MyVibrationEffect( + context, + enableHaptic.value, + hapticStrength.intValue + ).click() + coroutineScope.launch { + dataStore.edit { settings -> + settings[DataStoreConstants.INITIAL_PAGE] = 0 + } + } + initialPagePopupMenuState.dismiss() + }, + selected = settingsPage.initialPage.intValue == 0, + text = stringResource(R.string.scan_function_name), + iconPainter = painterResource(id = R.drawable.scan), + iconColor = SaltTheme.colors.text + ) + PopupMenuItem( + onClick = { + MyVibrationEffect( + context, + enableHaptic.value, + hapticStrength.intValue + ).click() + coroutineScope.launch { + dataStore.edit { settings -> + settings[DataStoreConstants.INITIAL_PAGE] = 1 + } + } + initialPagePopupMenuState.dismiss() + }, + selected = settingsPage.initialPage.intValue == 1, + text = stringResource(R.string.convert_function_name), + iconPainter = painterResource(id = R.drawable.convert), + iconColor = SaltTheme.colors.text + ) + PopupMenuItem( + onClick = { + MyVibrationEffect( + context, + enableHaptic.value, + hapticStrength.intValue + ).click() + coroutineScope.launch { + dataStore.edit { settings -> + settings[DataStoreConstants.INITIAL_PAGE] = 2 + } + } + initialPagePopupMenuState.dismiss() + }, + selected = settingsPage.initialPage.intValue == 2, + text = stringResource(R.string.tag_function_name), + iconPainter = painterResource(id = R.drawable.tag), + iconColor = SaltTheme.colors.text + ) + if (targetSdkVersion <= 28) { + PopupMenuItem( + onClick = { + MyVibrationEffect( + context, + enableHaptic.value, + hapticStrength.intValue + ).click() + coroutineScope.launch { + dataStore.edit { settings -> + settings[DataStoreConstants.INITIAL_PAGE] = 3 + } + } + initialPagePopupMenuState.dismiss() + }, + selected = settingsPage.initialPage.intValue == 3, + text = stringResource(R.string.unlock_function_name), + iconPainter = painterResource(id = R.drawable.um), + iconColor = SaltTheme.colors.text + ) + } + PopupMenuItem( + onClick = { + MyVibrationEffect( + context, + enableHaptic.value, + hapticStrength.intValue + ).click() + coroutineScope.launch { + dataStore.edit { settings -> + settings[DataStoreConstants.INITIAL_PAGE] = + if (targetSdkVersion <= 28) 4 else 3 + } + } + initialPagePopupMenuState.dismiss() + }, + selected = settingsPage.initialPage.intValue == if (targetSdkVersion <= 28) 4 else 3, + text = stringResource(R.string.settings_function_name), + iconPainter = painterResource(id = R.drawable.settings), + iconColor = SaltTheme.colors.text + ) + } } RoundedColumn { diff --git a/app/src/main/java/com/hwinzniej/musichelper/ui/TagPageUi.kt b/app/src/main/java/com/hwinzniej/musichelper/ui/TagPageUi.kt index 2fc3e4d..c32b7e9 100644 --- a/app/src/main/java/com/hwinzniej/musichelper/ui/TagPageUi.kt +++ b/app/src/main/java/com/hwinzniej/musichelper/ui/TagPageUi.kt @@ -508,7 +508,13 @@ fun TagPageUi( YesNoDialog( onDismiss = { - if (!showDialogProgressBar) { + if (showDialogProgressBar) { + Toast.makeText( + context, + context.getString(R.string.wait_operate_end), + Toast.LENGTH_SHORT + ).show() + } else { if (completeDone) { coroutineScope.launch(Dispatchers.IO) { tagPage.getMusicList(songList, sortMethod.intValue, selectedSongList) @@ -520,7 +526,13 @@ fun TagPageUi( } }, onCancel = { - if (!showDialogProgressBar) { + if (showDialogProgressBar) { + Toast.makeText( + context, + context.getString(R.string.wait_operate_end), + Toast.LENGTH_SHORT + ).show() + } else { if (completeDone) { coroutineScope.launch(Dispatchers.IO) { tagPage.getMusicList(songList, sortMethod.intValue, selectedSongList) diff --git a/app/src/main/java/com/hwinzniej/musichelper/ui/UnlockPageUi.kt b/app/src/main/java/com/hwinzniej/musichelper/ui/UnlockPageUi.kt index 2d7f1d6..3557767 100644 --- a/app/src/main/java/com/hwinzniej/musichelper/ui/UnlockPageUi.kt +++ b/app/src/main/java/com/hwinzniej/musichelper/ui/UnlockPageUi.kt @@ -1,5 +1,7 @@ package com.hwinzniej.musichelper.ui +import android.widget.Toast +import androidx.activity.compose.BackHandler import androidx.compose.animation.AnimatedContent import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn @@ -24,7 +26,6 @@ import androidx.compose.runtime.MutableState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -53,7 +54,6 @@ fun UnlockPageUi( settingsPage: SettingsPage, hapticStrength: MutableIntState ) { - val coroutineScope = rememberCoroutineScope() val context = LocalContext.current var inputPath by remember { mutableStateOf("") } var outputPath by remember { mutableStateOf("") } @@ -62,6 +62,14 @@ fun UnlockPageUi( var umSupportOverWrite by remember { mutableStateOf(false) } var showInputOutputPathNotSameDialog by remember { mutableStateOf(false) } + BackHandler(enabled = unlockPage.showLoadingProgressBar.value) { + Toast.makeText( + context, + context.getString(R.string.wait_operate_end), + Toast.LENGTH_SHORT + ).show() + } + LaunchedEffect(key1 = settingsPage.umSupportOverWrite.value) { umSupportOverWrite = settingsPage.umSupportOverWrite.value } diff --git a/app/src/main/res/drawable/app_theme.xml b/app/src/main/res/drawable/app_theme.xml index d1f2192..5f4e732 100644 --- a/app/src/main/res/drawable/app_theme.xml +++ b/app/src/main/res/drawable/app_theme.xml @@ -1,15 +1,22 @@ + android:width="592dp" + android:height="591dp" + android:viewportWidth="592" + android:viewportHeight="591"> + android:fillColor="#FF000000" + android:fillType="evenOdd" + android:pathData="M295.01,466C201.12,465.45 125.46,388.67 126,294.51 126.54,200.93 202.19,125.27 295.5,125L296,295.5Z" /> + android:fillColor="#00000000" + android:fillType="evenOdd" + android:pathData="M17,295.5C17,141.69 141.91,17 296,17 450.09,17 575,141.69 575,295.5 575,449.31 450.09,574 296,574 141.91,574 17,449.31 17,295.5Z" + android:strokeWidth="34.375" + android:strokeColor="#000000" /> + android:fillColor="#00000000" + android:fillType="evenOdd" + android:pathData="M117,295.5C117,196.36 197.14,116 296,116 394.86,116 475,196.36 475,295.5 475,394.64 394.86,475 296,475 197.14,475 117,394.64 117,295.5Z" + android:strokeWidth="34.375" + android:strokeColor="#000000" /> diff --git a/app/src/main/res/drawable/home_screen.xml b/app/src/main/res/drawable/home_screen.xml new file mode 100644 index 0000000..810dc50 --- /dev/null +++ b/app/src/main/res/drawable/home_screen.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/main/res/drawable/unlock.xml b/app/src/main/res/drawable/um.xml similarity index 100% rename from app/src/main/res/drawable/unlock.xml rename to app/src/main/res/drawable/um.xml diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 48dae6e..adfb9de 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -373,4 +373,6 @@ 노래 목록 데이터가 없습니다 로딩 중… 작업이 완료될 때까지 기다려주세요 + 플레이리스트파일을 선택하십시오 + 시작 페이지 \ No newline at end of file diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index cfaaa63..8ead29a 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -373,4 +373,6 @@ 无歌单数据 加载中… 请等待操作完成 + 请选择歌单文件 + 启动页 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e6bdf70..76b6342 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -379,4 +379,6 @@ No playlist data Loading… Please wait for the operation to complete + Please select playlist file + Launch page \ No newline at end of file