use of com.google.samples.apps.topeka.widget.TextSharedElementCallback in project android-topeka by googlesamples.
the class QuizActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
mCountingIdlingResource = new CountingIdlingResource("Quiz");
String categoryId = getIntent().getStringExtra(Category.TAG);
mInterpolator = new FastOutSlowInInterpolator();
if (null != savedInstanceState) {
mSavedStateIsPlaying = savedInstanceState.getBoolean(STATE_IS_PLAYING);
}
super.onCreate(savedInstanceState);
populate(categoryId);
int categoryNameTextSize = getResources().getDimensionPixelSize(R.dimen.category_item_text_size);
int paddingStart = getResources().getDimensionPixelSize(R.dimen.spacing_double);
final int startDelay = getResources().getInteger(R.integer.toolbar_transition_duration);
ActivityCompat.setEnterSharedElementCallback(this, new TextSharedElementCallback(categoryNameTextSize, paddingStart) {
@Override
public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
super.onSharedElementStart(sharedElementNames, sharedElements, sharedElementSnapshots);
mToolbarBack.setScaleX(0f);
mToolbarBack.setScaleY(0f);
}
@Override
public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
super.onSharedElementEnd(sharedElementNames, sharedElements, sharedElementSnapshots);
// Make sure to perform this animation after the transition has ended.
ViewCompat.animate(mToolbarBack).setStartDelay(startDelay).scaleX(1f).scaleY(1f).alpha(1f);
}
});
}
Aggregations