Search in sources :

Example 1 with ImageListener

use of com.synnapps.carouselview.ImageListener 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
        }
    });
}
Also used : ImageListener(com.synnapps.carouselview.ImageListener) RequestOptions(com.bumptech.glide.request.RequestOptions) IOException(java.io.IOException) ImageView(android.widget.ImageView) View(android.view.View) TapTargetView(com.getkeepsafe.taptargetview.TapTargetView) CarouselView(com.synnapps.carouselview.CarouselView) IOException(java.io.IOException) ImageView(android.widget.ImageView)

Aggregations

View (android.view.View)1 ImageView (android.widget.ImageView)1 RequestOptions (com.bumptech.glide.request.RequestOptions)1 TapTargetView (com.getkeepsafe.taptargetview.TapTargetView)1 CarouselView (com.synnapps.carouselview.CarouselView)1 ImageListener (com.synnapps.carouselview.ImageListener)1 IOException (java.io.IOException)1