- Introduction 1.1 Purpose 1.2 Intended Audience 1.3 Intended Use 1.4 Scope
- Overall Description
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| package="***"> | |
| // This is required | |
| <uses-permission android:name="android.permission.INTERNET"/> | |
| <application | |
| android:allowBackup="true" | |
| android:icon="@mipmap/ic_launcher" |
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
| /** | |
| * Used as a wrapper for data that is exposed via a LiveData that represents an event. | |
| */ | |
| open class Event<out T>(private val content: T) { | |
| var hasBeenHandled = false | |
| private set // Allow external read but not write | |
| /** | |
| * Returns the content and prevents its use again. |
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
| abstract class DataBoundAdapter<T, V : ViewDataBinding>( | |
| diffCallback: DiffUtil.ItemCallback<T> | |
| ) : ListAdapter<T, DataBoundViewHolder<V>>(diffCallback) { | |
| override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DataBoundViewHolder<V> { | |
| val binding = createBinding(parent) | |
| return DataBoundViewHolder(binding) | |
| } | |
| protected abstract fun createBinding(parent: ViewGroup): V |
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.beflukey.shootproofdownloader | |
| import org.openqa.selenium.By | |
| import org.openqa.selenium.chrome.ChromeDriver | |
| import org.openqa.selenium.support.ui.ExpectedConditions.presenceOfAllElementsLocatedBy | |
| import org.openqa.selenium.support.ui.WebDriverWait | |
| import java.io.* | |
| import java.net.URL | |
| import java.time.Duration |
I hereby claim:
- I am lduncandroid on github.
- I am lduncandroid (https://keybase.io/lduncandroid) on keybase.
- I have a public key ASAOQZsKTkEH14w2y882fSvi50PhMuHeELEbx_-t4tTQdwo
To claim this, I am signing this object:
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 kotlinx.coroutines.delay | |
| import kotlinx.coroutines.flow.* | |
| import kotlinx.coroutines.runBlocking | |
| // Following the RxJava implementation here: https://blog.mindorks.com/implement-caching-in-android-using-rxjava-operators | |
| data class Data(val source: String) | |
| class MemoryDataSource { |
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 LRUCache(capacity: Int) { | |
| private val internalCache: LinkedHashMap<Int, Int> = | |
| object : LinkedHashMap<Int, Int>(initialCapacity = capacity, loadFactor = 0.75f, accessOrder = true) { | |
| override fun removeEldestEntry(eldest: MutableMap.MutableEntry<Int, Int>?): Boolean { | |
| return size > capacity | |
| } | |
| } | |
| fun get(key: Int) = internalCache.getOrDefault(key, -1) |
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
| fun <T> Iterable<T>.countPairs() = groupingBy { it } | |
| .eachCount() | |
| .values | |
| .sumOf { it.div(2) } | |
| fun <T> Sequence<T>.countPairs() = groupBy { it } | |
| .mapValues { it.value.size } | |
| .values | |
| .sumOf {it.div(2)} |
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.okhttp.Interceptor | |
| import com.squareup.okhttp.MediaType | |
| import com.squareup.okhttp.Response | |
| import com.squareup.okhttp.ResponseBody | |
| import okio.BufferedSource | |
| import okio.GzipSource | |
| import okio.Okio | |
| class ResponseBodyLogger : Interceptor { | |
| override fun intercept(chain: Interceptor.Chain): Response { |
OlderNewer