Closed croccio closed 9 years ago
Ok I ever think to use parcelable in Emmet, but haven't implemented it yet, but I think it's time to add it.
For now I encode with gson when the type is not primary (not int,float,string,double...), but yes Parcelable is more efficient thant gson.
I'll try to add it as soon as possible, can you try to replace QUIWearResponseType with an String or Integer and try if it's working please ? It's just a small fix to continue your work until I continue the development of Emmet
it give me error :(
i replace it with integer
the list is very long. can this be a problem?
I don't think so, gson can serialize/deserialize a list of 1000 elements or more. oh ! what's in QICoupon ?
package com.paybay.quiapi.model.answer;
import org.parceler.Parcel;
import java.util.Date; import java.util.List;
/**
@Parcel public class QUICoupon {
String ticketErpCode;
String barCodeUrl;
byte progTicketStatusTypeId;
String descTicketStatusType;
String ticketType;
Date expirationDate;
String title;
float value;
QUIPromotion promotionCampaign;
String progTicketValueTypeId;
public QUICoupon(){}
public String getTicketErpCode() {
return ticketErpCode;
}
public void setTicketErpCode(String ticketErpCode) {
this.ticketErpCode = ticketErpCode;
}
public String getBarCodeUrl() {
return barCodeUrl;
}
public void setBarCodeUrl(String barCodeUrl) {
this.barCodeUrl = barCodeUrl;
}
public byte getProgTicketStatusTypeId() {
return progTicketStatusTypeId;
}
public void setProgTicketStatusTypeId(byte progTicketStatusTypeId) {
this.progTicketStatusTypeId = progTicketStatusTypeId;
}
public String getDescTicketStatusType() {
return descTicketStatusType;
}
public void setDescTicketStatusType(String descTicketStatusType) {
this.descTicketStatusType = descTicketStatusType;
}
public String getTicketType() {
return ticketType;
}
public void setTicketType(String ticketType) {
this.ticketType = ticketType;
}
public Date getExpirationDate() {
return expirationDate;
}
public void setExpirationDate(Date expirationDate) {
this.expirationDate = expirationDate;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public float getValue() {
return value;
}
public void setValue(float value) {
this.value = value;
}
public QUIPromotion getPromotionCampaign() {
return promotionCampaign;
}
public void setPromotionCampaign(QUIPromotion promotionCampaign) {
this.promotionCampaign = promotionCampaign;
}
public String getProgTicketValueTypeId() {
return progTicketValueTypeId;
}
public void setProgTicketValueTypeId(String progTicketValueTypeId) {
this.progTicketValueTypeId = progTicketValueTypeId;
}
}
i don't think the problem is in that class, because i can't send other custom object
I don't know if gson can encode enums
i use classes without enums but with another custom object as property. i can use only simple object with "standard" object as object in sample
ok, I'll try with a class containing another class as property
Class MySecondObject{ private String name; }
Class MyObject{ private MySecondObject mySecondObject; }
I come back to you ASAP
thank you very much! if your test is ok than i'll try to implement parcelable in a fork of lib (maybe parcelble don't give problem)
i make it works, but object's properties sended from smartphone to smart watch are null (on smartphone before send are with value)
I'm now home I can work on Emmet, can you send me your objects witch have null values please, si I can test
I made a small modification an it works on my sample, with
public class MyObject implements Serializable{
private String name;
private MySecondObject mySecondObject;
private List<MySecondObject> list;
public MyObject(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public MySecondObject getMySecondObject() {
return mySecondObject;
}
public void setMySecondObject(MySecondObject mySecondObject) {
this.mySecondObject = mySecondObject;
}
public List<MySecondObject> getList() {
return list;
}
public void setList(List<MySecondObject> list) {
this.list = list;
}
}
and
public class MySecondObject implements Serializable {
private String name;
private int value;
private float percent;
public MySecondObject(String name, int value, float percent) {
this.name = name;
this.value = value;
this.percent = percent;
}
public String getName() {
return name;
}
public int getValue() {
return value;
}
public float getPercent() {
return percent;
}
}
I sent a new version, 1.0.1, can you check ?
Object is too big to push it via Google Play Services
i get it with another library, so i think problem could be this
oh :/ try to send smaller objects containing just usefull informations / properties
you can close i've resolved
thank you :D
i've implemented this library in my app. when i send request from smart watch to smartphone no problem. but when i send response from smartphone to android wear in log i see
i haven't put that log in my app, so i think it is your log. can you help me to identify that "error"? here you are my impl:
ANDROID WEAR
public class CouponActivity extends QUIWearActivity {
SMARTPHONE
public class WearService extends EmmetWearableListenerService implements SmartphoneProtocol {
PROTOCOL
public interface WearProtocol {
public interface SmartphoneProtocol {
}
QUICoupon model is a parcelable. to create parcel i use this lib https://github.com/johncarl81/parceler