<resources> <string name="transition_avatar">AvatarTransition</string> </resources>
<ImageView android:id="@+id/avatar" android:layout_width="@dimen/avatar_size" android:layout_height="@dimen/avatar_size" android:layout_marginEnd="@dimen/keyline_16" android:transitionName="@string/transition_avatar"/>
private void performSignInWithTransition(View v) { Activity activity = getActivity(); ActivityOptions activityOptions = ActivityOptions .makeSceneTransitionAnimation(activity, v, activity.getString(R.string.transition_avatar)); CategorySelectionActivity.start(activity, mPlayer, activityOptions); activity.finishAfterTransition(); }
performScoreAnimation
private void addFloatingActionButton() { final int fabSize = getResources().getDimensionPixelSize(R.dimen.fab_size); int bottomOfQuestionView = findViewById(R.id.question_view).getBottom(); final LayoutParams fabLayoutParams = new LayoutParams(fabSize, fabSize, Gravity.END | Gravity.TOP); final int fabPadding = getResources().getDimensionPixelSize(R.dimen.padding_fab); final int halfAFab = fabSize / 2; fabLayoutParams.setMargins(0, // left bottomOfQuestionView - halfAFab, //top 0, // right fabPadding); // bottom addView(mSubmitAnswer, fabLayoutParams); }
addOnLayoutChangeListener(new OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int l, int t, int r, int b, int oldLeft, int oldTop, int oldRight, int oldBottom) { removeOnLayoutChangeListener(this); addFloatingActionButton(); } });
@Override public final void getOutline(View view, Outline outline) { final int size = view.getResources(). getDimensionPixelSize(R.id.view_size); outline.setOval(0, 0, size, size); }
setClipToOutline(true)
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="48" android:viewportHeight="48"> <path android:pathData="M40 22H15.66l11.17-11.17L24 8 8 24l16 16 2.83-2.83L15.66 26H40v-4z" android:fillColor="?android:attr/textColorPrimary" /> </vector>
// Property for animating the foreground public static final Property FOREGROUND_COLOR = new IntProperty("foregroundColor") { @Override public void setValue(FrameLayout layout, int value) { if (layout.getForeground() instanceof ColorDrawable) { ((ColorDrawable) layout.getForeground()).setColor(value); } else { layout.setForeground(new ColorDrawable(value)); } } @Override public Integer get(FrameLayout layout) { return ((ColorDrawable) layout.getForeground()).getColor(); } };
final ObjectAnimator foregroundAnimator = ObjectAnimator .ofArgb(this, FOREGROUND_COLOR, Color.WHITE, backgroundColor);