MaterialList icon indicating copy to clipboard operation
MaterialList copied to clipboard

How to get card config (card.getConfig)?

Open retf opened this issue 9 years ago • 4 comments

In last version, we have: card.getConfig();

E.g, if I have my custon card, and I want add some custom code, I did:

Card c1 = new Card.Builder(getActivity())
            .setTag("MY_CARD")
            .withProvider(SimplePhotoCard.class)
            .hideActionBar(true)
            .endConfig()
            .build();

    mListView.add(c1);

    SimplePhotoCard sp1 = (SimplePhotoCard) c1.getConfig();

    sp1.setOnTouchPhotoListener(new SimplePhotoCard.OnTouchPhotoListener() {
        @Override
        public void onTouch(View v) {
        }
    });

In the new version, how can I get it?

Thanks for help.

retf avatar Nov 11 '15 00:11 retf

You only need you use an object instead of a class type at the provider definition.

//...
.withProvider(new SimplePhotoCard())
//...

FHellmann avatar Nov 11 '15 06:11 FHellmann

Thanks for quick response.

The problem is that I have other case, where I store cars in a container, and then retrieve a Card and use getConfig.

In this case, the Class was intancied in other place.

Thanks again

retf avatar Nov 11 '15 10:11 retf

Now I got it. The getConfig() method was replaced by getProvider().

FHellmann avatar Nov 11 '15 10:11 FHellmann

Ok, thanks a lot! Nice lib!

retf avatar Nov 11 '15 10:11 retf