pniederw
10/31/2017, 2:23 AMpniederw
10/31/2017, 3:18 AMKType
rather than a Type
)avovk
10/31/2017, 11:53 AMbuttone1.setOnClickListener { viewModel.setDrawable() }
You can change it to something like this:
buttone1.setOnClickListener { viewModel.setDrawable(context = this) }
Then change the function you are currently editing to this:
fun setDrawable(context: Context) {
back.setDrawable(context.getResources()./*the rest*/)
}
That should helppoohbar
10/31/2017, 1:11 PMsourceDir
for the Kotlin plugin, should I do that?
And why does it replace the execution for the java compiler plugin in the guide?
<!-- Replacing default-compile as it is treated specially by maven -->
How specially? What? What does that mean? Why is the documentation so bad?poohbar
10/31/2017, 1:22 PM<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
What does this do? There is nothing about default-compile
goal anywhere in Maven docs.hannesstruss
10/31/2017, 1:35 PMUnresolved reference
. Is that generally impossible?
sealed class LoginScreenAction {
object NameEntered : LoginScreenAction()
object SubmitClicked : LoginScreenAction()
}
private typealias Action = LoginScreenAction
fun main() {
println("My action is: ${Action.NameEntered}")
}
mike_shysh
10/31/2017, 5:21 PMkarelpeeters
10/31/2017, 10:06 PM//java code
public abstract class Test {
public abstract void run()
}
//kotlin code
fun testFoo(test: Test) = test.run()
fun main(args: Array<String>) {
testFoo(object : Test() {
override fun run() {
println("hey")
}
})
}
It just feels unnecessary, are there plans to do something about this?alphi
11/01/2017, 9:32 AMCzar
11/01/2017, 1:13 PMapply
whose argument is a SAM from guava. Since some of us started using :kotlin: we bump into the conflict with Kotlin's apply
quite often. I'm considering the resolution options and so far found only two. Did I miss anything?
1. rename member apply
to something like applyFunction
(involves convincing several teamleads who do not use :kotlin: )
2. specify the receiver type (someInstanceOfBase.apply<Base> { ... }
) (suggested by @marstran)
3. accept that this is the reality and use also
instead of apply
4. duplicate Kotlin's apply
and rename that (suggested by @karelpeeters)
Here's the recipe for the disaster at hand 🙂 (irrelevant parts omitted for brevity)
:java:
import com.google.common.base.Function;
public abstract class Base {
public <T, F> T apply(Function<F, T> function) {
return function.apply((F) this);
}
}
marstran
11/01/2017, 1:55 PMsomeInstanceOfBase.apply<Base> { ... }
work?poohbar
11/01/2017, 3:36 PMclass Person(override val id: String, val name: String) : HasId
and this Java interface:
public interface HasId {
String getId();
}
How do I implement the interface? The above example gives me 'id' overrides nothing
hagabaka
11/01/2017, 11:33 PMsettermjd
11/02/2017, 12:15 PMjava.lang.ClassNotFoundException: MainKt
(my main class is src/main/Main.kt
, the package is called main
. Any suggestions?dorsamet
11/02/2017, 3:32 PMhagabaka
11/02/2017, 5:58 PMpavel
11/02/2017, 6:36 PM\n
Shawn
11/02/2017, 6:36 PM\n
represented literally ASCII 0x0A
or if it ends up being translated to the proper newline depending on platformAndreas Sinz
11/03/2017, 1:53 PMobject
by the definition of Kotlin is a class that has a single instance (like a Singleton) and that instance is created automatically at startup, so there is no way to have abstract stuff inside an ObjectFré Dumazy
11/04/2017, 10:26 AMziggy42
11/04/2017, 3:08 PMjw
11/04/2017, 4:40 PMron
11/04/2017, 4:42 PMbdawg.io
11/04/2017, 8:15 PMresponseBody?.let {
view?.onUnknownError(getErrorMessage(it))
}
tmseiler
11/04/2017, 8:15 PMjo
11/04/2017, 9:54 PMnish
11/05/2017, 3:16 AMkartikpatodi
11/05/2017, 6:56 AMreified
I'm unable to understand the concept behind this oneaeruhxi
11/05/2017, 1:45 PMMinty
11/05/2017, 3:40 PMMinty
11/05/2017, 3:40 PMilya.gorbunov
11/05/2017, 9:26 PMendInclusive
as a result of this function though it's named "inclusive". Otherwise it seems ok.