Esempio n. 1
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView =
        (ViewGroup) inflater.inflate(R.layout.submission_albumcard, container, false);

    TextView title = (TextView) rootView.findViewById(R.id.title);
    TextView desc = (TextView) rootView.findViewById(R.id.desc);

    title.setText(s.getTitle());
    desc.setText(
        s.getAuthor() + " " + TimeUtils.getTimeAgo(s.getCreated().getTime(), getContext()));
    ContentType.ImageType type = ContentType.getImageType(s);

    String url = "";

    if (s.getUrl().contains("gallery")) {
      gallery = true;
    }

    list = rootView.findViewById(R.id.images);

    list.setVisibility(View.VISIBLE);
    String rawDat = cutEnds(s.getUrl());
    String rawdat2 = rawDat;
    if (rawdat2.substring(rawDat.lastIndexOf("/"), rawdat2.length()).length() < 4) {
      rawDat = rawDat.replace(rawDat.substring(rawDat.lastIndexOf("/"), rawdat2.length()), "");
    }
    if (!rawDat.isEmpty()) {

      new AsyncImageLoaderAlbum().execute(getHash(rawDat));
    }

    rootView
        .findViewById(R.id.base)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                if (Reddit.tabletUI
                    && getActivity().getResources().getConfiguration().orientation
                        == Configuration.ORIENTATION_LANDSCAPE) {
                  Intent i2 = new Intent(getActivity(), CommentsScreenPopup.class);
                  i2.putExtra("page", i);
                  (getActivity()).startActivity(i2);

                } else {
                  Intent i2 = new Intent(getActivity(), CommentsScreen.class);
                  i2.putExtra("page", i);
                  (getActivity()).startActivity(i2);
                }
              }
            });
    return rootView;
  }
Esempio n. 2
0
  private void loadImages(List<Submission> submissions) {
    for (Submission s : submissions) {
      ContentType.Type type = ContentType.getContentType(s);

      String url = "";

      ImageLoadingListener l = new SimpleImageLoadingListener();

      if (type == ContentType.Type.IMAGE) {
        url = s.getUrl();
        if (SettingValues.bigPicEnabled) {
          ((Reddit) mSwipeRefreshLayout.getContext().getApplicationContext())
              .getImageLoader()
              .loadImage(url, l);
        } else {
          if (s.getThumbnailType() != Submission.ThumbnailType.NONE) {
            ((Reddit) mSwipeRefreshLayout.getContext().getApplicationContext())
                .getImageLoader()
                .loadImage(s.getThumbnail(), l);
          }
        }
      } else if (s.getDataNode().has("preview")
          && s.getDataNode().get("preview").get("images").get(0).get("source").has("height")) {
        url = s.getDataNode().get("preview").get("images").get(0).get("source").get("url").asText();
        if (SettingValues.bigPicEnabled) {
          ((Reddit) mSwipeRefreshLayout.getContext().getApplicationContext())
              .getImageLoader()
              .loadImage(url, l);
        } else if (s.getThumbnailType() != Submission.ThumbnailType.NONE) {
          ((Reddit) mSwipeRefreshLayout.getContext().getApplicationContext())
              .getImageLoader()
              .loadImage(s.getThumbnail(), l);
        }
      } else if (s.getThumbnail() != null
          && (s.getThumbnailType() == Submission.ThumbnailType.URL
              || s.getThumbnailType() == Submission.ThumbnailType.NSFW)) {
        if ((s.getThumbnailType() == Submission.ThumbnailType.NSFW)
            || s.getThumbnailType() == Submission.ThumbnailType.URL) {
          if (SettingValues.bigPicEnabled) {
            ((Reddit) mSwipeRefreshLayout.getContext().getApplicationContext())
                .getImageLoader()
                .loadImage(url, l);
          } else if (s.getThumbnailType() != Submission.ThumbnailType.NONE) {
            ((Reddit) mSwipeRefreshLayout.getContext().getApplicationContext())
                .getImageLoader()
                .loadImage(s.getThumbnail(), l);
          }
        }
      }
    }
  }
