1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-30 08:11:17 +00:00

Display partial ID if device name is empty (fixes #419).

This commit is contained in:
Felix Ableitner 2016-01-21 23:12:14 +01:00
parent 13870c0424
commit 41943502d4

View file

@ -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<RestApi.Device>
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) {