Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
7763b36d
Commit
7763b36d
authored
14 years ago
by
Tadashi G. Takaoka
Browse files
Options
Downloads
Patches
Plain Diff
Align key preview and mini-keyboard positions
Bug: 3004793 Change-Id: I1839e6ff3c8c66a576bfb3db9391c146ed225451
parent
4a3ffcbf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/res/values/styles.xml
+1
-1
1 addition, 1 deletion
java/res/values/styles.xml
java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
+22
-4
22 additions, 4 deletions
.../com/android/inputmethod/latin/LatinKeyboardBaseView.java
with
23 additions
and
5 deletions
java/res/values/styles.xml
+
1
−
1
View file @
7763b36d
...
...
@@ -22,7 +22,7 @@
<item
name=
"keyTextSize"
>
@dimen/key_text_size
</item>
<item
name=
"keyTextColor"
>
#FFFFFFFF
</item>
<item
name=
"keyPreviewLayout"
>
@layout/key_preview
</item>
<item
name=
"keyPreviewOffset"
>
5
dip
</item>
<item
name=
"keyPreviewOffset"
>
0
dip
</item>
<item
name=
"keyPreviewHeight"
>
80dip
</item>
<item
name=
"labelTextSize"
>
14sp
</item>
<item
name=
"popupLayout"
>
@layout/keyboard_popup
</item>
...
...
This diff is collapsed.
Click to expand it.
java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
+
22
−
4
View file @
7763b36d
...
...
@@ -48,6 +48,7 @@ import android.widget.TextView;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -191,6 +192,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
private
int
mPopupPreviewOffsetX
;
private
int
mPopupPreviewOffsetY
;
private
int
mWindowY
;
private
int
mPopupPreviewDisplayedY
;
// Popup mini keyboard
private
PopupWindow
mMiniKeyboardPopup
;
...
...
@@ -918,9 +920,9 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
getLocationInWindow
(
mOffsetInWindow
);
mOffsetInWindow
[
0
]
+=
mPopupPreviewOffsetX
;
// Offset may be zero
mOffsetInWindow
[
1
]
+=
mPopupPreviewOffsetY
;
// Offset may be zero
int
[]
mW
indowLocation
=
new
int
[
2
];
getLocationOnScreen
(
mW
indowLocation
);
mWindowY
=
mW
indowLocation
[
1
];
int
[]
w
indowLocation
=
new
int
[
2
];
getLocationOnScreen
(
w
indowLocation
);
mWindowY
=
w
indowLocation
[
1
];
}
// Set the preview background state
mPreviewText
.
getBackground
().
setState
(
...
...
@@ -948,6 +950,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
mPreviewPopup
.
showAtLocation
(
mMiniKeyboardParent
,
Gravity
.
NO_GRAVITY
,
popupPreviewX
,
popupPreviewY
);
}
// Record popup preview position to display mini-keyboard later at the same positon
mPopupPreviewDisplayedY
=
popupPreviewY
;
mPreviewText
.
setVisibility
(
VISIBLE
);
}
...
...
@@ -1057,6 +1061,19 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
return
container
;
}
private
static
boolean
isOneRowKeyboard
(
Keyboard
keyboard
)
{
final
List
<
Key
>
keys
=
keyboard
.
getKeys
();
if
(
keys
.
size
()
==
0
)
return
false
;
final
int
edgeFlags
=
keys
.
get
(
0
).
edgeFlags
;
// HACK: The first key of mini keyboard which was inflated from xml and has multiple rows,
// does not have both top and bottom edge flags on at the same time. On the other hand,
// the first key of mini keyboard that was created with popupCharacters must have both top
// and bottom edge flags on.
// When you want to use one row mini-keyboard from xml file, make sure that the row has
// both top and bottom edge flags set.
return
(
edgeFlags
&
Keyboard
.
EDGE_TOP
)
!=
0
&&
(
edgeFlags
&
Keyboard
.
EDGE_BOTTOM
)
!=
0
;
}
/**
* Called when a key is long pressed. By default this will open any popup keyboard associated
* with this key through the attributes popupLayout and popupCharacters.
...
...
@@ -1102,7 +1119,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
popupY
-=
container
.
getMeasuredHeight
();
popupY
+=
container
.
getPaddingBottom
();
final
int
x
=
popupX
;
final
int
y
=
popupY
;
final
int
y
=
isOneRowKeyboard
(
mMiniKeyboard
.
getKeyboard
())
?
mPopupPreviewDisplayedY
:
popupY
;
int
adjustedX
=
x
;
if
(
x
<
0
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment