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:no.barentswatch.fiskinfo.MapActivity.java

/**
 * //from  ww  w.  java  2s  . c  o  m
 * @param activityContext
 *            The context of the current activity
 */
@SuppressLint("InflateParams")
public void setProximityAlertDialog(Context activityContext) {
    LayoutInflater layoutInflater = getLayoutInflater();
    View view = layoutInflater.inflate(R.layout.dialog_scheduled_task_executor, null);
    final AlertDialog builder = new AlertDialog.Builder(activityContext).create();
    builder.setTitle(R.string.map_set_proximity_alert_title);
    builder.setView(view);

    final EditText distanceEditText = (EditText) view.findViewById(R.id.scheduledProximityRangeEditText);
    final SeekBar seekbar = (SeekBar) view.findViewById(R.id.scheduledSetProximityRangeSeekBar);
    distanceEditText.setText(String.valueOf(minLenghtMeters));

    final Spinner measuringUnitSpinner = (Spinner) view.findViewById(R.id.scheduledMeasuringUnitsSpinner);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.measurement_units,
            android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    measuringUnitSpinner.setAdapter(adapter);

    seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser == true) {
                if (currentlySelected == meterIndex) {
                    distanceEditText
                            .setText(String.valueOf((int) (minLenghtMeters + (stepSizeMeters * progress))));
                } else if (currentlySelected == nauticalMileIndex) {
                    distanceEditText.setText(
                            String.valueOf(minLenghtNauticalMiles + (stepSizeNauticalMiles * progress)));
                }
            }
        }
    });

    measuringUnitSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

            double distance = (distanceEditText.length() != 0
                    ? Double.parseDouble(distanceEditText.getText().toString())
                    : 0);

            System.out.println("posistion: " + position);
            System.out.println("currentlySelected: " + position);

            if (position == meterIndex) {
                if (position != currentlySelected) {
                    distance = convertDistance(distance, position);
                    distanceEditText.setText(String.valueOf(distance));
                    currentlySelected = position;
                }
            } else if (position == nauticalMileIndex) {
                if (position != currentlySelected) {
                    distance = convertDistance(distance, position);
                    distanceEditText.setText(String.valueOf(distance));
                    currentlySelected = position;
                }
            } else {
                return;
            }
            System.out.println("distance: " + distance);

            int newProgress = findProgress(distance, position);
            seekbar.setProgress(newProgress);
            System.out.println("progress: " + newProgress);
            distanceEditText.setText(String.valueOf(distance));
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });

    Button setProximityAlertButton = (Button) view.findViewById(R.id.scheduledSetProximityCheckerDialogButton);
    Button cancelButton = (Button) view.findViewById(R.id.cancel_button);

    builder.setView(view);
    builder.setCanceledOnTouchOutside(false);

    setProximityAlertButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

            if (!alarmSet) {
                mGpsLocationTracker = new GpsLocationTracker(getContext());
                double latitude, longitude = 0;
                if (mGpsLocationTracker.canGetLocation()) {
                    latitude = mGpsLocationTracker.getLatitude();
                    cachedLat = latitude;
                    longitude = mGpsLocationTracker.getLongitude();
                    cachedLon = longitude;
                } else {
                    mGpsLocationTracker.showSettingsAlert();
                    return;
                }
                String distance = distanceEditText.getText().toString();
                cachedDistance = distance;

                cacheWriter = new DownloadMapLayerFromBarentswatchApiInBackground().execute("fishingfacility",
                        "OLEX", "cachedResults", String.valueOf(longitude), String.valueOf(latitude), distance,
                        "true");
                alarmSet = true;
                runScheduledAlarm();
            }

            builder.dismiss();
        }
    });

    cancelButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            builder.cancel();

        }
    });

    builder.show();
}

From source file:im.ene.lab.toro.ext.layeredvideo.PlaybackControlLayer.java

/**
 * Perform binding to UI, setup of event handlers and initialization of values.
 *//*  w  w w.ja  v  a 2s.  com*/
