Java Code Examples for android.widget.SeekBar#getId()

The following examples show how to use android.widget.SeekBar#getId() . 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: TMSLayerSettingsActivity.java    From android_maplibui with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    int id = seekBar.getId();
    if (id == R.id.alphaSeekBar) {
        if (fromUser)
            mAlpha = progress;

        mAlphaLabel.setText(ControlHelper.getPercentValue(getContext(), R.string.alpha, mAlpha));
    } else if (id == R.id.brightnessSeekBar) {
        if (fromUser)
            mBrightness = progress - 255;

        mBrightnessLabel.setText((ControlHelper.getPercentValue(getContext(), R.string.brightness, mBrightness)));
    } else if (id == R.id.contrastSeekBar) {
        if (fromUser)
            mContrast = (float) progress / 10;

        mContrastLabel.setText(String.format(getString(R.string.contrast), mContrast));
    }
}
 
Example 2
Source File: EqualizerFragment.java    From android-openslmediaplayer with Apache License 2.0 6 votes vote down vote up
private static short seekBarToBandNo(SeekBar seekBar) {
    switch (seekBar.getId()) {
        case R.id.seekbar_equalizer_band_0:
            return 0;
        case R.id.seekbar_equalizer_band_1:
            return 1;
        case R.id.seekbar_equalizer_band_2:
            return 2;
        case R.id.seekbar_equalizer_band_3:
            return 3;
        case R.id.seekbar_equalizer_band_4:
            return 4;
        case R.id.seekbar_equalizer_band_5:
            return 5;
        default:
            throw new IllegalArgumentException();
    }
}
 
Example 3
Source File: CustomizeFragment.java    From ListBuddies with Apache License 2.0 6 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    switch (seekBar.getId()) {
        case R.id.seekBarGap:
            mGapSeekBarProgress = progress;
            seekBarGapValue.setText(String.valueOf(progress));
            mOnCustomizeListener.setGap(progress);
            break;
        case R.id.seekBarSpeed:
            mSpeedSeekBarProgress = progress;
            seekBarSpeedValue.setText(String.valueOf(progress));
            mOnCustomizeListener.setSpeed(progress);
            break;
        case R.id.seekBarDivHeight:
            mDivHeightSeekBarProgress = progress;
            seekBarDivHeightValue.setText(String.valueOf(progress));
            mOnCustomizeListener.setDividerHeight(progress);
            break;
    }
}
 
Example 4
Source File: HQEqualizerFragment.java    From android-openslmediaplayer with Apache License 2.0 6 votes vote down vote up
private static short seekBarToBandNo(SeekBar seekBar) {
    switch (seekBar.getId()) {
        case R.id.seekbar_equalizer_band_0:
            return 0;
        case R.id.seekbar_equalizer_band_1:
            return 1;
        case R.id.seekbar_equalizer_band_2:
            return 2;
        case R.id.seekbar_equalizer_band_3:
            return 3;
        case R.id.seekbar_equalizer_band_4:
            return 4;
        case R.id.seekbar_equalizer_band_5:
            return 5;
        case R.id.seekbar_equalizer_band_6:
            return 6;
        case R.id.seekbar_equalizer_band_7:
            return 7;
        case R.id.seekbar_equalizer_band_8:
            return 8;
        case R.id.seekbar_equalizer_band_9:
            return 9;
        default:
            throw new IllegalArgumentException();
    }
}
 
Example 5
Source File: EqualizerVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (!fromUser) return;
    if (isVirtualizerSupported() && seekBar.getId() == R.id.virtualizer) {
        virtualizer.setStrength((short) progress);
        LOGI(virtualizer.getClass().getSimpleName(), "setStrength(" + progress + ')');
    } else if (isBassBostSupported() && seekBar.getId() == R.id.bass_boost) {
        bassBoost.setStrength((short) progress);
        LOGI(bassBoost.getClass().getSimpleName(), "setStrength(" + progress + ')');
    } else if (null != equalizer) {
        Object tag = seekBar.getTag();
        if (tag instanceof Short) {
            short band = (Short) tag;
            equalizer.setBandLevel(band, (short) (progress + range[0]));
            LOGI(equalizer.getClass().getSimpleName(), "setBandLevel(" + (progress + range[0]) + ')');
        }
    }
    onUserInteraction();
}
 
