Use to draw dynamic shadows on and over views • Elevation is permanent height • Translation Z is used primarily to animate • New StateListAnimator <!-- animate the translationZ property of a view when pressed --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <set> <objectAnimator android:propertyName="translationZ" android:duration="@android:integer/config_shortAnimTime" android:valueTo="4dp" android:valueType="floatType"/> </set> </item> <item> <set> <objectAnimator android:propertyName="translationZ" android:duration="100" android:valueTo="0" android:valueType="floatType"/> </set> </item> </selector>
void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); setContentView(R.layout.activity_transition_entry); findViewById(R.id.imageView).setOnClickListener( new TransitionClickListener(this)); } private class TransitionClickListener implements View.OnClickListener { private final Activity activity; public TransitionClickListener(Activity activity) { this.activity = activity; } @Override public void onClick(View view) { Intent intent = new Intent(activity, TransitionLargeImageActivity.class); ActivityOptions activityOptions = ActivityOptions .makeSceneTransitionAnimation(activity, view, "kitten"); startActivity(intent, activityOptions.toBundle()); } } } Activity transitions • Enter transition, exit transition, or shared element transition • Very simple to set-up • Bit janky - didn’t work at all in iPlayer • Set up transitions easily in theme or in code • Shared elements require transitionName attribute public class TransitionLargeImageActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); setContentView(R.layout.activity_single_large_image); } }
public and private notifications • Palette - colourisation from an image • MediaSession - new API for controlling media replacing RemoteControlClient • RecyclerView and CardView • Not even talking about Android TV, Auto, or Wear! Palette palette = Palette.generate(bitmap); int defaultNormal = getResources().getColor(R.color.primary); int defaultDark = getResources().getColor(R.color.primary_dark); int darkVibrantColor = palette.getDarkVibrantColor(defaultDark); int vibrantColor = palette.getVibrantColor(defaultNormal); getWindow().setStatusBarColor(darkVibrantColor); getActionBar().setBackgroundDrawable(new ColorDrawable(vibrantColor));
mid-level developer with Android experience to work on iPlayer • Chat to me or go to our careers website (http:// bit.ly/1zp7uwS) • Open evening Tues 2nd December as well (http:// www.eventbrite.co.uk/e/bbc-future-media-open- evening-tickets-13574837705)