use of com.synnapps.carouselview.CarouselView in project Habba18 by chiragsastry1996.
the class HomeFragment method setUpViews.
private void setUpViews() {
MainActivity parentActivity = (MainActivity) getActivity();
try {
FirebaseMessaging.getInstance().subscribeToTopic("news");
String token = FirebaseInstanceId.getInstance().getToken();
Log.d("token", token);
registerToken(token);
} catch (Exception e) {
System.out.println("Token Error");
}
left = (Button) parentView.findViewById(R.id.left);
right = (Button) parentView.findViewById(R.id.right);
left.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
resideMenu.openMenu(ResideMenu.DIRECTION_LEFT);
}
});
right.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
resideMenu.openMenu(ResideMenu.DIRECTION_RIGHT);
}
});
carouselView = (CarouselView) parentView.findViewById(R.id.carouselView);
carouselView.setPageCount(sampleImages.length);
carouselView.setImageListener(new ImageListener() {
@Override
public void setImageForPosition(int position, ImageView imageView) {
Glide.with(getContext()).load(sampleImages[position]).apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE).placeholder(R.drawable.slider1)).into(imageView);
}
});
imageView1 = (ImageView) parentView.findViewById(R.id.imageView11);
try {
final pl.droidsonroids.gif.GifDrawable gifFromResource = new pl.droidsonroids.gif.GifDrawable(getResources(), R.drawable.landing);
imageView1.setImageDrawable(gifFromResource);
} catch (IOException e) {
e.printStackTrace();
}
imageView1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// do nothing
}
});
}
Aggregations