@Override
public void onLongPress(MotionEvent e) {
View child = recyclerView.findChildViewUnder(e.getX(), e.getY());
if (child != null && clickListener != null) {
//далее выгоднее получить холдер:
ViewHolder holder = recyclerView.findContainingViewHolder(child);
if(holder instanceOf Interactable){
((Interactable)holder).interactWith(e);
}else if(holder instanceOf Clickable){
//обычный клик по элементу
((Clickable)holder).click(Context ctx);
}
}
}
. . .
setContentView(R.layout.activity_main);
final Uri uri = Uri.parse("https://i.imgur.com/tGbaZCY.jpg");
final ImagePipeline imagePipeline = Fresco.getImagePipeline();
final ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
.setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH).build();
final DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(request, this);
final ImageView view = ((ImageView) findViewById(R.id.img));
dataSource.subscribe(new BaseBitmapDataSubscriber() {
@Override
protected void onNewResultImpl(final Bitmap bitmap) {
view.post(new Runnable() {
@Override
public void run() {
view.setImageBitmap(bitmap);
}
});
}
@Override
protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
dataSource.close();
}
}, AsyncTask.THREAD_POOL_EXECUTOR);<code>
ну работает же все:)