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 View getView(int position, View convertView, ViewGroup parent) { | |
ViewHolder holder; | |
//If convertView is null, we inflate our Layout in convertView. | |
if (convertView == null) { | |
convertView = mInflater.inflate(R.layout.item_layout, parent, false); | |
//We instantiate our ViewHolder object, in order to use it below. |
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.content.Context; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.ArrayAdapter; | |
import android.widget.TextView; | |
import java.util.List; |
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
mLoginButton.setReadPermissions("public_profile", "email"); | |
mLoginButton.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() { | |
@Override | |
public void onSuccess(LoginResult loginResult) { | |
Timber.e("Result:" + loginResult.getAccessToken()); | |
gotFacebookPermission = true; | |
startRequestingFacebookStaff(loginResult.getAccessToken()); | |
} |
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 | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
super.onActivityResult(requestCode, resultCode, data); | |
mCallbackManager.onActivityResult(requestCode,resultCode,data); | |
} |
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 reveal(View sourceView, int colorRes) { | |
groupOverlay = | |
(ViewGroupOverlay) getWindow().getDecorView().getOverlay(); | |
final Rect displayRect = new Rect(); | |
mMainDisplay.getGlobalVisibleRect(displayRect); | |
// Make reveal cover the display and status bar. | |
revealView = new View(this); | |
revealView.setBottom(displayRect.bottom); |
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
final Action1<T> consumer = new Action1<T>() { | |
@Override | |
public void call(T latest) { | |
if (last == NONE) last = latest; | |
} | |
}; |
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 Observable<T> call(Observable<T> upstream) { | |
final LastSeen<T> lastSeen = new LastSeen<>(); | |
return upstream | |
.doOnNext(lastSeen.consumer) | |
.share() | |
.flatMap(new Func1<T, Observable<T>>() { | |
@Override | |
public Observable<T> call(T t) { | |
return lastSeen.producer; |
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
service | |
.getMessages() | |
.subscribe(new Subscriber<List<Message>>(){ | |
@Override | |
public void onCompleted(){} | |
@Override | |
public void onError(Throwable e) { | |
ErrorHandler | |
.create() |
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
ErrorHandler | |
.defaultErrorHandler() | |
.bindErrorCodeClass(Integer.class, RetrofitMatcherFactory.create()) | |
.bindErrorCodeClass(Range.class, RetrofitMatcherFactory.createRange()) | |
.on(400, (throwable, errorHandler) -> showErrorMessage("what?")) | |
.on(Range.of(500, 599), (throwable, errorHandler) -> showErrorMessage("kaboom")) | |
.handle(httpException); |
OlderNewer