Metadata for ElevationBasic sample
Change-Id: If163a8c9c64afe693c099e49cfe7cc2cefa90659
diff --git a/ui/views/Elevation/ElevationBasic/screenshots/fixed.png b/ui/views/Elevation/ElevationBasic/screenshots/fixed.png
new file mode 100644
index 0000000..9864b90
--- /dev/null
+++ b/ui/views/Elevation/ElevationBasic/screenshots/fixed.png
Binary files differ
diff --git a/ui/views/Elevation/ElevationBasic/screenshots/icon-web.png b/ui/views/Elevation/ElevationBasic/screenshots/icon-web.png
new file mode 100644
index 0000000..7f2dbe5
--- /dev/null
+++ b/ui/views/Elevation/ElevationBasic/screenshots/icon-web.png
Binary files differ
diff --git a/ui/views/Elevation/ElevationBasic/screenshots/raised.png b/ui/views/Elevation/ElevationBasic/screenshots/raised.png
new file mode 100644
index 0000000..af81493
--- /dev/null
+++ b/ui/views/Elevation/ElevationBasic/screenshots/raised.png
Binary files differ
diff --git a/ui/views/Elevation/ElevationBasic/template-params.xml b/ui/views/Elevation/ElevationBasic/template-params.xml
index 3ef4ec2..bcaa253 100644
--- a/ui/views/Elevation/ElevationBasic/template-params.xml
+++ b/ui/views/Elevation/ElevationBasic/template-params.xml
@@ -44,5 +44,59 @@
<template src="FragmentView"/>
<common src="logger"/>
<common src="activities"/>
+ <metadata>
+ <status>PUBLISHED</status>
+ <categories>UI, Input</categories>
+ <technologies>Android</technologies>
+ <languages>Java</languages>
+ <solutions>Mobile</solutions>
+ <level>BEGINNER</level>
+ <icon>screenshots/icon-web.png</icon>
+ <screenshots>
+ <img>screenshots/fixed.png</img>
+ <img>screenshots/raised.png</img>
+ </screenshots>
+ <api_refs>
+ <android>android.view.MotionEvent</android>
+ </api_refs>
+ <description>
+<![CDATA[
+This sample demonstrates ways to move a view in the z-axis using
+`setTranslationZ()`. This method was introduced in API Level 21 ('Lollipop').
+]]>
+ </description>
+ <intro>
+<![CDATA[
+This sample uses two shapes, a circle and a square, and it demonstrates two
+alternative ways to move a view in the z-axis. The first shape, the circle,
+has a fixed elevation, which is defined in XML. The second view, the square,
+changes its elevation using [setTranslationZ()][1] when a user touches it:
+ shape2.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View view, MotionEvent motionEvent) {
+ int action = motionEvent.getActionMasked();
+ /* Raise view on ACTION_DOWN and lower it on ACTION_UP. */
+ switch (action) {
+ case MotionEvent.ACTION_DOWN:
+ Log.d(TAG, "ACTION_DOWN on view.");
+ view.setTranslationZ(120);
+ break;
+ case MotionEvent.ACTION_UP:
+ Log.d(TAG, "ACTION_UP on view.");
+ view.setTranslationZ(0);
+ break;
+ default:
+ return false;
+ }
+ return true;
+ }
+ });
+
+The elevation reverts back once the touch is removed.
+
+[1]: https://developer.android.com/training/material/shadows-clipping.html#Elevation
+]]>
+ </intro>
+ </metadata>
</sample>