當前位置: 首頁>>代碼示例>>Java>>正文


Java Callback類代碼示例

本文整理匯總了Java中com.squareup.picasso.Callback的典型用法代碼示例。如果您正苦於以下問題:Java Callback類的具體用法?Java Callback怎麽用?Java Callback使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Callback類屬於com.squareup.picasso包,在下文中一共展示了Callback類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: displayRaw

import com.squareup.picasso.Callback; //導入依賴的package包/類
@Override
public void displayRaw(@NonNull ImageView img, @NonNull String absPath, int width, int height, final IBoxingCallback callback) {
    String path = "file://" + absPath;
    RequestCreator creator = Picasso.with(img.getContext())
            .load(path);
    if (width > 0 && height > 0) {
        creator.transform(new BitmapTransform(width, height));
    }
    creator.into(img, new Callback() {
        @Override
        public void onSuccess() {
            if (callback != null) {
                callback.onSuccess();
            }
        }

        @Override
        public void onError() {
            if (callback != null) {
                callback.onFail(null);
            }
        }
    });
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:25,代碼來源:BoxingPicassoLoader.java

示例2: onViewCreated

import com.squareup.picasso.Callback; //導入依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    ImageView imageView = (ImageView) view.findViewById(R.id.picasso_fragment_b_image);
    Picasso.with(getContext())
            .load(PicassoFragmentA.GIRAFFE_PIC_URL)
            .fit()
            .noFade()
            .centerCrop()
            .into(imageView, new Callback() {
                @Override
                public void onSuccess() {
                    startPostponedEnterTransition();
                }

                @Override
                public void onError() {
                    startPostponedEnterTransition();
                }
            });
}
 
開發者ID:mikescamell,項目名稱:shared-element-transitions,代碼行數:23,代碼來源:PicassoFragmentB.java

示例3: onCreate

import com.squareup.picasso.Callback; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_animal_detail);
    supportPostponeEnterTransition();

    Bundle extras = getIntent().getExtras();
    AnimalItem animalItem = extras.getParcelable(RecyclerViewActivity.EXTRA_ANIMAL_ITEM);

    ImageView imageView = (ImageView) findViewById(R.id.animal_detail_image_view);
    TextView textView = (TextView) findViewById(R.id.animal_detail_text);
    textView.setText(animalItem.detail);

    String imageUrl = animalItem.imageUrl;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        String imageTransitionName = extras.getString(RecyclerViewActivity.EXTRA_ANIMAL_IMAGE_TRANSITION_NAME);
        imageView.setTransitionName(imageTransitionName);
    }

    Picasso.with(this)
            .load(imageUrl)
            .noFade()
            .into(imageView, new Callback() {
                @Override
                public void onSuccess() {
                    supportStartPostponedEnterTransition();
                }

                @Override
                public void onError() {
                    supportStartPostponedEnterTransition();
                }
            });
}
 
開發者ID:mikescamell,項目名稱:shared-element-transitions,代碼行數:35,代碼來源:AnimalDetailActivity.java

示例4: onViewCreated

import com.squareup.picasso.Callback; //導入依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    AnimalItem animalItem = getArguments().getParcelable(EXTRA_ANIMAL_ITEM);
    String transitionName = getArguments().getString(EXTRA_TRANSITION_NAME);

    TextView detailTextView = (TextView) view.findViewById(R.id.animal_detail_text);
    detailTextView.setText(animalItem.detail);

    ImageView imageView = (ImageView) view.findViewById(R.id.animal_detail_image_view);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        imageView.setTransitionName(transitionName);
    }

    Picasso.with(getContext())
            .load(animalItem.imageUrl)
            .noFade()
            .into(imageView, new Callback() {
                @Override
                public void onSuccess() {
                    startPostponedEnterTransition();
                }

                @Override
                public void onError() {
                    startPostponedEnterTransition();
                }
            });
}
 
開發者ID:mikescamell,項目名稱:shared-element-transitions,代碼行數:31,代碼來源:AnimalDetailFragment.java

示例5: onCreate

