Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Aug 29, 2018
1 parent 44a5f00 commit 06c8630
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Expand Up @@ -335,10 +335,10 @@ public CustomKeyboardView(Context context, AttributeSet attrs, int defStyleAttr,
mPaint.setTypeface(Typeface.create("sans-serif",Typeface.NORMAL));

mPadding = new Rect(0, 0, 0, 0);
mMiniKeyboardCache = new HashMap<Key,View>();
mMiniKeyboardCache = new HashMap<>();
mKeyBackground.getPadding(mPadding);
mKeyboardHoveredPadding = getContext().getResources().getDimension(R.dimen.keyboard_key_hovered_padding);
mKeyboardPressedPadding = getContext().getResources().getDimension(R.dimen.keyboard_key_pressed_padding);
mKeyboardHoveredPadding = getResources().getDimensionPixelSize(R.dimen.keyboard_key_hovered_padding);
mKeyboardPressedPadding = getResources().getDimensionPixelSize(R.dimen.keyboard_key_pressed_padding);

mSwipeThreshold = (int) (500 * getResources().getDisplayMetrics().density);
mDisambiguateSwipe = false;
Expand Down
Expand Up @@ -140,8 +140,8 @@ public void onClick(View view) {
}
});

mKeyboardPopupLeftMargin = (int)getResources().getDimension(R.dimen.keyboard_popup_left_margin);
mKeyboardPopupTopMargin = (int)getContext().getResources().getDimension(R.dimen.keyboard_key_pressed_padding) * 2;
mKeyboardPopupLeftMargin = getResources().getDimensionPixelSize(R.dimen.keyboard_popup_left_margin);
mKeyboardPopupTopMargin = getResources().getDimensionPixelSize(R.dimen.keyboard_key_pressed_padding) * 2;

mPopupKeyboardLayer.setOnClickListener(new OnClickListener() {
@Override
Expand Down Expand Up @@ -305,6 +305,8 @@ public void onLongPress(Keyboard.Key popupKey) {
mPopupKeyboardview.setVisibility(View.VISIBLE);
mPopupKeyboardLayer.setVisibility(View.VISIBLE);

mIsLongPress = true;

} else if (popupKey.codes[0] == CustomKeyboard.KEYCODE_SHIFT) {
mIsLongPress = !mIsCapsLock;

Expand Down Expand Up @@ -349,7 +351,10 @@ public void onKey(int primaryCode, int[] keyCodes, boolean hasPopup) {
handleText(".com");
break;
default:
handleKey(primaryCode, keyCodes);
if (!mIsLongPress) {
handleKey(primaryCode, keyCodes);
}

if (!hasPopup) {
mPopupKeyboardview.setVisibility(View.GONE);
mPopupKeyboardLayer.setVisibility(View.GONE);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/keyboard.xml
Expand Up @@ -34,7 +34,7 @@
android:layout_width="@dimen/keyboard_width"
android:layout_height="@dimen/keyboard_height"
android:background="@color/void_color"
android:alpha="0.0"
android:alpha="0.5"
android:visibility="gone"/>

<org.mozilla.vrbrowser.ui.CustomKeyboardView
Expand Down

0 comments on commit 06c8630

Please sign in to comment.