Search in sources :

Example 6 with SeekBar

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;
            }
        }
    });
}
Also used : EditText(android.widget.EditText) SeekBar(android.widget.SeekBar) Bundle(android.os.Bundle) MenuItem(android.view.MenuItem) View(android.view.View) TextView(android.widget.TextView) TextView(android.widget.TextView) Toolbar(android.support.v7.widget.Toolbar)

Example 7 with SeekBar

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();
}
Also used : EditText(android.widget.EditText) SeekBar(android.widget.SeekBar) Bundle(android.os.Bundle) RadioButton(android.widget.RadioButton) View(android.view.View) TextView(android.widget.TextView)

Example 8 with SeekBar

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");
}
Also used : SeekBar(android.widget.SeekBar)

Example 9 with SeekBar

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");
}
Also used : SeekBar(android.widget.SeekBar)

Example 10 with SeekBar

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");
}
Also used : SeekBar(android.widget.SeekBar)

Aggregations

SeekBar (android.widget.SeekBar)338 TextView (android.widget.TextView)159 View (android.view.View)135 Intent (android.content.Intent)45 ImageView (android.widget.ImageView)43 LinearLayout (android.widget.LinearLayout)37 CompoundButton (android.widget.CompoundButton)35 OnSeekBarChangeListener (android.widget.SeekBar.OnSeekBarChangeListener)34 DialogInterface (android.content.DialogInterface)29 SuppressLint (android.annotation.SuppressLint)28 AdapterView (android.widget.AdapterView)28 Paint (android.graphics.Paint)22 OnClickListener (android.view.View.OnClickListener)21 Button (android.widget.Button)20 LayoutInflater (android.view.LayoutInflater)19 FrameLayout (android.widget.FrameLayout)19 SharedPreferences (android.content.SharedPreferences)18 AlertDialog (android.support.v7.app.AlertDialog)18 AlertDialog (android.app.AlertDialog)15 Bundle (android.os.Bundle)15