Skip to content

Instantly share code, notes, and snippets.

Avatar

Dave Smith devunwired

View GitHub Profile
@onyxmueller
onyxmueller / strip_google_play_services.gradle
Last active Aug 29, 2015
Strip Google Play Services Packages
View strip_google_play_services.gradle
import groovy.transform.Field
// This is a drop-in Gradle script that allows you to easily strip out the packages you don't need
// from the Google Play Services library. The script will keep track of previous runs to prevent
// restripping each time you build.
// HOW TO USE THIS
//
// 1) Download/copy this strip_google_play_services.gradle file into the same location of your app's
// build.gradle file.
@JakeWharton
JakeWharton / README.md
Last active Jan 8, 2020
A special activity which facilitates restarting your application process.
View README.md
@rallat
rallat / dexmethodcount
Last active Dec 14, 2015
Android Dex Method Count more sophisticated scripts that gives you method cound by package @JakeWharton https://gist.github.com/JakeWharton/6002797 and @tsmith https://gist.github.com/tyvsmith/6056422
View dexmethodcount
You can add this to your shell profile and then use it as dexcount file.
This file should have a classes.dex in order to work, that means it has to be a android lib project or android apk.
count(){
mkdir temp >/dev/null
cp $1 temp/$1+copy > /dev/null
unzip temp/$1+copy -d temp/ > /dev/null
cat temp/classes.dex | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
rm -R temp > /dev/null
}
@JakeWharton
JakeWharton / dex.sh
Last active Jan 6, 2020
`classes.dex` method count helpers. Requires smali/baksmali from https://code.google.com/p/smali/ and dexdump from the build-tools in the Android SDK be on your PATH.
View dex.sh
function dex-method-count() {
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
}
function dex-method-count-by-package() {
dir=$(mktemp -d -t dex)
baksmali $1 -o $dir
for pkg in `find $dir/* -type d`; do
smali $pkg -o $pkg/classes.dex
count=$(dex-method-count $pkg/classes.dex)
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.')
@devunwired
devunwired / GifDecoder.java
Last active Aug 26, 2020
An optimized implementation of GifDecoder for Android devices.
View GifDecoder.java
/**
* Copyright (c) 2013 Xcellent Creations, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@devunwired
devunwired / background_dialog.xml
Created Nov 14, 2012
XML Shape Drawable for Dialog Backgrounds. Applies a fixed outer margin to keep background from fully stretching to screen edge, and allows for additional internal padding to apply to the dialog content.
View background_dialog.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Apply the margin value on the "item" element -->
<!-- This example creates a 15dp visible margin around the dialog -->
<item
android:top="15dp"
android:bottom="15dp"
android:left="15dp"
android:right="15dp">
<shape
@romannurik
romannurik / SwipeDismissListViewTouchListener.java
Last active Jan 15, 2020
**BETA** Android 4.0-style "Swipe to Dismiss" sample code
View SwipeDismissListViewTouchListener.java
Moved to
https://github.com/romannurik/android-swipetodismiss
You can’t perform that action at this time.