예제 #1
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder;
      if (convertView == null) {
        holder = new ViewHolder();
        convertView = LayoutInflater.from(getActivity()).inflate(R.layout.item_song, null);
        holder.mTvName = (TextView) convertView.findViewById(R.id.tv_name);
        holder.mTvArtist = (TextView) convertView.findViewById(R.id.tv_artist);
        holder.mTvDuration = (TextView) convertView.findViewById(R.id.tv_duration);
        holder.aboveView = convertView.findViewById(R.id.item_root);
        holder.behindView = convertView.findViewById(R.id.behind);
        convertView.setTag(holder);
        convertViewList.add((PullRightLayout) convertView);
      } else {
        holder = (ViewHolder) convertView.getTag();
      }
      if (HideApplication.showListAnim) {
        startAnim(convertView);
      }

      SongInfo info = SongManager.with(getActivity()).getSongByIndex(position);
      holder.mTvName.setText(info.getTitle());
      holder.mTvArtist.setText(info.getArtist() + " - " + info.getAlbum());
      holder.mTvDuration.setText(
          CommonUtils.durationToString(info.getDuration())
              + " - "
              + CommonUtils.getFileSize(info.getPath()));

      setItemSelected(holder, info.getId() == playingId);

      convertView.setOnClickListener(new OnItemClick(position));
      holder.behindView.setOnClickListener(new OnBehindClick(position));

      return convertView;
    }
 public void bindView(View view, Context context, Cursor cursor)
 {
     Log.d("smali", "Lcom/samsung/sec/mtv/ui/channelguide/MtvUiFragReservationList$ReservationAdapter;->bindView(Landroid/view/View;Landroid/content/Context;Landroid/database/Cursor;)V");
     MtvReservation mtvreservation = MtvReservationManager.builder(cursor);
     view.setTag(mtvreservation);
     String s;
     String s1;
     if(DateFormat.is24HourFormat(Log.d(MtvUiFragReservationList.this).getApplicationContext()))
         s = (new SimpleDateFormat("M/d (EEE) H:mm")).format(new Date(mtvreservation.mTimeStart));
     else
         s = (new SimpleDateFormat("M/d (EEE) h:mm a")).format(new Date(mtvreservation.mTimeStart));
     if(mtvreservation.mTimeEnd > 0L)
     {
         if(DateFormat.is24HourFormat(Log.d(MtvUiFragReservationList.this).getApplicationContext()))
             s1 = (new StringBuilder()).append(s).append(" - ").append((new SimpleDateFormat("H:mm")).format(new Date(mtvreservation.mTimeEnd))).toString();
         else
             s1 = (new StringBuilder()).append(s).append(" - ").append((new SimpleDateFormat("h:mm a")).format(new Date(mtvreservation.mTimeEnd))).toString();
     } else
     {
         s1 = (new StringBuilder()).append(s).append(" -            ").toString();
     }
     ((ImageView)view.findViewById(0x7f0a0053)).setImageDrawable(mIcon[mtvreservation.mPgmType][selectStatusIconIndex(mtvreservation)]);
     ((TextView)view.findViewById(0x7f0a0113)).setText((new StringBuilder()).append(s1).append(" ").append("Ch ").append(mtvreservation.mPch).append(" ").toString());
     ((TextView)view.findViewById(0x7f0a0112)).setText(mtvreservation.mPgmName);
     view.findViewById(0x7f0a0048).setVisibility(8);
 }