Esempio n. 3
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = (ViewGroup) inflater.inflate(R.layout.submission_imagecard, container, false);
    image = (SubsamplingScaleImageView) rootView.findViewById(R.id.image);

    PopulateShadowboxInfo.doActionbar(s, rootView, getActivity());

    (rootView.findViewById(R.id.thumbimage2)).setVisibility(View.GONE);

    type = ContentType.getImageType(s);

    if (type.toString().toLowerCase().contains("image")
        && type != ContentType.ImageType.IMAGE_LINK) {
      addClickFunctions(image, rootView, type, getActivity(), s);
      loadImage(s.getUrl());
    } else if (s.getDataNode().has("preview")
        && s.getDataNode().get("preview").get("images").get(0).get("source").has("height")
        && s.getDataNode().get("preview").get("images").get(0).get("source").get("height").asInt()
            > 200) {
      loadImage(
          s.getDataNode().get("preview").get("images").get(0).get("source").get("url").asText());
    } else {
      image.recycle();
      (rootView.findViewById(R.id.thumbimage2)).setVisibility(View.VISIBLE);
      ((ImageView) rootView.findViewById(R.id.thumbimage2)).setImageResource(R.drawable.web);
      addClickFunctions(
          (rootView.findViewById(R.id.thumbimage2)), rootView, type, getActivity(), s);

      (rootView.findViewById(R.id.progress)).setVisibility(View.GONE);
    }

    rootView
        .findViewById(R.id.base)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {

                Intent i2 = new Intent(getActivity(), CommentsScreen.class);
                i2.putExtra(CommentsScreen.EXTRA_PAGE, i);
                i2.putExtra(CommentsScreen.EXTRA_SUBREDDIT, sub);
                (getActivity()).startActivity(i2);
              }
            });
    return rootView;
  }
Esempio n. 4
0
  public static boolean doesMatch(Submission s) {
    String title = s.getTitle();
    String body = s.getSelftext();
    String domain = s.getUrl();
    String subreddit = s.getSubredditName();

    boolean titlec;
    boolean bodyc;
    boolean domainc;
    boolean subredditc;

    if (titles == null) {
      titles = SettingValues.titleFilters.replaceAll("^[,\\s]+", "").split("[,\\s]+");
    }
    if (texts == null) {
      texts = SettingValues.textFilters.replaceAll("^[,\\s]+", "").split("[,\\s]+");
    }
    if (domains == null) {
      domains = SettingValues.domainFilters.replaceAll("^[,\\s]+", "").split("[,\\s]+");
    }
    if (subreddits == null) {
      subreddits = SettingValues.subredditFilters.replaceAll("^[,\\s]+", "").split("[,\\s]+");
    }

    titlec = !SettingValues.titleFilters.isEmpty() && contains(title.toLowerCase(), titles, false);

    bodyc = !SettingValues.textFilters.isEmpty() && contains(body.toLowerCase(), texts, false);

    domainc =
        !SettingValues.domainFilters.isEmpty() && contains(domain.toLowerCase(), domains, false);

    subredditc =
        subreddit != null
            && !subreddit.isEmpty()
            && !SettingValues.subredditFilters.isEmpty()
            && contains(subreddit.toLowerCase(), subreddits, true);

    return (titlec || bodyc || domainc || subredditc);
  }
