Skip to content

IDE-51 Extend "Search" feature to names of scenes, groups, objects, looks, and sounds#5057

Open
p0dlunsek wants to merge 1 commit intoCatrobat:developfrom
p0dlunsek:IDE-51
Open

IDE-51 Extend "Search" feature to names of scenes, groups, objects, looks, and sounds#5057
p0dlunsek wants to merge 1 commit intoCatrobat:developfrom
p0dlunsek:IDE-51

Conversation

@p0dlunsek
Copy link
Copy Markdown
Contributor

@p0dlunsek p0dlunsek commented Dec 16, 2024

  • Implemented string search across scenes, objects, scripts, looks, and sounds
  • Search is accessible via overflow menu in all views
  • Result navigation keeps user in context (back leads to previous view)
  • Search starts from current object or view and continues through all project content
  • Search proceeds only from higher to lower hierarchy, not in reverse (e.g., from object to its scripts, but not from script to object)

https://catrobat.atlassian.net/jira/software/c/projects/IDE/boards/124?selectedIssue=IDE-51

  • Include the name of the Jira ticket in the PR’s title
  • Include a summary of the changes plus the relevant context
  • Choose the proper base branch (develop)
  • Confirm that the changes follow the project’s coding guidelines
  • Verify that the changes generate no compiler or linter warnings
  • Perform a self-review of the changes
  • Verify to commit no other files than the intentionally changed ones
  • Include reasonable and readable tests verifying the added or changed behavior
  • Confirm that new and existing unit tests pass locally
  • Check that the commits’ message style matches the project’s guideline
  • Stick to the project’s gitflow workflow
  • Verify that your changes do not have any conflicts with the base branch
  • After the PR, verify that all CI checks have passed
  • Post a message in the catroid-stage or catroid-ide Slack channel and ask for a code reviewer

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
9.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@juliajulie95 juliajulie95 marked this pull request as draft May 2, 2025 09:53
@juliajulie95
Copy link
Copy Markdown
Contributor

Please keep as draft until finished

@p0dlunsek p0dlunsek changed the title Ide 51 IDE-51 Extend "Search" feature to names of scenes, groups, objects, looks, and sounds May 11, 2025
@p0dlunsek p0dlunsek marked this pull request as ready for review May 21, 2025 18:23
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 7, 2025

@p0dlunsek p0dlunsek force-pushed the IDE-51 branch 2 times, most recently from df25d07 to 81fe8b7 Compare September 4, 2025 14:38
@sonarqubecloud
Copy link
Copy Markdown

@reichli reichli added the Active Member Tickets that are assigned to members that are still currently active label Dec 25, 2025
Copy link
Copy Markdown
Contributor

@reichli reichli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!

I tested the functionality and it works.

Most comments I have are about code structure and simplification:

  • I left some suggestions on how the code could be simplified as review comments. Please have a look at them and let me know if they do not work with your current solution or are impractical for any other reason.
  • Please rebase the branch ontop of the most recent develop-branch.
  • I also some some inconsistent formatting across the files (newlines, spaces, structuring of if/else-blocks). Please use the Android Studio Formatter on all files that you touched in this PR. many of those formatting inconsistencies also show up during linting (Checkstyle, SonarCube).

if(isThisFoundObject(position)){
highlightTheFoundObject(holder);
}
else{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run the Android Studio Formatter on changes like this (correct formatting of if/else-blocks and brackets) and others in all touched files of this PR.

* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package org.catrobat.catroid.test.ui
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this test to the espresso-package

FinderDataManager.instance.currentMatchIndex = brickIndex

when (type) {
1 -> activity.onBackPressed()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the enum values (FinderDataManager.FragmentType.SCENE) instead of integers. This makes the code way more comprehensible. This appears multiple times in the PR, not just in this file.


private var initiatingfragment:FragmentType = FragmentType.NONE
private var initiatingPosition = arrayOf(-1,-1,-1)
private var searchResults = mutableListOf<Array<Int>>()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you thought about creating a simple java class (like a c++ struct) for the search results instead of using integer arrays? This would make the code more readable in many places and potentially simpler.
We could also simplify the interface OnResultFoundListener.onResultFound, use equality-checks to check whether a search result already exists in Finder, etc.

result.let {
FinderDataManager.instance.getSearchResults().size.let { it1 ->
onResultFoundListener?.onResultFound(
it[0], it[1], it[2],it[3], it1,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section's readability would greatly profit from using an java object to represent a search result instead of integers arrays.

private val searchResultsNames = mutableListOf<String>()
private var searchResultIndex = -1
private var searchQuery: String? = null
private var searchOrder = arrayOf(1,2,3,4,5)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for this variable? Currently the search order in Finder is constant


interface OnResultFoundListener {
fun onResultFound(
sceneIndex: Int,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions that might make sense to simplify the code:

  • totalResults apparently is never used -> please remove
  • I think the name brickIndex should be changed to something else, since bricks aren't the only entity that can be found (maybe elementIndex?).
  • change type from Int to FragmentType?
  • If we have a own class for the search result, all these parameters can be collapsed into one.

Copy link
Copy Markdown

@github-advanced-security github-advanced-security AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkstyle found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Copy Markdown

@github-advanced-security github-advanced-security AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detekt found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Comment thread catroid/src/main/java/org/catrobat/catroid/ui/Finder.kt Fixed
}

val isClosed: Boolean
get() = visibility == GONE

Check warning

Code scanning / Android Lint

Use KTX extension function Warning

Use the KTX extension property View.isGone instead?
case R.id.merge:
startActionMode(MERGE);
break;
case R.id.find:

Check warning

Code scanning / Android Lint

Checks use of resource IDs in places requiring constants Warning

Resource IDs will be non-final by default in Android Gradle Plugin version 8.0, avoid using them in switch case statements
} else {
textView?.text = createActionBarTitle()
initializeAdapter()
adapter.notifyDataSetChanged()

Check warning

Code scanning / Android Lint

Invalidating All RecyclerView Data Warning

It will always be more efficient to use more specific change events if you can. Rely on notifyDataSetChanged as a last resort.
Comment thread catroid/src/main/java/org/catrobat/catroid/ui/Finder.kt Fixed
@p0dlunsek p0dlunsek force-pushed the IDE-51 branch 2 times, most recently from fcd2763 to be1b068 Compare February 21, 2026 09:33
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Active Member Tickets that are assigned to members that are still currently active

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants