am 70db3a20: Merge change 25414 into eclair
Merge commit '70db3a20cfa73fad0794679dda4102461a88057b' into eclair-plus-aosp * commit '70db3a20cfa73fad0794679dda4102461a88057b': refactor copy-and-paste email address filtering code.
This commit is contained in:
@@ -506,6 +506,13 @@ public final class Calendar {
|
|||||||
* <P>Type: INTEGER (boolean, readonly)</P>
|
* <P>Type: INTEGER (boolean, readonly)</P>
|
||||||
*/
|
*/
|
||||||
public static final String CAN_INVITE_OTHERS = "canInviteOthers";
|
public static final String CAN_INVITE_OTHERS = "canInviteOthers";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The owner account for this calendar, based on the calendar (foreign
|
||||||
|
* key into the calendars table).
|
||||||
|
* <P>Type: String</P>
|
||||||
|
*/
|
||||||
|
public static final String OWNER_ACCOUNT = "ownerAccount";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
58
core/java/android/text/util/Rfc822InputFilter.java
Normal file
58
core/java/android/text/util/Rfc822InputFilter.java
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package android.text.util;
|
||||||
|
|
||||||
|
import android.text.InputFilter;
|
||||||
|
import android.text.Spanned;
|
||||||
|
import android.text.SpannableStringBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements special address cleanup rules:
|
||||||
|
* The first space key entry following an "@" symbol that is followed by any combination
|
||||||
|
* of letters and symbols, including one+ dots and zero commas, should insert an extra
|
||||||
|
* comma (followed by the space).
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public class Rfc822InputFilter implements InputFilter {
|
||||||
|
|
||||||
|
public CharSequence filter(CharSequence source, int start, int end, Spanned dest,
|
||||||
|
int dstart, int dend) {
|
||||||
|
|
||||||
|
// quick check - did they enter a single space?
|
||||||
|
if (end-start != 1 || source.charAt(start) != ' ') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// determine if the characters before the new space fit the pattern
|
||||||
|
// follow backwards and see if we find a comma, dot, or @
|
||||||
|
int scanBack = dstart;
|
||||||
|
boolean dotFound = false;
|
||||||
|
while (scanBack > 0) {
|
||||||
|
char c = dest.charAt(--scanBack);
|
||||||
|
switch (c) {
|
||||||
|
case '.':
|
||||||
|
dotFound = true; // one or more dots are req'd
|
||||||
|
break;
|
||||||
|
case ',':
|
||||||
|
return null;
|
||||||
|
case '@':
|
||||||
|
if (!dotFound) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// we have found a comma-insert case. now just do it
|
||||||
|
// in the least expensive way we can.
|
||||||
|
if (source instanceof Spanned) {
|
||||||
|
SpannableStringBuilder sb = new SpannableStringBuilder(",");
|
||||||
|
sb.append(source);
|
||||||
|
return sb;
|
||||||
|
} else {
|
||||||
|
return ", ";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
// just keep going
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no termination cases were found, so don't edit the input
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user