├── settings.gradle ├── .idea ├── .gitignore └── migrations.xml ├── store_icon.png ├── app ├── src │ └── main │ │ ├── res │ │ ├── xml │ │ │ ├── shortcuts.xml │ │ │ └── filepaths.xml │ │ ├── drawable-hdpi │ │ │ ├── splash.png │ │ │ └── ic_notification_icon.png │ │ ├── drawable-mdpi │ │ │ ├── splash.png │ │ │ └── ic_notification_icon.png │ │ ├── drawable-xhdpi │ │ │ ├── splash.png │ │ │ └── ic_notification_icon.png │ │ ├── drawable-xxhdpi │ │ │ ├── splash.png │ │ │ └── ic_notification_icon.png │ │ ├── drawable-xxxhdpi │ │ │ ├── splash.png │ │ │ └── ic_notification_icon.png │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_maskable.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_maskable.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_maskable.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_maskable.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_maskable.png │ │ ├── raw │ │ │ └── web_app_manifest.json │ │ ├── values │ │ │ ├── colors.xml │ │ │ └── strings.xml │ │ ├── drawable-anydpi │ │ │ └── shortcut_legacy_background.xml │ │ └── mipmap-anydpi-v26 │ │ │ └── ic_launcher.xml │ │ ├── java │ │ └── net │ │ │ └── tsukumijima │ │ │ └── nxjikkyo │ │ │ └── android │ │ │ ├── DelegationService.java │ │ │ ├── Application.java │ │ │ └── LauncherActivity.java │ │ └── AndroidManifest.xml └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .editorconfig ├── Readme.md ├── gradle.properties ├── License.txt ├── .gitignore ├── gradlew.bat └── gradlew /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /store_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/store_icon.png -------------------------------------------------------------------------------- /app/src/main/res/xml/shortcuts.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/drawable-hdpi/splash.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/drawable-mdpi/splash.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/drawable-xhdpi/splash.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/drawable-xxhdpi/splash.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/drawable-xxxhdpi/splash.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_maskable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/mipmap-hdpi/ic_maskable.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_maskable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/mipmap-mdpi/ic_maskable.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_maskable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/mipmap-xhdpi/ic_maskable.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_maskable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/mipmap-xxhdpi/ic_maskable.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_maskable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/mipmap-xxxhdpi/ic_maskable.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_notification_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/drawable-hdpi/ic_notification_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_notification_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/drawable-mdpi/ic_notification_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_notification_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/drawable-xhdpi/ic_notification_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_notification_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/drawable-xxhdpi/ic_notification_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_notification_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsukumijima/NX-Jikkyo-Android/master/app/src/main/res/drawable-xxxhdpi/ic_notification_icon.png -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_size = 4 8 | indent_style = space 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip 6 | networkTimeout=10000 7 | validateDistributionUrl=true 8 | -------------------------------------------------------------------------------- /.idea/migrations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/net/tsukumijima/nxjikkyo/android/DelegationService.java: -------------------------------------------------------------------------------- 1 | package net.tsukumijima.nxjikkyo.android; 2 | 3 | 4 | public class DelegationService extends com.google.androidbrowserhelper.trusted.DelegationService { 5 | @Override 6 | public void onCreate() { 7 | super.onCreate(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/res/raw/web_app_manifest.json: -------------------------------------------------------------------------------- 1 | {"name":"NX-Jikkyo : ニコニコ実況避難所","short_name":"NX-Jikkyo","start_url":"/","display":"standalone","background_color":"#1E1310","lang":"ja","scope":"/","theme_color":"#0D0807","icons":[{"src":"/assets/images/icons/icon-192px.png","sizes":"192x192","type":"image/png"},{"src":"/assets/images/icons/icon-512px.png","sizes":"512x512","type":"image/png"},{"src":"/assets/images/icons/icon-maskable-192px.png","sizes":"192x192","type":"image/png","purpose":"maskable"},{"src":"/assets/images/icons/icon-maskable-512px.png","sizes":"512x512","type":"image/png","purpose":"maskable"}]} 2 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | 2 | # NX-Jikkyo for Android 3 | 4 | [PWABuilder](https://pwabuilder.com/) を使い作成した、[NX-Jikkyo](https://nx-jikkyo.tsukumijima.net/) ([GitHub](https://github.com/tsukumijima/NX-Jikkyo)) の Android アプリです。 5 | [インストールはこちらから!](https://play.google.com/store/apps/details?id=net.tsukumijima.nxjikkyo.android) 6 | 7 | ## About 8 | 9 | もともと NX-Jikkyo は PWA として実装されており、ブラウザから「ホーム画面に追加」することで、ネイティブアプリのような体験で利用できるようになっています。 10 | とはいえ Google Play ストアに公開されていれば、より多くの方に NX-Jikkyo について知っていただけると考え、試験的に Android アプリとして公開してみました。 11 | 12 | 技術的には、PWABuilder で生成した TWA (Trusted Web Activity) アプリのソースコードを、一部改変の上でビルド後、Google Play ストアに公開しています。 13 | 14 | ## License 15 | 16 | [MIT License](License.txt) 17 | -------------------------------------------------------------------------------- /app/src/main/res/xml/filepaths.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | #F5F5F5 18 | 19 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | android.useAndroidX=true 15 | -------------------------------------------------------------------------------- /app/src/main/java/net/tsukumijima/nxjikkyo/android/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package net.tsukumijima.nxjikkyo.android; 18 | 19 | 20 | public class Application extends android.app.Application { 21 | 22 | @Override 23 | public void onCreate() { 24 | super.onCreate(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2024 tsukumi 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-anydpi/shortcut_legacy_background.xml: -------------------------------------------------------------------------------- 1 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 26 | 27 | [{ 28 | \"relation\": [\"delegate_permission/common.handle_all_urls\"], 29 | \"target\": { 30 | \"namespace\": \"web\", 31 | \"site\": \"https://nx-jikkyo.tsukumijima.net\" 32 | } 33 | }] 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 16 | 18 | 19 | 20 | 21 | 25 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/java/net/tsukumijima/nxjikkyo/android/LauncherActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package net.tsukumijima.nxjikkyo.android; 18 | 19 | import android.content.pm.ActivityInfo; 20 | import android.net.Uri; 21 | import android.os.Build; 22 | import android.os.Bundle; 23 | 24 | 25 | public class LauncherActivity extends com.google.androidbrowserhelper.trusted.LauncherActivity { 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | // Setting an orientation crashes the app due to the transparent background on Android 8.0 31 | // Oreo and below. We only set the orientation on Oreo and above. This only affects the 32 | // splash screen and Chrome will still respect the orientation. 33 | // See https://github.com/GoogleChromeLabs/bubblewrap/issues/496 for details. 34 | if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) { 35 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); 36 | } else { 37 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); 38 | } 39 | } 40 | 41 | @Override 42 | protected Uri getLaunchingUrl() { 43 | // Get the original launch Url. 44 | Uri uri = super.getLaunchingUrl(); 45 | 46 | return uri; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/androidstudio 2 | # Edit at https://www.toptal.com/developers/gitignore?templates=androidstudio 3 | 4 | ### AndroidStudio ### 5 | # Covers files to be ignored for android development using Android Studio. 6 | 7 | # Built application files 8 | *.apk 9 | *.ap_ 10 | *.aab 11 | 12 | # Files for the ART/Dalvik VM 13 | *.dex 14 | 15 | # Java class files 16 | *.class 17 | 18 | # Generated files 19 | bin/ 20 | gen/ 21 | out/ 22 | 23 | # Gradle files 24 | .gradle 25 | .gradle/ 26 | build/ 27 | 28 | # Signing files 29 | .signing/ 30 | 31 | # Local configuration file (sdk path, etc) 32 | local.properties 33 | 34 | # Proguard folder generated by Eclipse 35 | proguard/ 36 | 37 | # Log Files 38 | *.log 39 | 40 | # Android Studio 41 | /*/build/ 42 | /*/local.properties 43 | /*/out 44 | /*/*/build 45 | /*/*/production 46 | captures/ 47 | .navigation/ 48 | *.ipr 49 | *~ 50 | *.swp 51 | 52 | # Keystore files 53 | *.jks 54 | *.keystore 55 | 56 | # Google Services (e.g. APIs or Firebase) 57 | # google-services.json 58 | 59 | # Android Patch 60 | gen-external-apklibs 61 | 62 | # External native build folder generated in Android Studio 2.2 and later 63 | .externalNativeBuild 64 | 65 | # NDK 66 | obj/ 67 | 68 | # IntelliJ IDEA 69 | *.iml 70 | *.iws 71 | /out/ 72 | 73 | # User-specific configurations 74 | .idea/caches/ 75 | .idea/libraries/ 76 | .idea/shelf/ 77 | .idea/workspace.xml 78 | .idea/tasks.xml 79 | .idea/.name 80 | .idea/compiler.xml 81 | .idea/copyright/profiles_settings.xml 82 | .idea/encodings.xml 83 | .idea/misc.xml 84 | .idea/modules.xml 85 | .idea/scopes/scope_settings.xml 86 | .idea/dictionaries 87 | .idea/vcs.xml 88 | .idea/jsLibraryMappings.xml 89 | .idea/datasources.xml 90 | .idea/dataSources.ids 91 | .idea/sqlDataSources.xml 92 | .idea/dynamic.xml 93 | .idea/uiDesigner.xml 94 | .idea/assetWizardSettings.xml 95 | .idea/gradle.xml 96 | .idea/jarRepositories.xml 97 | .idea/navEditor.xml 98 | 99 | # Legacy Eclipse project files 100 | .classpath 101 | .project 102 | .cproject 103 | .settings/ 104 | 105 | # Mobile Tools for Java (J2ME) 106 | .mtj.tmp/ 107 | 108 | # Package Files # 109 | *.war 110 | *.ear 111 | 112 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) 113 | hs_err_pid* 114 | 115 | ## Plugin-specific files: 116 | 117 | # mpeltonen/sbt-idea plugin 118 | .idea_modules/ 119 | 120 | # JIRA plugin 121 | atlassian-ide-plugin.xml 122 | 123 | # Mongo Explorer plugin 124 | .idea/mongoSettings.xml 125 | 126 | # Crashlytics plugin (for Android Studio and IntelliJ) 127 | com_crashlytics_export_strings.xml 128 | crashlytics.properties 129 | crashlytics-build.properties 130 | fabric.properties 131 | 132 | ### AndroidStudio Patch ### 133 | 134 | !/gradle/wrapper/gradle-wrapper.jar 135 | 136 | # End of https://www.toptal.com/developers/gitignore/api/androidstudio 137 | 138 | *.idsig 139 | signing-key-info.txt 140 | .idea/deploymentTargetSelector.xml 141 | 142 | .DS_Store 143 | ._* 144 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 33 | 34 | 37 | 38 | 46 | 47 | 50 | 51 | 54 | 55 | 58 | 59 | 62 | 63 | 66 | 67 | 70 | 71 | 72 | 75 | 76 | 77 | 81 | 83 | 84 | 87 | 88 | 91 | 92 | 95 | 96 | 99 | 100 | 103 | 104 | 107 | 108 | 110 | 111 | 113 | 114 | 116 | 117 | 119 | 120 | 121 | 122 | 124 | 125 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 147 | 148 | 153 | 156 | 157 | 158 | 162 | 163 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 88 | 89 | # Use the maximum available, or set MAX_FD != -1 to use that value. 90 | MAX_FD=maximum 91 | 92 | warn () { 93 | echo "$*" 94 | } >&2 95 | 96 | die () { 97 | echo 98 | echo "$*" 99 | echo 100 | exit 1 101 | } >&2 102 | 103 | # OS specific support (must be 'true' or 'false'). 104 | cygwin=false 105 | msys=false 106 | darwin=false 107 | nonstop=false 108 | case "$( uname )" in #( 109 | CYGWIN* ) cygwin=true ;; #( 110 | Darwin* ) darwin=true ;; #( 111 | MSYS* | MINGW* ) msys=true ;; #( 112 | NONSTOP* ) nonstop=true ;; 113 | esac 114 | 115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 116 | 117 | 118 | # Determine the Java command to use to start the JVM. 119 | if [ -n "$JAVA_HOME" ] ; then 120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 121 | # IBM's JDK on AIX uses strange locations for the executables 122 | JAVACMD=$JAVA_HOME/jre/sh/java 123 | else 124 | JAVACMD=$JAVA_HOME/bin/java 125 | fi 126 | if [ ! -x "$JAVACMD" ] ; then 127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 128 | 129 | Please set the JAVA_HOME variable in your environment to match the 130 | location of your Java installation." 131 | fi 132 | else 133 | JAVACMD=java 134 | if ! command -v java >/dev/null 2>&1 135 | then 136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | fi 142 | 143 | # Increase the maximum file descriptors if we can. 144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 145 | case $MAX_FD in #( 146 | max*) 147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 148 | # shellcheck disable=SC2039,SC3045 149 | MAX_FD=$( ulimit -H -n ) || 150 | warn "Could not query maximum file descriptor limit" 151 | esac 152 | case $MAX_FD in #( 153 | '' | soft) :;; #( 154 | *) 155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 156 | # shellcheck disable=SC2039,SC3045 157 | ulimit -n "$MAX_FD" || 158 | warn "Could not set maximum file descriptor limit to $MAX_FD" 159 | esac 160 | fi 161 | 162 | # Collect all arguments for the java command, stacking in reverse order: 163 | # * args from the command line 164 | # * the main class name 165 | # * -classpath 166 | # * -D...appname settings 167 | # * --module-path (only if needed) 168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 169 | 170 | # For Cygwin or MSYS, switch paths to Windows format before running java 171 | if "$cygwin" || "$msys" ; then 172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command: 206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 207 | # and any embedded shellness will be escaped. 208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 209 | # treated as '${Hostname}' itself on the command line. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -classpath "$CLASSPATH" \ 214 | org.gradle.wrapper.GradleWrapperMain \ 215 | "$@" 216 | 217 | # Stop when "xargs" is not available. 218 | if ! command -v xargs >/dev/null 2>&1 219 | then 220 | die "xargs is not available" 221 | fi 222 | 223 | # Use "xargs" to parse quoted args. 224 | # 225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 226 | # 227 | # In Bash we could simply go: 228 | # 229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 230 | # set -- "${ARGS[@]}" "$@" 231 | # 232 | # but POSIX shell has neither arrays nor command substitution, so instead we 233 | # post-process each arg (as a line of input to sed) to backslash-escape any 234 | # character that might be a shell metacharacter, then use eval to reverse 235 | # that process (while maintaining the separation between arguments), and wrap 236 | # the whole thing up as a single "set" statement. 237 | # 238 | # This will of course break if any of these variables contains a newline or 239 | # an unmatched quote. 240 | # 241 | 242 | eval "set -- $( 243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 244 | xargs -n1 | 245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 246 | tr '\n' ' ' 247 | )" '"$@"' 248 | 249 | exec "$JAVACMD" "$@" 250 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import groovy.xml.MarkupBuilder 18 | 19 | plugins { 20 | id 'com.android.application' 21 | } 22 | 23 | def twaManifest = [ 24 | applicationId: 'net.tsukumijima.nxjikkyo.android', 25 | hostName: 'nx-jikkyo.tsukumijima.net', // The domain being opened in the TWA. 26 | launchUrl: '/', // The start path for the TWA. Must be relative to the domain. 27 | name: 'NX-Jikkyo : ニコニコ実況避難所', // The application name. 28 | launcherName: 'NX-Jikkyo', // The name shown on the Android Launcher. 29 | themeColor: '#0D0807', // The color used for the status bar. 30 | themeColorDark: '#0D0807', // The color used for the dark status bar. 31 | navigationColor: '#0D0807', // The color used for the navigation bar. 32 | navigationColorDark: '#0D0807', // The color used for the dark navbar. 33 | navigationDividerColor: '#0D0807', // The navbar divider color. 34 | navigationDividerColorDark: '#0D0807', // The dark navbar divider color. 35 | backgroundColor: '#1E1310', // The color used for the splash screen background. 36 | enableNotifications: true, // Set to true to enable notification delegation. 37 | // Every shortcut must include the following fields: 38 | // - name: String that will show up in the shortcut. 39 | // - short_name: Shorter string used if |name| is too long. 40 | // - url: Absolute path of the URL to launch the app with (e.g '/create'). 41 | // - icon: Name of the resource in the drawable folder to use as an icon. 42 | shortcuts: [], 43 | // The duration of fade out animation in milliseconds to be played when removing splash screen. 44 | splashScreenFadeOutDuration: 300, 45 | generatorApp: 'PWABuilder', // Application that generated the Android Project 46 | // The fallback strategy for when Trusted Web Activity is not available. Possible values are 47 | // 'customtabs' and 'webview'. 48 | fallbackType: 'customtabs', 49 | enableSiteSettingsShortcut: 'true', 50 | orientation: 'default', 51 | ] 52 | 53 | android { 54 | compileSdkVersion 35 55 | namespace "net.tsukumijima.nxjikkyo.android" 56 | defaultConfig { 57 | applicationId "net.tsukumijima.nxjikkyo.android" 58 | minSdkVersion 23 59 | targetSdkVersion 35 60 | versionCode 1 61 | versionName "1.0.0" 62 | 63 | // The name for the application 64 | resValue "string", "appName", twaManifest.name 65 | 66 | // The name for the application on the Android Launcher 67 | resValue "string", "launcherName", twaManifest.launcherName 68 | 69 | // The URL that will be used when launching the TWA from the Android Launcher 70 | def launchUrl = "https://" + twaManifest.hostName + twaManifest.launchUrl 71 | resValue "string", "launchUrl", launchUrl 72 | 73 | // The URL the Web Manifest for the Progressive Web App that the TWA points to. This 74 | // is used by Chrome OS and Meta Quest to open the Web version of the PWA instead of 75 | // the TWA, as it will probably give a better user experience for non-mobile devices. 76 | resValue "string", "webManifestUrl", 'https://nx-jikkyo.tsukumijima.net/manifest.webmanifest' 77 | 78 | // This is used by Meta Quest. 79 | resValue "string", "fullScopeUrl", 'https://nx-jikkyo.tsukumijima.net/' 80 | 81 | // The hostname is used when building the intent-filter, so the TWA is able to 82 | // handle Intents to open host url of the application. 83 | resValue "string", "hostName", twaManifest.hostName 84 | 85 | // This attribute sets the status bar color for the TWA. It can be either set here or in 86 | // `res/values/colors.xml`. Setting in both places is an error and the app will not 87 | // compile. If not set, the status bar color defaults to #FFFFFF - white. 88 | resValue "color", "colorPrimary", twaManifest.themeColor 89 | 90 | // This attribute sets the dark status bar color for the TWA. It can be either set here or in 91 | // `res/values/colors.xml`. Setting in both places is an error and the app will not 92 | // compile. If not set, the status bar color defaults to #000000 - white. 93 | resValue "color", "colorPrimaryDark", twaManifest.themeColorDark 94 | 95 | // This attribute sets the navigation bar color for the TWA. It can be either set here or 96 | // in `res/values/colors.xml`. Setting in both places is an error and the app will not 97 | // compile. If not set, the navigation bar color defaults to #FFFFFF - white. 98 | resValue "color", "navigationColor", twaManifest.navigationColor 99 | 100 | // This attribute sets the dark navigation bar color for the TWA. It can be either set here 101 | // or in `res/values/colors.xml`. Setting in both places is an error and the app will not 102 | // compile. If not set, the navigation bar color defaults to #000000 - black. 103 | resValue "color", "navigationColorDark", twaManifest.navigationColorDark 104 | 105 | // This attribute sets the navbar divider color for the TWA. It can be either 106 | // set here or in `res/values/colors.xml`. Setting in both places is an error and the app 107 | // will not compile. If not set, the divider color defaults to #00000000 - transparent. 108 | resValue "color", "navigationDividerColor", twaManifest.navigationDividerColor 109 | 110 | // This attribute sets the dark navbar divider color for the TWA. It can be either 111 | // set here or in `res/values/colors.xml`. Setting in both places is an error and the 112 | //app will not compile. If not set, the divider color defaults to #000000 - black. 113 | resValue "color", "navigationDividerColorDark", twaManifest.navigationDividerColorDark 114 | 115 | // Sets the color for the background used for the splash screen when launching the 116 | // Trusted Web Activity. 117 | resValue "color", "backgroundColor", twaManifest.backgroundColor 118 | 119 | // Defines a provider authority for the Splash Screen 120 | resValue "string", "providerAuthority", twaManifest.applicationId + '.fileprovider' 121 | 122 | // The enableNotification resource is used to enable or disable the 123 | // TrustedWebActivityService, by changing the android:enabled and android:exported 124 | // attributes 125 | resValue "bool", "enableNotification", twaManifest.enableNotifications.toString() 126 | 127 | twaManifest.shortcuts.eachWithIndex { shortcut, index -> 128 | resValue "string", "shortcut_name_$index", "$shortcut.name" 129 | resValue "string", "shortcut_short_name_$index", "$shortcut.short_name" 130 | } 131 | 132 | // The splashScreenFadeOutDuration resource is used to set the duration of fade out animation in milliseconds 133 | // to be played when removing splash screen. The default is 0 (no animation). 134 | resValue "integer", "splashScreenFadeOutDuration", twaManifest.splashScreenFadeOutDuration.toString() 135 | 136 | resValue "string", "generatorApp", twaManifest.generatorApp 137 | 138 | resValue "string", "fallbackType", twaManifest.fallbackType 139 | 140 | resValue "bool", "enableSiteSettingsShortcut", twaManifest.enableSiteSettingsShortcut 141 | resValue "string", "orientation", twaManifest.orientation 142 | } 143 | buildTypes { 144 | release { 145 | minifyEnabled true 146 | } 147 | } 148 | compileOptions { 149 | sourceCompatibility JavaVersion.VERSION_1_8 150 | targetCompatibility JavaVersion.VERSION_1_8 151 | } 152 | lintOptions { 153 | checkReleaseBuilds false 154 | } 155 | } 156 | 157 | task generateShorcutsFile { 158 | assert twaManifest.shortcuts.size() < 5, "You can have at most 4 shortcuts." 159 | twaManifest.shortcuts.eachWithIndex { s, i -> 160 | assert s.name != null, 'Missing `name` in shortcut #' + i 161 | assert s.short_name != null, 'Missing `short_name` in shortcut #' + i 162 | assert s.url != null, 'Missing `icon` in shortcut #' + i 163 | assert s.icon != null, 'Missing `url` in shortcut #' + i 164 | } 165 | 166 | def shortcutsFile = new File("$projectDir/src/main/res/xml", "shortcuts.xml") 167 | 168 | def xmlWriter = new StringWriter() 169 | def xmlMarkup = new MarkupBuilder(new IndentPrinter(xmlWriter, " ", true)) 170 | 171 | xmlMarkup 172 | .'shortcuts'('xmlns:android': 'http://schemas.android.com/apk/res/android') { 173 | twaManifest.shortcuts.eachWithIndex { s, i -> 174 | 'shortcut'( 175 | 'android:shortcutId': 'shortcut' + i, 176 | 'android:enabled': 'true', 177 | 'android:icon': '@drawable/' + s.icon, 178 | 'android:shortcutShortLabel': '@string/shortcut_short_name_' + i, 179 | 'android:shortcutLongLabel': '@string/shortcut_name_' + i) { 180 | 'intent'( 181 | 'android:action': 'android.intent.action.MAIN', 182 | 'android:targetPackage': twaManifest.applicationId, 183 | 'android:targetClass': twaManifest.applicationId + '.LauncherActivity', 184 | 'android:data': s.url) 185 | 'categories'('android:name': 'android.intent.category.LAUNCHER') 186 | } 187 | } 188 | } 189 | shortcutsFile.text = xmlWriter.toString() + '\n' 190 | } 191 | 192 | preBuild.dependsOn(generateShorcutsFile) 193 | 194 | repositories { 195 | 196 | } 197 | 198 | dependencies { 199 | implementation fileTree(include: ['*.jar'], dir: 'libs') 200 | implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.5.0' 201 | } 202 | --------------------------------------------------------------------------------