Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activity Code Zero, ViewModel 과 ViewHolder 의존 관계 Zero 도전하기 #13

Merged
merged 63 commits into from Mar 19, 2022

Conversation

sieunju
Copy link
Owner

@sieunju sieunju commented Mar 19, 2022

Name

Activity Code Zero, ViewModel 과 ViewHolder 의존 관계 Zero 도전하기

추가 내용

sieunju and others added 30 commits January 16, 2022 17:22
- LifecycleController 추가
- RxLifecycle 추가
- DataBinding 추가추가
- Fragment Destroy View 가 됐을때 LifecycleOwner 에 대한 처리
- 로그인 매니저에서 토큰을 받았을때 이벤트들를 전달하기 위해 RxBusEvent 생성
- 테스트 페이지 추가
- 자주 사용하는 클래스라서 정적으로 변경
- DiffUtilㅣ 를 유지보수 하기 쉽게 처리 할수 있는 방안에 대해서 고민한 클래스 추가
- 퍼포먼스 함수가 다 같은 DiffUtil 바라보는 이슈 수정
- instanceOf 중복 검사하는 부분 개선
- LifecycleController 추가
- RxLifecycle 추가
sieunju and others added 25 commits March 5, 2022 15:17
…feature/mvvm_lifecycle

* 'feature/mvvm_lifecycle' of github.com:sieunju/TIL: (23 commits)
  chore: 금일 작업 반영
  refactor: Gradle 버전 업데이트
  chore: 오늘 공부하고 작업한 내용 반영
  feat: MVVM Lifecycle 오늘 공부한 내용 반영 - 로그인 매니저에서 토큰을 받았을때 이벤트들를 전달하기 위해 RxBusEvent 생성 - 테스트 페이지 추가
  chore: Lifecycle 로직 수정
  test: Timber 로그 스텍 수정
  chore: Fragment 로직 수정 - Fragment Destroy View 가 됐을때 LifecycleOwner 에 대한 처리
  refactor: BaseActivity, BaseFragment - DataBinding 추가추가
  feat: RxBus 모듈 추가
  chore: JLogger 제거 - LifecycleController 추가 - RxLifecycle 추가
  feat: Timber 라이브러리 추가
  feat: BaseActivity, BaseFragment 추가
  refactor: Gradle Plugin 버전 업데이트
  style: 누락된 ktlint 스타일 적용
  Update README.md
  Update README.md
  chore: IsBetterDiffUtil 로직 개선 - instanceOf 중복 검사하는 부분 개선
  test: 로그 노출 방식 변경
  test: 테스트 케이스 추가 더미 모델 50개 추가 - 퍼포먼스 함수가 다 같은 DiffUtil 바라보는 이슈 수정
  feat: DiffUtil.Callback() 개선 - DiffUtilㅣ 를 유지보수 하기 쉽게 처리 할수 있는 방안에 대해서 고민한 클래스 추가
  ...
- Annotation Class 로 처리하는 방안 추가
- Fragment 에서 onViewCreated 에서도 처리할수 있는 Annotation Class 추가
- RxLifecycle, LifecycleController Deprecated 처리
- 인라인 함수로 performOnCreate..onStoped 함수들 하나로 통일
- onActivityResult, onPermissionsResult 사용할수 있는 Annotation 함수 추가
- ActivityResult 를 ViewModel 에서 간단하게 Annotation 함수로 받을수 있게 처리
- PermissionResult 를 ViewModel 에서 간단하게 Annotation 함수를 받을수 있게 처리

ViewModel 안에 함수를 실제로 어디서 사용하는게 아니다 보니 회색으로 표시되는 이슈가 있음..
이거 어떻게 안되나?? 고민해봐야할듯...
이로서...액티비티에서 해야할 웬만한 동작들을 ViewModel 에서 처리할수 있도록 만들어진거 같음.
Activity 코드 0 만들기...80% 도착...
- 현재는 테스트및 검증이 끝났으니 70개 정도 주석 처리함
- 원인은 디컴파일할때 if if if if if 로 됨
…com:sieunju/TIL into feature/dev_simple_recyclerview_performance

