本文整理汇总了Java中java.lang.CharSequence类的典型用法代码示例。如果您正苦于以下问题:Java CharSequence类的具体用法?Java CharSequence怎么用?Java CharSequence使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CharSequence类属于java.lang包,在下文中一共展示了CharSequence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertGrid
import java.lang.CharSequence; //导入依赖的package包/类
private void assertGrid(@CollectionState.CollectionTransition int collectionTransition,
CharSequence gridName,
boolean rowChanged,
boolean colChanged,
int itemRow,
int itemCol,
CharSequence rowName,
CharSequence colName,
@CollectionState.TableHeadingType int headingType) {
assertEquals(Role.ROLE_GRID, mCollectionState.getCollectionRole());
assertEquals(collectionTransition, mCollectionState.getCollectionTransition());
assertCharSequenceEquals(gridName, mCollectionState.getCollectionName());
assertEquals(rowChanged,
(mCollectionState.getRowColumnTransition() & CollectionState.TYPE_ROW) != 0);
assertEquals(colChanged,
(mCollectionState.getRowColumnTransition() & CollectionState.TYPE_COLUMN) != 0);
CollectionState.TableItemState itemState = mCollectionState.getTableItemState();
assertEquals(itemRow, itemState.getRowIndex());
assertEquals(itemCol, itemState.getColumnIndex());
assertCharSequenceEquals(rowName, itemState.getRowName());
assertCharSequenceEquals(colName, itemState.getColumnName());
assertEquals(headingType, itemState.getHeadingType());
}
示例2: readLong
import java.lang.CharSequence; //导入依赖的package包/类
private long readLong (CharSequence csq, ParsePosition pos) {
final int length = csq.length();
int result = 0;
boolean isNegative = false;
while (pos.getIndex() < length) {
char c = csq.charAt(pos.getIndex());
if (c == '-') {
isNegative = true;
} else if ((c >= '0') && (c <= '9')) {
result = result * 10 + (c - '0');
} else {
break;
}
pos.setIndex(pos.getIndex()+1);
}
return isNegative ? -result : result;
}
示例3: append
import java.lang.CharSequence; //导入依赖的package包/类
private void append(Appendable appendable, CharSequence symbol,
int pow, int root) throws IOException {
appendable.append(symbol);
if ((pow != 1) || (root != 1)) {
// Write exponent.
if ((pow == 2) && (root == 1)) {
appendable.append('²'); // Square
} else if ((pow == 3) && (root == 1)) {
appendable.append('³'); // Cubic
} else {
// Use general exponent form.
appendable.append('^');
appendable.append(String.valueOf(pow));
if (root != 1) {
appendable.append(':');
appendable.append(String.valueOf(root));
}
}
}
}
示例4: AutoValue_TestClassBundled
import java.lang.CharSequence; //导入依赖的package包/类
AutoValue_TestClassBundled(Bundle bundle, byte someByte, boolean someBoolean, short someShort,
int someInt, long someLong, char someChar, float someFloat, double someDouble,
String someString, CharSequence someCharSequence, Parcelable someParcelable,
ArrayList<Parcelable> someParcelableArrayList,
SparseArray<Parcelable> someParcelableSparseArray, Serializable someSerializable,
ArrayList<Integer> someIntegerArrayList, ArrayList<String> someStringArrayList,
ArrayList<CharSequence> someCharSequenceArrayList, byte[] someByteArray,
short[] someShortArray, char[] someCharArray, float[] someFloatArray,
UnknownObject someUnknownObject, ArrayList<UnknownObject> someUnknownObjectList,
TestEnum testEnum) {
super(bundle,
someByte,
someBoolean,
someShort,
someInt,
someLong,
someChar,
someFloat,
someDouble,
someString,
someCharSequence,
someParcelable,
someParcelableArrayList,
someParcelableSparseArray,
someSerializable,
someIntegerArrayList,
someStringArrayList,
someCharSequenceArrayList,
someByteArray,
someShortArray,
someCharArray,
someFloatArray,
someUnknownObject,
someUnknownObjectList,
testEnum);
}
示例5: AutoValue_TestClassBundledGCM
import java.lang.CharSequence; //导入依赖的package包/类
AutoValue_TestClassBundledGCM(Bundle bundle, byte someByte, boolean someBoolean, short someShort,
int someInt, long someLong, char someChar, float someFloat, double someDouble,
String someString, CharSequence someCharSequence, Parcelable someParcelable,
ArrayList<Parcelable> someParcelableArrayList,
SparseArray<Parcelable> someParcelableSparseArray, Serializable someSerializable,
ArrayList<Integer> someIntegerArrayList, ArrayList<String> someStringArrayList,
ArrayList<CharSequence> someCharSequenceArrayList, byte[] someByteArray,
short[] someShortArray, char[] someCharArray, float[] someFloatArray,
UnknownObject someUnknownObject, ArrayList<UnknownObject> someUnknownObjectList,
TestEnum testEnum) {
super(bundle,
someByte,
someBoolean,
someShort,
someInt,
someLong,
someChar,
someFloat,
someDouble,
someString,
someCharSequence,
someParcelable,
someParcelableArrayList,
someParcelableSparseArray,
someSerializable,
someIntegerArrayList,
someStringArrayList,
someCharSequenceArrayList,
someByteArray,
someShortArray,
someCharArray,
someFloatArray,
someUnknownObject,
someUnknownObjectList,
testEnum);
}
示例6: unbundle
import java.lang.CharSequence; //导入依赖的package包/类
public static TestClassBundledGCM unbundle(Bundle bundle, Gson gson) {
return new AutoValue_TestClassBundledGCM(
bundle,
Byte.parseByte(bundle.getString("some_byte")),
Boolean.parseBoolean(bundle.getString("some_boolean")),
Short.parseShort(bundle.getString("some_short")),
Integer.parseInt(bundle.getString("some_int")),
Long.parseLong(bundle.getString("some_long")),
bundle.getString("some_char").charAt(0),
Float.parseFloat(bundle.getString("some_float")),
Double.parseDouble(bundle.getString("some_double")),
bundle.getString("some_string"),
bundle.getString("some_char_sequence"),
gson.fromJson(bundle.getString("some_parcelable"), Parcelable.class),
gson.fromJson(bundle.getString("some_parcelable_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<Parcelable>>(){}.getType()),
gson.fromJson(bundle.getString("some_parcelable_sparse_array"), new com.google.common.reflect.TypeToken<android.util.SparseArray<Parcelable>>(){}.getType()),
gson.fromJson(bundle.getString("some_serializable"), Serializable.class),
gson.fromJson(bundle.getString("some_integer_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<Integer>>(){}.getType()),
gson.fromJson(bundle.getString("some_string_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<String>>(){}.getType()),
gson.fromJson(bundle.getString("some_char_sequence_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<CharSequence>>(){}.getType()),
toPrimitive(gson.fromJson(bundle.getString("some_byte_array"), Byte[].class)),
toPrimitive(gson.fromJson(bundle.getString("some_short_array"), Short[].class)),
toPrimitive(gson.fromJson(bundle.getString("some_char_array"), Character[].class)),
toPrimitive(gson.fromJson(bundle.getString("some_float_array"), Float[].class)),
gson.fromJson(bundle.getString("some_unknown_object"), new com.google.common.reflect.TypeToken<UnknownObject>(){}.getType()),
gson.fromJson(bundle.getString("some_unknown_object_list"), new com.google.common.reflect.TypeToken<ArrayList<UnknownObject>>(){}.getType()),
gson.fromJson(bundle.getString("test_enum"), new com.google.common.reflect.TypeToken<TestEnum>(){}.getType()));
}
示例7: indentationLevel
import java.lang.CharSequence; //导入依赖的package包/类
public static int indentationLevel(CharSequence c) {
int i = 0;
while(i < c.length() && c.charAt(i) == ' ') {
i++;
}
return i;
}
示例8: Detail3ActivityNavigator
import java.lang.CharSequence; //导入依赖的package包/类
/**
* Constructor with required params */
public Detail3ActivityNavigator(String arg1, int arg2, long arg3, short arg4, float arg5, double arg6, boolean arg7, Parcelable arg8, Bundle arg9, CharSequence arg10, char arg11, byte arg12, int[] arg13, long[] arg14, short[] arg15, float[] arg16, double[] arg17, boolean[] arg18, char[] arg19, byte[] arg20, String[] arg21, Parcelable[] arg22, CharSequence[] arg23, Serializable arg24, ArrayList<String> arg25, ArrayList<CharSequence> arg26, ArrayList<Integer> arg27, ArrayList<Parcelable> arg28) {
this.arg1 = arg1;
this.arg2 = arg2;
this.arg3 = arg3;
this.arg4 = arg4;
this.arg5 = arg5;
this.arg6 = arg6;
this.arg7 = arg7;
this.arg8 = arg8;
this.arg9 = arg9;
this.arg10 = arg10;
this.arg11 = arg11;
this.arg12 = arg12;
this.arg13 = arg13;
this.arg14 = arg14;
this.arg15 = arg15;
this.arg16 = arg16;
this.arg17 = arg17;
this.arg18 = arg18;
this.arg19 = arg19;
this.arg20 = arg20;
this.arg21 = arg21;
this.arg22 = arg22;
this.arg23 = arg23;
this.arg24 = arg24;
this.arg25 = arg25;
this.arg26 = arg26;
this.arg27 = arg27;
this.arg28 = arg28;
}
示例9: onReceive
import java.lang.CharSequence; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
Log.d ( TAG, "onReceive()..." + new Date() ) ;
String voiceReplyContent = "No reply";
Bundle remoteInputBundle = RemoteInput.getResultsFromIntent(intent);
Log.d ( TAG, "onReceive() remoteInputBundle=" + remoteInputBundle ) ;
if (remoteInputBundle != null) {
CharSequence charSequence = remoteInputBundle.getCharSequence(EXTRA_VOICE_REPLY) ;
voiceReplyContent = charSequence.toString() ;
}
Log.d ( TAG, "onReceive()... voiceReplyContent=" + voiceReplyContent ) ;
// originate notification that will end up showing on the handheld
Notification notification = new Notification.Builder(context)
.setSmallIcon(R.drawable.alarm36)
.setContentTitle("From Head unit")
.setContentText( voiceReplyContent )
.setColor( context.getResources().getColor(R.color.colorPrimary)).build() ;
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify( 7200, notification );
}
示例10: methodWithVectorParamAndStackReturn
import java.lang.CharSequence; //导入依赖的package包/类
@Override
public <T extends CharSequence> Stack<T> methodWithVectorParamAndStackReturn(Vector<Parcelable> objectList) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
data.writeInterfaceToken(ConcreteListMethodTypeParam$$AidlServerImpl.DESCRIPTOR);
if (objectList == null) {
data.writeInt(-1);
} else {
data.writeInt(objectList.size());
for (Parcelable objectListElement : objectList) {
data.writeParcelable(objectListElement, 0);
}
}
delegate.transact(ConcreteListMethodTypeParam$$AidlServerImpl.TRANSACT_methodWithVectorParamAndStackReturn, data, reply, 0);
reply.readException();
final Stack<CharSequence> returnValueCollection;
final int returnValueSize = reply.readInt();
if (returnValueSize < 0) {
returnValueCollection = null;
} else {
returnValueCollection = new Stack<>();
for (int j = 0; j < returnValueSize; j++) {
returnValueCollection.add(TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(reply));
}
}
return (Stack) returnValueCollection;
} finally {
data.recycle();
reply.recycle();
}
}
示例11: onTransact
import java.lang.CharSequence; //导入依赖的package包/类
@Override
protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
switch(code) {
case TRANSACT_methodWithVectorParamAndStackReturn: {
data.enforceInterface(this.getInterfaceDescriptor());
final Vector<Parcelable> objectListCollection;
final int objectListSize = data.readInt();
if (objectListSize < 0) {
objectListCollection = null;
} else {
objectListCollection = new Vector<>(objectListSize);
for (int j = 0; j < objectListSize; j++) {
objectListCollection.add(data.readParcelable(getClass().getClassLoader()));
}
}
final Collection<? extends CharSequence> returnValue = delegate.methodWithVectorParamAndStackReturn(objectListCollection);
reply.writeNoException();
if (returnValue == null) {
reply.writeInt(-1);
} else {
reply.writeInt(returnValue.size());
for (CharSequence returnValueElement : returnValue) {
TextUtils.writeToParcel(returnValueElement, reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
}
}
return true;
}
}
return super.onTransact(code, data, reply, flags);
}
示例12: setCharSequence
import java.lang.CharSequence; //导入依赖的package包/类
public void setCharSequence (CharSequence input)
{
this.input = input;
this.matchText = null;
this.matchTextFresh = false;
if (input != null)
this.matcher = regex.matcher(input);
}
示例13: ListsActivityScreen
import java.lang.CharSequence; //导入依赖的package包/类
public ListsActivityScreen(ArrayList<String> list1, ArrayList<Integer> list2, ArrayList<CharSequence> list3, ArrayList<Parcelable> list4, ArrayList<ParcelableClass> list5, SparseArray<Parcelable> list6, SparseArray<ParcelableClass> list7) {
this.list1 = list1;
this.list2 = list2;
this.list3 = list3;
this.list4 = list4;
this.list5 = list5;
this.list6 = list6;
this.list7 = list7;
}
示例14: ClassesActivityScreen
import java.lang.CharSequence; //导入依赖的package包/类
public ClassesActivityScreen(String field1, CharSequence field2, CharSequence[] field3, Bundle field4, Parcelable field5, Parcelable[] field6, ParcelableClass field7, String[] field8, ParcelableClass[] field9, Serializable field91, SerializableClass field92) {
this.field1 = field1;
this.field2 = field2;
this.field3 = field3;
this.field4 = field4;
this.field5 = field5;
this.field6 = field6;
this.field7 = field7;
this.field8 = field8;
this.field9 = field9;
this.field91 = field91;
this.field92 = field92;
}
示例15: internalTestChangedTextFormatter_deleteCharacter
import java.lang.CharSequence; //导入依赖的package包/类
private void internalTestChangedTextFormatter_deleteCharacter(String text) throws Exception {
if (text.length() < 1) {
throw new IllegalArgumentException("This test case can only handle non-empty strings");
}
// Set up the test.
setContentView(R.layout.text_activity);
getViewForId(R.id.username).requestFocus();
mInstrumentation.waitForIdleSync();
mInstrumentation.sendStringSync(text);
waitForAccessibilityIdleSync();
// Delete the last character.
startRecordingUtterances();
mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_DEL);
waitForAccessibilityIdleSync();
final CharSequence lastChar = text.substring(text.length() - 1);
final CharSequence expectedSpeech = SpeechCleanupUtils.cleanUp(mAppCtx, lastChar) + " "
+ mAppCtx.getString(R.string.value_text_removed);
final CharSequenceFilter textFilter = new CharSequenceFilter().addContainsIgnoreCase(
expectedSpeech);
final UtteranceFilter utteranceFilter = new UtteranceFilter().addTextFilter(textFilter);
final Utterance utterance = stopRecordingUtterancesAfterMatch(utteranceFilter);
assertNotNull("Saw matching utterance", utterance);
}