Java Code Examples for android.widget.CheckedTextView#setOnClickListener()

The following examples show how to use android.widget.CheckedTextView#setOnClickListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SingleChoiceDialog.java    From edslite with GNU General Public License v2.0 6 votes vote down vote up
protected ArrayAdapter<T> initAdapter(List<T> items)
{
    return new ArrayAdapter<T>(getActivity(), android.R.layout.simple_list_item_single_choice, items)
    {
        @Override
        public View getView(final int position, View convertView, ViewGroup parent)
        {
            final CheckedTextView tv = (CheckedTextView) super.getView(position, convertView, parent);
            tv.setOnClickListener(v ->
            {
                getListView().setItemChecked(position, true);
                _okButton.setEnabled(true);
            });
            tv.setChecked(getListView().isItemChecked(position));
            return tv;
        }
    };
}
 
Example 2
Source File: MainActivity.java    From Phlux with MIT License 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    findViewById(R.id.thread_demo).setOnClickListener(v -> startActivity(new Intent(this, DemoActivity.class)));

    check1 = (CheckedTextView) findViewById(R.id.check1);
    check2 = (CheckedTextView) findViewById(R.id.check2);

    check1.setText(MainState.NAME_1);
    check2.setText(MainState.NAME_2);

    check1.setOnClickListener(v -> switchTo(MainState.NAME_1));
    check2.setOnClickListener(v -> switchTo(MainState.NAME_2));

    ListView listView = (ListView) findViewById(R.id.listView);
    listView.setAdapter(adapter = new ArrayAdapter<>(this, R.layout.item));
}
 
Example 3
Source File: DialogXRandomInfo.java    From bither-android with Apache License 2.0 6 votes vote down vote up
public DialogXRandomInfo(Context context, boolean guide, boolean auto) {
    super(context);
    setContentView(R.layout.dialog_xrandom_info);
    findViewById(R.id.btn_ok).setOnClickListener(this);
    TextView tv = (TextView) findViewById(R.id.tv);
    if (guide) {
        tv.setText(context.getString(R.string.xrandom_info_detail) + context.getString(R
                .string.xrandom_info_guide));
    } else {
        tv.setText(context.getString(R.string.xrandom_info_detail));
    }
    tv.setMaxWidth(UIUtil.getScreenWidth() - UIUtil.dip2pix(80));
    cbxAutoShowNegative = (CheckedTextView) findViewById(R.id.cbx_auto_show_negative);
    if (auto) {
        cbxAutoShowNegative.setVisibility(View.VISIBLE);
        cbxAutoShowNegative.setOnClickListener(this);
    } else {
        cbxAutoShowNegative.setVisibility(View.GONE);
    }
}
 
Example 4
Source File: TrivialActivity.java    From OPFIab with Apache License 2.0 6 votes vote down vote up
public HeaderViewHolder(final DragSortAdapter<?> dragSortAdapter, final View itemView) {
    super(dragSortAdapter, itemView);
    spinHelper = (Spinner) itemView.findViewById(R.id.spin_helper);
    tvSetupStatus = (TextView) itemView.findViewById(R.id.tv_setup_status);
    tvSetupProvider = (TextView) itemView.findViewById(R.id.tv_setup_provider);
    pbSetup = (ProgressBar) itemView.findViewById(R.id.pb_setup);
    btnForget = (Button) itemView.findViewById(R.id.btn_forget);
    btnInit = (Button) itemView.findViewById(R.id.btn_init);
    btnSetup = (Button) itemView.findViewById(R.id.btn_setup);
    ctvAutoRecover = (CheckedTextView) itemView.findViewById(R.id.ctv_auto_recover);

    final HelpersAdapter adapter = new HelpersAdapter();
    spinHelper.setAdapter(adapter);
    spinHelper.setSelection(adapter.getPosition(TrivialBilling.getHelper()));
    spinHelper.setOnItemSelectedListener(this);

    btnForget.setOnClickListener(this);
    btnInit.setOnClickListener(this);
    btnSetup.setOnClickListener(this);
    ctvAutoRecover.setChecked(TrivialBilling.isAutoRecover());
    ctvAutoRecover.setOnClickListener(this);

    iabHelper.addSetupListener(this);
}
 
