From 7ccf5758e349490674f8ca72e14c0887676fc8f3 Mon Sep 17 00:00:00 2001 From: Syuugo Date: Sun, 5 Jan 2025 10:15:14 +0900 Subject: [PATCH] v2.1.0 --- .github/workflows/build.yml | 73 ++---------------- .gitignore | 2 + README.md | 31 ++++---- app/build.gradle | 42 ++++------ app/proguard-rules.pro | 1 - app/src/main/AndroidManifest.xml | 8 +- .../java/androidx/annotation/NonNull.java | 36 +++++++++ .../me/s1204/benesse/touch/test/Tester.java | 67 ++++++++-------- app/src/main/res/layout/layout_getint.xml | 9 +-- app/src/main/res/layout/layout_getstring.xml | 8 +- app/src/main/res/layout/layout_putint.xml | 13 ++-- app/src/main/res/layout/layout_putstring.xml | 11 ++- app/src/main/res/values/strings.xml | 34 ++++++++ gradle/wrapper/gradle-wrapper.jar | Bin 43504 -> 43583 bytes gradle/wrapper/gradle-wrapper.properties | 4 +- gradlew | 3 +- settings.gradle | 2 +- 17 files changed, 168 insertions(+), 176 deletions(-) create mode 100644 app/src/main/java/androidx/annotation/NonNull.java create mode 100644 app/src/main/res/values/strings.xml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 14e8d05..504f3ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,19 +2,7 @@ name: Build on: push: - paths: - - '.github/workflows/build.yml' - - 'app/**' - - 'gradle/**' - - '*.gradle' - - '*.properties' workflow_dispatch: - inputs: - release: - description: 'Release' - type: boolean - required: true - default: false jobs: build: @@ -33,77 +21,32 @@ jobs: uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: '17' + java-version: 21 - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 + uses: gradle/actions/setup-gradle@v4 - name: Set environments run: | { - echo "version=v$(grep versionName app/build.gradle | awk '{print $2}' | tr -d \")" + echo "version=v$(grep versionName app/build.gradle | awk -F\" '{print $2}')" echo "commit=$(echo ${{ github.sha }} | cut -c-7)" echo "repo=$(echo ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/})" } >> $GITHUB_ENV - - name: Check tag exists - uses: mukunku/tag-exists-action@v1.6.0 - if: github.event.inputs.release == 'true' - id: check-tag - with: - tag: "${{ env.version }}" - - - name: Release check - if: github.event.inputs.release == 'true' - run: | - if [ "${{ secrets.STORE_FILE }}" == "" ]; then - echo -e "\nERROR!\nTo release, you need to set up a signing key!\n" - echo "STORE_FILE: A Base64 encoded string of the signing key in JKS format" - echo "STORE_PASSWORD: Key store password" - echo "KEY_ALIAS: Key alias" - echo "KEY_PASSWORD: Key password" - echo "" - exit 1 - fi - if [ "${{ steps.check-tag.outputs.exists }}" == "true" ]; then - echo -e "\nERROR!\nThe same tag already exists!\n" - echo "Please change versionName in build.gradle" - echo "" - exit 1 - fi - - - name: Build with Gradle + - name: Build run: | - if [ "${{ inputs.release }}" == "true" ]; then - echo "${{ secrets.STORE_FILE }}" | base64 -d > app/release.jks - export STORE_PASSWORD="${{ secrets.STORE_PASSWORD }}" - export KEY_ALIAS="${{ secrets.KEY_ALIAS }}" - export KEY_PASSWORD="${{ secrets.KEY_PASSWORD }}" - ./gradlew assembleRelease bundleRelease - cp -f app/build/outputs/apk/release/app-release.apk ${{ env.repo }}-${{ env.version }}.apk - cp -f app/build/outputs/bundle/release/app-release.aab ${{ env.repo }}-${{ env.version }}.aab - else - ./gradlew assembleDebug bundleDebug - cp -f app/build/outputs/apk/debug/app-debug.apk ${{ env.repo }}-${{ env.version }}@${{ env.commit }}.apk - cp -f app/build/outputs/bundle/debug/app-debug.aab ${{ env.repo }}-${{ env.version }}@${{ env.commit }}.aab - fi + ./gradlew assembleDebug bundleDebug --no-daemon --stacktrace --warning-mode=all + cp -f app/build/outputs/apk/debug/app-debug.apk ${{ env.repo }}-${{ env.version }}@${{ env.commit }}.apk + cp -f app/build/outputs/bundle/debug/app-debug.aab ${{ env.repo }}-${{ env.version }}@${{ env.commit }}.aab - name: Attest uses: actions/attest-build-provenance@v1 with: subject-path: ${{ env.repo }}-${{ env.version }}*.a* - - name: Upload APK + - name: Upload uses: actions/upload-artifact@v4 with: name: ${{ env.repo }}(${{ env.version }}@${{ env.commit }}) path: ${{ env.repo }}-${{ env.version }}*.a* - - - name: Release - uses: softprops/action-gh-release@v2 - if: github.event.inputs.release == 'true' - with: - tag_name: ${{ env.version }} - draft: true - prerelease: false - files: ${{ env.repo }}-${{ env.version }}.apk diff --git a/.gitignore b/.gitignore index 3774b38..090c1dd 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ build/ # Android Studio Signing APK /app/debug/ /app/release/ +# VS Code +/.vscode/ \ No newline at end of file diff --git a/README.md b/README.md index 3562363..f326abe 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ### 対応機種 - チャレンジパッド3 - ※02.04.000以降 + ※02.00.000以降 - チャレンジパッドNeo - チャレンジパッドNext @@ -32,7 +32,7 @@ CT3 のみ存在します。 - **getInt** : (String), (int) - **bc** から始まる変数の値を返します。 + 特定変数の値を返します。 CT3 には存在しません。 - **getLcdSize** : (void), (Point) @@ -40,22 +40,17 @@ CT3 のみ存在します。 - **getString** : (String), (String) - **bc** から始まる変数の値を返します。 + 特定変数の値を返します。 CT3 では **`bc:mac_address`** のみ取得できます。 - **putInt** : (String, int), (boolean) - **bc** から始まる変数の値を変更します。 + 特定変数の値を変更します。 CT3 には存在しません。 - **putString** : (String, String), (boolean) - 1つ目の引数に、 - - bc:**touchpanel:fw_update** - - bc:**digitizer:fw_update** - - bc:**touchpanel:nvt:fw_update** - + 1つ目の引数に特定変数を入れ、 2つ目の引数に、アップデートファイルのパスを入力します。 - bc:**touchpanel:fts:fw_update** は無視されています。 - 上手く動作していないので推測です。 + bc:**touchpanel:fts:fw_update** は無視されています。 CT3 及び CTX には存在しません。 - **setDchaState** : (int), (void) @@ -73,10 +68,10 @@ これらの変数は CTZ を参照しており、 CT3/CTX では使えない可能性があります。 - bc:**compatscreen** - 画面の密度と比率を変更できます。 - **0**: h(240)dpi 1920x1200 - **1**: m(160)dpi 1024x768 - **2**: m(160)dpi 1200x800 + 画面の密度と比率を変更できます。 + - **0**: h(240)dpi 1920x1200 + - **1**: m(160)dpi 1024x768 + - **2**: m(160)dpi 1200x800 - bc:**digitizer:fw_update** - bc:**digitizer:fw_version** - bc:**touchpanel\:palmreject:size** @@ -93,9 +88,9 @@ - bc:**nightcolor:min** 読書灯の輝度の最小値 : `2596` - bc:**nightmode:active** - 読書灯の状態 - **0** : 無効 - **1** : 有効 + 読書灯の状態 + - **0** : 無効 + - **1** : 有効 - bc:**touchpanel\:palmreject:size** - bc:**pen:battery** - bc:**touchpanel\:nvt:fw_update** diff --git a/app/build.gradle b/app/build.gradle index 1b8722f..2630891 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,15 +3,16 @@ plugins { } android { - namespace 'me.s1204.benesse.touch.test' - compileSdk 34 + namespace = 'me.s1204.benesse.touch.test' + compileSdk = 35 defaultConfig { - minSdk 24 - targetSdk 34 - versionCode 7 - versionName "2.0.1" + minSdk = 24 + targetSdk = 35 + versionCode = 8 + versionName = "2.1.0" proguardFiles += 'proguard-rules.pro' + multiDexEnabled = false } signingConfigs { @@ -21,34 +22,25 @@ android { keyAlias 'android' keyPassword 'android' } - release { - storeFile file('release.jks') - storePassword System.getenv('STORE_PASSWORD') - keyAlias System.getenv('KEY_ALIAS') - keyPassword System.getenv('KEY_PASSWORD') - } } buildTypes { - debug { - minifyEnabled false - multiDexEnabled false - signingConfig signingConfigs.android + configureEach { + signingConfig = signingConfigs.android } release { - minifyEnabled true - shrinkResources true - multiDexEnabled false - signingConfig signingConfigs.android - if (file('release.jks').exists()) { - signingConfig signingConfigs.release - } + minifyEnabled = true + shrinkResources = true } } compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_21 + targetCompatibility JavaVersion.VERSION_21 + } + + lintOptions { + ignore 'Deprecated', 'DiscouragedApi', 'ProtectedPermissions' } } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 222f7c1..297bd72 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,3 +1,2 @@ --ignorewarnings -keepattributes LineNumberTable,SourceFile -renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7b0fa66..cd79fb6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,23 +1,23 @@ - + + android:exported="true" + android:screenOrientation="landscape"> + diff --git a/app/src/main/java/androidx/annotation/NonNull.java b/app/src/main/java/androidx/annotation/NonNull.java new file mode 100644 index 0000000..e8847af --- /dev/null +++ b/app/src/main/java/androidx/annotation/NonNull.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * 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. + */ +package androidx.annotation; +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PACKAGE; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.CLASS; +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +/** + * Denotes that a parameter, field or method return value can never be null. + *