예제 #3
0
    @Override
    public View getView(int position, View convertView, final ViewGroup parent) {
      final Item item = getItem(position);

      final View view;
      if (convertView != null && item.getClass().equals(convertView.getTag())) {
        view = convertView;
      } else {
        view =
            getLayoutInflater()
                .inflate(
                    item instanceof SectionItem
                        ? R.layout.catalog_manager_section_head
                        : R.layout.catalog_manager_item,
                    null);
        view.setTag(item.getClass());
      }

      if (item instanceof SectionItem) {
        ((TextView) view.findViewById(R.id.catalog_manager_section_head_title))
            .setText(((SectionItem) item).Title);
      } else /* if (item instanceof CatalogItem) */ {
        final CatalogItem catalogItem = (CatalogItem) item;

        if (myCoverManager == null) {
          view.measure(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          final int coverHeight = view.getMeasuredHeight();
          myCoverManager =
              new CoverManager(CatalogManagerActivity.this, coverHeight * 15 / 22, coverHeight);
          view.requestLayout();
        }

        final INetworkLink link = catalogItem.Tree.getLink();
        ((TextView) view.findViewById(R.id.catalog_manager_item_title)).setText(link.getTitle());
        ((TextView) view.findViewById(R.id.catalog_manager_item_subtitle))
            .setText(link.getSummary());

        final ImageView coverView = (ImageView) view.findViewById(R.id.catalog_manager_item_icon);
        if (!myCoverManager.trySetCoverImage(coverView, catalogItem.Tree)) {
          coverView.setImageResource(R.drawable.ic_list_library_books);
        }

        final CheckBox checkBox = (CheckBox) view.findViewById(R.id.catalog_manager_item_checkbox);
        checkBox.setChecked(catalogItem.IsChecked);
        checkBox.setOnClickListener(
            new View.OnClickListener() {
              public void onClick(View v) {
                catalogItem.IsChecked = checkBox.isChecked();
                setResultIds(catalogItem, 0);
              }
            });
      }
      return view;
    }
예제 #4
0
  protected View getView(int position, View convertView, ViewGroup parent) {
    AccountHolder holder;
    if (convertView == null) {
      convertView = layoutInflater.inflate(layoutResourceId, parent, false);
      holder = new AccountHolder();
      holder.accountRow1 = (TextView) convertView.findViewById(R.id.accountRow1);
      holder.accountRow1.setTypeface(GothamFont.BOLD);
      holder.accountRow2 = (TextView) convertView.findViewById(R.id.accountRow2);
      convertView.setTag(holder);

    } else holder = (AccountHolder) convertView.getTag();

    Account account = getItem(position);

    holder.accountRow2.setText(getAccountRow2(account));
    holder.accountRow1.setText(getAccountRow1(account));

    return convertView;
  }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      View row = convertView;
      PhotoGridHolder holder = null;

      if (row == null) {
        LayoutInflater inflater = ((Activity) context).getLayoutInflater();
        row = inflater.inflate(layoutResourceId, parent, false);
        holder = new PhotoGridHolder();
        holder.itemImageView = (ImageView) row.findViewById(R.id.galleryGridImage);
        row.setTag(holder);
      } else {
        holder = (PhotoGridHolder) row.getTag();
      }
      String filename = getItem(position);
      String path = context.getFilesDir().getAbsolutePath() + "/images/" + filename;

      holder.itemImageView.setImageURI(Uri.parse(path));
      return row;
    }
예제 #6
0
  private ViewHolder getViewHolder(final View workingView) {
    final Object tag = workingView.getTag();
    ViewHolder viewHolder = null;

    if (null == tag || !(tag instanceof ViewHolder)) {
      viewHolder = new ViewHolder();

      viewHolder.nameView = (TextView) workingView.findViewById(R.id.name);
      viewHolder.dateView = (TextView) workingView.findViewById(R.id.date);
      viewHolder.sizeView = (TextView) workingView.findViewById(R.id.size);
      viewHolder.imageView = (ImageView) workingView.findViewById(R.id.image);

      workingView.setTag(viewHolder);

    } else {
      viewHolder = (ViewHolder) tag;
    }

    return viewHolder;
  }
예제 #7
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHodler holder = null;
   if (null == convertView) {
     convertView = View.inflate(context, R.layout.li_child_click_item, null);
     holder = new ViewHodler();
     holder.mCountry = (Button) convertView.findViewById(R.id.licc_btn_country);
     holder.mName = (TextView) convertView.findViewById(R.id.licc_tv_name);
     convertView.setTag(holder);
   } else {
     holder = (ViewHodler) convertView.getTag();
   }
   LiData data = list.get(position);
   holder.mCountry.setText(data.country);
   holder.mCountry.setOnClickListener(new OnItemChildClickListener(CLICK_INDEX_COUNTRY, position));
   holder.mName.setText(data.name);
   holder.mName.setOnClickListener(new OnItemChildClickListener(CLICK_INDEX_NAME, position));
   convertView.setOnClickListener(new OnItemChildClickListener(CLICK_INDEX_ITEM, position));
   return convertView;
 }
