コード例 #1
0
  @Override
  protected void updateIcon(ProgressViewHolder vh, Node item) {
    if (item instanceof NodePlaceHolder) {
      UIUtils.setBackground(((View) vh.icon), null);
      vh.icon.setImageResource(MimeTypeManager.getIcon(context, item.getName()));
    } else {
      super.updateIcon(vh, item);
    }

    if (item.isFolder()) {
      vh.icon.setImageDrawable(context.getResources().getDrawable(R.drawable.mime_256_folder));

      if (mode == ListingModeFragment.MODE_IMPORT) {
        return;
      }
      if (mode == ListingModeFragment.MODE_PICK) {
        return;
      }

      UIUtils.setBackground(
          ((View) vh.choose),
          context.getResources().getDrawable(R.drawable.quickcontact_badge_overlay_light));

      vh.choose.setVisibility(View.VISIBLE);
      AccessibilityHelper.addContentDescription(
          vh.choose,
          String.format(context.getString(R.string.more_options_folder), item.getName()));
      vh.choose.setTag(R.id.node_action, item);
      vh.choose.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              Node item = (Node) v.getTag(R.id.node_action);
              selectedOptionItems.add(item);
              PopupMenu popup = new PopupMenu(context, v);
              getMenu(popup.getMenu(), item);

              if (AndroidVersion.isICSOrAbove()) {
                popup.setOnDismissListener(
                    new OnDismissListener() {
                      @Override
                      public void onDismiss(PopupMenu menu) {
                        selectedOptionItems.clear();
                      }
                    });
              }

              popup.setOnMenuItemClickListener(ProgressNodeAdapter.this);

              popup.show();
            }
          });
    } else {
      UIUtils.setBackground(((View) vh.choose), null);
    }
  }
コード例 #2
0
 @Override
 protected void updateTopText(GenericViewHolder vh, String item) {
   vh.topText.setText(item);
   if (defaultCharSet.equals(item)) {
     UIUtils.setBackground(
         ((LinearLayout) vh.icon.getParent().getParent()),
         getContext().getResources().getDrawable(R.drawable.list_longpressed_holo));
   } else {
     UIUtils.setBackground(((LinearLayout) vh.icon.getParent().getParent()), null);
   }
 }