import com.squareup.picasso.Callback; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.picasso_activity_b);
    ImageView imageView = (ImageView) findViewById(R.id.picasso_activity_b_image);

    supportPostponeEnterTransition();

    Picasso.with(this)
            .load(PicassoActivityA.TIGER_PIC_URL)
            .fit()
            .noFade()
            .centerCrop()
            .into(imageView, new Callback() {
                @Override
                public void onSuccess() {
                    supportStartPostponedEnterTransition();
                }

                @Override
                public void onError() {
                    supportStartPostponedEnterTransition();
                }
            });
}
 
開發者ID:mikescamell,項目名稱:shared-element-transitions,代碼行數:26,代碼來源:PicassoActivityB.java

示例6: loadImage

import com.squareup.picasso.Callback; //導入依賴的package包/類
@Override
public void loadImage(String path, ImageView imageView) {
    if (path == null || path.equalsIgnoreCase("") || imageView == null) {
        //TODO:ERROR LOADING IMAGE
    }else{
        Picasso.with(context).load(path).into(imageView, new Callback() {
            @Override
            public void onSuccess() {
                listener.onImageLoaded();
            }

            @Override
            public void onError() {
                listener.onImageError();
            }
        });
    }
}
 
開發者ID:Mun0n,項目名稱:MADBike,代碼行數:19,代碼來源:ImageLoaderManager.java

示例7: startLoading

import com.squareup.picasso.Callback; //導入依賴的package包/類
@Override
public void startLoading() {
    picasso.load(PokeQuestApp.BASE_URL + mChoices.get(mCorrectNo).getImageUrl())
            .placeholder(me.datvu.pokequest.R.drawable.pokeball_padding)
            .error(me.datvu.pokequest.R.drawable.pokeball)
            .into(mImPoke, new Callback() {

                @Override
                public void onSuccess() {
                    if (mListener != null) {
                        if (!mIsFinish) mListener.onQuizReady();
                    }
                }

                @Override
                public void onError() {
                    if (mListener != null) {
                        mListener.onQuizLoadingError(new Exception("Error when loading poke " +
                                "image at id=" + mChoices.get(mCorrectNo).getId()));
                    }
                }
            });
}
 
開發者ID:datdescartes,項目名稱:pokequest,代碼行數:24,代碼來源:PokeQuizPickName.java

示例8: loadImageInto

import com.squareup.picasso.Callback; //導入依賴的package包/類
private Completable loadImageInto(ImageView im, Pokemon pk) {
    return Completable.create(e -> picasso.load(PokeQuestApp.BASE_URL + pk.getImageUrl())
            .placeholder(R.drawable.pokeball_padding)
            .error(R.drawable.pokeball)
            .into(im, new Callback() {
                @Override
                public void onSuccess() {
                    e.onComplete();
                }

                @Override
                public void onError() {
                    e.onError(new Throwable("Error when loading poke image at id=" + pk.getId()));
                }
            }));

}
 
開發者ID:datdescartes,項目名稱:pokequest,代碼行數:18,代碼來源:PokeQuizPickImage.java

示例9: setPhotoUrl

import com.squareup.picasso.Callback; //導入依賴的package包/類
void setPhotoUrl(String image, ViewHolder vh){
    ImageView event_image = vh.cardview.findViewById(R.id.commentorProfileImageView);
    final ProgressBar progressBar = vh.cardview.findViewById(R.id.progressBar2);
    Picasso.with(event_image.getContext())
            .load(image)
            .into(event_image, new Callback() {
                @Override
                public void onSuccess() {
                    progressBar.setVisibility(View.GONE);
                }

                @Override
                public void onError() {
                    Toast.makeText(getApplicationContext(), "Network error: failed to load image", Toast.LENGTH_SHORT).show();
                }
            });
}
 
開發者ID:Socialate,項目名稱:furry-sniffle,代碼行數:18,代碼來源:ViewEntertainmentActivity.java

示例10: setPhotoUrl