예제 #8
0
    public View getItemView(int itemPosition, View convertView, ViewGroup parent) {
      FolderInfoHolder folder = (FolderInfoHolder) getItem(itemPosition);
      View view;
      if (convertView != null) {
        view = convertView;
      } else {
        view = mInflater.inflate(R.layout.folder_list_item, parent, false);
      }

      FolderViewHolder holder = (FolderViewHolder) view.getTag();

      if (holder == null) {
        holder = new FolderViewHolder();
        holder.folderName = (TextView) view.findViewById(R.id.folder_name);
        holder.newMessageCount = (TextView) view.findViewById(R.id.folder_unread_message_count);
        holder.flaggedMessageCount =
            (TextView) view.findViewById(R.id.folder_flagged_message_count);
        holder.folderStatus = (TextView) view.findViewById(R.id.folder_status);
        holder.activeIcons = (RelativeLayout) view.findViewById(R.id.active_icons);
        holder.chip = view.findViewById(R.id.chip);
        holder.folderListItemLayout =
            (LinearLayout) view.findViewById(R.id.folder_list_item_layout);
        holder.rawFolderName = folder.name;

        view.setTag(holder);
      }

      if (folder == null) {
        return view;
      }

      holder.folderName.setText(folder.displayName);
      String statusText = "";

      if (folder.loading) {
        statusText = getString(R.string.status_loading);
      } else if (folder.status != null) {
        statusText = folder.status;
      } else if (folder.lastChecked != 0) {
        Date lastCheckedDate = new Date(folder.lastChecked);

        statusText =
            getTimeFormat().format(lastCheckedDate) + " " + getDateFormat().format(lastCheckedDate);
      }

      if (folder.pushActive) {
        statusText = getString(R.string.folder_push_active_symbol) + " " + statusText;
      }

      if (statusText != null) {
        holder.folderStatus.setText(statusText);
        holder.folderStatus.setVisibility(View.VISIBLE);
      } else {
        holder.folderStatus.setText(null);
        holder.folderStatus.setVisibility(View.GONE);
      }

      if (folder.unreadMessageCount != 0) {
        holder.newMessageCount.setText(Integer.toString(folder.unreadMessageCount));
        holder.newMessageCount.setOnClickListener(
            new FolderClickListener(
                mAccount, folder.name, folder.displayName, SearchModifier.UNREAD));
        holder.newMessageCount.setVisibility(View.VISIBLE);
      } else {
        holder.newMessageCount.setVisibility(View.GONE);
      }

      if (K9.messageListStars() && folder.flaggedMessageCount > 0) {
        holder.flaggedMessageCount.setText(Integer.toString(folder.flaggedMessageCount));
        holder.flaggedMessageCount.setOnClickListener(
            new FolderClickListener(
                mAccount, folder.name, folder.displayName, SearchModifier.FLAGGED));
        holder.flaggedMessageCount.setVisibility(View.VISIBLE);
      } else {
        holder.flaggedMessageCount.setVisibility(View.GONE);
      }
      if (K9.useCompactLayouts() && holder.folderListItemLayout != null) {
        holder.folderListItemLayout.setMinimumHeight(0);
      }
      holder.activeIcons.setOnClickListener(
          new OnClickListener() {
            public void onClick(View v) {
              Toast toast =
                  Toast.makeText(
                      getApplication(), getString(R.string.tap_hint), Toast.LENGTH_SHORT);
              toast.show();
            }
          });

      holder.chip.setBackgroundDrawable(mAccount.generateColorChip().drawable());
      holder.chip.getBackground().setAlpha(folder.unreadMessageCount == 0 ? 127 : 255);

      holder.folderName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getFolderName());
      holder.folderStatus.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getFolderStatus());

      return view;
    }