MaterialList icon indicating copy to clipboard operation
MaterialList copied to clipboard

image resizes on another card when dismissing BigImageButtonsCard

Open marijandbob opened this issue 9 years ago • 6 comments

Hi. I am having a problem with the BigImageButtonsProvider card. I created a bunch of test cards, and have set them all to "swipe to dismiss". When I dismiss a card that works ok, but the the image on another card gets re-sized to be about twice as large. The card that gets messed up is usually the card below the one which was dismissed, also, sometimes more than one card has it's image resized. maybe every 4th card?

In order to demonstrate the problem, I modified your demo program which was included in the downloaded source. There are the main changes to the program:

first, I always want to get a BigImageButtonsProvider card - so I modified the switch statement in getRandomCard():

 //    switch (position % 6) {
        switch (1) {

then modify the case statement for case 1 to be a little simpler (no Picasso) make the card dismissible:

           case 1: {
                final BigImageButtonsCardProvider provider = new Card.Builder(this)
                        .setTag("BIG_IMAGE_CARD")
                        .withProvider(BigImageButtonsCardProvider.class)
                        .setTitle(title)
                        .setDescription(description)
                        .setDrawable(R.drawable.dog);
                       /*********************************
                        .setDrawable("https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png");
                        .setOnPicassoImageLoadingListener(new TextCardProvider.OnPicassoImageLoadingListener() {
                            @Override
                            public void onImageLoading(@NonNull final RequestCreator requestCreator) {
                                requestCreator.rotate(position * 45.0f)
                                        .resize(200, 200)
                                        .centerCrop();
                            }
                        });
                       *************************/
                        Card cc = provider
                                .endConfig()
                                .build();
                    cc.setDismissible(true);
                    return cc;
            }

the problem seems to occur whether the Picasso Image loader is used or not. Also, I prefer using the dog picture since it is available locally in the drawable directory, and that would be more like my use case.

Have I set this up incorrectly? Have I done something wrong?

Thanks in advance!

bob

marijandbob avatar Oct 06 '15 05:10 marijandbob

Also, maybe another clue (or not) - when the title text is wide it will overlay the image, in the cases I've observed the text overlays the image about 1/3 from the bottom.

thanks again. bob

marijandbob avatar Oct 06 '15 05:10 marijandbob

Hi. I figured out what's causing this problem. basically there are two simple changes that need to be made. the image rescaling problem taking the entire height of the card is due to: material_image_with_buttons_card.xml having this problem:

           <ImageView
                android:id="@+id/imageView"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
//layout_height should be wrap_content, not fill_parent.
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:adjustViewBounds="true"
                android:scaleType="centerCrop" />

the other problem is simply that the titleTextView did not have any layout_width or layout_height specified. I added them to my copy and now the layout works fine.

           <TextView
                android:id="@+id/titleTextView"
                style="@style/CardTitle"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/imageView"
                tools:text="Title" />

I have not reviewed the other card types to see if this is a problem elsewhere...

thanks bob

marijandbob avatar Oct 07 '15 18:10 marijandbob

i'm facing the same issue. How did you make the changes only on your copy?

soand avatar Oct 10 '15 00:10 soand

Since I also am impacted by bug #100 (dismissing first card), and my project deadline is approaching, I decided not to use the packaged library until new versions are released.

So, this is my own version of a "fork" for the time being until the changes get back into the main line of the code and I can thoroughly test the library.

Download the zip file from the front page of the project. Unpack it, import it into android studio, build it and make sure the demo works. Make the change I described in bug 100 (IMPORTANT! if you want to "dismiss" cards) and changes the various XMLs for this bug, rebuild and test to make sure everything's ok, and extract the library from the MaterialList Android Studio project and (try to) get Android Studio to recognize it in your project.

I had some troubles including the library in my project, so I'm pulling the code and the XMLs directly into my project, and changing them as necessary. When the changes to MaterialList catch up, I'll re-test, and refactor then delete the direct inclusion of MaterialList code and switch back to using the library.

If you have more questions, let me know.

Thanks. bob

marijandbob avatar Oct 10 '15 02:10 marijandbob

You're also free to use my fork. I've added new features and fixed the known bugs.

FHellmann avatar Oct 10 '15 16:10 FHellmann

Thanks, I'll check it out.

Bob


From: Fabio Hellmann [mailto:[email protected]] Sent: Saturday, October 10, 2015 12:46 PM To: dexafree/MaterialList Cc: marijandbob Subject: Re: [MaterialList] image resizes on another card when dismissing BigImageButtonsCard (#102)

You're also free to use my fork https://github.com/FHellmann/MaterialList . I've added new features and fixed the known bugs.

Reply to this email directly or view https://github.com/dexafree/MaterialList/issues/102#issuecomment-147105931 it on GitHub. <https://github.com/notifications/beacon/AMENKGXXYxLDeij9KRyAoyh-hV189-woks5 o6ThJgaJpZM4GJgc7.gif>

marijandbob avatar Oct 10 '15 20:10 marijandbob