Example 5
Source File: TrackSelectionHelper.java    From leafpicrevived with GNU General Public License v3.0 5 votes vote down vote up
@SuppressLint("InflateParams")
private View buildView(LayoutInflater inflater) {
    View view = inflater.inflate(R.layout.track_selection_dialog, null);
    ViewGroup root = view.findViewById(R.id.root);

    trackViews = new CheckedTextView[trackGroups.length][];
    for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
        TrackGroup group = trackGroups.get(groupIndex);
        boolean groupIsAdaptive = trackGroupsAdaptive[groupIndex];
        trackViews[groupIndex] = new CheckedTextView[group.length];
        for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
            if (trackIndex == 0) {
                root.addView(inflater.inflate(R.layout.list_divider, root, false));
            }
            int trackViewLayoutId = groupIsAdaptive ? android.R.layout.simple_list_item_multiple_choice
                    : android.R.layout.simple_list_item_single_choice;
            CheckedTextView trackView = (CheckedTextView) inflater.inflate(
                    trackViewLayoutId, root, false);
            trackView.setText(buildTrackName(group.getFormat(trackIndex)));
            if (trackInfo.getTrackFormatSupport(rendererIndex, groupIndex, trackIndex)
                    == RendererCapabilities.FORMAT_HANDLED) {
                trackView.setFocusable(true);
                trackView.setTag(Pair.create(groupIndex, trackIndex));
                trackView.setOnClickListener(this);
            } else {
                trackView.setFocusable(false);
                trackView.setEnabled(false);
            }
            trackViews[groupIndex][trackIndex] = trackView;
            root.addView(trackView);
        }
    }

    updateViews();
    return view;
}
 
Example 6
Source File: LocationTrackingActivity.java    From android-map-sdk with Apache License 2.0 5 votes vote down vote up
@Override
public void onMapReady(@NonNull NaverMap naverMap) {
    map = naverMap;

    naverMap.setLocationSource(locationSource);

    CheckedTextView none = findViewById(R.id.location_tracking_mode_none);
    CheckedTextView noFollow = findViewById(R.id.location_tracking_mode_no_follow);
    CheckedTextView follow = findViewById(R.id.location_tracking_mode_follow);
    CheckedTextView face = findViewById(R.id.location_tracking_mode_face);

    none.setOnClickListener(v -> naverMap.setLocationTrackingMode(LocationTrackingMode.None));
    noFollow.setOnClickListener(v -> naverMap.setLocationTrackingMode(LocationTrackingMode.NoFollow));
    follow.setOnClickListener(v -> naverMap.setLocationTrackingMode(LocationTrackingMode.Follow));
    face.setOnClickListener(v -> naverMap.setLocationTrackingMode(LocationTrackingMode.Face));

    naverMap.addOnOptionChangeListener(() -> {
        LocationTrackingMode mode = naverMap.getLocationTrackingMode();
        none.setChecked(mode == LocationTrackingMode.None);
        noFollow.setChecked(mode == LocationTrackingMode.NoFollow);
        follow.setChecked(mode == LocationTrackingMode.Follow);
        face.setChecked(mode == LocationTrackingMode.Face);

        locationSource.setCompassEnabled(mode == LocationTrackingMode.Follow || mode == LocationTrackingMode.Face);
    });

    naverMap.setLocationTrackingMode(LocationTrackingMode.Follow);
}
 
