コード例 #1
0
  @Override
  public void addAnswer(Question parent, Answer newAnswer) {
    addedOffline = true;
    mProfileManager.saveNewPostAttributes(newAnswer);

    parent.addAnswer(newAnswer);
    save();
  }
コード例 #2
0
  // TODO: Delete this later!
  private void loadTestQuestions() {
    Question q1 =
        new Question(
            "Is anyone able to give me a demo please!", "gregthegreg", "How does this app work?");
    q1.setLocation(new LatLng(53.633033467692506, -113.62990535795689));

    Answer a1 = new Answer("OH wait, just look at the demo vid on youtube!", "gregthegreg");
    a1.setExistsOnline(true);
    Answer a2 =
        new Answer(
            "Confirmed, video does an excellent job of explaining how the app works", "djhindle");
    a2.setExistsOnline(true);

    q1.addAnswer(a1);
    q1.addAnswer(a2);
    q1.incrementVotes();

    Question q2 =
        new Question(
            "What is the difference between a UML class diagram,"
                + "a UML Sequence diagram, and a UML state diagram?",
            "djhindle",
            "UML Diagrams Question");
    q2.incrementVotes();
    q2.incrementVotes();
    Calendar cal = Calendar.getInstance();
    cal.set(2014, Calendar.NOVEMBER, 21);
    q2.setDate(cal.getTime());

    // Q3 tests the concatenating of long titles/text
    Question q3 =
        new Question(
            "Hey DJ Hindle help me out?? I deleted my System 32 folder like you said,"
                + "but now I'm getting this weird blue screen when I start"
                + "my computer??? What's going on? How do I fix it. Is this a"
                + "virus or what?",
            "gregthegreg",
            "What is this weird blue screen??");
    q2.setLocation(new LatLng(53.5333, -113.5000));
    q2.setVotes(5);
    q3.setVotes(15);

    Question q4 =
        new Question(
            "Just FYI I've been using StackUnderflow since before it was even a thing so...",
            "hipSTAR",
            "DAE use this app?");
    cal.set(2014, Calendar.AUGUST, 1);
    q4.setDate(cal.getTime());

    Answer a3 = new Answer("Don't call me DJ Hindle :/", "djhindle");
    a3.setExistsOnline(true);
    Answer a4 = new Answer("It's a virus LOL", "marco-yolo");
    a4.setExistsOnline(true);

    q3.addAnswer(a3);
    q3.addAnswer(a4);

    mQuestions.add(q1);
    mQuestions.add(q2);
    mQuestions.add(q3);
    mQuestions.add(q4);
  }