Beispiel #1
0
    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
      super.setUserVisibleHint(isVisibleToUser);
      if (this.isVisible()) {
        if (!isVisibleToUser) // If we are becoming invisible, then...
        {
          ((MediaVideoView) gif).pause();
          gif.setVisibility(View.GONE);
        }

        if (isVisibleToUser) // If we are becoming visible, then...
        {
          ((MediaVideoView) gif).start();
          gif.setVisibility(View.VISIBLE);
        }
      }
    }
Beispiel #2
0
 public void doLoadGif(final String dat) {
   isGif = true;
   videoView = (MediaVideoView) rootView.findViewById(R.id.gif);
   videoView.clearFocus();
   videoView.setZOrderOnTop(true);
   rootView.findViewById(R.id.gifarea).setVisibility(View.VISIBLE);
   rootView.findViewById(R.id.submission_image).setVisibility(View.GONE);
   final ProgressBar loader = (ProgressBar) rootView.findViewById(R.id.gifprogress);
   rootView.findViewById(R.id.progress).setVisibility(View.GONE);
   gif =
       new GifUtils.AsyncLoadGif(
           getActivity(),
           (MediaVideoView) rootView.findViewById(R.id.gif),
           loader,
           rootView.findViewById(R.id.placeholder),
           true,
           false,
           false);
   gif.execute(dat);
 }
Beispiel #3
0
    @Override
    public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      rootView = (ViewGroup) inflater.inflate(R.layout.submission_gifcard_album, container, false);
      loader = (ProgressBar) rootView.findViewById(R.id.gifprogress);

      TitleTextView title = (TitleTextView) rootView.findViewById(R.id.title);
      SpoilerRobotoTextView desc = (SpoilerRobotoTextView) rootView.findViewById(R.id.desc);

      title.setVisibility(View.VISIBLE);
      desc.setVisibility(View.VISIBLE);
      if (user.getAsJsonObject().has("image")) {
        if (!user.getAsJsonObject().getAsJsonObject("image").get("title").isJsonNull()) {
          List<String> text =
              SubmissionParser.getBlocks(
                  user.getAsJsonObject().getAsJsonObject("image").get("title").getAsString());
          desc.setTextHtml(text.get(0));
          if (desc.getText().toString().isEmpty()) {
            desc.setVisibility(View.GONE);
          }
        } else {
          desc.setVisibility(View.GONE);
        }
        if (!user.getAsJsonObject().getAsJsonObject("image").get("caption").isJsonNull()) {

          title.setTextHtml(
              user.getAsJsonObject().getAsJsonObject("image").get("caption").getAsString(),
              "FORCE_LINK_HANDLING");
          if (title.getText().toString().isEmpty()) {
            title.setVisibility(View.GONE);
          }
        } else {
          title.setVisibility(View.GONE);
        }
      } else {
        if (user.getAsJsonObject().has("title")) {
          desc.setTextHtml(
              user.getAsJsonObject().get("title").getAsString(), "FORCE_LINK_HANDLING");

          if (desc.getText().toString().isEmpty()) {
            desc.setVisibility(View.GONE);
          }

        } else {
          desc.setVisibility(View.GONE);
        }
        if (user.getAsJsonObject().has("description")) {
          title.setTextHtml(
              user.getAsJsonObject().get("description").getAsString(), "FORCE_LINK_HANDLING");
          if (title.getText().toString().isEmpty()) {
            title.setVisibility(View.GONE);
          }
        } else {
          title.setVisibility(View.GONE);
        }
      }
      gif = rootView.findViewById(R.id.gif);

      gif.setVisibility(View.VISIBLE);
      final MediaVideoView v = (MediaVideoView) gif;
      v.clearFocus();

      String dat;
      if (gallery) {

        dat =
            ("https://imgur.com/"
                + images.get(i).getAsJsonObject().get("hash").getAsString()
                + ".gif");

      } else {
        dat =
            (images
                .get(i)
                .getAsJsonObject()
                .getAsJsonObject("links")
                .get("original")
                .getAsString());
      }

      new GifUtils.AsyncLoadGif(
              AlbumPager.this,
              (MediaVideoView) rootView.findViewById(R.id.gif),
              loader,
              null,
              null,
              false)
          .execute(dat);

      return rootView;
    }