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