Skip to content

Instantly share code, notes, and snippets.

View scottyab's full-sized avatar

Scott Alexander-Bown scottyab

View GitHub Profile
@scottyab
scottyab / proguard-project.txt
Created August 23, 2013 13:02
Android Proguard config to remove all logging. Remember to enabled the -optimize progaurd config
#Remove Android logging code
-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String, int);
public static int v(...);
public static int i(...);
public static int w(...);
public static int d(...);
public static int e(...);
public static java.lang.String getStackTraceString(java.lang.Throwable);
}
@scottyab
scottyab / MyXofYPagerAdapter.java
Created April 16, 2013 19:59
PagerAdapter X of Y. When using a view pager you can simply override the getPageTitle to create a page x of y text as seen in apps like gmail. This was used in a app to swipe through the RSS stories with android.support.v4.app.FragmentPagerAdapter. Alternatively you could use something like https://github.com/ManuelPeinado/NumericPageIndicator
public class MyXofYPagerAdapter extends FragmentPagerAdapter {
private final ArrayList<RssItem> items;
public MyXofYPagerAdapter(FragmentManager fm,
ArrayList<RssItem> items) {
super(fm);
this.items = items;
}
@Override
@scottyab
scottyab / ConvertLatLongToStaticMapUri
Created May 3, 2012 14:46
Quick and dirty util to convert a lat/long into a uri for google static maps.
/**
* simple util to build the static google map url for the lat/long
* @param latitude
* @param longitude
* @return static google map url
*/
public static Uri buildStaticGoogleMapUrlForAddress(String latitude, String longitude){
Builder builder = Uri.parse("http://maps.google.com/maps/api/staticmap").buildUpon();
builder.appendQueryParameter("center", latitude+","+longitude);