Android Open Source - edu-video-client Mock Rest Actions






From Project

Back to project page edu-video-client.

License

The source code is released under:

Apache License

If you think the Android project edu-video-client 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.ngm.explaintome.service;
/* w  w  w  . jav  a2 s .  c  o  m*/
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import android.os.Handler;

import android.widget.EditText;
import com.ngm.explaintome.data.*;

public class MockRestActions implements RestActions {

  @Override
  public void getVideos(List<Tag> tags, Callback<List<Video>> callback) {
    final ArrayList<Tag> tagList = new ArrayList<Tag>();
    Tag tag = new Tag();
    tag.setName("??????? 1");

    tagList.add(tag);

    final ArrayList<Video> arrayList = new ArrayList<Video>();

    Video video1 = new Video();
    video1.setTitle("??????? ?? ???");
    video1.setDescription("?????? ????? ?? ????????? ?? ???");
    video1.setTags(tagList);
    video1.setUri("https://www.youtube.com/watch?v=6aOaxcWA2XM");

    Video video2 = new Video();
    video2.setTitle("??????? ?? ????");
    video2.setDescription("?????? ????? ?? ????????? ?? ????");
    video2.setTags(tagList);
    video2.setUri("https://www.youtube.com/watch?v=HvfQVtSfyAI");

    arrayList.add(video1);
    arrayList.add(video2);

    delay(callback, arrayList);
  }

  @Override
  public void getQuestions(Video video, Callback<List<Question>> callback) {

    final ArrayList<Question> questions = new ArrayList<Question>();

    Question question1 = new Question();

    ArrayList<Answer> answersList = new ArrayList<Answer>();

    Answer answer1 = new Answer();
    answer1.setText("?????????????? ? ????????????? ? ???????????? ????????.");

    Answer answer2 = new Answer();
    answer2.setText("?????????????? ? ?????????? ? ?????????.");

    Answer answer3 = new Answer();
    answer3.setText("????????????? ? ??????????? ????????.");

    Answer answer4 = new Answer();
    answer4.setText("f(x) ? ?????????? ? ??????? ?? ????????????? ??????.");

    answersList.add(answer1);
    answersList.add(answer2);
    answersList.add(answer3);
    answersList.add(answer4);

    question1.setCorrectAnswer(answer1);
    question1.setTimestamp(5000);
    question1
        .setText("????? ??? ??????????? ?? f(x) ?? ?? ???? ????????? ?? ????");
    question1.setQuestionType(QuestionType.MULTIPLE_CHOICE.name());
    question1.setAnswers(answersList);

    Question question2 = new Question();

    final Answer answer21 = new Answer();
    answer21.setText("??????????? ????? x0, ? ?????? f'(x0) = 0.");
    final Answer answer22 = new Answer();
    answer22.setText("???? ?????????? ? ????? ???????? ?? ?????????, ?? ??? ? ?????????.");

    final Answer answer23 = new Answer();
    answer23.setText("???? ?????????? ? ?????????, ?? ??? ?????? ???????? ????????? ? ??????????? ?????????? ? ?????????.");

    final Answer answer24 = new Answer();
    answer24.setText("??????????? ??????????? ?? ????????, ? ????? ?????????? ?????? ?????? ??????? ??????????.");

    question2.setCorrectAnswer(answer21);
    question2.setTimestamp(12000);
    question2.setText("????? ????? ????????? ?? ????");
    question2.setQuestionType(QuestionType.MULTIPLE_CHOICE.name());
    question2.setAnswers(Arrays.asList(answer21, answer22, answer23,
        answer24));

    questions.add(question1);
    questions.add(question2);

    delay(callback, questions);
  }

  @Override
  public void getTags(final Callback<List<Tag>> callback) {
    final ArrayList<Tag> arrayList = new ArrayList<Tag>();
    Tag analiz1 = new Tag();
    analiz1.setName("??????? 1");

    Tag analiz2 = new Tag();
    analiz2.setName("??????? 2");

    Tag algebra = new Tag();
    algebra.setName("?????? ????????");

    arrayList.add(analiz1);
    arrayList.add(analiz2);
    arrayList.add(algebra);

    delay(callback, arrayList);

  }

  private <T> void delay(final Callback<T> callback, final T arrayList) {
    new Handler().postDelayed(new Runnable() {
      @Override
      public void run() {
        callback.call(arrayList);
      }
    }, 50);
  }

  @Override
  public void postTags(Callback<Boolean> callback, List<Tag> tags) {
    // TODO Auto-generated method stub

  }

  @Override
  public void postVideo(Video video, Callback<Video> success) {
    // TODO Auto-generated method stub

  }

}




Java Source Code List

com.ngm.exlpaintome.video.VideoControllerView.java
com.ngm.explaintome.BaseActivity.java
com.ngm.explaintome.BaseListActivity.java
com.ngm.explaintome.BrowseActivity.java
com.ngm.explaintome.ColoredSearchView.java
com.ngm.explaintome.Constants.java
com.ngm.explaintome.ExplainActivity.java
com.ngm.explaintome.FilterableEntity.java
com.ngm.explaintome.FirstActivity.java
com.ngm.explaintome.FixedPagerAdapter.java
com.ngm.explaintome.RestConfig.java
com.ngm.explaintome.VideoViewActivity.java
com.ngm.explaintome.VideosActivity.java
com.ngm.explaintome.YoutubeUrlAsyncTask.java
com.ngm.explaintome.data.Answer.java
com.ngm.explaintome.data.ModelElement.java
com.ngm.explaintome.data.QuestionType.java
com.ngm.explaintome.data.Question.java
com.ngm.explaintome.data.Tag.java
com.ngm.explaintome.data.Video.java
com.ngm.explaintome.modules.ModuleProvider.java
com.ngm.explaintome.service.Callback.java
com.ngm.explaintome.service.MockRestActions.java
com.ngm.explaintome.service.RestActionsImpl.java
com.ngm.explaintome.service.RestActions.java