See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope> is optional
| package peterho.kotlintipstricks | |
| import android.content.Context | |
| import android.support.annotation.AttrRes | |
| import android.support.annotation.StyleRes | |
| import android.support.v4.app.Fragment | |
| import android.support.v4.app.FragmentManager | |
| import android.support.v7.app.AlertDialog | |
| import android.support.v7.widget.RecyclerView | |
| import android.text.TextUtils |
These are things that I found annoying writing a complex library in Kotlin. While I am also a Scala developer, these should not necessarily be juxtaposed w/ Scala (even if I reference Scala) as some of my annoyances are with features that Scala doesn't even have. This is also not trying to be opinionated on whether Kotlin is good/bad (for the record, I think it's good). I have numbered them for easy reference. I can give examples for anything I am talking about below upon request. I'm sure there are good reasons for all of them.
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
| public class RxSchedulerHook { | |
| private ISRxSchedulerHook() { | |
| // no instances | |
| } | |
| /** | |
| * this makes sure that when we run the tests all of RxJava | |
| * operates on a single thread (Scheduler.immediate) | |
| */ |
| import android.support.design.widget.AppBarLayout; | |
| /** | |
| * App bar collapsing state | |
| * @author Paulo Caldeira <paulo.caldeira@acin.pt>. | |
| */ | |
| public abstract class AppBarStateChangeListener implements AppBarLayout.OnOffsetChangedListener { | |
| // State | |
| public enum State { | |
| EXPANDED, |
| buildscript { | |
| repositories { | |
| mavenCentral() | |
| maven { | |
| url 'https://oss.sonatype.org/content/repositories/snapshots/' | |
| } | |
| } | |
| dependencies { | |
| classpath 'com.android.tools.build:gradle:0.9.+' | |
| classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.1-SNAPSHOT' |
| <manifest> | |
| <!-- other code --> | |
| <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | |
| </manifest> |
| import android.content.Context; | |
| import android.net.ConnectivityManager; | |
| import android.net.NetworkInfo; | |
| import android.telephony.TelephonyManager; | |
| /** | |
| * Check device's network connectivity and speed | |
| * @author emil http://stackoverflow.com/users/220710/emil | |
| * | |
| */ |