Example 7
Source File: TrackSelectionHelper.java    From PowerFileExplorer with GNU General Public License v3.0 4 votes vote down vote up
@SuppressLint("InflateParams")
private View buildView(Context context) {
  LayoutInflater inflater = LayoutInflater.from(context);
  View view = inflater.inflate(R.layout.track_selection_dialog, null);
  ViewGroup root = (ViewGroup) view.findViewById(R.id.root);

  TypedArray attributeArray = context.getTheme().obtainStyledAttributes(
      new int[] {android.R.attr.selectableItemBackground});
  int selectableItemBackgroundResourceId = attributeArray.getResourceId(0, 0);
  attributeArray.recycle();

  // View for disabling the renderer.
  disableView = (CheckedTextView) inflater.inflate(
      android.R.layout.simple_list_item_single_choice, root, false);
  disableView.setBackgroundResource(selectableItemBackgroundResourceId);
  disableView.setText(R.string.selection_disabled);
  disableView.setFocusable(true);
  disableView.setOnClickListener(this);
  root.addView(disableView);

  // View for clearing the override to allow the selector to use its default selection logic.
  defaultView = (CheckedTextView) inflater.inflate(
      android.R.layout.simple_list_item_single_choice, root, false);
  defaultView.setBackgroundResource(selectableItemBackgroundResourceId);
  defaultView.setText(R.string.selection_default);
  defaultView.setFocusable(true);
  defaultView.setOnClickListener(this);
  root.addView(inflater.inflate(R.layout.list_divider, root, false));
  root.addView(defaultView);

  // Per-track views.
  boolean haveSupportedTracks = false;
  boolean haveAdaptiveTracks = false;
  trackViews = new CheckedTextView[trackGroups.length][];
  for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
    TrackGroup group = trackGroups.get(groupIndex);
    boolean groupIsAdaptive = trackGroupsAdaptive[groupIndex];
    haveAdaptiveTracks |= groupIsAdaptive;
    trackViews[groupIndex] = new CheckedTextView[group.length];
    for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
      if (trackIndex == 0) {
        root.addView(inflater.inflate(R.layout.list_divider, root, false));
      }
      int trackViewLayoutId = groupIsAdaptive ? android.R.layout.simple_list_item_multiple_choice
          : android.R.layout.simple_list_item_single_choice;
      CheckedTextView trackView = (CheckedTextView) inflater.inflate(
          trackViewLayoutId, root, false);
      trackView.setBackgroundResource(selectableItemBackgroundResourceId);
      trackView.setText(buildTrackName(group.getFormat(trackIndex)));
      if (trackInfo.getTrackFormatSupport(rendererIndex, groupIndex, trackIndex)
          == RendererCapabilities.FORMAT_HANDLED) {
        trackView.setFocusable(true);
        trackView.setTag(Pair.create(groupIndex, trackIndex));
        trackView.setOnClickListener(this);
        haveSupportedTracks = true;
      } else {
        trackView.setFocusable(false);
        trackView.setEnabled(false);
      }
      trackViews[groupIndex][trackIndex] = trackView;
      root.addView(trackView);
    }
  }

  if (!haveSupportedTracks) {
    // Indicate that the default selection will be nothing.
    defaultView.setText(R.string.selection_default_none);
  } else if (haveAdaptiveTracks) {
    // View for using random adaptation.
    enableRandomAdaptationView = (CheckedTextView) inflater.inflate(
        android.R.layout.simple_list_item_multiple_choice, root, false);
    enableRandomAdaptationView.setBackgroundResource(selectableItemBackgroundResourceId);
    enableRandomAdaptationView.setText(R.string.enable_random_adaptation);
    enableRandomAdaptationView.setOnClickListener(this);
    root.addView(inflater.inflate(R.layout.list_divider, root, false));
    root.addView(enableRandomAdaptationView);
  }

  updateViews();
  return view;
}
 
