Example usage for android.widget SeekBar setMax

List of usage examples for android.widget SeekBar setMax

Introduction

In this page you can find the example usage for android.widget SeekBar setMax.

Prototype

@Override
    public synchronized void setMax(int max) 

Source Link

Usage

From source file:jp.co.rediscovery.firstflight.BaseAutoPilotFragment.java

private void initPreprocess(final View rootView) {
    mExposureFormat = getString(R.string.trace_use_exposure);
    mSaturationFormat = getString(R.string.trace_use_saturation);
    mBrightnessFormat = getString(R.string.trace_use_brightness);
    mBinarizeThresholdFormat = getString(R.string.trace_binarize_threshold);

    SeekBar sb;
    Button btn;/* w  ww.j a va2 s.co m*/
    // 
    mExposure = mPref.getFloat(KEY_EXPOSURE, DEFAULT_EXPOSURE);
    mExposureLabel = (TextView) rootView.findViewById(R.id.exposure_textview);
    sb = (SeekBar) rootView.findViewById(R.id.exposure_seekbar);
    sb.setMax(6000);
    sb.setProgress(exposureToProgress(mExposure)); // [-3,+ 3] => [0, 6000]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateExposure(mExposure);
    // 
    mSaturation = mPref.getFloat(KEY_SATURATION, DEFAULT_SATURATION);
    mSaturationLabel = (TextView) rootView.findViewById(R.id.saturation_textview);
    sb = (SeekBar) rootView.findViewById(R.id.saturation_seekbar);
    sb.setMax(200);
    sb.setProgress((int) (mSaturation * 100.0f) + 100); // [-1.0f, +1.0f] => [0, 200]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateSaturation(mSaturation);
    // ?
    mBrightness = mPref.getFloat(KEY_BRIGHTNESS, DEFAULT_BRIGHTNESS);
    mBrightnessLabel = (TextView) rootView.findViewById(R.id.brightness_textview);
    sb = (SeekBar) rootView.findViewById(R.id.brightness_seekbar);
    sb.setMax(200);
    sb.setProgress((int) (mBrightness * 100.0f) + 100); // [-1.0f, +1.0f] => [0, 200]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateBrightness(mBrightness);
    // 
    mBinarizeThreshold = mPref.getFloat(KEY_BINARIZE_THRESHOLD, DEFAULT_BINARIZE_THRESHOLD);
    mBinarizeThresholdLabel = (TextView) rootView.findViewById(R.id.binarize_threshold_textview);
    sb = (SeekBar) rootView.findViewById(R.id.binarize_threshold_seekbar);
    sb.setMax(100);
    sb.setProgress((int) (mBinarizeThreshold * 100.0f)); // [0.0f, +1.0f] => [0, 100]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateBinarizeThreshold(mBinarizeThreshold);
}

From source file:com.serenegiant.autoparrot.BaseAutoPilotFragment.java

/**
 * ??//w ww  .  j a  v a2s. com
 * @param root
 */
private void initConfigFlight(final View root) {
    if (DEBUG)
        Log.v(TAG, "initConfigFlight:");
    mMaxAltitudeFormat = getString(R.string.config_max_altitude);
    mMaxTiltFormat = getString(R.string.config_max_tilt);
    mMaxVerticalSpeedFormat = getString(R.string.config_max_vertical_speed);
    mMaxRotationSpeedFormat = getString(R.string.config_max_rotating_speed);
    // 
    mMaxAltitudeLabel = (TextView) root.findViewById(R.id.max_altitude_textview);
    SeekBar seekbar = (SeekBar) root.findViewById(R.id.max_altitude_seekbar);
    seekbar.setOnSeekBarChangeListener(null);
    seekbar.setMax(1000);
    mMaxAltitude = mFlightController.getMaxAltitude();
    try {
        seekbar.setProgress((int) ((mMaxAltitude.current() - mMaxAltitude.min())
                / (mMaxAltitude.max() - mMaxAltitude.min()) * 1000));
    } catch (final Exception e) {
        seekbar.setProgress(0);
    }
    seekbar.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateMaxAltitude(mMaxAltitude.current());
    // 
    // bebop?5-3050km/hr???13.9m/s/300.46[m/s/]
    mMaxTiltLabel = (TextView) root.findViewById(R.id.max_tilt_textview);
    seekbar = (SeekBar) root.findViewById(R.id.max_tilt_seekbar);
    seekbar.setOnSeekBarChangeListener(null);
    seekbar.setMax(1000);
    mMaxTilt = mFlightController.getMaxTilt();
    try {
        seekbar.setProgress(
                (int) ((mMaxTilt.current() - mMaxTilt.min()) / (mMaxTilt.max() - mMaxTilt.min()) * 1000));
    } catch (final Exception e) {
        seekbar.setProgress(0);
    }
    seekbar.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateMaxTilt(mMaxTilt.current());
    // /?, Bebop2?6m/s
    mMaxVerticalSpeedLabel = (TextView) root.findViewById(R.id.max_vertical_speed_textview);
    seekbar = (SeekBar) root.findViewById(R.id.max_vertical_speed_seekbar);
    seekbar.setOnSeekBarChangeListener(null);
    seekbar.setMax(1000);
    mMaxVerticalSpeed = mFlightController.getMaxVerticalSpeed();
    try {
        seekbar.setProgress((int) ((mMaxVerticalSpeed.current() - mMaxVerticalSpeed.min())
                / (mMaxVerticalSpeed.max() - mMaxVerticalSpeed.min()) * 1000));
    } catch (final Exception e) {
        seekbar.setProgress(0);
    }
    seekbar.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateMaxVerticalSpeed(mMaxVerticalSpeed.current());
    // 
    mMaxRotationSpeedLabel = (TextView) root.findViewById(R.id.max_rotation_speed_textview);
    seekbar = (SeekBar) root.findViewById(R.id.max_rotation_speed_seekbar);
    seekbar.setOnSeekBarChangeListener(null);
    seekbar.setMax(1000);
    mMaxRotationSpeed = mFlightController.getMaxRotationSpeed();
    try {
        seekbar.setProgress((int) ((mMaxRotationSpeed.current() - mMaxRotationSpeed.min())
                / (mMaxRotationSpeed.max() - mMaxRotationSpeed.min()) * 1000));
    } catch (final Exception e) {
        seekbar.setProgress(0);
    }
    seekbar.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateMaxRotationSpeed(mMaxRotationSpeed.current());
}

From source file:com.serenegiant.autoparrot.BaseAutoPilotFragment.java

/**
 * ???//from   ww w  .j a  va 2s  .c  om
 * @param root
 */
