This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Task to compile, install and run the debug build on a device/emulator | |
task run(type: Exec, dependsOn: 'installDebug') { | |
commandLine 'adb', 'shell', 'am', 'start', '-n', 'com.myapp/.MyFirstActivity' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while true | |
do | |
ping -c 1 www.example.com &> /dev/null | |
if [ $? -ne 0 ]; then | |
echo `date`: ping failed! | |
say "Hey network admin - internet is down" -v bruce | |
fi | |
sleep 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void hideKeyboard(Context context) { | |
InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE); | |
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Built application files | |
*.apk | |
*.ap_ | |
# Files for the Dalvik VM | |
*.dex | |
# Java class files | |
*.class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private long mLastClickTime = 0; | |
protected boolean isNotAFastClick() { | |
boolean result = true; | |
if (SystemClock.elapsedRealtime() - mLastClickTime < FAST_CLICK_THRESHOLD) { | |
result = false; | |
} | |
mLastClickTime = SystemClock.elapsedRealtime(); | |
return result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.util.Log; | |
/** | |
* @author Mustafa Ali | |
*/ | |
public class L { | |
private static final String LOG_TAG = "MyAwesomeApp"; | |
private static final boolean IS_LOGGING_ENABLED = true; | |
public static void d(String msg) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Handler; | |
import android.os.Looper; | |
import com.squareup.otto.Bus; | |
/** | |
* @author Mustafa Ali | |
*/ | |
public class AppBus { | |
private Bus mBus = new Bus(); |