Skip to content

Instantly share code, notes, and snippets.

public class SoftInputAssist {
private View rootView;
private ViewGroup contentContainer;
private ViewTreeObserver viewTreeObserver;
private ViewTreeObserver.OnGlobalLayoutListener listener = () -> possiblyResizeChildOfContent();
private Rect contentAreaOfWindowBounds = new Rect();
private FrameLayout.LayoutParams rootViewLayout;
private int usableHeightPrevious = 0;
public SoftInputAssist(Activity activity) {
@grennis
grennis / SwipeRefreshLayoutWithEmpty.java
Created May 11, 2016 23:14
This class allows easy use of SwipeRefreshLayout with RecyclerView (or ListView) and an "empty" view that can still be pulled to refresh
package com.innodroid.sample;
import android.content.Context;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
//
@grennis
grennis / RoundedCornerLayout.java
Created April 22, 2016 14:00
Android Rounded Corner Layout
// This layout will display its children with rounded corners
// It works with Glide image library placeholders and animations
// It assumes your background is a solid color. If you need the corners to be truly transparent,
// this solution will not work for you.
package com.myapp.ui;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import shutil
import os
import json
material_dir = os.path.expanduser('~/material-design-icons-2.0/')
ios_dir = '../MyProject-ios/MyProject/Images.xcassets/'
dest_dir = 'app/src/main/res/drawable-'
densities = ['xxxhdpi', 'xxhdpi', 'xhdpi', 'hdpi', 'mdpi']
ios_res = {'1x': 'hdpi', '2x': 'xhdpi', '3x': 'xxhdpi'}