mirror of
https://github.com/etesync/android
synced 2024-11-29 11:28:19 +00:00
fix annoying bug that marked contacts as starred
This commit is contained in:
parent
5d3ef61b77
commit
6727987051
@ -13,13 +13,18 @@ public class Starred extends Property {
|
|||||||
|
|
||||||
public static final String PROPERTY_NAME = "DAVDROID-STARRED";
|
public static final String PROPERTY_NAME = "DAVDROID-STARRED";
|
||||||
|
|
||||||
public Starred() {
|
protected boolean isStarred;
|
||||||
|
|
||||||
|
|
||||||
|
public Starred(String value) {
|
||||||
super(PROPERTY_NAME);
|
super(PROPERTY_NAME);
|
||||||
|
|
||||||
|
isStarred = Integer.parseInt(value) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return "1";
|
return isStarred ? "1" : "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -30,12 +35,12 @@ public class Starred extends Property {
|
|||||||
public static class Factory implements PropertyFactory<Property> {
|
public static class Factory implements PropertyFactory<Property> {
|
||||||
@Override
|
@Override
|
||||||
public Starred createProperty(List<Parameter> params, String value) {
|
public Starred createProperty(List<Parameter> params, String value) {
|
||||||
return new Starred();
|
return new Starred(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Starred createProperty(Group group, List<Parameter> params, String value) {
|
public Starred createProperty(Group group, List<Parameter> params, String value) {
|
||||||
return new Starred();
|
return new Starred(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,9 +118,8 @@ public class Contact extends Resource {
|
|||||||
if (uid != null)
|
if (uid != null)
|
||||||
this.uid = uid.getValue();
|
this.uid = uid.getValue();
|
||||||
|
|
||||||
for (Property p : vcard.getExtendedProperties(Starred.PROPERTY_NAME))
|
Starred starred = (Starred)vcard.getExtendedProperty(Starred.PROPERTY_NAME);
|
||||||
Log.i(TAG, p.getValue());
|
this.starred = starred != null && starred.getValue().equals("1");
|
||||||
this.starred = vcard.getExtendedProperty(Starred.PROPERTY_NAME) != null;
|
|
||||||
|
|
||||||
Fn fn = (Fn)vcard.getProperty(Id.FN);
|
Fn fn = (Fn)vcard.getProperty(Id.FN);
|
||||||
displayName = (fn != null) ? fn.getValue() : null;
|
displayName = (fn != null) ? fn.getValue() : null;
|
||||||
@ -193,7 +192,7 @@ public class Contact extends Resource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (starred)
|
if (starred)
|
||||||
properties.add(new Starred());
|
properties.add(new Starred("1"));
|
||||||
|
|
||||||
if (displayName != null)
|
if (displayName != null)
|
||||||
properties.add(new Fn(displayName));
|
properties.add(new Fn(displayName));
|
||||||
|
Loading…
Reference in New Issue
Block a user