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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
5199199
chore: ViewHolder 가 onDetach 상태인경우 dipose 처리 (누락된 코드)
sieunju Jan 16, 2022
0f3474f
test: 퍼포먼스 테스트 코드 추가
sieunju Jan 18, 2022
aa17c2f
style: 누락된 ktlint 스타일 적용
sieunju Feb 26, 2022
fe57d2c
refactor: Gradle Plugin 버전 업데이트
sieunju Feb 26, 2022
9533beb
feat: BaseActivity, BaseFragment 추가
sieunju Feb 26, 2022
d7a5519
feat: Timber 라이브러리 추가
sieunju Feb 26, 2022
5848307
chore: JLogger 제거
sieunju Feb 27, 2022
f4302d6
feat: RxBus 모듈 추가
sieunju Feb 27, 2022
41a3435
refactor: BaseActivity, BaseFragment
sieunju Feb 27, 2022
656551a
chore: Fragment 로직 수정
sieunju Feb 27, 2022
3befa4c
test: Timber 로그 스텍 수정
sieunju Feb 27, 2022
c56f420
chore: Lifecycle 로직 수정
sieunju Feb 27, 2022
0934823
feat: MVVM Lifecycle 오늘 공부한 내용 반영
sieunju Feb 27, 2022
ecdae40
chore: 오늘 공부하고 작업한 내용 반영
sieunju Feb 27, 2022
392beea
refactor: Gradle 버전 업데이트
sieunju Mar 1, 2022
5a65145
chore: 금일 작업 반영
sieunju Mar 5, 2022
1759823
chore: BaseDiffUtil 클래스 정적으로 변경
sieunju Feb 18, 2022
ed78392
Update android-pull-request.yml
sieunju Feb 16, 2022
37f3398
chore: 주석 잘못 작성한거 제거
sieunju Feb 18, 2022
1b11ffe
feat: DiffUtil.Callback() 개선
sieunju Feb 19, 2022
cfb82e9
test: 테스트 케이스 추가 더미 모델 50개 추가
sieunju Feb 19, 2022
dd6efd7
test: 로그 노출 방식 변경
sieunju Feb 19, 2022
e88739e
chore: IsBetterDiffUtil 로직 개선
sieunju Feb 19, 2022
c22aecb
Update README.md
sieunju Feb 20, 2022
0f610a7
Update README.md
sieunju Feb 26, 2022
e012a01
style: 누락된 ktlint 스타일 적용
sieunju Feb 26, 2022
d281921
refactor: Gradle Plugin 버전 업데이트
sieunju Feb 26, 2022
667c6a2
feat: BaseActivity, BaseFragment 추가
sieunju Feb 26, 2022
50e848d
feat: Timber 라이브러리 추가
sieunju Feb 26, 2022
db1dd9f
chore: JLogger 제거
sieunju Feb 27, 2022
160af9b
feat: RxBus 모듈 추가
sieunju Feb 27, 2022
8eea175
refactor: BaseActivity, BaseFragment
sieunju Feb 27, 2022
96938b4
chore: Fragment 로직 수정
sieunju Feb 27, 2022
7a56b9d
test: Timber 로그 스텍 수정
sieunju Feb 27, 2022
c55759c
chore: Lifecycle 로직 수정
sieunju Feb 27, 2022
1cfafbf
feat: MVVM Lifecycle 오늘 공부한 내용 반영
sieunju Feb 27, 2022
5580954
chore: 오늘 공부하고 작업한 내용 반영
sieunju Feb 27, 2022
e7f6446
refactor: Gradle 버전 업데이트
sieunju Mar 1, 2022
2583907
chore: 금일 작업 반영
sieunju Mar 5, 2022
1f587ba
Merge branch 'feature/mvvm_lifecycle' of github.com:sieunju/TIL into …
sieunju Mar 5, 2022
5089cd6
test: 테스트
sieunju Mar 5, 2022
751a862
feat: ViewModel에서 Lifecycle 적용해보기
sieunju Mar 9, 2022
707dc27
feat: ViewModel에서 Lifecycle 적용해보기
sieunju Mar 9, 2022
5188db0
feat: lifecycle 모듈 추가
sieunju Mar 11, 2022
68a0bad
feat: 테스트 페이지 추가
sieunju Mar 11, 2022
c19e97e
feat: StartActivity 를 하기 위한 인텐트 데이터 모델 추가
sieunju Mar 11, 2022
5e04461
feat: BaseActivity, BaseFragment 에 StartActivity를 처리할 함수 로직 추가
sieunju Mar 11, 2022
2e96e30
chore: BaseActivity, BaseFragment 에 StartActivity를 처리할 함수 로직 추가
sieunju Mar 12, 2022
639c014
feat: registerForActivityResult ActivityResult 처리하는 로직 추가
sieunju Mar 12, 2022
29e799e
feat: 금일 작업한거 추가
sieunju Mar 12, 2022
7efd7b5
fix: 잘못된 부분 원복 처리
sieunju Mar 12, 2022
18ccd78
feat: 권한에 대한 Annotation 로직 함수 추가
sieunju Mar 15, 2022
8208b73
refactor: Lifecycle Rx 스타일로 개선
sieunju Mar 15, 2022
63bef4b
refactor: permissionResult Rx 적용
sieunju Mar 16, 2022
3527256
feat: Fragment onHiddenChanged 에서 hidden -> false 일때 처리할수 있는 OnFragme…
sieunju Mar 16, 2022
057fee0
feat: MVVM Lifecycle 테스트 페이지들 추가
sieunju Mar 17, 2022
653ff4c
chore: 코드 정리
sieunju Mar 18, 2022
905088c
Merge pull request #12 from sieunju/feature/mvvm_lifecycle
sieunju Mar 18, 2022
c603e4b
Update README.md
sieunju Mar 18, 2022
36c7f7b
fix: DiffUtil 레거시한버전 yml 실행시 에러가 발생하는 부분..
sieunju Mar 19, 2022
e0ac55f
chore: ViewHolder 가 onDetach 상태인경우 dipose 처리 (누락된 코드)
sieunju Jan 16, 2022
29f07d1
test: 퍼포먼스 테스트 코드 추가
sieunju Jan 18, 2022
97c84bf
Merge branch 'feature/dev_simple_recyclerview_performance' of github.…
sieunju Mar 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
- [Github Action으로 라이브러리 배포 돌려보기](https://github.com/sieunju/TIL/wiki/Github-Action%EC%9C%BC%EB%A1%9C-%EB%9D%BC%EC%9D%B4%EB%B8%8C%EB%9F%AC%EB%A6%AC-%EB%B0%B0%ED%8F%AC-%EB%8F%8C%EB%A0%A4%EB%B3%B4%EA%B8%B0)

- Lifecycle
- [MVVM Lifecycle 의존하여 관리해보기](https://github.com/sieunju/TIL/wiki/ViewModel-%EC%97%90%EC%84%9C-Lifecycle-%EC%9D%98%EC%A1%B4%ED%95%98%EC%97%AC-%EA%B4%80%EB%A6%AC%ED%95%B4%EB%B3%B4%EA%B8%B0)
- [MVVM Lifecycle 의존하여 관리해보기, Activity 코드 제로에 도전해보기](https://github.com/sieunju/TIL/wiki/ViewModel-%EC%97%90%EC%84%9C-Lifecycle-%EC%9D%98%EC%A1%B4%ED%95%98%EC%97%AC-%EA%B4%80%EB%A6%AC%ED%95%B4%EB%B3%B4%EA%B8%B0)

20 changes: 13 additions & 7 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ plugins {
}

android {
compileSdkVersion(Apps.compileSdkVersion)
buildToolsVersion(Apps.buildToolsVersion)
compileSdk = Apps.compileSdkVersion
buildToolsVersion = Apps.buildToolsVersion

defaultConfig {
applicationId = "com.hmju.til"
minSdkVersion(Apps.minSdkVersion)
targetSdkVersion(Apps.targetSdkVersion)
minSdk = Apps.minSdkVersion
targetSdk = Apps.targetSdkVersion
versionCode = Apps.versionCode
versionName = Apps.versionName
setProperty("archivesBaseName", "til_${versionCode}_${versionName}")
Expand All @@ -33,11 +33,11 @@ android {
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11"
}
buildFeatures {
dataBinding = true
Expand All @@ -50,6 +50,7 @@ dependencies {
implementation(project(path = ":domain"))
implementation(project(path = ":loginmanager"))
implementation(project(path = ":presentation"))
implementation(project(path = ":rxbus"))

/**
* Network
Expand Down Expand Up @@ -88,6 +89,11 @@ dependencies {
implementation(Rx.java)
implementation(Rx.kotlin)

/**
* Timber
*/
implementation(Log.timber)

testImplementation(UnitTest.junit)
androidTestImplementation(UnitTest.androidXJunit)
androidTestImplementation(UnitTest.Espresso.core)
Expand Down
96 changes: 78 additions & 18 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,81 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
# 소스 파일, 라인정보 유지
-keepattributes SourceFile,LineNumberTable
# Remove Log Disable
#-assumenosideeffects class android.util.Log {
# public static int d(...);
# public static int e(...);
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
#[s] Kotlinx Serialization ========================================================================
-keepattributes *Annotation*, InnerClasses
-dontnote kotlinx.serialization.AnnotationsKt # core serialization annotations

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# kotlinx-serialization-json specific. Add this if you have java.lang.NoClassDefFoundError kotlinx.serialization.json.JsonObjectSerializer
-keepclassmembers class kotlinx.serialization.json.** {
*** Companion;
}
-keepclasseswithmembers class kotlinx.serialization.json.** {
kotlinx.serialization.KSerializer serializer(...);
}

# Change here com.yourcompany.yourpackage
-keep,includedescriptorclasses class com.til.model.**$$serializer { *; } # <-- change package name to your app's
-keepclassmembers class com.til.model.** { # <-- change package name to your app's
*** Companion;
}
-keepclasseswithmembers class com.til.model.** { # <-- change package name to your app's
kotlinx.serialization.KSerializer serializer(...);
}
#[e] Kotlinx Serialization ===================================================================

# [s] Retrofit Proguard ===========================================================================
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod

# Retrofit does reflection on method and parameter annotations.
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations

# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}

# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

# Ignore JSR 305 annotations for embedding nullability information.
-dontwarn javax.annotation.**

# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit

# Top-level functions that can only be used by Kotlin.
-dontwarn retrofit2.KotlinExtensions
-dontwarn retrofit2.KotlinExtensions$*

# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>
# [e] Retrofit Proguard ===========================================================================

# [s] Glide Proguard ==============================================================================
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep class * extends com.bumptech.glide.module.AppGlideModule {
<init>(...);
}
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder.InternalRewinder {
*** rewind();
}
#-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
# *** rewind();
#}

# for DexGuard only Error
#-keepresourcexmlelements manifest/application/meta-data@value=GlideModule
# [e] Glide Proguard ==============================================================================
18 changes: 16 additions & 2 deletions android/app/src/main/java/com/hmju/til/MainApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.multidex.MultiDexApplication
import dagger.hilt.android.HiltAndroidApp
import io.reactivex.rxjava3.exceptions.UndeliverableException
import io.reactivex.rxjava3.plugins.RxJavaPlugins
import timber.log.Timber
import java.io.IOException
import java.net.SocketException

Expand All @@ -13,6 +14,8 @@ class MainApplication : MultiDexApplication() {
override fun onCreate() {
super.onCreate()

initTimber()

// Rx Exception 처리
initRxJava()
}
Expand All @@ -26,7 +29,7 @@ class MainApplication : MultiDexApplication() {
RxJavaPlugins.setErrorHandler { e ->
var error = e
if (error is UndeliverableException) {
error = e.cause
error = e.cause ?: Throwable("UndeliverableException")
}
if (error is IOException || error is SocketException) {
// fine, irrelevant network problem or API that throws on cancellation
Expand Down Expand Up @@ -54,4 +57,15 @@ class MainApplication : MultiDexApplication() {
}
}
}
}

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)


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)

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)

}

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)

})

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)

