修复一些列bug

This commit is contained in:
2026-08-01 21:44:59 +08:00
parent cc3f273872
commit 562ba8e603
26 changed files with 1181 additions and 1 deletions

35
android/README.md Normal file
View File

@@ -0,0 +1,35 @@
# Android 公示屏 APK
这是景区排队叫号系统的原生 Android 薄壳,只承载两个公开页面:
- 项目列表:`https://queue.nianxx.cn/admin/display`
- 单项目展示:`https://queue.nianxx.cn/display/{项目编码或公示 Token}`
## 现场能力
- 无浏览器地址栏的沉浸式展示,并保持屏幕常亮
- 接管项目卡的网页全屏请求,返回键退出全屏
- 允许叫号音频无需额外手势播放
- 支持上述两个 HTTPS 页面作为 Android 深链
- 仅允许 `queue.nianxx.cn` 的公开公示路径,阻止后台、员工端、外域和明文 HTTP 导航
- 网络或证书异常时显示原生重试页
APK 仍依赖线上服务和 Android System WebView不会把实时队列数据离线复制进安装包。
## 构建
需要 JDK 17+ 和 Android SDK 36Build Tools 36.1.0
```powershell
$env:ANDROID_HOME = 'C:\Users\你的用户名\AppData\Local\Android\Sdk'
.\gradlew.bat testDebugUnitTest lintDebug assembleDebug
```
可安装 APK 位于 `app/build/outputs/apk/debug/app-debug.apk`。Debug APK 适合现场安装验证;正式发布前应使用单位自有密钥生成签名 Release APK。
## 安装与深链验证
```powershell
& "$env:ANDROID_HOME\platform-tools\adb.exe" install -r .\app\build\outputs\apk\debug\app-debug.apk
& "$env:ANDROID_HOME\platform-tools\adb.exe" shell am start -a android.intent.action.VIEW -d 'https://queue.nianxx.cn/display/YYHHC'
```

38
android/app/build.gradle Normal file
View File

