Comments (1)
백문이 불여일견 제가 직접 변경해보았습니다.
val `this` = this@SignUpActivity
viewModel.run {
showLoadingDialogEvent.observe(`this`, Observer { LoadingDialog.show(supportFragmentManager) })
hideLoadingDialogEvent.observe(`this`, Observer { LoadingDialog.hide() })
finishActivityEvent.observe(`this`, Observer { finish() })
toastEvent.observe(`this`, Observer { toast(it) })
signUpLogEvent.observe(`this`, Observer { Analytics.logEvent(`this`, Analytics.SIGN_UP, it) })
}
위 코드에서 볼 수 있듯이 Analytics.logEvent 에는 context가 들어가지만 this@SignUpActivity를 통해 Context를 넘겨줄 수 있습니다.
그래서 lifeCycleOwner로만 this가 사용되지 않는 사실을 확인할 수 있습니다.
하지만 this라는 이름의 변수는 선언할 수 없습니다.
그래서 다양한 이름 중 `this`로 결정했습니다.
` ` 로 감싸주면 기본 신택스도 변수이름으로 사용할 수 있습니다.
실제로 적용해보니 생각보다 느낌있네요.
그래서 모두 변경하려고 합니다.
감사합니다
from dsmmarket.
Related Issues (13)
- UI test code
- README.md 피카소 안쓰잖아요 HOT 1
- 회원가입 불가 issue HOT 1
- Post Detail onResume() HOT 2
- 댓글 신고 HOT 2
- 댓글 개수가 갱신이 되지 않습니다 HOT 1
- activity 무한 중첩 HOT 1
- 채팅 HOT 2
- Hey hey, Do you know dark theme issue In your App? HOT 1
- 다크테마로 변경할 때 BottomNavigationView
- BNV reselected issue HOT 1
- 아이템이 없을 때 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dsmmarket.