Skip to content

Use Interface Callbacks to reduce Coupling between Activity and Fragments and reduce the lines of code #2108

Closed
@abhishekbisht1429

Description

@abhishekbisht1429

Actual Behaviour
PsLabSensor directly calls methods from fragments such as LuxMeterDataFragment, SoundMeterFragment etc, which increases coupling and also increases lines of codes in the onOptionItemSelected() method of PsLabSensor. In addition it increases chances of introducing bugs when new sensors are implemented.

Expected Behaviour
Interface callbacks can be used to reduce the coupling between PsLabSensor and other data fragments. We can define a interface with common set of methods such as play(), stop(), pause(), resume() etc and have the fragments implement this interface.

Steps to reproduce it
N/A

LogCat for the issue

N/A

Screenshots of the issue
The lines of codes below are redundant.
coupling_issue

Would you like to work on the issue?
Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions