This file contains hidden or 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
#!/bin/bash | |
version=$1 | |
if [[ $version =~ ^(Preview)?[0-9]+\.[0-9]$ ]]; then | |
echo "Clean up Android Studio $version." | |
else | |
echo "You should specify the version(e.g. 3.0 or Preview3.0) of Android Studio." | |
exit 1 | |
fi |
This file contains hidden or 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
#!/bin/bash | |
version=$1 | |
if [[ $version =~ ^20[0-9]{2}\.[0-9]{1,3}$ ]]; then | |
echo "Clean up IntelliJ CE $version." | |
else | |
echo "You should specify the version(e.g. 2017.2) of IntelliJ." | |
exit 1 | |
fi |
This file contains hidden or 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
val json = app.assets.open("timeline.json").use { | |
it.bufferedReader().readText() | |
} |
This file contains hidden or 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
val parentJob = Job() | |
launch(parentJob + CommonPool) { | |
try { | |
Timber.d("[${Thread.currentThread().name}]: start job1.") | |
delay(1500L) | |
Timber.d("[${Thread.currentThread().name}]: stop job2.") | |
} catch (e: CancellationException) { | |
Timber.d("[${Thread.currentThread().name}]: cancel job1.") | |
} | |
} |
This file contains hidden or 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.Manifest; | |
import android.annotation.TargetApi; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.content.pm.PackageManager; | |
import android.os.Build; | |
import android.support.annotation.NonNull; |
This file contains hidden or 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
/** | |
* Shortcut of the [Clippin.animate().target(view)]. | |
*/ | |
public fun View.clip(): ClippingAnimator = Clippin.animate().target(this) | |
// call example | |
val view = ... // create view | |
view.clip().circleCenter(Clippin.CENTER_LEFT_BOTTOM) | |
.duration(600) | |
.show { |
This file contains hidden or 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
// ArrayAdapter.getItems() with iterator | |
public class ArrayAdapterIterator<T>(val adapter: ArrayAdapter<T>) { | |
private var index = 0 | |
fun next() = adapter.getItem(index++) | |
fun hasNext() = index < adapter.getCount() | |
} | |
public fun <T>ArrayAdapter<T>.iterator(): ArrayAdapterIterator<T> = ArrayAdapterIterator(this) |
This file contains hidden or 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 com.droibit.utils | |
import android.os.Handler | |
import android.os.Message | |
import java.util.* | |
/** | |
* ActivityもしくはFragmentのレジューム時に処理をフックするためのハンドラ。 | |
* | |
* 参考: |