本文整理汇总了Java中android.text.TextUtils.join方法的典型用法代码示例。如果您正苦于以下问题:Java TextUtils.join方法的具体用法?Java TextUtils.join怎么用?Java TextUtils.join使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.TextUtils
的用法示例。
在下文中一共展示了TextUtils.join方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGeofenceTransitionDetails
import android.text.TextUtils; //导入方法依赖的package包/类
/**
* Gets transition details and returns them as a formatted string.
*
* @param context The app context.
* @param geofenceTransition The ID of the geofence transition.
* @param triggeringGeofences The geofence(s) triggered.
* @return The transition details formatted as String.
*/
private String getGeofenceTransitionDetails(
Context context,
int geofenceTransition,
List<Geofence> triggeringGeofences) {
String geofenceTransitionString = getTransitionString(geofenceTransition);
// Get the Ids of each geofence that was triggered.
ArrayList triggeringGeofencesIdsList = new ArrayList();
for (Geofence geofence : triggeringGeofences) {
triggeringGeofencesIdsList.add(geofence.getRequestId());
}
String triggeringGeofencesIdsString = TextUtils.join(", ", triggeringGeofencesIdsList);
return geofenceTransitionString + ": " + triggeringGeofencesIdsString;
}
示例2: FunctionRunner
import android.text.TextUtils; //导入方法依赖的package包/类
/**
* Initialization; needs a context to find the classpath.
* @param ctx
*/
public FunctionRunner(Context ctx) {
/*
* It would be nicer if we could just look at the classloaders for this class and
* the one being run, but the details we need aren't publicly exposed there as far as
* I can see. I'd rather do this than hack around with reflection or parsing classloaders'
* toString().
*/
ApplicationInfo appInfo = ctx.getApplicationInfo();
mClassPath = appInfo.sourceDir + File.pathSeparator +
TextUtils.join(File.pathSeparator, appInfo.splitSourceDirs);
// and I guess there's really no better way for this either
// TODO let caller optionally configure this?
mCodeCacheDir = ctx.getCodeCacheDir().getPath();
}
示例3: RepoContentLoader
import android.text.TextUtils; //导入方法依赖的package包/类
public RepoContentLoader(Context context, String path, String repoName, String userName) {
super(context);
if (repoName == null || userName == null || repoName.isEmpty() || userName.isEmpty()) {
isRepoReady = false;
}
String[] pathList = path.split("/");
for (int i = 0; i < pathList.length; i++) {
pathList[i] = Uri.encode(pathList[i]);
}
this.path = TextUtils.join("/", pathList);
this.repoName = repoName;
this.userName = userName;
firebaseAnalytics = new FirebaseAnalyticsWrapper(context);
}
示例4: iterableToString
import android.text.TextUtils; //导入方法依赖的package包/类
@Nullable
public static String iterableToString(@Nullable Iterable<String> strings) {
if (strings == null) {
return null;
}
Set<String> stringSet = new LinkedHashSet<>();
for (String str : strings) {
LiCoreSDKUtils.checkArgument(!TextUtils.isEmpty(str),
"individual scopes cannot be null or empty");
stringSet.add(str);
}
if (stringSet.isEmpty()) {
return null;
}
return TextUtils.join(" ", stringSet);
}
示例5: updateScheduledTime
import android.text.TextUtils; //导入方法依赖的package包/类
public static void updateScheduledTime(Context context, Set<Long> noteIds, OrgDateTime time) {
ArrayList<ContentProviderOperation> ops = new ArrayList<>();
String noteIdsCommaSeparated = TextUtils.join(",", noteIds);
/* Update notes. */
ContentValues values = new ContentValues();
if (time != null) {
values.put(ProviderContract.Notes.UpdateParam.SCHEDULED_STRING, new OrgRange(time).toString());
} else {
values.putNull(ProviderContract.Notes.UpdateParam.SCHEDULED_STRING);
}
ops.add(ContentProviderOperation
.newUpdate(ProviderContract.Notes.ContentUri.notes())
.withValues(values)
.withSelection(ProviderContract.Notes.UpdateParam._ID + " IN (" + noteIdsCommaSeparated + ")", null)
.build());
updateBooksMtimeForNotes(context, noteIdsCommaSeparated, ops);
/*
* Apply batch.
*/
try {
context.getContentResolver().applyBatch(ProviderContract.AUTHORITY, ops);
} catch (RemoteException | OperationApplicationException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
示例6: toString
import android.text.TextUtils; //导入方法依赖的package包/类
@Override
public String toString() {
return TextUtils.join("|", new Object[] {
responseCode, nonce, packageName, versionCode,
userId, timestamp
});
}
示例7: sortTableColumns
import android.text.TextUtils; //导入方法依赖的package包/类
private String sortTableColumns(String sql) {
int positionOfColumnDefinitions = sql.indexOf('(');
String columnDefinitionsSql = sql.substring(positionOfColumnDefinitions + 1, sql.length() - 1);
String[] columnDefinitions = columnDefinitionsSql.split(" *, *(?![^(]*\\))");
Arrays.sort(columnDefinitions);
String sqlPrefix = sql.substring(0, positionOfColumnDefinitions + 1);
String sortedColumnDefinitionsSql = TextUtils.join(", ", columnDefinitions);
return sqlPrefix + sortedColumnDefinitionsSql + ")";
}
示例8: restoreData
import android.text.TextUtils; //导入方法依赖的package包/类
private static void restoreData(StandardDatabase db, List<Class<? extends AbstractDao<?, ?>>> daoClasses) {
for (Class<? extends AbstractDao<?, ?>> daoClass : daoClasses) {
DaoConfig daoConfig = new DaoConfig(db, daoClass);
String tableName = daoConfig.tablename;
String tempTableName = daoConfig.tablename.concat("_TEMP");
// get all columns from tempTable, take careful to use the columns list
List<String> columns = getColumns(db, tempTableName);
ArrayList<String> properties = new ArrayList<>(columns.size());
for (int j = 0; j < daoConfig.properties.length; j++) {
String columnName = daoConfig.properties[j].columnName;
if (columns.contains(columnName)) {
properties.add(columnName);
}
}
if (properties.size() > 0) {
final String columnSQL = TextUtils.join(",", properties);
String insertTableStringBuilder = "INSERT INTO " + tableName + " (" +
columnSQL +
") SELECT " +
columnSQL +
" FROM " + tempTableName + ";";
try {
db.execSQL(insertTableStringBuilder);
} catch (Exception e) {
e.printStackTrace();
}
}
db.execSQL("DROP TABLE " + tempTableName);
}
}
示例9: joinNewline
import android.text.TextUtils; //导入方法依赖的package包/类
private static String joinNewline(String... args) {
return TextUtils.join("\n", args);
}
示例10: getObjectIdentifier
import android.text.TextUtils; //导入方法依赖的package包/类
private String getObjectIdentifier(){
return TextUtils.join("", keys);
}
示例11: createErrorResult
import android.text.TextUtils; //导入方法依赖的package包/类
static Result createErrorResult(AuthorizationRequest request, String errorType, String errorDescription,
String errorCode) {
String message = TextUtils.join(": ", Utility.asListNoNulls(errorType, errorDescription));
return new Result(request, Code.ERROR, null, message, errorCode);
}
示例12: orderBySql
import android.text.TextUtils; //导入方法依赖的package包/类
private String orderBySql() {
if (orderBys.size() == 0) {
return "";
}
return " ORDER BY " + TextUtils.join(", ", orderBys);
}
示例13: draw
import android.text.TextUtils; //导入方法依赖的package包/类
@Override
public void draw(Canvas canvas, Paint paint, float opacity) {
if (mFrame == null) {
return;
}
opacity *= mOpacity;
if (opacity <= MIN_OPACITY_FOR_DRAW) {
return;
}
if (!mFrame.hasKey(PROP_LINES)) {
return;
}
ReadableArray linesProp = mFrame.getArray(PROP_LINES);
if (linesProp == null || linesProp.size() == 0) {
return;
}
// only set up the canvas if we have something to draw
saveAndSetupCanvas(canvas);
String[] lines = new String[linesProp.size()];
for (int i = 0; i < lines.length; i++) {
lines[i] = linesProp.getString(i);
}
String text = TextUtils.join("\n", lines);
if (setupStrokePaint(paint, opacity)) {
applyTextPropertiesToPaint(paint);
if (mPath == null) {
canvas.drawText(text, 0, -paint.ascent(), paint);
} else {
canvas.drawTextOnPath(text, mPath, 0, 0, paint);
}
}
if (setupFillPaint(paint, opacity)) {
applyTextPropertiesToPaint(paint);
if (mPath == null) {
canvas.drawText(text, 0, -paint.ascent(), paint);
} else {
canvas.drawTextOnPath(text, mPath, 0, 0, paint);
}
}
restoreCanvas(canvas);
markUpdateSeen();
}
示例14: CommandResult
import android.text.TextUtils; //导入方法依赖的package包/类
CommandResult(int returnCode, List<String> output) {
this.exitCode = returnCode;
this.output = TextUtils.join("\n", output);
}
示例15: toString
import android.text.TextUtils; //导入方法依赖的package包/类
@Override
public String toString() {
return TextUtils.join("|", new Object [] { responseCode, nonce, packageName, versionCode,
userId, timestamp });
}