Example 6
Source File: EqualizerVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (!fromUser) return;
    if (isVirtualizerSupported() && seekBar.getId() == R.id.virtualizer) {
        virtualizer.setStrength((short) progress);
        LOGI(virtualizer.getClass().getSimpleName(), "setStrength(" + progress + ')');
    } else if (isBassBostSupported() && seekBar.getId() == R.id.bass_boost) {
        bassBoost.setStrength((short) progress);
        LOGI(bassBoost.getClass().getSimpleName(), "setStrength(" + progress + ')');
    } else if (null != equalizer) {
        Object tag = seekBar.getTag();
        if (tag instanceof Short) {
            short band = (Short) tag;
            equalizer.setBandLevel(band, (short) (progress + range[0]));
            LOGI(equalizer.getClass().getSimpleName(), "setBandLevel(" + (progress + range[0]) + ')');
        }
    }
    onUserInteraction();
}
 
Example 7
Source File: MovingTesterFragment.java    From DexMovingImageView with Apache License 2.0 6 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    switch (seekBar.getId()) {
        case R.id.zoom_seek_bar:
            dexMovingImageView.setZoom((float) progress / 100);
            break;
        case R.id.angle_seek_bar:
            dexMovingImageView.setAngle(progress);
            break;
        case R.id.speed_seek_bar:
            if (progress != 0)
                dexMovingImageView.setSpeed(progress);
            else
                dexMovingImageView.setSpeed(1);
            break;
    }
}
 
Example 8
Source File: VideoMixActivity.java    From PLDroidShortVideo with Apache License 2.0 6 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (!isVideoReady()) {
        return;
    }
    float volume = 1f * progress / 100;
    switch (seekBar.getId()) {
        case R.id.seekBar1:
            mVideoMixItem1.setVolume(volume);
            mPlayer1.setVolume(volume, volume);
            break;
        case R.id.seekBar2:
            mVideoMixItem2.setVolume(volume);
            mPlayer2.setVolume(volume, volume);
            break;
    }
}
 
Example 9
Source File: RotatePopUpWindow.java    From ViewPagerLayoutManager with Apache License 2.0 6 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    switch (seekBar.getId()) {
        case R.id.sb_item_space:
            int itemSpace = progress * 2;
            rotateLayoutManager.setItemSpace(itemSpace);
            itemSpaceValue.setText(String.valueOf(itemSpace));
            break;
        case R.id.sb_angle:
            final float angle = progress / 100f * 360;
            rotateLayoutManager.setAngle(angle);
            angleValue.setText(Util.formatFloat(angle));
            break;
        case R.id.sb_speed:
            final float speed = progress * 0.05f;
            rotateLayoutManager.setMoveSpeed(speed);
            speedValue.setText(Util.formatFloat(speed));
            break;
    }
}
 
Example 10
Source File: PreAmpPreferenceDialog.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (fromUser) {
        if (seekBar.getId() == R.id.seekbar_with_rg) {
            withRgValue = progress * 0.2f - 15.0f;
            updateLabelWithRg();
        } else if (seekBar.getId() == R.id.seekbar_without_rg) {
            withoutRgValue = progress * 0.2f - 15.0f;
            updateLabelWitouthRg();
        }
    }
}
 
Example 11
Source File: DrawableRatingBarActivity.java    From DrawableRatingBar with Apache License 2.0 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    switch (seekBar.getId()) {
        case R.id.drb_sb_max:
            dbrDemo.setMax(6 + progress);
            break;
        case R.id.drb_sb_min:
            dbrDemo.setMin(progress);
            break;
    }
}
 
Example 12
Source File: ReadActivity.java    From BookReader with Apache License 2.0 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (seekBar.getId() == seekbarFontSize.getId() && fromUser) {
        calcFontSize(progress);
    } else if (seekBar.getId() == seekbarLightness.getId() && fromUser
            && !SettingManager.getInstance().isAutoBrightness()) { // 非自动调节模式下 才可调整屏幕亮度
        ScreenUtils.saveScreenBrightnessInt100(progress, ReadActivity.this);
        //SettingManager.getInstance().saveReadBrightness(progress);
    }
}
 
