Marcell-Juhasz / secret-diary

0 stars 1 forks source link

remove hardcoded references to view ids #4

Closed RedJocker closed 2 years ago

RedJocker commented 2 years ago

We should avoid assuming as much as we can the implementation code. Hardcoded references like R.id.someViewId assumes that this id exists in the implementation code. If the implementationdoes not declare this we will get a build failure, which we want to avoid.

I've been using code like this for this purpose

https://github.com/RedJocker/fixCinemaRoomManager/blob/fixWithSolution/Cinema%20Room%20Manager/stage1/src/test/java/org/hyperskill/cinema/abstraction/Extensions.kt

You can copy this and replace the use of findViewById() with one of these find() methods. To use you just pass the viewId as a string like find("someViewId")

Marcell-Juhasz commented 2 years ago

Done