@@ -0,0 +1,38 @@
plugins {
id("com.android.application")
}
android {
namespace = "cn.nianxx.queue.display"
compileSdk = 36
buildToolsVersion = "36.1.0"
defaultConfig {
applicationId = "cn.nianxx.queue.display"
minSdk = 23
targetSdk = 36
versionCode = 1
versionName = "1.0.0"
}
buildTypes {
release {
minifyEnabled = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
testOptions {
unitTests {
returnDefaultValues = true
}
}
}
dependencies {
testImplementation("junit:junit:4.13.2")
}

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<application
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@drawable/ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.XQKQueue"
android:usesCleartextTraffic="false"
tools:targetApi="s">
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:exported="true"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="false">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="queue.nianxx.cn" />
<data android:path="/admin/display" />
<data android:pathPrefix="/display/" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,403 @@
package cn.nianxx.queue.display;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.graphics.Color;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.view.WindowInsetsController;
import android.view.WindowManager;
import android.webkit.CookieManager;
import android.webkit.PermissionRequest;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
public final class MainActivity extends Activity {
private FrameLayout root;
private WebView webView;
private ProgressBar progressBar;
private LinearLayout errorView;
private TextView errorDetail;
private View customView;
private WebChromeClient.CustomViewCallback customViewCallback;
private String lastAllowedUrl = NavigationPolicy.START_URL;
private boolean mainFrameFailed;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
configureWindow();
buildContentView();
setContentView(root);
registerPredictiveBackCallback();
String initialUrl = NavigationPolicy.initialUrlOrStart(getIntent().getDataString());
lastAllowedUrl = initialUrl;
webView.loadUrl(initialUrl);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
String target = NavigationPolicy.initialUrlOrStart(intent.getDataString());
exitWebFullscreen();
if (!target.equals(webView.getUrl())) {
webView.loadUrl(target);
}
}
@Override
protected void onResume() {
super.onResume();
webView.onResume();
enterImmersiveMode();
}
@Override
protected void onPause() {
webView.onPause();
super.onPause();
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
enterImmersiveMode();
}
}
@Override
@SuppressLint("GestureBackNavigation")
@SuppressWarnings("deprecation")
public void onBackPressed() {
handleBackNavigation();
}
private void handleBackNavigation() {
if (customView != null) {
exitWebFullscreen();
return;
}
if (webView.canGoBack()) {
webView.goBack();
return;
}
if (NavigationPolicy.isProjectDisplay(lastAllowedUrl)) {
webView.loadUrl(NavigationPolicy.START_URL);
return;
}
finishAfterTransition();
}
private void registerPredictiveBackCallback() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
getOnBackInvokedDispatcher().registerOnBackInvokedCallback(
android.window.OnBackInvokedDispatcher.PRIORITY_DEFAULT,
this::handleBackNavigation);
}
}
@Override
protected void onDestroy() {
if (customView != null) {
root.removeView(customView);
customView = null;
if (customViewCallback != null) {
customViewCallback.onCustomViewHidden();
customViewCallback = null;
}
}
root.removeView(webView);
webView.stopLoading();
webView.setWebChromeClient(null);
webView.setWebViewClient(null);
webView.destroy();
super.onDestroy();
}
private void configureWindow() {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
enterImmersiveMode();
}
@SuppressWarnings("deprecation")
private void enterImmersiveMode() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
getWindow().setDecorFitsSystemWindows(false);
WindowInsetsController controller = getWindow().getInsetsController();
if (controller != null) {
controller.hide(WindowInsets.Type.systemBars());
controller.setSystemBarsBehavior(
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
}
return;
}
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
private void buildContentView() {
root = new FrameLayout(this);
root.setBackgroundColor(Color.BLACK);
webView = createWebView();
root.addView(webView, matchParent());
progressBar = new ProgressBar(this);
FrameLayout.LayoutParams progressLayout = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
Gravity.CENTER);
root.addView(progressBar, progressLayout);
errorView = createErrorView();
errorView.setVisibility(View.GONE);
root.addView(errorView, matchParent());
}
@SuppressLint("SetJavaScriptEnabled")
@SuppressWarnings("deprecation")
private WebView createWebView() {
WebView view = new WebView(this);
view.setBackgroundColor(Color.BLACK);
view.setOverScrollMode(View.OVER_SCROLL_NEVER);
view.setLongClickable(false);
view.setOnLongClickListener(ignored -> true);
boolean debuggable = (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
WebView.setWebContentsDebuggingEnabled(debuggable);
WebSettings settings = view.getSettings();
settings.setJavaScriptEnabled(true);
settings.setDomStorageEnabled(true);
settings.setMediaPlaybackRequiresUserGesture(false);
settings.setJavaScriptCanOpenWindowsAutomatically(false);
settings.setSupportMultipleWindows(false);
settings.setAllowFileAccess(false);
settings.setAllowContentAccess(false);
settings.setGeolocationEnabled(false);
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_NEVER_ALLOW);
settings.setCacheMode(WebSettings.LOAD_DEFAULT);
settings.setUserAgentString(settings.getUserAgentString() + " XQKQueueDisplay/1.0");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
settings.setSafeBrowsingEnabled(true);
}
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
cookieManager.setAcceptThirdPartyCookies(view, false);
view.setWebViewClient(new DisplayWebViewClient());
view.setWebChromeClient(new DisplayWebChromeClient());
return view;
}
private LinearLayout createErrorView() {
LinearLayout panel = new LinearLayout(this);
panel.setOrientation(LinearLayout.VERTICAL);
panel.setGravity(Gravity.CENTER);
panel.setPadding(dp(32), dp(32), dp(32), dp(32));
panel.setBackgroundColor(Color.rgb(245, 248, 246));
TextView title = new TextView(this);
title.setText(R.string.page_unavailable_title);
title.setTextColor(Color.rgb(24, 54, 44));
title.setTextSize(24);
title.setGravity(Gravity.CENTER);
title.setTypeface(title.getTypeface(), android.graphics.Typeface.BOLD);
panel.addView(title, wrapContentWithBottomMargin(dp(12)));
errorDetail = new TextView(this);
errorDetail.setText(R.string.page_unavailable_detail);
errorDetail.setTextColor(Color.rgb(67, 88, 81));
errorDetail.setTextSize(16);
errorDetail.setGravity(Gravity.CENTER);
panel.addView(errorDetail, wrapContentWithBottomMargin(dp(24)));
Button retry = new Button(this);
retry.setText(R.string.retry);
retry.setTextColor(Color.WHITE);
retry.setBackgroundColor(Color.rgb(15, 107, 77));
retry.setOnClickListener(ignored -> {
showLoading();
webView.loadUrl(NavigationPolicy.initialUrlOrStart(lastAllowedUrl));
});
panel.addView(retry, new LinearLayout.LayoutParams(dp(160), dp(52)));
return panel;
}
private void showLoading() {
mainFrameFailed = false;
errorView.setVisibility(View.GONE);
progressBar.setVisibility(View.VISIBLE);
}
private void showError(int messageResource) {
mainFrameFailed = true;
progressBar.setVisibility(View.GONE);
errorDetail.setText(messageResource);
errorView.setVisibility(View.VISIBLE);
}
private void exitWebFullscreen() {
if (customView == null) {
return;
}
root.removeView(customView);
customView = null;
webView.setVisibility(View.VISIBLE);
if (customViewCallback != null) {
WebChromeClient.CustomViewCallback callback = customViewCallback;
customViewCallback = null;
callback.onCustomViewHidden();
}
enterImmersiveMode();
}
private FrameLayout.LayoutParams matchParent() {
return new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
}
private LinearLayout.LayoutParams wrapContentWithBottomMargin(int bottomMargin) {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
params.bottomMargin = bottomMargin;
return params;
}
private int dp(int value) {
return Math.round(value * getResources().getDisplayMetrics().density);
}
private final class DisplayWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
if (!request.isForMainFrame()) {
return false;
}
return blockIfOutsideApp(request.getUrl().toString());
}
@Override
@SuppressWarnings("deprecation")
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return blockIfOutsideApp(url);
}
private boolean blockIfOutsideApp(String url) {
if (NavigationPolicy.isAllowed(url)) {
return false;
}
Toast.makeText(MainActivity.this, R.string.blocked_navigation, Toast.LENGTH_SHORT).show();
return true;
}
@Override
public void onPageStarted(WebView view, String url, android.graphics.Bitmap favicon) {
if (NavigationPolicy.isAllowed(url)) {
lastAllowedUrl = url;
}
showLoading();
}
@Override
public void onPageFinished(WebView view, String url) {
progressBar.setVisibility(View.GONE);
if (!mainFrameFailed) {
errorView.setVisibility(View.GONE);
}
}
@Override
public void onReceivedError(
WebView view,
WebResourceRequest request,
WebResourceError error) {
if (request.isForMainFrame()) {
showError(R.string.page_unavailable_detail);
}
}
@Override
public void onReceivedHttpError(
WebView view,
WebResourceRequest request,
WebResourceResponse errorResponse) {
if (request.isForMainFrame() && errorResponse.getStatusCode() >= 400) {
showError(R.string.page_unavailable_detail);
}
}
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.cancel();
showError(R.string.ssl_error);
}
}
private final class DisplayWebChromeClient extends WebChromeClient {
@Override
public void onProgressChanged(WebView view, int newProgress) {
if (!mainFrameFailed && newProgress < 100 && customView == null) {
progressBar.setVisibility(View.VISIBLE);
} else if (newProgress == 100) {
progressBar.setVisibility(View.GONE);
}
}
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
if (customView != null) {
callback.onCustomViewHidden();
return;
}
customView = view;
customViewCallback = callback;
webView.setVisibility(View.GONE);
progressBar.setVisibility(View.GONE);
errorView.setVisibility(View.GONE);
root.addView(customView, matchParent());
enterImmersiveMode();
}
@Override
public void onHideCustomView() {
exitWebFullscreen();
}
@Override
public void onPermissionRequest(PermissionRequest request) {
request.deny();
}
}
}