Example 13
Source File: InCallMediaControl.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar arg0, int value, boolean arg2) {
	Log.d(THIS_FILE, "Progress has changed");
	if(sipService != null) {
		try {
			float newValue = progressUnitToValue( value );
			String key;
			boolean useBT = sipService.getCurrentMediaState().isBluetoothScoOn;
			int sId = arg0.getId();
			if (sId == R.id.speaker_level) {
				sipService.confAdjustTxLevel(0, newValue);
				key =  useBT ? SipConfigManager.SND_BT_SPEAKER_LEVEL : SipConfigManager.SND_SPEAKER_LEVEL;
				SipConfigManager.setPreferenceFloatValue(this, key, newValue);
			} else if (sId == R.id.micro_level) {
				sipService.confAdjustRxLevel(0, newValue);
				key =  useBT ? SipConfigManager.SND_BT_MIC_LEVEL : SipConfigManager.SND_MIC_LEVEL;
				SipConfigManager.setPreferenceFloatValue(this, key, newValue);
			}
		} catch (RemoteException e) {
			Log.e(THIS_FILE, "Impossible to set mic/speaker level", e);
		}
		
	}else {
		//TODO : revert changes here !
	}
	
	//Update quit timer
	if(isAutoClose) {
		delayedQuit(AUTO_QUIT_DELAY);
	}
}
 
Example 14
Source File: ReadActivity.java    From fangzhuishushenqi with Apache License 2.0 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    if (seekBar.getId() == seekbarFontSize.getId() && fromUser) {
        calcFontSize(progress);
    } else if (seekBar.getId() == seekbarLightness.getId() && fromUser
            && !SettingManager.getInstance().isAutoBrightness()) { // 非自动调节模式下 才可调整屏幕亮度
        ScreenUtils.setScreenBrightness(progress, ReadActivity.this);
        SettingManager.getInstance().saveReadBrightness(progress);
    }
}
 
Example 15
Source File: PlayerControlFragment.java    From android-openslmediaplayer with Apache License 2.0 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    switch (seekBar.getId()) {
        case R.id.seekbar_player_position:
            if (fromUser) {
                float position = (float) progress / POSITION_SEEKBAR_MAX;
                postAppEvent(
                        PlayerControlReqEvents.PLAYER_SEEK_TO,
                        0, position);
            }
            break;
        case R.id.seekbar_player_left_volume:
            if (fromUser) {
                postAppEvent(
                        PlayerControlReqEvents.PLAYER_SET_VOLUME_LEFT,
                        0, (float) progress / VOLUME_SEEKBAR_MAX);
            }
            break;
        case R.id.seekbar_player_right_volume:
            if (fromUser) {
                postAppEvent(
                        PlayerControlReqEvents.PLAYER_SET_VOLUME_RIGHT,
                        0, (float) progress / VOLUME_SEEKBAR_MAX);
            }
            break;
        case R.id.seekbar_player_aux_effect_send_level:
            if (fromUser) {
                postAppEvent(
                        PlayerControlReqEvents.PLAYER_SET_AUX_SEND_LEVEL,
                        0, (float) progress / VOLUME_SEEKBAR_MAX);
            }
            break;
    }
}
 
Example 16
Source File: WrapLayoutActivity.java    From ProjectX with Apache License 2.0 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    switch (seekBar.getId()) {
        case R.id.wl_sb_horizontal:
            mVContent.setHorizontalSpacing(
                    (int) (progress * getResources().getDisplayMetrics().density));
            break;
        case R.id.wl_sb_vertical:
            mVContent.setVerticalSpacing(
                    (int) (progress * getResources().getDisplayMetrics().density));
            break;
    }
}
 
Example 17
Source File: PropertiesBSFragment.java    From PhotoEditor with MIT License 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
    switch (seekBar.getId()) {
        case R.id.sbOpacity:
            if (mProperties != null) {
                mProperties.onOpacityChanged(i);
            }
            break;
        case R.id.sbSize:
            if (mProperties != null) {
                mProperties.onBrushSizeChanged(i);
            }
            break;
    }
}
 
