diff --git a/.github/workflows/make-apk.yml b/.github/workflows/make-apk.yml index f580d04..ea334de 100644 --- a/.github/workflows/make-apk.yml +++ b/.github/workflows/make-apk.yml @@ -12,36 +12,37 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'zulu' # See 'Supported distributions' for available options - java-version: '11' + java-version: '17' - name: Checkout repo uses: actions/checkout@v3 - - name: Cache debug certificate - uses: actions/cache@v3 - with: - path: _build/debug.keystore - key: debug-keystore - - name: Restore debug keystore from github Secrets + - name: Restore debug keystore from GitHub Secrets run: | - mkdir -p _build - cd "_build" # Check if exist and use the secret named DEBUG_KEYSTORE # The contents of the secret can be obtained - - # from the debug.keystore.asc from you local _build folder + # from the debug.keystore.asc from you local folder (refer to CONTRIBUTING.md#Using the local debug.keystore on the Github CI actions) if [[ ! "${{ secrets.DEBUG_KEYSTORE }}" = "" ]]; then echo "${{ secrets.DEBUG_KEYSTORE }}" > "debug.keystore.asc" if [[ -s "debug.keystore.asc" ]]; then + echo "Restoring debug keystore from GitHub secrets" gpg -d --passphrase "debug0" --batch "debug.keystore.asc" > "debug.keystore" fi fi - - name: Build - run: make + - name: Build debug APK + uses: gradle/gradle-build-action@v2 + env: + DEBUG_KEYSTORE: "debug.keystore" + DEBUG_KEYSTORE_PASSWORD: debug0 + DEBUG_KEY_ALIAS: debug + DEBUG_KEY_PASSWORD: debug0 + with: + arguments: assembleDebug - name: Artifact naming run: | artifact="${{github.repository_owner}} ${{github.ref_name}}" artifact="${artifact//\//-}" # replace slashes echo "artifact=${artifact}" >> $GITHUB_ENV - - name: Save debug apk + - name: Upload debug APK uses: actions/upload-artifact@v3 with: name: "${{env.artifact}} debug_apk" - path: _build/*.apk + path: build/outputs/apk/debug/*.apk diff --git a/.gitignore b/.gitignore index 8a08a4a..397d793 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,12 @@ *.keystore *.keystore.asc -_build /*-keystore.conf +*.iml +.gradle +/local.properties +/.idea +.DS_Store +/captures +/build +# Directory _build is not used anymore +/_build diff --git a/AndroidManifest.xml b/AndroidManifest.xml index a9bb792..ed0b60f 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,6 +1,5 @@ - - + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 487e268..9af5fa1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,52 +4,44 @@ Thanks for contributing :) ## Building the app -The application doesn't use Gradle and it might be hard to use some features of -Android Studio. - -Fortunately, there's not many dependencies: -- OpenJDK 8 +The application uses Gradle and can be used with Android Studio, but using +Android Studio is not required. The build dependencies are: +- OpenJDK 17 - Android SDK: build tools (minimum `28.0.1`), platform `30` -- Make sure to have the `$ANDROID_HOME` environment variable set. + +Python 3 is required to update generated files but not to build the app. + +For Android Studio users, no more setup is needed. For Nix users, the right environment can be obtained with `nix-shell ./shell.nix`. Instructions to install Nix are [here](https://nixos.wiki/wiki/Nix_Installation_Guide). +If you don't use Android Studio or Nix, you have to inform Gradle about the +location of your Android SDK by either: +- Setting the `ANDROID_HOME` environment variable to point to the android sdk or +- Creating the file `local.properties` and writing + `sdk.dir=` into it. + Building the debug apk: ```sh -make +./gradlew assembleDebug ``` -If the build succeed, the debug apk is located in `_build/juloo.keyboard2.debug.apk`. - -## Using the local debug.keystore on the Github CI actions - -It's possible to save the local debug.keystore into a github secret, so the same keystore is utilized to build the debug apk in the CI github actions. -Doing this, they wil have the same signature, thus the debug apk can be updated without having to uninstall it first. - -After you sucessfully run `make`, (thus a debug.keystore exists) you can use this second command to generate a base64 stringified version of it - -```sh -cd _build -gpg -c --armor --pinentry-mode loopback --passphrase debug0 --yes "debug.keystore" -``` - -A file will be generated inside the local `_build/` folder, called `debug.keystore.asc` - -You can copy the content of this file, and with that, paste it into a new github secret in your repo settings. - -The secret must be named `DEBUG_KEYSTORE` +If the build succeeds, the debug apk is located in `build/outputs/apk/debug/app-debug.apk`. ## Debugging on your phone First [Enable adb debugging on your device](https://developer.android.com/studio/command-line/adb#Enabling). -Then connect your phone to your computer using an USB cable or wireless +Then connect your phone to your computer using an USB cable or via wireless debugging. +If you use Android Studio, this process will be automatic and you don't have to +follow this guide anymore. + And finally, install the application with: ```sh -make installd +./gradlew installDebug ``` The released version of the application won't be removed, both versions will @@ -57,11 +49,13 @@ be installed at the same time. ## Debugging the application: INSTALL_FAILED_UPDATE_INCOMPATIBLE -`make installd` can fail with the following error message: +`./gradlew installDebug` can fail with the following error message: ``` -adb: failed to install _build/juloo.keyboard2.debug.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package juloo.keyboard2.debug signatures do not match previously installed version; ignoring!] -make: *** [Makefile:20: installd] Error 1 +FAILURE: Build failed with an exception. +* What went wrong: +Execution failed for task ':installDebug'. +> java.util.concurrent.ExecutionException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package juloo.keyboard2.debug signatures do not match newer version; ignoring! ``` The application can't be "updated" because the temporary certificate has been @@ -70,9 +64,24 @@ The application must be enabled again in the settings. ```sh adb uninstall juloo.keyboard2.debug -make installd +./gradlew installDebug ``` +## Specifying a debug signing certificate on Github Actions + +It's possible to specify the signing certificate that the automated build +should use. +After you successfully run `./gradlew asssembleDebug`, (thus a debug.keystore +exists) you can use this second command to generate a base64 stringified +version of it: + +```sh +gpg -c --armor --pinentry-mode loopback --passphrase debug0 --yes "debug.keystore" +``` + +This will create the file `debug.keystore.asc`, paste its content into a new +Github secret named `DEBUG_KEYSTORE`. + ## Guidelines ### Adding a layout @@ -89,17 +98,18 @@ The layout file must be placed in the `res/xml/` directory and named according t - layout name (eg. the name of a standard) - country code (or language code if more adequate) -Then, run `make gen_layouts` to add the layout to the app. +Then, run `./gradlew genLayoutsList` to add the layout to the app. The last step will update the file `res/values/layouts.xml`, that you should not edit directly. -Run `make check_layouts` to check some properties about your layout. This will -change the file `check_layout.output`, which you should commit. +Run `./gradlew checkKeyboardLayouts` to check some properties about your +layout. This will change the file `check_layout.output`, which you should +commit. #### Adding a programming layout -A programming layout must contains every ASCII characters. +A programming layout must contain all ASCII characters. The current programming layouts are: QWERTY, Dvorak and Colemak. See for example, Dvorak, added in https://github.com/Julow/Unexpected-Keyboard/pull/16 @@ -161,7 +171,7 @@ default translation in `res/values/strings.xml`, which contain the structure of the file and the English strings. To check that `strings.xml` is formatted correctly, run -`python sync_translations.py`. This will modify your files. +`./gradlew syncTranslations`. This will modify your files. The store description is found in `metadata/android//`, `short_description.txt` and `full_description.txt`. diff --git a/Makefile b/Makefile deleted file mode 100644 index b86019a..0000000 --- a/Makefile +++ /dev/null @@ -1,139 +0,0 @@ -# Configuration - -PACKAGE_NAME = juloo.keyboard2 - -ANDROID_PLATFORM_VERSION = android-30 -JAVA_VERSION = 1.7 - -SRC_DIR = srcs -RES_DIR = res - -EXTRA_JARS = - -# / - -debug: _build/$(PACKAGE_NAME).debug.apk -release: _build/$(PACKAGE_NAME).apk - -installd: _build/$(PACKAGE_NAME).debug.apk - adb install -r "$<" - -clean: - rm -rf _build/*.dex _build/class _build/gen _build/*.apk _build/*.unsigned-apk \ - _build/*.idsig _build/assets - -rebuild_special_font: _build/special_font.ttf - cp "$<" srcs/special_font/result.ttf - -sync_translations: - python sync_translations.py - -check_layouts: - python check_layout.py $(wildcard res/xml/*.xml) > check_layout.output - -gen_layouts: - python gen_layouts.py - -# Will modify the source tree. -runtest: rebuild_special_font sync_translations check_layouts gen_layouts - -.PHONY: release debug installd clean rebuild_special_font check_layouts \ - sync_translations runtest gen_layouts - -$(shell mkdir -p _build) - -ifndef ANDROID_HOME -$(error ANDROID_HOME not set) -endif - -ANDROID_BUILD_TOOLS = $(lastword $(sort $(wildcard $(ANDROID_HOME)/build-tools/*))) -ANDROID_PLATFORM = $(ANDROID_HOME)/platforms/$(ANDROID_PLATFORM_VERSION) - -ifeq ($(shell [ -d "$(ANDROID_PLATFORM)" ] && echo ok),) -$(error Android platform not found. Want $(ANDROID_PLATFORM_VERSION), \ - found $(notdir $(wildcard $(ANDROID_HOME)/platforms/*))) -endif - -JAVAC_FLAGS = -source $(JAVA_VERSION) -target $(JAVA_VERSION) -encoding utf8 - -# Source files - -MANIFEST_FILE = AndroidManifest.xml -JAVA_FILES = $(shell find $(SRC_DIR) -name '*.java') -RES_FILES = $(shell find $(RES_DIR) -type f) - -# Debug signing - -DEBUG_KEYSTORE = _build/debug.keystore -DEBUG_PASSWD = debug0 - -$(DEBUG_KEYSTORE): - echo y | keytool -genkeypair -dname "cn=d, ou=e, o=b, c=ug" \ - -alias debug -keypass $(DEBUG_PASSWD) -keystore "$@" \ - -keyalg rsa -storepass $(DEBUG_PASSWD) -validity 10000 - -_build/%.debug.apk: _build/%.debug.unsigned-apk $(DEBUG_KEYSTORE) - $(ANDROID_BUILD_TOOLS)/apksigner sign --in "$<" --out "$@" \ - --ks $(DEBUG_KEYSTORE) --ks-key-alias debug --ks-pass "pass:$(DEBUG_PASSWD)" - -# Debug apk - -_build/$(PACKAGE_NAME).debug.unsigned-apk: AAPT_PACKAGE_FLAGS+=--rename-manifest-package $(PACKAGE_NAME).debug --product debug - -# Release signing - -# %-keystore.conf should declare KEYSTORE, KEYNAME and KEYSTOREPASS -# it is interpreted as a shell script -_build/%.apk: _build/%.unsigned-apk %-keystore.conf - eval `cat $(word 2,$^)` && \ - $(ANDROID_BUILD_TOOLS)/apksigner sign --in "$<" --out "$@" \ - --ks "$$KEYSTORE" --ks-key-alias "$$KEYNAME" --ks-pass "pass:$$KEYSTOREPASS" - -# Package - -_build/%.unsigned-apk: _build/%.unaligned-apk - $(ANDROID_BUILD_TOOLS)/zipalign -fp 4 "$<" "$@" - -APK_EXTRA_FILES = classes.dex assets/special_font.ttf - -_build/%.unaligned-apk: $(addprefix _build/,$(APK_EXTRA_FILES)) $(MANIFEST_FILE) - $(ANDROID_BUILD_TOOLS)/aapt package -f -M $(MANIFEST_FILE) -S $(RES_DIR) \ - -I $(ANDROID_PLATFORM)/android.jar -F "$@" $(AAPT_PACKAGE_FLAGS) - cd $(@D) && $(ANDROID_BUILD_TOOLS)/aapt add $(@F) $(APK_EXTRA_FILES) - -# Copy the special font file into _build because aapt requires relative paths -_build/assets/special_font.ttf: srcs/special_font/result.ttf - mkdir -p $(@D) - cp "$<" "$@" - -# R.java - -GEN_DIR = _build/gen -R_FILE = $(GEN_DIR)/$(subst .,/,$(PACKAGE_NAME))/R.java - -$(R_FILE): $(RES_FILES) $(MANIFEST_FILE) - mkdir -p "$(@D)" - $(ANDROID_BUILD_TOOLS)/aapt package -f -m -S $(RES_DIR) -J $(GEN_DIR) \ - -M $(MANIFEST_FILE) -I $(ANDROID_PLATFORM)/android.jar - -# Compile java classes and build classes.dex - -OBJ_DIR = _build/class -# A$B.class files are ignored -# CLASS_FILES = $(JAVA_FILES:$(SRC_DIR)/%.java=$(OBJ_DIR)/%.class) \ -# $(R_FILE:$(GEN_DIR)/%.java=$(OBJ_DIR)/%.class) - -_build/classes.dex: $(JAVA_FILES) $(R_FILE) - mkdir -p $(OBJ_DIR) - javac -d $(OBJ_DIR) $(JAVAC_FLAGS) \ - -classpath $(ANDROID_PLATFORM)/android.jar:$(EXTRA_JARS) \ - -sourcepath $(SRC_DIR):$(GEN_DIR) \ - $^ - $(ANDROID_BUILD_TOOLS)/d8 --output $(@D) $(OBJ_DIR)/*/*/* $(subst :, ,$(EXTRA_JARS)) - -# Font file - -FONT_GLYPHS = $(wildcard srcs/special_font/*.svg) - -_build/special_font.ttf: srcs/special_font/build.pe $(FONT_GLYPHS) - fontforge -lang=ff -script $< "$@" $(FONT_GLYPHS) diff --git a/srcs/special_font/result.ttf b/assets/special_font.ttf similarity index 100% rename from srcs/special_font/result.ttf rename to assets/special_font.ttf diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..57beb80 --- /dev/null +++ b/build.gradle @@ -0,0 +1,147 @@ +plugins { + id 'com.android.application' version '8.1.1' +} + +android { + namespace 'juloo.keyboard2' + compileSdk 33 + + defaultConfig { + applicationId "juloo.keyboard2" + minSdk 4 + targetSdkVersion 33 + versionCode 36 + versionName "1.24.0" + } + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['srcs'] + res.srcDirs = ['res'] + assets.srcDirs = ['assets'] + } + } + + signingConfigs { + // Debug builds will always be signed. If no environment variables are set, a default + // keystore will be initialized by the task initDebugKeystore and used. This keystore + // can be uploaded to GitHub secrets by following instructions in CONTRIBUTING.md + // in order to always receive correctly signed debug APKs from the CI. + debug { + storeFile(System.env.DEBUG_KEYSTORE ? file(System.env.DEBUG_KEYSTORE) : file("debug.keystore")) + storePassword(System.env.DEBUG_KEYSTORE_PASSWORD ? "$System.env.DEBUG_KEYSTORE_PASSWORD" : "debug0") + keyAlias(System.env.DEBUG_KEY_ALIAS ? "$System.env.DEBUG_KEY_ALIAS" : "debug") + keyPassword(System.env.DEBUG_KEY_PASSWORD ? "$System.env.DEBUG_KEY_PASSWORD" : "debug0") + } + // Release builds will only be signed with a dedicated key if specified. This key has to be + // created manually. + release { + if (System.env.RELEASE_KEYSTORE) { + storeFile file(System.env.RELEASE_KEYSTORE) + storePassword "$System.env.RELEASE_KEYSTORE_PASSWORD" + keyAlias "$System.env.RELEASE_KEY_ALIAS" + keyPassword "$System.env.RELEASE_KEY_PASSWORD" + } + } + } + + buildTypes { + release { + minifyEnabled true + shrinkResources true + debuggable false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt') + resValue "string", "app_name", "@string/app_name_release" + if (System.env.RELEASE_KEYSTORE) { + signingConfig signingConfigs.release + } + } + debug { + minifyEnabled false + shrinkResources false + debuggable true + applicationIdSuffix ".debug" + resValue "string", "app_name", "@string/app_name_debug" + resValue "bool", "debug_logs", "true" + signingConfig signingConfigs.debug + } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } +} + +dependencies { + +} + +tasks.register('buildKeyboardFont') { + println "\nBuilding assets/special_font.ttf" + mkdir "$buildDir" + exec { + workingDir "$projectDir/srcs/special_font" + def svgFiles = workingDir.listFiles().findAll { + it.isFile() && it.name.endsWith(".svg") + } + commandLine("fontforge", "-lang=ff", "-script", "build.pe", "$buildDir/special_font.ttf", *svgFiles) + } + copy { + from "$buildDir/special_font.ttf" + into "assets" + } +} + +tasks.withType(Test).configureEach { + dependsOn 'genLayoutsList' + dependsOn 'checkKeyboardLayouts' + dependsOn 'syncTranslations' +} + +tasks.register('genLayoutsList') { + println "\nGenerating res/values/layouts.xml" + exec { + workingDir = projectDir + commandLine "python", "gen_layouts.py" + } +} + +tasks.register('checkKeyboardLayouts') { + println "\nChecking layouts" + new ByteArrayOutputStream().withStream { bos -> + exec { + def layouts = new File(projectDir, "res/xml").listFiles().findAll { + it.isFile() && it.name.endsWith(".xml") + } + workingDir = projectDir + commandLine("python", "check_layout.py", *layouts) + standardOutput = bos + } + + new File(projectDir, "check_layout.output").write(bos.toString()) + } +} + +tasks.register('syncTranslations') { + println "\nUpdating translations" + exec { + workingDir = projectDir + commandLine "python", "sync_translations.py" + } +} + +tasks.named("preBuild") { + dependsOn += "initDebugKeystore" +} + +tasks.register('initDebugKeystore') { + if (!file("debug.keystore").exists()) { + println "Initializing default debug keystore" + exec { + // A shell script might be needed if this line requires input from the user + commandLine "keytool", "-genkeypair", "-dname", "cn=d, ou=e, o=b, c=ug", "-alias", "debug", "-keypass", "debug0", "-keystore", "debug.keystore", "-keyalg", "rsa", "-storepass", "debug0", "-validity", "10000" + } + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..72138dd --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Dfile.encoding=UTF-8 +android.useAndroidX=false +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..b32fb16 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Aug 21 18:13:41 CEST 2023 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..4f906e0 --- /dev/null +++ b/gradlew @@ -0,0 +1,185 @@ +#!/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 +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +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='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# 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 + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# 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" + which java >/dev/null 2>&1 || 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 + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# 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"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + 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" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +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" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..107acd3 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@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 +@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=. +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%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="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! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index 85cb835..13be4fb 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -1,7 +1,7 @@ - Klávesnice Unexpected (pro ladění) - Klávesnice Unexpected + Klávesnice Unexpected + Klávesnice Unexpected (pro ladění) Nastavení Klávesnice Unexpected V režimu na výšku V režimu na šířku diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index f7bf7ba..03042e8 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -1,7 +1,7 @@ - Unexpected Keyboard (Debug) - Unexpected Keyboard + Unexpected Keyboard + Unexpected Keyboard (Debug) Unexpected Keyboard - Einstellungen Im Hochformatmodus Im Querformatmodus diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index b403bdc..3e91392 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -1,7 +1,7 @@ - Unexpected Keyboard (debug) - Unexpected Keyboard + Unexpected Keyboard + Unexpected Keyboard (debug) Ajustes de Unexpected Keyboard En modo vertical En modo horizontal diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml index de80960..b4a8bcc 100644 --- a/res/values-fa/strings.xml +++ b/res/values-fa/strings.xml @@ -1,7 +1,7 @@ - صفحه کلید غیرمنتظره - صفحه کلید غیرمنتظره + صفحه کلید غیرمنتظره + صفحه کلید غیرمنتظره تنظیمات صفحه کلید غیرمنتظره در حالت عمودی در حالت افقی diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index d965996..dc99e83 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -1,7 +1,7 @@ - Unexpected Keyboard (debug) - Unexpected Keyboard + Unexpected Keyboard + Unexpected Keyboard (debug) Unexpected Keyboard Paramètres En mode portrait En mode landscape diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index e5cb669..d66e1ce 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -1,7 +1,7 @@ - Unexpected Keyboard (debug) - Unexpected Keyboard + Unexpected Keyboard + Unexpected Keyboard (debug) Impostazioni di Unexpected Keyboard diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml index 08bbeeb..8f08436 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -1,7 +1,7 @@ - - + + Unexpected Keyboard 설정 diff --git a/res/values-lv/strings.xml b/res/values-lv/strings.xml index bf43e00..c1c53aa 100644 --- a/res/values-lv/strings.xml +++ b/res/values-lv/strings.xml @@ -1,7 +1,7 @@ - Unexpected Keyboard (atkļūdošana) - Unexpected Keyboard + Unexpected Keyboard + Unexpected Keyboard (atkļūdošana) Unexpected Keyboard iestatījumi Stateniski Guleniski diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 0699850..0a6f380 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -1,7 +1,7 @@ - Unexpected Keyboard (debug) - Unexpected Keyboard + Unexpected Keyboard + Unexpected Keyboard (debug) Ustawienia Unexpected Keyboard W widoku pionowym W widoku poziomym diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index 45ce72d..5e4e93e 100644 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -1,7 +1,7 @@ - Teclado Unexpected - Teclado Unexpected + Teclado Unexpected + Teclado Unexpected Configurações No modo retrato No modo paisagem diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml index b205dca..d52db9b 100644 --- a/res/values-ro/strings.xml +++ b/res/values-ro/strings.xml @@ -1,7 +1,7 @@ - Tastatură Unexpected (depanare) - Tastatură Unexpected + Tastatură Unexpected + Tastatură Unexpected (depanare) Setări Tastatură Unexpected În mod portret În mod panoramă diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 46e7d42..1ac480a 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -1,7 +1,7 @@ - Unexpected Keyboard (отладка) - Unexpected Keyboard + Unexpected Keyboard + Unexpected Keyboard (отладка) Unexpected Keyboard Настройки В портретном режиме В ландшафтном режиме diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml index 292b64e..71a6565 100644 --- a/res/values-tr/strings.xml +++ b/res/values-tr/strings.xml @@ -1,7 +1,7 @@ - Unexpected Keyboard (debug) - Unexpected Keyboard + Unexpected Keyboard + Unexpected Keyboard (debug) Unexpected Keyboard Ayarları Portre modunda Manzara modunda diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml index 08e7353..a0a0e81 100644 --- a/res/values-vi/strings.xml +++ b/res/values-vi/strings.xml @@ -1,7 +1,7 @@ - Unexpected Keyboard (gỡ lỗi) - Unexpected Keyboard + Unexpected Keyboard + Unexpected Keyboard (gỡ lỗi) Cài đặt Unexpected Keyboard Trong chế độ chân dung Trong chế độ phong cảnh diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index a63133e..642e71a 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -1,7 +1,7 @@ - Unexpected Keyboard (debug) - Unexpected Keyboard + Unexpected Keyboard + Unexpected Keyboard (debug) Unexpected Keyboard 设置 在竖屏模式下 在横屏模式下 diff --git a/res/values/strings.xml b/res/values/strings.xml index 7a80d76..b84f683 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,7 +1,7 @@ - Unexpected Keyboard (debug) - Unexpected Keyboard + Unexpected Keyboard + Unexpected Keyboard (Debug) Unexpected Keyboard Settings In portrait mode In landscape mode diff --git a/res/values/values.xml b/res/values/values.xml index 737e7db..8e40307 100644 --- a/res/values/values.xml +++ b/res/values/values.xml @@ -6,6 +6,5 @@ 250dp 28dp 28dp - true - false + false diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..649cd46 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,17 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +rootProject.name = "Unexpected-Keyboard" diff --git a/srcs/juloo.keyboard2/Theme.java b/srcs/juloo.keyboard2/Theme.java index b5e5b88..8539edb 100644 --- a/srcs/juloo.keyboard2/Theme.java +++ b/srcs/juloo.keyboard2/Theme.java @@ -1,7 +1,6 @@ package juloo.keyboard2; import android.content.Context; -import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Color; import android.graphics.Paint;