本文整理汇总了Java中com.gc.materialdesign.views.Slider类的典型用法代码示例。如果您正苦于以下问题:Java Slider类的具体用法?Java Slider怎么用?Java Slider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Slider类属于com.gc.materialdesign.views包,在下文中一共展示了Slider类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initView
import com.gc.materialdesign.views.Slider; //导入依赖的package包/类
private void initView(Context context) {
this.context = context;
View v = LayoutInflater.from(context).inflate(R.layout.view_video_controller, null);
addView(v);
mVideoView = findView(R.id.videoView);
mVideoView.setOnTouchListener(this);
mVideoView.setOnPreparedListener(this);
mVideoView.setOnBufferingUpdateListener(this);
mVideoView.setOnCompletionListener(this);
mProgressWheel = findView(R.id.progressWheel);
mProgressWheel.startSpinning();
viewPlay = findView(R.id.button_play);
slider = findView(R.id.slider);
slider.setOnValueChangedListener(this);
slider.setOnNumberIndicatorConvert(new Slider.OnNumberIndicatorConvert() {
@Override
public String covert(long val) {
return MediaPlayerUtils.getVideoDisplayTime(val);
}
});
setVideoPlayButton();
}
示例2: initView
import com.gc.materialdesign.views.Slider; //导入依赖的package包/类
private void initView(Context context) {
this.context = context;
View v = LayoutInflater.from(context).inflate(R.layout.view_video_controller, null);
addView(v);
mVideoView = findView(R.id.videoView);
mVideoView.setOnTouchListener(this);
mVideoView.setOnPreparedListener(this);
mVideoView.setOnBufferingUpdateListener(this);
mVideoView.setOnCompletionListener(this);
mProgressWheel = findView(R.id.progressWheel);
mProgressWheel.startSpinning();
viewPlay = findView(R.id.button_play);
slider = findView(R.id.slider);
slider.setOnValueChangedListener(this);
slider.setOnNumberIndicatorConvert(new Slider.OnNumberIndicatorConvert() {
@Override
public String covert(long val) {
return MediaPlayerUtils.getVideoDisplayTime(val);
}
});
setVideoPlayButton();
}
示例3: initSeekBar
import com.gc.materialdesign.views.Slider; //导入依赖的package包/类
/** Not intended to be called in {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}
* @return <code>true</code> if successfully initialized Slider,
* <code>false</code> if something went wrong.
* @param view The view to initialize with.
*/
private boolean initSeekBar(View view){
mSliderDistance = (Slider)
view.findViewById(R.id.careerstack_distanceSeekbar_slider);
mTv_distance = (TextView)
view.findViewById(R.id.careerstack_distanceSeekbar_text_value);
if (mSliderDistance != null && mTv_distance != null){
Resources r = getResources();
mDistanceSliderWrapper = new MaterialSliderWrapper(
mSliderDistance,
r.getInteger(R.integer.careerstack_seekBar_min),
r.getInteger(R.integer.careerstack_seekBar_max),
r.getInteger(R.integer.careerstack_seekBar_step)
);
mDistanceSliderWrapper.setOnValueChangedListener(this);
mDistanceSliderWrapper.setProgress(mCurrentDistanceValue);
return true;
} else {
return false; //end early
}
}
示例4: MaterialSliderWrapper
import com.gc.materialdesign.views.Slider; //导入依赖的package包/类
/** Builds a helper with given values.
* @param slider The slider to adjust
* @param min The minimum value (when at "0")
* @param max the maximum value (when at "100"). Must be larger than min.
* @param step he minimum step between allowed values. Must be positive
*/
public MaterialSliderWrapper(Slider slider, int min, int max, int step) {
this.mSlider = slider;
if (max <= min){
throw new IllegalArgumentException(
String.format(DETAILED_EXCEPTION_MAX_SMALLER, max, min)
);
}
if (step <= 0){
throw
new IllegalArgumentException(DETAILED_EXCEPTION_STEP_NEGATIVE);
}
int range = max - min;
if (range < step){
throw new IllegalArgumentException(
String.format(DETAILED_EXCEPTION_STEP_LARGER, range, step)
);
}
this.mStep = step;
this.mSlider.setOnValueChangedListener(this);
this.mSlider.setMax(max);
this.mSlider.setMin(min);
}
示例5: onCreate
import com.gc.materialdesign.views.Slider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.color_selector);
colorView = findViewById(R.id.viewColor);
colorView.setBackgroundColor(color);
// Resize ColorView
colorView.post(new Runnable() {
@Override
public void run() {
LayoutParams params = (LayoutParams) colorView.getLayoutParams();
params.height = colorView.getWidth();
colorView.setLayoutParams(params);
}
});
// Configure Sliders
red = (Slider) findViewById(R.id.red);
green = (Slider) findViewById(R.id.green);
blue = (Slider) findViewById(R.id.blue);
int r = (this.color >> 16) & 0xFF;
int g = (this.color >> 8) & 0xFF;
int b = (this.color >> 0) & 0xFF;
red.setValue(r);
green.setValue(g);
blue.setValue(b);
red.setOnValueChangedListener(this);
green.setOnValueChangedListener(this);
blue.setOnValueChangedListener(this);
}
示例6: onCreate
import com.gc.materialdesign.views.Slider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.color_selector);
colorView = findViewById(R.id.viewColor);
colorView.setBackgroundColor(color);
// Resize ColorView
colorView.post(new Runnable() {
@Override
public void run() {
LinearLayout.LayoutParams params = (LayoutParams) colorView.getLayoutParams();
params.height = colorView.getWidth();
colorView.setLayoutParams(params);
}
});
// Configure Sliders
red = (Slider) findViewById(R.id.red);
green = (Slider) findViewById(R.id.green);
blue = (Slider) findViewById(R.id.blue);
int r = (this.color >> 16) & 0xFF;
int g = (this.color >> 8) & 0xFF;
int b = (this.color >> 0) & 0xFF;
red.setValue(r);
green.setValue(g);
blue.setValue(b);
red.setOnValueChangedListener(this);
green.setOnValueChangedListener(this);
blue.setOnValueChangedListener(this);
}
示例7: initViews
import com.gc.materialdesign.views.Slider; //导入依赖的package包/类
/** Initializes the views. */
private void initViews(View rootView){
mTv_distance = (TextView)
rootView.findViewById(R.id.careerstack_distanceSeekbar_text_value);
mSliderSeekbar = (Slider)
rootView.findViewById(R.id.careerstack_distanceSeekbar_slider);
mSliderWrapper = new MaterialSliderWrapper(mSliderSeekbar,
getResources().getInteger(R.integer.careerstack_seekBar_min),
getResources().getInteger(R.integer.careerstack_seekBar_max),
getResources().getInteger(R.integer.careerstack_seekBar_step));
mSliderWrapper.setOnValueChangedListener(this);
mSliderWrapper.setProgress(mCurrentDistanceValue);
}
示例8: onCreate
import com.gc.materialdesign.views.Slider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.color_selector);
view = (LinearLayout)findViewById(R.id.contentSelector);
backView = (RelativeLayout)findViewById(R.id.rootSelector);
backView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getX() < view.getLeft() || event.getX() >view.getRight()
|| event.getY() > view.getBottom() || event.getY() < view.getTop()) {
dismiss();
}
return false;
}
});
colorView = findViewById(R.id.viewColor);
colorView.setBackgroundColor(color);
// Resize ColorView
colorView.post(new Runnable() {
@Override
public void run() {
LayoutParams params = (LayoutParams) colorView.getLayoutParams();
params.height = colorView.getWidth();
colorView.setLayoutParams(params);
}
});
// Configure Sliders
red = (Slider) findViewById(R.id.red);
green = (Slider) findViewById(R.id.green);
blue = (Slider) findViewById(R.id.blue);
int r = (this.color >> 16) & 0xFF;
int g = (this.color >> 8) & 0xFF;
int b = (this.color >> 0) & 0xFF;
red.setValue(r);
green.setValue(g);
blue.setValue(b);
red.setOnValueChangedListener(this);
green.setOnValueChangedListener(this);
blue.setOnValueChangedListener(this);
}
示例9: onCreate
import com.gc.materialdesign.views.Slider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.color_selector);
view = (LinearLayout)findViewById(R.id.contentSelector);
backView = (RelativeLayout)findViewById(R.id.rootSelector);
backView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getX() < view.getLeft() || event.getX() >view.getRight()
|| event.getY() > view.getBottom() || event.getY() < view.getTop()) {
dismiss();
}
return false;
}
});
colorView = findViewById(R.id.viewColor);
colorView.setBackgroundColor(color);
// Resize ColorView
colorView.post(new Runnable() {
@Override
public void run() {
LinearLayout.LayoutParams params = (LayoutParams) colorView.getLayoutParams();
params.height = colorView.getWidth();
colorView.setLayoutParams(params);
}
});
// Configure Sliders
red = (Slider) findViewById(R.id.red);
green = (Slider) findViewById(R.id.green);
blue = (Slider) findViewById(R.id.blue);
int r = (this.color >> 16) & 0xFF;
int g = (this.color >> 8) & 0xFF;
int b = (this.color >> 0) & 0xFF;
red.setValue(r, true);
green.setValue(g, true);
blue.setValue(b, true);
red.setOnValueChangedListener(this);
green.setOnValueChangedListener(this);
blue.setOnValueChangedListener(this);
}
示例10: onCreate
import com.gc.materialdesign.views.Slider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.color_selector);
view = (LinearLayout)findViewById(R.id.contentSelector);
backView = (RelativeLayout)findViewById(R.id.rootSelector);
backView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getX() < view.getLeft() || event.getX() >view.getRight()
|| event.getY() > view.getBottom() || event.getY() < view.getTop()) {
dismiss();
}
return false;
}
});
colorView = findViewById(R.id.viewColor);
colorView.setBackgroundColor(color);
// Resize ColorView
colorView.post(new Runnable() {
@Override
public void run() {
LinearLayout.LayoutParams params = (LayoutParams) colorView.getLayoutParams();
params.height = colorView.getWidth();
colorView.setLayoutParams(params);
}
});
// Configure Sliders
red = (Slider) findViewById(R.id.red);
green = (Slider) findViewById(R.id.green);
blue = (Slider) findViewById(R.id.blue);
int r = (this.color >> 16) & 0xFF;
int g = (this.color >> 8) & 0xFF;
int b = (this.color >> 0) & 0xFF;
red.setValue(r);
green.setValue(g);
blue.setValue(b);
red.setOnValueChangedListener(this);
green.setOnValueChangedListener(this);
blue.setOnValueChangedListener(this);
}
示例11: onCreate
import com.gc.materialdesign.views.Slider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.color_selector);
colorView = findViewById(R.id.viewColor);
colorView.setBackgroundColor(color);
colorView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
colorView.post(new Runnable() {
@Override
public void run() {
LinearLayout.LayoutParams params = (LayoutParams) colorView.getLayoutParams();
params.height = colorView.getWidth();
colorView.setLayoutParams(params);
}
});
red = (Slider) findViewById(R.id.red);
green = (Slider) findViewById(R.id.green);
blue = (Slider) findViewById(R.id.blue);
int r = (this.color >> 16) & 0xFF;
int g = (this.color >> 8) & 0xFF;
int b = (this.color >> 0) & 0xFF;
red.setValue(r);
green.setValue(g);
blue.setValue(b);
red.setOnValueChangedListener(this);
green.setOnValueChangedListener(this);
blue.setOnValueChangedListener(this);
}
示例12: getSlider
import com.gc.materialdesign.views.Slider; //导入依赖的package包/类
/** Returns the slider as set in constructor.
* @return The {@link Slider} for this stepper. */
public Slider getSlider() {
return mSlider;
}