* 'feature/dev_simple_recyclerview_performance' of github.com:sieunju/TIL:
  test: 퍼포먼스 테스트 코드 추가
  chore: ViewHolder 가 onDetach 상태인경우 dipose 처리  (누락된 코드)
@sieunju sieunju added feature 기능 추가 & 공부한내용 refactor 리펙토링 labels Mar 19, 2022
@sieunju sieunju self-assigned this Mar 19, 2022
@sieunju sieunju merged commit df8fb0b into master Mar 19, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

ktlint

android/presentation/src/main/java/com/hmju/presentation/lifecycle/RxLifecycle.kt|45 col 11| Missing spacing after "if"
android/presentation/src/main/java/com/hmju/presentation/lifecycle/RxLifecycle.kt|51 col 11| Missing spacing after "if"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/LifecycleViewModel.kt|7 col 1| Wildcard import (cannot be auto-corrected)
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/LifecycleViewModel.kt|12 col 1| Unused import
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/LifecycleViewModel.kt|15 col 1| Unused import
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/LifecycleViewModel.kt|16 col 1| Unused import
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/LifecycleViewModel.kt|86 col 1| Unexpected blank line(s) before "}"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleFragment.kt|4 col 1| Unused import
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleFragment.kt|5 col 1| Unused import
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleFragment.kt|6 col 1| Unused import
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest2ViewModel.kt|53 col 1| Unexpected blank line(s) before "}"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest2ViewModel.kt|63 col 48| Missing spacing after ","
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest2ViewModel.kt|64 col 42| Missing spacing after ","
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest2ViewModel.kt|71 col 27| Unexpected spacing before ":"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest2ViewModel.kt|71 col 37| Missing spacing before "{"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest2ViewModel.kt|74 col 38| Missing spacing before "->"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3Activity.kt|1 col 1| File must end with a newline (\n)
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3Activity.kt|6 col 1| Unused import
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3Activity.kt|15 col 1| Unexpected indentation (8) (should be 4)
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3Activity.kt|31 col 11| Missing spacing after "if"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3Fragment.kt|1 col 1| File must end with a newline (\n)
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3Fragment.kt|6 col 1| Unused import
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3Fragment.kt|21 col 72| Missing spacing after ","
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3Fragment.kt|22 col 31| Missing newline before ")"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3Fragment.kt|31 col 40| Missing spacing after ","
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3Fragment.kt|37 col 44| Missing spacing after ","
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3FragmentViewModel.kt|1 col 1| File must end with a newline (\n)
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3FragmentViewModel.kt|21 col 20| Unexpected spacing before ":"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3FragmentViewModel.kt|24 col 21| Missing spacing before "{"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3FragmentViewModel.kt|29 col 22| Missing spacing before "{"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3FragmentViewModel.kt|34 col 19| Missing spacing before "{"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3ViewModel.kt|1 col 1| File must end with a newline (\n)
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3ViewModel.kt|49 col 24| Missing newline after "("
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3ViewModel.kt|51 col 9| Missing newline before ")"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3ViewModel.kt|68 col 18| Missing newline after "("
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest3ViewModel.kt|73 col 9| Missing newline before ")"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTest4Fragment.kt|1 col 1| File must end with a newline (\n)
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTestFragment.kt|1 col 1| File must end with a newline (\n)
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTestFragment.kt|23 col 1| Unexpected blank line(s) before "}"
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTestViewModel.kt|7 col 1| Wildcard import (cannot be auto-corrected)
android/presentation/src/main/java/com/hmju/presentation/mvvm_lifecycle/MvvmLifecycleTestViewModel.kt|101 col 1| Unexpected blank line(s) before "}"
android/presentation/src/main/java/com/hmju/presentation/simple_like_recyclerview/SimpleLike3ViewHolder.kt|1 col 1| File must end with a newline (\n)
android/presentation/src/main/java/com/hmju/presentation/simple_like_recyclerview/SimpleLike4ViewHolder.kt|1 col 1| File must end with a newline (\n)
android/rxbus/src/androidTest/java/com/til/rxbus/ExampleInstrumentedTest.kt|1 col 1| File must end with a newline (\n)
android/rxbus/src/androidTest/java/com/til/rxbus/ExampleInstrumentedTest.kt|3 col 1| Imports must be ordered in lexicographic order without any empty lines in-between with "java", "javax", "kotlin" and aliases in the end
android/rxbus/src/androidTest/java/com/til/rxbus/ExampleInstrumentedTest.kt|9 col 1| Wildcard import (cannot be auto-corrected)
android/rxbus/src/main/java/com/til/rxbus/LoginBusEvent.kt|1 col 1| File must end with a newline (\n)
android/rxbus/src/main/java/com/til/rxbus/RxBusEvent.kt|1 col 1| File must end with a newline (\n)
android/rxbus/src/main/java/com/til/rxbus/RxBusEvent.kt|16 col 33| Unexpected spacing before ":"
android/rxbus/src/main/java/com/til/rxbus/TestBusEvent.kt|1 col 1| File must end with a newline (\n)
android/rxbus/src/main/java/com/til/rxbus/TestBusEvent.kt|4 col 1| Unused import
android/rxbus/src/main/java/com/til/rxbus/TestBusEvent.kt|15 col 21| Unexpected spacing before ":"
android/rxbus/src/test/java/com/til/rxbus/ExampleUnitTest.kt|1 col 1| File must end with a newline (\n)
android/rxbus/src/test/java/com/til/rxbus/ExampleUnitTest.kt|3 col 1| Imports must be ordered in lexicographic order without any empty lines in-between with "java", "javax", "kotlin" and aliases in the end
android/rxbus/src/test/java/com/til/rxbus/ExampleUnitTest.kt|5 col 1| Wildcard import (cannot be auto-corrected)