Esempio n. 5
0
    @Override
    public Fragment getItem(int i) {

      Fragment f;
      ContentType.ImageType t = ContentType.getImageType(subredditPosts.getPosts().get(i));

      if (subredditPosts.getPosts().size() - 2 <= i && subredditPosts.hasMore()) {
        subredditPosts.loadMore(Shadowbox.this.getApplicationContext(), Shadowbox.this, false);
      }
      switch (t) {
        case NSFW_IMAGE:
        case NSFW_GIF:
        case NSFW_GFY:
        case GFY:
        case GIF:
        case IMAGE:
        case NONE_GFY:
        case NONE_GIF:
        case NONE_IMAGE:
          {
            f = new MediaFragment();
            Bundle args = new Bundle();
            Submission submission = OfflineSubreddit.getSubreddit(subreddit).submissions.get(i);
            String previewUrl = "";
            if (submission.getDataNode().has("preview")
                && submission
                    .getDataNode()
                    .get("preview")
                    .get("images")
                    .get(0)
                    .get("source")
                    .has("height")) { // Load the preview image which has probably already been
              // cached in memory instead of the direct link
              previewUrl =
                  submission
                      .getDataNode()
                      .get("preview")
                      .get("images")
                      .get(0)
                      .get("source")
                      .get("url")
                      .asText();
            }
            args.putString("contentUrl", submission.getUrl());
            args.putString("firstUrl", previewUrl);
            args.putInt("page", i);
            args.putString("sub", subreddit);
            f.setArguments(args);
          }
          break;
        case REDDIT:
          {
            f = new ImageFull();
            Bundle args = new Bundle();
            args.putInt("page", i);
            args.putString("sub", subreddit);

            f.setArguments(args);
          }
          break;
        case EMBEDDED:
          {
            f = new ImageFull();
            Bundle args = new Bundle();
            args.putInt("page", i);
            args.putString("sub", subreddit);

            f.setArguments(args);
          }
          break;
        case LINK:
          {
            f = new ImageFull();
            Bundle args = new Bundle();
            args.putInt("page", i);
            args.putString("sub", subreddit);

            f.setArguments(args);
          }
          break;
        case IMAGE_LINK:
          {
            f = new ImageFull();
            Bundle args = new Bundle();
            args.putInt("page", i);
            args.putString("sub", subreddit);

            f.setArguments(args);
          }
          break;
        case NSFW_LINK:
          {
            f = new ImageFull();
            Bundle args = new Bundle();
            args.putInt("page", i);
            args.putString("sub", subreddit);

            f.setArguments(args);
          }
          break;
        case SELF:
          {
            if (subredditPosts.getPosts().get(i).getSelftext().isEmpty()) {
              f = new TitleFull();
              Bundle args = new Bundle();
              args.putInt("page", i);
              args.putString("sub", subreddit);

              f.setArguments(args);
            } else {
              f = new SelftextFull();
              Bundle args = new Bundle();
              args.putInt("page", i);
              args.putString("sub", subreddit);

              f.setArguments(args);
            }
          }
          break;
        case ALBUM:
          {
            f = new AlbumFull();
            Bundle args = new Bundle();
            args.putInt("page", i);
            args.putString("sub", subreddit);

            f.setArguments(args);
          }
          break;
        case VID_ME:
        case STREAMABLE:
          {
            f = new Gif();
            Bundle args = new Bundle();
            args.putInt("page", i);
            args.putString("sub", subreddit);

            f.setArguments(args);
          }
          break;
        case NONE:
          {
            if (subredditPosts.getPosts().get(i).getSelftext().isEmpty()) {
              f = new TitleFull();
              Bundle args = new Bundle();
              args.putInt("page", i);
              args.putString("sub", subreddit);

              f.setArguments(args);
            } else {
              f = new SelftextFull();
              Bundle args = new Bundle();
              args.putInt("page", i);
              args.putString("sub", subreddit);

              f.setArguments(args);
            }
          }
          break;
        case VIDEO:
          {
            f = new ImageFull();
            Bundle args = new Bundle();
            args.putInt("page", i);
            args.putString("sub", subreddit);

            f.setArguments(args);
          }
          break;
        case NONE_URL:
          {
            f = new ImageFull();
            Bundle args = new Bundle();
            args.putInt("page", i);
            args.putString("sub", subreddit);

            f.setArguments(args);
          }
          break;
        default:
          {
            f = new ImageFull();
            Bundle args = new Bundle();
            args.putInt("page", i);
            args.putString("sub", subreddit);

            f.setArguments(args);
          }
          break;
      }

      return f;
    }
Esempio n. 6
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.submission_albumcard, container, false);
    PopulateShadowboxInfo.doActionbar(s, rootView, getActivity());

    if (s.getUrl().contains("gallery")) {
      gallery = true;
    }

    list = rootView.findViewById(R.id.images);

    list.setVisibility(View.VISIBLE);
    final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    ((RecyclerView) list).setLayoutManager(layoutManager);

    ((RecyclerView) list)
        .setOnScrollListener(
            new RecyclerView.OnScrollListener() {

              @Override
              public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                super.onScrolled(recyclerView, dx, dy);
                ValueAnimator va = null;

                if (dy > 0 && !hidden) {
                  hidden = true;

                  if (va != null && va.isRunning()) va.cancel();

                  final View base = rootView.findViewById(R.id.base);
                  va = ValueAnimator.ofFloat(1.0f, 0.2f);
                  int mDuration = 250; // in millis
                  va.setDuration(mDuration);
                  va.addUpdateListener(
                      new ValueAnimator.AnimatorUpdateListener() {
                        public void onAnimationUpdate(ValueAnimator animation) {
                          Float value = (Float) animation.getAnimatedValue();
                          base.setAlpha(value);
                        }
                      });

                  va.start();

                } else if (hidden && dy <= 0) {
                  final View base = rootView.findViewById(R.id.base);

                  if (va != null && va.isRunning()) va.cancel();

                  hidden = false;
                  va = ValueAnimator.ofFloat(0.2f, 1.0f);
                  int mDuration = 250; // in millis
                  va.setDuration(mDuration);
                  va.addUpdateListener(
                      new ValueAnimator.AnimatorUpdateListener() {
                        public void onAnimationUpdate(ValueAnimator animation) {
                          Float value = (Float) animation.getAnimatedValue();
                          base.setAlpha(value);
                        }
                      });

                  va.start();
                }
              }

              @Override
              public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                super.onScrollStateChanged(recyclerView, newState);
              }
            });

    rootView
        .findViewById(R.id.base)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {

                Intent i2 = new Intent(getActivity(), CommentsScreen.class);
                i2.putExtra(CommentsScreen.EXTRA_PAGE, i);
                i2.putExtra(CommentsScreen.EXTRA_SUBREDDIT, s.getSubredditName());
                (getActivity()).startActivity(i2);
              }
            });

    new LoadIntoRecycler(s.getUrl(), getActivity()).execute();

    return rootView;
  }
