mirror of
https://github.com/melihaksoy/Android-Kotlin-Modulerized-CleanArchitecture.git
synced 2026-03-18 15:34:14 +01:00
Reducing complexity & duplication
Update README.md Update README.md
This commit is contained in:
@@ -10,6 +10,9 @@ import androidx.databinding.ViewDataBinding
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.fragment.NavHostFragment
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.melih.repository.interactors.base.Reason
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
|
||||
/**
|
||||
* Parent of all fragments.
|
||||
@@ -38,6 +41,17 @@ abstract class BaseFragment<T : ViewDataBinding> : Fragment() {
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
protected fun showSnackbarWithAction(reason: Reason, block: () -> Unit) {
|
||||
Snackbar.make(
|
||||
binding.root,
|
||||
resources.getString(reason.messageRes),
|
||||
Snackbar.LENGTH_INDEFINITE
|
||||
).setAction(com.melih.core.R.string.retry) {
|
||||
block()
|
||||
}.show()
|
||||
}
|
||||
|
||||
@LayoutRes
|
||||
abstract fun getLayoutId(): Int
|
||||
// endregion
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.melih.core.extensions
|
||||
|
||||
fun CharSequence.containsIgnoreCase(other: CharSequence) = contains(other, true)
|
||||
Reference in New Issue
Block a user