Skip to content

Commit

Permalink
Merge pull request #401 from rivaldi8/fix-standard-kb-on-edit
Browse files Browse the repository at this point in the history
Avoid opening the standard keyboard in amount edit text when editing
  • Loading branch information
codinguser committed Oct 8, 2015
2 parents dbed8af + d50bc58 commit 5cbac10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,7 @@ private void setAmountEditViewVisible(int visibility) {
private void toggleAmountInputEntryMode(boolean enabled){
if (enabled){
mAmountEditText.setFocusable(true);
mAmountEditText.setOnClickListener(null);
mAmountEditText.setDefaultTouchListener();
mAmountEditText.bindListeners(mKeyboardView);
} else {
mAmountEditText.setFocusable(false);
mAmountEditText.setOnClickListener(new View.OnClickListener() {
Expand All @@ -515,7 +514,6 @@ public void onClick(View v) {
openSplitEditor();
}
});
mAmountEditText.setOnTouchListener(null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,27 +158,21 @@ public boolean onLongClick(View v) {
}
});

setDefaultTouchListener();

((FormActivity)mContext).setOnBackListener(mCalculatorKeyboard);
}

/**
* Sets the default touch listener which opens the calculator keyboard
*/
public void setDefaultTouchListener() {
// Although it looks redundant having both onClickListener and OnTouchListener, removing
// one of them makes the standard keyboard show up in addition to the calculator one.
setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (!mCalculatorKeyboard.isCustomKeyboardVisible())
mCalculatorKeyboard.showCustomKeyboard(v);


// XXX: Use dispatchTouchEvent()?
onTouchEvent(event); // Call native handler
onTouchEvent(event);
return false;
}
});

((FormActivity)mContext).setOnBackListener(mCalculatorKeyboard);
}

/**
Expand Down

0 comments on commit 5cbac10

Please sign in to comment.