Skip to content

Instantly share code, notes, and snippets.

View rubenpla-develop's full-sized avatar

Ruben Pla Ferrero rubenpla-develop

  • Barcelona, Spain.
View GitHub Profile
@Override
public void onResult(People.LoadPeopleResult loadPeopleResult) {
if (!loadPeopleResult.getStatus().isSuccess()) {
Log.e(TAG, loadPeopleResult.getStatus().toString());
return;
}
PersonBuffer people = loadPeopleResult.getPersonBuffer();
Log.d(TAG, "" + people.getCount());
for(Person p : people) {
Log.d(TAG, p.getDisplayName()); // For example.
@jpardogo
jpardogo / ScaleToFitWHTransformation.java
Last active June 11, 2020 08:09
Resize a bitmap respecting the aspect radio. I use a custom transformations with Picasso library. This transformation calculate the new dimension of the bitmap scaling it to fit a specific width or height that we pass as a parameter (usually the biggest size of the imageView where we wanna set the bitmap).
public class ScaleToFitWidthHeightTransform implements Transformation {
private int mSize;
private boolean isHeightScale;
public ScaleToFitWidthHeightTransform(int size, boolean isHeightScale){
mSize =size;
this.isHeightScale = isHeightScale;
}
@rupertbates
rupertbates / WebviewArticlePresenter.java
Last active December 25, 2016 08:43
Work out the maximum scroll extent of an Android WebView
int maxScrollExtent = (int) ((mOverlayTop.getContentHeight() * mOverlayTop.getScale()) - mOverlayTop.getHeight());