Esempio n. 7
0
  public static boolean doesMatch(Submission s, String baseSubreddit, boolean ignore18) {
    String title = s.getTitle();
    String body = s.getSelftext();
    String domain = s.getUrl();
    String subreddit = s.getSubredditName();
    String flair = s.getSubmissionFlair().getText() != null ? s.getSubmissionFlair().getText() : "";

    boolean titlec;
    boolean bodyc;
    boolean domainc;
    boolean subredditc;
    boolean userc;

    if (titles == null) {
      titles = SettingValues.titleFilters.replaceAll("^[,\\s]+", "").split("[,\\s]+");
    }
    if (texts == null) {
      texts = SettingValues.textFilters.replaceAll("^[,\\s]+", "").split("[,\\s]+");
    }
    if (domains == null) {
      domains = SettingValues.domainFilters.replaceAll("^[,\\s]+", "").split("[,\\s]+");
    }
    if (subreddits == null) {
      subreddits = SettingValues.subredditFilters.replaceAll("^[,\\s]+", "").split("[,\\s]+");
    }
    if (flairs == null) {
      flairs = SettingValues.flairFilters.replaceAll("^[,]+", "").split("[,]+");
    }
    if (users == null) {
      users = SettingValues.userFilters.replaceAll("^[,\\s]+", "").split("[,\\s]+");
    }

    titlec = !SettingValues.titleFilters.isEmpty() && contains(title.toLowerCase(), titles, false);

    bodyc = !SettingValues.textFilters.isEmpty() && contains(body.toLowerCase(), texts, false);

    userc =
        !SettingValues.userFilters.isEmpty() && contains(s.getAuthor().toLowerCase(), users, false);

    try {
      domainc = !SettingValues.domainFilters.isEmpty() && isDomain(domain.toLowerCase(), domains);
    } catch (MalformedURLException e) {
      domainc = false;
    }

    subredditc =
        !subreddit.equalsIgnoreCase(baseSubreddit)
            && !SettingValues.subredditFilters.isEmpty()
            && contains(subreddit.toLowerCase(), subreddits, true);

    boolean contentMatch = false;

    if (baseSubreddit == null || baseSubreddit.isEmpty()) {
      baseSubreddit = "frontpage";
    }

    baseSubreddit = baseSubreddit.toLowerCase();
    boolean gifs = isGif(baseSubreddit);
    boolean images = isImage(baseSubreddit);
    boolean nsfw = isNsfw(baseSubreddit);
    boolean albums = isAlbums(baseSubreddit);
    boolean urls = isUrls(baseSubreddit);
    boolean selftext = isSelftext(baseSubreddit);
    boolean videos = isVideo(baseSubreddit);

    if (s.isNsfw()) {
      if (nsfw) {
        contentMatch = true;
      }
      if (!Reddit.over18 && !ignore18) {
        contentMatch = true;
      }
    }
    switch (ContentType.getContentType(s)) {
      case REDDIT:
      case EMBEDDED:
      case LINK:
        if (urls) {
          contentMatch = true;
        }
        break;
      case SELF:
      case NONE:
        if (selftext) {
          contentMatch = true;
        }
        break;
      case ALBUM:
        if (albums) {
          contentMatch = true;
        }
        break;
      case IMAGE:
      case DEVIANTART:
      case IMGUR:
      case XKCD:
        if (images) {
          contentMatch = true;
        }
        break;
      case GIF:
        if (gifs) {
          contentMatch = true;
        }
        break;
      case VID_ME:
      case STREAMABLE:
      case VIDEO:
        if (videos) {
          contentMatch = true;
        }
        break;
    }

    if (!flair.isEmpty())
      for (String flairText : flairs) {
        if (flairText.toLowerCase().startsWith(baseSubreddit)) {
          String[] split = flairText.split(":");
          if (split[0].equalsIgnoreCase(baseSubreddit)) {
            if (flair.equalsIgnoreCase(split[1].trim())) {
              contentMatch = true;
              break;
            }
          }
        }
      }

    return (titlec
        || bodyc
        || userc
        || domainc
        || subredditc
        || contentMatch
        || Hidden.id.contains(s.getFullName()));
  }