private void initConfigAutopilot(final View root) {
    mAutopilotScaleXFormat = getString(R.string.config_scale_x);
    mAutopilotScaleYFormat = getString(R.string.config_scale_y);
    mAutopilotScaleZFormat = getString(R.string.config_scale_z);
    mAutopilotScaleRFormat = getString(R.string.config_scale_r);
    mAutopilotMaxControlValueFormat = getString(R.string.config_control_max);
    // 
    mAutopilotMaxControlValueLabel = (TextView) root.findViewById(R.id.max_control_value_textview);
    SeekBar seekbar = (SeekBar) root.findViewById(R.id.max_control_value_seekbar);
    seekbar.setOnSeekBarChangeListener(null);
    seekbar.setMax(1000);
    mMaxControlValue = mPref.getFloat(KEY_AUTOPILOT_MAX_CONTROL_VALUE, DEFAULT_AUTOPILOT_MAX_CONTROL_VALUE);
    try {
        seekbar.setProgress((int) (mMaxControlValue + SCALE_OFFSET));
    } catch (final Exception e) {
        seekbar.setProgress(SCALE_OFFSET);
    }
    seekbar.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateAutopilotMaxControlValue(mMaxControlValue);
    // X
    mAutopilotScaleXLabel = (TextView) root.findViewById(R.id.scale_x_textview);
    seekbar = (SeekBar) root.findViewById(R.id.scale_seekbar_x);
    seekbar.setOnSeekBarChangeListener(null);
    seekbar.setMax(1000);
    mScaleX = mPref.getFloat(KEY_AUTOPILOT_SCALE_X, DEFAULT_AUTOPILOT_SCALE_X);
    try {
        seekbar.setProgress((int) (mScaleX * SCALE_FACTOR + SCALE_OFFSET));
    } catch (final Exception e) {
        seekbar.setProgress(SCALE_OFFSET);
    }
    seekbar.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateAutopilotScaleX(mScaleX);
    // Y
    mAutopilotScaleYLabel = (TextView) root.findViewById(R.id.scale_y_textview);
    seekbar = (SeekBar) root.findViewById(R.id.scale_seekbar_y);
    seekbar.setOnSeekBarChangeListener(null);
    seekbar.setMax(1000);
    mScaleY = mPref.getFloat(KEY_AUTOPILOT_SCALE_Y, DEFAULT_AUTOPILOT_SCALE_Y);
    try {
        seekbar.setProgress((int) (mScaleY * SCALE_FACTOR + SCALE_OFFSET));
    } catch (final Exception e) {
        seekbar.setProgress(SCALE_OFFSET);
    }
    seekbar.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateAutopilotScaleY(mScaleY);
    // Z
    mAutopilotScaleZLabel = (TextView) root.findViewById(R.id.scale_z_textview);
    seekbar = (SeekBar) root.findViewById(R.id.scale_seekbar_z);
    seekbar.setOnSeekBarChangeListener(null);
    seekbar.setMax(1000);
    mScaleZ = mPref.getFloat(KEY_AUTOPILOT_SCALE_Z, DEFAULT_AUTOPILOT_SCALE_Z);
    try {
        seekbar.setProgress((int) (mScaleZ * SCALE_FACTOR + SCALE_OFFSET));
    } catch (final Exception e) {
        seekbar.setProgress(SCALE_OFFSET);
    }
    seekbar.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateAutopilotScaleZ(mScaleZ);
    // R
    mAutopilotScaleRLabel = (TextView) root.findViewById(R.id.scale_r_textview);
    seekbar = (SeekBar) root.findViewById(R.id.scale_seekbar_r);
    seekbar.setOnSeekBarChangeListener(null);
    seekbar.setMax(1000);
    mScaleR = mPref.getFloat(KEY_AUTOPILOT_SCALE_R, DEFAULT_AUTOPILOT_SCALE_R);
    try {
        seekbar.setProgress((int) (mScaleR * SCALE_FACTOR + SCALE_OFFSET));
    } catch (final Exception e) {
        seekbar.setProgress(SCALE_OFFSET);
    }
    seekbar.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateAutopilotScaleR(mScaleR);
}

From source file:jp.co.rediscovery.firstflight.BaseAutoPilotFragment.java

private void initAutoTrace(final View rootView) {
    SeekBar sb;
    ////from  w  ww.  j  a v a2  s.co m
    mTraceDirectionalReverseBiasFormat = getString(R.string.trace_config_trace_reverse_bias);
    mTraceMovingAveTapFormat = getString(R.string.trace_config_moving_ave_tap);
    mTraceDecayRateFormat = getString(R.string.trace_config_decay_rate);
    mTraceSensitivityFormat = getString(R.string.trace_config_trace_sensitivity);
    // ??
    mTraceDirectionalReverseBias = mPref.getFloat(KEY_TRACE_DIR_REVERSE_BIAS, DEFAULT_TRACE_DIR_REVERSE_BIAS);
    mTraceDirectionalReverseBiasLabel = (TextView) rootView
            .findViewById(R.id.trace_flight_reverse_bias_textview);
    sb = (SeekBar) rootView.findViewById(R.id.trace_flight_reverse_bias_seekbar);
    sb.setMax(200);
    sb.setProgress((int) (mTraceDirectionalReverseBias * 100)); // [0.0f, 2.0f] => [0, 200]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateTraceDirectionalReverseBias(mTraceDirectionalReverseBias);
    // ?
    mTraceMovingAveTap = mPref.getInt(KEY_TRACE_MOVING_AVE_TAP, DEFAULT_TRACE_MOVING_AVE_TAP);
    mTraceMovingAveTapLabel = (TextView) rootView.findViewById(R.id.trace_flight_moving_ave_tap_textview);
    sb = (SeekBar) rootView.findViewById(R.id.trace_flight_moving_ave_tap_seekbar);
    sb.setMax(19);
    sb.setProgress(mTraceMovingAveTap - 1); // [1, 20] => [0, 19]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateTraceMovingAveTap(mTraceMovingAveTap);
    // 
    mTraceDecayRate = mPref.getFloat(KEY_TRACE_DECAY_RATE, DEFAULT_TRACE_DECAY_RATE);
    mTraceDecayRateLabel = (TextView) rootView.findViewById(R.id.trace_flight_decay_rate_textview);
    sb = (SeekBar) rootView.findViewById(R.id.trace_flight_decay_rate_seekbar);
    sb.setMax(1000);
    sb.setProgress((int) (mTraceDecayRate * 1000.0f)); // [0.000f, 1.000f] => [0, 1000]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateTraceDecayRate(mTraceDecayRate);
    // 
    mTraceSensitivity = mPref.getFloat(KEY_TRACE_SENSITIVITY, DEFAULT_TRACE_SENSITIVITY);
    mTraceSensitivityLabel = (TextView) rootView.findViewById(R.id.trace_flight_sensitivity_textview);
    sb = (SeekBar) rootView.findViewById(R.id.trace_flight_sensitivity_seekbar);
    sb.setMax(100);
    sb.setProgress((int) (mTraceSensitivity)); // [0f, 100f] => [0, 100]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateTraceSensitivity(mTraceSensitivity);
}

