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
class MainViewModel(private val layoutCenterViewUsecase : LayoutCenterViewUsecase) { | |
val centerY = ObservableInt() | |
init { | |
layoutCenterViewUsecase.observe() | |
.subscribe { y : Int -> | |
centerY.set(y) | |
} | |
} |
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
@BindingAdapter({"bindUri", "bindImageLoader"}, requireAll = true) | |
fun loadImage(view: ImageView, uri : String, imageLoader : ImageLoader) { | |
imageLoader.load(uri).into(view) | |
} |
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
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
> | |
<data> | |
<variable | |
name="vm" | |
type="MainViewModel" |
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
class MainViewModelTest { | |
private lateinit var vm : MainViewModel | |
private lateinit var resourcesProvider : ResourcesProvider | |
@Setup | |
fun init() { | |
resourcesProvider = mock(ResourcesProvider::class) | |
vm = MainViewModelImpl(resourcesProvider) | |
} | |
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
class MainViewModel(private val resourcesProvider: ResourcesProvider) { | |
val name = ObservableField() | |
fun click() { | |
name.set(resourceProvider.getString(R.string.name_title)) | |
} | |
} |
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
class MainViewModel { | |
val visible = ObservableBoolean(false) | |
} |
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
class RoundImageView : ImageView { | |
private radious : Int | |
fun setRadious(rad : Int) { | |
this.radious = rad | |
} | |
// 이하 생략 | |
} |
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
class MainViewModel { | |
val scaleAndAlpha = ObservableField<ScaleAlpha>() | |
fun imageClick() { | |
scaleAndAlpha.set(ScaleAlpha(1f,1f)) | |
} | |
} |
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
class ItemAdapter : RecyclerView.Adapter() { | |
var items : List<Item> = emptyList() | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<layout | |
xmlns:android="http://schemas.android.com/apk/res/android"> | |
<!-- 데이터바인딩 정의 --> | |
<data> | |
<variable | |
name="vm" | |
type="MainViewModel" /> | |
</data> |