Skip to content

Instantly share code, notes, and snippets.

:shipit:
barteklipinski.com

Bartek Lipinski blipinsk

:shipit:
barteklipinski.com
Block or report user

Report or block blipinsk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@blipinsk
blipinsk / Component.kt
Last active Jul 22, 2019
Dagger NPE issue: [Kotlin + Generics + Abstract classes]
View Component.kt
package com.barteklipinski.example.daggernpe
import dagger.Component
import javax.inject.Singleton
@Singleton
@Component(
modules = [Module::class]
)
interface Component {
@blipinsk
blipinsk / ScaledAndroidDelays.kt
Created Apr 24, 2019
Scaled delays, for synchronising coroutines with Android animations
View ScaledAndroidDelays.kt
import android.app.Activity
import android.os.Build
import android.provider.Settings
import kotlinx.coroutines.delay
public suspend fun transitionDelay(timeMillis: Long, activity: Activity) {
val transitionAnimationScale =
if (Build.VERSION.SDK_INT >= 17) {
Settings.Global.getFloat(
activity.contentResolver,
@blipinsk
blipinsk / DebouncingOnClickListener.java
Last active Jan 8, 2018
[Medium] Butterknife's DebouncingOnClickListener as interface
View DebouncingOnClickListener.java
public interface DebouncingOnClickListener extends View.OnClickListener {
Enabled enabled = new Enabled(true);
Runnable ENABLE_AGAIN = () -> enabled.set(true);
void doClick(View v);
@Override
default void onClick(View v) {
@blipinsk
blipinsk / DebouncingOnClickListener.java
Last active Sep 30, 2017
[Medium] Butterknife's DebouncingOnClickListener as abstract class
View DebouncingOnClickListener.java
public abstract class DebouncingOnClickListener implements View.OnClickListener {
static boolean enabled = true;
private static final Runnable ENABLE_AGAIN = new Runnable() {
@Override
public void run() {
enabled = true;
}
};
@blipinsk
blipinsk / BindingViewHolder.java
Last active Oct 13, 2017
The easiest way to use ViewDataBinding with RecyclerView.ViewHolder
View BindingViewHolder.java
/*
* Copyright 2017 Bartosz Lipinski
*
* 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
@blipinsk
blipinsk / OrderedRobolectricTestRunner.java
Created Jan 25, 2017
A Robolectric Test Runner (can easily be just a regular JUnit Runner) that can execute test methods in specific order.
View OrderedRobolectricTestRunner.java
/*
* Copyright 2017 Bartosz Lipinski
*
* 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
@blipinsk
blipinsk / ControllableAppBarLayout.java
Last active Nov 28, 2018
An extension of Android AppBarLayout, that allows to programatically change the CollapsibleToolbarLayout state
View ControllableAppBarLayout.java
/**
* Copyright 2015 Bartosz Lipinski
*
* 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
You can’t perform that action at this time.