Я создал приложение с pull refre sh, но когда приложение тянет, чтобы refre sh, у меня возникает ошибка, так как ползунок точек все еще считает, если я потяну, чтобы refre sh, это мой код:
public class MainActivity extends AppCompatActivity implements BaseSliderView.OnSliderClickListener,
ViewPagerEx.OnPageChangeListener {
private SliderLayout mDemoSlider;
SwipyRefreshLayout swipe;
ArrayList<String> listUrl;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mDemoSlider = findViewById(R.id.slider);
swipe = findViewById(R.id.swipe);
listUrl = new ArrayList<>();
swipe.setOnRefreshListener(new SwipyRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh(SwipyRefreshLayoutDirection direction) {
listUrl.clear();
refreshItems();
}
});
getView();
}
private void refreshItems() {
onItemsLoadComplete();
getView();
}
private void onItemsLoadComplete() {
swipe.setRefreshing(false);
}
private void getView() {
listUrl.add("https://www.revive-adserver.com/media/GitHub.jpg");
listUrl.add("https://tctechcrunch2011.files.wordpress.com/2017/02/android-studio-logo.png");
listUrl.add("http://static.tumblr.com/7650edd3fb8f7f2287d79a67b5fec211/3mg2skq/3bdn278j2/tumblr_static_idk_what.gif");
listUrl.add("http://www.gstatic.com/webp/gallery/1.webp");
RequestOptions requestOptions = new RequestOptions();
requestOptions.centerCrop();
//.diskCacheStrategy(DiskCacheStrategy.NONE)
//.placeholder(R.drawable.placeholder)
//.error(R.drawable.placeholder);
for (int i = 0; i < listUrl.size(); i++) {
TextSliderView sliderView = new TextSliderView(this);
// if you want show image only / without description text use DefaultSliderView instead
// initialize SliderLayout
sliderView
.image(listUrl.get(i))
.setRequestOption(requestOptions)
.setProgressBarVisible(true)
.setOnSliderClickListener(this);
//add your extra information
sliderView.bundle(new Bundle());
mDemoSlider.addSlider(sliderView);
}
// set Slider Transition Animation
// mDemoSlider.setPresetTransformer(SliderLayout.Transformer.Default);
mDemoSlider.setPresetTransformer(SliderLayout.Transformer.Accordion);
mDemoSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
mDemoSlider.setCustomAnimation(new DescriptionAnimation());
mDemoSlider.setDuration(4000);
mDemoSlider.addOnPageChangeListener(this);
mDemoSlider.stopCyclingWhenTouch(false);
}
@Override
protected void onStop() {
// To prevent a memory leak on rotation, make sure to call stopAutoCycle() on the slider before activity or fragment is destroyed
mDemoSlider.stopAutoCycle();
super.onStop();
}