Example 8
Source File: TrackSelectionHelper.java    From ExoPlayer-Offline with Apache License 2.0 4 votes vote down vote up
@SuppressLint("InflateParams")
private View buildView(Context context) {
  LayoutInflater inflater = LayoutInflater.from(context);
  View view = inflater.inflate(R.layout.track_selection_dialog, null);
  ViewGroup root = (ViewGroup) view.findViewById(R.id.root);

  TypedArray attributeArray = context.getTheme().obtainStyledAttributes(
      new int[] {android.R.attr.selectableItemBackground});
  int selectableItemBackgroundResourceId = attributeArray.getResourceId(0, 0);
  attributeArray.recycle();

  // View for disabling the renderer.
  disableView = (CheckedTextView) inflater.inflate(
      android.R.layout.simple_list_item_single_choice, root, false);
  disableView.setBackgroundResource(selectableItemBackgroundResourceId);
  disableView.setText(R.string.selection_disabled);
  disableView.setFocusable(true);
  disableView.setOnClickListener(this);
  root.addView(disableView);

  // View for clearing the override to allow the selector to use its default selection logic.
  defaultView = (CheckedTextView) inflater.inflate(
      android.R.layout.simple_list_item_single_choice, root, false);
  defaultView.setBackgroundResource(selectableItemBackgroundResourceId);
  defaultView.setText(R.string.selection_default);
  defaultView.setFocusable(true);
  defaultView.setOnClickListener(this);
  root.addView(inflater.inflate(R.layout.list_divider, root, false));
  root.addView(defaultView);

  // Per-track views.
  boolean haveSupportedTracks = false;
  boolean haveAdaptiveTracks = false;
  trackViews = new CheckedTextView[trackGroups.length][];
  for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
    TrackGroup group = trackGroups.get(groupIndex);
    boolean groupIsAdaptive = trackGroupsAdaptive[groupIndex];
    haveAdaptiveTracks |= groupIsAdaptive;
    trackViews[groupIndex] = new CheckedTextView[group.length];
    for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
      if (trackIndex == 0) {
        root.addView(inflater.inflate(R.layout.list_divider, root, false));
      }
      int trackViewLayoutId = groupIsAdaptive ? android.R.layout.simple_list_item_multiple_choice
          : android.R.layout.simple_list_item_single_choice;
      CheckedTextView trackView = (CheckedTextView) inflater.inflate(
          trackViewLayoutId, root, false);
      trackView.setBackgroundResource(selectableItemBackgroundResourceId);
      trackView.setText(buildTrackName(group.getFormat(trackIndex)));
      if (trackInfo.getTrackFormatSupport(rendererIndex, groupIndex, trackIndex)
          == RendererCapabilities.FORMAT_HANDLED) {
        trackView.setFocusable(true);
        trackView.setTag(Pair.create(groupIndex, trackIndex));
        trackView.setOnClickListener(this);
        haveSupportedTracks = true;
      } else {
        trackView.setFocusable(false);
        trackView.setEnabled(false);
      }
      trackViews[groupIndex][trackIndex] = trackView;
      root.addView(trackView);
    }
  }

  if (!haveSupportedTracks) {
    // Indicate that the default selection will be nothing.
    defaultView.setText(R.string.selection_default_none);
  } else if (haveAdaptiveTracks) {
    // View for using random adaptation.
    enableRandomAdaptationView = (CheckedTextView) inflater.inflate(
        android.R.layout.simple_list_item_multiple_choice, root, false);
    enableRandomAdaptationView.setBackgroundResource(selectableItemBackgroundResourceId);
    enableRandomAdaptationView.setText(R.string.enable_random_adaptation);
    enableRandomAdaptationView.setOnClickListener(this);
    root.addView(inflater.inflate(R.layout.list_divider, root, false));
    root.addView(enableRandomAdaptationView);
  }

  updateViews();
  return view;
}
 
