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
a0a8d96c
Commit
a0a8d96c
authored
11 years ago
by
Tadashi G. Takaoka
Committed by
Android (Google) Code Review
11 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Filter Spacer before keyboard layout test"
parents
a103e29d
8c6b34e5
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
tests/src/com/android/inputmethod/keyboard/layout/expected/ActualKeyboardBuilder.java
+15
-4
15 additions, 4 deletions
...ethod/keyboard/layout/expected/ActualKeyboardBuilder.java
with
15 additions
and
4 deletions
tests/src/com/android/inputmethod/keyboard/layout/expected/ActualKeyboardBuilder.java
+
15
−
4
View file @
a0a8d96c
...
...
@@ -24,7 +24,6 @@ import com.android.inputmethod.latin.utils.CollectionUtils;
import
com.android.inputmethod.latin.utils.StringUtils
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Comparator
;
...
...
@@ -44,15 +43,27 @@ public final class ActualKeyboardBuilder extends AbstractKeyboardBuilder<Key> {
}
};
private
static
ArrayList
<
Key
>
filterOutSpacerAndSortKeys
(
final
Key
[]
keys
)
{
final
ArrayList
<
Key
>
filteredKeys
=
CollectionUtils
.
newArrayList
();
for
(
final
Key
key
:
keys
)
{
if
(
key
.
isSpacer
())
{
continue
;
}
filteredKeys
.
add
(
key
);
}
Collections
.
sort
(
filteredKeys
,
ROW_COLUMN_COMPARATOR
);
return
filteredKeys
;
}
/**
* Create the keyboard that consists of the array of rows of the actual keyboard's keys.
* @param keys the array of keys of the actual keyboard.
* @return the actual keyboard grouped with rows.
*/
public
static
Key
[][]
buildKeyboard
(
final
Key
[]
keys
)
{
//
S
ort keys from top-left to bottom-right order to prepare to
create rows.
final
ArrayList
<
Key
>
sortedKeys
=
CollectionUtils
.
newArrayList
(
Arrays
.
asList
(
keys
));
Collections
.
sort
(
sortedKeys
,
ROW_COLUMN_COMPARATOR
);
//
Filter out spacer and s
ort keys from top-left to bottom-right order to prepare to
// create rows.
final
ArrayList
<
Key
>
sortedKeys
=
filterOutSpacerAndSortKeys
(
keys
);
// Grouping keys into rows.
final
ArrayList
<
ArrayList
<
Key
>>
rows
=
CollectionUtils
.
newArrayList
();
...
...
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