fixed wrong field name

This commit is contained in:
Mariotaku Lee 2015-04-23 23:09:13 +08:00
parent 921be18099
commit 240aaf1b22
5 changed files with 154 additions and 99 deletions

View File

@ -27,6 +27,9 @@ import android.os.Parcelable;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.mariotaku.querybuilder.Columns.Column; import org.mariotaku.querybuilder.Columns.Column;
import org.mariotaku.querybuilder.Expression; import org.mariotaku.querybuilder.Expression;
import org.mariotaku.querybuilder.RawItemArray; import org.mariotaku.querybuilder.RawItemArray;
@ -38,6 +41,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@JsonObject
public class ParcelableAccount implements Parcelable { public class ParcelableAccount implements Parcelable {
public static final Parcelable.Creator<ParcelableAccount> CREATOR = new Parcelable.Creator<ParcelableAccount>() { public static final Parcelable.Creator<ParcelableAccount> CREATOR = new Parcelable.Creator<ParcelableAccount>() {
@ -53,11 +57,30 @@ public class ParcelableAccount implements Parcelable {
} }
}; };
public final String screen_name, name, profile_image_url, profile_banner_url;
public final long account_id; @JsonField(name = "screen_name")
public final int color; public String screen_name;
public final boolean is_activated;
public final boolean is_dummy; @JsonField(name = "name")
public String name;
@JsonField(name = "profile_image_url")
public String profile_image_url;
@JsonField(name = "profile_banner_url")
public String profile_banner_url;
@JsonField(name = "account_id")
public long account_id;
@JsonField(name = "color")
public int color;
@JsonField(name = "is_activated")
public boolean is_activated;
@JsonField(name = "is_dummy")
public boolean is_dummy;
public ParcelableAccount(final Cursor cursor, final Indices indices) { public ParcelableAccount(final Cursor cursor, final Indices indices) {
is_dummy = false; is_dummy = false;
@ -164,7 +187,7 @@ public class ParcelableAccount implements Parcelable {
} }
@NonNull @NonNull
public static ParcelableAccount[] getAccounts(@Nullable final Cursor cursor,@Nullable final Indices indices) { public static ParcelableAccount[] getAccounts(@Nullable final Cursor cursor, @Nullable final Indices indices) {
if (cursor == null || indices == null) return new ParcelableAccount[0]; if (cursor == null || indices == null) return new ParcelableAccount[0];
try { try {
cursor.moveToFirst(); cursor.moveToFirst();
@ -264,6 +287,7 @@ public class ParcelableAccount implements Parcelable {
+ ", is_activated=" + is_activated + ", is_dummy=" + is_dummy + "}"; + ", is_activated=" + is_activated + ", is_dummy=" + is_dummy + "}";
} }
@JsonObject
public static class ParcelableCredentials extends ParcelableAccount { public static class ParcelableCredentials extends ParcelableAccount {
public static final Parcelable.Creator<ParcelableCredentials> CREATOR = new Parcelable.Creator<ParcelableCredentials>() { public static final Parcelable.Creator<ParcelableCredentials> CREATOR = new Parcelable.Creator<ParcelableCredentials>() {
@ -279,12 +303,36 @@ public class ParcelableAccount implements Parcelable {
} }
}; };
public final int auth_type;
public final String consumer_key, consumer_secret; @JsonField(name = "auth_type")
public final String basic_auth_username, basic_auth_password; public int auth_type;
public final String oauth_token, oauth_token_secret;
public final String api_url_format; @JsonField(name = "consumer_key")
public final boolean same_oauth_signing_url, no_version_suffix; public String consumer_key;
@JsonField(name = "consumer_secret")
public String consumer_secret;
@JsonField(name = "basic_auth_username")
public String basic_auth_username;
@JsonField(name = "basic_auth_password")
public String basic_auth_password;
@JsonField(name = "oauth_token")
public String oauth_token;
@JsonField(name = "oauth_token_secret")
public String oauth_token_secret;
@JsonField(name = "api_url_format")
public String api_url_format;
@JsonField(name = "same_oauth_signing_url")
public boolean same_oauth_signing_url;
@JsonField(name = "no_version_suffix")
public boolean no_version_suffix;
public ParcelableCredentials(final Cursor cursor, final Indices indices) { public ParcelableCredentials(final Cursor cursor, final Indices indices) {
super(cursor, indices); super(cursor, indices);

View File

@ -66,43 +66,44 @@ public class ParcelableDirectMessage implements Parcelable, Comparable<Parcelabl
} }
}; };
@JsonField(name = "long")
@JsonField(name = "account_id")
public long account_id; public long account_id;
@JsonField(name = "long") @JsonField(name = "id")
public long id; public long id;
@JsonField(name = "long") @JsonField(name = "timestamp")
public long timestamp; public long timestamp;
@JsonField(name = "long") @JsonField(name = "sender_id")
public long sender_id; public long sender_id;
@JsonField(name = "long") @JsonField(name = "recipient_id")
public long recipient_id; public long recipient_id;
@JsonField(name = "boolean") @JsonField(name = "is_outgoing")
public boolean is_outgoing; public boolean is_outgoing;
@JsonField(name = "String") @JsonField(name = "text_html")
public String text_html; public String text_html;
@JsonField(name = "String") @JsonField(name = "text_plain")
public String text_plain; public String text_plain;
@JsonField(name = "String") @JsonField(name = "text_unescaped")
public String text_unescaped; public String text_unescaped;
@JsonField(name = "String") @JsonField(name = "sender_name")
public String sender_name; public String sender_name;
@JsonField(name = "String") @JsonField(name = "recipient_name")
public String recipient_name; public String recipient_name;
@JsonField(name = "String") @JsonField(name = "sender_screen_name")
public String sender_screen_name; public String sender_screen_name;
@JsonField(name = "String") @JsonField(name = "recipient_screen_name")
public String recipient_screen_name; public String recipient_screen_name;
@JsonField(name = "String") @JsonField(name = "sender_profile_image_url")
public String sender_profile_image_url; public String sender_profile_image_url;
@JsonField(name = "String") @JsonField(name = "recipient_profile_image_url")
public String recipient_profile_image_url; public String recipient_profile_image_url;
@JsonField(name = "ParcelableMedia[]") @JsonField(name = "media")
public ParcelableMedia[] media; public ParcelableMedia[] media;
public ParcelableDirectMessage(final ContentValues values) { public ParcelableDirectMessage(final ContentValues values) {

View File

@ -43,17 +43,18 @@ public class ParcelableStatusUpdate implements Parcelable {
} }
}; };
@JsonField(name = "ParcelableAccount[]") @JsonField(name = "accounts")
public ParcelableAccount[] accounts; public ParcelableAccount[] accounts;
@JsonField(name = "ParcelableMediaUpdate[]") @JsonField(name = "media")
public ParcelableMediaUpdate[] media; public ParcelableMediaUpdate[] media;
@JsonField(name = "String") @JsonField(name = "text")
public String text; public String text;
@JsonField(name = "ParcelableLocation") @JsonField(name = "location")
public ParcelableLocation location; public ParcelableLocation location;
@JsonField(name = "long") @JsonField(name = "in_reply_to_status_id")
public long in_reply_to_status_id; public long in_reply_to_status_id;
public final boolean is_possibly_sensitive; @JsonField(name = "boolean")
public boolean is_possibly_sensitive;
/** /**
* @deprecated It has too much arguments to call, use * @deprecated It has too much arguments to call, use

View File

@ -9,70 +9,74 @@ import com.bluelinelabs.logansquare.annotation.JsonObject;
@JsonObject @JsonObject
public class StatusShortenResult implements Parcelable { public class StatusShortenResult implements Parcelable {
public static final Parcelable.Creator<StatusShortenResult> CREATOR = new Parcelable.Creator<StatusShortenResult>() { public static final Parcelable.Creator<StatusShortenResult> CREATOR = new Parcelable.Creator<StatusShortenResult>() {
@Override @Override
public StatusShortenResult createFromParcel(final Parcel source) { public StatusShortenResult createFromParcel(final Parcel source) {
return new StatusShortenResult(source); return new StatusShortenResult(source);
} }
@Override @Override
public StatusShortenResult[] newArray(final int size) { public StatusShortenResult[] newArray(final int size) {
return new StatusShortenResult[size]; return new StatusShortenResult[size];
} }
}; };
@JsonField(name = "String")
public String shortened;
@JsonField(name = "int")
public int error_code;
@JsonField(name = "String")
public String error_message;
public StatusShortenResult(final int errorCode, final String errorMessage) { @JsonField(name = "shortened")
if (errorCode == 0) throw new IllegalArgumentException("Error code must not be 0"); public String shortened;
shortened = null;
error_code = errorCode;
error_message = errorMessage;
}
public StatusShortenResult(final Parcel src) { @JsonField(name = "error_code")
shortened = src.readString(); public int error_code;
error_code = src.readInt();
error_message = src.readString();
}
public StatusShortenResult(final String shortened) { @JsonField(name = "error_message")
if (shortened == null) throw new IllegalArgumentException("Shortened text must not be null"); public String error_message;
this.shortened = shortened;
error_code = 0;
error_message = null;
}
@Override public StatusShortenResult(final int errorCode, final String errorMessage) {
public int describeContents() { if (errorCode == 0) throw new IllegalArgumentException("Error code must not be 0");
return 0; shortened = null;
} error_code = errorCode;
error_message = errorMessage;
}
@Override public StatusShortenResult(final Parcel src) {
public String toString() { shortened = src.readString();
return "StatusShortenResult{shortened=" + shortened + ", error_code=" + error_code + ", error_message=" error_code = src.readInt();
+ error_message + "}"; error_message = src.readString();
} }
@Override public StatusShortenResult(final String shortened) {
public void writeToParcel(final Parcel dest, final int flags) { if (shortened == null)
dest.writeString(shortened); throw new IllegalArgumentException("Shortened text must not be null");
dest.writeInt(error_code); this.shortened = shortened;
dest.writeString(error_message); error_code = 0;
} error_message = null;
}
public static StatusShortenResult getInstance(final int errorCode, final String errorMessage) { @Override
return new StatusShortenResult(errorCode, errorMessage); public int describeContents() {
} return 0;
}
public static StatusShortenResult getInstance(final String shortened) { @Override
return new StatusShortenResult(shortened); public String toString() {
} return "StatusShortenResult{shortened=" + shortened + ", error_code=" + error_code + ", error_message="
+ error_message + "}";
}
@Override
public void writeToParcel(final Parcel dest, final int flags) {
dest.writeString(shortened);
dest.writeInt(error_code);
dest.writeString(error_message);
}
public static StatusShortenResult getInstance(final int errorCode, final String errorMessage) {
return new StatusShortenResult(errorCode, errorMessage);
}
public static StatusShortenResult getInstance(final String shortened) {
return new StatusShortenResult(shortened);
}
} }

View File

@ -28,12 +28,13 @@ public class UploaderMediaItem implements Parcelable {
} }
}; };
@JsonField(name = "String")
public String path; @JsonField(name = "path")
@JsonField(name = "ParcelFileDescriptor") public String path;
public ParcelFileDescriptor fd; @JsonField(name = "fd")
@JsonField(name = "long") public ParcelFileDescriptor fd;
public long size; @JsonField(name = "size")
public long size;
public UploaderMediaItem(final Context context, final ParcelableMediaUpdate media) throws FileNotFoundException { public UploaderMediaItem(final Context context, final ParcelableMediaUpdate media) throws FileNotFoundException {
path = Uri.parse(media.uri).getPath(); path = Uri.parse(media.uri).getPath();