use of android.widget.SeekBar in project android_frameworks_base by DirtyUnicorns.
the class PointsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setBackgroundDrawable(new ColorDrawable(0xff000000));
SeekBar slider = new SeekBar(this);
LinearLayout container = new LinearLayout(this);
container.setOrientation(LinearLayout.VERTICAL);
setContentView(container);
container.addView(slider);
slider.setMax(100);
slider.setProgress(50);
FrameLayout frame = new FrameLayout(this);
final RenderingView gpuView = new RenderingView(this, Color.GREEN);
frame.addView(gpuView);
final RenderingView swView = new RenderingView(this, Color.RED);
swView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
frame.addView(swView);
container.addView(frame);
slider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
mSeekValue = (float) progress / 100.0f;
float gpuAlpha = Math.min(2.0f * mSeekValue, 1f);
gpuView.setAlpha(gpuAlpha);
float swAlpha = Math.min((1 - mSeekValue) * 2.0f, 1f);
System.out.println("(gpuAlpha, swAlpha = " + gpuAlpha + ", " + swAlpha);
swView.setAlpha(swAlpha);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
use of android.widget.SeekBar in project android_frameworks_base by AOSPA.
the class SeekBarPreference method onBindView.
@Override
protected void onBindView(View view) {
super.onBindView(view);
SeekBar seekBar = (SeekBar) view.findViewById(com.android.internal.R.id.seekbar);
seekBar.setOnSeekBarChangeListener(this);
seekBar.setMax(mMax);
seekBar.setProgress(mProgress);
seekBar.setEnabled(isEnabled());
}
use of android.widget.SeekBar in project android_frameworks_base by AOSPA.
the class VirtualizerTest method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
SeekBar seekBar;
TextView textView;
setContentView(R.layout.virtualizertest);
mSessionText = (EditText) findViewById(R.id.sessionEdit);
mSessionText.setOnKeyListener(mSessionKeyListener);
mSessionText.setText(Integer.toString(sSession));
mReleaseButton = (ToggleButton) findViewById(R.id.virtReleaseButton);
mOnOffButton = (ToggleButton) findViewById(R.id.virtualizerOnOff);
getEffect(sSession);
if (mVirtualizer != null) {
mReleaseButton.setOnCheckedChangeListener(this);
mOnOffButton.setOnCheckedChangeListener(this);
textView = (TextView) findViewById(R.id.virtStrengthMin);
textView.setText("0");
textView = (TextView) findViewById(R.id.virtStrengthMax);
textView.setText("1000");
seekBar = (SeekBar) findViewById(R.id.virtStrengthSeekBar);
textView = (TextView) findViewById(R.id.virtStrengthValue);
mStrength = new VirtualizerParam(mVirtualizer, 0, 1000, seekBar, textView);
seekBar.setOnSeekBarChangeListener(mStrength);
mStrength.setEnabled(mVirtualizer.getStrengthSupported());
}
}
use of android.widget.SeekBar in project android_frameworks_base by AOSPA.
the class EqualizerTest method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
SeekBar seekBar;
TextView textView;
setContentView(R.layout.equalizertest);
mSessionText = (EditText) findViewById(R.id.sessionEdit);
mSessionText.setOnKeyListener(mSessionKeyListener);
mSessionText.setText(Integer.toString(sSession));
mReleaseButton = (ToggleButton) findViewById(R.id.eqReleaseButton);
mOnOffButton = (ToggleButton) findViewById(R.id.equalizerOnOff);
getEffect(sSession);
if (mEqualizer != null) {
mReleaseButton.setOnCheckedChangeListener(this);
mOnOffButton.setOnCheckedChangeListener(this);
short[] bandLevelRange = mEqualizer.getBandLevelRange();
int centerFreq;
int[] freqRange;
// Band 1 level
centerFreq = mEqualizer.getCenterFreq((short) 0);
freqRange = mEqualizer.getBandFreqRange((short) 0);
displayFreq(R.id.eqParam1Center, centerFreq);
displayFreq(R.id.eqParam1Min, freqRange[0]);
displayFreq(R.id.eqParam1Max, freqRange[1]);
seekBar = (SeekBar) findViewById(R.id.eqParam1SeekBar);
textView = (TextView) findViewById(R.id.eqParam1Value);
mParameters[0] = new BandLevelParam(mEqualizer, 0, bandLevelRange[0], bandLevelRange[1], seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[0]);
// Band 2 level
centerFreq = mEqualizer.getCenterFreq((short) 1);
freqRange = mEqualizer.getBandFreqRange((short) 1);
displayFreq(R.id.eqParam2Center, centerFreq);
displayFreq(R.id.eqParam2Min, freqRange[0]);
displayFreq(R.id.eqParam2Max, freqRange[1]);
seekBar = (SeekBar) findViewById(R.id.eqParam2SeekBar);
textView = (TextView) findViewById(R.id.eqParam2Value);
mParameters[1] = new BandLevelParam(mEqualizer, 1, bandLevelRange[0], bandLevelRange[1], seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[1]);
// Band 3 level
centerFreq = mEqualizer.getCenterFreq((short) 2);
freqRange = mEqualizer.getBandFreqRange((short) 2);
displayFreq(R.id.eqParam3Center, centerFreq);
displayFreq(R.id.eqParam3Min, freqRange[0]);
displayFreq(R.id.eqParam3Max, freqRange[1]);
seekBar = (SeekBar) findViewById(R.id.eqParam3SeekBar);
textView = (TextView) findViewById(R.id.eqParam3Value);
mParameters[2] = new BandLevelParam(mEqualizer, 2, bandLevelRange[0], bandLevelRange[1], seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[2]);
// Band 4 level
centerFreq = mEqualizer.getCenterFreq((short) 3);
freqRange = mEqualizer.getBandFreqRange((short) 3);
displayFreq(R.id.eqParam4Center, centerFreq);
displayFreq(R.id.eqParam4Min, freqRange[0]);
displayFreq(R.id.eqParam4Max, freqRange[1]);
seekBar = (SeekBar) findViewById(R.id.eqParam4SeekBar);
textView = (TextView) findViewById(R.id.eqParam4Value);
mParameters[3] = new BandLevelParam(mEqualizer, 3, bandLevelRange[0], bandLevelRange[1], seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[3]);
// Band 5 level
centerFreq = mEqualizer.getCenterFreq((short) 4);
freqRange = mEqualizer.getBandFreqRange((short) 4);
displayFreq(R.id.eqParam5Center, centerFreq);
displayFreq(R.id.eqParam5Min, freqRange[0]);
displayFreq(R.id.eqParam5Max, freqRange[1]);
seekBar = (SeekBar) findViewById(R.id.eqParam5SeekBar);
textView = (TextView) findViewById(R.id.eqParam5Value);
mParameters[4] = new BandLevelParam(mEqualizer, 4, bandLevelRange[0], bandLevelRange[1], seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[4]);
// Presets
short numPresets = mEqualizer.getNumberOfPresets();
seekBar = (SeekBar) findViewById(R.id.eqParam6SeekBar);
textView = (TextView) findViewById(R.id.eqParam6Value);
mParameters[5] = new PresetParam(mEqualizer, (short) 0, (short) (numPresets - 1), seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[5]);
}
}
use of android.widget.SeekBar in project android_frameworks_base by AOSPA.
the class PresetReverbTest method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.presetreverbtest);
mSessionText = (EditText) findViewById(R.id.sessionEdit);
mSessionText.setOnKeyListener(mSessionKeyListener);
mSessionText.setText(Integer.toString(sSession));
mReleaseButton = (ToggleButton) findViewById(R.id.presetrvbReleaseButton);
mOnOffButton = (ToggleButton) findViewById(R.id.presetrvbOnOff);
getEffect(sSession);
if (mPresetReverb != null) {
mReleaseButton.setOnCheckedChangeListener(this);
mOnOffButton.setOnCheckedChangeListener(this);
// Presets
SeekBar seekBar = (SeekBar) findViewById(R.id.presetrvbParam1SeekBar);
TextView textView = (TextView) findViewById(R.id.presetrvbParam1Value);
mParameters[0] = new PresetParam(mPresetReverb, (short) 0, (short) (sPresetNames.length - 1), seekBar, textView);
seekBar.setOnSeekBarChangeListener(mParameters[0]);
}
}
Aggregations