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.Nullable;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.mariotaku.querybuilder.Columns.Column;
import org.mariotaku.querybuilder.Expression;
import org.mariotaku.querybuilder.RawItemArray;
@ -38,6 +41,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@JsonObject
public class ParcelableAccount implements Parcelable {
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;
public final int color;
public final boolean is_activated;
public final boolean is_dummy;
@JsonField(name = "screen_name")
public String screen_name;
@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) {
is_dummy = false;
@ -164,7 +187,7 @@ public class ParcelableAccount implements Parcelable {
}
@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];
try {
cursor.moveToFirst();
@ -264,6 +287,7 @@ public class ParcelableAccount implements Parcelable {
+ ", is_activated=" + is_activated + ", is_dummy=" + is_dummy + "}";
}
@JsonObject
public static class ParcelableCredentials extends ParcelableAccount {
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;
public final String basic_auth_username, basic_auth_password;
public final String oauth_token, oauth_token_secret;
public final String api_url_format;
public final boolean same_oauth_signing_url, no_version_suffix;
@JsonField(name = "auth_type")
public int auth_type;
@JsonField(name = "consumer_key")
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) {
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;
@JsonField(name = "long")
@JsonField(name = "id")
public long id;
@JsonField(name = "long")
@JsonField(name = "timestamp")
public long timestamp;
@JsonField(name = "long")
@JsonField(name = "sender_id")
public long sender_id;
@JsonField(name = "long")
@JsonField(name = "recipient_id")
public long recipient_id;
@JsonField(name = "boolean")
@JsonField(name = "is_outgoing")
public boolean is_outgoing;
@JsonField(name = "String")
@JsonField(name = "text_html")
public String text_html;
@JsonField(name = "String")
@JsonField(name = "text_plain")
public String text_plain;
@JsonField(name = "String")
@JsonField(name = "text_unescaped")
public String text_unescaped;
@JsonField(name = "String")
@JsonField(name = "sender_name")
public String sender_name;
@JsonField(name = "String")
@JsonField(name = "recipient_name")
public String recipient_name;
@JsonField(name = "String")
@JsonField(name = "sender_screen_name")
public String sender_screen_name;
@JsonField(name = "String")
@JsonField(name = "recipient_screen_name")
public String recipient_screen_name;
@JsonField(name = "String")
@JsonField(name = "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;
@JsonField(name = "ParcelableMedia[]")
@JsonField(name = "media")
public ParcelableMedia[] media;
public ParcelableDirectMessage(final ContentValues values) {

View File

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

View File

@ -9,70 +9,74 @@ import com.bluelinelabs.logansquare.annotation.JsonObject;
@JsonObject
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
public StatusShortenResult createFromParcel(final Parcel source) {
return new StatusShortenResult(source);
}
@Override
public StatusShortenResult createFromParcel(final Parcel source) {
return new StatusShortenResult(source);
}
@Override
public StatusShortenResult[] newArray(final int size) {
return new StatusShortenResult[size];
}
};
@Override
public StatusShortenResult[] newArray(final int 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) {
if (errorCode == 0) throw new IllegalArgumentException("Error code must not be 0");
shortened = null;
error_code = errorCode;
error_message = errorMessage;
}
@JsonField(name = "shortened")
public String shortened;
public StatusShortenResult(final Parcel src) {
shortened = src.readString();
error_code = src.readInt();
error_message = src.readString();
}
@JsonField(name = "error_code")
public int error_code;
public StatusShortenResult(final String shortened) {
if (shortened == null) throw new IllegalArgumentException("Shortened text must not be null");
this.shortened = shortened;
error_code = 0;
error_message = null;
}
@JsonField(name = "error_message")
public String error_message;
@Override
public int describeContents() {
return 0;
}
public StatusShortenResult(final int errorCode, final String errorMessage) {
if (errorCode == 0) throw new IllegalArgumentException("Error code must not be 0");
shortened = null;
error_code = errorCode;
error_message = errorMessage;
}
@Override
public String toString() {
return "StatusShortenResult{shortened=" + shortened + ", error_code=" + error_code + ", error_message="
+ error_message + "}";
}
public StatusShortenResult(final Parcel src) {
shortened = src.readString();
error_code = src.readInt();
error_message = src.readString();
}
@Override
public void writeToParcel(final Parcel dest, final int flags) {
dest.writeString(shortened);
dest.writeInt(error_code);
dest.writeString(error_message);
}
public StatusShortenResult(final String shortened) {
if (shortened == null)
throw new IllegalArgumentException("Shortened text must not be null");
this.shortened = shortened;
error_code = 0;
error_message = null;
}
public static StatusShortenResult getInstance(final int errorCode, final String errorMessage) {
return new StatusShortenResult(errorCode, errorMessage);
}
@Override
public int describeContents() {
return 0;
}
public static StatusShortenResult getInstance(final String shortened) {
return new StatusShortenResult(shortened);
}
@Override
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 = "ParcelFileDescriptor")
public ParcelFileDescriptor fd;
@JsonField(name = "long")
public long size;
@JsonField(name = "path")
public String path;
@JsonField(name = "fd")
public ParcelFileDescriptor fd;
@JsonField(name = "size")
public long size;
public UploaderMediaItem(final Context context, final ParcelableMediaUpdate media) throws FileNotFoundException {
path = Uri.parse(media.uri).getPath();