Пример #1
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      int type = getItemViewType(position);
      View res =
          convertView != null
              ? convertView
              : LayoutInflater.from(dialogContext)
                  .inflate(
                      type == 0 ? R.layout.item_label_chooser : android.R.layout.simple_list_item_1,
                      null);

      if (type == 0) {
        TextView text1 = V.get(res, android.R.id.text1);
        Label label = getItem(position);
        text1.setText(label.title);
        U.applyLabelColor(label, text1);
      } else {
        TextView text1 = V.get(res, android.R.id.text1);
        text1.setText(context.getString(R.string.create_label_titik3));

        // for API 10 or lower, forcefully set text color
        if (VERSION.SDK_INT <= 10) {
          text1.setTextColor(0xff000000);
        }
      }

      return res;
    }
Пример #2
0
  private View getLabelView(Label label) {
    TextView res = (TextView) LayoutInflater.from(context).inflate(R.layout.label_x, null);
    res.setLayoutParams(panelLabels.generateDefaultLayoutParams());
    res.setText(label.title);
    res.setTag(R.id.TAG_label, label);
    res.setOnClickListener(lJudul_click);

    U.applyLabelColor(label, res);

    return res;
  }
Пример #3
0
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      View res =
          convertView != null
              ? convertView
              : getLayoutInflater().inflate(R.layout.item_bookmark_filter, null);

      ImageView imgFilterIcon = V.get(res, R.id.imgFilterIcon);
      if (position < 3) {
        imgFilterIcon.setVisibility(View.VISIBLE);
        imgFilterIcon.setImageResource(
            position == 0
                ? R.drawable.attribute_type_bookmark
                : position == 1
                    ? R.drawable.attribute_type_note
                    : position == 2 ? R.drawable.highlight_color_checked : 0);
        imgFilterIcon.setBackgroundColor(position == 2 ? 0xffffff00 : 0);
      } else {
        imgFilterIcon.setVisibility(View.GONE);
      }

      TextView lFilterCaption = V.get(res, R.id.lFilterCaption);
      if (position < 4) {
        lFilterCaption.setVisibility(View.VISIBLE);
        lFilterCaption.setText(presetCaptions[position]);
      } else {
        lFilterCaption.setVisibility(View.GONE);
      }

      TextView lFilterLabel = V.get(res, R.id.lFilterLabel);
      if (position < 4) {
        lFilterLabel.setVisibility(View.GONE);
      } else {
        Label label = getItem(position);
        lFilterLabel.setVisibility(View.VISIBLE);
        lFilterLabel.setText(label.title);

        U.applyLabelColor(label, lFilterLabel);
      }

      View drag_handle = V.get(res, R.id.drag_handle);
      if (position < 4) {
        drag_handle.setVisibility(View.GONE);
      } else {
        drag_handle.setVisibility(View.VISIBLE);
      }

      return res;
    }