Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom authored Dec 11, 2016
1 parent 1d29ebd commit 0b1ceef
Showing 1 changed file with 0 additions and 63 deletions.
63 changes: 0 additions & 63 deletions app/src/main/java/io/plaidapp/ui/DribbbleLogin.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,67 +220,4 @@ public void onFailure(Call<User> call, Throwable t) {
}
});
}

private void forceSharedElementLayout() {
int widthSpec = View.MeasureSpec.makeMeasureSpec(container.getWidth(),
View.MeasureSpec.EXACTLY);
int heightSpec = View.MeasureSpec.makeMeasureSpec(container.getHeight(),
View.MeasureSpec.EXACTLY);
container.measure(widthSpec, heightSpec);
container.layout(container.getLeft(), container.getTop(), container.getRight(), container
.getBottom());
}

private SharedElementCallback sharedElementEnterCallback = new SharedElementCallback() {
@Override
public View onCreateSnapshotView(Context context, Parcelable snapshot) {
// grab the saved fab snapshot and pass it to the below via a View
View view = new View(context);
final Bitmap snapshotBitmap = getSnapshot(snapshot);
if (snapshotBitmap != null) {
view.setBackground(new BitmapDrawable(context.getResources(), snapshotBitmap));
}
return view;
}

@Override
public void onSharedElementStart(List<String> sharedElementNames,
List<View> sharedElements,
List<View> sharedElementSnapshots) {
// grab the fab snapshot and fade it out/in (depending on if we are entering or exiting)
for (int i = 0; i < sharedElements.size(); i++) {
if (sharedElements.get(i) == container) {
View snapshot = sharedElementSnapshots.get(i);
BitmapDrawable fabSnapshot = (BitmapDrawable) snapshot.getBackground();
fabSnapshot.setBounds(0, 0, snapshot.getWidth(), snapshot.getHeight());
container.getOverlay().clear();
container.getOverlay().add(fabSnapshot);
if (!isDismissing) {
// fab -> login: fade out the fab snapshot
ObjectAnimator.ofInt(fabSnapshot, "alpha", 0).setDuration(100).start();
} else {
// login -> fab: fade in the fab snapshot toward the end of the transition
fabSnapshot.setAlpha(0);
ObjectAnimator fadeIn = ObjectAnimator.ofInt(fabSnapshot, "alpha", 255)
.setDuration(150);
fadeIn.setStartDelay(150);
fadeIn.start();
}
forceSharedElementLayout();
break;
}
}
}

private Bitmap getSnapshot(Parcelable parcel) {
if (parcel instanceof Bitmap) {
return (Bitmap) parcel;
} else if (parcel instanceof Bundle) {
Bundle bundle = (Bundle) parcel;
// see SharedElementCallback#onCaptureSharedElementSnapshot
return (Bitmap) bundle.getParcelable("sharedElement:snapshot:bitmap");
}
return null;
}
};
}

0 comments on commit 0b1ceef

Please sign in to comment.