import com.squareup.picasso.Callback; //導入依賴的package包/類
void setPhotoUrl(String image){
    ImageView event_image = mView.findViewById(R.id.photoImageView);
    final ProgressBar progressBar = mView.findViewById(R.id.imageProgressBar);
    Picasso.with(event_image.getContext())
            .load(image)
            .into(event_image, new Callback() {
                @Override
                public void onSuccess() {
                    progressBar.setVisibility(View.GONE);
                }

                @Override
                public void onError() {

                }
            });
}
 
開發者ID:Socialate,項目名稱:furry-sniffle,代碼行數:18,代碼來源:MainActivity.java

示例11: setPhotoUrl

import com.squareup.picasso.Callback; //導入依賴的package包/類
void setPhotoUrl(String image, ViewHolder vh){
    ImageView event_image = vh.cardview.findViewById(R.id.photoImageView);
    final ProgressBar progressBar = vh.cardview.findViewById(R.id.imageProgressBar);
    Picasso.with(event_image.getContext())
            .load(image)
            .into(event_image, new Callback() {
                @Override
                public void onSuccess() {
                    progressBar.setVisibility(View.GONE);
                }

                @Override
                public void onError() {

                }
            });
}
 
開發者ID:Socialate,項目名稱:furry-sniffle,代碼行數:18,代碼來源:SearchableActivity.java

示例12: setProfilePhotoURL

import com.squareup.picasso.Callback; //導入依賴的package包/類
@Override
public void setProfilePhotoURL(String profilePhotoUrl) {
    Picasso.with(getActivity())
            .load(Uri.parse(profilePhotoUrl))
            .noFade()
            .into(thumbnail, new Callback() {
                @Override
                public void onSuccess() {
                    presenter.onThumbnailLoaded();
                }

                @Override
                public void onError() {
                    setDefaultProfilePhoto();
                }
            });
    //CircleImageView requires noFade() to be set
}
 
開發者ID:BracketCove,項目名稱:Profiler,代碼行數:19,代碼來源:ProfilePageFragment.java

示例13: setDefaultProfilePhoto

import com.squareup.picasso.Callback; //導入依賴的package包/類
@Override
public void setDefaultProfilePhoto() {
    Picasso.with(getActivity())
            .load(R.drawable.default_profile_pic)
            .noFade()
            .into(thumbnail, new Callback() {
                @Override
                public void onSuccess() {
                    presenter.onThumbnailLoaded();
                }

                @Override
                public void onError() {
                    Toast.makeText(
                            getActivity(),
                            getString(R.string.error_loading_image),
                            Toast.LENGTH_SHORT).show();
                }
            });
}
 
開發者ID:BracketCove,項目名稱:Profiler,代碼行數:21,代碼來源:ProfilePageFragment.java

示例14: setBitmap

import com.squareup.picasso.Callback; //導入依賴的package包/類
@Override
public void setBitmap() {
    Picasso.with(getActivity())
            .load(photoURL)
            .fit()
            .into(photo, new Callback() {
                @Override
                public void onSuccess() {
                    presenter.onImageLoaded();
                }

                @Override
                public void onError() {
                    presenter.onImageLoadFailure();
                }
            });
}
 
開發者ID:BracketCove,項目名稱:Profiler,代碼行數:18,代碼來源:PhotoDetailFragment.java

示例15: setPictureUrl

import com.squareup.picasso.Callback; //導入依賴的package包/類
public void setPictureUrl(final String imageUrl) {
	progressBar.setVisibility(View.VISIBLE);
	Picasso.with(image.getContext())
			.load(imageUrl)
			.into(image, new Callback() {
				@Override
				public void onSuccess() {
					progressBar.setVisibility(View.GONE);
				}

				@Override
				public void onError() {
					progressBar.setVisibility(View.GONE);
					image.setImageResource(android.R.drawable.ic_menu_gallery);
				}
			});
}
 
開發者ID:Nyentek,項目名稱:RecyclerPagerAdapter,代碼行數:18,代碼來源:DemoRecyclerPagerAdapterViewHolder.java


注:本文中的com.squareup.picasso.Callback類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。