Ejemplo n.º 1
0
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

    if (searchMode == Var.SEARCH_YOUTUBE) {
      searchChannel = youtubeChannelSearch.get(position - 1);
      Log.d(TAG, searchChannel.toString());

      addThumbnail(searchChannel.getThumbnail());
      if (Var.isEmpty(userName_edt.getText().toString()))
        userName_edt.setText(searchChannel.getName());
      name_tv.setText(searchChannel.getName());
      imageLoader.DisplayImage(searchChannel.getThumbnail(), thumbnail_iv);

      toggleSearch(Var.SEARCH_YT_CHANNEL);
      searchChannel();
    }

    if (searchMode == Var.SEARCH_TWITTER) {
      editUser.getMediaFeed().add(twitterFeedSearch.get(position - 1));
      addThumbnail(twitterFeedSearch.get(position - 1).getThumbnail());

      if (Var.isEmpty(userName_edt.getText().toString()))
        userName_edt.setText(twitterFeedSearch.get(position - 1).getDisplayName());

      toggleSearch(Var.SEARCH_NONE);
    }
  }
Ejemplo n.º 2
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

      ViewHolder holder;

      if (convertView == null) {
        convertView =
            inflater.inflate(
                (getItemViewType(position) == 0
                    ? R.layout.item_youtube_search
                    : R.layout.item_twitter_search),
                parent,
                false);
        holder = new ViewHolder();
        holder.image_iv = (ImageView) convertView.findViewById(R.id.thumbnail_iv);
        holder.name_tv = (TextView) convertView.findViewById(R.id.name_tv);
        holder.screenName_tv = (TextView) convertView.findViewById(R.id.screen_name_tv);
        convertView.setTag(holder);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }

      if (searchMode == Var.SEARCH_YOUTUBE) {
        YoutubeChannel feed = (YoutubeChannel) getItem(position);
        holder.image_iv.setImageResource(R.drawable.ic_youtube_icon);
        if (feed.getThumbnail() != null)
          imageLoader.DisplayImage(feed.getThumbnail(), holder.image_iv);

        holder.name_tv.setText(feed.getName());
      }

      if (searchMode == Var.SEARCH_TWITTER) {
        TwitterFeed feed = (TwitterFeed) getItem(position);
        holder.image_iv.setImageResource(R.drawable.ic_twitter_icon);
        if (feed.getThumbnail() != null)
          imageLoader.DisplayImage(feed.getThumbnail(), holder.image_iv);

        holder.name_tv.setText(feed.getDisplayName());
        holder.screenName_tv.setText(feed.getName());
      }

      if (searchMode == Var.SEARCH_YT_CHANNEL) {
        YoutubeFeed feed = (YoutubeFeed) getItem(position);
        holder.image_iv.setImageResource(R.drawable.ic_youtube_icon);
        if (feed.getThumbnail() != null)
          imageLoader.DisplayImage(feed.getThumbnail(), holder.image_iv);

        holder.name_tv.setText(feed.getName());
      }

      return convertView;
    }