Java Code Examples for pl.droidsonroids.gif.GifImageView#setOnClickListener()

The following examples show how to use pl.droidsonroids.gif.GifImageView#setOnClickListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EmptyLayout.java    From CoreModule with Apache License 2.0 6 votes vote down vote up
private void init() {
    View view = View
            .inflate(getContext(), R.layout.emptyview_content, null);
    img = (GifImageView) view.findViewById(R.id.img_error_layout);
    tv = (TextView) view.findViewById(R.id.tv_error_layout);

    setBackgroundColor(-1);
    setOnClickListener(this);
    if (getVisibility() == View.GONE) {
        setErrorType(HIDE_LAYOUT);
    } else {
        setErrorType(NETWORK_LOADING);
    }

    img.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (clickEnable && listener != null) {
                listener.onClick(v);
            }
        }
    });

    this.addView(view);
}
 
Example 2
Source File: SamplePagerAdapter.java    From KJGallery with Apache License 2.0 6 votes vote down vote up
/**
 * 加载gif图片
 */
private void displayGif(final GifImageView gifView, byte[] res) {
    gifView.setVisibility(View.VISIBLE);

    try {
        GifDrawable gifFromBytes = new GifDrawable(res);
        gifView.setImageDrawable(gifFromBytes);
    } catch (IOException e) {
        gifView.setImageResource(R.mipmap.default_img_rect);
    }

    gifView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            aty.finish();
        }
    });
}