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 retrofit2.Call; | |
import retrofit2.Callback; | |
import retrofit2.Response; | |
/** | |
* <p> | |
* Builds upon the Retrofit {@link Callback} class. Useful when each HTTP code group has | |
* specific functionality. This lacks some of the flexibility of {@link Callback} though. | |
* </p> | |
*/ |
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.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.PorterDuff; | |
import android.graphics.drawable.ColorDrawable; | |
import android.graphics.drawable.Drawable; | |
import android.os.Handler; | |
import android.support.annotation.ColorRes; | |
import android.support.annotation.IdRes; | |
import android.support.v4.content.ContextCompat; |
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.Nullable; | |
import java.util.Stack; | |
import retrofit2.Call; | |
/** | |
* Simple helper class to monitor the Retrofit 2 calls. Biggest use case is to cancel all pending calls. | |
*/ | |
public class RetroCallStack { |
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
{"lastUpload":"2021-08-07T13:12:16.241Z","extensionVersion":"v3.4.3"} |
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
public abstract class GsonBundler<T> implements Bundler<T> { | |
//Maximum bytes this fragment is allowed to save, os limit is 1 Mb | |
public static final int MAX_BUNDLE_BYTE_SIZE = 93750; //93750 bytes == .75 Mb | |
abstract Class<T> getObjClass(); | |
@Override public void put(String s, T obj, Bundle bundle) { | |
putReturnSize(s, obj, bundle); | |
} |
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 RealmObjBundler<T extends RealmObject> implements Bundler<T> { | |
abstract public String[] args(T obj); | |
@NonNull abstract public RealmQuery<T> query(Realm realm, String... args); | |
@Override public void put(String s, final T obj, Bundle bundle) { | |
if (obj == null) return; | |
ArrayList<String> args = new ArrayList<>(); | |
// We need to know whether this was managed before to determine if we need to delete it afterwards |
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 UiComponent(@LayoutRes val layoutId: Int, | |
val root: ViewGroup, | |
val activity: FragmentActivity) | |
{ | |
val mainView: View = View.inflate(activity, layoutId, root) | |
lateinit protected var unbinder: Unbinder | |
open fun unbind() { |
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.graphics.* | |
import android.util.AttributeSet | |
import android.view.View | |
import kotlin.math.max | |
import kotlin.math.min | |
class SquareCutoutOverlay( | |
context: Context, |
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
sealed class Resource<T> { | |
object Loading: Resource<Nothing>() | |
data class Success<T>(val data: T): Resource<T>() | |
data class Error(val error: AppError): Resource<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 { useMemo, useEffect, useState } from 'react'; | |
import { useDebounce } from 'use-debounce'; | |
export default function(debounceWaitMs = 500) { | |
const [curWindowHeightPx, setWindowHeight] = useState(window.innerHeight); | |
const [windowHeightPx] = useDebounce(curWindowHeightPx, debounceWaitMs, { | |
leading: true | |
}); | |
useEffect(() => { |
OlderNewer