Search in sources :

Example 1 with PicassoUtils

use of net.osmand.plus.utils.PicassoUtils in project OsmAnd by osmandapp.

the class DescriptionCard method setupImage.

private void setupImage(final String imageUrl) {
    if (imageUrl == null) {
        return;
    }
    final PicassoUtils picasso = PicassoUtils.getPicasso(app);
    RequestCreator rc = Picasso.get().load(imageUrl);
    final AppCompatImageView image = view.findViewById(R.id.main_image);
    rc.into(image, new Callback() {

        @Override
        public void onSuccess() {
            picasso.setResultLoaded(imageUrl, true);
            AndroidUiHelper.updateVisibility(image, true);
        }

        @Override
        public void onError(Exception e) {
            picasso.setResultLoaded(imageUrl, false);
        }
    });
}
Also used : Callback(com.squareup.picasso.Callback) AppCompatImageView(androidx.appcompat.widget.AppCompatImageView) PicassoUtils(net.osmand.plus.utils.PicassoUtils) RequestCreator(com.squareup.picasso.RequestCreator)

Example 2 with PicassoUtils

use of net.osmand.plus.utils.PicassoUtils in project Osmand by osmandapp.

the class DescriptionCard method setupImage.

private void setupImage(final String imageUrl) {
    if (imageUrl == null) {
        return;
    }
    final PicassoUtils picasso = PicassoUtils.getPicasso(app);
    RequestCreator rc = Picasso.get().load(imageUrl);
    final AppCompatImageView image = view.findViewById(R.id.main_image);
    rc.into(image, new Callback() {

        @Override
        public void onSuccess() {
            picasso.setResultLoaded(imageUrl, true);
            AndroidUiHelper.updateVisibility(image, true);
        }

        @Override
        public void onError(Exception e) {
            picasso.setResultLoaded(imageUrl, false);
        }
    });
}
Also used : Callback(com.squareup.picasso.Callback) AppCompatImageView(androidx.appcompat.widget.AppCompatImageView) PicassoUtils(net.osmand.plus.utils.PicassoUtils) RequestCreator(com.squareup.picasso.RequestCreator)

Example 3 with PicassoUtils

use of net.osmand.plus.utils.PicassoUtils in project Osmand by osmandapp.

the class GpxReadDescriptionDialogFragment method setupImage.

private void setupImage(View view) {
    if (imageUrl == null) {
        return;
    }
    final OsmandApplication app = getMyApplication();
    final PicassoUtils picasso = PicassoUtils.getPicasso(app);
    final AppCompatImageView image = view.findViewById(R.id.main_image);
    RequestCreator rc = Picasso.get().load(imageUrl);
    WikivoyageUtils.setupNetworkPolicy(app.getSettings(), rc);
    rc.into(image, new Callback() {

        @Override
        public void onSuccess() {
            picasso.setResultLoaded(imageUrl, true);
            AndroidUiHelper.updateVisibility(image, true);
        }

        @Override
        public void onError(Exception e) {
            picasso.setResultLoaded(imageUrl, false);
        }
    });
}
Also used : Callback(com.squareup.picasso.Callback) OsmandApplication(net.osmand.plus.OsmandApplication) AppCompatImageView(androidx.appcompat.widget.AppCompatImageView) PicassoUtils(net.osmand.plus.utils.PicassoUtils) RequestCreator(com.squareup.picasso.RequestCreator)

Example 4 with PicassoUtils

use of net.osmand.plus.utils.PicassoUtils in project OsmAnd by osmandapp.

the class GpxReadDescriptionDialogFragment method setupImage.

private void setupImage(View view) {
    if (imageUrl == null) {
        return;
    }
    final OsmandApplication app = getMyApplication();
    final PicassoUtils picasso = PicassoUtils.getPicasso(app);
    final AppCompatImageView image = view.findViewById(R.id.main_image);
    RequestCreator rc = Picasso.get().load(imageUrl);
    WikivoyageUtils.setupNetworkPolicy(app.getSettings(), rc);
    rc.into(image, new Callback() {

        @Override
        public void onSuccess() {
            picasso.setResultLoaded(imageUrl, true);
            AndroidUiHelper.updateVisibility(image, true);
        }

        @Override
        public void onError(Exception e) {
            picasso.setResultLoaded(imageUrl, false);
        }
    });
}
Also used : Callback(com.squareup.picasso.Callback) OsmandApplication(net.osmand.plus.OsmandApplication) AppCompatImageView(androidx.appcompat.widget.AppCompatImageView) PicassoUtils(net.osmand.plus.utils.PicassoUtils) RequestCreator(com.squareup.picasso.RequestCreator)

Aggregations

AppCompatImageView (androidx.appcompat.widget.AppCompatImageView)4 Callback (com.squareup.picasso.Callback)4 RequestCreator (com.squareup.picasso.RequestCreator)4 PicassoUtils (net.osmand.plus.utils.PicassoUtils)4 OsmandApplication (net.osmand.plus.OsmandApplication)2