Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inflating in fragment #30

Open
parissakalaee opened this issue Jul 28, 2022 · 1 comment
Open

Inflating in fragment #30

parissakalaee opened this issue Jul 28, 2022 · 1 comment

Comments

@parissakalaee
Copy link

Hi there,

I wonder if it would be possible to use this EPG customview in a fragment? I was working all day long, but onDraw isn't be called in fragment, or I don't know how to manage that.

Any clue?

@parissakalaee
Copy link
Author

parissakalaee commented Jul 29, 2022

It is like this, onDraw is never called.

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        
        EPG epg = new EPG(container.getContext());
        epg.setEPGClickListener(new EPGClickListener() {
            @Override
            public void onChannelClicked(int channelPosition, EPGChannel epgChannel) {
                Toast.makeText(container.getContext(), epgChannel.getName() + " clicked", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onEventClicked(int channelPosition, int programPosition, EPGEvent epgEvent) {
                Toast.makeText(container.getContext(), epgEvent.getTitle() + " clicked", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onResetButtonClicked() {
                epg.recalculateAndRedraw(true);
            }
        });

        EPGData epgData = new EPGDataImpl(MockDataService.getMockData());
        epg.setEPGData(epgData);
        epg.recalculateAndRedraw(false);

        return epg;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant