-
Notifications
You must be signed in to change notification settings - Fork 698
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IDE-198 Create class EndBrick and use in Composite Bricks instead of …
…inner class (#4868)
- Loading branch information
Showing
12 changed files
with
102 additions
and
430 deletions.
There are no files selected for viewing
This file contains 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
64 changes: 64 additions & 0 deletions
64
catroid/src/main/java/org/catrobat/catroid/content/bricks/EndBrick.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Catroid: An on-device visual programming system for Android devices | ||
* Copyright (C) 2010-2023 The Catrobat Team | ||
* (<http://developer.catrobat.org/credits>) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* An additional term exception under section 7 of the GNU Affero | ||
* General Public License, version 3, is available at | ||
* http://developer.catrobat.org/license_additional_term | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.catrobat.catroid.content.bricks | ||
|
||
import org.catrobat.catroid.R | ||
import org.catrobat.catroid.content.Sprite | ||
import org.catrobat.catroid.content.actions.ScriptSequenceAction | ||
import java.util.UUID | ||
|
||
class EndBrick @JvmOverloads constructor( | ||
endBrickParent: BrickBaseType, | ||
private val viewResource: Int = R.layout.brick_loop_end | ||
) : BrickBaseType() { | ||
|
||
init { | ||
parent = endBrickParent | ||
} | ||
|
||
override fun getViewResource(): Int = viewResource | ||
|
||
override fun addActionToSequence(sprite: Sprite?, sequence: ScriptSequenceAction?) { | ||
// not needed for EndBricks, in case you need it for one, please be aware that changes | ||
// here will affect multiple composite bricks | ||
} | ||
|
||
override fun isCommentedOut(): Boolean = parent.isCommentedOut | ||
|
||
override fun consistsOfMultipleParts(): Boolean = true | ||
|
||
override fun getAllParts(): List<Brick?>? = parent.allParts | ||
|
||
override fun addToFlatList(bricks: List<Brick?>?) { | ||
parent.addToFlatList(bricks) | ||
} | ||
|
||
override fun getDragAndDropTargetList(): List<Brick?>? = | ||
parent.parent.dragAndDropTargetList | ||
|
||
override fun getPositionInDragAndDropTargetList(): Int = | ||
parent.parent.dragAndDropTargetList.indexOf(parent) | ||
|
||
override fun getBrickID(): UUID? = parent.brickID | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.