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 main (String args[]) { | |
System.out.println("Hello world!"); | |
} |
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 com.philosophicalhacker.philosopy; | |
/** | |
* This class contains some methods for evaluating arguments that | |
* attempt to defend the moral permissibility of pirating. | |
* | |
* It also contains a <code>main()</code> method that uses | |
* this class to show that several of the arguments made in | |
* defense of pirating aren't really that compelling. | |
* |
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 ActionBarActivity implements View.OnClickListener { | |
@Override | |
public void onClick(View v) { | |
mApiService.submitCredentials(mCredentials) | |
.subscribe(new Subscriber<RegistrationResponse>() { | |
@Override | |
public void onCompleted() { |
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 ActionBarActivity implements View.OnClickListener { | |
... | |
@Override | |
protected void onDestroy() { | |
super.onDestroy(); | |
mSubscribtion.unsubscribe(); | |
} |
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 WeakSubscriberDecorator<T> extends Subscriber<T> { | |
private final WeakReference<Subscriber<T>> mWeakSubscriber; | |
public WeakSubscriberDecorator(Subscriber<T> subscriber) { | |
this.mWeakSubscriber = new WeakReference<Subscriber<T>>(subscriber); | |
} | |
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 SafeObservable<T> extends Observable<T> { | |
/** | |
* Creates an Observable with a Function to execute when it is subscribed to. | |
* <p/> | |
* <em>Note:</em> Use {@link #create(rx.Observable.OnSubscribe)} to create an Observable, instead of this constructor, | |
* unless you specifically have a need for inheritance. | |
* | |
* @param f {@link rx.Observable.OnSubscribe} to be executed when {@link #subscribe(Subscriber)} is called | |
*/ |
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
@Override | |
public void onStop() { | |
super.onStop(); | |
if (mInitStarred != mStarred) { | |
if (UIUtils.getCurrentTime(this) < mSessionStart) { | |
// Update Calendar event through the Calendar API on Android 4.0 or new versions. | |
Intent intent = null; | |
if (mStarred) { | |
// Set up intent to add session to Calendar, if it doesn't exist already. | |
intent = new Intent(SessionCalendarService.ACTION_ADD_SESSION_CALENDAR, |
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 void onSessionQueryComplete(Cursor cursor) { | |
final boolean inMySchedule = cursor.getInt(SessionsQuery.IN_MY_SCHEDULE) != 0; | |
//... | |
if (!mIsKeynote) { | |
showStarredDeferred(mInitStarred = inMySchedule, false); | |
} | |
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 void testSquare() { | |
MathNerd mathNerd = new MathNerd(); | |
int result = mathNerd.square(2); | |
assertEquals(result, 4); | |
} |
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 void testSquare() { | |
MathNerd mathNerd = new MathNerd(); | |
int result = mathNerd.square(2); | |
assertTrue(mathNerd.didDoMath()); | |
} |
OlderNewer