Example 9
Source File: MainActivity.java    From android-ringtone-picker with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final CheckedTextView musicCb = findViewById(R.id.cb_music);
    musicCb.setOnClickListener(mCheckBoxClickListener);

    final CheckedTextView notificationCb = findViewById(R.id.cb_notification);
    notificationCb.setOnClickListener(mCheckBoxClickListener);

    final CheckedTextView ringtoneCb = findViewById(R.id.cb_ringtone);
    ringtoneCb.setOnClickListener(mCheckBoxClickListener);

    final CheckedTextView alarmCb = findViewById(R.id.cb_alarm);
    alarmCb.setOnClickListener(mCheckBoxClickListener);

    final SwitchCompat playRingtoneSwitch = findViewById(R.id.switch_play_ringtone);
    final SwitchCompat defaultSwitch = findViewById(R.id.switch_default_ringtone);
    final SwitchCompat silentSwitch = findViewById(R.id.switch_silent_ringtone);

    final TextView ringtoneTv = findViewById(R.id.tv_ringtone_info);

    findViewById(R.id.btn_pick_ringtone).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            //Validate if at least one ringtone type is selected.
            if (!musicCb.isChecked()
                    && !notificationCb.isChecked()
                    && alarmCb.isChecked()
                    && musicCb.isChecked()) {

                Toast.makeText(MainActivity.this, R.string.error_no_ringtone_type,
                        Toast.LENGTH_SHORT).show();
                return;
            }

            //Application needs read storage permission for Builder.TYPE_MUSIC .
            if (ActivityCompat.checkSelfPermission(MainActivity.this,
                    Manifest.permission.READ_EXTERNAL_STORAGE)
                    == PackageManager.PERMISSION_GRANTED) {

                RingtonePickerDialog.Builder ringtonePickerBuilder = new RingtonePickerDialog
                        .Builder(MainActivity.this, getSupportFragmentManager())

                        //Set title of the dialog.
                        //If set null, no title will be displayed.
                        .setTitle("Select ringtone")

                        //set the currently selected uri, to mark that ringtone as checked by default.
                        //If no ringtone is currently selected, pass null.
                        .setCurrentRingtoneUri(mCurrentSelectedUri)

                        //Allow user to select default ringtone set in phone settings.
                        .displayDefaultRingtone(defaultSwitch.isChecked())

                        //Allow user to select silent (i.e. No ringtone.).
                        .displaySilentRingtone(silentSwitch.isChecked())

                        //set the text to display of the positive (ok) button.
                        //If not set OK will be the default text.
                        .setPositiveButtonText("SET RINGTONE")

                        //set text to display as negative button.
                        //If set null, negative button will not be displayed.
                        .setCancelButtonText("CANCEL")

                        //Set flag true if you want to play the sample of the clicked tone.
                        .setPlaySampleWhileSelection(playRingtoneSwitch.isChecked())

                        //Set the callback listener.
                        .setListener(new RingtonePickerListener() {
                            @Override
                            public void OnRingtoneSelected(@NonNull String ringtoneName, Uri ringtoneUri) {
                                mCurrentSelectedUri = ringtoneUri;
                                ringtoneTv.setText(String.format("Name : %s\nUri : %s", ringtoneName, ringtoneUri));
                            }
                        });


                //Add the desirable ringtone types.
                if (musicCb.isChecked())
                    ringtonePickerBuilder.addRingtoneType(RingtonePickerDialog.Builder.TYPE_MUSIC);
                if (notificationCb.isChecked())
                    ringtonePickerBuilder.addRingtoneType(RingtonePickerDialog.Builder.TYPE_NOTIFICATION);
                if (ringtoneCb.isChecked())
                    ringtonePickerBuilder.addRingtoneType(RingtonePickerDialog.Builder.TYPE_RINGTONE);
                if (alarmCb.isChecked())
                    ringtonePickerBuilder.addRingtoneType(RingtonePickerDialog.Builder.TYPE_ALARM);

                //Display the dialog.
                ringtonePickerBuilder.show();
            } else {
                ActivityCompat.requestPermissions(MainActivity.this,
                        new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
                        123);
            }
        }
    });
}
 
Example 10
Source File: MediaRecorderActivity.java    From VideoRecord with MIT License 4 votes vote down vote up
/**
 * 加载视图
 */
private void loadViews() {
    setContentView(R.layout.activity_media_recorder);
    // ~~~ 绑定控件
    mSurfaceView = (SurfaceView) findViewById(R.id.record_preview);
    mCameraSwitch = (CheckBox) findViewById(R.id.record_camera_switcher);
    mFocusImage = (ImageView) findViewById(R.id.record_focusing);
    mProgressView = (ProgressView) findViewById(R.id.record_progress);
    mRecordDelete = (CheckedTextView) findViewById(R.id.record_delete);
    mRecordController = (ImageView) findViewById(R.id.record_controller);
    mBottomLayout = (RelativeLayout) findViewById(R.id.bottom_layout);
    mRecordLed = (CheckBox) findViewById(R.id.record_camera_led);

    // ~~~ 绑定事件
    if (DeviceUtils.hasICS())
        mSurfaceView.setOnTouchListener(mOnSurfaveViewTouchListener);

    findViewById(R.id.title_back).setOnClickListener(this);
    mRecordDelete.setOnClickListener(this);
    mRecordController.setOnClickListener(this);

    // 是否支持前置摄像头
    if (MediaRecorderBase.isSupportFrontCamera()) {
        mCameraSwitch.setOnClickListener(this);
    } else {
        mCameraSwitch.setVisibility(View.GONE);
    }
    // 是否支持闪光灯
    if (DeviceUtils.isSupportCameraLedFlash(getPackageManager())) {
        mRecordLed.setOnClickListener(this);
    } else {
        mRecordLed.setVisibility(View.GONE);
    }

    try {
        mFocusImage.setImageResource(R.drawable.video_focus);
    } catch (OutOfMemoryError e) {
        Logger.e(e);
    }

    mProgressView.setMaxDuration(RECORD_TIME_MAX);
    initSurfaceView();
}
 
