IDE-109: Implement collapseable scripts and composite bricks#5196
Draft
harshsomankar123-tech wants to merge 2 commits intoCatrobat:developfrom
Draft
IDE-109: Implement collapseable scripts and composite bricks#5196harshsomankar123-tech wants to merge 2 commits intoCatrobat:developfrom
harshsomankar123-tech wants to merge 2 commits intoCatrobat:developfrom
Conversation
- Add transient collapsed state to Script and BrickBaseType - Add collapse/expand action mode with ALL checkboxes visible - Add context menu items for individual script/loop collapse - Add FrameLayout overlay collapse indicator (only shown when collapsed) - Filter collapsed CompositeBrick children from flat list - Add ic_collapse/ic_expand vector drawables - Add collapse_expand menu item to SpriteActivity
| updateItemsFromCurrentScripts() | ||
| } | ||
|
|
||
| private fun handleCheckBoxModeCollapseExpand(item: Brick) { |
| return R.drawable.ic_library_add_small; | ||
| case R.string.menu_rate_us: | ||
| return R.drawable.ic_star_rate; | ||
| case R.string.brick_context_dialog_collapse_script: |
| case R.string.brick_context_dialog_collapse_script: | ||
| case R.string.brick_context_dialog_collapse_brick: | ||
| return R.drawable.ic_collapse; | ||
| case R.string.brick_context_dialog_expand_script: |
| case R.id.comment_in_out: | ||
| startActionMode(COMMENT); | ||
| break; | ||
| case R.id.collapse_expand: |
| } | ||
| listView.highlightControlStructureBricks(positions); | ||
| break; | ||
| case R.string.brick_context_dialog_collapse_script: |
| brick.getScript().setCollapsed(true); | ||
| adapter.updateItems(ProjectManager.getInstance().getCurrentSprite()); | ||
| break; | ||
| case R.string.brick_context_dialog_expand_script: |
| brick.getScript().setCollapsed(false); | ||
| adapter.updateItems(ProjectManager.getInstance().getCurrentSprite()); | ||
| break; | ||
| case R.string.brick_context_dialog_collapse_brick: |
| ((BrickBaseType) brick).setCollapsed(true); | ||
| adapter.updateItems(ProjectManager.getInstance().getCurrentSprite()); | ||
| break; | ||
| case R.string.brick_context_dialog_expand_brick: |
| import android.widget.ImageView | ||
| import android.widget.LinearLayout | ||
| import androidx.annotation.IntDef | ||
| import androidx.core.content.ContextCompat |
| import android.widget.ImageView | ||
| import android.widget.LinearLayout | ||
| import androidx.annotation.IntDef | ||
| import androidx.core.content.ContextCompat |
| notifyDataSetChanged() | ||
| } | ||
|
|
||
| private fun filterCollapsedCompositeBricks() { |
| private fun filterCollapsedCompositeBricks() { | ||
| val filteredItems = ArrayList<Brick>() | ||
| squashedBricks.clear() | ||
|
|
| private fun filterCollapsedCompositeBricks() { | ||
| val filteredItems = ArrayList<Brick>() | ||
| squashedBricks.clear() | ||
|
|
| scaleType = ImageView.ScaleType.CENTER_INSIDE | ||
| val density = resources.displayMetrics.density | ||
| layoutParams = FrameLayout.LayoutParams( | ||
| (32 * density).toInt(), |
| val density = resources.displayMetrics.density | ||
| layoutParams = FrameLayout.LayoutParams( | ||
| (32 * density).toInt(), | ||
| (32 * density).toInt() |
| (32 * density).toInt() | ||
| ).apply { | ||
| gravity = Gravity.END or Gravity.CENTER_VERTICAL | ||
| marginEnd = (8 * density).toInt() |
| marginEnd = (8 * density).toInt() | ||
| } | ||
| setColorFilter(Color.WHITE) | ||
| alpha = if (isCollapsed) 0.8f else 0.5f |
| marginEnd = (8 * density).toInt() | ||
| } | ||
| setColorFilter(Color.WHITE) | ||
| alpha = if (isCollapsed) 0.8f else 0.5f |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Jira Ticket::[(https://catrobat.atlassian.net/browse/IDE-109)]
Summary of Changes:
This pull request introduces the ability to collapse and expand Scripts and Composite Bricks (such as loops) within the workspace. This enhancement significantly improves project navigation and code readability by allowing users to temporarily hide complex or lengthy blocks of logic.
Key Technical Implementations:
collapsedstate to bothScriptandBrickBaseTypeto track visibility without permanently altering the project model.CompositeBrickitems from the flat list.collapse_expandmenu option into theSpriteActivity.FrameLayoutoverlay to serve as a visual indicator, which is strictly displayed only when an item is in its collapsed state.ic_collapseandic_expandvector drawables to support the UI updates.Your checklist for this pull request
Please review the contributing guidelines and wiki pages of this repository.