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
extension SequenceType where Self.Generator.Element : Equatable { | |
typealias Diff = (added: [Self.Generator.Element], removed: [Self.Generator.Element]) | |
func diff(changed:[Self.Generator.Element]) -> Diff { | |
let added:[Self.Generator.Element] = changed.reduce([]) { | |
!self.contains($1) ? $0 + [$1] : $0 | |
} | |
let removed:[Self.Generator.Element] = self.reduce([]) { |
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
class PicassoImageObservable( | |
private val picasso: Picasso | |
) : Func1<String, Observable<Bitmap>> { | |
override fun call(url: String): Observable<Bitmap> { | |
return Observable.fromAsync({ emitter -> | |
val target = object : Target { | |
override fun onPrepareLoad(placeHolderDrawable: Drawable?) { | |
//do nothing | |
} |
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.os.Bundle; | |
import com.squareup.moshi.JsonAdapter; | |
import com.squareup.moshi.Moshi; | |
import java.io.IOException; | |
/** | |
* Removes some of the boilerplate associated with Properties in android fragments by handling | |
* the serialization and deserialization of wrapped objects into and out of argument | |
* {@link Bundle}s. | |
* |
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.annotation.TargetApi; | |
import android.os.Build; | |
import android.support.v4.content.ContextCompat; | |
import android.view.Window; | |
import android.view.WindowManager; | |
public class Windows { | |
private Windows() { | |
//no instances |
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.content.Context; | |
import android.util.TypedValue; | |
public class TypedValues { | |
private TypedValues() { | |
//no instances | |
} | |
public static int dip(Context context, float dp) { |
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.bulwinkel.android | |
import android.os.Bundle | |
import android.os.IBinder | |
import android.os.Parcelable | |
import java.io.Serializable | |
fun <V> Map<String, V>.toBundle(bundle: Bundle = Bundle()): Bundle = bundle.apply { | |
forEach { | |
val k = it.key |
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.support.annotation.ColorInt; | |
import android.text.SpannableStringBuilder; | |
import android.text.style.ForegroundColorSpan; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
import org.jetbrains.annotations.NotNull; | |
import static android.text.Spanned.SPAN_INCLUSIVE_EXCLUSIVE; |
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 com.squareup.moshi.JsonAdapter; | |
import com.squareup.moshi.JsonReader; | |
import com.squareup.moshi.JsonWriter; | |
import com.squareup.moshi.Moshi; | |
import com.squareup.moshi.Types; | |
import io.realm.RealmList; | |
import io.realm.RealmModel; | |
import java.io.IOException; | |
import java.lang.annotation.Annotation; | |
import java.lang.reflect.Type; |
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.nm.support.okhttp; | |
import retrofit2.HttpException; | |
import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR; | |
import static java.net.HttpURLConnection.HTTP_NOT_FOUND; | |
import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; | |
public final class HttpExceptions { | |
private HttpExceptions() { |
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
RESOLUTIONS=('-mdpi' '-hdpi' '-xhdpi' '-xxhdpi' '-xxxhdpi') | |
for res in "${RESOLUTIONS[@]}"; do | |
echo $res | |
DIR="res/drawable${res}" | |
mkdir -p ${DIR} | |
for file in $(find . -type f -iname "*${res}*"); do | |
echo "${file}" | |
mv "$file" "${DIR}/${file/${res}/}" | |
done |
OlderNewer