private void setupView() {
    if (actionToolbar == null) {
        actionToolbar = (Toolbar) view.findViewById(R.id.playback_toolbar);
        actionToolbar.inflateMenu(R.menu.playback_actions);
        actionToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                if (settingsCallback != null) {
                    settingsCallback.onSettings();
                    return true;
                }

                return false;
            }
        });
    }
    // Bind fields to UI elements.
    pausePlayButton = (ImageButton) view.findViewById(R.id.pause);
    fullscreenButton = (ImageButton) view.findViewById((R.id.fullscreen));
    seekBar = (SeekBar) view.findViewById(R.id.media_controller_progress);
    endTime = (TextView) view.findViewById(R.id.time_duration);
    currentTime = (TextView) view.findViewById(R.id.time_current);
    logoImageView = (ImageView) view.findViewById(R.id.logo_image);
    playbackControlRootView = (FrameLayout) view.findViewById(R.id.middle_section);
    topChrome = (RelativeLayout) view.findViewById(R.id.top_chrome);
    bottomChrome = (LinearLayout) view.findViewById(R.id.bottom_chrome);
    actionButtonsContainer = (LinearLayout) view.findViewById(R.id.actions_container);

    // The play button should toggle play/pause when the play/pause button is clicked.
    pausePlayButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            togglePlayPause();
            show(DEFAULT_TIMEOUT_MS);
        }
    });

    if (fullscreenCallback == null) {
        fullscreenButton.setVisibility(View.INVISIBLE);
    }
    // Go into fullscreen when the fullscreen button is clicked.
    fullscreenButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            doToggleFullscreen();
            show(DEFAULT_TIMEOUT_MS);
            updateActionButtons();
            updateColors();
        }
    });

    seekBar.setMax(1000);

    seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromuser) {
            if (!fromuser || !canSeek) {
                // Ignore programmatic changes to seek bar position.
                // Ignore changes to seek bar position is seeking is not enabled.
                return;
            }

            ObservablePlayerControl playerControl = layerManager.getControl();
            long duration = playerControl.getDuration();
            long newPosition = (duration * progress) / 1000L;
            playerControl.seekTo((int) newPosition);
            if (currentTime != null) {
                currentTime.setText(formatTimeString((int) newPosition));
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
            show(0);
            isSeekBarDragging = true;
            handler.removeMessages(SHOW_PROGRESS);
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            isSeekBarDragging = false;
            updateProgress();
            updatePlayPauseButton();
            show(DEFAULT_TIMEOUT_MS);

            handler.sendEmptyMessage(SHOW_PROGRESS);
        }
    });

    actionToolbar.setTitle(videoTitle);

    timeFormat = new StringBuilder();
    timeFormatter = new Formatter(timeFormat, Locale.getDefault());
}

From source file:com.andreadec.musicplayer.MainActivity.java

private void bassBoostSettings() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.bassBoost);
    View view = getLayoutInflater().inflate(R.layout.layout_bassboost, null);
    builder.setView(view);//from   ww w .  ja  v  a  2  s.co  m

    builder.setOnCancelListener(new OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            updateExtendedMenu();
        }
    });
    builder.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            updateExtendedMenu();
        }
    });

    CheckBox checkBoxBassBoostEnable = (CheckBox) view.findViewById(R.id.checkBoxBassBoostEnabled);
    checkBoxBassBoostEnable.setChecked(musicService.getBassBoostEnabled());
    checkBoxBassBoostEnable.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            musicService.toggleBassBoost();
            updateExtendedMenu();
        }
    });

    SeekBar seekbar = (SeekBar) view.findViewById(R.id.seekBarBassBoostStrength);
    seekbar.setMax(1000);
    seekbar.setProgress(musicService.getBassBoostStrength());
    seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            if (fromUser) {
                musicService.setBassBoostStrength(seekBar.getProgress());
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar arg0) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar arg0) {
        }
    });

    builder.show();
}

From source file:com.audiokernel.euphonyrmt.fragments.NowPlayingFragment.java

/**
 * Generates the volume {@link android.widget.SeekBar}.
 *
 * @param view The view in which to setup the {@code SeekBar} for.
 * @return The constructed SeekBar for the volume modification.
 *//*from ww  w  .  j  a  v a  2 s.com*/
private SeekBar getVolumeSeekBar(final View view) {
    final SeekBar.OnSeekBarChangeListener seekBarListener = new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {

        }

        @Override
        public void onStartTrackingTouch(final SeekBar seekBar) {
            mVolTimerTask = new TimerTask() {
                private int mLastSentVol = -1;

                private SeekBar mProgress;

                @Override
                public void run() {
                    final int progress = mProgress.getProgress();

                    if (mLastSentVol != progress) {
                        mLastSentVol = progress;
                        MPDControl.run(MPDControl.ACTION_VOLUME_SET, progress);
                    }
                }

                public TimerTask setProgress(final SeekBar prg) {
                    mProgress = prg;
                    return this;
                }
            }.setProgress(seekBar);

            mVolTimer.scheduleAtFixedRate(mVolTimerTask, (long) MPDCommand.MIN_VOLUME,
                    (long) MPDCommand.MAX_VOLUME);
        }

        @Override
        public void onStopTrackingTouch(final SeekBar seekBar) {
            mVolTimerTask.cancel();
            mVolTimerTask.run();
        }
    };

    final SeekBar volumeSeekBar = (SeekBar) view.findViewById(R.id.progress_volume);
    volumeSeekBar.setOnSeekBarChangeListener(seekBarListener);

    return volumeSeekBar;
}

