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
package in.curtech.android.common; | |
import android.content.BroadcastReceiver; | |
/** | |
* Extension of {@code BroadcastReceiver} meant to be used in conjunction with | |
* {@link OrderEnabledLocalBroadcastManager} | |
* | |
* @author Kiran Rao | |
*/ |
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 static org.fest.reflect.core.Reflection.*; | |
import android.net.nsd.NsdServiceInfo; | |
public class ReflectionUtils { | |
public static int extractTxtRecordFromServiceInfo(NsdServiceInfo serviceInfo) { | |
Class<?> dnsSdTxtRecordType = type("android.net.nsd.DnsSdTxtRecord") | |
.load(); | |
Object txtRecord = | |
method("getTxtRecord") | |
.withReturnType(dnsSdTxtRecordType) |
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.annotation.TargetApi; | |
import android.os.AsyncTask; | |
import android.os.Build; | |
public class AsyncTaskUtils { | |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) | |
public static <P> void executeAsyncTaskInParallel( | |
AsyncTask<P, ?, ?> asyncTask, P... params) { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { |
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 class MainActivity extends Activity { | |
private TextView tvHello; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
setContentView(R.layout.layout); | |
tvHello = (TextView) findViewById(R.id.tv_hello); | |
} | |
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
"Revealing Module Pattern with constructor": { | |
"prefix": "reveal", | |
"body": [ | |
"var ${1:ModuleName} = (function () {", | |
" var that,", | |
" constr = function (${2:constr_param}) {", | |
" that = this;", | |
" this.$2 = $2;", | |
" },", | |
"", |
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
* { | |
font-size: 12pt; | |
font-family: monospace; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: none; | |
color: black; | |
cursor: default; | |
} |
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
apply plugin: 'java' | |
sourceCompatibility = JavaVersion.VERSION_1_7 | |
targetCompatibility = JavaVersion.VERSION_1_7 | |
def logger = new com.android.build.gradle.internal.LoggerWrapper(project.logger) | |
def sdkHandler = new com.android.build.gradle.internal.SdkHandler(project, logger) | |
for (File file : sdkHandler.sdkLoader.repositories) { | |
project.repositories.maven { | |
url = file.toURI() |
NewerOlder