Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ozodrukh's full-sized avatar
🎃
woah, how close was that?

Ozodrukh ozodrukh

🎃
woah, how close was that?
View GitHub Profile
@wispborne
wispborne / Preferences.kt
Last active July 21, 2022 03:47
Android SharedPreferences helper class for Kotlin. Easy-to-use delegated properties, automatic database creation, and listening for property changes.
import android.content.Context
import android.content.SharedPreferences
import kotlin.reflect.KProperty
/**
* Represents a single [SharedPreferences] file.
*
* Usage:
*
* ```kotlin
package spoon.test;
import spoon.reflect.declaration.*;
import java.util.ArrayList;
import java.util.IntSummaryStatistics;
import java.util.TreeSet;
import java.util.function.Consumer;
import java.util.function.ToIntFunction;
@mpost
mpost / colors.xml
Last active January 8, 2020 02:09
This gist demonstrates how to create an animated pause/resume media playback button for Android. It uses animated vector drawables and state transitions to orchestrate the effect. Some background: https://plus.google.com/u/0/+MoritzPost/posts/3EFF8uC7jXv
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="action_pause">#FF8F00</color>
<color name="action_resume">#43A047</color>
</resources>
@bryanstern
bryanstern / OkHttpStack.java
Last active April 24, 2022 03:17
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@rock3r
rock3r / prepareassets.sh
Last active April 28, 2017 23:43
Move/rename *-{m|h|xh|xxh|xxxh}dpi.png" assets into proper folder structure, ready for copypasta
#!/bin/bash
# License for any modification to the original (linked below):
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Sebastiano Poggi wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return.
# ----------------------------------------------------------------------------
prefix=${1-"drawable"}
buckets=( mdpi hdpi xhdpi xxhdpi xxxhdpi )
@chris95x8
chris95x8 / UIActivity.java
Created December 13, 2014 22:35
FAB expand
package com.materialdesign.chris.materialdesignexperimenting;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.ViewAnimationUtils;
@chris95x8
chris95x8 / CubicBezierInterpolator.java
Created December 12, 2014 13:59
Bunch of interpolators for awesome animations in Android!
import android.graphics.PointF;
import android.view.animation.Interpolator;
/**
* From https://github.com/codesoup/android-cubic-bezier-interpolator
* Derived from: https://github.com/rdallasgray/bez
*/
public class CubicBezierInterpolator implements Interpolator {
@chrisbanes
chrisbanes / CollapsingTitleLayout.java
Last active March 26, 2023 11:58
CollapsingTitleLayout
/*
* Copyright 2014 Chris Banes
*
* 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
@ozodrukh
ozodrukh / HideExtraOnScroll.java
Created November 16, 2014 11:20
Show/Hide extra objects when scrolling
public static class HideExtraOnScroll extends RecyclerView.OnScrollListener{
final static Interpolator ACCELERATE = new AccelerateInterpolator();
final static Interpolator DECELERATE = new DecelerateInterpolator();
WeakReference<View> mTarget;
HideExtraOnScrollHelper mScrollHelper;
boolean isExtraObjectsOutside;