From source file:roommateapp.info.droid.ActivityBuilding.java

/**
 * Show the room properties filter options.
 *//*from ww  w  .  j a  va 2s  .co m*/
public void showFilterOptions() {

    AlertDialog.Builder filter = new AlertDialog.Builder(this);
    filter.setTitle(getString(R.string.filtertitle));

    // Get the layout inflater
    LayoutInflater inflater = this.getLayoutInflater();

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

    // Seekbar
    dialogView = (TextView) dialogview.findViewById(R.id.txt_filterroomsize);
    SeekBar seekbar = (SeekBar) dialogview.findViewById(R.id.seekBar_filter);
    int size = Preferences.getSize(getApplicationContext());
    size = (size == -1) ? 0 : size;

    seekbar.setProgress(size);
    dialogView.setText(getString(R.string.filter_msgP1) + " " + size + " " + getString(R.string.filter_msgP2));

    seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            int stepSize = 5;
            progress = ((int) Math.round(progress / stepSize)) * stepSize;
            seekBar.setProgress(progress);
            dialogView.setText(
                    getString(R.string.filter_msgP1) + " " + progress + " " + getString(R.string.filter_msgP2));
        }

        public void onStartTrackingTouch(SeekBar seekBar) {
            // Nothing here (:
        }

        public void onStopTrackingTouch(SeekBar seekBar) {

            Preferences.setSize(getApplicationContext(), seekBar.getProgress());
        }
    });

    // Checkbox list
    ListView choiceList;

    choiceList = (ListView) dialogview.findViewById(R.id.listFilter);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_multiple_choice, this.filterlist);

    choiceList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    choiceList.setAdapter(adapter);
    boolean[] filterChecked = this.filterActive;

    // Set the saved filter preferences
    for (int i = 0; i < filterChecked.length; i++) {
        choiceList.setItemChecked(i, filterChecked[i]);
    }

    choiceList.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            filterActive[arg2] = !filterActive[arg2];
        }
    });

    // Filter
    filter.setPositiveButton(getString(R.string.filter_set), new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            Preferences.setFilters(getApplicationContext(), filterActive);
            createListViewAll();
            createListViewFreeRooms();
        }
    });

    boolean isFilterActive = false;
    for (int i = 0; i < filterChecked.length && !isFilterActive; i++) {

        isFilterActive = filterChecked[i];
    }

    // Clear the filter settings
    if (isFilterActive || (Preferences.getSize(getApplicationContext()) > 0)) {

        filter.setNegativeButton(getString(R.string.filter_reset), new DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int which) {

                resetFilter();
            }
        });
    }

    filter.create();
    filter.setCancelable(false);
    filter.show();
}

From source file:com.flipzu.flipzu.Player.java

private void sendPlay() {
    if (mUrl == null)
        return;/*  ww  w.  j  av a 2 s . c  om*/

    if (intent == null)
        intent = new Intent(this, FlipzuPlayerService.class);

    intent.setAction(FlipzuPlayerService.ACTION_PLAY);
    Uri data = Uri.parse(mUrl);
    debug.logV(TAG, "sendPlay, got data " + data.toString());
    intent.setData(data);
    intent.putExtra("title", mTitle);
    if (bcast.isLive()) {
        intent.putExtra("live", true);
    } else {
        intent.putExtra("live", false);
        if (!bcast.isLive()) {
            SeekBar seekBar = (SeekBar) findViewById(R.id.seekbar);
            seekBar.setVisibility(View.VISIBLE);
            seekBar.setOnSeekBarChangeListener(this);
        }
    }
    startService(intent);

}