From source file:com.serenegiant.autoparrot.BaseAutoPilotFragment.java

private void initAutoTrace2(final View rootView) {
    SeekBar sb;
    Switch sw;//from   w ww .  ja  va 2  s . c om
    //
    mTraceAttitudeYawFormat = getString(R.string.trace_config_trace_attitude_yaw);
    mTraceSpeedFormat = getString(R.string.trace_config_trace_speed);
    mTraceAltitudeFormat = getString(R.string.trace_config_trace_altitude);
    // (yaw)
    mTraceAttitudeYaw = mPref.getFloat(KEY_TRACE_ATTITUDE_YAW, DEFAULT_TRACE_ATTITUDE_YAW);
    mTraceAttitudeYawLabel = (TextView) rootView.findViewById(R.id.trace_flight_attitude_yaw_textview);
    sb = (SeekBar) rootView.findViewById(R.id.trace_flight_attitude_yaw_seekbar);
    sb.setMax(180);
    sb.setProgress((int) (mTraceAttitudeYaw + 90)); // [-90,+90] => [0, 180]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateTraceAttitudeYaw(mTraceAttitudeYaw);
    // 
    mTraceSpeed = mPref.getFloat(KEY_TRACE_SPEED, DEFAULT_TRACE_SPEED);
    mTraceSpeedLabel = (TextView) rootView.findViewById(R.id.trace_flight_speed_textview);
    sb = (SeekBar) rootView.findViewById(R.id.trace_flight_speed_seekbar);
    sb.setMax(200);
    sb.setProgress((int) (mTraceSpeed + 100)); // [-100,+100] => [0, 200]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateTraceSpeed(mTraceSpeed);
    // 
    mTraceAltitudeEnabled = mPref.getBoolean(KEY_TRACE_ALTITUDE_ENABLED, DEFAULT_TRACE_ALTITUDE_ENABLED);
    sw = (Switch) rootView.findViewById(R.id.trace_flight_altitude_enable_switch);
    sw.setChecked(mTraceAltitudeEnabled);
    sw.setOnCheckedChangeListener(mOnCheckedChangeListener);
    // 
    mTraceAltitude = Math.min(mPref.getFloat(KEY_TRACE_ALTITUDE, DEFAULT_TRACE_ALTITUDE),
            mFlightController.getMaxAltitude().current());
    mTraceAltitudeLabel = (TextView) rootView.findViewById(R.id.trace_flight_altitude_textview);
    sb = (SeekBar) rootView.findViewById(R.id.trace_flight_altitude_seekbar);
    sb.setMax(45);
    sb.setProgress((int) ((mTraceAltitude - 0.5f) * 10.0f)); // [0.5,+5.0] => [0, 45]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateTraceAltitude(mTraceAltitude);
}

From source file:com.serenegiant.autoparrot.BaseAutoPilotFragment.java

private void initDetect(final View rootView) {
    Button btn;// ww w  .  j a va  2s.c  o  m
    SeekBar sb;

    mAreaLimitMinFormat = getString(R.string.trace_config_detect_area_limit_min);
    mAspectLimitMinFormat = getString(R.string.trace_config_detect_aspect_limit_min);
    mAreaErrLimit1Format = getString(R.string.trace_config_detect_area_err_limit1);
    mAreaErrLimit2Format = getString(R.string.trace_config_detect_area_err_limit2);

    // ????
    mAreaLimitMin = mPref.getFloat(KEY_AREA_LIMIT_MIN, DEFAULT_AREA_LIMIT_MIN);
    mAreaLimitMinLabel = (TextView) rootView.findViewById(R.id.area_limit_min_textview);
    sb = (SeekBar) rootView.findViewById(R.id.area_limit_min_seekbar);
    sb.setMax(9500);
    sb.setProgress(areaLimitMinToProgress(mAreaLimitMin - 500)); // [0,10000] => [0, 10000]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateAreaLimitMin(mAreaLimitMin);
    // ???1
    mAreaErrLimit1 = mPref.getFloat(KEY_AREA_ERR_LIMIT1, DEFAULT_AREA_ERR_LIMIT1);
    mAreaErrLimit1Label = (TextView) rootView.findViewById(R.id.area_err_limit1_textview);
    sb = (SeekBar) rootView.findViewById(R.id.area_err_limit1_seekbar);
    sb.setMax(100);
    sb.setProgress((int) ((mAreaErrLimit1 - 1.0f) * 100.0f)); // [1,2] => [0, 100]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateAreaErrLimit1(mAreaErrLimit1);
    // ???2
    mAreaErrLimit2 = mPref.getFloat(KEY_AREA_ERR_LIMIT2, DEFAULT_AREA_ERR_LIMIT2);
    mAreaErrLimit2Label = (TextView) rootView.findViewById(R.id.area_err_limit2_textview);
    sb = (SeekBar) rootView.findViewById(R.id.area_err_limit2_seekbar);
    sb.setMax(100);
    sb.setProgress((int) ((mAreaErrLimit2 - 1.0f) * 100.0f)); // [1,2] => [0, 100]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateAreaErrLimit2(mAreaErrLimit2);
    // ??
    mAspectLimitMin = mPref.getFloat(KEY_ASPECT_LIMIT_MIN, DEFAULT_ASPECT_LIMIT_MIN);
    mAspectLimitMinLabel = (TextView) rootView.findViewById(R.id.aspect_limit_min_textview);
    sb = (SeekBar) rootView.findViewById(R.id.aspect_limit_min_seekbar);
    sb.setMax(190);
    sb.setProgress((int) ((mAspectLimitMin - 1.0f) * 10)); // [1,20] => [0, 190]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateAspectLimitMin(mAspectLimitMin);
}

From source file:com.serenegiant.autoparrot.BaseAutoPilotFragment.java