private fun initTimber() {
// if (BuildConfig.DEBUG) {
Timber.plant(object : Timber.DebugTree() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [ktlint] reported by reviewdog 🐶
Unexpected indentation (12) (should be 8)

Timber.plant(object : Timber.DebugTree() {

override fun createStackElementTag(element: StackTraceElement): String {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [ktlint] reported by reviewdog 🐶
Unexpected indentation (16) (should be 12)


override fun createStackElementTag(element: StackTraceElement): String {
return "Timber_${element.methodName.substringBeforeLast(".")}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [ktlint] reported by reviewdog 🐶
Unexpected indentation (20) (should be 16)

override fun createStackElementTag(element: StackTraceElement): String {
return "Timber_${element.methodName.substringBeforeLast(".")}"
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [ktlint] reported by reviewdog 🐶
Unexpected indentation (16) (should be 12)

return "Timber_${element.methodName.substringBeforeLast(".")}"
}
})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [ktlint] reported by reviewdog 🐶
Unexpected indentation (12) (should be 8)

.subscribe({ pair ->
pair.first.invoke(this, pair.second)
}, {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [ktlint] reported by reviewdog 🐶
Unexpected blank line(s) before "}"

}, {

})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [ktlint] reported by reviewdog 🐶
Unexpected blank line(s) before "}"

@@ -0,0 +1,65 @@
package com.hmju.presentation.lifecycle

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [ktlint] reported by reviewdog 🐶
File must end with a newline (\n)

@@ -0,0 +1,55 @@
package com.hmju.presentation.lifecycle

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [ktlint] reported by reviewdog 🐶
File must end with a newline (\n)

package com.hmju.presentation.lifecycle

import io.reactivex.rxjava3.disposables.Disposable
import timber.log.Timber

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [ktlint] reported by reviewdog 🐶
Unused import

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 기능 추가 & 공부한내용 refactor 리펙토링
Projects
None yet
1 participant