Skip to content

Added ability to set input type on android #2361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
add82d1
Updated gradle plugin version to 3.5.2
shashi278 Jun 8, 2020
336c636
Support for native services
lerela Jun 25, 2020
5a94d07
Merge pull request #2244 from Chronolife-team/native_services_upstream
AndreMiras Aug 14, 2020
8394ebd
Add recipe for https://docs.aiohttp.org/en/stable/
rambo Oct 5, 2020
de8f339
`libpython3.8m.so` should not have `m` suffix
davidhewitt Aug 4, 2020
b6a6d46
Update versions of ffmpeg and ffpyplayer recipes. Do not enable build…
rnixx Oct 15, 2020
cd0a5e4
Added ability to set input type on android
dwmoffatt Nov 27, 2020
6e48aa9
:pencil2: setup.py: Fix dependency syntax (#2354)
jayvdb Dec 3, 2020
63db01c
:hammer: Support running tests on any arch (#2355)
jayvdb Dec 3, 2020
e62d33c
:green_heart: fix CI (#2368)
obfusk Dec 3, 2020
0c7d273
support activity_launch_mode in webview bootstrap
obfusk Dec 2, 2020
9c84ebd
use WebView_AndroidGetJNIEnv for non-sdl2
obfusk Oct 19, 2020
54d63fa
use main lib for non-sdl2
obfusk Oct 19, 2020
39c701a
add android.permissions p4a module stuff to webview
obfusk Oct 20, 2020
f19d3f7
Merge pull request #2335 from rnixx/ffmpeg_ffpyplayer_upgrade_and_non…
AndreMiras Dec 7, 2020
fb96b2b
Add service information for buildozer.spec
xloem Dec 15, 2020
6892b35
Pull master-only commits into develop: Support for native services
inclement Dec 19, 2020
f79343b
Merge pull request #2376 from inclement/fix_master_only_merges
inclement Dec 22, 2020
981ede6
fix for audiostream/issues/25
xloem Dec 19, 2020
406a258
docs: fix simple typo, pacakged -> packaged (#2377)
timgates42 Dec 23, 2020
db615eb
:bug: Fixes pip command on Travis and bumps actions/setup-python
AndreMiras Dec 28, 2020
73a4c52
Merge pull request #2382 from AndreMiras/feature/fix_travis
AndreMiras Dec 28, 2020
212572d
fix travis
obfusk Dec 28, 2020
60cf882
:arrow_up: Updates to Kivy2
kuzeyron Dec 28, 2020
f592348
Merge pull request #2383 from obfusk/patch-12
AndreMiras Dec 28, 2020
21ad9ba
Merge pull request #2384 from kuzeyron/kivy2_recipe
AndreMiras Dec 28, 2020
61a4d3c
Merge pull request #2375 from xloem/audiostream
AndreMiras Dec 28, 2020
53081b8
Merge pull request #2372 from xloem/patch-1
AndreMiras Dec 28, 2020
5da1684
Merge pull request #2367 from obfusk/patch-10
AndreMiras Dec 28, 2020
fd4bbec
Merge pull request #2340 from obfusk/fix-webview-jni
AndreMiras Dec 28, 2020
0db8184
Merge pull request #2332 from advian-oss/aiohttp_recipe
AndreMiras Dec 28, 2020
cb760ae
Merge pull request #2278 from davidhewitt/patch-1
AndreMiras Dec 28, 2020
f2fff78
Merge pull request #2234 from shashi278/patch-1
AndreMiras Dec 28, 2020
4045557
webview: add mOpenExternalLinksInBrowser field
obfusk Dec 30, 2020
34f0c40
webview: add enableZoom() method
obfusk Dec 30, 2020
358fcbf
Update Pymunk recipe to 6.0.0
viblo Dec 31, 2020
66a292c
Merge pull request #2389 from viblo/pymunk-6.0.0
AndreMiras Jan 1, 2021
3d63a8d
support Python 3.9
obfusk Jan 2, 2021
3850b72
Merge pull request #2394 from obfusk/python3.9-support
AndreMiras Jan 2, 2021
548a908
Merge pull request #2387 from obfusk/webview-ext-browser
AndreMiras Jan 2, 2021
cd81a6f
Merge pull request #2386 from obfusk/webview-zooming
AndreMiras Jan 2, 2021
a81fef3
update openssl to 1.1.1i
obfusk Jan 2, 2021
a2ebea2
update sqlite3 to 3.34.0
obfusk Jan 2, 2021
210a1a2
Fix Pymunk crash on older versions of Android
viblo Jan 3, 2021
c6067df
don't run git pull when not on a branch
obfusk Jan 4, 2021
3ed4cf0
Merge pull request #2397 from obfusk/sqlite3-3.34.0
AndreMiras Jan 5, 2021
16f1c26
Merge pull request #2400 from obfusk/fix-git-pull
AndreMiras Jan 5, 2021
929d727
Merge pull request #2399 from viblo/pymunk-crash
AndreMiras Jan 5, 2021
c37c304
Merge pull request #2396 from obfusk/openssl-1.1.1i
AndreMiras Jan 5, 2021
7f4652a
recipes: add scipy support (#2370)
mzakharo Jan 5, 2021
aadcfc4
Recipe for argon2-cffi (#2398)
Arjun-Somvanshi Jan 5, 2021
eafc5a9
modifications for reproducible builds
obfusk Dec 31, 2020
463aa55
Merge pull request #2390 from obfusk/reproducible-builds
AndreMiras Jan 5, 2021
fe5c909
recipes: scipy - fix build for armeabi-v7a (#2402)
mzakharo Jan 6, 2021
5580004
print recipe ENV on failure and P4A_FULL_DEBUG
mzakharo Jan 7, 2021
0663e54
Merge pull request #2403 from mzakharo/printenv
AndreMiras Jan 7, 2021
1518d9c
PyZQM recipe needs setuptools, list it explicitly in deps (#2404)
rambo Jan 7, 2021
0008018
Added ability to set input type on android
dwmoffatt Nov 27, 2020
a01c353
Merge branch 'Added-Ability-To-Change-Input-Type-Android' of github.c…
dwmoffatt Jan 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Checkout python-for-android
uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1.1.0
uses: actions/setup-python@v2.2.1
with:
python-version: 3.7
- name: Run flake8
Expand All @@ -32,7 +32,7 @@ jobs:
- name: Checkout python-for-android
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1.1.0
uses: actions/setup-python@v2.2.1
with:
python-version: ${{ matrix.python-version }}
- name: Tox tests
Expand Down
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
- type -t deactivate && deactivate || true
- export PATH=/opt/python/3.7.1/bin:$PATH
# Install tox
- pip3.7 install tox>=2.0
- python3.7 -m pip install tox>=2.0
# Install coveralls & dependencies
# Note: pyOpenSSL needed to send the coveralls reports
- pip3.7 install pyOpenSSL
- pip3.7 install coveralls
- python3.7 -m pip install pyOpenSSL
- python3.7 -m pip install coveralls
script:
# ignores test_pythonpackage.py since it runs for too long
- tox -- tests/ --ignore tests/test_pythonpackage.py
Expand Down
2 changes: 2 additions & 0 deletions ci/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class TargetPython(Enum):
# mpmath package with a version >= 0.19 required
'sympy',
'vlc',
# need extra gfortran NDK system add-on
'lapack', 'scipy',
])

BROKEN_RECIPES = {
Expand Down
2 changes: 1 addition & 1 deletion ci/makefiles/osx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ all: install_java upgrade_cython install_android_ndk_sdk install_p4a

install_java:
brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk13
brew install --cask adoptopenjdk13
/usr/libexec/java_home -V

upgrade_cython:
Expand Down
12 changes: 7 additions & 5 deletions doc/source/services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ options.

To create the service, create a python script with your service code
and add a :code:`--service=myservice:/path/to/myservice.py` argument
when calling python-for-android. The ``myservice`` name before the
colon is the name of the service class, via which you will interact
with it later. You can add multiple
:code:`--service` arguments to include multiple services, which you
will later be able to stop and start from your app.
when calling python-for-android, or in buildozer.spec, a
:code:`services = myservice:/path/to/myservice.py` [app] setting.
The ``myservice`` name before the colon is the name of the service
class, via which you will interact with it later. You can add multiple
:code:`--service` arguments to include multiple services, or separate
them with a comma in buildozer.spec, all of which you will later be
able to stop and start from your app.

To run the services (i.e. starting them from within your main app
code), you must use PyJNIus to interact with the java class
Expand Down
2 changes: 1 addition & 1 deletion doc/source/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ particular.
Unpacking an APK
----------------

It is sometimes useful to unpack a pacakged APK to see what is inside,
It is sometimes useful to unpack a packaged APK to see what is inside,
especially when debugging python-for-android itself.

APKs are just zip files, so you can extract the contents easily::
Expand Down
6 changes: 6 additions & 0 deletions pythonforandroid/archs.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ def get_env(self, with_flags_in_cc=True):

env['PATH'] = environ['PATH']

# for reproducible builds
if 'SOURCE_DATE_EPOCH' in environ:
for k in 'LC_ALL TZ SOURCE_DATE_EPOCH PYTHONHASHSEED BUILD_DATE BUILD_TIME'.split():
if k in environ:
env[k] = environ[k]

return env


Expand Down
33 changes: 29 additions & 4 deletions pythonforandroid/bootstraps/common/build/build.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env python3

from gzip import GzipFile
import hashlib
import json
from os.path import (
dirname, join, isfile, realpath,
relpath, split, exists, basename
)
from os import listdir, makedirs, remove
from os import environ, listdir, makedirs, remove
import os
import shlex
import shutil
Expand Down Expand Up @@ -161,16 +163,25 @@ def select(fn):
return False
return not is_blacklist(fn)

def clean(tinfo):
"""cleaning function (for reproducible builds)"""
tinfo.uid = tinfo.gid = 0
tinfo.uname = tinfo.gname = ''
tinfo.mtime = 0
return tinfo

# get the files and relpath file of all the directory we asked for
files = []
for sd in source_dirs:
sd = realpath(sd)
compile_dir(sd, optimize_python=optimize_python)
files += [(x, relpath(realpath(x), sd)) for x in listfiles(sd)
if select(x)]
files.sort() # deterministic

# create tar.gz of thoses files
tf = tarfile.open(tfn, 'w:gz', format=tarfile.USTAR_FORMAT)
gf = GzipFile(tfn, 'wb', mtime=0) # deterministic
tf = tarfile.open(None, 'w', gf, format=tarfile.USTAR_FORMAT)
dirs = []
for fn, afn in files:
dn = dirname(afn)
Expand All @@ -189,8 +200,9 @@ def select(fn):
tf.addfile(tinfo)

# put the file
tf.add(fn, afn)
tf.add(fn, afn, filter=clean)
tf.close()
gf.close()


def compile_dir(dfn, optimize_python=True):
Expand Down Expand Up @@ -485,6 +497,7 @@ def make_package(args):
"service_names": service_names,
"android_api": android_api,
"debug": "debug" in args.build_mode,
"native_services": args.native_services
}
if get_bootstrap_name() == "sdl2":
render_args["url_scheme"] = url_scheme
Expand Down Expand Up @@ -520,9 +533,18 @@ def make_package(args):
versioned_name=versioned_name)

# String resources:
timestamp = time.time()
if 'SOURCE_DATE_EPOCH' in environ:
# for reproducible builds
timestamp = int(environ['SOURCE_DATE_EPOCH'])
private_version = "{} {} {}".format(
args.version,
args.numeric_version,
timestamp
)
render_args = {
"args": args,
"private_version": str(time.time())
"private_version": hashlib.sha1(private_version.encode()).hexdigest()
}
if get_bootstrap_name() == "sdl2":
render_args["url_scheme"] = url_scheme
Expand Down Expand Up @@ -643,6 +665,9 @@ def parse_args_and_make_package(args=None):
ap.add_argument('--service', dest='services', action='append', default=[],
help='Declare a new service entrypoint: '
'NAME:PATH_TO_PY[:foreground]')
ap.add_argument('--native-service', dest='native_services', action='append', default=[],
help='Declare a new native service: '
'package.name.service')
if get_bootstrap_name() != "service_only":
ap.add_argument('--presplash', dest='presplash',
help=('A jpeg file to use as a screen while the '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ protected static ArrayList<String> getLibraries(File libsDir) {
libsList.add("python3.5m");
libsList.add("python3.6m");
libsList.add("python3.7m");
libsList.add("python3.8m");
libsList.add("python3.8");
libsList.add("python3.9");
libsList.add("main");
return libsList;
}
Expand All @@ -63,7 +64,7 @@ public static void loadLibraries(File filesDir, File libsDir) {
// load, and it has failed, give a more
// general error
Log.v(TAG, "Library loading error: " + e.getMessage());
if (lib.startsWith("python3.8") && !foundPython) {
if (lib.startsWith("python3.9") && !foundPython) {
throw new RuntimeException("Could not load any libpythonXXX.so");
} else if (lib.startsWith("python")) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.android.tools.build:gradle:3.5.2'
}
}

Expand Down Expand Up @@ -100,17 +100,18 @@ android {

dependencies {
{%- for aar in aars %}
compile(name: '{{ aar }}', ext: 'aar')
implementation(name: '{{ aar }}', ext: 'aar')
{%- endfor -%}
{%- for jar in jars %}
compile files('src/main/libs/{{ jar }}')
implementation files('src/main/libs/{{ jar }}')
{%- endfor -%}
{%- if args.depends -%}
{%- for depend in args.depends %}
compile '{{ depend }}'
implementation '{{ depend }}'
{%- endfor %}
{%- endif %}
{% if args.presplash_lottie %}
implementation 'com.airbnb.android:lottie:3.4.0'
{%- endif %}
}

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import android.os.Bundle;
import android.os.PowerManager;
import android.util.Log;
import android.view.inputmethod.InputMethodManager;
import android.view.SurfaceView;
import android.view.ViewGroup;
import android.view.View;
Expand Down Expand Up @@ -632,4 +633,12 @@ public void requestPermissionsWithRequestCode(String[] permissions, int requestC
public void requestPermissions(String[] permissions) {
requestPermissionsWithRequestCode(permissions, 1);
}

public static void changeKeyboard(int inputType) {
if (SDLActivity.keyboardInputType != inputType){
SDLActivity.keyboardInputType = inputType;
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.restartInput(mTextEdit);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
--- a/src/main/java/org/libsdl/app/SDLActivity.java
+++ b/src/main/java/org/libsdl/app/SDLActivity.java
@@ -196,6 +196,15 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
@@ -94,6 +94,8 @@
// This is what SDL runs in. It invokes SDL_main(), eventually
protected static Thread mSDLThread;

+ public static int keyboardInputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
+
protected static SDLGenericMotionListener_API12 getMotionListener() {
if (mMotionListener == null) {
if (Build.VERSION.SDK_INT >= 26) {
@@ -196,6 +198,15 @@
Log.v(TAG, "onCreate()");
super.onCreate(savedInstanceState);

+ SDLActivity.initialize();
+ // So we can call stuff from static callbacks
+ mSingleton = this;
Expand All @@ -16,19 +25,19 @@
// Load shared libraries
String errorMsgBrokenLib = "";
try {
@@ -639,7 +648,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
@@ -639,7 +650,7 @@
Handler commandHandler = new SDLCommandHandler();

// Send a message from the SDLMain thread
- boolean sendCommand(int command, Object data) {
+ protected boolean sendCommand(int command, Object data) {
Message msg = commandHandler.obtainMessage();
msg.arg1 = command;
msg.obj = data;
@@ -1051,6 +1061,21 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
@@ -1051,6 +1062,21 @@
return Arrays.copyOf(filtered, used);
}

+ /**
+ * Calls turnActive() on singleton to keep loading screen active
+ */
Expand All @@ -45,11 +54,11 @@
+
+
// APK expansion files support

/** com.android.vending.expansion.zipfile.ZipResourceFile object or null. */
@@ -1341,14 +1366,13 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
@@ -1341,14 +1367,13 @@
};

public void onSystemUiVisibilityChange(int visibility) {
- if (SDLActivity.mFullscreenModeActive && (visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0 || (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
-
Expand All @@ -62,13 +71,21 @@
}
-
}
}
@@ -1475,6 +1499,7 @@ class SDLMain implements Runnable {
}

@@ -1475,6 +1500,7 @@
String[] arguments = SDLActivity.mSingleton.getArguments();

Log.v("SDL", "Running main function " + function + " from library " + library);
+ SDLActivity.mSingleton.appConfirmedActive();
SDLActivity.nativeRunMain(library, function, arguments);

Log.v("SDL", "Finished main function");
@@ -2002,7 +2028,7 @@
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
ic = new SDLInputConnection(this, true);

- outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
+ outAttrs.inputType = SDLActivity.keyboardInputType;
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
| EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */;
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@
<service android:name="{{ args.package }}.Service{{ name|capitalize }}"
android:process=":service_{{ name }}" />
{% endfor %}
{% for name in native_services %}
<service android:name="{{ name }}" />
{% endfor %}

{% if args.billing_pubkey %}
<service android:name="org.kivy.android.billing.BillingReceiver"
Expand Down
Loading