Skip to content

Instantly share code, notes, and snippets.

@peterkuterna
peterkuterna / CursorFragmentPagerAdapter.java
Created July 19, 2012 14:20
A FragmentPagerAdapter that exposes data from a Cursor
package com.example;
import android.content.Context;
import android.database.Cursor;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.SparseIntArray;
import android.view.ViewGroup;
// additional required configuration to hook into the build script
android {
signingConfigs {
release
}
buildTypes {
release {
signingConfig signingConfigs.release
}
import com.android.volley.toolbox.HurlStack;
import com.squareup.okhttp.OkHttpClient;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* An {@link com.android.volley.toolbox.HttpStack HttpStack} implementation which
* uses OkHttp as its transport.
*/
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
package your.awesome.app;
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
import com.android.volley.toolbox.ImageLoader.ImageCache;
public class LruBitmapCache extends LruCache<String, Bitmap> implements ImageCache {
public LruBitmapCache(int maxSize) {
super(maxSize);
public class OverscrollUtilities {
public static void disableOverscrollMode(View view) {
if (view instanceof ListView) {
try {
ListView listView = (ListView) view;
Method setEnableExcessScroll = ListView.class.getMethod("setEnableExcessScroll", Boolean.TYPE);
if (setEnableExcessScroll != null) {
setEnableExcessScroll.invoke(listView, Boolean.valueOf(false));
}
@peterkuterna
peterkuterna / gist:8245223
Created January 3, 2014 19:47
Nexus 5 in DE
1. Create an account at mailboxde.com and use it as package forwarder
2. Use a DE proxy/VPN. E.g. select one from http://www.proxynova.com/proxy-server-list/country-de/
3. Create a new Google account
4. Use address of mailboxde.com for your Google and Wallet account
5. Add a credit card with the following shipping address:
Mailboxde.com
Dresdner Str. 9
z. Hd. <first name> <last name>, ID <mailboxde id>
Zittau 02763 DE
+49 3583 8355148
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
import android.content.Context;
import android.graphics.Bitmap;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import com.squareup.picasso.Transformation;
public class BlurTransform implements Transformation {
# add the webupd8team java PPA
sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
# install oracle java 6
sudo apt-get install oracle-java6-installer