Skip to content

Instantly share code, notes, and snippets.

View ikakus's full-sized avatar

Irakli Dadiani ikakus

  • Change invest
  • Estonia, Tallinn
View GitHub Profile
@scraplesh
scraplesh / FooBarFragment.kt
Created November 11, 2020 15:51
Fragment arguments delegate
class FooBarFragment : Fragment() {
companion object {
fun newInstance(foo: String, bar: String?) = FooBarFragment().apply {
this.foo = foo
this.bar = bar
}
}
private var foo: String by argumentNotNull()
@osipxd
osipxd / .editorconfig
Last active November 18, 2025 06:10
EditorConfig for Android projects with mapping to IntelliJ IDEA's config
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120
class Phone(sendSmsCode: SendSmsCodeUseCase) : ActorReducerFeature<Wish, Effect, PhoneState, News>(
initialState = PhoneState(),
actor = PhoneActor(sendSmsCode),
reducer = PhoneReducer(),
newsPublisher = PhoneNewsPublisher()
) {
data class PhoneState(
val selectedCountryCode: CountryCodeEntity = CountryCodeEntity("us", "United States of America", "1"),
val phone: String = "",
@dlew
dlew / script.sh
Created November 9, 2018 16:36
Simple AndroidX Migration Script
#!/usr/bin/env bash
# I've found that the "Migrate to AndroidX" converter in Android Studio doesn't work very
# well, so I wrote my own script to do the simple job of converting package names.
#
# You can download a CSV of package names here: https://developer.android.com/topic/libraries/support-library/downloads/androidx-class-mapping.csv
#
# It'll run faster on a clean build because then there are fewer files to scan over.
#
# Uses `gsed` because I'm on a Mac. Can easily replace with `sed` if you don't have `gsed`.
@amalChandran
amalChandran / BezInterpolator.java
Last active November 1, 2019 13:11
Easy custom interpolators for android.
public class BezInterpolator {
private static BezInterpolator bezInterpolator;
//Control points to create the cubic bezier curve.
private float[] PRINCIPLE_DEFAULT_EASE = {(float)0.25, (float)0.1, (float)0.25, (float)1.0};
private float[] EASE_OUT = {(float)0, (float)0, (float)0.58, (float)1.0};
private float[] EASE_IN = {(float)0.42, (float)0, (float)1.0, (float)1.0};
public static BezInterpolator getInstance(){
@KKorvin
KKorvin / LetterBitmap.java
Last active November 8, 2018 07:39
Create multi color squares with letter. For Android.
/**
* Orginal http://stackoverflow.com/questions/23122088/colored-boxed-with-letters-a-la-gmail
* Used to create a {@link Bitmap} that contains a letter used in the English
* alphabet or digit, if there is no letter or digit available, a default image
* is shown instead.
*
* Only English language supported.
*/
public class LetterBitmap {
@tonnyavery
tonnyavery / KotlinRxExt.kt
Last active April 17, 2020 11:09
Kotlin Rx Extensions
import rx.Observable
import rx.Observer
import rx.Subscriber
import rx.Subscription
import rx.functions.Action0
import rx.functions.Action1
fun <T> Observable<T>.uiSubscribe(schedulers: Schedulers, subscriber: Subscriber<in T>): Subscription {
return subscribeOn(schedulers.io)
.observeOn(schedulers.mainThread)
@vzaliva
vzaliva / ThinkLight
Created May 22, 2016 14:27
This script controll keyboard backlight on IBM ThinkPad X-series
#!/bin/bash
# Vadim Zaliva lord@crocodile.org
# based on https://gist.github.com/hadess/6847281
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@lopspower
lopspower / KeyboardUtils.java
Last active July 6, 2023 13:35
Force Hide Keyboard Android
import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
public class KeyboardUtils {
public static void hideKeyboard(Activity activity) {
View view = activity.findViewById(android.R.id.content);
@cesarferreira
cesarferreira / RxJava.md
Last active March 30, 2025 00:28
Party tricks with RxJava, RxAndroid & Retrolambda

View Click

Instead of the verbose setOnClickListener:

RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));

Filter even numbers

Observable
    .just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)