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/bash | |
| # Will find all emulator processes that have been running longer than an hour, and kill -9 them. | |
| SEARCH_TERM="qemu-system" | |
| echo "$(ps eaxo etime,pid,comm | grep ${SEARCH_TERM})" | while read line | |
| do | |
| if [ "${#line}" -gt 0 ]; then | |
| echo "Found Emulator -> $line" | |
| COLUMNS=() | |
| for word in $line |
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.vinaysshenoy.multitouch.widget.matrixtest; | |
| import android.content.Context; | |
| import android.graphics.Canvas; | |
| import android.graphics.Color; | |
| import android.graphics.Matrix; | |
| import android.graphics.Paint; | |
| import android.graphics.Path; | |
| import android.graphics.RectF; | |
| import android.support.annotation.Nullable; |
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
| /** | |
| * Logs lifecycle events and provides subclasses a method to bind the views, bindViews(). | |
| * | |
| * Note that the bindViews() uses Butterknife to bind the views. However, the views | |
| * can also be bound without using Butterknife. Using Butterknife or not | |
| * plays no part in this demonstration. | |
| */ | |
| // BaseFragment.java | |
| public abstract class BaseFragment extends Fragment { |
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
| task deployDebug(type: Exec, dependsOn: 'app:installDebug') { | |
| def rootDir = project.rootDir | |
| def localProperties = new File(rootDir, "local.properties") | |
| if (localProperties.exists()) { | |
| Properties properties = new Properties() | |
| localProperties.withInputStream { | |
| inputStream -> properties.load(inputStream) | |
| } | |
| def sdkDir = properties.getProperty('sdk.dir') | |
| def adb = "$sdkDir/platform-tools/adb" |
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
| android.permission.ACCESS_ALL_DOWNLOADS | |
| android.permission.ACCESS_BLUETOOTH_SHARE | |
| android.permission.ACCESS_CACHE_FILESYSTEM | |
| android.permission.ACCESS_CHECKIN_PROPERTIES | |
| android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY | |
| android.permission.ACCESS_DOWNLOAD_MANAGER | |
| android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED | |
| android.permission.ACCESS_DRM_CERTIFICATES | |
| android.permission.ACCESS_EPHEMERAL_APPS | |
| android.permission.ACCESS_FM_RADIO |
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
| android.applicationVariants.all { variant -> | |
| def applicationId = variant.applicationId | |
| def adb = androidadbExe. as String | |
| def variantName = variant.name.capitalize() | |
| def grantPermissionTask = task.create("create${variantName}Permissions") << { | |
| "${adb} devices".execute().text.eachLine { | |
| if(it.endsWith("device")){ | |
| def device = it.split()[0] | |
| println "Granting permissions on devices ${device}" | |
| "${adb} -s ${devices} shell pm grant ${applicationId} android.permission.ACCESS_FINE_LOCATION".execute() |
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 java.io.IOException; | |
| import okhttp3.HttpUrl; | |
| import okhttp3.Interceptor; | |
| import okhttp3.OkHttpClient; | |
| import okhttp3.Request; | |
| /** An interceptor that allows runtime changes to the URL hostname. */ | |
| public final class HostSelectionInterceptor implements Interceptor { | |
| private volatile String host; |
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
| def publish = project.tasks.create("copyReleaseApkToCustomDir") | |
| publish.description "Copies release apk to custom directory" | |
| android.applicationVariants.all { variant -> | |
| if (variant.buildType.name.equals("release")) { | |
| variant.outputs.each { output -> | |
| if ( output.outputFile != null && output.outputFile.name.endsWith('.apk')) { | |
| def task = project.tasks.create("copyAndRename${variant.name}Apk", Copy) | |
| def outputFile = output.outputFile | |
| println "Creating " + rootProject.name + "-${versionName}.apk" + " from " + project.name + "-${variant.name}.apk" |
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
| project.afterEvaluate { | |
| project.("connectedDebugAndroidTest").doFirst { | |
| def originalProvider = deviceProvider | |
| deviceProvider = [ | |
| getName : { originalProvider.getName() }, | |
| init : { originalProvider.init() }, | |
| terminate : { originalProvider.terminate() }, | |
| getDevices : { filterDevices(originalProvider.getDevices()) }, | |
| getTimeoutInMs: { originalProvider.getTimeoutInMs() }, | |
| isConfigured : { originalProvider.isConfigured() }, |