private void initPreprocess(final View rootView) {
    mExposureFormat = getString(R.string.trace_use_exposure);
    mSaturationFormat = getString(R.string.trace_use_saturation);
    mBrightnessFormat = getString(R.string.trace_use_brightness);
    //      mPosterizeFormat = getString(R.string.trace_use_posterize);
    mBinarizeThresholdFormat = getString(R.string.trace_binarize_threshold);
    mTrapeziumRateFormat = getString(R.string.trace_trapezium_rate);

    Switch sw;/*  w  ww  . j  a  v a 2s. c  o m*/
    SeekBar sb;
    Button btn;
    //      // ?
    //      mAutoWhiteBlance = mPref.getBoolean(KEY_AUTO_WHITE_BLANCE, true);
    //      mAutoWhiteBlanceSw = (Switch)rootView.findViewById(R.id.white_balance_sw);
    //      mAutoWhiteBlanceSw.setChecked(mAutoWhiteBlance);
    //      mAutoWhiteBlanceSw.setOnCheckedChangeListener(mOnCheckedChangeListener);
    // 
    mExposure = mPref.getFloat(KEY_EXPOSURE, DEFAULT_EXPOSURE);
    mExposureLabel = (TextView) rootView.findViewById(R.id.exposure_textview);
    sb = (SeekBar) rootView.findViewById(R.id.exposure_seekbar);
    sb.setMax(6000);
    sb.setProgress(exposureToProgress(mExposure)); // [-3,+ 3] => [0, 6000]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateExposure(mExposure);
    // 
    mSaturation = mPref.getFloat(KEY_SATURATION, DEFAULT_SATURATION);
    mSaturationLabel = (TextView) rootView.findViewById(R.id.saturation_textview);
    sb = (SeekBar) rootView.findViewById(R.id.saturation_seekbar);
    sb.setMax(200);
    sb.setProgress((int) (mSaturation * 100.0f) + 100); // [-1.0f, +1.0f] => [0, 200]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateSaturation(mSaturation);
    // ?
    mBrightness = mPref.getFloat(KEY_BRIGHTNESS, DEFAULT_BRIGHTNESS);
    mBrightnessLabel = (TextView) rootView.findViewById(R.id.brightness_textview);
    sb = (SeekBar) rootView.findViewById(R.id.brightness_seekbar);
    sb.setMax(200);
    sb.setProgress((int) (mBrightness * 100.0f) + 100); // [-1.0f, +1.0f] => [0, 200]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateBrightness(mBrightness);
    //      // ?
    //      mPosterize = mPref.getFloat(KEY_POSTERIZE, DEFAULT_POSTERIZE);
    //      mPosterizeLabel = (TextView)rootView.findViewById(R.id.posterize_textview);
    //      sb = (SeekBar)rootView.findViewById(R.id.posterize_seekbar);
    //      sb.setMax(255);
    //      sb.setProgress((int)(mPosterize - 1));   // [1, 256] => [0, 255]
    //      sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    //      mEnablePosterize = mPref.getBoolean(KEY_ENABLE_POSTERIZE, false);
    //      sw = (Switch)rootView.findViewById(R.id.use_posterize_sw);
    //      sw.setChecked(mEnablePosterize);
    //      sw.setOnCheckedChangeListener(mOnCheckedChangeListener);
    //      updatePosterize(mPosterize);
    // 
    mBinarizeThreshold = mPref.getFloat(KEY_BINARIZE_THRESHOLD, DEFAULT_BINARIZE_THRESHOLD);
    mBinarizeThresholdLabel = (TextView) rootView.findViewById(R.id.binarize_threshold_textview);
    sb = (SeekBar) rootView.findViewById(R.id.binarize_threshold_seekbar);
    sb.setMax(100);
    sb.setProgress((int) (mBinarizeThreshold * 100.0f)); // [0.0f, +1.0f] => [0, 100]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateBinarizeThreshold(mBinarizeThreshold);
    // ?
    mTrapeziumRate = (float) Double.parseDouble(mPref.getString(KEY_TRAPEZIUM_RATE, "0.0"));
    if (Math.abs(mTrapeziumRate) < 0.01f)
        mTrapeziumRate = 0.0f;
    mTrapeziumRateLabel = (TextView) rootView.findViewById(R.id.trapezium_rate_textview);
    sb = (SeekBar) rootView.findViewById(R.id.trapezium_rate_seekbar);
    sb.setMax(4000);
    sb.setProgress(trapeziumRateToProgress(mTrapeziumRate)); // [-2.0f, +2.0f] => [0, 4000]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateTrapeziumRate(mTrapeziumRate);
}

From source file:com.serenegiant.autoparrot.BaseAutoPilotFragment.java

