Skip to content
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

[TIMOB-23757] Android: Fix TextField keyboard overlap #8922

Merged
merged 1 commit into from Apr 12, 2017

Conversation

garymathews
Copy link
Contributor

TEST CASE
var win = Ti.UI.createWindow({
        backgroundColor : 'white'
    }),
    a = Ti.UI.createTextField({
        bottom : 10,
        width: '90%',
        textAlign : Titanium.UI.TEXT_ALIGNMENT_RIGHT,
        color: 'black'
    });

win.add(a);
win.open();

JIRA Ticket

Copy link
Contributor

@frankieandone frankieandone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight compile errors to fix and some other suggestions but on the whole great job! 👍

@@ -433,6 +436,18 @@ protected KrollDict getFocusEventObject(boolean hasFocus)
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent keyEvent)
{
// TIMOB-23757: https://code.google.com/p/android/issues/detail?id=182191
if (Build.VERSION.SDK_INT < 24 && (getGravity() & Gravity.LEFT) != Gravity.LEFT) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change from getGravity() to v.getGravity()?


import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add import android.view.Gravity?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change spaces to tabs?

}
Context context = TiApplication.getInstance().getApplicationContext();
InputMethodManager inputManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(tv.getWindowToken(), 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change 0 to InputMethodManager.RESULT_UNCHANGED_SHOWN?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hideSoftInputFromWindow 0 is used for the flags. I'm not using the ResultReceiver.

@ssjsamir
Copy link
Contributor

@garymathews After testing this I am still seeing the problem on a Nexus 6 Device running Android 6.0.1.

Steps taken:

  • Copied the test case from the description above
  • Tested the test case with the build from this PR
  • Pressed the text box and entered the text which was visible
  • Pressed the back button the device
  • Pressed the text box again and this time the text box was not visible

Environment
Appcelerator Command-Line Interface, version 6.1.0
Google Nexus 6P (Android 7.1.1)
Operating System Name: Mac OS X El Capitan
Operating System Version: 10.11.6
Node.js Version: 4.6.0
npm: 4.2.8
Xcode: 8.2
Appcelerator Studio: 4.8.1.201612050850

@garymathews
Copy link
Contributor Author

@ssjsamir Updated PR

@ssjsamir
Copy link
Contributor

FR - Passed,
@garymathews After testing again on the Nexus 6 (6.0.1),Nexus 5x (6.0.1) and Nexus 6P (7.1.1) I am no longer seeing an overlap between the text field and the keyboard.

Test steps

  • Copied the test case from the description above
  • Tested the test case with the build from this PR
  • Pressed the text box and entered the text which was visible
  • Pressed the back button on the device
  • Pressed the text box again and this time the text box was not overlapping with the keyboard.

Environment
Appcelerator Command-Line Interface, version 6.1.0
Google Nexus 6 (6.0.1)
Google Nexus 5x (6.0.1)
Google Nexus 6P (Android 7.1.1)
Operating System Name: Mac OS X El Capitan
Operating System Version: 10.11.6
Node.js Version: 4.6.0
npm: 4.2.8
Xcode: 8.2
Appcelerator Studio: 4.8.1.201612050850

@ssjsamir ssjsamir merged commit 864c18a into tidev:master Apr 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants