Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
[Android] fix interaction badcase (#2762)
Browse files Browse the repository at this point in the history
1. keybord show and input (addview)
2. slider children position fix (inScreen?)
  • Loading branch information
lucky-chen authored and YorkShen committed Jul 30, 2019
1 parent 31f7089 commit 2b9d773
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,9 @@ private boolean showSoftKeyboard() {
getHostView().postDelayed(WXThread.secure(new Runnable() {
@Override
public void run() {
if (getInstance() != null && getInstance().getApmForInstance() != null){
getInstance().getApmForInstance().forceStopRecordInteraction = true;
}
mInputMethodManager.showSoftInput(getHostView(), InputMethodManager.SHOW_IMPLICIT);
}
}), 100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ public abstract class WXComponent<T extends View> extends WXBasicComponent imple
public boolean mIsAddElementToTree = false;
//for fix element case
public int interactionAbsoluteX=0,interactionAbsoluteY=0;
//for fix slider case :cssLeft is not real left base parent;
protected int mChildrensWidth = 0;
private boolean mHasAddFocusListener = false;

public WXTracing.TraceInfo mTraceInfo = new WXTracing.TraceInfo();
Expand Down Expand Up @@ -1068,8 +1070,14 @@ private void recordInteraction(int realWidth,int realHeight){
}else {
float cssTop = getCSSLayoutTop();
float cssLeft = getCSSLayoutLeft();
interactionAbsoluteX = (int)(this.isFixed() ? cssLeft : mParent.interactionAbsoluteX + cssLeft);
interactionAbsoluteX = (int)(this.isFixed() ? cssLeft : mParent.interactionAbsoluteX + mParent.mChildrensWidth + cssLeft);
interactionAbsoluteY = (int)(this.isFixed() ? cssTop : mParent.interactionAbsoluteY + cssTop);
//fix for slider impl ,and interactionTime calculate if component is out screen
if (WXBasicComponentType.SLIDER.equalsIgnoreCase(mParent.getComponentType()) || WXBasicComponentType.CYCLE_SLIDER.equalsIgnoreCase(mParent.getComponentType())){
if (!WXBasicComponentType.INDICATOR.equalsIgnoreCase(getComponentType())){
mParent.mChildrensWidth += (int)(realWidth + cssLeft);
}
}
}

if (null == getInstance().getApmForInstance().instanceRect){
Expand Down

0 comments on commit 2b9d773

Please sign in to comment.