public void createSeekBar(View customView) {
    SeekBar brightbar = (SeekBar) customView.findViewById(R.id.seekBar_light);
    brightbar.setMax(255);
    brightbar.setProgress(200);
    try {
      // get the current system brightness
      brightness = System.getInt(this.getContentResolver(), System.SCREEN_BRIGHTNESS);
      brightbar.setProgress(SettingUtils.getSetting(ComicImageViewActivity.this, "light", 125));
    } catch (SettingNotFoundException e) {
      Toast.makeText(this, "不能获取系统亮度", Toast.LENGTH_SHORT).show();
      return;
    }
    // register OnSeekBarChangeListener, so it can actually change values
    brightbar.setOnSeekBarChangeListener(
        new OnSeekBarChangeListener() {
          @Override
          public void onStopTrackingTouch(SeekBar seekBar) {
            // set the system brightness using the brightness variable value
            // if(Settings.System.getInt(cResolver,
            // Settings.System.SCREEN_BRIGHTNESS_MODE) ==
            // Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC)
            // System.putInt(cResolver, System.SCREEN_BRIGHTNESS,
            // brightness);

            // preview brightness changes at this window
            // get the current window attributes
            LayoutParams layoutpars = getWindow().getAttributes();
            // set the brightness of this window
            layoutpars.screenBrightness = brightness / (float) 255;
            // apply attribute changes to this window
            getWindow().setAttributes(layoutpars);
          }

          @Override
          public void onStartTrackingTouch(SeekBar seekBar) {}

          @Override
          public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            // sets the minimal brightness level
            // if seek bar is 20 or any value below
            if (progress <= 10) {
              // set the brightness to 20
              brightness = 10;
            } else // brightness is greater than 20
            {
              // sets brightness variable based on the progress bar
              brightness = progress;
            }
          }
        });
  }
 private void LightShow() {
   // preview brightness changes at this window
   // get the current window attributes
   LayoutParams layoutpars = getWindow().getAttributes();
   // set the brightness of this window
   int light = 100;
   try {
     light = Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS);
     layoutpars.screenBrightness =
         SettingUtils.getSetting(ComicImageViewActivity.this, "light", light) / (float) 255;
     // apply attribute changes to this window
     getWindow().setAttributes(layoutpars);
   } catch (SettingNotFoundException e) {
     e.printStackTrace();
   }
 }