android-maps-utils icon indicating copy to clipboard operation
android-maps-utils copied to clipboard

Problem when work with URL

Open mdtuyen opened this issue 11 years ago • 4 comments

I need get picture from URL to push to marker (my case using glide)

  • Image picture wrong after spand
  • How to put text to top of picture ?

Here is my code:

       @Override
        protected void onBeforeClusterItemRendered(final FeedsModel feedsModel, final MarkerOptions markerOptions) {
            // Draw a single person.
            // Set the info window to show their name.
            Glide
                    .with(mActivity.getApplicationContext())
                    .load(feedsModel.getImages().getThumbnail().getUrl())
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
                    .into(new SimpleTarget<GlideDrawable>() {
                        @Override
                        public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
                            mImageView.setImageDrawable(resource);
                            Bitmap icon = mIconGenerator.makeIcon();
                            markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
                            Marker markerToChange = null;
                            for (Marker marker : mClusterManager.getMarkerCollection().getMarkers()) {
                                if (marker.getPosition().equals(feedsModel.getPosition())) {
                                    markerToChange = marker;
                                }
                            }
                            // if found - change icon
                            if (markerToChange != null) {
                                markerToChange.setIcon(BitmapDescriptorFactory.fromBitmap(icon));
                            }
                        }
                    });
            Bitmap icon = mIconGenerator.makeIcon();
            markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
        }

        @Override
        protected void onBeforeClusterRendered(final Cluster<FeedsModel> cluster, final MarkerOptions markerOptions) {
            // Draw multiple people.
            // Note: this method runs on the UI thread. Don't spend too much time in here (like in this example).
            final List<Drawable> profilePhotos = new ArrayList<Drawable>(Math.min(4, cluster.getSize()));
            final int width = mDimension;
            final int height = mDimension;

            int i = 0;

            for (final FeedsModel p : cluster.getItems()) {
                // Draw 4 at most.
                i++;
                Glide
                        .with(mActivity.getApplicationContext())
                        .load(p.getImages().getThumbnail().getUrl())
                        .diskCacheStrategy(DiskCacheStrategy.ALL)
                        .into(new SimpleTarget<GlideDrawable>() {
                            @Override
                            public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
                                resource.setBounds(0, 0, width, height);
                                profilePhotos.add(resource);
                                MultiDrawable multiDrawable = new MultiDrawable(profilePhotos);
                                multiDrawable.setBounds(0, 0, width, height);

                                mClusterImageView.setImageDrawable(multiDrawable);
                                Bitmap icon = mClusterIconGenerator.makeIcon(String.valueOf(cluster.getSize() > 99 ? "99+" : cluster.getSize()));
                                markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
                            }
                        });

                if (i == 4) break;
            }
            Bitmap icon = mClusterIconGenerator.makeIcon(String.valueOf(cluster.getSize()));
            markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
        }

mdtuyen avatar Nov 11 '15 23:11 mdtuyen

When I zoom mapview, I check markerOptions.getPosition() and cluster.getPosition() with one cluster on map, why sometime it is difference ?

mdtuyen avatar Nov 13 '15 06:11 mdtuyen

@mdtuyen any solution for this

Kaushik1502 avatar Dec 15 '16 05:12 Kaushik1502

This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!

stale[bot] avatar Oct 03 '19 13:10 stale[bot]

Closing this. Please reopen if you believe it should be addressed. Thank you for your contribution.

stale[bot] avatar Nov 02 '19 13:11 stale[bot]