am f6009233: Merge "Tweak for armenian periods and commas."
* commit 'f600923376afab0295b25451887450edaffeda7c': Tweak for armenian periods and commas.main
commit
1a46424dd5
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
**
|
||||
** Copyright 2013, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- Same list as in English, but add armenian period and comma: -->
|
||||
<!-- U+055D: "՝" ARMENIAN COMMA -->
|
||||
<!-- U+0589: "։" ARMENIAN FULL STOP -->
|
||||
<!-- Symbols that are normally followed by a space (used to add an auto-space after these) -->
|
||||
<string name="symbols_followed_by_space">.,;:!?)]}&։՝</string>
|
||||
<!-- Symbols that separate words. Adding armenian period and comma. -->
|
||||
<!-- Don't remove the enclosing double quotes, they protect whitespace (not just U+0020) -->
|
||||
<string name="symbols_word_separators">"	 \n"()[]{}*&<>+=|.,;:!?/_\"։՝</string>
|
||||
</resources>
|
|
@ -165,6 +165,7 @@ public final class Constants {
|
|||
public static final int CODE_TAB = '\t';
|
||||
public static final int CODE_SPACE = ' ';
|
||||
public static final int CODE_PERIOD = '.';
|
||||
public static final int CODE_ARMENIAN_PERIOD = 0x0589;
|
||||
public static final int CODE_DASH = '-';
|
||||
public static final int CODE_SINGLE_QUOTE = '\'';
|
||||
public static final int CODE_DOUBLE_QUOTE = '"';
|
||||
|
|
|
@ -60,6 +60,11 @@ public final class CapsModeUtils {
|
|||
|| WordComposer.CAPS_MODE_AUTO_SHIFT_LOCKED == mode;
|
||||
}
|
||||
|
||||
private static boolean isPeriod(final int codePoint) {
|
||||
// TODO: make this a resource.
|
||||
return codePoint == Constants.CODE_PERIOD || codePoint == Constants.CODE_ARMENIAN_PERIOD;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine what caps mode should be in effect at the current offset in
|
||||
* the text. Only the mode bits set in <var>reqModes</var> will be
|
||||
|
@ -190,7 +195,7 @@ public final class CapsModeUtils {
|
|||
if (c == Constants.CODE_QUESTION_MARK || c == Constants.CODE_EXCLAMATION_MARK) {
|
||||
return (TextUtils.CAP_MODE_CHARACTERS | TextUtils.CAP_MODE_SENTENCES) & reqModes;
|
||||
}
|
||||
if (c != Constants.CODE_PERIOD || j <= 0) {
|
||||
if (!isPeriod(c) || j <= 0) {
|
||||
return (TextUtils.CAP_MODE_CHARACTERS | TextUtils.CAP_MODE_WORDS) & reqModes;
|
||||
}
|
||||
|
||||
|
@ -240,7 +245,7 @@ public final class CapsModeUtils {
|
|||
case WORD:
|
||||
if (Character.isLetter(c)) {
|
||||
state = WORD;
|
||||
} else if (c == Constants.CODE_PERIOD) {
|
||||
} else if (isPeriod(c)) {
|
||||
state = PERIOD;
|
||||
} else {
|
||||
return caps;
|
||||
|
@ -256,7 +261,7 @@ public final class CapsModeUtils {
|
|||
case LETTER:
|
||||
if (Character.isLetter(c)) {
|
||||
state = LETTER;
|
||||
} else if (c == Constants.CODE_PERIOD) {
|
||||
} else if (isPeriod(c)) {
|
||||
state = PERIOD;
|
||||
} else {
|
||||
return noCaps;
|
||||
|
|
Loading…
Reference in New Issue