SDL: fixed SDL_ANDROID_GetScreenKeyboardTextInputAsync() API, build.sh -q will rebuild only armeabi-v7a package

This commit is contained in:
Sergii Pylypenko
2017-01-10 20:47:35 +02:00
parent f3f5378693
commit a826416f74
8 changed files with 33 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ run_apk=false
sign_apk=false
build_release=true
quick_rebuild=false
QUICK_REBUILD_ARGS=
if [ "$#" -gt 0 -a "$1" = "-s" ]; then
shift
@@ -26,6 +27,7 @@ fi
if [ "$#" -gt 0 -a "$1" = "-q" ]; then
shift
quick_rebuild=true
QUICK_REBUILD_ARGS=APP_ABI=armeabi-v7a
fi
if [ "$#" -gt 0 -a "$1" = "release" ]; then
@@ -169,7 +171,7 @@ strip_libs() {
return 0
}
cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j$NCPU V=1 && \
cd project && env PATH=$NDKBUILDPATH BUILD_NUM_CPUS=$NCPU nice -n19 ndk-build -j$NCPU V=1 $QUICK_REBUILD_ARGS && \
strip_libs && \
cd .. && ./copyAssets.sh && cd project && \
{ if $build_release ; then \

View File

@@ -791,6 +791,7 @@ public class MainActivity extends Activity
public void showScreenKeyboard(final String oldText)
{
Log.i("SDL", "showScreenKeyboard()");
if(Globals.CompatibilityHacksTextInputEmulatesHwKeyboard)
{
showScreenKeyboardWithoutTextInputField(Globals.TextInputKeyboard);
@@ -798,6 +799,7 @@ public class MainActivity extends Activity
}
if(_screenKeyboard != null)
return;
Log.i("SDL", "showScreenKeyboard() - adding keyboard view");
class simpleKeyListener implements OnKeyListener
{
MainActivity _parent;
@@ -817,6 +819,7 @@ public class MainActivity extends Activity
keyCode == KeyEvent.KEYCODE_BUTTON_3 ||
keyCode == KeyEvent.KEYCODE_BUTTON_4 ))
{
Log.i("SDL", "_parent.hideScreenKeyboard()");
_parent.hideScreenKeyboard();
return true;
}
@@ -904,6 +907,7 @@ public class MainActivity extends Activity
public void hideScreenKeyboard()
{
Log.i("SDL", "hideScreenKeyboard()");
if( keyboardWithoutTextInputShown )
showScreenKeyboardWithoutTextInputField(Globals.TextInputKeyboard);
@@ -918,6 +922,7 @@ public class MainActivity extends Activity
DemoRenderer.nativeTextInput( (int)text.charAt(i), (int)text.codePointAt(i) );
}
}
Log.i("SDL", "hideScreenKeyboard() nativeTextInputFinished()");
DemoRenderer.nativeTextInputFinished();
_inputManager.hideSoftInputFromWindow(_screenKeyboard.getWindowToken(), 0);
_videoLayout.removeView(_screenKeyboard);

View File

@@ -5,7 +5,9 @@ APP_MODULES := application sdl-1.2 sdl_main sdl_native_helpers jpeg png ogg flac
# To filter out static libs from all libs in makefile
APP_AVAILABLE_STATIC_LIBS := jpeg png tremor freetype xerces ogg tremor vorbis flac boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread boost_locale glu icudata icutest icui18n icuio icule iculx icutu icuuc sdl_savepng android_support gl4es nanogl
ifeq ($(APP_ABI),)
APP_ABI := armeabi
endif
# The namespace in Java file, with dots replaced with underscores
SDL_JAVA_PACKAGE_PATH := net_sourceforge_clonekeenplus

View File

@@ -442,6 +442,8 @@ int main(int argc, char* argv[])
int accel[5], screenjoy[4], gamepads[4][8];
SDL_Surface *mouse[4];
int screenKeyboardShown = 0;
int asyncTextInput = 0;
char asyncTextInputBuf[256];
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
@@ -694,8 +696,10 @@ int main(int argc, char* argv[])
}
if(evt.key.keysym.sym == SDLK_2)
{
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, 1);
screen = SDL_SetVideoMode(SCREEN_W, SDL_GetVideoSurface()->h + 1, bpp, flags);
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Async text input started");
asyncTextInput = 1;
asyncTextInputBuf[0] = 0;
SDL_ANDROID_GetScreenKeyboardTextInputAsync(asyncTextInputBuf, sizeof(asyncTextInputBuf));
}
if(evt.key.keysym.sym == SDLK_3)
SDL_ANDROID_SetScreenKeyboardButtonShown(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, 0);
@@ -752,6 +756,14 @@ int main(int argc, char* argv[])
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Screen keyboard shown: %d -> %d", screenKeyboardShown, SDL_IsScreenKeyboardShown(NULL));
screenKeyboardShown = SDL_IsScreenKeyboardShown(NULL);
}
if( asyncTextInput )
{
if( SDL_ANDROID_GetScreenKeyboardTextInputAsync(asyncTextInputBuf, sizeof(asyncTextInputBuf)) == SDL_ANDROID_TEXTINPUT_ASYNC_FINISHED)
{
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Async text input: %s", asyncTextInputBuf);
asyncTextInput = 0;
}
}
/* Animate */
x_speed = 500.0 * sin(t * 0.37);

View File

@@ -523,7 +523,6 @@ void SDL_ANDROID_DeferredTextInput()
{
if( SDL_ANDROID_TextInputFinished )
{
SDL_ANDROID_TextInputFinished = 0;
SDL_ANDROID_IsScreenKeyboardShownFlag = 0;
}
}

View File

@@ -306,7 +306,6 @@ void SDL_ANDROID_DeferredTextInput()
{
if( SDL_ANDROID_TextInputFinished )
{
SDL_ANDROID_TextInputFinished = 0;
SDL_ANDROID_IsScreenKeyboardShownFlag = 0;
}
}

View File

@@ -96,6 +96,8 @@ static int themeType = 0;
static int joystickTouchPoints[MAX_JOYSTICKS*2];
static int floatingScreenJoystick = 0;
static int asyncTextInputActive = 0;
static void R_DumpOpenGlState(void);
static inline int InsideRect(const SDL_Rect * r, int x, int y)
@@ -1247,10 +1249,14 @@ SDL_AndroidTextInputAsyncStatus_t SDLCALL SDL_ANDROID_GetScreenKeyboardTextInput
if( SDL_ANDROID_TextInputFinished )
{
SDL_ANDROID_TextInputFinished = 0;
SDL_ANDROID_IsScreenKeyboardShownFlag = 0;
asyncTextInputActive = 0;
return SDL_ANDROID_TEXTINPUT_ASYNC_FINISHED;
}
SDL_ANDROID_CallJavaShowScreenKeyboard(textBuf, textBuf, textBufSize, 1);
if( !SDL_ANDROID_IsScreenKeyboardShownFlag && !asyncTextInputActive )
{
asyncTextInputActive = 1;
SDL_ANDROID_CallJavaShowScreenKeyboard(textBuf, textBuf, textBufSize, 1);
}
return SDL_ANDROID_TEXTINPUT_ASYNC_IN_PROGRESS;
}