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.assertions.api.Assertions.assertThat; | |
assertThat(intentOne).usingComparator(new IntentComparator()).isEqualTo(intentTwo); | |
private static class IntentComparator implements Comparator<Intent> { | |
@Override | |
public int compare(Intent left, Intent right) { | |
return left.filterEquals(right) ? 0 : 1; | |
} | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.blundell.brittle.example"> | |
<application | |
android:allowBackup="true" | |
android:icon="@drawable/ic_launcher" | |
android:label="@string/app_name" | |
android:theme="@style/AppTheme"> |
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 AdMobPokerExampleActivity extends Activity { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
AdMobPoker.track(findViewById(R.id.adView), savedInstanceState); | |
} |
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 ExampleActivity extends Activity implements WatchFaceLifecycle.Listener { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_my_layout); | |
WatchFaceLifecycle.attach(this, savedInstanceState, this); | |
} | |
@Override |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
// Code readability - 4 possibilities | |
// A | |
context.getContentResolver().update(getDownloadUri(context, intent), values, null, null); | |
// vs | |
// B | |
context.getContentResolver().update( | |
getDownloadUri(context, intent), values, null, null); | |
// vs |
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 com.puppycrawl.tools.checkstyle.api.*; | |
public class AntiHungarianCheck extends Check { | |
private static final String CATCH_MSG = "Hungarian notation belongs in the 90's. " + | |
"Don't prefix member variables with 'm'. " + | |
"Use your IDE's shiny colors. Culprit was: "; | |
private final HungarianNotationMemberDetector detector = new HungarianNotationMemberDetector(); |
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
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<VideoView | |
android:id="@+id/my_video_view" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:layout_gravity="center" /> |
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
subprojects { | |
buildscript { | |
repositories { | |
mavenCentral() | |
maven { | |
url "https://oss.sonatype.org/content/repositories/snapshots" | |
} | |
maven { | |
url "https://github.com/novoda/public-mvn-repo/raw/master/releases" | |
} |
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 NavDrawerArrayAdapter extends ArrayAdapter<String> { | |
public NavDrawerArrayAdapter(final Context context) { | |
super(context, android.R.layout.simple_list_item_activated_1, android.R.id.text1, | |
new ArrayList<String>() {{ | |
add(context.getString(R.string.nav_drawer_section_explore)); | |
add(context.getString(R.string.nav_drawer_section_rewards)); | |
add(context.getString(R.string.nav_drawer_section_offers)); | |
add(context.getString(R.string.nav_drawer_section_events)); | |
}}); | |
refresh(); |