From source file:edu.mum.ml.group7.guessasketch.android.EasyPaint.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    mPaint.setXfermode(null);/*from w w  w. j  av a  2  s.  com*/
    mPaint.setAlpha(0xFF);

    switch (item.getItemId()) {
    case R.id.normal_brush_menu:
        mPaint.setShader(null);
        mPaint.setMaskFilter(null);
        return true;
    case R.id.color_menu:
        new ColorPickerDialog(this, this, mPaint.getColor()).show();
        return true;

    case R.id.size_menu: {
        LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View layout = inflater.inflate(R.layout.brush, (ViewGroup) findViewById(R.id.root));
        AlertDialog.Builder builder = new AlertDialog.Builder(this).setView(layout);
        builder.setTitle(R.string.choose_width);
        final AlertDialog alertDialog = builder.create();
        alertDialog.show();
        SeekBar sb = (SeekBar) layout.findViewById(R.id.brushSizeSeekBar);
        sb.setProgress(getStrokeSize());
        final TextView txt = (TextView) layout.findViewById(R.id.sizeValueTextView);
        txt.setText(
                String.format(getResources().getString(R.string.your_selected_size_is), getStrokeSize() + 1));
        sb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            public void onProgressChanged(SeekBar seekBar, final int progress, boolean fromUser) {
                // Do something here with new value
                mPaint.setStrokeWidth(progress);
                txt.setText(
                        String.format(getResources().getString(R.string.your_selected_size_is), progress + 1));
            }

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

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub
            }
        });
        return true;
    }
    case R.id.erase_menu: {
        LayoutInflater inflater_e = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View layout_e = inflater_e.inflate(R.layout.brush, (ViewGroup) findViewById(R.id.root));
        AlertDialog.Builder builder_e = new AlertDialog.Builder(this).setView(layout_e);
        builder_e.setTitle(R.string.choose_width);
        final AlertDialog alertDialog_e = builder_e.create();
        alertDialog_e.show();
        SeekBar sb_e = (SeekBar) layout_e.findViewById(R.id.brushSizeSeekBar);
        sb_e.setProgress(getStrokeSize());
        final TextView txt_e = (TextView) layout_e.findViewById(R.id.sizeValueTextView);
        txt_e.setText(
                String.format(getResources().getString(R.string.your_selected_size_is), getStrokeSize() + 1));
        sb_e.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            public void onProgressChanged(SeekBar seekBar, final int progress, boolean fromUser) {
                // Do something here with new value
                mPaint.setStrokeWidth(progress);
                txt_e.setText(
                        String.format(getResources().getString(R.string.your_selected_size_is), progress + 1));
            }

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

            public void onStopTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub
            }
        });
        mPaint.setShader(null);
        mPaint.setXfermode(new PorterDuffXfermode(Mode.CLEAR));
        return true;
    }
    case R.id.clear_all_menu: {
        contentView.mBitmap.eraseColor(Color.TRANSPARENT);
        if (predictions != null) {
            resetPredictionsView(predictions, true);
        }
        return true;
    }
    case R.id.save_menu:
        sendScreenshot(false, ApiCallType.GUESS_IMAGE, "");
        break;

    case R.id.about_menu:
        startActivity(new Intent(this, AboutActivity.class));
        break;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.javielinux.fragments.MyActivityFragment.java

public void showSizeText() {

    final int minValue = 6;

    LayoutInflater factory = LayoutInflater.from(getActivity());
    final View sizesFontView = factory.inflate(R.layout.alert_dialog_sizes_font, null);

    ((TextView) sizesFontView.findViewById(R.id.txt_size_titles)).setText(
            getString(R.string.size_title) + " (" + PreferenceUtils.getSizeTitles(getActivity()) + ")");
    ((TextView) sizesFontView.findViewById(R.id.txt_size_text))
            .setText(getString(R.string.size_text) + " (" + PreferenceUtils.getSizeText(getActivity()) + ")");

    SeekBar sbSizeTitles = (SeekBar) sizesFontView.findViewById(R.id.sb_size_titles);

    sbSizeTitles.setMax(18);//w  w  w  . ja  v  a  2 s .c  o  m
    sbSizeTitles.setProgress(PreferenceUtils.getSizeTitles(getActivity()) - minValue);

    sbSizeTitles.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            progress += minValue;
            PreferenceUtils.setSizeTitles(getActivity(), progress);
            //seekBar.setProgress(progress);
            ((TextView) sizesFontView.findViewById(R.id.txt_size_titles)).setText(
                    getString(R.string.size_title) + " (" + PreferenceUtils.getSizeTitles(getActivity()) + ")");
            // TODO notificar al adapter el cambio de texto
            //mAdapterResponseList.notifyDataSetChanged();
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }

    });

    SeekBar sbSizeText = (SeekBar) sizesFontView.findViewById(R.id.sb_size_text);
    sbSizeText.setMax(18);
    sbSizeText.setProgress(PreferenceUtils.getSizeText(getActivity()) - minValue);

    sbSizeText.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            progress += minValue;
            PreferenceUtils.setSizeText(getActivity(), progress);
            //seekBar.setProgress(progress);
            ((TextView) sizesFontView.findViewById(R.id.txt_size_text)).setText(
                    getString(R.string.size_text) + " (" + PreferenceUtils.getSizeText(getActivity()) + ")");
            // TODO notificar al adapter el cambio de texto
            //mAdapterResponseList.notifyDataSetChanged();
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }

    });

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.font_size);
    builder.setView(sizesFontView);
    builder.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
        }
    });
    builder.create();
    builder.show();
}