View File

@@ -0,0 +1,61 @@
package cn.nianxx.queue.display;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.regex.Pattern;
final class NavigationPolicy {
static final String START_URL = "https://queue.nianxx.cn/admin/display";
private static final String HOST = "queue.nianxx.cn";
private static final String DISPLAY_PREFIX = "/display/";
private static final Pattern DISPLAY_IDENTIFIER = Pattern.compile("[A-Za-z0-9_-]{2,128}");
private NavigationPolicy() {
}
static String initialUrlOrStart(String candidate) {
return isAllowed(candidate) ? candidate : START_URL;
}
static boolean isAllowed(String candidate) {
URI uri = parse(candidate);
if (uri == null
|| !"https".equalsIgnoreCase(uri.getScheme())
|| !HOST.equalsIgnoreCase(uri.getHost())
|| uri.getRawUserInfo() != null
|| (uri.getPort() != -1 && uri.getPort() != 443)) {
return false;
}
String path = uri.getRawPath();
if ("/admin/display".equals(path)) {
return true;
}
if (path == null || !path.startsWith(DISPLAY_PREFIX)) {
return false;
}
String identifier = path.substring(DISPLAY_PREFIX.length());
return DISPLAY_IDENTIFIER.matcher(identifier).matches();
}
static boolean isProjectDisplay(String candidate) {
URI uri = parse(candidate);
return isAllowed(candidate)
&& uri != null
&& uri.getRawPath() != null
&& uri.getRawPath().startsWith(DISPLAY_PREFIX);
}
private static URI parse(String candidate) {
if (candidate == null || candidate.isBlank()) {
return null;
}
try {
return new URI(candidate);
} catch (URISyntaxException ignored) {
return null;
}
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#0F6B4D"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#D8F0E6"
android:pathData="M16,73L36,42L48,57L63,33L93,73Z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M16,74L39,54L50,65L65,48L94,74Z" />
<path
android:fillColor="@android:color/transparent"
android:pathData="M18,82C32,75 43,88 57,81C70,75 80,86 92,79"
android:strokeColor="#D8F0E6"
android:strokeLineCap="round"
android:strokeWidth="5" />
</vector>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">景区排队叫号大屏</string>
<string name="page_unavailable_title">页面暂时无法连接</string>
<string name="page_unavailable_detail">请检查网络连接后重试</string>
<string name="retry">重新加载</string>
<string name="blocked_navigation">已阻止离开公示页面</string>
<string name="ssl_error">安全连接校验失败,请联系管理员</string>
</resources>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.XQKQueue" parent="android:style/Theme.Material.Light.NoActionBar">
<item name="android:fontFamily">sans</item>
<item name="android:windowActionModeOverlay">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorAccent">#0F6B4D</item>
<item name="android:navigationBarColor">#000000</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowLightStatusBar">false</item>
</style>
</resources>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<exclude domain="root" path="." />
<exclude domain="file" path="." />
<exclude domain="database" path="." />
<exclude domain="sharedpref" path="." />
</full-backup-content>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<data-extraction-rules>
<cloud-backup>
<exclude domain="root" path="." />
<exclude domain="file" path="." />
<exclude domain="database" path="." />
<exclude domain="sharedpref" path="." />
</cloud-backup>
<device-transfer>
<exclude domain="root" path="." />
<exclude domain="file" path="." />
<exclude domain="database" path="." />
<exclude domain="sharedpref" path="." />
</device-transfer>
</data-extraction-rules>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="false">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>

View File

@@ -0,0 +1,50 @@
package cn.nianxx.queue.display;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public final class NavigationPolicyTest {
@Test
public void allowsOnlyTheTwoPublicPageFamilies() {
assertTrue(NavigationPolicy.isAllowed("https://queue.nianxx.cn/admin/display"));
assertTrue(NavigationPolicy.isAllowed("https://queue.nianxx.cn:443/admin/display"));
assertTrue(NavigationPolicy.isAllowed("https://queue.nianxx.cn/display/YYHHC"));
assertTrue(NavigationPolicy.isAllowed(
"https://queue.nianxx.cn/display/0123456789abcdef0123456789abcdef01234567"));
assertFalse(NavigationPolicy.isAllowed("https://queue.nianxx.cn/admin"));
assertFalse(NavigationPolicy.isAllowed("https://queue.nianxx.cn/staff"));
assertFalse(NavigationPolicy.isAllowed("https://queue.nianxx.cn/display/YYHHC/extra"));
assertFalse(NavigationPolicy.isAllowed("https://queue.nianxx.cn/display/X"));
}
@Test
public void rejectsUntrustedOrAmbiguousUrls() {
assertFalse(NavigationPolicy.isAllowed("http://queue.nianxx.cn/admin/display"));
assertFalse(NavigationPolicy.isAllowed("https://queue.nianxx.cn.evil.test/display/YYHHC"));
assertFalse(NavigationPolicy.isAllowed("https://queue.nianxx.cn@evil.test/display/YYHHC"));
assertFalse(NavigationPolicy.isAllowed("https://queue.nianxx.cn:444/display/YYHHC"));
assertFalse(NavigationPolicy.isAllowed("https://queue.nianxx.cn/display/YY%2FHHC"));
assertFalse(NavigationPolicy.isAllowed("not a url"));
assertFalse(NavigationPolicy.isAllowed(null));
}
@Test
public void fallsBackToTheProjectListForInvalidDeepLinks() {
assertEquals(
NavigationPolicy.START_URL,
NavigationPolicy.initialUrlOrStart("https://example.com/display/YYHHC"));
assertEquals(
"https://queue.nianxx.cn/display/YYHHC",
NavigationPolicy.initialUrlOrStart("https://queue.nianxx.cn/display/YYHHC"));
}
@Test
public void identifiesDirectProjectDisplaysForBackNavigation() {
assertTrue(NavigationPolicy.isProjectDisplay("https://queue.nianxx.cn/display/YYHHC"));
assertFalse(NavigationPolicy.isProjectDisplay(NavigationPolicy.START_URL));
}
}

3
android/build.gradle Normal file
View File

@@ -0,0 +1,3 @@
plugins {
id "com.android.application" version "9.2.0" apply false
}

View File

@@ -0,0 +1,3 @@
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
org.gradle.configuration-cache=true
android.nonTransitiveRClass=true

Binary file not shown.

View File

@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

248
android/gradlew vendored Normal file
View File

@@ -0,0 +1,248 @@
#!/bin/sh
#
# Copyright © 2015 the original authors.
#
# 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
#
# https://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.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/2d6327017519d23b96af35865dc997fcb544fb40/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

93
android/gradlew.bat vendored Normal file
View File

@@ -0,0 +1,93 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

18
android/settings.gradle Normal file
View File

@@ -0,0 +1,18 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "XQKQueueDisplay"
include(":app")