本文整理汇总了Java中com.daimajia.slider.library.SliderTypes.DefaultSliderView类的典型用法代码示例。如果您正苦于以下问题:Java DefaultSliderView类的具体用法?Java DefaultSliderView怎么用?Java DefaultSliderView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultSliderView类属于com.daimajia.slider.library.SliderTypes包,在下文中一共展示了DefaultSliderView类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupCurrentImagesViewPager
import com.daimajia.slider.library.SliderTypes.DefaultSliderView; //导入依赖的package包/类
private void setupCurrentImagesViewPager(ArrayList<String> productImages) {
productImagesViewPager.removeAllSliders();
ViewGroup.LayoutParams vp = productImagesViewPager.getLayoutParams();
vp.height = (int) (DisplayArea.getDisplayWidth());
productImagesViewPager.setLayoutParams(vp);
for (String productImage : productImages) {
DefaultSliderView sliderView = new DefaultSliderView(home);
sliderView.image(productImage);
// sliderView.setOnSliderClickListener(new BaseSliderView.OnSliderClickListener() {
// @Override
// public void onSliderClick(BaseSliderView slider) {
// home.showProductsFragment(Constants.PRODUCTS_MODE_BANNER, null);
// }
// });
productImagesViewPager.addSlider(sliderView);
}
productImagesViewPager.setPresetTransformer(SliderLayout.Transformer.ZoomOutSlide);
productImagesViewPager.setIndicatorVisibility(PagerIndicator.IndicatorVisibility.Invisible);
productImagesViewPager.stopAutoCycle();
}
示例2: initListView
import com.daimajia.slider.library.SliderTypes.DefaultSliderView; //导入依赖的package包/类
/**
* {@link ListView} initialize
*/
private void initListView() {
ListView listView = (ListView) findViewById(R.id.list_view);
View headerLayout = LayoutInflater.from(this)
.inflate(R.layout.layout_viewpager, null);
SliderLayout sliderLayout = (SliderLayout) headerLayout.findViewById(R.id.slider);
for (int resId : mPagerDatas) {
DefaultSliderView mSliderView = new DefaultSliderView(this);
mSliderView
.image(resId)
.setScaleType(BaseSliderView.ScaleType.Fit);
mSliderView.bundle(new Bundle());
mSliderView.getBundle().putInt("position", mPagerDatas.indexOf(resId));
sliderLayout.addSlider(mSliderView);
}
sliderLayout.setPresetTransformer(SliderLayout.Transformer.Default);
sliderLayout.setDuration(3000);
ListAdapter adapter = new ListAdapter(this, R.layout.list_item, mSampleDatas);
adapter.setViewPager(sliderLayout);
listView.setAdapter(adapter);
}
示例3: setupCurrentOffersViewPager
import com.daimajia.slider.library.SliderTypes.DefaultSliderView; //导入依赖的package包/类
private void setupCurrentOffersViewPager(ArrayList<Banner> currentOfferBanners) {
ViewGroup.LayoutParams vp = currentOffersViewPager.getLayoutParams();
vp.height = (int) (DisplayArea.getDisplayWidth()/1.72);
currentOffersViewPager.setLayoutParams(vp);
for (Banner currentOffer : currentOfferBanners) {
DefaultSliderView sliderView = new DefaultSliderView(home);
sliderView.image(currentOffer.getImage());
sliderView.setOnSliderClickListener(new BaseSliderView.OnSliderClickListener() {
@Override
public void onSliderClick(BaseSliderView slider) {
home.showProductsFragment(ProductsFragment.PRODUCTS_MODE_BANNER, null);
}
});
currentOffersViewPager.addSlider(sliderView);
}
currentOffersViewPager.setPresetTransformer(SliderLayout.Transformer.ZoomOutSlide);
currentOffersViewPager.setIndicatorVisibility(PagerIndicator.IndicatorVisibility.Invisible);
currentOffersViewPager.stopAutoCycle();
}
示例4: setSlider
import com.daimajia.slider.library.SliderTypes.DefaultSliderView; //导入依赖的package包/类
@BindingAdapter(value = {"indicator", "data", "sliderClick"}, requireAll = false)
public static void setSlider(SliderLayout sliderLayout, PagerIndicator indicator, String data,
BaseSliderView.OnSliderClickListener onSliderClickListener) {
DisplayMetrics displayMetrics = AppContext.getInstance().getResources().getDisplayMetrics();
float width = displayMetrics.widthPixels;
ViewGroup.LayoutParams lp = sliderLayout.getLayoutParams();
lp.height = (int) (166 * width / 375);
sliderLayout.setLayoutParams(lp);
sliderLayout.requestLayout();
//清空旧的
sliderLayout.removeAllSliders();
List<String> banners = new ArrayList<>();
banners.add("http://jewely-image.b0.upaiyun.com/images/2017-02-22/148773250858acff1c6b69f.jpg");
banners.add("http://jewely-image.b0.upaiyun.com/images/2017-02-22/148774660958ad363167649.jpg");
banners.add("http://jewely-image.b0.upaiyun.com/ueditor/2017-02-28/1488248833.jpg");
banners.add("https://static.darryring.com/ueditor/2017-03-28/1490687105.jpg");
for (String banner : banners) {
DefaultSliderView defaultSliderView = new DefaultSliderView(AppContext.getInstance());
defaultSliderView.image(banner).empty(R.drawable.bg_image_loading).error(R.drawable.bg_image_loading)
.setScaleType(BaseSliderView.ScaleType.CenterCrop).setOnSliderClickListener(onSliderClickListener);
defaultSliderView.bundle(new Bundle());
defaultSliderView.getBundle().putSerializable("extra", banner);
sliderLayout.addSlider(defaultSliderView);
}
indicator.setDefaultIndicatorColor(ContextCompat.getColor(AppContext.getInstance(), R.color.pagerIndicator_select_color),
ContextCompat.getColor(AppContext.getInstance(), R.color.pagerIndicator_unSelect_color));
sliderLayout.setCustomIndicator(indicator);
sliderLayout.setCustomAnimation(new DescriptionAnimation());
sliderLayout.setDuration(3 * 1000);
sliderLayout.setRecoverCycleDuration(200);
sliderLayout.startAutoCycle();
}
示例5: loadCameraImages
import com.daimajia.slider.library.SliderTypes.DefaultSliderView; //导入依赖的package包/类
private void loadCameraImages() {
final int CAMERA_IMAGE_COUNT = 9;
if (mCameraSliderLayout == null) {
return;
}
mCameraSliderLayout.stopAutoCycle();
mCameraSliderLayout.removeAllSliders();
for (int i = 1; i < CAMERA_IMAGE_COUNT+1; i++) {
if (i == 5) {
// Skip 5 for now cuz its not loading for some werid reason
continue;
}
String cameraURL = mCamera.getImageUrl().replace("01.jpg", String.format(Locale.US, "%02d.jpg", i));
Ion.with(getActivity()).load(cameraURL).asBitmap().setCallback(new FutureCallback<Bitmap>() {
@Override
public void onCompleted(Exception e, Bitmap result) {
DefaultSliderView cameraSliderView = new DefaultSliderView(getActivity());
cameraSliderView.image(result);
mCameraSliderLayout.addSlider(cameraSliderView);
}
});
}
}
示例6: showSliderViews
import com.daimajia.slider.library.SliderTypes.DefaultSliderView; //导入依赖的package包/类
private void showSliderViews(List<Banner> banners){
if(banners !=null){
for (Banner banner : banners){
DefaultSliderView sliderView = new DefaultSliderView(this.getActivity());
sliderView.image(banner.getImgUrl());
sliderView.description(banner.getName());
sliderView.setScaleType(BaseSliderView.ScaleType.Fit);
mSliderLayout.addSlider(sliderView);
}
}
mSliderLayout.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
mSliderLayout.setCustomAnimation(new DescriptionAnimation());
mSliderLayout.setPresetTransformer(SliderLayout.Transformer.Default);
mSliderLayout.setDuration(3000);
}