This file contains hidden or 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/sh | |
echo "Crashlytics username (e-mail):" | |
read email | |
echo "Crashlytics password:" | |
read -s password | |
data="{\"email\":\"${email}\",\"password\":\"${password}\"}" |
This file contains hidden or 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
// If you do this... | |
list.addHeaderView(headerView); | |
// And then call this inside of onItemClick, the position value will not be what you expect (header is now index 0) | |
Fruit fruit = adapter.getItem(position); | |
// This is what you really want to call inside of onItemClick | |
Fruit fruit = (Fruit) parent.getItemAtPosition(position); |
This file contains hidden or 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
package com.demo.okhttpissue; | |
import android.test.InstrumentationTestCase; | |
import com.squareup.okhttp.Callback; | |
import com.squareup.okhttp.OkHttpClient; | |
import com.squareup.okhttp.Request; | |
import com.squareup.okhttp.Response; | |
import com.squareup.okhttp.mockwebserver.MockResponse; | |
import com.squareup.okhttp.mockwebserver.MockWebServer; |
This file contains hidden or 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.graphics.Rect; | |
import android.view.View; | |
import android.widget.CheckBox; | |
/** | |
* Enlarges the effective hit target of a checkbox to more closely match the dimensions of the | |
* provided root view. If the provided root isn't actually an ancestor view of the checkbox, bad | |
* things will happen. | |
* <p/> | |
* See: http://developer.android.com/training/gestures/viewgroup.html#delegate |
This file contains hidden or 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.graphics.Rect; | |
import android.view.MotionEvent; | |
import android.view.TouchDelegate; | |
import android.view.View; | |
import android.view.ViewConfiguration; | |
/** | |
* There is a bug with TouchDelegate where ancestor views can get into an awkward state after | |
* a delegate view has been actioned upon by the touch delegate. | |
* |
This file contains hidden or 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.app.Activity; | |
import android.content.Context; | |
import android.os.PowerManager; | |
import android.os.PowerManager.WakeLock; | |
import android.test.ActivityInstrumentationTestCase2; | |
/** | |
* This requires to be declared in the effective manifest: | |
* <uses-permission android:name="android.permission.WAKE_LOCK"/> | |
* |
This file contains hidden or 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
package com.myapp; | |
public class SampleApplication extends TestingAwareApplication { | |
@Override | |
protected String getFullyQualifiedTestFile() { | |
return "com.myapp.TestMode"; | |
} | |
@Override | |
protected void initAppInstance() { |
This file contains hidden or 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/sh | |
while true; do | |
sleep 3300 # 55 min * 60 sec | |
echo "Bouncing the wifi at `date`" | |
# You might need to change en1 to something else. | |
# ifconfig can tell you what network adapter to use | |
networksetup -setairportpower en1 off | |
sleep 2 |
This file contains hidden or 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
... | |
apply plugin: 'findbugs' | |
... | |
task findbugs(type: FindBugs, dependsOn: assembleDebug) { | |
excludeFilter file("${project.rootDir}/config/findbugs/exclude.xml") | |
classes = fileTree('build/intermediates/classes/debug/') // Varies based on your app build configs and flavors... | |
source = fileTree('src/main/java/') |
This file contains hidden or 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 checkHasPermission(Context contxt, String permissionName) { | |
String packageName = context.getPackageName(); | |
PackageManager packageManager = context.getPackageManager(); | |
int permissionStatus = packageManager.checkPermission(permissionName, packageName); | |
if (permissionStatus != PackageManager.PERMISSION_GRANTED) { | |
throw new SecurityException("Application requires <uses-permission android:name=\"" + permissionName + "\" />"); | |
} | |
} |