diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..a9e5b1629 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,54 @@ +# This is a basic workflow to help you get started with Actions + +name: Build + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + paths-ignore: + - '**/README.md' + pull_request: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Setup Android NDK + uses: nttld/setup-ndk@v1.0.5 + id: setup-ndk + with: + ndk-version: r21e + add-to-path: false + env: + ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: gradle wrapper && ./gradlew packageDebugUniversalApk + - name: Get app version + run: echo "APP_VERSION=v$(cat ./app/build.gradle | grep -m1 versionName | awk -F \" '{print $2}')" >> $GITHUB_ENV + - name: Get app name + run: echo "APP_NAME=HackersKeyboard-DEBUG#${{ github.run_number }}" >> $GITHUB_ENV + - name: Rename the APK file + run: mv ./app/build/outputs/universal_apk/debug/app-debug-universal.apk ./${{ env.APP_NAME }}.apk + - name: Store generated APK file + uses: actions/upload-artifact@v1 + with: + name: ${{ env.APP_NAME }} + path: ./${{ env.APP_NAME }}.apk diff --git a/app/.gitignore b/app/.gitignore index 67e07b8fe..2286229fc 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1,2 +1,3 @@ /build /release +.cxx/* diff --git a/app/build.gradle b/app/build.gradle index 8158c9691..7bf166924 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,14 +1,15 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 26 + compileSdkVersion 30 defaultConfig { applicationId 'org.pocketworkstation.pckeyboard' - minSdkVersion 14 - targetSdkVersion 26 + minSdkVersion 21 + targetSdkVersion 30 versionCode 1041001 versionName "v1.41.1" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + ndkVersion "21.3.6528147" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' externalNativeBuild { cmake { cppFlags "" @@ -38,9 +39,9 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.android.support:appcompat-v7:27.1.1' - implementation "com.android.support:support-compat:26.0.0" + implementation 'androidx.appcompat:appcompat:1.3.1' + implementation 'androidx.core:core:1.6.0' testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } \ No newline at end of file diff --git a/app/src/main/java/org/pocketworkstation/pckeyboard/ComposeSequence.java b/app/src/main/java/org/pocketworkstation/pckeyboard/ComposeSequence.java index fc08f8b0a..7f09f54d1 100644 --- a/app/src/main/java/org/pocketworkstation/pckeyboard/ComposeSequence.java +++ b/app/src/main/java/org/pocketworkstation/pckeyboard/ComposeSequence.java @@ -16,21 +16,19 @@ package org.pocketworkstation.pckeyboard; -import android.inputmethodservice.InputMethodService; import android.util.Log; import android.util.SparseArray; import android.view.inputmethod.EditorInfo; -import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; interface ComposeSequencing { - public void onText(CharSequence text); - public void updateShiftKeyState(EditorInfo attr); - public EditorInfo getCurrentInputEditorInfo(); + void onText(CharSequence text); + void updateShiftKeyState(EditorInfo attr); + EditorInfo getCurrentInputEditorInfo(); } public class ComposeSequence { diff --git a/app/src/main/java/org/pocketworkstation/pckeyboard/DeadAccentSequence.java b/app/src/main/java/org/pocketworkstation/pckeyboard/DeadAccentSequence.java index 00964a081..c9222030b 100644 --- a/app/src/main/java/org/pocketworkstation/pckeyboard/DeadAccentSequence.java +++ b/app/src/main/java/org/pocketworkstation/pckeyboard/DeadAccentSequence.java @@ -16,10 +16,9 @@ package org.pocketworkstation.pckeyboard; -import java.text.Normalizer; - import android.os.Build; -import android.util.Log; + +import java.text.Normalizer; public class DeadAccentSequence extends ComposeSequence { private static final String TAG = "HK/DeadAccent"; diff --git a/app/src/main/java/org/pocketworkstation/pckeyboard/LatinIME.java b/app/src/main/java/org/pocketworkstation/pckeyboard/LatinIME.java index b33d912f9..cdb8aa941 100644 --- a/app/src/main/java/org/pocketworkstation/pckeyboard/LatinIME.java +++ b/app/src/main/java/org/pocketworkstation/pckeyboard/LatinIME.java @@ -45,8 +45,8 @@ import android.os.Vibrator; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.NotificationManagerCompat; +import androidx.core.app.NotificationCompat; +import androidx.core.app.NotificationManagerCompat; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; diff --git a/build.gradle b/build.gradle index 8d3ef8e5c..d8798b6b0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,14 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - + repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' - + classpath 'com.android.tools.build:gradle:4.2.2' + // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -18,10 +18,14 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() } } task clean(type: Delete) { delete rootProject.buildDir } + +wrapper { + gradleVersion = '5.6.4' +} diff --git a/gradle-wrapper.properties b/gradle-wrapper.properties new file mode 100644 index 000000000..d384d28fd --- /dev/null +++ b/gradle-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 82618cecb..d546deaf0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,6 +6,8 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. +android.enableJetifier=true +android.useAndroidX=true org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit diff --git a/gradlew b/gradlew index cccdd3d51..2fe81a7d9 100644 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or 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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index f9553162f..9618d8d96 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@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 + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @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= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome