Skip to content
This repository was archived by the owner on Jan 27, 2025. It is now read-only.
This repository was archived by the owner on Jan 27, 2025. It is now read-only.

Eliminate Clones in AndroidGestureProcessor.java in onShowPress and onLongPress Methods Group 1 #79

@ZazibaAhmed

Description

@ZazibaAhmed

Describe the clone
The clone in file, AndroidGestureProcessor, consists of two methods, onShowPress and onLongPress, which perform almost identical actions for handling press events, differing only in the event type used.

Location of the clones
Starting at line Starting at line 96 of C:\jmonkeyengineFall2024\jme3-android\src\main\java\com\jme3\input\android\AndroidGestureProcessor.java
Starting at line 110 of C:\jmonkeyengineFall2024\jme3-android\src\main\java\com\jme3\input\android\AndroidGestureProcessor.java

Clone Type
Type #1 Clone

Expected outcome
The duplicate logic in onShowPress and onLongPress will be moved into a single method, pressEventHandler, which takes the event type as a parameter. This method will handle both types of press events, reducing code repetition.

Code before refactoring
Screenshot (124)
Screenshot (125)

Code after refactoring
Screenshot (126)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions