From 0eb5a43c00720bc815e523cf35f1e3aaedea1e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 26 Apr 2021 14:30:08 +0800 Subject: [PATCH] About page --- .github/workflows/debug.yml | 1 + .idea/vcs.xml | 5 + LICENSE | 2 +- app/build.gradle | 36 +- app/src/main/AndroidManifest.xml | 15 + app/src/main/assets/LICENSE | 25 + app/src/main/assets/open_source_licenses.html | 806 ------------------ .../nekohasekai/sagernet/bg/ProxyInstance.kt | 4 +- .../io/nekohasekai/sagernet/bg/VpnService.kt | 1 - .../sagernet/fmt/v2ray/V2RayFmt.kt | 5 +- .../io/nekohasekai/sagernet/ktx/Browsers.kt | 45 + .../nekohasekai/sagernet/ui/AboutFragment.kt | 144 ++++ .../sagernet/ui/LicenseActivity.kt | 66 ++ .../sagernet/ui/SettingsPreferenceFragment.kt | 7 +- .../drawable/ic_baseline_bug_report_24.xml | 31 + .../res/drawable/ic_baseline_sanitizer_24.xml | 31 + .../res/drawable/ic_baseline_update_24.xml | 31 + app/src/main/res/layout/layout_about.xml | 58 +- app/src/main/res/layout/layout_license.xml | 19 + app/src/main/res/values/strings.xml | 14 +- app/src/main/res/xml/log_paths.xml | 4 + build.gradle | 2 +- v2ray | 2 +- 23 files changed, 504 insertions(+), 850 deletions(-) create mode 100644 app/src/main/assets/LICENSE delete mode 100644 app/src/main/assets/open_source_licenses.html create mode 100644 app/src/main/java/io/nekohasekai/sagernet/ktx/Browsers.kt create mode 100644 app/src/main/java/io/nekohasekai/sagernet/ui/LicenseActivity.kt create mode 100644 app/src/main/res/drawable/ic_baseline_bug_report_24.xml create mode 100644 app/src/main/res/drawable/ic_baseline_sanitizer_24.xml create mode 100644 app/src/main/res/drawable/ic_baseline_update_24.xml create mode 100644 app/src/main/res/layout/layout_license.xml create mode 100644 app/src/main/res/xml/log_paths.xml diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index 9de1acd5..7cd1ec1a 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -131,4 +131,5 @@ jobs: run: | echo "sdk.dir=${ANDROID_HOME}" > local.properties echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties + ./run update_assets ./gradlew app:assembleDebug \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 9e6c3fee..c4733c66 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -4,6 +4,11 @@ + + + + + diff --git a/LICENSE b/LICENSE index f288702d..c6e6f3ff 100644 --- a/LICENSE +++ b/LICENSE @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - Copyright (C) + SagerNet Copyright (C) 2021 nekohasekai This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/app/build.gradle b/app/build.gradle index 4068c804..82e3a670 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,7 +3,7 @@ plugins { id "kotlin-android" id "kotlin-kapt" id "kotlin-parcelize" - id "com.jaredsburrows.license" + id "com.mikepenz.aboutlibraries.plugin" } def keystorePwd = null @@ -121,53 +121,47 @@ android { } -licenseReport { - generateCsvReport = false - generateJsonReport = false - generateHtmlReport = true - copyHtmlReportToAssets = true - copyJsonReportToAssets = false - copyCsvReportToAssets = false -} - dependencies { implementation fileTree(dir: "libs") implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3" - implementation 'androidx.core:core-ktx:1.6.0-alpha02' - implementation 'androidx.activity:activity-ktx:1.2.2' + implementation "androidx.core:core-ktx:1.6.0-alpha02" + implementation "androidx.activity:activity-ktx:1.2.2" implementation "androidx.fragment:fragment-ktx:1.3.3" + implementation "androidx.browser:browser:1.3.0" - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation "androidx.constraintlayout:constraintlayout:2.0.4" implementation "androidx.navigation:navigation-fragment-ktx:2.3.5" implementation "androidx.navigation:navigation-ui-ktx:2.3.5" implementation "androidx.preference:preference-ktx:1.1.1" - implementation 'androidx.appcompat:appcompat:1.2.0' + implementation "androidx.appcompat:appcompat:1.2.0" implementation "com.google.android.material:material:1.3.0" implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.2" implementation "cn.hutool:hutool-core:5.6.3" implementation "cn.hutool:hutool-json:5.6.3" - implementation 'com.google.code.gson:gson:2.8.6' + implementation "com.google.code.gson:gson:2.8.6" implementation "com.google.zxing:core:3.4.1" implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.2" implementation "com.takisoft.preferencex:preferencex-simplemenu:1.1.0" implementation "org.yaml:snakeyaml:1.28" + implementation "com.github.daniel-stoneuk:material-about-library:3.2.0-rc01" + implementation "com.mikepenz:aboutlibraries:8.8.5" implementation("com.simplecityapps:recyclerview-fastscroll:2.0.1") { exclude group: "androidx.recyclerview" exclude group: "androidx.appcompat" } implementation("org.smali:dexlib2:2.5.2") { - exclude group: 'com.google.guava', module: 'guava' + exclude group: "com.google.guava", module: "guava" } implementation "com.google.guava:guava:30.1.1-android" implementation "com.journeyapps:zxing-android-embedded:4.2.0" - implementation "androidx.room:room-runtime:2.2.6" - kapt "androidx.room:room-compiler:2.2.6" - implementation "androidx.room:room-ktx:2.2.6" + implementation "androidx.room:room-runtime:2.3.0" + kapt "androidx.room:room-compiler:2.3.0" + implementation "androidx.room:room-ktx:2.3.0" implementation "com.github.MatrixDev.Roomigrant:RoomigrantLib:0.3.4" kapt "com.github.MatrixDev.Roomigrant:RoomigrantCompiler:0.3.4" @@ -175,8 +169,8 @@ dependencies { implementation "com.esotericsoftware:kryo:5.1.0" testImplementation "junit:junit:4.13.2" - testImplementation "androidx.room:room-testing:2.2.6" - androidTestImplementation 'androidx.test.ext:junit:1.1.2' + testImplementation "androidx.room:room-testing:2.3.0" + androidTestImplementation "androidx.test.ext:junit:1.1.2" androidTestImplementation "androidx.test.espresso:espresso-core:3.3.0" coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e22ac12a..c67ab345 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -90,6 +90,12 @@ android:parentActivityName="io.nekohasekai.sagernet.ui.MainActivity" android:screenOrientation="locked" android:theme="@style/Theme.SagerNet" /> + + + + + +Copyright (C) 2017-2021 by Max Lv + + +Copyright (C) 2017-2021 by Mygod Studio + + +This program is free software: you can +redistribute it and/or modify it under +the terms of the GNU General Public License +as published by the Free Software Foundation, +either version 3 of the License, +or (at your option) any later version. + +This program is distributed in the hope +that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the +GNU General Public License along with this program. +If not, see . \ No newline at end of file diff --git a/app/src/main/assets/open_source_licenses.html b/app/src/main/assets/open_source_licenses.html deleted file mode 100644 index 235445ba..00000000 --- a/app/src/main/assets/open_source_licenses.html +++ /dev/null @@ -1,806 +0,0 @@ - - - - Open source licenses - - -

Notice for packages:

-
    -
  • zxing-android-embedded (4.2.0) -
    -
    Copyright © 20xx Ralf Kistner
    -
    -
  • - -
    Mulan Permissive Software License,Version 1
    -https://license.coscl.org.cn/MulanPSL2
    -
    -
    -
  • Activity (1.2.2) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Activity (1.1.0) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Activity Kotlin Extensions (1.2.2) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android AppCompat Library v7 (1.2.0) -
    -
    Copyright © 2011 The Android Open Source Project
    -
    -
  • -
  • Android Arch-Common (2.1.0) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Arch-Runtime (2.1.0) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android ConstraintLayout (2.0.4) -
    -
    Copyright © 2007 The Android Open Source Project
    -
    -
  • -
  • Android ConstraintLayout Solver (2.0.4) -
    -
    Copyright © 2007 The Android Open Source Project
    -
    -
  • -
  • Android DB (2.0.1) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Lifecycle Kotlin Extensions (2.3.1) -
    -
    Copyright © 2019 The Android Open Source Project
    -
    -
  • -
  • Android Lifecycle LiveData (2.0.0) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Lifecycle LiveData Core (2.3.1) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Lifecycle Runtime (2.3.1) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Lifecycle ViewModel (2.3.1) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Lifecycle ViewModel Kotlin Extensions (2.3.1) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Lifecycle ViewModel with SavedState (2.3.1) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Lifecycle-Common (2.3.1) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Navigation Common (2.3.5) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Navigation Common Kotlin Extensions (2.3.5) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Navigation Fragment (2.3.5) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Navigation Fragment Kotlin Extensions (2.3.5) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Navigation Runtime (2.3.5) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Navigation Runtime Kotlin Extensions (2.3.5) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Navigation UI (2.3.5) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Navigation UI Kotlin Extensions (2.3.5) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Preferences KTX (1.1.1) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Resources Library (1.2.0) -
    -
    Copyright © 2019 The Android Open Source Project
    -
    -
  • -
  • Android Room Kotlin Extensions (2.2.6) -
    -
    Copyright © 2019 The Android Open Source Project
    -
    -
  • -
  • Android Room-Common (2.2.6) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Room-Runtime (2.2.6) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Support AnimatedVectorDrawable (1.1.0) -
    -
    Copyright © 2015 The Android Open Source Project
    -
    -
  • -
  • Android Support CardView v7 (1.0.0) -
    -
    Copyright © 2011 The Android Open Source Project
    -
    -
  • -
  • Android Support DynamicAnimation (1.0.0) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Support Library Annotations (1.2.0) -
    -
    Copyright © 2013 The Android Open Source Project
    -
    -
  • -
  • Android Support Library Async Layout Inflater (1.0.0) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Support Library collections (1.1.0) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Support Library compat (1.6.0-alpha02) -
    -
    Copyright © 2015 The Android Open Source Project
    -
    -
  • -
  • Android Support Library Coordinator Layout (1.1.0) -
    -
    Copyright © 2011 The Android Open Source Project
    -
    -
  • -
  • Android Support Library core UI (1.0.0) -
    -
    Copyright © 2011 The Android Open Source Project
    -
    -
  • -
  • Android Support Library core utils (1.0.0) -
    -
    Copyright © 2011 The Android Open Source Project
    -
    -
  • -
  • Android Support Library Cursor Adapter (1.0.0) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Support Library Custom View (1.1.0) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Support Library Custom View (1.0.0) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Support Library Document File (1.0.0) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Support Library Drawer Layout (1.1.1) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Support Library fragment (1.3.2) -
    -
    Copyright © 2011 The Android Open Source Project
    -
    -
  • -
  • Android Support Library Interpolators (1.0.0) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Support Library loader (1.0.0) -
    -
    Copyright © 2011 The Android Open Source Project
    -
    -
  • -
  • Android Support Library Local Broadcast Manager (1.0.0) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Support Library media compat (1.0.0) -
    -
    Copyright © 2011 The Android Open Source Project
    -
    -
  • -
  • Android Support Library Print (1.0.0) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Support Library Sliding Pane Layout (1.0.0) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Support Library v4 (1.0.0) -
    -
    Copyright © 2011 The Android Open Source Project
    -
    -
  • -
  • Android Support Library View Pager (1.0.0) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Android Support RecyclerView v7 (1.1.0) -
    -
    Copyright © 2014 The Android Open Source Project
    -
    -
  • -
  • Android Support SQLite - Framework Implementation (2.0.1) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Android Support VectorDrawable (1.1.0) -
    -
    Copyright © 2015 The Android Open Source Project
    -
    -
  • -
  • Android Tracing (1.0.0) -
    -
    Copyright © 2020 The Android Open Source Project
    -
    -
  • -
  • Android Transition Support Library (1.3.0) -
    -
    Copyright © 2016 The Android Open Source Project
    -
    -
  • -
  • AndroidX Preference (1.1.1) -
    -
    Copyright © 2015 The Android Open Source Project
    -
    -
  • -
  • AndroidX Widget ViewPager2 (1.0.0) -
    -
    Copyright © 2017 The Android Open Source Project
    -
    -
  • -
  • Collections Kotlin Extensions (1.1.0) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Core Kotlin Extensions (1.6.0-alpha02) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • error-prone annotations (2.5.1) -
    -
    Copyright © 20xx The original author or authors
    -
    -
  • -
  • Experimental annotation (1.0.0) -
    -
    Copyright © 2019 The Android Open Source Project
    -
    -
  • -
  • FindBugs-jsr305 (3.0.2) -
    -
    Copyright © 20xx The original author or authors
    -
    -
  • -
  • Fragment Kotlin Extensions (1.3.2) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Gson (2.8.6) -
    -
    Copyright © 20xx The original author or authors
    -
    -
  • -
  • Guava InternalFutureFailureAccess and InternalFutures (1.0.1) -
    -
    Copyright © 20xx The original author or authors
    -
    -
  • -
  • Guava ListenableFuture only (9999.0-empty-to-avoid-conflict-with-guava) -
    -
    Copyright © 20xx The original author or authors
    -
    -
  • -
  • Guava: Google Core Libraries for Java (30.1.1-android) -
    -
    Copyright © 20xx The original author or authors
    -
    -
  • -
  • IntelliJ IDEA Annotations (13.0) -
    -
    Copyright © 20xx JetBrains Team
    -
    -
  • -
  • J2ObjC Annotations (1.3) -
    -
    Copyright © 20xx The original author or authors
    -
    -
  • -
  • Kotlin Android Extensions Runtime (1.4.32) -
    -
    Copyright © 20xx Kotlin Team
    -
    -
  • -
  • Kotlin Stdlib (1.4.32) -
    -
    Copyright © 20xx Kotlin Team
    -
    -
  • -
  • Kotlin Stdlib Common (1.4.32) -
    -
    Copyright © 20xx Kotlin Team
    -
    -
  • -
  • Kotlin Stdlib Jdk7 (1.4.32) -
    -
    Copyright © 20xx Kotlin Team
    -
    -
  • -
  • Kotlin Stdlib Jdk8 (1.4.32) -
    -
    Copyright © 20xx Kotlin Team
    -
    -
  • -
  • kotlinx-coroutines-android (1.4.3) -
    -
    Copyright © 20xx JetBrains Team
    -
    -
  • -
  • kotlinx-coroutines-core (1.4.3) -
    -
    Copyright © 20xx JetBrains Team
    -
    -
  • -
  • LiveData Core Kotlin Extensions (2.3.1) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • Material Components for Android (1.3.0) -
    -
    Copyright © 2015 The Android Open Source Project
    -
    -
  • -
  • Objenesis (3.2) -
    -
    Copyright © 20xx The original author or authors
    -
    -
  • -
  • okhttp (5.0.0-alpha.2) -
    -
    Copyright © 20xx Square, Inc.
    -
    -
  • -
  • Okio (2.9.0) -
    -
    Copyright © 20xx Square, Inc.
    -
    -
  • -
  • Parcelize Runtime (1.4.32) -
    -
    Copyright © 20xx Kotlin Team
    -
    -
  • -
  • Preference X - SimpleMenuPreference (1.1.0) -
    -
    Copyright © 20xx Mygod
    -
    -
  • -
  • recyclerview-fastscroll (2.0.1) -
    -
    Copyright © 20xx Tim Malseed
    -
    -
  • -
  • SavedState Kotlin Extensions (1.1.0) -
    -
    Copyright © 2020 The Android Open Source Project
    -
    -
  • -
  • SnakeYAML (1.28) -
    -
    Copyright © 2008 Andrey Somov
    -
    Copyright © 2008 Alexander Maslov
    -
    Copyright © 2008 Jordan Angold
    -
    -
  • -
  • VersionedParcelable (1.1.1) -
    -
    Copyright © 2018 The Android Open Source Project
    -
    -
  • -
  • ZXing Core (3.4.1) -
    -
    Copyright © 20xx The original author or authors
    -
    -
  • - -
                                     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:
    -
    -      (a) You must give any other recipients of the Work or
    -          Derivative Works a copy of this License; and
    -
    -      (b) You must cause any modified files to carry prominent notices
    -          stating that You changed the files; and
    -
    -      (c) You must retain, in the Source form of any Derivative Works
    -          that You distribute, all copyright, patent, trademark, and
    -          attribution notices from the Source form of the Work,
    -          excluding those notices that do not pertain to any part of
    -          the Derivative Works; and
    -
    -      (d) If the Work includes a "NOTICE" text file as part of its
    -          distribution, then any Derivative Works that You distribute must
    -          include a readable copy of the attribution notices contained
    -          within such NOTICE file, excluding those notices that do not
    -          pertain to any part of the Derivative Works, in at least one
    -          of the following places: within a NOTICE text file distributed
    -          as part of the Derivative Works; within the Source form or
    -          documentation, if provided along with the Derivative Works; or,
    -          within a display generated by the Derivative Works, if and
    -          wherever such third-party notices normally appear. The contents
    -          of the NOTICE file are for informational purposes only and
    -          do not modify the License. You may add Your own attribution
    -          notices within Derivative Works that You distribute, alongside
    -          or as an addendum to the NOTICE text from the Work, provided
    -          that such additional attribution notices cannot be construed
    -          as modifying the License.
    -
    -      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.
    -
    -
    -
    -
  • dexlib2 (2.5.2) -
    -
    Copyright © 20xx Ben Gruver
    -
    -
  • -
  • Kryo (5.1.0) -
    -
    Copyright © 20xx The original author or authors
    -
    -
  • -
  • MinLog (1.3.1) -
    -
    Copyright © 20xx Nathan Sweet
    -
    -
  • -
  • ReflectASM (1.11.9) -
    -
    Copyright © 20xx Nathan Sweet
    -
    -
  • - -
    BSD 3-Clause License
    -
    -Copyright (c) [year], [fullname]
    -All rights reserved.
    -
    -Redistribution and use in source and binary forms, with or without
    -modification, are permitted provided that the following conditions are met:
    -
    -* Redistributions of source code must retain the above copyright notice, this
    -  list of conditions and the following disclaimer.
    -
    -* Redistributions in binary form must reproduce the above copyright notice,
    -  this list of conditions and the following disclaimer in the documentation
    -  and/or other materials provided with the distribution.
    -
    -* Neither the name of the copyright holder nor the names of its
    -  contributors may be used to endorse or promote products derived from
    -  this software without specific prior written permission.
    -
    -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    -
    -
    -
    -
  • Checker Qual (2.5.5) -
    -
    Copyright © 20xx Michael Ernst
    -
    Copyright © 20xx Werner M. Dietl
    -
    Copyright © 20xx Suzanne Millstein
    -
    -
  • - -
    GNU General Public License, version 2 (GPL2), with the classpath exception
    -http://www.gnu.org/software/classpath/license.html
    -
    -
    MIT License
    -
    -Copyright (c) [year] [fullname]
    -
    -Permission is hereby granted, free of charge, to any person obtaining a copy
    -of this software and associated documentation files (the "Software"), to deal
    -in the Software without restriction, including without limitation the rights
    -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    -copies of the Software, and to permit persons to whom the Software is
    -furnished to do so, subject to the following conditions:
    -
    -The above copyright notice and this permission notice shall be included in all
    -copies or substantial portions of the Software.
    -
    -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    -SOFTWARE.
    -
    -
    -
    -
  • MatrixDev/Roomigrant (0.3.4) -
    -
    Copyright © 2018 Rostyslav Lesovyi
    -
    -
  • - -
    MIT License
    -
    -Copyright (c) [year] [fullname]
    -
    -Permission is hereby granted, free of charge, to any person obtaining a copy
    -of this software and associated documentation files (the "Software"), to deal
    -in the Software without restriction, including without limitation the rights
    -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    -copies of the Software, and to permit persons to whom the Software is
    -furnished to do so, subject to the following conditions:
    -
    -The above copyright notice and this permission notice shall be included in all
    -copies or substantial portions of the Software.
    -
    -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    -SOFTWARE.
    -
    -
    -
    -
- - diff --git a/app/src/main/java/io/nekohasekai/sagernet/bg/ProxyInstance.kt b/app/src/main/java/io/nekohasekai/sagernet/bg/ProxyInstance.kt index 924b7f7d..3dca3aab 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/bg/ProxyInstance.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/bg/ProxyInstance.kt @@ -37,7 +37,7 @@ import io.nekohasekai.sagernet.fmt.shadowsocks.ShadowsocksBean import io.nekohasekai.sagernet.fmt.shadowsocksr.ShadowsocksRBean import io.nekohasekai.sagernet.fmt.v2ray.AbstractV2RayBean import io.nekohasekai.sagernet.fmt.v2ray.V2RayConfig -import io.nekohasekai.sagernet.fmt.v2ray.buildV2rayConfig +import io.nekohasekai.sagernet.fmt.v2ray.buildV2RayConfig import io.nekohasekai.sagernet.ktx.Logs import io.nekohasekai.sagernet.utils.DirectBoot import kotlinx.coroutines.CoroutineScope @@ -65,7 +65,7 @@ class ProxyInstance(val profile: ProxyEntity) { v2rayPoint.domainName = profile.requireBean().serverAddress + ":" + profile.requireBean().serverPort } - config = buildV2rayConfig(profile) + config = buildV2RayConfig(profile) v2rayPoint.configureFileContent = gson.toJson(config).also { Logs.d(it) } diff --git a/app/src/main/java/io/nekohasekai/sagernet/bg/VpnService.kt b/app/src/main/java/io/nekohasekai/sagernet/bg/VpnService.kt index 51d7f6d1..0559ba77 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/bg/VpnService.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/bg/VpnService.kt @@ -184,7 +184,6 @@ class VpnService : BaseVpnService(), BaseService.Interface { metered = DataStore.meteredNetwork active = true // possible race condition here? -// builder.setUnderlyingNetworks(underlyingNetworks) if (Build.VERSION.SDK_INT >= 29) builder.setMetered(metered) val conn = builder.establish() ?: throw NullConnectionException() diff --git a/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt b/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt index f6db9b02..b6fcbb86 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt @@ -23,6 +23,7 @@ package io.nekohasekai.sagernet.fmt.v2ray import cn.hutool.core.codec.Base64 import cn.hutool.json.JSONObject +import io.nekohasekai.sagernet.BuildConfig import io.nekohasekai.sagernet.RouteMode import io.nekohasekai.sagernet.database.DataStore import io.nekohasekai.sagernet.database.ProxyEntity @@ -41,7 +42,7 @@ const val TAG_DIRECT = "bypass" const val TAG_DNS_IN = "dns-in" const val TAG_DNS_OUT = "dns-out" -fun buildV2rayConfig(proxy: ProxyEntity): V2RayConfig { +fun buildV2RayConfig(proxy: ProxyEntity): V2RayConfig { val bind = if (DataStore.allowAccess) "0.0.0.0" else "127.0.0.1" val remoteDns = DataStore.remoteDNS.split(",") @@ -82,7 +83,7 @@ fun buildV2rayConfig(proxy: ProxyEntity): V2RayConfig { } log = LogObject().apply { - loglevel = "debug" + loglevel = if (BuildConfig.DEBUG) "debug" else "warning" } policy = PolicyObject().apply { diff --git a/app/src/main/java/io/nekohasekai/sagernet/ktx/Browsers.kt b/app/src/main/java/io/nekohasekai/sagernet/ktx/Browsers.kt new file mode 100644 index 00000000..a52085ae --- /dev/null +++ b/app/src/main/java/io/nekohasekai/sagernet/ktx/Browsers.kt @@ -0,0 +1,45 @@ +/****************************************************************************** + * * + * Copyright (C) 2021 by nekohasekai * + * Copyright (C) 2021 by Max Lv * + * Copyright (C) 2021 by Mygod Studio * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ + +package io.nekohasekai.sagernet.ktx + +import android.content.Context +import android.net.Uri +import androidx.browser.customtabs.CustomTabColorSchemeParams +import androidx.browser.customtabs.CustomTabsIntent +import androidx.core.content.ContextCompat +import io.nekohasekai.sagernet.R + +fun Context.launchCustomTab(uri: Uri) { + CustomTabsIntent.Builder().apply { + setColorScheme(CustomTabsIntent.COLOR_SCHEME_SYSTEM) + setColorSchemeParams(CustomTabsIntent.COLOR_SCHEME_LIGHT, + CustomTabColorSchemeParams.Builder().apply { + setToolbarColor(ContextCompat.getColor(this@launchCustomTab, + R.color.light_color_primary)) + }.build()) + setColorSchemeParams(CustomTabsIntent.COLOR_SCHEME_DARK, + CustomTabColorSchemeParams.Builder().apply { + setToolbarColor(ContextCompat.getColor(this@launchCustomTab, + R.color.light_color_primary)) + }.build()) + }.build().launchUrl(this, uri) +} \ No newline at end of file diff --git a/app/src/main/java/io/nekohasekai/sagernet/ui/AboutFragment.kt b/app/src/main/java/io/nekohasekai/sagernet/ui/AboutFragment.kt index fe8632a3..5fedd49e 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/ui/AboutFragment.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/ui/AboutFragment.kt @@ -21,11 +21,29 @@ package io.nekohasekai.sagernet.ui +import android.content.Context +import android.content.Intent +import android.net.Uri +import android.os.Build import android.os.Bundle +import android.text.util.Linkify import android.view.View +import android.widget.TextView +import androidx.core.content.FileProvider import androidx.core.view.ViewCompat +import androidx.recyclerview.widget.RecyclerView +import com.danielstone.materialaboutlibrary.MaterialAboutFragment +import com.danielstone.materialaboutlibrary.items.MaterialAboutActionItem +import com.danielstone.materialaboutlibrary.model.MaterialAboutCard +import com.danielstone.materialaboutlibrary.model.MaterialAboutList +import io.nekohasekai.sagernet.BuildConfig import io.nekohasekai.sagernet.R +import io.nekohasekai.sagernet.ktx.* import io.nekohasekai.sagernet.widget.ListHolderListener +import libv2ray.Libv2ray +import java.io.File +import java.io.IOException +import java.io.PrintWriter class AboutFragment : ToolbarFragment(R.layout.layout_about) { @@ -34,6 +52,132 @@ class AboutFragment : ToolbarFragment(R.layout.layout_about) { ViewCompat.setOnApplyWindowInsetsListener(view, ListHolderListener) toolbar.setTitle(R.string.menu_about) + + parentFragmentManager.beginTransaction().replace(R.id.fragment_holder, AboutContent()) + .commitAllowingStateLoss() + + runOnDefaultDispatcher { + val license = view.context.assets.open("LICENSE").bufferedReader().readText() + val licenseText = view.findViewById(R.id.license) + onMainDispatcher { + licenseText.text = license + Linkify.addLinks(licenseText, Linkify.EMAIL_ADDRESSES or Linkify.WEB_URLS) + } + } + } + + class AboutContent : MaterialAboutFragment() { + + fun checkUpdate() { + // TODO: check update + } + + fun exportLog() { + val context = requireContext() + + runOnDefaultDispatcher { + val logDir = File(app.cacheDir, "log") + logDir.mkdir() + val logFile = File.createTempFile("sagernet-", ".log", logDir) + logFile.outputStream().use { out -> + PrintWriter(out.bufferedWriter()).use { writer -> + writer.println("APP ${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})") + @Suppress("DEPRECATION") + writer.println("ABI ${Build.CPU_ABI} (${Build.SUPPORTED_ABIS.joinToString(", ")})") + writer.println("API ${Build.VERSION.SDK_INT}") + writer.println("DEV ${Build.DEVICE}") + writer.flush() + try { + Runtime.getRuntime() + .exec(arrayOf("logcat", "-d")).inputStream.use { it.copyTo(out) } + } catch (e: IOException) { + Logs.w(e) + e.printStackTrace(writer) + } + writer.println() + } + } + startActivity(Intent.createChooser(Intent(Intent.ACTION_SEND) + .setType("text/x-log") + .setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + .putExtra(Intent.EXTRA_STREAM, + FileProvider.getUriForFile(context, + app.packageName + ".log", + logFile)), + context.getString(R.string.abc_shareactionprovider_share_with))) + } + } + + override fun getMaterialAboutList(activityContext: Context): MaterialAboutList { + + return MaterialAboutList.Builder() + .addCard(MaterialAboutCard.Builder() + .outline(false) + .addItem(MaterialAboutActionItem.Builder() + .icon(R.drawable.ic_baseline_update_24) + .text(R.string.app_version) + .subText(BuildConfig.VERSION_NAME) + .setOnClickAction { checkUpdate() } + .build() + ) + .addItem(MaterialAboutActionItem.Builder() + .icon(R.drawable.ic_baseline_airplanemode_active_24) + .text(R.string.v2ray_version) + .subText(Libv2ray.getVersion()) + .setOnClickAction { } + .build() + ) + .addItem(MaterialAboutActionItem.Builder() + .icon(R.drawable.ic_baseline_bug_report_24) + .text(R.string.logcat) + .subText(R.string.logcat_summary) + .setOnClickAction { exportLog() } + .build() + ) + .build() + ) + .addCard(MaterialAboutCard.Builder() + .outline(false) + .title(R.string.project) + .addItem(MaterialAboutActionItem.Builder() + .icon(R.drawable.ic_baseline_sanitizer_24) + .text(R.string.github) + .setOnClickAction { + requireContext().launchCustomTab(Uri.parse( + "https://github.com/nekohasekai/SagerNet" + )) + } + .build() + ) + .addItem(MaterialAboutActionItem.Builder() + .icon(R.drawable.ic_qu_shadowsocks_foreground) + .text(R.string.telegram) + .setOnClickAction { + requireContext().launchCustomTab(Uri.parse( + "https://t.me/SagerNet" + )) + } + .build()) + .addItem(MaterialAboutActionItem.Builder() + .icon(R.drawable.ic_action_copyright) + .text(R.string.oss_licenses) + .setOnClickAction { + startActivity(Intent(context, LicenseActivity::class.java)) + } + .build()) + .build()) + .build() + + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + view.findViewById(R.id.mal_recyclerview).apply { + overScrollMode = RecyclerView.OVER_SCROLL_NEVER + } + } + } } \ No newline at end of file diff --git a/app/src/main/java/io/nekohasekai/sagernet/ui/LicenseActivity.kt b/app/src/main/java/io/nekohasekai/sagernet/ui/LicenseActivity.kt new file mode 100644 index 00000000..78a8a5df --- /dev/null +++ b/app/src/main/java/io/nekohasekai/sagernet/ui/LicenseActivity.kt @@ -0,0 +1,66 @@ +/****************************************************************************** + * * + * Copyright (C) 2021 by nekohasekai * + * Copyright (C) 2021 by Max Lv * + * Copyright (C) 2021 by Mygod Studio * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + * * + ******************************************************************************/ + +package io.nekohasekai.sagernet.ui + +import android.os.Bundle +import android.widget.TextView +import androidx.appcompat.app.AppCompatActivity +import com.mikepenz.aboutlibraries.LibsBuilder +import io.nekohasekai.sagernet.R +import io.nekohasekai.sagernet.ktx.onMainDispatcher +import io.nekohasekai.sagernet.ktx.runOnDefaultDispatcher +import io.nekohasekai.sagernet.widget.ListHolderListener + +class LicenseActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + setContentView(R.layout.layout_license) + + setSupportActionBar(findViewById(R.id.toolbar)) + supportActionBar?.apply { + setTitle(R.string.oss_licenses) + setDisplayHomeAsUpEnabled(true) + setHomeAsUpIndicator(R.drawable.ic_navigation_close) + } + ListHolderListener.setup(this) + + val libs = LibsBuilder() + .withAboutIconShown(false) + .withExcludedLibraries( + // Can't parse ${project.artifactId} in pom.xml + "cn_hutool__hutool_core", + "cn_hutool__hutool_json" + ) + .supportFragment() + + supportFragmentManager.beginTransaction().replace(R.id.fragment_holder, libs) + .commitAllowingStateLoss() + } + + override fun onSupportNavigateUp(): Boolean { + finish() + return true + } + +} \ No newline at end of file diff --git a/app/src/main/java/io/nekohasekai/sagernet/ui/SettingsPreferenceFragment.kt b/app/src/main/java/io/nekohasekai/sagernet/ui/SettingsPreferenceFragment.kt index 662f3ab4..f5cdde95 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/ui/SettingsPreferenceFragment.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/ui/SettingsPreferenceFragment.kt @@ -33,7 +33,6 @@ import io.nekohasekai.sagernet.R import io.nekohasekai.sagernet.bg.BaseService import io.nekohasekai.sagernet.database.DataStore import io.nekohasekai.sagernet.database.preference.EditTextPreferenceModifiers -import io.nekohasekai.sagernet.ktx.onMainDispatcher import io.nekohasekai.sagernet.ktx.remove import io.nekohasekai.sagernet.ktx.runOnDefaultDispatcher @@ -43,12 +42,10 @@ class SettingsPreferenceFragment : PreferenceFragmentCompat() { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { preferenceManager.preferenceDataStore = DataStore.configurationStore + DataStore.initGlobal() + addPreferencesFromResource(R.xml.global_preferences) runOnDefaultDispatcher { - DataStore.initGlobal() - onMainDispatcher { - addPreferencesFromResource(R.xml.global_preferences) - } val persistAcrossReboot = findPreference(Key.PERSIST_ACROSS_REBOOT)!! val directBootAware = findPreference(Key.DIRECT_BOOT_AWARE)!! val portSocks5 = findPreference(Key.SOCKS_PORT)!! diff --git a/app/src/main/res/drawable/ic_baseline_bug_report_24.xml b/app/src/main/res/drawable/ic_baseline_bug_report_24.xml new file mode 100644 index 00000000..580f1d9d --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_bug_report_24.xml @@ -0,0 +1,31 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_baseline_sanitizer_24.xml b/app/src/main/res/drawable/ic_baseline_sanitizer_24.xml new file mode 100644 index 00000000..9c70f539 --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_sanitizer_24.xml @@ -0,0 +1,31 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_baseline_update_24.xml b/app/src/main/res/drawable/ic_baseline_update_24.xml new file mode 100644 index 00000000..4d0c5d2b --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_update_24.xml @@ -0,0 +1,31 @@ + + + + + diff --git a/app/src/main/res/layout/layout_about.xml b/app/src/main/res/layout/layout_about.xml index 6a74c44c..f88c0569 100644 --- a/app/src/main/res/layout/layout_about.xml +++ b/app/src/main/res/layout/layout_about.xml @@ -22,10 +22,10 @@ + android:textAppearance="?attr/textAppearanceSubtitle2" /> + android:layout_marginTop="16dp" + android:text="@string/app_desc" + android:textAppearance="?attr/textAppearanceBody2" + android:textColor="?android:textColorSecondary" /> + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/layout_license.xml b/app/src/main/res/layout/layout_license.xml new file mode 100644 index 00000000..90db2d0c --- /dev/null +++ b/app/src/main/res/layout/layout_license.xml @@ -0,0 +1,19 @@ + + + + + + + + + \ 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 eecf8d09..adce4f48 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,5 +1,17 @@ SagerNet + The universal proxy toolchain for Android, written in Kotlin. + + Project + Source code + Telegram update channel + Open source licenses + + Misc + Version + Version (v2ray-core) + Export debug information + Such useful very wow Settings Configuration @@ -263,6 +275,6 @@ No Apply - The universal proxy toolchain for Android, written in Kotlin.\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. + License \ No newline at end of file diff --git a/app/src/main/res/xml/log_paths.xml b/app/src/main/res/xml/log_paths.xml new file mode 100644 index 00000000..68afdc67 --- /dev/null +++ b/app/src/main/res/xml/log_paths.xml @@ -0,0 +1,4 @@ + + + + diff --git a/build.gradle b/build.gradle index 62d9fdca..e7a03493 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { classpath "com.android.tools.build:gradle:4.1.3" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "gradle.plugin.org.mozilla.rust-android-gradle:plugin:0.8.3" - classpath 'com.jaredsburrows:gradle-license-plugin:0.8.90' + classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:8.8.5" } } diff --git a/v2ray b/v2ray index e93dded2..84bdd43a 160000 --- a/v2ray +++ b/v2ray @@ -1 +1 @@ -Subproject commit e93dded26a3fe32412dac972781a749862ead664 +Subproject commit 84bdd43a0c32ca7f2c9289ac2bc87cbb020aa433