muralimohan962
09/30/2018, 5:02 PMpoohbar
10/01/2018, 3:49 PMalso
,run
,let
,apply
etc should I use:
1. the extension must be lambda that takes one parameter (like let), can't be this
2. it automatically returns the input just like apply
doesNikita Khlebushkin
10/02/2018, 9:34 AMasSequence
before `filter`s and `map`s?CamilleBC
10/03/2018, 8:59 AMhudsonb
10/03/2018, 5:10 PMinternal
?ValV
10/04/2018, 12:54 AMforcelain
10/04/2018, 8:03 AMprivate val items : MutableList<String> by lazy {
// a lot of init code
}
how do I exclude my initialisation code into a separate function? I can think of creating something like
private val items : MutableList<String> by lazy {
init()
}
fun init() : MutableList<String> {...}
but maybe there is more elegant waySam
10/04/2018, 6:37 PMmFilter.run {
addAction( Intent.ACTION_PACKAGE_INSTALL )
addAction( Intent.ACTION_PACKAGE_ADDED )
addAction( Intent.ACTION_PACKAGE_REMOVED )
addAction( Intent.ACTION_PACKAGE_FULLY_REMOVED )
addDataScheme("package")
}
mFilter.apply {
addAction( Intent.ACTION_PACKAGE_INSTALL )
addAction( Intent.ACTION_PACKAGE_ADDED )
addAction( Intent.ACTION_PACKAGE_REMOVED )
addAction( Intent.ACTION_PACKAGE_FULLY_REMOVED )
addDataScheme("package")
}
Sam
10/04/2018, 7:15 PMval launchUri = try {
if( isAvailable() ) {
Uri.parse( "..." )
} else {
Uri.parse("..." )
}
} catch ( e : android.content.ActivityNotFoundException ) {
if( isAvailable() ) {
Uri.parse( "..." )
} else {
Uri.parse("..." )
}
}
Nikky
10/04/2018, 8:36 PMMike
10/04/2018, 9:10 PMformatted according to project settings
and turn it on. Appears under Kotlin.
Then if code doesn’t conform to formatting, it will have the colour you chose here with squiggly lines around it.
I’m not sure if this will appear in an Analyze run. You may be able to modify the Analyze rules and have IntelliJ expose formatting issues.ValV
10/06/2018, 10:39 AMIntegerStringConverter
that trows exceptions like java.lang.NumberFormatException
, is it possible to catch or suppress them without try ... catch
block?Sam
10/06/2018, 3:16 PMval list = listOf( 1, 2, 3, 4, 5 )
val evenList = list.filter {
return
it % 2 == 0
}
ValV
10/07/2018, 8:03 AMValV
10/07/2018, 10:30 AMinline fun <reified T> convert(text: String): Any? {
return try {
text to T // something bad is happening here
} catch (e: Exception) {
null
}
}
Rohit Surwase
10/08/2018, 1:08 AM// Downloaded 1.3. early preview plugin of Kotlin for Android Studio
ext.kotlin_version = '1.3.0-rc-46'
// ext.kotlin_version = '1.3.0-rc-57'
maven { url '<https://dl.bintray.com/kotlin/kotlin-eap>' }
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:0.30.1") {
exclude group: "org.jetbrains.kotlinx", module: "atomicfu-common"
}
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.30.1'
Above setup giving me error No route to host (connect failed)
3. What working for me is just
ext.kotlin_version = '1.2.71'
implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:0.30.1") {
exclude group: "org.jetbrains.kotlinx", module: "atomicfu-common"
}
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.30.1'
Please guide me in the right direction. Thanks.Hullaballoonatic
10/08/2018, 3:42 AMkarelpeeters
10/08/2018, 9:04 AMthis
, and default parameters are evaluated in a constructor.miha-x64
10/08/2018, 7:09 PMfunction.annotationEntries.any { it.shortName?.identifier == "PublishedApi" }
works but may be false-positive for some.custom.package.PublishedApi
. How should I fix this, where's annotation FQN?miha-x64
10/08/2018, 7:41 PMmarcelo
10/08/2018, 10:50 PMval counterWithTwoTags = metric.counterTwoTags("my.counter.name", "key1", "key2")
try{
someHttpCall()
counterWithTwoTags("value1", "value2")
catch(Exception e) {
counterWithTwoTags("errorValue1", "errorValue2")
}
I want to make sure that the name
for the counter remains immutable, but the the value is not. I was thinking that companion objects was the right way, but this seems more like for static methods.marcelo
10/09/2018, 2:42 AMdata class MetricTag<T>(val name: String, var value: T)
marcelo
10/09/2018, 2:42 AMValV
10/09/2018, 9:20 AMObservableList<ObservableList<ObservableValue<Any>>>
? Do I need inherit and annotate it? Are there better (Kotlin-specific) ways to marshal an object?Matheus
10/09/2018, 3:29 PMpoohbar
10/10/2018, 4:00 PMdiesieben07
10/10/2018, 4:01 PMbuildSequence
serebit
10/10/2018, 6:06 PMfkrauthan
10/10/2018, 6:14 PMkotlinx.serialization
for a Javascript project to convert my data class to a simple Javascript object and back without all the heavy auto gen code and to string serialization?ValV
10/11/2018, 11:38 AM.idea
folder? Isn't it IDE configs that should not be put into version control?ValV
10/11/2018, 11:38 AM.idea
folder? Isn't it IDE configs that should not be put into version control?arekolek
10/11/2018, 11:45 AMValV
10/11/2018, 11:49 AM.idea
to .gitignore
, but left .iml
filearekolek
10/11/2018, 11:53 AM.iml
file”, also I can’t know what files were already checked in before modifying the .gitignore
ValV
10/11/2018, 11:55 AM