All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.robobinding.widget.seekbar.TwoWayProgressAttribute Maven / Gradle / Ivy

The newest version!
package org.robobinding.widget.seekbar;

import org.robobinding.property.ValueModel;
import org.robobinding.viewattribute.property.TwoWayPropertyViewAttribute;
import org.robobinding.widgetaddon.seekbar.SeekBarAddOn;

import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;

/**
 * 
 * @since 1.0
 * @version $Revision: 1.0 $
 * @author Robert Taylor
 * @author Cheng Wei
 */
public class TwoWayProgressAttribute implements TwoWayPropertyViewAttribute {
	@Override
	public void updateView(SeekBar view, Integer progress, SeekBarAddOn viewAddOn) {
		view.setProgress(progress);
	}

	@Override
	public void observeChangesOnTheView(SeekBarAddOn viewAddOn, final ValueModel valueModel, SeekBar view) {
		viewAddOn.addOnSeekBarChangeListener(new OnSeekBarChangeListener() {

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

			@Override
			public void onStopTrackingTouch(SeekBar seekBar) {
			}

			@Override
			public void onStartTrackingTouch(SeekBar seekBar) {
			}
		});
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy