Refresh data on "Back", allow configuration of View + border
[jvcard.git] / src / be / nikiroo / jvcard / Contact.java
index 87c1286a77093d436148a1563015f789e1b9beb6..1b888961466737bace2f6f647ee5d9d21b2b739b 100644 (file)
@@ -11,7 +11,7 @@ import java.util.UUID;
 
 import be.nikiroo.jvcard.parsers.Format;
 import be.nikiroo.jvcard.parsers.Parser;
-import be.nikiroo.jvcard.tui.StringUtils;
+import be.nikiroo.jvcard.resources.StringUtils;
 
 /**
  * A contact is the information that represent a contact person or organisation.
@@ -47,13 +47,9 @@ public class Contact extends BaseClass<Data> {
                for (Data data : getData(name)) {
                        if (first == null)
                                first = data;
-                       for (int index = 0; index < data.size(); index++) {
-                               TypeInfo type = data.get(index);
-                               if (type.getName().equals("TYPE")
-                                               && type.getValue().equals("pref")) {
-                                       return data;
-                               }
-                       }
+
+                       if (data.isPreferred())
+                               return data;
                }
 
                return first;
@@ -418,7 +414,7 @@ public class Contact extends BaseClass<Data> {
 
        @Override
        public String getState() {
-               return "" + getPreferredDataValue("UID");
+               return getId();
        }
 
        /**