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);
Header displayOptionsHeader = new Header(); displayOptionsHeader.titleRes = R.string.display_options_title; displayOptionsHeader.fragment = DisplayOptionsSettingsFragment.class.getName(); Header soundSettingsHeader = new Header(); soundSettingsHeader.titleRes = R.string.sounds_and_vibration_title; soundSettingsHeader.fragment = SoundSettingsFragment.class.getName(); Header quickResponseSettingsHeader = new Header(); Intent quickResponseSettingsIntent = new Intent(TelecomManager.ACTION_SHOW_RESPOND_VIA_SMS_SETTINGS); if (isPrimaryUser && TelephonyManagerCompat.getPhoneCount(telephonyManager) <= 1) { Header callSettingsHeader = new Header(); Intent callSettingsIntent = new Intent(TelecomManager.ACTION_SHOW_CALL_SETTINGS); callSettingsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); target.add(callSettingsHeader); } else if (BuildCompat.isAtLeastN() || isPrimaryUser) { Header phoneAccountSettingsHeader = new Header(); Intent phoneAccountSettingsIntent = new Intent(TelecomManager.ACTION_CHANGE_PHONE_ACCOUNTS); Header blockedCallsHeader = new Header(); blockedCallsHeader.titleRes = R.string.manage_blocked_numbers_label; blockedCallsHeader.intent = FilteredNumberCompat.createManageBlockedNumbersIntent(this); && (TelephonyManagerCompat.isTtyModeSupported(telephonyManager)
public View getView(int position, View convertView, ViewGroup parent) { Header header = getItem(position); int headerType = getHeaderType(header); View view = null; switch (headerType) { case HEADER_TYPE_CATEGORY: view = mInflater.inflate(android.R.layout.preference_category, parent, false); ((TextView) view.findViewById(android.R.id.title)).setText(header.getTitle(getContext().getResources())); break; case HEADER_TYPE_SWITCH: view = mInflater.inflate(R.layout.preference_header_switch_item, parent, false); ((ImageView) view.findViewById(android.R.id.icon)).setImageResource(header.iconRes); ((TextView) view.findViewById(android.R.id.title)).setText(header.getTitle(getContext().getResources())); ((TextView) view.findViewById(android.R.id.summary)).setText(header.getSummary(getContext().getResources())); if(header.id == R.id.contentdirectory_settings) mContentDirectoryEnabler = new ContentDirectoryEnabler(getContext(), (Switch) view.findViewById(R.id.switchWidget)); break; case HEADER_TYPE_NORMAL: view = mInflater.inflate(R.layout.preference_header_item, parent, false); ((ImageView) view.findViewById(android.R.id.icon)).setImageResource(header.iconRes); ((TextView) view.findViewById(android.R.id.title)).setText(header.getTitle(getContext().getResources())); ((TextView) view.findViewById(android.R.id.summary)).setText(header.getSummary(getContext().getResources())); break; } return view; }