Skip to content

Instantly share code, notes, and snippets.

View mseroczynski's full-sized avatar

Michał Seroczyński mseroczynski

View GitHub Profile
@gmk57
gmk57 / 1 ViewBindingDelegates.kt
Last active January 25, 2024 09:01
Kotlin delegates for Android View Binding with usage examples
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.viewbinding.ViewBinding
def reportsDirectory = "$buildDir/artifacts/composer-output"
def embedScreenshotsTask = task('embedScreenshots', group: 'reporting') {
dependsOn {
fetchScreenshotsTask
}
doFirst {
println new File(reportsDirectory, 'screenshots/failures')
@delacrixmorgan
delacrixmorgan / ViewPagerPeeking.md
Created March 18, 2019 02:37
Animate ViewPager to Peek when Tapped on It

Animate ViewPager to Peek when Tapped on It

Calling Method

this.viewPager.animatePeekingEffect(offset = 10, delay = 250)

Extension Methods

fun ViewPager.animatePeekingEffect(offset: Int, delay: Int) {
@RubyLichtenstein
RubyLichtenstein / PainlessFragmentArguments.md
Last active February 11, 2021 00:40
Painless android fragments with Kotlin

Starting new fragments with Kotlin is easy

Example

val user = User(id = "id", name = "Ruby")
val userFragment: UserFragment = newFragment<User, UserFragment>(user)

How this magic works

@julianfalcionelli
julianfalcionelli / RxErrorHandlingCallAdapterFactory.java
Last active June 21, 2022 08:55
Rx Error Handling for Retrofit2
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import io.reactivex.Completable;
import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.Single;
import io.reactivex.SingleSource;
import io.reactivex.annotations.NonNull;
@odigity
odigity / Firebase Database API Cheatsheet
Last active June 9, 2022 03:45
Firebase Database API Cheatsheet
There is no way to store an empty object/array/null value.
There are also no actual arrays. Array values get stored as objects with integer keys.
(If all keys are integers, it will be returned as an array.)
Basically, it's one giant tree of hashes with string keys.
Simply write a value to any location, and the intermediary locations will automatically come into existance.
── Classes ──
DataSnapshot : Container for a subtree of data at a particular location.
@amaksoft
amaksoft / Jenkinsfile
Last active December 29, 2021 08:15
My example Jenkins Pipeline setup for Android app project
#!/usr/bin/groovy
/*
* Copyright (c) 2016, Andrey Makeev <amaksoft@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
@KishorFlutter
KishorFlutter / AesDataSource.java
Created June 16, 2016 06:55
AES data source for real-time decryption of media content
package com.google.android.exoplayer.demo;
import android.content.Context;
import android.util.Log;
import com.google.android.exoplayer.C;
import com.google.android.exoplayer.upstream.DataSpec;
import com.google.android.exoplayer.upstream.TransferListener;
import com.google.android.exoplayer.upstream.UriDataSource;
@karthikrg
karthikrg / gist:0948bf5d7864c0376bcd
Created February 20, 2016 01:24
Coordinator layout that supports nesting of other coordinator layouts within
package android.support.design.widget;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.NestedScrollingChildHelper;
import android.util.AttributeSet;
import android.view.View;
/**