use of android.widget.SeekBar in project NewPipe by TeamNewPipe.
the class DownloadDialog method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Bundle arguments = getArguments();
final Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
final EditText name = (EditText) view.findViewById(R.id.file_name);
final TextView tCount = (TextView) view.findViewById(R.id.threads_count);
final SeekBar threads = (SeekBar) view.findViewById(R.id.threads);
toolbar.setTitle(R.string.download_dialog_title);
toolbar.setNavigationIcon(R.drawable.ic_arrow_back_black_24dp);
toolbar.inflateMenu(R.menu.dialog_url);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getDialog().dismiss();
}
});
threads.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekbar, int progress, boolean fromUser) {
tCount.setText(String.valueOf(progress + 1));
}
@Override
public void onStartTrackingTouch(SeekBar p1) {
}
@Override
public void onStopTrackingTouch(SeekBar p1) {
}
});
checkDownloadOptions();
//int def = mPrefs.getInt("threads", 4);
int def = 3;
threads.setProgress(def - 1);
tCount.setText(String.valueOf(def));
name.setText(createFileName(arguments.getString(TITLE)));
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if (item.getItemId() == R.id.okay) {
download();
return true;
} else {
return false;
}
}
});
}
use of android.widget.SeekBar in project NewPipe by TeamNewPipe.
the class DownloadDialog method download.
//download audio, video or both?
private void download() {
View view = getView();
Bundle arguments = getArguments();
final EditText name = (EditText) view.findViewById(R.id.file_name);
final SeekBar threads = (SeekBar) view.findViewById(R.id.threads);
RadioButton audioButton = (RadioButton) view.findViewById(R.id.audio_button);
RadioButton videoButton = (RadioButton) view.findViewById(R.id.video_button);
String fName = name.getText().toString().trim();
boolean isAudio = audioButton.isChecked();
String url, location, filename;
if (isAudio) {
url = arguments.getString(AUDIO_URL);
location = NewPipeSettings.getAudioDownloadPath(getContext());
filename = fName + arguments.getString(FILE_SUFFIX_AUDIO);
} else {
url = arguments.getString(VIDEO_URL);
location = NewPipeSettings.getVideoDownloadPath(getContext());
filename = fName + arguments.getString(FILE_SUFFIX_VIDEO);
}
DownloadManagerService.startMission(getContext(), url, location, filename, isAudio, threads.getProgress() + 1);
getDialog().dismiss();
}
use of android.widget.SeekBar in project BoomMenu by Nightonke.
the class ShareActivity method initHideDurationSeek.
private void initHideDurationSeek() {
SeekBar hideDurationSeekBar = (SeekBar) findViewById(R.id.hide_duration_seek);
assert hideDurationSeekBar != null;
hideDurationSeekBar.setMax(1000);
hideDurationSeekBar.setProgress((int) bmb1.getHideDuration());
hideDurationSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
hideDurationSeekText.setText("Hide duration = " + seekBar.getProgress() + " ms");
bmb1.setHideDuration(progress);
bmb2.setHideDuration(progress);
bmb3.setHideDuration(progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
hideDurationSeekText = (TextView) findViewById(R.id.hide_duration_text);
hideDurationSeekText.setText("Hide duration = " + hideDurationSeekBar.getProgress() + " ms");
}
use of android.widget.SeekBar in project BoomMenu by Nightonke.
the class ShareActivity method initShowDelaySeek.
private void initShowDelaySeek() {
SeekBar showDelaySeekBar = (SeekBar) findViewById(R.id.show_delay_seek);
assert showDelaySeekBar != null;
showDelaySeekBar.setMax(1000);
showDelaySeekBar.setProgress((int) bmb1.getShowDelay());
showDelaySeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
showDelaySeekText.setText("Show delay = " + seekBar.getProgress() + " ms");
bmb1.setShowDelay(progress);
bmb2.setShowDelay(progress);
bmb3.setShowDelay(progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
showDelaySeekText = (TextView) findViewById(R.id.show_delay_text);
showDelaySeekText.setText("Show delay = " + showDelaySeekBar.getProgress() + " ms");
}
use of android.widget.SeekBar in project BoomMenu by Nightonke.
the class ShareActivity method initHideDelaySeek.
private void initHideDelaySeek() {
SeekBar hideDelaySeekBar = (SeekBar) findViewById(R.id.hide_delay_seek);
assert hideDelaySeekBar != null;
hideDelaySeekBar.setMax(1000);
hideDelaySeekBar.setProgress((int) bmb1.getHideDelay());
hideDelaySeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
hideDelaySeekText.setText("Hide delay = " + seekBar.getProgress() + " ms");
bmb1.setHideDelay(progress);
bmb2.setHideDelay(progress);
bmb3.setHideDelay(progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
hideDelaySeekText = (TextView) findViewById(R.id.hide_delay_text);
hideDelaySeekText.setText("Hide delay = " + hideDelaySeekBar.getProgress() + " ms");
}
Aggregations