From 41943502d4b93379b0723ee80966447cf4e855de Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 21 Jan 2016 23:12:14 +0100 Subject: [PATCH] Display partial ID if device name is empty (fixes #419). --- .../com/nutomic/syncthingandroid/util/DevicesAdapter.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/util/DevicesAdapter.java b/src/main/java/com/nutomic/syncthingandroid/util/DevicesAdapter.java index 4488f918..c9733b56 100644 --- a/src/main/java/com/nutomic/syncthingandroid/util/DevicesAdapter.java +++ b/src/main/java/com/nutomic/syncthingandroid/util/DevicesAdapter.java @@ -2,6 +2,7 @@ package com.nutomic.syncthingandroid.util; import android.content.Context; import android.content.res.Resources; +import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -53,7 +54,10 @@ public class DevicesAdapter extends ArrayAdapter String deviceId = getItem(position).deviceID; RestApi.Connection conn = mConnections.get(deviceId); - name.setText(getItem(position).name); + String displayName = (TextUtils.isEmpty(getItem(position).name)) + ? deviceId.substring(0, 7) + : getItem(position).name; + name.setText(displayName); Resources r = getContext().getResources(); if (conn != null && conn.connected) { if (conn.completion == 100) {