-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from AlanCheen/feature/dsl
Feature/dsl
- Loading branch information
Showing
14 changed files
with
289 additions
and
66 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
37 changes: 37 additions & 0 deletions
37
app/src/main/java/me/yifeiyuan/flapdev/GitHubDemoFragment.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,37 @@ | ||
package me.yifeiyuan.flapdev | ||
|
||
import android.view.View | ||
import me.yifeiyuan.flap.delegate.makeDelegate | ||
import me.yifeiyuan.flap.ext.bindTextView | ||
import me.yifeiyuan.flapdev.components.SimpleTextModel | ||
import me.yifeiyuan.flapdev.showcase.BaseTestcaseFragment | ||
|
||
/** | ||
* GitHub 代码示例 | ||
* | ||
* Created by 程序亦非猿 on 2022/8/9. | ||
*/ | ||
class GitHubDemoFragment : BaseTestcaseFragment() { | ||
|
||
override fun onInit(view: View) { | ||
super.onInit(view) | ||
|
||
val simpleTextDelegate = makeDelegate<SimpleTextModel>(R.layout.flap_item_simple_text) { | ||
onBind { model -> | ||
bindTextView(R.id.tv_content) { | ||
text = model.content | ||
} | ||
} | ||
} | ||
|
||
adapter.registerAdapterDelegate(simpleTextDelegate) | ||
|
||
val dataList = ArrayList<Any>() | ||
|
||
dataList.add(SimpleTextModel("Android")) | ||
dataList.add(SimpleTextModel("Java")) | ||
dataList.add(SimpleTextModel("Kotlin")) | ||
|
||
adapter.setData(dataList) | ||
} | ||
} |
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
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.