Example 18
Source File: SettingsActivity.java    From abnd-track-pomodoro-timer-app with MIT License 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    switch (seekBar.getId()) {
        case R.id.ticking_seek_bar:
            preferences.edit().putInt(TICKING_VOLUME_LEVEL_KEY, progress).apply(); //Save volume level to SharedPreferences
            floatTickingVolumeLevel = convertToFloat(preferences.getInt(TICKING_VOLUME_LEVEL_KEY, maxVolume), maxVolume);
            break;
        case R.id.ringing_seek_bar:
            preferences.edit().putInt(RINGING_VOLUME_LEVEL_KEY, progress).apply(); //Save value to SharedPreferences
            floatRingingVolumeLevel = convertToFloat(preferences.getInt(RINGING_VOLUME_LEVEL_KEY, maxVolume), maxVolume);
    }

}
 
Example 19
Source File: XYPositionDemoFragment.java    From android-materialshadowninepatch with Apache License 2.0 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    switch (seekBar.getId()) {
        case R.id.seekbar_translation_z:
            if (fromUser) {
                setItemsTranslationZ(progressToTranslationZAmount(progress));
            }
            break;
    }
}
 
Example 20
Source File: CircleProgressBarActivity.java    From CircleProgressBar with Apache License 2.0 4 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    switch (seekBar.getId()) {
        case R.id.cpb_sb_radius:
            cpbDemo.setRadius(density * (progress + 100));
            break;
        case R.id.cpb_sb_start_angle:
            cpbDemo.setStartAngle(progress);
            break;
        case R.id.cpb_sb_sweep_angle:
            cpbDemo.setSweepAngle(progress);
            break;
        case R.id.cpb_sb_background_size:
            cpbDemo.setBackgroundSize(density * progress);
            break;
        case R.id.cpb_sb_progress_size:
            cpbDemo.setProgressSize(density * progress);
            break;
        case R.id.cpb_sb_progress:
            cpbDemo.animationToProgress(progress);
            break;
        case R.id.cpb_sb_dial_gap:
            cpbDemo.setDialGap(density * progress);
            break;
        case R.id.cpb_sb_dial_angle:
            cpbDemo.setDialAngle(progress);
            break;
        case R.id.cpb_sb_dial_height:
            cpbDemo.setDialHeight(density * progress);
            break;
        case R.id.cpb_sb_dial_width:
            cpbDemo.setDialWidth(density * progress);
            break;
        case R.id.cpb_sb_dial_special_unit:
            cpbDemo.setDialSpecialUnit(progress);
            break;
        case R.id.cpb_sb_dial_special_height:
            cpbDemo.setDialSpecialHeight(density * progress);
            break;
        case R.id.cpb_sb_dial_special_width:
            cpbDemo.setDialSpecialWidth(density * progress);
            break;
        case R.id.cpb_sb_special_dial_value_gap:
            cpbDemo.setSpecialDialValueGap(density * progress);
            break;
        case R.id.cpb_sb_special_dial_value_text_size:
            cpbDemo.setSpecialDialValueTextSize(density * (progress + 5));
            break;
        case R.id.cpb_sb_progress_value_text_size:
            cpbDemo.setProgressValueTextSize(density * (progress + 50));
            break;
        case R.id.cpb_sb_top_text_gap:
            cpbDemo.setTopTextGap(density * progress);
            break;
        case R.id.cpb_sb_top_text_size:
            cpbDemo.setTopTextSize(density * (progress + 10));
            break;
        case R.id.cpb_sb_bottom_text_gap:
            cpbDemo.setBottomTextGap(density * progress);
            break;
        case R.id.cpb_sb_bottom_text_size:
            cpbDemo.setBottomTextSize(density * (progress + 10));
            break;
        case R.id.cpb_sb_progress_duration:
            cpbDemo.setProgressDuration(100 * (progress + 1));
            break;
        case R.id.cpb_sb_loading_start_angle:
            cpbDemo.setLoadingStartAngle(progress);
            break;
        case R.id.cpb_sb_loading_sweep_angle:
            cpbDemo.setLoadingSweepAngle(progress);
            break;
        case R.id.cpb_sb_loading_duration:
            cpbDemo.setLoadingDuration(100 * (progress + 1));
            break;
    }

}