+ * This is a marker annotation and it has no specific attributes. + */ +@Documented +@Retention(CLASS) +@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE}) +public @interface NonNull { +} \ No newline at end of file diff --git a/app/src/main/java/me/s1204/benesse/touch/test/Tester.java b/app/src/main/java/me/s1204/benesse/touch/test/Tester.java index e87e55a..53aa06b 100644 --- a/app/src/main/java/me/s1204/benesse/touch/test/Tester.java +++ b/app/src/main/java/me/s1204/benesse/touch/test/Tester.java @@ -9,8 +9,12 @@ import android.os.Bundle; import android.view.View; import android.widget.EditText; +import android.widget.Spinner; import android.widget.Toast; +import androidx.annotation.NonNull; + +/** @noinspection CallToPrintStackTrace*/ public class Tester extends Activity { private static final String CT3 = "TAB-A03-BR3"; @@ -29,22 +33,19 @@ private void makeText(String msg) { Toast.makeText(this, msg, Toast.LENGTH_LONG).show(); } - private void noClassFound(NoClassDefFoundError e) { - //noinspection CallToPrintStackTrace + private void noClassFound(@NonNull NoClassDefFoundError e) { e.printStackTrace(); makeText("BenesseExtension が存在しません"); finishAndRemoveTask(); } - private void cannotExec(SecurityException e) { - //noinspection CallToPrintStackTrace + private void cannotExec(@NonNull SecurityException e) { e.printStackTrace(); makeText("関数の実行に失敗しました"); //backHome(); } - private void noSuchFunc(NoSuchMethodError e) { - //noinspection CallToPrintStackTrace + private void noSuchFunc(@NonNull NoSuchMethodError e) { e.printStackTrace(); makeText("関数が存在しません"); //backHome(); @@ -88,7 +89,7 @@ public void onCreate(Bundle savedInstanceState) { findViewById(R.id.btn_enableNoSuchFunc).setVisibility(View.INVISIBLE); }); - // checkPassword + // checkPassword(String) findViewById(R.id.btn_checkPassword).setOnClickListener(view -> { setContentView(R.layout.layout_checkpassword); findViewById(R.id.exec).setOnClickListener(view1 -> { @@ -148,18 +149,18 @@ public void onCreate(Bundle savedInstanceState) { } }); - // getInt + // getInt(String) findViewById(R.id.btn_getInt).setOnClickListener(view -> { setContentView(R.layout.layout_getint); findViewById(R.id.exec).setOnClickListener(view13 -> { - EditText variableBox = findViewById(R.id.getInt_variable); - String variable = variableBox.getText().toString(); - if (variable.isEmpty()) { + Spinner varBox = findViewById(R.id.getInt_var); + String var = varBox.toString(); + if (var.isEmpty()) { makeText("値を入力してください"); return; } try { - makeText("実行結果:" + BenesseExtension.getInt(variable)); + makeText("実行結果:" + BenesseExtension.getInt(var)); } catch (NoClassDefFoundError e) { noClassFound(e); } catch (NoSuchMethodError e) { @@ -181,18 +182,18 @@ public void onCreate(Bundle savedInstanceState) { } }); - // getString + // getString(String) findViewById(R.id.btn_getString).setOnClickListener(view -> { setContentView(R.layout.layout_getstring); findViewById(R.id.exec).setOnClickListener(view15 -> { - EditText variableBox = findViewById(R.id.getString_variable); - String variable = variableBox.getText().toString(); - if (variable.isEmpty()) { + Spinner varBox = findViewById(R.id.getString_var); + String var = varBox.toString(); + if (var.isEmpty()) { makeText("値を入力してください"); return; } try { - makeText("実行結果:" + BenesseExtension.getString(variable)); + makeText("実行結果:" + BenesseExtension.getString(var)); } catch (SecurityException e) { cannotExec(e); } catch (NoClassDefFoundError e) { @@ -203,20 +204,20 @@ public void onCreate(Bundle savedInstanceState) { findViewById(R.id.backHome).setOnClickListener(view16 -> backHome()); }); - // putInt + // putInt(String, int) findViewById(R.id.btn_putInt).setOnClickListener(view -> { setContentView(R.layout.layout_putint); findViewById(R.id.exec).setOnClickListener(view17 -> { - EditText putIntBox = findViewById(R.id.putInt_variable); - EditText putIntValueBox = findViewById(R.id.putInt_value); - String variable = putIntBox.getText().toString(); - String value = putIntValueBox.getText().toString(); - if (variable.isEmpty() || value.isEmpty()) { + Spinner varBox = findViewById(R.id.putInt_var); + EditText valBox = findViewById(R.id.putInt_val); + String var = varBox.toString(); + String val = valBox.getText().toString(); + if (var.isEmpty() || val.isEmpty()) { makeText("値を入力してください"); return; } try { - makeText("実行結果:" + BenesseExtension.putInt(variable, Integer.parseInt(value))); + makeText("実行結果:" + BenesseExtension.putInt(var, Integer.parseInt(val))); } catch (NoClassDefFoundError e) { noClassFound(e); } catch (NoSuchMethodError e) { @@ -227,20 +228,20 @@ public void onCreate(Bundle savedInstanceState) { findViewById(R.id.backHome).setOnClickListener(view18 -> backHome()); }); - // putString + // putString(String, String) findViewById(R.id.btn_putString).setOnClickListener(view -> { setContentView(R.layout.layout_putstring); findViewById(R.id.exec).setOnClickListener(view115 -> { - EditText putStringBox = findViewById(R.id.putString_variable); - EditText putStringValueBox = findViewById(R.id.putString_value); - String variable = putStringBox.getText().toString(); - String value = putStringValueBox.getText().toString(); - if (variable.isEmpty() || value.isEmpty()) { + Spinner varBox = findViewById(R.id.putString_var); + EditText valBox = findViewById(R.id.putString_val); + String var = varBox.toString(); + String val = valBox.getText().toString(); + if (var.isEmpty() || val.isEmpty()) { makeText("値を入力してください"); return; } try { - makeText("実行結果:" + BenesseExtension.putString(variable, value)); + makeText("実行結果:" + BenesseExtension.putString(var, val)); } catch (NoClassDefFoundError e) { noClassFound(e); } catch (NoSuchMethodError e) { @@ -251,7 +252,7 @@ public void onCreate(Bundle savedInstanceState) { findViewById(R.id.backHome).setOnClickListener(view19 -> backHome()); }); - // setDchaState + // setDchaState(int) findViewById(R.id.btn_setDchaState).setOnClickListener(view -> { setContentView(R.layout.layout_setdchastate); // setDchaState(0) @@ -298,7 +299,7 @@ public void onCreate(Bundle savedInstanceState) { findViewById(R.id.backHome).setOnClickListener(view114 -> backHome()); }); - // setForcedDisplaySize + // setForcedDisplaySize(int, int) findViewById(R.id.btn_setForcedDisplaySize).setOnClickListener(view -> { setContentView(R.layout.layout_setforceddisplaysize); findViewById(R.id.exec).setOnClickListener(view15 -> { diff --git a/app/src/main/res/layout/layout_getint.xml b/app/src/main/res/layout/layout_getint.xml index 904f2a8..15ab199 100644 --- a/app/src/main/res/layout/layout_getint.xml +++ b/app/src/main/res/layout/layout_getint.xml @@ -22,16 +22,13 @@ android:text="getInt" android:textSize="26sp" /> - + android:entries="@array/get_int" />