@Override
    public View getView(int position, View convertView, ViewGroup parent) {
      HeaderViewHolder holder;
      View view;

      if (convertView == null) {
        view = mInflater.inflate(R.layout.dialer_preferences, parent, false);
        holder = new HeaderViewHolder();
        holder.title = (TextView) view.findViewById(R.id.title);
        holder.summary = (TextView) view.findViewById(R.id.summary);
        view.setTag(holder);
      } else {
        view = convertView;
        holder = (HeaderViewHolder) view.getTag();
      }

      // All view fields must be updated every time, because the view may be recycled
      Header header = getItem(position);
      holder.title.setText(header.getTitle(getContext().getResources()));
      CharSequence summary = header.getSummary(getContext().getResources());
      if (!TextUtils.isEmpty(summary)) {
        holder.summary.setVisibility(View.VISIBLE);
        holder.summary.setText(summary);
      } else {
        holder.summary.setVisibility(View.GONE);
      }
      return view;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      HeaderViewHolder holder;
      Header header = getItem(position);
      int headerType = getHeaderType(header);
      View view = null;

      if (convertView == null) {
        holder = new HeaderViewHolder();
        switch (headerType) {
          case HEADER_TYPE_CATEGORY:
            view = new TextView(getContext(), null, android.R.attr.listSeparatorTextViewStyle);
            holder.title = (TextView) view;
            break;

          case HEADER_TYPE_NORMAL:
            view = mInflater.inflate(R.layout.preference_header_item, parent, false);
            holder.icon = (ImageView) view.findViewById(R.id.icon);
            holder.title = (TextView) view.findViewById(com.android.internal.R.id.title);
            holder.summary = (TextView) view.findViewById(com.android.internal.R.id.summary);
            break;
        }
        view.setTag(holder);
      } else {
        view = convertView;
        holder = (HeaderViewHolder) view.getTag();
      }

      // All view fields must be updated every time, because the view may be recycled
      switch (headerType) {
        case HEADER_TYPE_CATEGORY:
          holder.title.setText(header.getTitle(getContext().getResources()));
          break;

        case HEADER_TYPE_NORMAL:
          holder.icon.setImageResource(header.iconRes);
          holder.title.setText(header.getTitle(getContext().getResources()));
          CharSequence summary = header.getSummary(getContext().getResources());
          if (!TextUtils.isEmpty(summary)) {
            holder.summary.setVisibility(View.VISIBLE);
            holder.summary.setText(summary);
          } else {
            holder.summary.setVisibility(View.GONE);
          }
          break;
      }

      return view;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      HeaderViewHolder holder;
      Header header = getItem(position);
      int headerType = getHeaderType(header);
      View view = null;

      if (convertView == null || headerType == HEADER_TYPE_SWITCH) {
        holder = new HeaderViewHolder();
        switch (headerType) {
          case HEADER_TYPE_CATEGORY:
            view = new TextView(getContext(), null, android.R.attr.listSeparatorTextViewStyle);
            holder.title = (TextView) view;
            break;

          case HEADER_TYPE_SWITCH:
            view = mInflater.inflate(R.layout.preference_header_switch_item, parent, false);
            holder.icon = (ImageView) view.findViewById(R.id.icon);
            holder.title = (TextView) view.findViewById(com.android.internal.R.id.title);
            holder.summary = (TextView) view.findViewById(com.android.internal.R.id.summary);
            holder.switch_ = (Switch) view.findViewById(R.id.switchWidget);
            break;

          case HEADER_TYPE_NORMAL:
            view = mInflater.inflate(R.layout.preference_header_item, parent, false);
            holder.icon = (ImageView) view.findViewById(R.id.icon);
            holder.title = (TextView) view.findViewById(com.android.internal.R.id.title);
            holder.summary = (TextView) view.findViewById(com.android.internal.R.id.summary);
            break;
        }
        view.setTag(holder);
      } else {
        view = convertView;
        holder = (HeaderViewHolder) view.getTag();
      }

      // All view fields must be updated every time, because the view may be recycled
      switch (headerType) {
        case HEADER_TYPE_CATEGORY:
          holder.title.setText(header.getTitle(getContext().getResources()));
          break;

        case HEADER_TYPE_SWITCH:
          // Would need a different treatment if the main menu had more switches
          if (header.id == R.id.wifi_settings) {
            mWifiEnabler.setSwitch(holder.switch_);
          } else if (header.id == R.id.bluetooth_settings) {
            mBluetoothEnabler.setSwitch(holder.switch_);
          } else if (header.id == R.id.profiles_settings) {
            mProfileEnabler.setSwitch(holder.switch_);
          } else if (header.id == R.id.trds_settings) {
            mTRDSSwitch = (Switch) view.findViewById(R.id.switchWidget);
            mTRDSEnabler.setSwitch(holder.switch_);
          }
          // No break, fall through on purpose to update common fields

          // $FALL-THROUGH$
        case HEADER_TYPE_NORMAL:
          if (header.extras != null
              && header.extras.containsKey(ManageAccountsSettings.KEY_ACCOUNT_TYPE)) {
            String accType = header.extras.getString(ManageAccountsSettings.KEY_ACCOUNT_TYPE);
            ViewGroup.LayoutParams lp = holder.icon.getLayoutParams();
            lp.width = getContext().getResources().getDimensionPixelSize(R.dimen.header_icon_width);
            lp.height = lp.width;
            holder.icon.setLayoutParams(lp);
            Drawable icon = mAuthHelper.getDrawableForType(getContext(), accType);
            holder.icon.setImageDrawable(icon);
          } else {
            holder.icon.setImageResource(header.iconRes);
          }
          holder.title.setText(header.getTitle(getContext().getResources()));
          CharSequence summary = header.getSummary(getContext().getResources());
          if (!TextUtils.isEmpty(summary)) {
            holder.summary.setVisibility(View.VISIBLE);
            holder.summary.setText(summary);
          } else {
            holder.summary.setVisibility(View.GONE);
          }
          break;
      }

      return view;
    }