Example usage for android.widget SeekBar setOnSeekBarChangeListener

List of usage examples for android.widget SeekBar setOnSeekBarChangeListener

Introduction

In this page you can find the example usage for android.widget SeekBar setOnSeekBarChangeListener.

Prototype

public void setOnSeekBarChangeListener(OnSeekBarChangeListener l) 

Source Link

Document

Sets a listener to receive notifications of changes to the SeekBar's progress level.

Usage

From source file:com.esri.arcgisruntime.generateofflinemapoverrides.MainActivity.java

/**
 * Builds a seek bar and handles updating of the associated current seek bar text view.
 *
 * @param seekBar             view to build
 * @param currSeekBarTextView to be updated when the seek bar progress changes
 * @param max                 max value for the seek bar
 * @param progress            initial progress position of the seek bar
 * @return the built seek bar/*from  ww  w .  j a va 2 s.  co  m*/
 */
private static SeekBar buildSeekBar(SeekBar seekBar, TextView currSeekBarTextView, int max, int progress) {
    seekBar.setMax(max);
    seekBar.setProgress(progress);
    currSeekBarTextView.setText(String.valueOf(seekBar.getProgress()));
    seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            currSeekBarTextView.setText(String.valueOf(progress));
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    return seekBar;
}

From source file:org.brandroid.openmanager.fragments.DialogHandler.java

public static AlertDialog showSeekBarDialog(final Context context, String title, int progress, int max,
        OnSeekBarChangeListener onSeekListener) {
    FrameLayout view = new FrameLayout(context);
    SeekBar sb = new SeekBar(context);
    view.addView(sb);/* w ww . j a v  a2s  .c om*/
    view.setPadding(20, 20, 20, 20);

    sb.setOnSeekBarChangeListener(onSeekListener);
    sb.setProgress(progress);
    sb.setMax(max);
    return new AlertDialog.Builder(context).setTitle(title).setView(view).show();
}

From source file:com.commonsware.android.scaleclip.FragmentBase.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setRetainInstance(true);/*from w w  w .  j a  va 2  s. c o m*/

    View result = inflater.inflate(R.layout.scaleclip, container, false);
    SeekBar bar = ((SeekBar) result.findViewById(R.id.level));

    bar.setOnSeekBarChangeListener(this);
    image = (ImageView) result.findViewById(R.id.image);
    setImageBackground(image);
    image.setImageLevel(bar.getProgress());

    return (result);
}

From source file:org.debian.paulliu.kajiradoubra.controller.LevelFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mActivity = (KajiraDouBraController) getActivity();

    SeekBar seekBarLeft = (SeekBar) mActivity.findViewById(R.id.seekbar_level_left);
    seekBarLeft.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override// w w  w.  j a v a  2 s  .co m
        public void onStopTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            onLeftProgressChanged(progress);
        }
    });

    SeekBar seekBarRight = (SeekBar) mActivity.findViewById(R.id.seekbar_level_right);
    seekBarRight.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
            // TODO Auto-generated method stub
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            onRightProgressChanged(progress);
        }
    });
}

From source file:net.evendanan.android.thumbremote.ui.FragmentAlertDialogSupport.java

private Dialog createMediaTimeSeekDialog() {
    final Dialog seeker = new Dialog(getActivity(), R.style.Popup);
    seeker.setContentView(R.layout.custom_time_selection);
    seeker.findViewById(R.id.seeker_close_button).setOnClickListener(new OnClickListener() {
        @Override//from w  w w . j  av  a2  s. co m
        public void onClick(View v) {
            seeker.dismiss();
        }
    });
    seeker.setOnDismissListener(new OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            ((RemoteUiActivity) getActivity()).mMediaSeekBar = null;
        }
    });

    SeekBar seekBar = (SeekBar) seeker.findViewById(R.id.time_seek_bar);
    seekBar.setOnSeekBarChangeListener((RemoteUiActivity) getActivity());

    return seeker;
}

From source file:nodomain.freeyourgadget.gadgetbridge.activities.VibrationActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_vibration);

    IntentFilter filter = new IntentFilter();
    filter.addAction(GBApplication.ACTION_QUIT);
    LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filter);
    registerReceiver(mReceiver, filter);

    seekBar = (SeekBar) findViewById(R.id.vibration_seekbar);
    seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override/*  w  ww  .j  av  a  2  s. c  o  m*/
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (progress > 0) { // 1-16
                progress = progress * 16 - 1; // max 255
            }
            GBApplication.deviceService().onSetConstantVibration(progress);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {

        }
    });
}

From source file:pl.reticular.br.dialogs.LineWidthDialog.java

@NonNull
@Override// w w w. j  av a  2 s.co  m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    // Use the Builder class for convenient dialog construction
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

    LayoutInflater inflater = getActivity().getLayoutInflater();

    // Inflate and set the layout for the dialog
    // Pass null as the parent view because its going in the dialog layout
    View view = inflater.inflate(R.layout.line_width_dialog_layout, null);

    SeekBar seekBar = (SeekBar) view.findViewById(R.id.line_width_seekBar);

    seekBar.setProgress(PrefsHelper.getInstance().getLineWidth());

    seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            PrefsHelper.getInstance().setLineWidth(progress);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    builder.setView(view).setTitle(R.string.line_width).setNeutralButton(R.string.ok,
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                }
            });

    return builder.create();
}

From source file:it.dex.movingimageview.fragments.CrossFadeTesterFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    dexCrossFadeImageView = (DexCrossFadeImageView) view.findViewById(R.id.image);
    play = (DexCrossFadeImageView) view.findViewById(R.id.play);
    play.setOnClickListener(this);
    SeekBar transitionSeekBar = (SeekBar) view.findViewById(R.id.transition_seek_bar);
    SeekBar stillImageSeekBar = (SeekBar) view.findViewById(R.id.still_image_seek_bar);
    transitionSeekBar.setOnSeekBarChangeListener(this);
    stillImageSeekBar.setOnSeekBarChangeListener(this);
}

From source file:com.bluros.music.widgets.SleepModeDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    context = getActivity().getBaseContext();
    Intent action = new Intent(MusicService.SLEEP_MODE_STOP_ACTION);
    ComponentName serviceName = new ComponentName(context, MusicService.class);
    action.setComponent(serviceName);//  ww  w  .j  ava2 s .  c o  m
    pendingIntent = PendingIntent.getService(context, 4, action, 0);
    alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.sleep_mode_time_selector, null);
    int minutes = Integer.valueOf(getString(R.string.default_interval));
    final TextView tvPopUpTime = (TextView) view.findViewById(R.id.pop_up_time);
    tvPopUpTime.setText(String.valueOf(minutes));
    final SeekBar sBar = (SeekBar) view.findViewById(R.id.seekbar);
    sBar.setProgress(minutes - 1);
    sBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) {
            tvPopUpTime.setText(String.valueOf(arg1 + 1));
        }

        @Override
        public void onStartTrackingTouch(SeekBar arg0) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar arg0) {

        }
    });
    builder.setTitle(R.string.select_quit_time);
    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int arg1) {
            long timeLeft = (sBar.getProgress() + 1) * mMill;
            alarmManager.set(AlarmManager.RTC_WAKEUP, timeLeft + System.currentTimeMillis(), pendingIntent);
            MusicPlayer.setSleepMode(true);
            Toast.makeText(context, String.format(getString(R.string.quit_warining), sBar.getProgress() + 1),
                    Toast.LENGTH_SHORT).show();
            dialog.dismiss();
        }
    });
    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int arg1) {
            dialog.dismiss();
        }
    });
    builder.setView(view);
    return builder.create();
}

From source file:fi.harism.anndblur.MainActivity.java

@Override
@SuppressWarnings("deprecation")
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);/*from  w ww  .ja  v  a  2s  . co m*/

    findViewById(R.id.button_left).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mDrawerLayout.openDrawer(Gravity.LEFT);
        }
    });

    findViewById(R.id.button_right).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mDrawerLayout.openDrawer(Gravity.RIGHT);
        }
    });

    int maxBlur = getWindowManager().getDefaultDisplay().getWidth() / 8;
    mFooterLayout = (BlurLinearLayout) findViewById(R.id.footer_layout);
    mFooterLayout.setBlurRadius(maxBlur / 2);

    SeekBar seekBar = (SeekBar) mFooterLayout.findViewById(R.id.seekbar_blur);
    seekBar.setMax(maxBlur);
    seekBar.setProgress(maxBlur / 2);
    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) {
            mFooterLayout.setBlurRadius(progress + 1);
        }
    });

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLayout.setScrimColor(0x40000000);
}