Skip to content

Commit

Permalink
All base classes (activity, fragment, viewModel) are removed in favor…
Browse files Browse the repository at this point in the history
… of "composition over inheritance".
  • Loading branch information
muratbilir committed Jun 23, 2023
1 parent 236988b commit b1dc8fa
Show file tree
Hide file tree
Showing 33 changed files with 334 additions and 493 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ indent_size = 2
[*.{kt, kts, java}]
indent_size = 4
max_line_length = 120
ij_kotlin_imports_layout=*,java.**,javax.**,kotlin.**,^
31 changes: 31 additions & 0 deletions app/src/main/kotlin/androidx/lifecycle/ViewModelExt.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package androidx.lifecycle

import com.adesso.movee.base.FailureData
import com.adesso.movee.internal.util.Event
import com.adesso.movee.navigation.NavigationCommand

private const val KEY_NAVIGATION = "navigation"
private const val KEY_FAILURE_POPUP = "failure-popup"

private val ViewModel.navigationEvents: MutableLiveData<Event<NavigationCommand>>
get() {
return getTag(KEY_NAVIGATION) ?: setTagIfAbsent(KEY_NAVIGATION, MutableLiveData())
}

val ViewModel.navigation: LiveData<Event<NavigationCommand>>
get() = this.navigationEvents

private val ViewModel._failurePopup: MutableLiveData<Event<FailureData>>
get() {
return getTag(KEY_FAILURE_POPUP) ?: setTagIfAbsent(KEY_FAILURE_POPUP, MutableLiveData())
}
val ViewModel.failurePopup: MutableLiveData<Event<FailureData>>
get() = this._failurePopup

fun ViewModel.navigate(command: NavigationCommand) {
navigationEvents.value = Event(command)
}

fun ViewModel.setFailure(data: FailureData) {
_failurePopup.value = Event(data)
}
16 changes: 0 additions & 16 deletions app/src/main/kotlin/com/adesso/movee/base/BaseActivity.kt

This file was deleted.

17 changes: 0 additions & 17 deletions app/src/main/kotlin/com/adesso/movee/base/BaseBindingActivity.kt

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.adesso.movee.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.google.android.material.bottomsheet.BottomSheetDialogFragment

abstract class BaseBottomSheetFragment(private val contentLayoutId: Int) : BottomSheetDialogFragment() {

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return if (contentLayoutId != 0) {
inflater.inflate(contentLayoutId, container, false)
} else null
}
}
154 changes: 0 additions & 154 deletions app/src/main/kotlin/com/adesso/movee/base/BaseFragment.kt

This file was deleted.

Loading

0 comments on commit b1dc8fa

Please sign in to comment.