This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun test() { | |
val lines = use { | |
val a = File("path1").reader().use | |
val b = File("path2").reader().use | |
val c = File("path3").reader().use | |
a.readLines() + b.readLines() + c.readLines() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.animation.TimeInterpolator; | |
/** | |
* Interpolator that produces a decaying sine wave oscillating around zero. | |
*/ | |
public class ShakeInterpolator implements TimeInterpolator { | |
private static final double AMP, FREQ = 5, DECAY = 6; | |
static { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package me.eugeniomarletti.example; | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import android.widget.Toast; | |
import rx.Observable; | |
import rx.Subscriber; | |
import rx.Subscription; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources xmlns:tools="http://schemas.android.com/tools"> | |
<style name="CustomDialog" parent="@style/Base.Theme.AppCompat.Light.Dialog.FixedSize"> | |
<item name="android:windowCloseOnTouchOutside">false</item> | |
<item name="android:windowBackground">@android:color/transparent</item> | |
<item name="android:windowIsFloating">false</item> | |
<item name="android:windowIsTranslucent">true</item> | |
<item name="android:windowClipToOutline">false</item> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface WindowAware { | |
public void onAttachedToWindow(); | |
public void onDetachedFromWindow(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | |
<application> | |
<activity android:name=".TaskKiller"/> | |
</application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String getJavaHome(String version) | |
{ | |
def stdout = new ByteArrayOutputStream() | |
exec { | |
commandLine "/usr/libexec/java_home", "-v", version | |
standardOutput = stdout; | |
} | |
return stdout.toString().trim() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.support.v4.util.Pair; | |
import rx.Observable; | |
public class HistoryTransformer<T> implements Observable.Transformer<T, Pair<T,T>> { | |
@Override | |
public Observable<Pair<T,T>> call(Observable<T> observable) { | |
//noinspection unchecked | |
return observable | |
.map(value -> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def buildConfigAndResStringField(variant, name, value) { | |
variant.resValue 'string', name.toLowerCase(), value | |
variant.buildConfigField 'String', name, "\"$value\"" | |
} | |
afterEvaluate { | |
android.applicationVariants.all { variant -> | |
variant.resValue 'string', 'application_id', variant.applicationId | |
buildConfigAndResStringField variant, "ACCOUNT_TYPE", variant.applicationId | |
buildConfigAndResStringField variant, "CONTENT_AUTHORITY", variant.applicationId + ".provider" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.animation.Animator; | |
import android.animation.AnimatorSet; | |
import android.animation.Keyframe; | |
import android.animation.PropertyValuesHolder; | |
import android.animation.ValueAnimator; | |
import android.os.Build; | |
import android.support.annotation.Nullable; | |
import java.lang.reflect.Field; |