Skip to content

Instantly share code, notes, and snippets.

View thomaseb's full-sized avatar

Thomas Ezan thomaseb

View GitHub Profile
@thomaseb
thomaseb / HardwareMenuButtonTest.java
Created January 7, 2013 05:31
Check if the Android device has a hardware menu button.
[...]
if (VERSION.SDK_INT >= 11 && !ViewConfiguration.get(getActivity()).hasPermanentMenuKey()) {
// DOESN'T HAVE a hardware menu button
// Do stuff...
} else {
// HAS a hardware menu button
// Do stuff...
}
@thomaseb
thomaseb / gist:4342476
Created December 20, 2012 02:28
Cleanup the unused string resources from your default values/string.xml (you should run it at the path of your project) AndroidUnusedResources can be find at: http://code.google.com/p/android-unused-resources/
java -jar AndroidUnusedResourcesX.X.X.jar | grep 'string :\| /your_path_to_values/strings.xml'
@thomaseb
thomaseb / smoketests.sh
Created July 19, 2012 16:50
Run smoke tests before and after the upgrade and after a fresh install of an Android app
#!/bin/bash
# Prefix the apk file name of the previous version with "a" (e.g myAppV1.apk => amyAppV1.apk)
# Prefix the apk file name of the current version with "b" (e.g myAppV2.apk => bmyAppV2.apk)
# Run this script un a folder holding the apk of your current version and the previous version.
APP_PACKAGE="whatever.your.app.package.is"
TEST_PACKAGE="whatever.your.test.package.is"
echo -en "###############################\n\r"
@thomaseb
thomaseb / Preferences.sublime-settings
Created May 8, 2012 22:50
Sumblime text 2 : draw all the spaces
{
"draw_white_space": "all"
}
@thomaseb
thomaseb / hiddekeyboard.java
Created April 19, 2012 21:59
Hidde Keyboard on Android
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);