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.os.Build; | |
import android.webkit.JavascriptInterface; | |
import android.webkit.WebView; | |
import com.google.gson.Gson; | |
import java.util.concurrent.Callable; | |
import java.util.concurrent.LinkedBlockingDeque; | |
import java.util.concurrent.ThreadPoolExecutor; | |
import java.util.concurrent.TimeUnit; |
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
/** | |
* unified wrapper of {@link Log} to make logging more consistent throughout the app | |
* | |
* automatically logs called filename, method and linenumber | |
* if you are not called the methods with a custom tag | |
* | |
* D/FILENAME﹕ [METHOD: LINENUMBER] MSG | |
* | |
* Created by timfreiheit on 26.07.15. | |
*/ |
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.app.Activity; | |
import android.app.Fragment; | |
import android.app.FragmentManager; | |
import android.app.FragmentTransaction; | |
import android.os.Bundle; | |
import android.os.Handler; | |
import android.os.Message; | |
import android.support.v4.app.FragmentActivity; | |
import android.util.Log; |
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
/* | |
* uses MyGeoCoder if !android.location.Geocoder.isPresent() | |
*/ | |
public class GeoCoderWrapper { | |
Geocoder geo; | |
public GeoCoderWrapper(Context context){ | |
if(Geocoder.isPresent()){ |
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.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.drawable.Drawable; | |
import android.util.AttributeSet; | |
import android.util.Log; | |
import android.util.SparseArray; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.ImageView; |
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.content.SharedPreferences; | |
import android.support.annotation.NonNull; | |
import com.f2prateek.rx.preferences.Preference; | |
/** | |
* Caches an result in memory to avoid fetching and parsing it for every call | |
* IMPORTANT: the value will not update automatically if you change the preferences in another way than using | |
* {@link Preference#set(Object)} |
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.app.Activity | |
import android.app.Instrumentation.ActivityResult | |
import android.content.Intent | |
import android.support.test.espresso.intent.Intents | |
import android.support.test.espresso.intent.Intents.intending | |
import android.support.test.espresso.matcher.ViewMatchers.assertThat | |
import org.hamcrest.CoreMatchers.allOf | |
import org.hamcrest.Description | |
import org.hamcrest.Matcher | |
import org.hamcrest.StringDescription |
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
class MultiTypeDiffItemCallback<T: Any> : DiffUtil.ItemCallback<T>() { | |
private val itemCallbacks = mutableMapOf<Any, DiffUtil.ItemCallback<T>>() | |
fun <Subclass: T> register(clazz: Class<Subclass>, callback: DiffUtil.ItemCallback<Subclass>) { | |
@Suppress("UNCHECKED_CAST") | |
itemCallbacks[clazz] = callback as DiffUtil.ItemCallback<T> | |
} | |
override fun areItemsTheSame(oldItem: T, newItem: T): Boolean { |