private void initCamera(final View rootView) {
    mCameraExposureFormat = getString(R.string.trace_camera_exposure);
    mCameraSaturationFormat = getString(R.string.trace_camera_saturation);
    mCameraPanFormat = getString(R.string.trace_camera_pan);
    mCameraTiltFormat = getString(R.string.trace_camera_tilt);

    SeekBar sb;
    // ?//from w w w  .  j  av  a2  s. c o  m
    mCameraAutoWhiteBlance = getInt(mPref, KEY_CAMERA_WHITE_BLANCE, DEFAULT_CAMERA_WHITE_BLANCE);
    final Spinner spinner = (Spinner) rootView.findViewById(R.id.camera_white_blance_spinner);
    spinner.setAdapter(new WhiteBlanceAdapter(getActivity()));
    spinner.setSelection(mCameraAutoWhiteBlance + 1);
    spinner.setOnItemSelectedListener(mOnItemSelectedListener);
    // 
    mCameraExposure = mPref.getFloat(KEY_CAMERA_EXPOSURE, DEFAULT_CAMERA_EXPOSURE);
    mCameraExposureLabel = (TextView) rootView.findViewById(R.id.camera_exposure_textview);
    sb = (SeekBar) rootView.findViewById(R.id.camera_exposure_seekbar);
    sb.setMax(3000);
    sb.setProgress(cameraExposureToProgress(mCameraExposure)); // [-1.5,+ 1.5] => [0, 3000]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateCameraExposure(mCameraExposure);
    // 
    mCameraSaturation = mPref.getFloat(KEY_CAMERA_SATURATION, DEFAULT_CAMERA_SATURATION);
    mCameraSaturationLabel = (TextView) rootView.findViewById(R.id.camera_saturation_textview);
    sb = (SeekBar) rootView.findViewById(R.id.camera_saturation_seekbar);
    sb.setMax(2000);
    sb.setProgress((int) (mCameraSaturation * 10.0f) + 1000); // [-100.0f, +100.0f] => [0, 2000]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateCameraSaturation(mCameraSaturation);
    // 
    mCameraPan = getInt(mPref, KEY_CAMERA_PAN, DEFAULT_CAMERA_PAN);
    mCameraPanLabel = (TextView) rootView.findViewById(R.id.camera_pan_textview);
    sb = (SeekBar) rootView.findViewById(R.id.camera_pan_seekbar);
    sb.setMax(40);
    sb.setProgress(cameraPanTiltToProgress(mCameraPan)); // [-100,+100] => [0, 40]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateCameraPan(mCameraPan);
    // ?
    mCameraTilt = getInt(mPref, KEY_CAMERA_TILT, DEFAULT_CAMERA_TILT);
    mCameraTiltLabel = (TextView) rootView.findViewById(R.id.camera_tilt_textview);
    sb = (SeekBar) rootView.findViewById(R.id.camera_tilt_seekbar);
    sb.setMax(40);
    sb.setProgress(cameraPanTiltToProgress(mCameraTilt)); // [-100,+100] => [0, 40]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateCameraTilt(mCameraTilt);
}

From source file:com.example.android.lightcontrol.MainActivity.java

private void setupChat() {
    Log.d(TAG, "setupChat()");

    seekBar = (SeekBar) findViewById(R.id.seekBar1);
    seekBar.setMax(Max_Value);
    textView_progress = (TextView) findViewById(R.id.textView1);
    textView_progress.setText(seekBar.getProgress() + "%");
    seekBar.setProgress(0);//from   w  w  w  . j a va2  s . c  om
    seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progresValue, boolean fromUser) { // progress = progresValue; }
            textView_progress.setText(String.valueOf(progress1) + "%");
            if (seekBar.getProgress() == Min_Value) {
                progress1 = Min_Value;
                progrss_change_1();
            } else if (progress1 <= Max_Value) {
                progress1 = seekBar.getProgress();
                progrss_change_1();
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
            textView_progress.setText(String.valueOf(progress1) + "%");

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {

            textView_progress.setText(String.valueOf(progress1) + "%");
        }
    });

    mConversationArrayAdapter = new ArrayAdapter<String>(this, R.layout.message);
    ListView mConversationViewnew = (ListView) findViewById(R.id.Query_log);
    mConversationViewnew.setAdapter(mConversationArrayAdapter);

    Button light_off = (Button) findViewById(R.id.light_off);
    Button light_on = (Button) findViewById(R.id.light_on);
    // Button light_query = (Button) findViewById(R.id.light_query);
    Button send_free = (Button) findViewById(R.id.sendfreetyping);
    final EditText free_typing = (EditText) findViewById(R.id.freetyping);
    Switch ON_OFF = (Switch) findViewById(R.id.switch1);

    ON_OFF.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // TODO Auto-generated method stub
            if (isChecked) {
                light_on();
            } else {
                light_off();
            }
        }
    });

    send_free.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            if (mChatService.getState() != BluetoothChatService.STATE_CONNECTED) {
                Toast.makeText(MainActivity.this, R.string.not_connected, Toast.LENGTH_SHORT).show();
                return;
            }

            mConversationArrayAdapter.clear();

            String free = free_typing.getText().toString();
            sendMessage(free);
            try {
                Thread.sleep(300);
            } catch (InterruptedException ignored) {
            }
            //freetyping.setText("");

        }
    });
    light_on.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            light_on();
        }
    });
    light_off.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            light_off();
        }
    });

    /*        light_query.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
        if (mChatService.getState() != BluetoothChatService.STATE_CONNECTED) {
            Toast.makeText(MainActivity.this, R.string.not_connected,
                    Toast.LENGTH_SHORT).show();
            return;
        }
        //new Query_Short().execute();
        new query_is_zigbee_exist_or_not_Async().execute();
    }
            });*/

}

