-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All base classes (activity, fragment, viewModel) are removed in favor…
… of "composition over inheritance".
- Loading branch information
1 parent
236988b
commit b1dc8fa
Showing
33 changed files
with
334 additions
and
493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
app/src/main/kotlin/com/adesso/movee/base/BaseBindingActivity.kt
This file was deleted.
Oops, something went wrong.
105 changes: 0 additions & 105 deletions
105
app/src/main/kotlin/com/adesso/movee/base/BaseBottomSheetDialogFragment.kt
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
app/src/main/kotlin/com/adesso/movee/base/BaseBottomSheetFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
154
app/src/main/kotlin/com/adesso/movee/base/BaseFragment.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.