forked from upstream-mirrors/OpenTracks
Cleanup: use TextUtils.isEmpty().
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package de.dennisguse.opentracks.share;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Pair;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
@@ -71,7 +72,7 @@ public class TrackShareSummaryGenerator {
|
||||
}
|
||||
|
||||
private void writeString(String text, StringBuilder builder, int resId) {
|
||||
if (text == null || text.isEmpty()) {
|
||||
if (TextUtils.isEmpty(text)) {
|
||||
text = context.getString(R.string.value_unknown);
|
||||
}
|
||||
builder.append(context.getString(resId, text));
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package de.dennisguse.opentracks.ui.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.time.Duration;
|
||||
@@ -49,16 +50,17 @@ public class ListItemUtils {
|
||||
*/
|
||||
private static String getTimeDistance(String totalTime, String totalDistance) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if (totalTime != null && !totalTime.isEmpty()) {
|
||||
if (!TextUtils.isEmpty(totalTime)) {
|
||||
if (builder.length() != 0) {
|
||||
builder.append(" ‧ ");
|
||||
}
|
||||
builder.append(totalTime);
|
||||
}
|
||||
if (totalDistance != null && !totalDistance.isEmpty()) {
|
||||
if (!TextUtils.isEmpty(totalDistance)) {
|
||||
if (builder.length() != 0) {
|
||||
builder.append(" ");
|
||||
}
|
||||
//TODO Use strings.xml
|
||||
builder.append("(").append(totalDistance).append(")");
|
||||
}
|
||||
return builder.toString();
|
||||
|
||||
Reference in New Issue
Block a user