Example 11
Source File: AppCompatTimePickerDelegate.java    From AppCompat-Extension-Library with Apache License 2.0 4 votes vote down vote up
public AppCompatTimePickerDelegate(AppCompatTimePicker delegator, Context context, AttributeSet attrs,
                                   int defStyleAttr, int defStyleRes) {
    super(delegator, context);

    // process style attributes
    final TypedArray a = mContext.obtainStyledAttributes(attrs,
            R.styleable.TimePickerDialog, defStyleAttr, defStyleRes);
    final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
            Context.LAYOUT_INFLATER_SERVICE);
    final Resources res = mContext.getResources();

    mSelectHours = res.getString(R.string.select_hours);
    mSelectMinutes = res.getString(R.string.select_minutes);

    String[] amPmStrings = getAmPmStrings(context);
    mAmText = amPmStrings[0];
    mPmText = amPmStrings[1];

    final View mainView = inflater.inflate(R.layout.time_picker_material, delegator);

    mHeaderView = mainView.findViewById(R.id.time_header);

    // Set up hour/minute labels.
    mHourView = (TextView) mainView.findViewById(R.id.hours);
    mHourView.setOnClickListener(mClickListener);
    ViewCompat.setAccessibilityDelegate(mHourView,
            new ClickActionDelegate(context, R.string.select_hours));
    mSeparatorView = (TextView) mainView.findViewById(R.id.separator);
    mMinuteView = (TextView) mainView.findViewById(R.id.minutes);
    mMinuteView.setOnClickListener(mClickListener);
    ViewCompat.setAccessibilityDelegate(mMinuteView,
            new ClickActionDelegate(context, R.string.select_minutes));

    // Now that we have text appearances out of the way, make sure the hour
    // and minute views are correctly sized.
    mHourView.setMinWidth(computeStableWidth(mHourView, 24));
    mMinuteView.setMinWidth(computeStableWidth(mMinuteView, 60));

    // Set up AM/PM labels.
    mAmPmLayout = mainView.findViewById(R.id.ampm_layout);
    mAmLabel = (CheckedTextView) mAmPmLayout.findViewById(R.id.am_label);
    mAmLabel.setText(obtainVerbatim(amPmStrings[0]));
    mAmLabel.setOnClickListener(mClickListener);
    mPmLabel = (CheckedTextView) mAmPmLayout.findViewById(R.id.pm_label);
    mPmLabel.setText(obtainVerbatim(amPmStrings[1]));
    mPmLabel.setOnClickListener(mClickListener);


    // Set up header text color, if available.
    ColorStateList headerTextColor;
    if (a.hasValue(R.styleable.TimePickerDialog_headerTextColor)) {
        headerTextColor = a.getColorStateList(R.styleable.DatePickerDialog_headerTextColor);
    } else {
        headerTextColor = PickerThemeUtils.getHeaderTextColorStateList(mContext);
    }
    mHourView.setTextColor(headerTextColor);
    mSeparatorView.setTextColor(headerTextColor);
    mMinuteView.setTextColor(headerTextColor);
    mAmLabel.setTextColor(headerTextColor);
    mPmLabel.setTextColor(headerTextColor);

    // Set up header background, if available.
    ViewCompatUtils.setBackground(mHeaderView, PickerThemeUtils.getHeaderBackground(mContext,
            a.getColor(R.styleable.DatePickerDialog_headerBackground,
                    ThemeUtils.getThemeAttrColor(mContext, R.attr.colorAccent))));

    a.recycle();

    mRadialTimePickerView = (RadialTimePickerView) mainView.findViewById(
            R.id.radial_picker);

    setupListeners();

    mAllowAutoAdvance = true;

    // Set up for keyboard mode.
    mDoublePlaceholderText = res.getString(R.string.time_placeholder);
    mDeletedKeyFormat = res.getString(R.string.deleted_key);
    mPlaceholderText = mDoublePlaceholderText.charAt(0);
    mAmKeyCode = mPmKeyCode = -1;
    generateLegalTimesTree();

    // Initialize with current time
    final Calendar calendar = Calendar.getInstance(mCurrentLocale);
    final int currentHour = calendar.get(Calendar.HOUR_OF_DAY);
    final int currentMinute = calendar.get(Calendar.MINUTE);
    initialize(currentHour, currentMinute, false /* 12h */, HOUR_INDEX);
}