app/src/main/java/net/nashlegend/sourcewall/model/Answer.java

(开头部分) 10KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package net.nashlegend.sourcewall.model;

import android.os.Parcel;

import net.nashlegend.sourcewall.request.api.APIBase;
import net.nashlegend.sourcewall.util.RegUtil;

import org.json.JSONObject;

/**
 * Created by NashLegend on 2014/9/16 0016
 */
public class Answer extends AceModel {

    private static int maxImageWidth = 240;
    private static String prefix = "<div class=\"ZoomBox\"><div class=\"content-zoom ZoomIn\">";
    private static String suffix = "</div></div>";
    private String content = "";
    private String simplifiedContent = "";
    private String date_created = "";
    private String date_modified = "";
    private Author author;
    private String ID = "";
    private String questionID = "";
    private String question = "";
    private int commentNum = 0;
    private int upvoteNum = 0;
    private int downvoteNum = 0;
    private boolean hasUpVoted = false;
    private boolean hasDownVoted = false;
    private boolean hasBuried = false;
    private boolean hasThanked = false;
    private boolean isContentComplex = false;

    public Answer() {
    }

    public static Answer fromJson(JSONObject answerObject) throws Exception {
        String hostTitle = "";
        String hostID = "";
        if (answerObject.has("question_id")) {
            hostID = answerObject.optString("question_id");
        } else {
            JSONObject questionObject = answerObject.optJSONObject("question");
            if (questionObject != null) {
                hostID = questionObject.optString("id");
                hostTitle = questionObject.optString("question");
            }
        }
        String id = answerObject.optString("id");
        boolean current_user_has_supported = answerObject.optBoolean("current_user_has_supported");
        boolean current_user_has_buried = answerObject.optBoolean("current_user_has_buried");
        boolean current_user_has_thanked = answerObject.optBoolean("current_user_has_thanked");
        boolean current_user_has_opposed = answerObject.optBoolean("current_user_has_opposed");
        JSONObject authorObject = answerObject.optJSONObject("author");
        String date_created = APIBase.parseDate(answerObject.optString("date_created"));
        String date_modified = APIBase.parseDate(answerObject.optString("date_modified"));
        int replies_count = answerObject.optInt("replies_count");
        int supportings_count = answerObject.optInt("supportings_count");
        int opposings_count = answerObject.optInt("opposings_count");
后面还有 249 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。