use of android.widget.SeekBar in project J2ME-Loader by nikita36078.
the class Gauge method getItemContentView.
@Override
protected View getItemContentView() {
if (pbar == null) {
if (interactive) {
pbar = new SeekBar(getOwnerForm().getParentActivity());
((SeekBar) pbar).setOnSeekBarChangeListener(listener);
} else {
pbar = new ProgressBar(getOwnerForm().getParentActivity(), null, android.R.attr.progressBarStyleHorizontal);
}
pbar.setMax(maxValue);
pbar.setProgress(value);
}
return pbar;
}
use of android.widget.SeekBar in project XCL-Charts by xcltapestry.
the class CircleChartActivity method init.
private void init() {
halfchart = (com.demo.xclcharts.view.CircleChart01View) findViewById(R.id.halfcircle_view);
chart = (com.demo.xclcharts.view.CircleChart02View) findViewById(R.id.circle_view);
halfchart2 = (com.demo.xclcharts.view.CircleChart03View) findViewById(R.id.halfcircle_view2);
process = (TextView) findViewById(R.id.tv_process);
SeekBar seekBar = (SeekBar) this.findViewById(R.id.seekBar1);
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
process.setText(Integer.toString(progress));
halfchart.setPercentage(progress);
halfchart.chartRender();
halfchart.invalidate();
chart.setPercentage(progress);
chart.chartRender();
chart.invalidate();
halfchart2.setPercentage(progress);
halfchart2.chartRender();
halfchart2.invalidate();
}
});
}
use of android.widget.SeekBar in project XCL-Charts by xcltapestry.
the class SeekBarActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_seek_bar);
SeekBar seekBar = (SeekBar) this.findViewById(R.id.sk_process);
mLaychart = (LinearLayout) this.findViewById(R.id.lay_chart);
mDesc = (TextView) findViewById(R.id.tv_process);
Bundle bunde = this.getIntent().getExtras();
String title = bunde.getString("title");
this.setTitle(title);
mSelected = bunde.getInt("selected");
if (// 仪表盘
0 == mSelected) {
mGaChart = new GaugeChart01View(this);
mLaychart.addView(mGaChart);
seekBar.setMax(180);
} else if (1 == mSelected) {
mCirChart2 = new CircleChart02View(this);
mLaychart.addView(mCirChart2);
seekBar.setMax(100);
} else if (2 == mSelected) {
// 半圆
mCirChart = new CircleChart01View(this);
mLaychart.addView(mCirChart);
seekBar.setMax(100);
}
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
mDesc.setText(Integer.toString(progress));
if (0 == mSelected) {
mGaChart.setAngle(progress);
mGaChart.chartRender();
mGaChart.invalidate();
} else if (1 == mSelected) {
mCirChart2.setPercentage(progress);
mCirChart2.chartRender();
mCirChart2.invalidate();
} else if (2 == mSelected) {
mCirChart.setPercentage(progress);
mCirChart.chartRender();
mCirChart.invalidate();
}
}
});
}
use of android.widget.SeekBar in project android-UniversalMusicPlayer by googlesamples.
the class FullScreenPlayerActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_full_player);
initializeToolbar();
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("");
}
mBackgroundImage = (ImageView) findViewById(R.id.background_image);
mPauseDrawable = ContextCompat.getDrawable(this, R.drawable.uamp_ic_pause_white_48dp);
mPlayDrawable = ContextCompat.getDrawable(this, R.drawable.uamp_ic_play_arrow_white_48dp);
mPlayPause = (ImageView) findViewById(R.id.play_pause);
mSkipNext = (ImageView) findViewById(R.id.next);
mSkipPrev = (ImageView) findViewById(R.id.prev);
mStart = (TextView) findViewById(R.id.startText);
mEnd = (TextView) findViewById(R.id.endText);
mSeekbar = (SeekBar) findViewById(R.id.seekBar1);
mLine1 = (TextView) findViewById(R.id.line1);
mLine2 = (TextView) findViewById(R.id.line2);
mLine3 = (TextView) findViewById(R.id.line3);
mLoading = (ProgressBar) findViewById(R.id.progressBar1);
mControllers = findViewById(R.id.controllers);
mSkipNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MediaControllerCompat.TransportControls controls = MediaControllerCompat.getMediaController(FullScreenPlayerActivity.this).getTransportControls();
controls.skipToNext();
}
});
mSkipPrev.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MediaControllerCompat.TransportControls controls = MediaControllerCompat.getMediaController(FullScreenPlayerActivity.this).getTransportControls();
controls.skipToPrevious();
}
});
mPlayPause.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PlaybackStateCompat state = MediaControllerCompat.getMediaController(FullScreenPlayerActivity.this).getPlaybackState();
if (state != null) {
MediaControllerCompat.TransportControls controls = MediaControllerCompat.getMediaController(FullScreenPlayerActivity.this).getTransportControls();
switch(state.getState()) {
// fall through
case PlaybackStateCompat.STATE_PLAYING:
case PlaybackStateCompat.STATE_BUFFERING:
controls.pause();
stopSeekbarUpdate();
break;
case PlaybackStateCompat.STATE_PAUSED:
case PlaybackStateCompat.STATE_STOPPED:
controls.play();
scheduleSeekbarUpdate();
break;
default:
LogHelper.d(TAG, "onClick with state ", state.getState());
}
}
}
});
mSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
mStart.setText(DateUtils.formatElapsedTime(progress / 1000));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
stopSeekbarUpdate();
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
MediaControllerCompat.getMediaController(FullScreenPlayerActivity.this).getTransportControls().seekTo(seekBar.getProgress());
scheduleSeekbarUpdate();
}
});
// Only update from the intent if we are not recreating from a config change:
if (savedInstanceState == null) {
updateFromParams(getIntent());
}
mMediaBrowser = new MediaBrowserCompat(this, new ComponentName(this, MusicService.class), mConnectionCallback, null);
}
use of android.widget.SeekBar in project Shuttle by timusus.
the class EqualizerFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_equalizer, container, false);
unbinder = ButterKnife.bind(this, rootView);
toolbar.inflateMenu(R.menu.menu_equalizer);
toolbar.setNavigationOnClickListener(v -> getNavigationController().popViewController());
toolbar.setOnMenuItemClickListener(this);
MenuItem item = toolbar.getMenu().findItem(R.id.action_equalizer);
SwitchCompat switchItem = (SwitchCompat) item.getActionView();
boolean isEnabled = prefs.getBoolean("audiofx.global.enable", false);
switchItem.setChecked(isEnabled);
switchItem.setOnCheckedChangeListener(this);
// Hide the 'open DSP' button if DSP/Other audio effects aren't available
final Intent intent = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
if (ShuttleApplication.getInstance().getPackageManager().resolveActivity(intent, 0) == null) {
MenuItem openDSPItem = toolbar.getMenu().findItem(R.id.menu_dsp);
if (openDSPItem != null) {
openDSPItem.setVisible(false);
}
}
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
eqPreset = position;
equalizerSetPreset(position);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
setupPresets();
if (spinnerAdapter != null && spinnerAdapter.getCount() > eqPreset) {
spinner.setSelection(eqPreset);
}
// Initialize the equalizer elements
numberEqualizerBands = Integer.parseInt(prefs.getString("equalizer.number_of_bands", "5"));
final int[] centerFreqs = getCenterFreqs();
final int[] bandLevelRange = getBandLevelRange();
for (int band = 0; band < numberEqualizerBands; band++) {
// Unit conversion from mHz to Hz and use k prefix if necessary to display
float centerFreqHz = centerFreqs[band] / 1000;
String unitPrefix = "";
if (centerFreqHz >= 1000) {
centerFreqHz = centerFreqHz / 1000;
unitPrefix = "k";
}
(eqContainer.findViewById(eqViewElementIds[band][0])).setVisibility(View.VISIBLE);
(eqContainer.findViewById(eqViewTextElementIds[band][0])).setVisibility(View.VISIBLE);
(eqContainer.findViewById(eqViewElementIds[band][1])).setVisibility(View.VISIBLE);
(eqContainer.findViewById(eqViewTextElementIds[band][1])).setVisibility(View.VISIBLE);
((TextView) eqContainer.findViewById(eqViewElementIds[band][0])).setText(format("%.0f ", centerFreqHz) + unitPrefix + "Hz");
mEqualizerSeekBar[band] = eqContainer.findViewById(eqViewElementIds[band][1]);
mEqualizerSeekBar[band].setMax((bandLevelRange[1] / 100) - (bandLevelRange[0] / 100));
mEqualizerSeekBar[band].setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
if (fromUser) {
// Determine which band changed
int seekbarId = seekBar.getId();
int band = 0;
for (int i = 0; i < eqViewElementIds.length; i++) {
if (eqViewElementIds[i][1] == seekbarId) {
band = i;
}
}
if (eqPreset != eqCustomPresetPosition) {
equalizerCopyToCustom();
if (spinnerAdapter != null && spinnerAdapter.getCount() > eqCustomPresetPosition) {
spinner.setSelection(eqCustomPresetPosition);
}
} else {
int level = getBandLevelRange()[0] + (progress * 100);
equalizerBandUpdate(band, level);
}
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
MusicUtils.updateEqualizer();
}
});
}
// Set the SeekBar listener.
if (bassBoostSupported) {
baseBoostSeekbar.setMax(OpenSLESConstants.BASSBOOST_MAX_STRENGTH - OpenSLESConstants.BASSBOOST_MIN_STRENGTH);
baseBoostSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
// set parameter and state
if (fromUser) {
prefs.edit().putBoolean("audiofx.bass.enable", true).apply();
prefs.edit().putString("audiofx.bass.strength", String.valueOf(progress)).apply();
MusicUtils.updateEqualizer();
}
}
// If slider pos was 0 when starting re-enable effect
@Override
public void onStartTrackingTouch(final SeekBar seekBar) {
if (seekBar.getProgress() == 0) {
prefs.edit().putBoolean("audiofx.bass.enable", true).apply();
MusicUtils.updateEqualizer();
}
}
// If slider pos = 0 when stopping disable effect
@Override
public void onStopTrackingTouch(final SeekBar seekBar) {
if (seekBar.getProgress() == 0) {
// disable
prefs.edit().putBoolean("audiofx.bass.enable", false).apply();
MusicUtils.updateEqualizer();
}
}
});
}
// Set the SeekBar listener.
if (virtualizerSupported) {
virtualizerSeekbar.setMax(OpenSLESConstants.VIRTUALIZER_MAX_STRENGTH - OpenSLESConstants.VIRTUALIZER_MIN_STRENGTH);
virtualizerSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
// set parameter and state
if (fromUser) {
prefs.edit().putBoolean("audiofx.virtualizer.enable", true).apply();
prefs.edit().putString("audiofx.virtualizer.strength", String.valueOf(progress)).apply();
MusicUtils.updateEqualizer();
}
}
// If slider pos was 0 when starting re-enable effect
@Override
public void onStartTrackingTouch(final SeekBar seekBar) {
if (seekBar.getProgress() == 0) {
prefs.edit().putBoolean("audiofx.virtualizer.enable", true).apply();
MusicUtils.updateEqualizer();
}
}
// If slider pos = 0 when stopping disable effect
@Override
public void onStopTrackingTouch(final SeekBar seekBar) {
if (seekBar.getProgress() == 0) {
// disable
prefs.edit().putBoolean("audiofx.virtualizer.enable", false).apply();
MusicUtils.updateEqualizer();
}
}
});
}
return rootView;
}
Aggregations