K0NN4
06/17/2019, 1:36 PMTask :app:buildInfoGeneratorDebug```
Lukas Anda
06/17/2019, 4:15 PMAdam Hurwitz
06/17/2019, 7:04 PMSealed class
and the shallow .copy(..)
function.
I'd love any feedback on this new approach! 🙂 🤖
Medium - https://hackernoon.com/android-unidirectional-flow-with-livedata-bf24119e747
YouTube - https://youtu.be/Elp-Z-pQTpM▾
Brian Mahecha
06/17/2019, 9:06 PMdiego-gomez-olvera
06/18/2019, 10:06 AMkotlin-android-extensions
for @Parcelize
but not for views?Tuan Kiet
06/18/2019, 10:42 AM.kotlin_module
files when build release apk?Byron Woodfork
06/18/2019, 3:46 PMbryan
06/18/2019, 10:16 PMsuspend
functions. If I want to log, say, which screen the user opened then I’ll want to call one of those suspend
functions from the library. However, if I’m calling from onCreate
in an Activity
, what coroutine scope do I want to use? I want the analytics to get recorded and not canceled if the Activity
is destroyed.dhananjaykulkarni19
06/19/2019, 5:50 AMK0NN4
06/19/2019, 2:28 PMChainchelliah
06/19/2019, 3:47 PMyogaboy
06/20/2019, 7:44 AMSlackbot
06/21/2019, 12:33 PMblakelee
06/21/2019, 5:43 PMSuraj Shah
06/24/2019, 8:05 AMContract
for deprecation be a good idea?
Take Html.fromHtml
for example, even though we have HtmlCompat
we wont have to go and create a XxxCompat
for everyone if something like this was possible.
Consider this snippet:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Html.fromHtml(contactToDisplay, Html.FROM_HTML_MODE_LEGACY)
} else {
@Suppress("DEPRECATION") // maybe we can do something to avoid this?
Html.fromHtml(contactToDisplay)
}
If we could wrap this in a contract maybe, plus android SDKs mostly have when a particular api was deprecated, even though below a particular SDK level, it was completely fine using it.
Also, looking at a bigger picture we could maybe not just use primal checks like implies x != null
there could be some other annotation with retention policy of runtime or something and maybe we could do implies x is NotDeprecated::class.java
or something.
Just a thought.Joan Colmenero
06/24/2019, 2:55 PMMockito.when(view.hideKeyboard()).then(doNothing())
SrSouza
06/24/2019, 6:09 PMTheDukerChip
06/25/2019, 11:13 AMdata class FormData(
private var _email: String = "",
private var _password: String = "",
private var _isAllFieldsValid: Boolean = false
) : BaseObservable() {
var email: String
@Bindable get() = _email
set(value) {
_email = value
notifyPropertyChanged(BR.email)
}
var password: String
@Bindable get() = _password
set(value) {
_password = value
notifyPropertyChanged(BR.password)
}
// I want this function to be notifed for both email and password changes
fun onValuesChanged() {
}
}
Is there any way to achieve this rather than callback or observer?am414
06/25/2019, 4:23 PMJulian Bissekkou
06/25/2019, 6:16 PMvictoralissont5
06/25/2019, 11:11 PMtouge
06/26/2019, 8:34 AMSlackbot
06/26/2019, 10:51 PMPadawanchichi
06/27/2019, 3:38 PMsuspend fun <T> awaitCallback (block: (Callback<T>) -> Unit) : T =
suspendCancellableCoroutine { continuation ->
block(object : Callback<T> {
override fun onComplete(result: T) {
if (continuation.isActive) {
continuation.resume(result)
} else {
...
}
}
})
}
I admit I’m not fully mastering that snippet (could be arguable to use it in our codebase) but it’s allowing us to get rid of callbacks when there’s no alternatives. We’re using it with firebase iirc.
It’s working well, however we have a lot of trouble covering that particular snippet of code using Unit Tests. We’re using Mockito/Powermockito and seting up the unit test with this code :
@Captor
private lateinit var callbackCaptor: ArgumentCaptor<Callback<Any>>
@Mock
private lateinit var lambdaReceiver: (Callback<Any>) -> Unit
Anybody do have tips to cover that the above method using Mockito/Powermockito ?CamilleBC
06/27/2019, 3:46 PMdata class
duplication when using room.
I have a data class
from a custom library (Kotlin but NOT Android). I have an Android app that uses that library and will store some items of that data class
. But as far as I can see, I don't find an easy way to create an entity
from that library data class
. Any ideas?veer
06/28/2019, 7:24 AMjecarr33
06/28/2019, 8:42 AMandroidx
libraries. I can't seem to find the version number of the latest androidx recycler view. When I search online I see a lot of old posts which direct you back to the support library. Can anybody please help me to find what I'm supposed to put in the implementation
portion of the gradle build???Fredrik Larsen
06/28/2019, 2:34 PMgoku
07/01/2019, 1:47 AMView Holder
shouldn’t be an inner class
. I don’t remember where I read it, but I don’t see any problem with making ViewHolder
an inner class
. Any thoughts on this?Shan
07/01/2019, 2:45 AMShan
07/01/2019, 2:45 AMgildor
07/01/2019, 3:11 AMShan
07/01/2019, 3:12 AMgildor
07/01/2019, 3:15 AMShan
07/01/2019, 3:21 AMjava.lang.IllegalStateException: Cannot access database on the main thread since it may potentially lock the UI for a long period of time.
😞viewModelScope.coroutineContext
which is bound to Dispatchers.Main
gildor
07/01/2019, 3:41 AMShan
07/01/2019, 3:43 AMviewModel.launch {
val destination = destinationsDao.getLastActive(true)
}
from my fragment. the query is:
@Query("SELECT * FROM destinations WHERE last_active = :lastActive")
fun getLastActive(lastActive: Boolean) : Destination?
gildor
07/01/2019, 3:46 AM