Last active
December 12, 2019 03:29
-
-
Save manwithsteelnerves/f5084caab10733f2b26eae307c36f271 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
webView.setOnTouchListener(new View.OnTouchListener() | |
{ | |
@Override | |
public boolean onTouch(View v, MotionEvent event) | |
{ | |
int actionEvent = event.getAction(); | |
switch (actionEvent) | |
{ | |
case MotionEvent.ACTION_DOWN: | |
case MotionEvent.ACTION_UP: | |
if (!v.hasFocus()) | |
{ | |
v.requestFocus(); | |
} | |
if((actionEvent == MotionEvent.ACTION_UP)) | |
{ | |
Rect screenRect = getScreenSize(); | |
if(event.getRawY() > (screenRect.height()/3)) | |
{ | |
adjustableScrollY = (int) (event.getRawY() - (screenRect.height() / 3)); | |
} | |
else | |
{ | |
adjustableScrollY = 0; | |
} | |
} | |
break; | |
} | |
return false; | |
} | |
}); | |
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |
// Call adjustKeyboard based on KeyboardHelper.java (Check Gist) notifications. | |
public void adjustKeyboard(boolean isVisible) | |
{ | |
if(NativePluginHelper.isRunningInFullScreenMode())//Just checkes if FLAG_FULLSCREEN flag is set on Activity | |
{ | |
if (rect.height() >= 0.9f && rect.top <= 0.1f) { | |
if (isVisible) { | |
animateViewProperty(webView, "translationY", -adjustableScrollY, 500); | |
} else { | |
animateViewProperty(webView, "translationY", 0f, 500); | |
adjustableScrollY = 0; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment