Skip to content

Instantly share code, notes, and snippets.

View yekmer's full-sized avatar

Yekmer Simsek yekmer

View GitHub Profile
@okmanideep
okmanideep / BetterRecyclerView.java
Last active March 3, 2022 17:18
A RecyclerView that intercepts the scroll only if the user is scrolling in that direction
public class BetterRecyclerView extends RecyclerView{
private static final int INVALID_POINTER = -1;
private int mScrollPointerId = INVALID_POINTER;
private int mInitialTouchX, mInitialTouchY;
private int mTouchSlop;
public BetterRecyclerView(Context context) {
this(context, null);
}
public BetterRecyclerView(Context context, @Nullable AttributeSet attrs) {
@cdsap
cdsap / AndroidManifest.xml
Last active January 7, 2021 17:59
Example ManifestPlaceHolder
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapplication" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
@steveliles
steveliles / Foreground.java
Created April 20, 2014 15:30
Class for detecting and eventing the foreground/background state of an Android app - API-level 14+
package com.sjl.util;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import java.util.List;
@JakeWharton
JakeWharton / AspectRatioImageView.java
Created June 2, 2012 02:14
ImageView that respects an aspect ratio applied to a specific measurement.
// Copyright 2012 Square, Inc.
package com.squareup.widgets;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ImageView;
/** Maintains an aspect ratio based on either width or height. Disabled by default. */
public class AspectRatioImageView extends ImageView {