diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 5faab08..c44f573 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,23 +1,48 @@ name: Android CI -on: [push] +on: + push: + release: + types: [published, prereleased] + workflow_dispatch: jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Build with Gradle - run: chmod +x ./gradlew && ./gradlew build - - - name: Upload APK - uses: actions/upload-artifact@v2 - with: - name: app - path: app/**/*.apk + - uses: actions/checkout@v3 + + - name: set up JDK 1.8 + uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: "8" + + - name: Decode keystore + run: | + if [ -n "$KEYSTORE_BASE64" ]; then + echo "$KEYSTORE_BASE64" | base64 --decode > release.keystore + fi + env: + KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} + + - name: Build with Gradle + run: chmod +x ./gradlew && ./gradlew build + env: + KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} + KEY_ALIAS: ${{ secrets.KEY_ALIAS }} + KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: app + path: app/**/*.apk + + - name: Upload release assets + if: ${{ github.event_name == 'release' }} + uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: "app/**/*.apk" diff --git a/.gitignore b/.gitignore index 7bdfe81..46ffc21 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ captures/ # Keystore files *.jks +*.keystore # External native build folder generated in Android Studio 2.2 and later .externalNativeBuild @@ -49,3 +50,6 @@ google-services.json freeline.py freeline/ freeline_project_description.json + +# vim tmp file +*.swp diff --git a/app/build.gradle b/app/build.gradle index 4f38580..bfa5720 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,10 +10,21 @@ android { versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } + signingConfigs { + release { + storeFile rootProject.file('release.keystore') + storePassword System.getenv('KEYSTORE_PASSWORD') + keyAlias System.getenv('KEY_ALIAS') + keyPassword System.getenv('KEY_PASSWORD') + } + } buildTypes { release { - minifyEnabled false + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + if (rootProject.file('release.keystore').exists()) { + signingConfig signingConfigs.release + } } } } diff --git a/app/src/main/java/io/github/tmatz/hackers_unistroke_keyboard/GestureInputMethod.java b/app/src/main/java/io/github/tmatz/hackers_unistroke_keyboard/GestureInputMethod.java index 3d0125a..52e04e8 100644 --- a/app/src/main/java/io/github/tmatz/hackers_unistroke_keyboard/GestureInputMethod.java +++ b/app/src/main/java/io/github/tmatz/hackers_unistroke_keyboard/GestureInputMethod.java @@ -16,6 +16,7 @@ import android.widget.Button; import android.widget.TextView; import android.widget.Toast; +import android.view.inputmethod.*; public class GestureInputMethod extends InputMethodService @@ -101,6 +102,15 @@ public void performEditorAction() getCurrentInputConnection().performEditorAction(getEditorAction()); } + public void showInputMethodPicker() + { + InputMethodManager manager = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE); + if (manager != null) + { + manager.showInputMethodPicker(); + } + } + public void sendText(String str) { getCurrentInputConnection().commitText(str, str.length()); @@ -238,13 +248,20 @@ private void setupExtendKey(final View view) keyboardArea.setVisibility(View.INVISIBLE); - extendKey.setOnClickListener( - new OnClickListener() - { + extendKey.setOnTouchListener( + new OnTouchGestureListener(view.getContext()) + { @Override - public void onClick(View v) + public boolean onSingleTapUp(MotionEvent e) { toggleKeyboadOn(); + return true; + } + + @Override + public void onLongPress(MotionEvent e) + { + showInputMethodPicker(); } private void toggleKeyboadOn() diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 25ea203..8d6d849 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,5 +1,5 @@ - Hacker\'s Unistroke Keyboard + Unistroke Keyboard Unistroke