Start search implementation
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package gq.kirmanak.mealient.extensions
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.Lifecycle
|
||||
@@ -18,10 +17,7 @@ fun <T> Fragment.collectWhenViewResumed(flow: Flow<T>, collector: FlowCollector<
|
||||
}
|
||||
}
|
||||
|
||||
fun Fragment.showLongToast(@StringRes text: Int) = showLongToast(getString(text))
|
||||
fun Fragment.showLongToast(@StringRes text: Int) = context?.showLongToast(text) != null
|
||||
|
||||
fun Fragment.showLongToast(text: String) = showToast(text, Toast.LENGTH_LONG)
|
||||
fun Fragment.showLongToast(text: String) = context?.showLongToast(text) != null
|
||||
|
||||
private fun Fragment.showToast(text: String, length: Int): Boolean {
|
||||
return context?.let { Toast.makeText(it, text, length).show() } != null
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package gq.kirmanak.mealient.extensions
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.widget.EditText
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.core.widget.doAfterTextChanged
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
@@ -95,4 +97,13 @@ fun <T> LiveData<T>.observeOnce(lifecycleOwner: LifecycleOwner, observer: Observ
|
||||
observer.onChanged(value)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun Context.showLongToast(text: String) = showToast(text, Toast.LENGTH_LONG)
|
||||
|
||||
fun Context.showLongToast(@StringRes text: Int) = showLongToast(getString(text))
|
||||
|
||||
private fun Context.showToast(text: String, length: Int) {
|
||||
Toast.makeText(this, text, length).show()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user