My minimal configuration would be.
@Singleton
@Component(modules = AppModule.class)
public interface AppComponent {
public static void printStackTrace() { | |
System.out.println("Printing stack trace:"); | |
StackTraceElement[] elements = Thread.currentThread().getStackTrace(); | |
for (final StackTraceElement element : elements) { | |
System.out.println("\tat " + element.getClassName() + "." + element.getMethodName() | |
+ "(" + element.getFileName() + ":" + element.getLineNumber() + ")"); | |
} | |
} |
import android.app.Activity; | |
import android.content.pm.PackageManager; | |
import android.support.annotation.Nullable; | |
import android.support.v4.app.ActivityCompat; | |
import android.support.v7.app.AlertDialog; | |
public class PermissionRequest { | |
private static int RC = 1; | |
private final String permission; |
import android.app.Activity | |
import android.app.Fragment | |
import android.content.Context | |
import android.content.Intent | |
import android.os.Bundle | |
import android.os.Parcelable | |
import android.support.annotation.VisibleForTesting | |
import android.support.v4.app.FragmentActivity | |
import android.util.SparseArray |
import android.graphics.Color; | |
import android.support.v7.util.DiffUtil; | |
import android.support.v7.widget.OrientationHelper; | |
import com.facebook.litho.Column; | |
import com.facebook.litho.ComponentContext; | |
import com.facebook.litho.ComponentInfo; | |
import com.facebook.litho.ComponentLayout; | |
import com.facebook.litho.annotations.LayoutSpec; | |
import com.facebook.litho.annotations.OnCreateLayout; |
#!/bin/bash | |
# Fix the CircleCI path | |
function install() { | |
TARGET="$1" | |
if [ ! -e $TARGET ]; then | |
echo y | android update sdk --no-ui --all --filter $2 | |
else | |
echo "$TARGET has installed" | |
fi |
#Intro
Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3
Kotlin project website is at kotlin.jetbrains.org.
All the codes here can be copied and run on Kotlin online editor.
Let's get started.
import android.app.Dialog; | |
import android.content.DialogInterface; | |
import android.os.Bundle; | |
import android.support.annotation.NonNull; | |
import android.support.v7.app.AlertDialog; | |
import android.support.v7.app.AppCompatDialogFragment; | |
import android.util.Log; | |
/** |
Original solution sacrifices new api lint check.
Here my solution:
int minSdk = hasProperty('minSdk') ? minSdk.toInteger() : 16
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
import rx.Subscription; | |
import rx.functions.Action1; | |
import rx.subjects.PublishSubject; | |
import rx.subjects.SerializedSubject; | |
import rx.subjects.Subject; | |
public class RxBus { | |
private final Subject<Object, Object> bus = new SerializedSubject<Object, Object>(PublishSubject.create()); |