jmfayard
10/07/2019, 9:39 AMMigrate to AndroidX
is broken in general or just in my projectkhairil.ushan
10/08/2019, 6:21 AMclass MyFragment : Fragment(R.layout.my_fragment_layout)
.
But how to initialized our binding (DataBinding) if we use this constructor approach?Etinge Edward Mabian
10/08/2019, 8:39 AMmingkangpan
10/08/2019, 11:52 AM> Task :myapp:kaptDebugKotlin FAILED
e: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
pawel.rybicki
10/08/2019, 12:28 PMMoshi moshi = new Moshi.Builder().build();
JsonAdapter<BlackjackHand> jsonAdapter = moshi.adapter(BlackjackHand.class);
String json = jsonAdapter.toJson(blackjackHand);
and I've been thinking its a bit of a boiler plate to write it for each class, so I came up with the idea of this:
fun Any.toJson() = Moshi.Builder().build().adapter(Any::class.java).toJson(this)
this way I can simply call AnyObj.toJson()
, but I wonder if there is any downside of such solution?pawel.rybicki
10/08/2019, 1:07 PMMohamed
10/08/2019, 4:46 PMvalue
is nullable
Tolriq
10/09/2019, 7:39 AMJemshit Iskenderov
10/09/2019, 12:33 PMkoufa
10/09/2019, 12:35 PMimplementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7")
I recently read the we should use the first one on Android as the latter ones contain it and do not provide any value on Android and the last one also has features that are not supported yet on Android ( at least for minSdkVersion: 21
) . Is that true? What are your suggestions?Paul Dhaliwal
10/09/2019, 4:15 PMdataBinding.featureHostBottomNavigationViewFrame.featureHostCustomerAccountPointBalance.text = someNumber
. I don’t know too much about Kotlin yet however I’m curious if there’s some way I can simplify these calls to just featureHostCustomerAccountPointBalance.text = someNumber
Shan
10/09/2019, 9:34 PMUINonBundledState
, but I'd rather just have the annotation working. It gives me this error when trying to use it like I have in the example: @IgnoredOnParcel is inapplicable to properties declared in the primary constructor
capitalthree
10/10/2019, 2:41 AMMohamed Ibrahim
10/10/2019, 7:47 AMGSearchConfig.INSTANCE.getCONFIG()
-> how to get rid off the INSTANCE when accessing Kotlin class from JavaTsafack Dagha cedrick
10/10/2019, 11:01 AMThomas Nordmeyer
10/10/2019, 5:52 PMval contract: LiveData<Contract?> = MutableLiveData()
val authState: LiveData<AuthState?> = MutableLiveData()
init {
contract.observeForever { contract ->
(authState as MutableLiveData).value = when {
tokenRepository.tokens.accessToken.isNullOrEmpty() -> AuthState.ANONYMOUS
contract != null -> AuthState.LOGGED_IN_WITH_CONTRACT
else -> AuthState.LOGGED_IN_WITHOUT_CONTRACT
}.also { authState ->
Timber.d("Refreshing auth state to $authState after contract live data update")
}
}
}
But this doesn't
val contract: LiveData<Contract?> = MutableLiveData()
val authState = Transformations.map(contract)
{
when {
tokenRepository.tokens.accessToken.isNullOrEmpty() -> AuthState.ANONYMOUS
contract != null -> AuthState.LOGGED_IN_WITH_CONTRACT
else -> AuthState.LOGGED_IN_WITHOUT_CONTRACT
}.also { authState ->
Timber.d("Refreshing auth state to $authState after contract live data update")
}
}
init {
contract.observeForever { Timber.d("Updated contract value to ${it?.contract}")}
}
I would expect the logs from the observer in init method be followed trom the Transformations observer always. But sometimes I get the init method's only (setting contract.value=null).Priyankkumar Patel
10/10/2019, 5:53 PMMark
10/11/2019, 6:23 AMhetang
10/11/2019, 6:39 AMjava.time.datetime
Going back means either you need to build your own version of date manipulation or integrate with joda librarySergio C.
10/11/2019, 9:08 AMimplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Is there support for higher versions?Pablichjenkov
10/13/2019, 4:02 AMobject
.capitalthree
10/13/2019, 9:15 AMJonny
10/13/2019, 1:48 PMclass AddJobViewModel() : ViewModel() {
val minPrice = 20
val maxPrice = 1000
val step = 10
var description: MutableLiveData<String> = MutableLiveData("")
var displayPrice: MutableLiveData<String> = MutableLiveData(String.format("Price: %d Kr", minPrice))
val seekBarMax: MutableLiveData<Int> = MutableLiveData((maxPrice - minPrice) / step)
var currentPrice: MutableLiveData<Int>
var seekBarProgress: MutableLiveData<Int>
init {
currentPrice = object: MutableLiveData<Int>(minPrice) {
override fun setValue(value: Int?) {
if (this.value == value) {
return
}
super.setValue(value)
displayPrice.value = String.format("Price: %d Kr", value)
seekBarProgress.value = value!! / step - minPrice
}
override fun postValue(value: Int?) {
if (this.value == value) {
return
}
super.postValue(value)
displayPrice.postValue(String.format("Price: %d Kr", value))
seekBarProgress.postValue(value!! / step - minPrice)
}
}
seekBarProgress = object: MutableLiveData<Int>(0) {
override fun setValue(value: Int?) {
if (this.value == value) {
return
}
super.setValue(value)
currentPrice.value = minPrice + value!! * step
}
override fun postValue(value: Int?) {
if (this.value == value) {
return
}
super.postValue(value)
currentPrice.postValue(minPrice + value!! * step)
}
}
currentPrice.value = 200
}
}
Thomas Nordmeyer
10/14/2019, 7:32 AMJoan Colmenero
10/14/2019, 10:08 AMapp
core
core-testing
features
(inside different features as a modules)? I'm about to start a new project and I want to have a "guide".
Thank you guys 🙂Shan
10/14/2019, 11:28 PMj.b.u: Can't locate argument-less serializer for class e.b.b.d.a (Kotlin reflection is not available). For generic classes, such as lists, please provide serializer explicitly.
spierce7
10/15/2019, 3:19 AMAkbar
10/15/2019, 7:04 AMBruno_
10/15/2019, 12:50 PMJoan Colmenero
10/16/2019, 10:04 AMBasicAuthenticatorInterceptor
that implements Interceptor
and then create there the Basic Authentication, the thing is I do not like to have the credentials inside the APP, how do I store the credentials to avoid someone that get the source code could do api calls? I was thinking to do an endpoint call first get the credentials from server and then store them in SP but I do not know if I have to encrypt them or what.
Any other suggestions?Joan Colmenero
10/16/2019, 10:04 AMBasicAuthenticatorInterceptor
that implements Interceptor
and then create there the Basic Authentication, the thing is I do not like to have the credentials inside the APP, how do I store the credentials to avoid someone that get the source code could do api calls? I was thinking to do an endpoint call first get the credentials from server and then store them in SP but I do not know if I have to encrypt them or what.
Any other suggestions?gildor
10/16/2019, 10:05 AMJoan Colmenero
10/16/2019, 10:31 AMgildor
10/16/2019, 10:35 AMJoan Colmenero
10/16/2019, 10:37 AMJorge R
10/16/2019, 3:10 PM