From 2b9816ce80a4fc50e84446b1ba924d3f1d9780f0 Mon Sep 17 00:00:00 2001 From: hajdam Date: Tue, 21 Oct 2025 17:24:48 +0200 Subject: [PATCH] Limit android library for F-droid build issue --- README.md | 4 +-- app/build.gradle | 10 ++++--- .../org/exbin/bined/android/CodeAreaCore.java | 5 ++-- .../bined/editor/android/MainActivity.java | 4 +-- .../editor/android/search/SearchDialog.java | 26 +++++++++++-------- build.gradle | 17 ++++++++++-- file_picker/build.gradle | 12 ++++++--- 7 files changed, 52 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index eb34ba5..c3fbc96 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,9 @@ or on Windows: To modify this project, Android Studio is recommended. https://developer.android.com/studio/ -When using Android Studio modify following line in build.gradle file to avoid legacy errors: +When using Android Studio modify `playStore = false` line in build.gradle file to avoid legacy errors: - def playStore = true + playStore = true License ------- diff --git a/app/build.gradle b/app/build.gradle index 8da407e..4c5ccc0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,13 +2,17 @@ plugins { id 'com.android.application' } -def playStore = false +def playStore = rootProject.ext.playstore def materialVersion = '1.6.1' android { namespace 'org.exbin.bined.editor.android' - compileSdk { - version = release(35) + if (playstore) { + compileSdk { + version = release(35) + } + } else { + compileSdk 35 } defaultConfig { diff --git a/app/src/main/java/org/exbin/bined/android/CodeAreaCore.java b/app/src/main/java/org/exbin/bined/android/CodeAreaCore.java index e2cf1f5..3520ca4 100644 --- a/app/src/main/java/org/exbin/bined/android/CodeAreaCore.java +++ b/app/src/main/java/org/exbin/bined/android/CodeAreaCore.java @@ -308,10 +308,9 @@ public abstract class CodeAreaCore extends ViewGroup implements CodeAreaControl } } + @Nonnull @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { - return new BaseInputConnection(this, true) { - - }; + return new BaseInputConnection(this, true); } } diff --git a/app/src/main/java/org/exbin/bined/editor/android/MainActivity.java b/app/src/main/java/org/exbin/bined/editor/android/MainActivity.java index 96ba026..2cd2c06 100644 --- a/app/src/main/java/org/exbin/bined/editor/android/MainActivity.java +++ b/app/src/main/java/org/exbin/bined/editor/android/MainActivity.java @@ -210,14 +210,14 @@ public class MainActivity extends AppCompatActivity implements FileDialog.OnFile if (showKeyboard != keyboardShown) { keyboardShown = showKeyboard; codeArea.requestFocus(); - codeArea.post(() -> { + codeArea.postDelayed(() -> { InputMethodManager im = (InputMethodManager) getApplication().getSystemService(Context.INPUT_METHOD_SERVICE); if (showKeyboard) { im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT); } else { im.hideSoftInputFromWindow(codeArea.getWindowToken(), 0); } - }); + }, 100); } }; private final View.OnKeyListener codeAreaOnKeyListener = new CodeAreaKeyListener(); diff --git a/app/src/main/java/org/exbin/bined/editor/android/search/SearchDialog.java b/app/src/main/java/org/exbin/bined/editor/android/search/SearchDialog.java index d2e0af8..2414cad 100644 --- a/app/src/main/java/org/exbin/bined/editor/android/search/SearchDialog.java +++ b/app/src/main/java/org/exbin/bined/editor/android/search/SearchDialog.java @@ -76,16 +76,18 @@ public class SearchDialog extends AppCompatDialogFragment { keyboardShown = showKeyboard; InputMethodManager im = (InputMethodManager) codeArea.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); codeArea.requestFocus(); - if (showKeyboard) { - // TODO im.setInputMethodAndSubtype(); - im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT); - Dialog dialog = SearchDialog.this.getDialog(); - if (dialog != null) { - dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + codeArea.postDelayed(() -> { + if (showKeyboard) { + // TODO im.setInputMethodAndSubtype(); + im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT); + Dialog dialog = SearchDialog.this.getDialog(); + if (dialog != null) { + dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); + } + } else { + im.hideSoftInputFromWindow(codeArea.getWindowToken(), 0); } - } else { - im.hideSoftInputFromWindow(codeArea.getWindowToken(), 0); - } + }, 100); } }; @@ -267,8 +269,10 @@ public class SearchDialog extends AppCompatDialogFragment { if (keyEvent.getAction() == KeyEvent.ACTION_DOWN) { if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER) { - InputMethodManager im = (InputMethodManager) codeArea.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT); + codeArea.postDelayed(() -> { + InputMethodManager im = (InputMethodManager) codeArea.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); + im.showSoftInput(codeArea, InputMethodManager.SHOW_IMPLICIT); + }, 100); return true; } else if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK) { View fromCursorView = searchView.findViewById(R.id.from_cursor); diff --git a/build.gradle b/build.gradle index 67e1945..2b2e82b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,20 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. + +// Temporary restrict default version to 8.11.1 for F-droid build server issue +// https://gitlab.com/fdroid/admin/-/issues/593 +buildscript { + ext { + // playstore = hasProperty('playstore') + playstore = false + agpVersion = playstore ? '8.13.0' : '8.11.1' + } +} + plugins { - id 'com.android.application' version '8.13.0' apply false - id 'com.android.library' version '8.13.0' apply false + //noinspection GradlePluginVersion + id 'com.android.application' version "${agpVersion}" apply false + //noinspection GradlePluginVersion + id 'com.android.library' version "${agpVersion}" apply false } tasks.register('clean', Delete) { diff --git a/file_picker/build.gradle b/file_picker/build.gradle index 618f13e..defc920 100644 --- a/file_picker/build.gradle +++ b/file_picker/build.gradle @@ -1,16 +1,22 @@ apply plugin: 'com.android.library' -def playStore = false +def playStore = rootProject.ext.playstore def materialVersion = '1.6.1' android { namespace = 'com.rustamg.filedialogs' - compileSdk 35 + if (playstore) { + compileSdk { + version = release(35) + } + } else { + compileSdk 35 + } defaultConfig { if (playStore) { minSdk 24 - materialVersion = '1.12.0' + materialVersion = '1.13.0' } else { multiDexEnabled true minSdk 14