From source file:com.serenegiant.autoparrot.BaseAutoPilotFragment.java

private void initAutoTrace(final View rootView) {
    SeekBar sb;
    Switch sw;//ww w .  j a v a 2s.c om
    //
    mTraceDirectionalReverseBiasFormat = getString(R.string.trace_config_trace_reverse_bias);
    mTraceMovingAveTapFormat = getString(R.string.trace_config_moving_ave_tap);
    mTraceDecayRateFormat = getString(R.string.trace_config_decay_rate);
    mTraceSensitivityFormat = getString(R.string.trace_config_trace_sensitivity);
    // ??
    mTraceDirectionalReverseBias = mPref.getFloat(KEY_TRACE_DIR_REVERSE_BIAS, DEFAULT_TRACE_DIR_REVERSE_BIAS);
    mTraceDirectionalReverseBiasLabel = (TextView) rootView
            .findViewById(R.id.trace_flight_reverse_bias_textview);
    sb = (SeekBar) rootView.findViewById(R.id.trace_flight_reverse_bias_seekbar);
    sb.setMax(200);
    sb.setProgress((int) (mTraceDirectionalReverseBias * 100)); // [0.0f, 2.0f] => [0, 200]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateTraceDirectionalReverseBias(mTraceDirectionalReverseBias);
    // ?
    mTraceMovingAveTap = mPref.getInt(KEY_TRACE_MOVING_AVE_TAP, DEFAULT_TRACE_MOVING_AVE_TAP);
    mTraceMovingAveTapLabel = (TextView) rootView.findViewById(R.id.trace_flight_moving_ave_tap_textview);
    sb = (SeekBar) rootView.findViewById(R.id.trace_flight_moving_ave_tap_seekbar);
    sb.setMax(19);
    sb.setProgress(mTraceMovingAveTap - 1); // [1, 20] => [0, 19]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateTraceMovingAveTap(mTraceMovingAveTap);
    // 
    mTraceDecayRate = mPref.getFloat(KEY_TRACE_DECAY_RATE, DEFAULT_TRACE_DECAY_RATE);
    mTraceDecayRateLabel = (TextView) rootView.findViewById(R.id.trace_flight_decay_rate_textview);
    sb = (SeekBar) rootView.findViewById(R.id.trace_flight_decay_rate_seekbar);
    sb.setMax(1000);
    sb.setProgress((int) (mTraceDecayRate * 1000.0f)); // [0.000f, 1.000f] => [0, 1000]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateTraceDecayRate(mTraceDecayRate);
    // 
    mTraceSensitivity = mPref.getFloat(KEY_TRACE_SENSITIVITY, DEFAULT_TRACE_SENSITIVITY);
    mTraceSensitivityLabel = (TextView) rootView.findViewById(R.id.trace_flight_sensitivity_textview);
    sb = (SeekBar) rootView.findViewById(R.id.trace_flight_sensitivity_seekbar);
    sb.setMax(100);
    sb.setProgress((int) (mTraceSensitivity)); // [0f, 100f] => [0, 100]
    sb.setOnSeekBarChangeListener(mOnSeekBarChangeListener);
    updateTraceSensitivity(mTraceSensitivity);
}