@Override
  protected void onBindDialogView(View view) {
    super.onBindDialogView(view);

    mSeekBar = getSeekBar(view);
    mSeekBar.setMax(MAXIMUM_BACKLIGHT); // - mScreenBrightnessDim);

    try {
      this.loadPreference();
    } catch (InvalidPreferencesFormatException e) {
      e.printStackTrace();

      // Set some default
      this.brightness = 255;
      this.brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
    }

    mOldBrightness = getBrightness(0);
    mSeekBar.setProgress(mOldBrightness); // - mScreenBrightnessDim);

    mCheckBox = (CheckBox) view.findViewById(R.id.automatic_mode);
    if (mAutomaticAvailable) {
      mCheckBox.setOnCheckedChangeListener(this);
      mOldAutomatic = getBrightnessMode(0);
      mCheckBox.setChecked(mOldAutomatic != 0);
    } else {
      mCheckBox.setVisibility(View.GONE);
    }
    mSeekBar.setOnSeekBarChangeListener(this);
  }
 /**
  * Imports Preferences from an XML file.
  *
  * @param filename String File to import from
  */
 public void importPreferences(String filename) throws IOException {
   File f = new File(filename);
   InputStream is = new FileInputStream(f);
   try {
     Preferences.importPreferences(is);
   } catch (InvalidPreferencesFormatException ex) {
     throw new IOException(ex.getMessage());
   }
 }