-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #11 : Add support for FrameLayout
- Loading branch information
1 parent
5ab09a0
commit bf61510
Showing
9 changed files
with
155 additions
and
1 deletion.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
recompose-ast/src/main/kotlin/recompose/ast/viewgroup/FrameLayoutNode.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,34 @@ | ||
/* | ||
* Copyright 2020 Sebastian Kaspari | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package recompose.ast.viewgroup | ||
|
||
import recompose.ast.ViewGroupNode | ||
import recompose.ast.attributes.ViewAttributes | ||
import recompose.ast.attributes.ViewGroupAttributes | ||
import recompose.visitor.Visitor | ||
|
||
/** | ||
* Data classs holding value of a parsed `FrameLayout` | ||
* | ||
* https://developer.android.com/reference/android/widget/FrameLayout | ||
*/ | ||
data class FrameLayoutNode( | ||
override val viewGroup: ViewGroupAttributes, | ||
override val view: ViewAttributes, | ||
) : ViewGroupNode { | ||
override fun accept(visitor: Visitor) = visitor.visitFrameLayout(this) | ||
} |
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
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
34 changes: 34 additions & 0 deletions
34
recompose-parser/src/main/kotlin/recompose/parser/xml/viewgroup/FrameLayout.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,34 @@ | ||
/* | ||
* Copyright 2020 Sebastian Kaspari | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package recompose.parser.xml.viewgroup | ||
|
||
import org.xmlpull.v1.XmlPullParser | ||
import recompose.ast.viewgroup.FrameLayoutNode | ||
import recompose.parser.xml.viewAttributes | ||
import recompose.parser.xml.viewGroupAttributes | ||
|
||
/** | ||
* Parses a `<FrameLayout> element. | ||
* | ||
* https://developer.android.com/reference/android/widget/FrameLayout | ||
*/ | ||
fun XmlPullParser.frameLayout(): FrameLayoutNode { | ||
return FrameLayoutNode( | ||
view = viewAttributes(), | ||
viewGroup = viewGroupAttributes() | ||
) | ||
} |
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
20 changes: 20 additions & 0 deletions
20
recompose-test/src/main/resources/framelayout-textview-button.xml
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,20 @@ | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:padding="16dp"> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:gravity="center" | ||
android:text="Center" | ||
android:textSize="20sp" /> | ||
|
||
<Button | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="bottom|center" | ||
android:gravity="bottom|center" | ||
android:text="Button" | ||
android:textSize="20sp" /> | ||
</FrameLayout> |