Esempio n. 8
0
  public void loadPhotos(List<Submission> submissions) {
    for (Submission submission : submissions) {
      boolean forceThumb = false;
      String url;
      ContentType.Type type = ContentType.getContentType(submission);
      if (submission.getThumbnails() != null) {

        int height = submission.getThumbnails().getSource().getHeight();
        int width = submission.getThumbnails().getSource().getWidth();

        if (type != ContentType.Type.IMAGE
            && type != ContentType.Type.SELF
            && (submission.getThumbnailType() != Submission.ThumbnailType.URL)) {

        } else if (type == ContentType.Type.IMAGE) {
          if (((!NetworkUtil.isConnectedWifi(c) && SettingValues.lowResMobile)
                  || SettingValues.lowResAlways)
              && submission.getThumbnails() != null
              && submission.getThumbnails().getVariations() != null) {

            int length = submission.getThumbnails().getVariations().length;
            url =
                Html.fromHtml(submission.getThumbnails().getVariations()[length / 2].getUrl())
                    .toString(); // unescape url characters

          } else {
            if (submission.getDataNode().has("preview")
                && submission
                    .getDataNode()
                    .get("preview")
                    .get("images")
                    .get(0)
                    .get("source")
                    .has(
                        "height")) { // Load the preview image which has probably already been
                                     // cached in memory instead of the direct link
              url =
                  submission
                      .getDataNode()
                      .get("preview")
                      .get("images")
                      .get(0)
                      .get("source")
                      .get("url")
                      .asText();
            } else {
              url = submission.getUrl();
            }
          }

          ((Reddit) c.getApplicationContext())
              .getImageLoader()
              .loadImage(
                  url,
                  new ImageLoadingListener() {
                    @Override
                    public void onLoadingStarted(String imageUri, View view) {}

                    @Override
                    public void onLoadingFailed(
                        String imageUri, View view, FailReason failReason) {}

                    @Override
                    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {}

                    @Override
                    public void onLoadingCancelled(String imageUri, View view) {}
                  });

        } else if (submission.getThumbnails() != null) {

          if (((!NetworkUtil.isConnectedWifi(c) && SettingValues.lowResMobile)
                  || SettingValues.lowResAlways)
              && submission.getThumbnails().getVariations().length != 0) {

            int length = submission.getThumbnails().getVariations().length;
            url =
                Html.fromHtml(submission.getThumbnails().getVariations()[length / 2].getUrl())
                    .toString(); // unescape url characters

          } else {
            url =
                Html.fromHtml(submission.getThumbnails().getSource().getUrl())
                    .toString(); // unescape url characters
          }

          ((Reddit) c.getApplicationContext())
              .getImageLoader()
              .loadImage(
                  url,
                  new ImageLoadingListener() {
                    @Override
                    public void onLoadingStarted(String imageUri, View view) {}

                    @Override
                    public void onLoadingFailed(
                        String imageUri, View view, FailReason failReason) {}

                    @Override
                    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {}

                    @Override
                    public void onLoadingCancelled(String imageUri, View view) {}
                  });

        } else if (submission.getThumbnail() != null
            && (submission.getThumbnailType() == Submission.ThumbnailType.URL
                || submission.getThumbnailType() == Submission.ThumbnailType.NSFW)) {

          ((Reddit) c.getApplicationContext())
              .getImageLoader()
              .loadImage(
                  submission.getUrl(),
                  new ImageLoadingListener() {
                    @Override
                    public void onLoadingStarted(String imageUri, View view) {}

                    @Override
                    public void onLoadingFailed(
                        String imageUri, View view, FailReason failReason) {}

                    @Override
                    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {}

                    @Override
                    public void onLoadingCancelled(String imageUri, View view) {}
                  });
        }
      }
    }
  }
Esempio n. 9
0
  private static void addClickFunctions(
      final View base,
      final View clickingArea,
      ContentType.ImageType type,
      final Activity contextActivity,
      final Submission submission) {
    if (!PostMatch.openExternal(submission.getUrl())) {

      switch (type) {
        case NSFW_IMAGE:
          base.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View v2) {
                  PopulateSubmissionViewHolder.openImage(contextActivity, submission);
                }
              });
          break;
        case VID_ME:
        case STREAMABLE:
          base.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                  if (SettingValues.video) {
                    Intent myIntent = new Intent(contextActivity, GifView.class);

                    myIntent.putExtra(GifView.EXTRA_STREAMABLE, submission.getUrl());
                    contextActivity.startActivity(myIntent);

                  } else {
                    Reddit.defaultShare(submission.getUrl(), contextActivity);
                  }
                }
              });
        case EMBEDDED:
          base.setOnClickListener(
              new View.OnClickListener() {

                @Override
                public void onClick(View v2) {
                  if (SettingValues.video) {
                    Reddit.defaultShare(submission.getUrl(), contextActivity);
                    String data =
                        submission.getDataNode().get("media_embed").get("content").asText();
                    {
                      Intent i = new Intent(contextActivity, FullscreenVideo.class);
                      i.putExtra(FullscreenVideo.EXTRA_HTML, data);
                      contextActivity.startActivity(i);
                    }
                  } else {
                    Reddit.defaultShare(submission.getUrl(), contextActivity);
                  }
                }
              });
          break;
        case NSFW_GIF:
          base.setOnClickListener(
              new View.OnClickListener() {

                @Override
                public void onClick(View v2) {
                  PopulateSubmissionViewHolder.openGif(false, contextActivity, submission);
                }
              });
          break;
        case NSFW_GFY:
          base.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View v2) {
                  PopulateSubmissionViewHolder.openGif(true, contextActivity, submission);
                }
              });
          break;
        case REDDIT:
          base.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View v2) {
                  PopulateSubmissionViewHolder.openRedditContent(
                      submission.getUrl(), contextActivity);
                }
              });
          break;
        case LINK:
          base.setOnClickListener(
              new View.OnClickListener() {

                @Override
                public void onClick(View v2) {
                  CustomTabUtil.openUrl(
                      submission.getUrl(),
                      Palette.getColor(submission.getSubredditName()),
                      contextActivity);
                }
              });
          break;
        case IMAGE_LINK:
          base.setOnClickListener(
              new View.OnClickListener() {

                @Override
                public void onClick(View v2) {
                  CustomTabUtil.openUrl(
                      submission.getUrl(),
                      Palette.getColor(submission.getSubredditName()),
                      contextActivity);
                }
              });
          break;
        case NSFW_LINK:
          base.setOnClickListener(
              new View.OnClickListener() {

                @Override
                public void onClick(View v2) {
                  CustomTabUtil.openUrl(
                      submission.getUrl(),
                      Palette.getColor(submission.getSubredditName()),
                      contextActivity);
                }
              });
          break;
        case SELF:
          break;
        case GFY:
          base.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View v2) {
                  PopulateSubmissionViewHolder.openGif(true, contextActivity, submission);
                }
              });
          break;
        case ALBUM:
          base.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View v2) {

                  if (SettingValues.album) {
                    if (SettingValues.albumSwipe) {
                      Intent i = new Intent(contextActivity, AlbumPager.class);
                      i.putExtra(Album.EXTRA_URL, submission.getUrl());
                      contextActivity.startActivity(i);
                      contextActivity.overridePendingTransition(R.anim.slideright, R.anim.fade_out);
                    } else {
                      Intent i = new Intent(contextActivity, Album.class);
                      i.putExtra(Album.EXTRA_URL, submission.getUrl());
                      contextActivity.startActivity(i);
                      contextActivity.overridePendingTransition(R.anim.slideright, R.anim.fade_out);
                    }

                  } else {
                    Reddit.defaultShare(submission.getUrl(), contextActivity);
                  }
                }
              });
          break;
        case DEVIANTART:
        case IMAGE:
          base.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View v2) {
                  PopulateSubmissionViewHolder.openImage(contextActivity, submission);
                }
              });
          break;
        case GIF:
          base.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View v2) {
                  PopulateSubmissionViewHolder.openGif(false, contextActivity, submission);
                }
              });
          break;
        case NONE_GFY:
          base.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View v2) {
                  PopulateSubmissionViewHolder.openGif(true, contextActivity, submission);
                }
              });
          break;
        case NONE_GIF:
          base.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View v2) {
                  PopulateSubmissionViewHolder.openGif(false, contextActivity, submission);
                }
              });
          break;

        case NONE:
          base.setOnClickListener(
              new View.OnClickListener() {

                @Override
                public void onClick(View v2) {
                  CustomTabUtil.openUrl(
                      submission.getUrl(),
                      Palette.getColor(submission.getSubredditName()),
                      contextActivity);
                }
              });
          break;
        case NONE_IMAGE:
          base.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View v2) {
                  PopulateSubmissionViewHolder.openImage(contextActivity, submission);
                }
              });
          break;
        case NONE_URL:
          base.setOnClickListener(
              new View.OnClickListener() {

                @Override
                public void onClick(View v2) {
                  CustomTabUtil.openUrl(
                      submission.getUrl(),
                      Palette.getColor(submission.getSubredditName()),
                      contextActivity);
                }
              });
          break;
        case VIDEO:
          base.setOnClickListener(
              new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                  Reddit.defaultShare(submission.getUrl(), contextActivity);
                }
              });
      }
    } else {
      Reddit.defaultShare(submission.getUrl(), contextActivity);
    }
  }