// }
}
}
9 changes: 5 additions & 4 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ buildscript {
gradlePluginPortal()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30")
classpath("org.jetbrains.kotlin:kotlin-serialization:1.4.30")
classpath("com.google.dagger:hilt-android-gradle-plugin:2.36")
classpath("com.android.tools.build:gradle:7.0.4")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
classpath("org.jetbrains.kotlin:kotlin-serialization:1.6.10")
classpath("com.google.dagger:hilt-android-gradle-plugin:2.38.1")
}
}

allprojects {
repositories {
mavenCentral()
google()
maven { url = uri("https://jitpack.io") }
}
}

Expand Down
22 changes: 15 additions & 7 deletions android/buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
object Apps {
const val compileSdkVersion = 31
const val buildToolsVersion = "30.0.3"
const val buildToolsVersion = "31.0.0"
const val minSdkVersion = 23
const val targetSdkVersion = 30
const val targetSdkVersion = 31
const val versionCode = 1
const val versionName = "0.0.1"
}

object Versions {
const val kotlin = "1.4.30"
const val ktx = "1.5.0"
const val kotlin = "1.6.10"
const val ktx = "1.6.0"
const val retrofit = "2.9.0"
const val glide = "4.11.0"
const val dagger = "2.28"
const val dagger = "2.38.1"
const val espresso = "3.2.0"
const val lifecycle = "2.3.1"
const val hilt = "2.36"
const val hilt = "2.38.1"
}

