Live data from Hacker News

Show HN: I built an Android live wallpaper with Scala – now it's free

play.google.com

21–30 of 40 posts

Re: Show HN: I built an Android live wallpaper with Scala – now it's free

#21
post #20

will the app truly not run on a galaxy nexus or is minSdk set too high?

I currently don't allow installation on the Galaxy Nexus because for some reason the live wallpaper has severe performance issues on Galaxy Nexus devices. I've never been able to figure out what the problem is, since it's obviously not hardware — older devices run it fine. My best guesses are that I'm doing something out of the ordinary in GL ES that I haven't noticed or that there are either driver issues (not necessarily buggy drivers) or those specific devices have something off about their GL interfaces. It's hard to say without having a device on hand for it, which I don't. I'm mostly leaning toward it being an issue with how I use GL.

Because of the issues, I decided it was better to just block the device entirely rather than have people suffer through the performance issues with the Galaxy Nexus.

Re: Show HN: I built an Android live wallpaper with Scala – now it's free

#25

Thank you for making this compatible with Android 4.1.2. Because of bluetooth issues, I switched my Xperia T back from 4.3 to 4.1.2, and I've been missing all the cool 4.3 Xperia wallpapers. I'm running "Glitch" Config with "Blueshift" Gradient, all other settings defaulted. Gonna stare at it for a few hours.

This actually made me aware of a bug in the last release that I just released a patch for, so that was fun. I guess nobody ever reported (or encountered? seems unlikely though) the issue until I got a crash report for it today.

Re: Show HN: I built an Android live wallpaper with Scala – now it's free

#26
post #24
post #23

Earlier quoted context omitted.

Not at the moment. Still undecided on that.

Why not? Might get more people using Scala for Android development.

It's code I've invested a lot of time in, but was never written with the idea that other people would see it, so 75% worried at how horrifying the code might be and 25% worried that someone might make a build and push a clone out with malware attached.

Re: Show HN: I built an Android live wallpaper with Scala – now it's free

#27

I'm writing Android app as well, using Scala. Do you have sbt script and/or ProGuard config that you can share?

If you don't need the sbt build system for your project, it's pretty simple to get started. Here's my guide (and some code examples) for using just proguard + Intellij. Using sbt isn't difficult to set up either, though I consider it a bit overkill for smaller projects/scripting.

https://github.com/yareally/android-scala-intellij-no-sbt-pl...

Re: Show HN: I built an Android live wallpaper with Scala – now it's free

#28

dude this is so cool. So scala can compile to the jvm right?

On Android, Scala gets compiled to dex bytecode just the same as Java. Scala has slightly more overhead though from making lots of small objects, but the tradeoff is worth it if you prefer not using Java.

I stick to using Java Collections (and the special ones Android provides[1]) most of the time to avoid excess overhead, but it still results in much more concise code than what I would write in Java. One of most compelling reasons to use Scala though is it's much easier to deal with asynchronous processing (via actors, futures, async/await[2]) than the messes you end up with using AsyncTask + callbacks with Java.

[1] http://developer.android.com/reference/android/support/v4/ut...

[2] http://docs.scala-lang.org/sips/pending/async.html

Re: Show HN: I built an Android live wallpaper with Scala – now it's free

#29

dude this is so cool. So scala can compile to the jvm right?

On Android, Scala gets compiled to dex bytecode just the same as Java. Scala has slightly more overhead though from making lots of small objects, but the tradeoff is worth it if you prefer not using Java. I stick to using Java Collections (and the special ones Android provides[1]) most of the time to avoid excess overhead, but it still results in much more concise code than what I would write in Java. One of most com…

> Scala has slightly more overhead though from making lots of small objects

This is definitely true, though it's possible to write code that avoids it. It just ends up being slightly uglier Scala. The renderer in Ascension, for example, is all fairly bare-bones Java-like Scala because I have to be careful about how certain code is generated (i.e., prefer a while loop or tail recursion to a for comprehension or .foreach). So, it's possible to get performant code, it just ends up being more like Java usually.

In the UI code, you can get away with a little more depending on where it is. If it's inside an adapter, it pays to avoid the heavier tools Scala gives you. If it's responding to a button press, you probably don't need to worry as much. The GC will run a little more often, but the GC in Android has improved a fair bit over time.

I'll second the Java collections recommendation though — as much as I like the immutable collections provided by Scala (and I do use a few of them), they're much free-er with their allocations than Java and Android's. I haven't tried anything with actors on Android yet, though, so I can't comment on that. I just use AsyncTask as carefully as possible right now, but I really need to get familiar with an alternative to that. I'd like to try actors, plus I'd also like to get into using something like RxJava/Scala, but I haven't had anything come up where I could afford to experiment with it. Also need to see how Akka fares on Android, but same problem as RxJ/S.

Post reply on HN