Android Open Source - Android-VKontakte-SDK Album






From Project

Back to project page Android-VKontakte-SDK.

License

The source code is released under:

MIT License

If you think the Android project Android-VKontakte-SDK listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.perm.kate.api;
//  www .  jav  a 2 s  .  com
import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;

public class Album implements Serializable {
    public long aid;
    public long thumb_id;
    public long owner_id;
    public String title;
    public String description;
    public long created;
    public long updated;
    public long size;
    public long privacy;
    public long comment_privacy;
    public String thumb_src;

    public static Album parse(JSONObject o) throws JSONException {
        Album a = new Album();
        a.title = Api.unescape(o.optString("title"));
        a.aid = Long.parseLong(o.getString("id"));
        a.owner_id = Long.parseLong(o.getString("owner_id"));
        String description = o.optString("description");
        if (description != null && !description.equals("") && !description.equals("null"))
            a.description = Api.unescape(description);
        String thumb_id = o.optString("thumb_id");
        if (thumb_id != null && !thumb_id.equals("") && !thumb_id.equals("null"))
            a.thumb_id = Long.parseLong(thumb_id);
        String created = o.optString("created");
        if (created != null && !created.equals("") && !created.equals("null"))
            a.created = Long.parseLong(created);
        
        JSONObject privacy=o.optJSONObject("privacy_view");
        if(privacy!=null){
            String type = privacy.optString("type");
            if("all".equals(type))
                a.privacy=0;
            else if("friends".equals(type))
                a.privacy=1;
            else if("friends_of_friends".equals(type))
                a.privacy=2;
            else if("nobody".equals(type))
                a.privacy=3;
            else if("users".equals(type))
                a.privacy=4;
        }
        
        JSONObject privacy_comment=o.optJSONObject("privacy_comment");
        if(privacy_comment!=null){
            String type = privacy_comment.optString("type");
            if("all".equals(type))
                a.comment_privacy=0;
            else if("friends".equals(type))
                a.comment_privacy=1;
            else if("friends_of_friends".equals(type))
                a.comment_privacy=2;
            else if("nobody".equals(type))
                a.comment_privacy=3;
            else if("users".equals(type))
                a.comment_privacy=4;
        }
        
        a.size = o.optLong("size");
        String updated = o.optString("updated");
        if (updated != null && !updated.equals("") && !updated.equals("null"))
            a.updated = Long.parseLong(updated);
        a.thumb_src = o.optString("thumb_src");
        return a;
    }
    
    public static Album parseFromAttachment(JSONObject o) throws JSONException {
        Album a = new Album();
        a.title = Api.unescape(o.optString("title"));
        a.aid = Long.parseLong(o.getString("id"));
        a.owner_id = Long.parseLong(o.getString("owner_id"));
        return a;
    }
}




Java Source Code List

com.perm.kate.api.Album.java
com.perm.kate.api.Api.java
com.perm.kate.api.Attachment.java
com.perm.kate.api.AudioAlbum.java
com.perm.kate.api.Audio.java
com.perm.kate.api.Auth.java
com.perm.kate.api.BanInfo.java
com.perm.kate.api.BannArg.java
com.perm.kate.api.City.java
com.perm.kate.api.CommentList.java
com.perm.kate.api.Comment.java
com.perm.kate.api.Constants.java
com.perm.kate.api.Contact.java
com.perm.kate.api.Counters.java
com.perm.kate.api.Country.java
com.perm.kate.api.Document.java
com.perm.kate.api.FriendsList.java
com.perm.kate.api.Geo.java
com.perm.kate.api.Gift.java
com.perm.kate.api.Graffiti.java
com.perm.kate.api.GroupBanItem.java
com.perm.kate.api.GroupTopic.java
com.perm.kate.api.Group.java
com.perm.kate.api.IdsPair.java
com.perm.kate.api.KException.java
com.perm.kate.api.LastActivity.java
com.perm.kate.api.Link.java
com.perm.kate.api.Media.java
com.perm.kate.api.Message.java
com.perm.kate.api.NameCases.java
com.perm.kate.api.NewsItem.java
com.perm.kate.api.NewsJTags.java
com.perm.kate.api.NewsTypes.java
com.perm.kate.api.Newsfeed.java
com.perm.kate.api.Note.java
com.perm.kate.api.Notification.java
com.perm.kate.api.Notifications.java
com.perm.kate.api.Page.java
com.perm.kate.api.Params.java
com.perm.kate.api.PhotoComment.java
com.perm.kate.api.PhotoTag.java
com.perm.kate.api.Photo.java
com.perm.kate.api.Place.java
com.perm.kate.api.Reply.java
com.perm.kate.api.SearchDialogItem.java
com.perm.kate.api.User.java
com.perm.kate.api.Video.java
com.perm.kate.api.VkApp.java
com.perm.kate.api.VkPollAnswer.java
com.perm.kate.api.VkPoll.java
com.perm.kate.api.VkStatus.java
com.perm.kate.api.WallMessage.java
com.perm.kate.api.sample.Account.java
com.perm.kate.api.sample.Constants.java
com.perm.kate.api.sample.LoginActivity.java
com.perm.kate.api.sample.MainActivity.java
com.perm.utils.Utils.java
com.perm.utils.WrongResponseCodeException.java