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
bafe4b8a
Commit
bafe4b8a
authored
11 years ago
by
Tadashi G. Takaoka
Browse files
Options
Downloads
Patches
Plain Diff
Fix possible divided by zeror error
Bug: 9534022 Change-Id: I5ab575c724fd7a9e80c76a93d83949e81b2970bb
parent
940cca4f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
+7
-13
7 additions, 13 deletions
...rc/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
with
7 additions
and
13 deletions
java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
+
7
−
13
View file @
bafe4b8a
...
...
@@ -279,8 +279,14 @@ public final class MoreKeysKeyboard extends Keyboard {
mParentKey
=
parentKey
;
final
int
width
,
height
;
// {@link KeyPreviewDrawParams#mPreviewVisibleWidth} should have been set at
// {@link MainKeyboardView#showKeyPreview(PointerTracker}, though there may be
// some chances that the value is zero. <code>width == 0</code> will cause
// zero-division error at
// {@link MoreKeysKeyboardParams#setParameters(int,int,int,int,int,int,boolean,int)}.
final
boolean
singleMoreKeyWithPreview
=
parentKeyboardView
.
isKeyPreviewPopupEnabled
()
&&
!
parentKey
.
noKeyPreview
()
&&
parentKey
.
mMoreKeys
.
length
==
1
;
&&
!
parentKey
.
noKeyPreview
()
&&
parentKey
.
mMoreKeys
.
length
==
1
&&
keyPreviewDrawParams
.
mPreviewVisibleWidth
>
0
;
if
(
singleMoreKeyWithPreview
)
{
// Use pre-computed width and height if this more keys keyboard has only one key to
// mitigate visual flicker between key preview and more keys keyboard.
...
...
@@ -291,22 +297,10 @@ public final class MoreKeysKeyboard extends Keyboard {
// adjusted with their bottom paddings deducted.
width
=
keyPreviewDrawParams
.
mPreviewVisibleWidth
;
height
=
keyPreviewDrawParams
.
mPreviewVisibleHeight
+
mParams
.
mVerticalGap
;
// TODO: Remove this check.
if
(
width
==
0
)
{
throw
new
IllegalArgumentException
(
"Zero width key detected: "
+
parentKey
+
" in "
+
parentKeyboard
.
mId
);
}
}
else
{
width
=
getMaxKeyWidth
(
parentKeyboardView
,
parentKey
,
mParams
.
mDefaultKeyWidth
,
context
.
getResources
());
height
=
parentKeyboard
.
mMostCommonKeyHeight
;
// TODO: Remove this check.
if
(
width
==
0
)
{
throw
new
IllegalArgumentException
(
"Zero width calculated: "
+
parentKey
+
" moreKeys="
+
java
.
util
.
Arrays
.
toString
(
parentKey
.
mMoreKeys
)
+
" in "
+
parentKeyboard
.
mId
);
}
}
final
int
dividerWidth
;
if
(
parentKey
.
needsDividersInMoreKeys
())
{
...
...
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