object AndroidX {
Expand Down Expand Up @@ -47,7 +47,6 @@ object Hilt {
const val android = "com.google.dagger:hilt-android:${Versions.hilt}"
const val compiler = "com.google.dagger:hilt-compiler:${Versions.hilt}"
const val androidx = "androidx.hilt:hilt-compiler:1.0.0-alpha01"
const val lifecycle = "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha01"
}

object Rx {
Expand All @@ -74,6 +73,15 @@ object KotlinX {
const val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
}

object Log {
const val timber = "com.jakewharton.timber:timber:5.0.1"
}

object Libs {
const val binding = "com.github.kirich1409:viewbindingpropertydelegate:1.5.3"
const val bindingReflection = "com.github.kirich1409:viewbindingpropertydelegate-noreflection:1.5.3"
}

object UnitTest {
const val junit = "junit:junit:4.12"
const val androidXJunit = "androidx.test.ext:junit:1.1.3"
Expand Down
12 changes: 6 additions & 6 deletions android/data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ plugins {
}

android {
compileSdkVersion(Apps.compileSdkVersion)
compileSdk = Apps.compileSdkVersion

defaultConfig {
minSdkVersion(Apps.minSdkVersion)
targetSdkVersion(Apps.targetSdkVersion)
minSdk = Apps.minSdkVersion
targetSdk = Apps.targetSdkVersion

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -27,11 +27,11 @@ android {
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11"
}
}

Expand Down
40 changes: 2 additions & 38 deletions android/domain/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,14 @@ plugins {
id("kotlinx-serialization")
}

//android {
// compileSdkVersion(Apps.compileSdkVersion)
//
// defaultConfig {
// minSdkVersion(Apps.minSdkVersion)
// targetSdkVersion(Apps.targetSdkVersion)
//
// testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
// }
//
// buildTypes {
// getByName("debug") {
// isMinifyEnabled = false
// }
//
// getByName("release") {
// isMinifyEnabled = true
// proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
// }
// }
// compileOptions {
// sourceCompatibility = JavaVersion.VERSION_1_8
// targetCompatibility = JavaVersion.VERSION_1_8
// }
// kotlinOptions {
// jvmTarget = "1.8"
// }
//}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

dependencies {
implementation(project(":model"))
implementation(project(":likemanager"))

// /**
// * Hilt
// */
// implementation(Hilt.android)
// kapt(Hilt.compiler)

implementation(Javax.inject)

/**
Expand Down
6 changes: 3 additions & 3 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Jan 10 22:23:03 KST 2022
#Sat Feb 26 14:42:13 KST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
zipStoreBase=GRADLE_USER_HOME
1 change: 1 addition & 0 deletions android/lifecycle/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build