diff --git a/app/build.gradle b/app/build.gradle index 72fef42..4c8531f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,39 +3,35 @@ plugins { } android { - compileSdk 31 - + compileSdk 34 defaultConfig { applicationId "org.sucareto.androidhidkeyboard" - minSdk 29 - targetSdk 31 - versionCode 10 - versionName '1.5.1' + minSdk 26 + targetSdk 34 + versionCode 11 + versionName '1.5.2' } buildTypes { release { - minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } buildFeatures { viewBinding true } + namespace 'org.sucareto.androidhidkeyboard' } dependencies { - - implementation 'androidx.appcompat:appcompat:1.4.2' - implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.11.0' } dependencies { - def libsuVersion = '3.2.1' - implementation "com.github.topjohnwu.libsu:core:${libsuVersion}" - implementation "com.github.topjohnwu.libsu:io:${libsuVersion}" + implementation 'com.github.topjohnwu.libsu:io:5.2.2' } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2b9d4ea..a2f46aa 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="org.sucareto.androidhidkeyboard"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <application android:icon="@mipmap/ic_launcher" diff --git a/app/src/main/java/org/sucareto/androidhidkeyboard/Keyboard.java b/app/src/main/java/org/sucareto/androidhidkeyboard/Keyboard.java index f50a0bb..ba74e21 100644 --- a/app/src/main/java/org/sucareto/androidhidkeyboard/Keyboard.java +++ b/app/src/main/java/org/sucareto/androidhidkeyboard/Keyboard.java @@ -22,12 +22,6 @@ public class Keyboard extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); View root_view = ActivityKeyboardBinding.inflate(getLayoutInflater()).getRoot(); - root_view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE - | View.SYSTEM_UI_FLAG_FULLSCREEN - | View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); setContentView(root_view); findViewById(R.id.BtnSpace).setOnTouchListener(new SpaceOnTouch()); @@ -71,18 +65,17 @@ private class SpaceOnTouch implements View.OnTouchListener { @Override public boolean onTouch(View v, MotionEvent e) { switch (e.getAction()) { - case MotionEvent.ACTION_DOWN: + case MotionEvent.ACTION_DOWN -> { v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_PRESS); if (FnEnable) { startActivity(new Intent(Keyboard.this, Mouse.class)); break; } hid.kPress((byte) Integer.parseInt(v.getTag().toString(), 16)); - break; - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_CANCEL: + } + case MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { hid.kRelease((byte) Integer.parseInt(v.getTag().toString(), 16)); - break; + } } return false; } @@ -93,7 +86,7 @@ private class EnterOnTouch implements View.OnTouchListener { @Override public boolean onTouch(View v, MotionEvent e) { switch (e.getAction()) { - case MotionEvent.ACTION_DOWN: + case MotionEvent.ACTION_DOWN -> { v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_PRESS); if (FnEnable) { hid.kCode = new byte[]{0x05, 0, 0x4c, 0, 0, 0, 0, 0}; @@ -101,16 +94,15 @@ public boolean onTouch(View v, MotionEvent e) { } else { hid.kPress((byte) Integer.parseInt(v.getTag().toString(), 16)); } - break; - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_CANCEL: + } + case MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { if (FnEnable) { hid.kCode = new byte[]{0, 0, 0, 0, 0, 0, 0, 0}; hid.kSend(); } else { hid.kRelease((byte) Integer.parseInt(v.getTag().toString(), 16)); } - break; + } } return false; } @@ -121,14 +113,13 @@ private class CtrlKeyOnTouch implements View.OnTouchListener { @Override public boolean onTouch(View v, MotionEvent e) { switch (e.getAction()) { - case MotionEvent.ACTION_DOWN: + case MotionEvent.ACTION_DOWN -> { v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_PRESS); hid.kPress_c((byte) Integer.parseInt(v.getTag().toString(), 16)); - break; - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_CANCEL: + } + case MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { hid.kRelease_c((byte) Integer.parseInt(v.getTag().toString(), 16)); - break; + } } return false; } @@ -139,14 +130,13 @@ private class KeyOnTouch implements View.OnTouchListener { @Override public boolean onTouch(View v, MotionEvent e) { switch (e.getAction()) { - case MotionEvent.ACTION_DOWN: + case MotionEvent.ACTION_DOWN -> { v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_PRESS); hid.kPress((byte) Integer.parseInt(v.getTag().toString(), 16)); - break; - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_CANCEL: + } + case MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { hid.kRelease((byte) Integer.parseInt(v.getTag().toString(), 16)); - break; + } } return false; } @@ -157,16 +147,14 @@ private class FnKeyOnTouch implements View.OnTouchListener { @Override public boolean onTouch(View v, MotionEvent e) { switch (e.getAction()) { - case MotionEvent.ACTION_DOWN: + case MotionEvent.ACTION_DOWN -> { v.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_PRESS); FnEnable = true; - break; - case MotionEvent.ACTION_UP: - case MotionEvent.ACTION_CANCEL: - FnEnable = false; - break; - default: + } + case MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> FnEnable = false; + default -> { return false; + } } ((Button) findViewById(R.id.Btn12)).setText(getResources().getString(FnEnable ? R.string.KeyText78 : R.string.KeyText12));//Insert findViewById(R.id.Btn12).setTag(getResources().getString(FnEnable ? R.string.KeyCode78 : R.string.KeyCode12)); diff --git a/build.gradle b/build.gradle index 7b2734d..57e94aa 100644 --- a/build.gradle +++ b/build.gradle @@ -5,13 +5,10 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.2.2' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files + classpath 'com.android.tools.build:gradle:8.2.2' } } -task clean(type: Delete) { +tasks.register('clean', Delete) { delete rootProject.buildDir } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 52f5917..6826e61 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,6 +14,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # AndroidX package structure to make it clearer which packages are bundled with the # Android operating system, and which are packaged with your app"s APK # https://developer.android.com/topic/libraries/support-library/androidx-rn -android.useAndroidX=true -# Automatically convert third-party libraries to use AndroidX -android.enableJetifier=true \ No newline at end of file +android.useAndroidX=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 69f188e..bee36e6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed Dec 22 22:30:28 CST 2021 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME