Skip to content

Instantly share code, notes, and snippets.

View jamolkhon's full-sized avatar

Jamolkhon Khakimov jamolkhon

View GitHub Profile
@bmc08gt
bmc08gt / SwipeToDelete.kt
Last active December 15, 2023 03:40
Jetpack Compose Modifier extension to implement swipe-to-delete via Modifier.draggable
import androidx.animation.IntToVectorConverter
import androidx.animation.tween
import androidx.compose.Composable
import androidx.compose.mutableStateOf
import androidx.compose.remember
import androidx.ui.animation.animatedFloat
import androidx.ui.animation.animatedValue
import androidx.ui.core.*
import androidx.ui.core.gesture.scrollorientationlocking.Orientation
import androidx.ui.foundation.animation.FlingConfig
@gbzarelli
gbzarelli / InputStreamRequestBody.java
Last active May 25, 2022 09:05
OkHttp RequestBody based in InputStream
public class InputStreamRequestBody extends RequestBody {
private final InputStream inputStream;
private final MediaType contentType;
public InputStreamRequestBody(MediaType contentType, InputStream inputStream) {
if (inputStream == null) throw new NullPointerException("inputStream == null");
this.contentType = contentType;
this.inputStream = inputStream;
}
@G00fY2
G00fY2 / CustomRxJava2CallAdapterFactory.java
Last active October 2, 2024 04:13
CustomRxJava2CallAdapterFactory to transform HttpExceptions to custom error
import com.google.gson.Gson;
import io.reactivex.Completable;
import io.reactivex.Flowable;
import io.reactivex.Maybe;
import io.reactivex.MaybeSource;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.Scheduler;
import io.reactivex.Single;
import java.lang.annotation.Annotation;
@tolpp
tolpp / android-send-push-locally-using-adb.adoc
Last active October 15, 2024 09:35
This gist explains how to send push notification locally using ADB without need network connection.

Requirements:

  • Device should be a rooted (simulator’s are rooted by default)

  • adbd should be started as root. (Rub command: adb root )

Now, send local push message using command:

@johnwatsondev
johnwatsondev / DividerItemDecoration.java
Last active November 30, 2022 07:48
Customizing the DividerItemDecoration class so we can remove divider / decorator after the last item
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@florina-muntenescu
florina-muntenescu / BaseDao.kt
Last active October 11, 2024 01:20
Use Dao inheritance to reduce the amount of boilerplate code - https://medium.com/google-developers/7-pro-tips-for-room-fbadea4bfbd1
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@magillus
magillus / LifecycleObservableTransformer.java
Last active March 29, 2018 05:54
Observable transformer that will act on event of the Lifecycle to auto dispose its subscriptions when the event occurs. By default ON_DESTROY
package com.example.playground;
import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.LifecycleObserver;
import android.arch.lifecycle.OnLifecycleEvent;
import android.support.annotation.NonNull;
import android.util.Log;
import java.lang.ref.WeakReference;
import java.util.Map;
@guelo
guelo / RxSchedulers.java
Last active February 11, 2020 09:42
Dagger injected Rx schedulers
import javax.inject.Named;
import javax.inject.Singleton;
import io.reactivex.Observable;
import io.reactivex.ObservableTransformer;
import io.reactivex.Scheduler;
@Singleton
public class RxSchedulers {
@minsik-ai
minsik-ai / Jetbrains IDE Essential Shortcuts.md
Last active February 18, 2021 04:50
Essential Shortcuts for Jetbrains IDEs, including IntelliJ IDEA, Android Studio & others.

Jetbrains IDE Essential Shortcuts

This is a list of Jetbrains IDE shortcuts I use everyday.

Comments welcome! Tell me your favorites.

Navigating Between Windows

Change Focus to Window