From source file:com.flipzu.flipzu.Player.java

@Override
public void onResume() {
    super.onResume();

    debug.logV(TAG, "onResume()");

    /* track pageview */
    tracker.trackPageView("/" + this.getLocalClassName());

    if (!isOnline()) {
        setLiveVisible(false);//ww w.j  a va2 s.co m
        if (intent == null)
            intent = new Intent(this, FlipzuPlayerService.class);
        stopService(intent);
    }

    // request player update.
    sendRequestStatus();
    registerReceiver(broadcastReceiver, new IntentFilter(FlipzuPlayerService.INTENT_FILTER));

    if (bcast != null) {
        AsyncFlipInterface.getComments(Integer.parseInt(bcast.getId()), Player.this);
        timerHandler.postDelayed(mTimerTask, 1000);
        if (!bcast.isLive()) {
            SeekBar seekBar = (SeekBar) findViewById(R.id.seekbar);
            seekBar.setVisibility(View.VISIBLE);
            seekBar.setOnSeekBarChangeListener(this);
        }
    }
    comHandler.postDelayed(mUpdateCommentsTask, 10000);
}

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

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    dexMovingImageView = (DexMovingImageView) view.findViewById(R.id.image);
    commands = view.findViewById(R.id.commands_card_view);
    SeekBar zoomSeekBar = (SeekBar) view.findViewById(R.id.zoom_seek_bar);
    SeekBar angleSeekBar = (SeekBar) view.findViewById(R.id.angle_seek_bar);
    speedSeekBar = (SeekBar) view.findViewById(R.id.speed_seek_bar);
    Spinner evaluators = (Spinner) view.findViewById(R.id.evaluators);
    Spinner generators = (Spinner) view.findViewById(R.id.generators);
    CheckBox scale = (CheckBox) view.findViewById(R.id.drawer_scale);
    CheckBox rotate = (CheckBox) view.findViewById(R.id.drawer_rotate);
    CheckBox translate = (CheckBox) view.findViewById(R.id.drawer_translate);
    xValue = (TextView) view.findViewById(R.id.x_value);
    yValue = (TextView) view.findViewById(R.id.y_value);
    zValue = (TextView) view.findViewById(R.id.z_value);
    angleValue = (TextView) view.findViewById(R.id.angle_value);
    eventOccurrences = (TextView) view.findViewById(R.id.event_occurrences);
    evaluators.setOnItemSelectedListener(this);
    generators.setOnItemSelectedListener(this);
    scale.setOnCheckedChangeListener(this);
    rotate.setOnCheckedChangeListener(this);
    translate.setOnCheckedChangeListener(this);
    zoomSeekBar.setOnSeekBarChangeListener(this);
    angleSeekBar.setOnSeekBarChangeListener(this);
    speedSeekBar.setOnSeekBarChangeListener(this);
    scale.setChecked(dexMovingImageView.isDrawerAdded(DRAWERS.SCALE));
    rotate.setChecked(dexMovingImageView.isDrawerAdded(DRAWERS.ROTATE));
    translate.setChecked(dexMovingImageView.isDrawerAdded(DRAWERS.TRANSLATE));
    zoomSeekBar.setProgress((int) (dexMovingImageView.getZoom() * 100));
    angleSeekBar.setProgress((int) (dexMovingImageView.getAngle() * 100 / angleSeekBar.getMax()));
    if (dexMovingImageView.getFrequency() == 0)
        speedSeekBar.setProgress(0);/*  w w  w.  ja  v  a  2s  .c  om*/
    else
        speedSeekBar.setProgress((int) (1 / dexMovingImageView.getFrequency()));
    dexMovingImageView.setOnValueChanged(this);
    dexMovingImageView.setOnEventOccurred(this);
}