Skip to content

Instantly share code, notes, and snippets.

View Samnan's full-sized avatar
⚒️

Samnan ur Rehman Akhoond Samnan

⚒️
View GitHub Profile
@cbeyls
cbeyls / SafeLoadersFragmentActivity.java
Last active April 27, 2019 12:16
Activity to restore the safe Loaders behavior of support libraries < 24.0.0 in recent versions
package android.support.v4.app;
/**
* Inherit from this class to prevent Loaders from being forcefully retained during a configuration change.
* Forceful retain currently causes all stopped Loaders to briefly start, causing unexpected issues for detached fragments.
* This restores the Loaders behavior of support libraries < 24.0.0
*
* @author Christophe Beyls
* @see <a href="https://issuetracker.google.com/issues/37916599">Bug report</a>
*/
@cbeyls
cbeyls / RefreshProgressBar.java
Last active January 1, 2019 14:37
A custom horizontal indeterminate progress bar which displays a smooth colored animation. (Google Now progress bar)
package android.support.v4.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.os.Handler;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
@cbeyls
cbeyls / ParallaxScrollView.java
Last active September 15, 2018 14:54
Simplest implementation of a parallax header effect for Android.
package be.digitalia.common.widgets;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ScrollView;
@cbeyls
cbeyls / PreferenceFragment.java
Last active April 6, 2023 09:07
A PreferenceFragment for the Android support library. Based on the platform's code with some removed features and a basic ListView layout.It uses reflection but works with every device I've tested so far.
package android.support.v4.preference;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;