@Override
  // Hit when an item in the first-level popup gets selected, then bring up
  // the second-level popup
  public void onPreferenceClicked(ListPreference pref) {
    if (mPopupStatus != POPUP_FIRST_LEVEL) return;

    LayoutInflater inflater =
        (LayoutInflater) mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    if (CameraSettings.KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL.equals(pref.getKey())) {
      TimeIntervalPopup timeInterval =
          (TimeIntervalPopup) inflater.inflate(R.layout.time_interval_popup, null, false);
      timeInterval.initialize((IconListPreference) pref);
      timeInterval.setSettingChangedListener(this);
      mModule.dismissPopup(true);
      mPopup = timeInterval;
    } else {
      ListPrefSettingPopup basic =
          (ListPrefSettingPopup) inflater.inflate(R.layout.list_pref_setting_popup, null, false);
      basic.initialize(pref);
      basic.setSettingChangedListener(this);
      mModule.dismissPopup(true);
      mPopup = basic;
    }
    mModule.showPopup(mPopup);
    mPopupStatus = POPUP_SECOND_LEVEL;
  }
 public void popupDismissed(boolean topPopupOnly) {
   // if the 2nd level popup gets dismissed
   if (mPopupStatus == POPUP_SECOND_LEVEL) {
     initializePopup();
     mPopupStatus = POPUP_FIRST_LEVEL;
     if (topPopupOnly) mModule.showPopup(mPopup);
   }
 }
 @Override
 // Hit when an item in the second-level popup gets selected
 public void onListPrefChanged(ListPreference pref) {
   if (mPopup != null) {
     if (mPopupStatus == POPUP_SECOND_LEVEL) {
       mModule.dismissPopup(true);
     }
   }
   super.onSettingChanged(pref);
 }