<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alvaro de la Serna Martínez on Medium]]></title>
        <description><![CDATA[Stories by Alvaro de la Serna Martínez on Medium]]></description>
        <link>https://medium.com/@alvaro.delaserna?source=rss-382dc75b2cf6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Rh79qGqqJvbkgmSj.</url>
            <title>Stories by Alvaro de la Serna Martínez on Medium</title>
            <link>https://medium.com/@alvaro.delaserna?source=rss-382dc75b2cf6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 00:08:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alvaro.delaserna/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A virtual visit to BEEVA Labs (II)]]></title>
            <link>https://medium.com/beeva-labs/a-virtual-visit-to-beeva-labs-ii-ba259e043b9e?source=rss-382dc75b2cf6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba259e043b9e</guid>
            <category><![CDATA[beeva-labs]]></category>
            <category><![CDATA[threejs]]></category>
            <category><![CDATA[vr]]></category>
            <category><![CDATA[knowledge]]></category>
            <category><![CDATA[mobility]]></category>
            <dc:creator><![CDATA[Alvaro de la Serna Martínez]]></dc:creator>
            <pubDate>Mon, 12 Jun 2017 13:32:44 GMT</pubDate>
            <atom:updated>2018-03-01T17:22:43.026Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*smP5ckOgGcZjPY-1oBJy4A.png" /><figcaption>What the user sees when entering the environment for the first time</figcaption></figure><p>As you know from my previous article, “<a href="https://medium.com/@alvaro.delaserna/a-virtual-visit-to-beeva-labs-6fe3f6add065"><strong><em>A virtual visit to BEEVA Labs (I)</em></strong></a>” <a href="https://www.beeva.com/">BEEVA</a>’s UX <a href="https://labs.beeva.com/">Lab</a> team have been researching and designing different user interactions within a <strong>mobile VR framework</strong>. To validate their hypotheses, we have implemented some of them on a real product: a virtual visit to our department.</p><p>The complete list of interactions we have implemented are the following:</p><ol><li>The reticle must change its shape when detecting an interactive element and show a loading indicator.</li><li>If part of the scene has multiple interactive objects, they must become available when the user is sufficiently close to them.</li><li>If part of the scene has multiple interactive elements, they must become visible to the user when she/he reaches it.</li><li>An interactive element must change its color so the user knows she/he can interact with it.</li><li>An interactive element must change its size so the user knows she/he can interact with it.</li><li>If an interactive object plays a video, the camera should point to the screen and the media controls should be visible to the user.</li><li>There must exist a HUD menu with essential options.</li></ol><p>I have already covered the first three in my previous post. In this article I will talk about the remaining ones.</p><h4>4. An interactive element must change its color so the user knows she/he can interact with it</h4><p>Besides noticing a change in the gaze pointer, sometimes users need <strong>additional visual aid</strong> to know that they <strong>can interact</strong> with an object. In the cases in which <strong>several objects</strong> appear in the scene at the same time, the user might find it difficult to discern which object os being targeted (since the change in size of the reticle and the fuse sometimes appear to shadow other elements). In these cases, the targeted object <strong>changes its color</strong> when the reticle is placed on it.</p><p>To implement this, I used Reticulum’s gaze events onGazeOver and onGazeOut to call the color change:</p><pre>Reticulum.add( object, {<br> ...<br> onGazeOver: function() {<br>    if (this.material.color) this.material.color.setHex( 0xffcc00 );<br> },<br> onGazeOut: function() {<br>    if (this.material.color) this.material.color.setHex( 0xffffff );<br> },<br> ...<br>});</pre><p>The result is shown in the following video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F_fxSCwb23-A%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D_fxSCwb23-A&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F_fxSCwb23-A%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/85edc2311c8227aebeeca9aca11e37f2/href">https://medium.com/media/85edc2311c8227aebeeca9aca11e37f2/href</a></iframe><h4>5. An interactive element must change its size so the user knows she/he can interact with it</h4><p>Following the <strong>additional visual aids</strong> a user might need to know that she/he can interact with an object, we can make an object <strong>grow</strong> when the reticle is placed over it to tell the user the object is interactive. It would never make sense to shrink the object, because the reticle might stop intersecting with the object resulting in the object growing and shrinking continuously.</p><p>To implement this, I used Reticulum’s gaze events onGazeOver and onGazeOut to call the change in scale:</p><pre>Reticulum.add( object, {<br> ...<br> onGazeOver: function() {<br>   changeScaleSingle(object, 1.5);<br> },<br> onGazeOut: function() {<br>   changeScaleSingle(object, 1);<br> },<br> ...<br>});</pre><p>Where the function changeScaleSingle calls the following with the same value for scaleX, scaleY andscaleZ:</p><pre>object.scale.set(scaleX, scaleY, scaleZ);</pre><p>The result is shown in the following video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FPC4ziqKc5-I%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DPC4ziqKc5-I&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FPC4ziqKc5-I%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1690080b44bea328de89b86b7be67885/href">https://medium.com/media/1690080b44bea328de89b86b7be67885/href</a></iframe><h4>6. If an interactive object plays a video, the camera should point to the screen and the media controls should be visible to the user</h4><p>Implementing the <strong>first part</strong> of this interaction has caused me some headaches. When running the code on a <strong>browser</strong>, making the camera face an object is straightforward: since the orientation of the camera is not dependent on the orientation of the PC/laptop running it, you can directly call camera.lookAt(someObject) to rotate the camera to face the intended target.</p><p>However, on <strong>mobile</strong> devices this is not possible (or I have not been able to do it yet), since the orientation of the camera is completely dependent on the orientation of the device. Therefore, the resulting behavior of this interaction will depend on the type of device running it:</p><ul><li>It will work as expected on a browser.</li><li>It will not work on a mobile device, unless the user is already in front of the targeted screen. If not, she/he will have to move to look at the screen.</li></ul><p>The <strong>second part</strong> of the interaction (displaying the media buttons, moving them so the user knows where they are and keeping them visible) was much easier. Since this is triggered once the user has clicked on the <em>play</em> button, she/he will be already facing the screen and will see the buttons appear and move.</p><p>All this is called from Reticulum’s onGazeLong event, since we want to trigger it after the fuse has completed <strong>loading</strong>:</p><pre>Reticulum.add( screen, {<br> reticleHoverColor: 0x00fff6,<br> fuseColor: 0x00fff6,<br> fuseVisible: true,<br> onGazeLong: function() {<br>    ...<br>    // move camera to screen position<br>    movement(<br>       {x: -1.5, y: 2, z: screen.position.z}, // final position<br>       camera.position, // object to update<br>       0, // delay<br>       2000, // duration<br>       TWEEN.Easing.Quartic.Out, // type of animation<br>       function () { // callback function<br>         // add media controls on callback<br>         addMediaControls(screen, video);<br>    });<br>    ...<br>    // make camera face the screen <br>    camera.up = new THREE.Vector3(0,1,0);<br>    camera.lookAt(screen.position);<br> }<br>});</pre><p>The following video shows the intended behavior:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fx3gm89-xo6Q%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dx3gm89-xo6Q&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fx3gm89-xo6Q%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/581187d2866184d7b74ef7875b0668d5/href">https://medium.com/media/581187d2866184d7b74ef7875b0668d5/href</a></iframe><h4>7. There must exist a HUD menu with essential options</h4><p>As mentioned in Salva’s <strong>“</strong><a href="https://labs.beeva.com/vr-prototyping-in-framer-head-up-display-navigation-c4b6cc12c3f3"><strong><em>VR Prototyping in Framer. Head-up display Navigation.</em></strong></a><strong>”</strong> article, we need to add a <strong>HUD</strong> menu (Head-Up Display), where our user can have permanent access to the navigation options, to cover the lack of a <strong>menu</strong> in the scene. This is reserved for actions that can be <strong>needed from anywhere</strong> in the scene.</p><p>In the case of our virtual tour, instead of having the options on top of the user we decided to add a “<em>Home</em>” button directly below the user. By clicking on this button, the user can return to the beginning of the tour from anywhere in the scene.</p><p>As in the previous case, all this is called from Reticulum’s onGazeLong event, since we want to trigger it after the fuse has completed loading:</p><pre>Reticulum.add( screenMesh, {<br> reticleHoverColor: 0x00fff6,<br> fuseColor: 0x00fff6,<br> fuseVisible: true,<br> onGazeLong: function() {<br>    // move camera to initial position<br>    movement({<br>      x: initialPosition.x, <br>      y: initialPosition.y, <br>      z: initialPosition.z<br>    }, camera.position, 0, 2000, TWEEN.Easing.Quartic.Out, <br>    function () {</pre><pre>updateHomeButtonPosition(); // move &quot;Home&quot; towards user<br>      <br>      // &quot;controls&quot; is only defined when running on a browser,<br>      // needed to update the reference of our camera controls<br>      if (controls) controls.target.set(camera.position.x, camera.position.y, camera.position.z + 0.5);<br>    });<br> }<br>});</pre><p>The following video shows the intended behavior:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F4O3hgOfurDI%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D4O3hgOfurDI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F4O3hgOfurDI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/553e21eca1f3b39b341197b2847539a3/href">https://medium.com/media/553e21eca1f3b39b341197b2847539a3/href</a></iframe><p>In this article I have shared how we have implemented the remaining interactions for mobile VR that I did not cover in my previous post in our virtual tour to BEEVA Labs.</p><p>You can test the application by opening this <a href="https://beeva-sergiosantamaria.github.io/VRLabs/"><strong>link</strong></a>. We have added a tutorial at the beginning so first-time users can become familiar with the environment. It is important to keep in mind that the application has been optimized to run on <strong>mobile devices</strong> (we have tested it on a <strong>Nexus 5x</strong> and a <strong>Samsung Galaxy 6</strong>), therefore some things will behave differently if it is run from a browser. Feel free to come over to our department and test the app on our VR headset, every feedback is welcome!</p><p>I hope you enjoyed reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba259e043b9e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/beeva-labs/a-virtual-visit-to-beeva-labs-ii-ba259e043b9e">A virtual visit to BEEVA Labs (II)</a> was originally published in <a href="https://medium.com/beeva-labs">BEEVA Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A virtual visit to BEEVA Labs (I)]]></title>
            <link>https://medium.com/beeva-labs/a-virtual-visit-to-beeva-labs-6fe3f6add065?source=rss-382dc75b2cf6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fe3f6add065</guid>
            <category><![CDATA[hci]]></category>
            <category><![CDATA[vr]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[beeva-labs]]></category>
            <category><![CDATA[knowledge]]></category>
            <dc:creator><![CDATA[Alvaro de la Serna Martínez]]></dc:creator>
            <pubDate>Mon, 12 Jun 2017 06:34:25 GMT</pubDate>
            <atom:updated>2018-03-01T17:21:35.704Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*smP5ckOgGcZjPY-1oBJy4A.png" /><figcaption>What the user sees when entering the environment for the first time</figcaption></figure><p><a href="https://labs.beeva.com/a-virtual-visit-to-beeva-labs-ii-ba259e043b9e"><strong><em>Click here to read the second part</em></strong></a></p><p>For the past couple of months, <a href="https://www.beeva.com/"><strong>BEEVA</strong></a>’s <strong>UX </strong><a href="https://labs.beeva.com/"><strong>Lab</strong></a><strong> </strong>team have been researching and designing different user interactions within a <strong>mobile VR framework</strong>. You might have come across some of <a href="https://medium.com/u/9483dcc78bde">Salvador Valle Vargas</a>’s articles, in which he presents <strong>Framer</strong> as a good option for prototyping interactions for VR and talks about the challenges of designing interactions using only the user’s gaze, since mobile devices don’t offer the same input options as other VR frameworks (HTC, Oculus, etc.) do.</p><p>Since we wanted to test those interactions on a real product, we have developed a <strong>virtual visit</strong> to our department. To develop it, we have used <a href="https://threejs.org/"><strong>Three.js</strong></a>, a cross-browser JavaScript library/API that uses <a href="https://en.wikipedia.org/wiki/WebGL"><strong>WebGL</strong></a> (Web Graphics Library) to create and display animated 3D computer graphics in a web browser.</p><p>The <strong>interactions</strong> we have implemented are:</p><ol><li>The reticle must change its shape when detecting an interactive element and show a loading indicator.</li><li>If part of the scene has multiple interactive objects, they must become available when the user is sufficiently close to them.</li><li>If part of the scene has multiple interactive elements, they must become visible to the user when she/he reaches it.</li><li>An interactive element must change its color so the user knows she/he can interact with it.</li><li>An interactive element must change its size so the user knows she/he can interact with it.</li><li>If an interactive object plays a video, the camera should point to the screen and the media controls should be visible to the user.</li><li>There must exist a HUD menu with essential options.</li></ol><p>In this article I will talk about how we implemented <strong>the first three interactions</strong>. The rest will be covered in <a href="https://labs.beeva.com/a-virtual-visit-to-beeva-labs-ii-ba259e043b9e"><strong>another post</strong></a>. At the end of the second post I will share a link to the “final” product (it is one of those products that can never be completely finished, so what you find in the link might change over time) so you can test it and share your insights.</p><p>Before that, I want to talk a little bit about <a href="https://github.com/skezo/Reticulum"><strong>Reticulum</strong></a>, a library for managing the gaze pointer and its interactions with the scene. If you have ever developed anything for VR, one of the most annoying things to code is the <strong>gaze pointer </strong>(a.k.a <em>reticle</em>): it needs to <strong>react</strong> when it encounters <strong>interactive</strong> objects (it can change its size, color, shape, etc.), it needs to offer some visual aid to show <strong>loading time</strong>, and any other thing you might think useful for your user, so handling all those events and UI updates can result in long and underperforming chunks of code. <strong>Reticulum</strong> solves those issues quite beautifully and very easily. It has the following features:</p><ul><li>Avoids double vision and depth issues by projecting spatially onto targeted objects.</li><li>Gaze and click events for targeted objects onGazeOver, onGazeOut, onGazeLong and onGazeClick.</li><li>Built-in fuse support (loading indicator). It allows to set different fuse durations for targeted objects.</li><li>Display the reticle only when the camera can see a targeted object</li></ul><p>Thanks to this library, implementing most interactions was pretty straightforward.</p><h4>1. The reticle must change its shape when detecting an interactive element and show a loading indicator</h4><p>The implementation of this interaction is as easy as setting Reticulum’s <strong>initial parameters</strong> during initialization. Taking a look at the following piece of code you can see how the size of the reticle is defined for the cases in which no interactive object is detected and when the reticle is passing over the interactive object ( hover ). Moreover, the default size and duration of the fuse are set inside the fuse parameter.</p><pre>Reticulum.init(camera, {<br> near: 1, // minimum distance to interact with an object<br> far: 7, // maximum distance to interact with an object<br> vibrate: 0,<br> reticle: {<br>     visible: true,<br>     restPoint: 1, // reticle’s resting point<br>     color: 0xff00e7,<br>     innerRadius: 0.001, // inner radius when nothing is selected<br>     outerRadius: 0.006, // outer radius when nothing is selected<br>     hover: {<br>         color: 0xff00e7,<br>         innerRadius: 0.02, // inner radius on over<br>         outerRadius: 0.024, // outer radius on over<br>         speed: 5,<br>         vibrate: 0 // Set to 0 or [] to disable<br>     }<br> },<br> click: {<br>     vibrate: 0 // disabled<br> },<br> hover: {<br>     vibrate: 0 // disabled<br> },<br> fuse: {<br>     visible: false,<br>     duration: 2, // in seconds, loading time<br>     color: defaultFuseColor,<br>     innerRadius: 0.045, // inner radius when reticle is loading<br>     outerRadius: 0.06, // outer radius when reticle is loading<br>     vibrate: 0, // disabled<br>     clickCancelFuse: false // If users clicks on targeted object fuse is not canceled<br> }<br>});</pre><p>You can set <strong>different values</strong> for those parameters for every interactive object you add to the scene by calling Reticulum.add(). For example, if we wanted to make the <strong>reticle</strong> turn <strong>blue</strong> as it detects an interactive object and show a <strong>loading indicator</strong> of the same color that takes <strong>two seconds</strong> to load we would do the following:</p><pre>Reticulum.add( interactiveObject, {<br>  reticleHoverColor: 0x00fff6,<br>  fuseColor: 0x00fff6,<br>  fuseDuration: 2,<br>  fuseVisible: true,<br>  onGazeLong: function() {<br>     // react to the interaction when fuse<br>     // finishes loading<br>  }<br>});</pre><p>The result is shown in the following video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-KbvaUsmF_k%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-KbvaUsmF_k&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-KbvaUsmF_k%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7e68793b0ac324b16ca7d0591b88541/href">https://medium.com/media/f7e68793b0ac324b16ca7d0591b88541/href</a></iframe><h4>2. If part of the scene has multiple interactive objects, they must become available when the user is sufficiently close to them</h4><p>Making <strong>everything</strong> in the scene available for the user to interact with from the very beginning can be overwhelming and result in poor user experiences. In order to avoid this, we imposed <strong>limits</strong> to the <strong>minimum</strong> and <strong>maximum</strong> distances required for the reticle to be able to interact with an object, so the user can still see that she/he can interact with the objects but they are simply <strong>out of reach</strong> yet and the user must move in order to interact with them.</p><p>This was shown in the previous step when we initialized Reticulum, but I didn’t cover it then:</p><pre>Reticulum.init(camera, {<br> near: 1, // minimum distance to interact with an object<br> far: 7, // maximum distance to interact with an object<br> ... // rest of parameters<br>});</pre><p>This is shown in the following video. In the scene, all yellow elements are interactive, but the reticle only reacts to those which are between those values:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F6UkPh4wnkjk%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D6UkPh4wnkjk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F6UkPh4wnkjk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb40a5828c4f47c52eb110cb7f7b01f6/href">https://medium.com/media/bb40a5828c4f47c52eb110cb7f7b01f6/href</a></iframe><h4>3. If part of the scene has multiple interactive elements, they must become visible to the user when she/he reaches it</h4><p>Users who are placed on a VR scene for the first time need a way of <strong>knowing</strong> what can be done and which elements they can interact with <em>just in time</em>. As in the previous case, we don’t want to show all interactive elements from the beginning. Instead, we display new interactive objects as needed <strong>after</strong> the user moves to a different place in the scene.</p><p>The result is shown in the following video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fe1tadOmRQgA%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3De1tadOmRQgA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fe1tadOmRQgA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ef2fabdb80f3e938da3fad1d1561f45e/href">https://medium.com/media/ef2fabdb80f3e938da3fad1d1561f45e/href</a></iframe><p>In this post I have presented a list of interactions designed for mobile VR applications, and I have talked about how we have added them to our virtual visit to BEEVA Labs. In my <a href="https://labs.beeva.com/a-virtual-visit-to-beeva-labs-ii-ba259e043b9e">next post</a> I will cover the rest of the list.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fe3f6add065" width="1" height="1" alt=""><hr><p><a href="https://medium.com/beeva-labs/a-virtual-visit-to-beeva-labs-6fe3f6add065">A virtual visit to BEEVA Labs (I)</a> was originally published in <a href="https://medium.com/beeva-labs">BEEVA Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cómo conseguir el “double binding” de AngularJS en Android]]></title>
            <link>https://medium.com/beeva-labs/c%C3%B3mo-conseguir-el-double-binding-de-angularjs-en-android-398f909ad18e?source=rss-382dc75b2cf6------2</link>
            <guid isPermaLink="false">https://medium.com/p/398f909ad18e</guid>
            <category><![CDATA[hci]]></category>
            <category><![CDATA[knowledge]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[rxjava]]></category>
            <category><![CDATA[beeva-labs]]></category>
            <dc:creator><![CDATA[Alvaro de la Serna Martínez]]></dc:creator>
            <pubDate>Fri, 02 Jun 2017 10:47:49 GMT</pubDate>
            <atom:updated>2018-03-01T17:18:38.315Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*nvTJtLNuOwuhKX_uffeetg.png" /><figcaption>ref: <a href="http://blog.thedigitalgroup.com/sheldonf/wp-content/uploads/sites/14/2015/05/Two_Way_Data_Binding_MSPAINT1-1024x480.png">http://blog.thedigitalgroup.com/sheldonf/wp-content/uploads/sites/14/2015/05/Two_Way_Data_Binding_MSPAINT1-1024x480.png</a></figcaption></figure><p>Las vistas que se actualizan de forma automática molan mucho. Si has trabajado anteriormente con AngularJS conocerás el concepto del <strong><em>two-way data binding</em></strong>, mediante el cual podemos <strong>enlazar</strong> un elemento HTML con un <strong>modelo</strong> de datos para que los cambios que se realicen en el modelo se vean reflejados en la vista y, del mismo modo, actualizar el valor de nuestro modelo de datos si el contenido de la vista cambia.</p><pre>&lt;div ng-app=”myApp” ng-controller=”myCtrl”&gt;<br>   Name: &lt;input ng-model=”firstName”&gt;<br>   &lt;h1&gt;{{firstName}}&lt;/h1&gt;<br>&lt;/div&gt;</pre><p>Desde el <strong>Mobility Lab</strong> de <a href="https://www.beeva.com/"><strong>BEEVA</strong></a> os queremos enseñar en este artículo una técnica muy sencilla para implementar este <em>two-way binding </em>en <strong>Android</strong>, utilizando programación reactiva (<a href="https://github.com/ReactiveX/RxJava"><strong>RxJava</strong></a> concretamente) y <a href="http://jakewharton.github.io/butterknife/"><strong>Butter Knife</strong></a>.</p><p>El código en el que me voy a basar lo podéis encontrar en el siguiente <a href="https://github.com/beeva-alvarodelaserna/RxJava-Android-Samples/blob/master/app/src/main/java/com/morihacky/android/rxjava/fragments/DoubleBindingTextViewFragment.java"><strong>enlace</strong></a>. Para este caso concreto sólo necesitamos dos clases de RxJava para conseguir nuestro objetivo: <a href="https://medium.com/@vanniktech/rxjava-2-disposable-under-the-hood-f842d2373e64"><strong><em>Disposable</em></strong></a> y <a href="http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/processors/PublishProcessor.html"><strong><em>PublishProcessor</em></strong></a>. Si no estáis familiarizados con los conceptos de la <strong>programación reactiva</strong>, o si necesitáis refrescar alguna cosilla, podéis entrar en <a href="https://gist.github.com/staltz/868e7e9bc2a7b8c1f754"><strong>“<em>The introduction to Reactive Programming you’ve been missing”</em></strong></a><em>.</em></p><p>En nuestro ejemplo tenemos una vista en la que el usuario puede introducir dos números y se actualiza la vista con el valor de la suma de esos valores.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*fsSZwboIexqGbMMslVB9cg.png" /></figure><p>Para poder actualizar la vista automáticamente, necesitamos poder detectar cuándo cambian los valores de los elementos editables y <strong>suscribirnos</strong> a esos eventos con nuestro <em>PublishProcessor</em>. El resultado de dicha suscripción la almacenamos en nuestro <em>Disposable</em>, gracias al cual podremos:</p><ol><li><strong>Reaccionar</strong> ante los cambios que se hagan sobre los elementos editables (cuando se ejecuta el <em>callback </em>de la suscripción).</li><li><strong>Desactivar</strong> la recepción de eventos si la vista se destruye.</li></ol><p>Por último, una vez hemos cambiado uno de los campos, enviaremos el resultado de la suma mediante la función <em>onNext()</em> de nuestro <em>PublishProcessor </em>y actualizaremos la vista.</p><p>Imaginemos que tenemos las siguientes variables:</p><pre>EditText firstValue;<br>EditText secondValue;<br>TextView result;<br>Disposable disposable;<br>PublishProcessor&lt;Float&gt; publishProcessor;<br>Unbinder unbinder;</pre><p>Donde <em>Unbinder</em> es una clase de Butter Knife que sirve para desenlazar la vista del contexto cuando ésta se destruye.</p><p>En lugar de inicializar <em>firstValue</em>, <em>secondValue</em> y <em>result </em>utilizando el método <em>findViewById()</em>, utilizamos Butter Knife para enlazar las variables con sus correspondientes elementos de la vista utilizando <strong><em>@BindView(elementId)</em></strong> e inicializamos <em>unbinder</em> llamando a <strong><em>ButterKnife.bind()</em></strong>:</p><pre>@BindView(R.id.<em>double_binding_num1</em>)<br>EditText firstValue;<br><br>@BindView(R.id.<em>double_binding_num2</em>)<br>EditText secondValue;<br><br>@BindView(R.id.<em>double_binding_result</em>)<br>TextView result;</pre><pre>@Override<br>public View onCreateView(<br>        LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {<br>    [...]<br>    unbinder = ButterKnife.<em>bind</em>(this, layout);<br>    [...]<br>}</pre><p>A continuación, instanciamos <em>publishProcessor</em> y nos suscribimos a sus eventos, almacenando el resultado en <em>disposable</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MQs_9xrMl8oPDTgimpZjOw.png" /><figcaption>Nota: para poder usar lambda ( →) es necesario incluir <a href="https://github.com/evant/gradle-retrolambda"><em>retrolambda</em></a> como dependencia.</figcaption></figure><p>Ahora, cada vez que el usuario cambie el valor de cualquiera de los editables se llamará a la función <em>onNumberChanged</em>:</p><pre>public void onNumberChanged() {<br>    float num1 = 0;<br>    float num2 = 0;<br><br>    if (!<em>isEmpty</em>(firstValue.getText().toString())) {<br>        num1 = Float.<em>parseFloat</em>(firstValue.getText().toString());<br>    }<br><br>    if (!<em>isEmpty</em>(secondValue.getText().toString())) {<br>        num2 = Float.<em>parseFloat</em>(secondValue.getText().toString());<br>    }<br><br>    publishProcessor.onNext(num1 + num2);<br>}</pre><p>Dentro de esta función se llama a la función <em>onNext()</em> de nuestro <em>publishProcessor</em> para “lanzar” el evento al que nos hemos suscrito anteriormente.</p><p>Finalmente, a la hora de añadir “escuchadores” a los <em>EditText</em> para detectar cuándo cambia su valor, normalmente añadiríamos un <em>TextWatcher</em> a los elementos editables:</p><pre>// haríamos lo mismo para secondValue<br>firstValue.addTextChangedListener(new TextWatcher() {<br>    @Override<br>    public void beforeTextChanged(CharSequence s, int start, int count, int after) {<br><br>    }<br><br>    @Override<br>    public void onTextChanged(CharSequence s, int start, int before, int count) {<br><br>    }<br><br>    @Override<br>    public void afterTextChanged(Editable s) {<br>        onNumberChanged();<br>    }<br>});</pre><p>Lo que resulta en bastantes líneas de código (además por duplicado). Gracias a Butter Knife, esta funcionalidad quedaría así:</p><pre>@OnTextChanged({R.id.<em>double_binding_num1</em>, R.id.<em>double_binding_num2</em>})<br>public void onNumberChanged() {<br>    [...]<br>}</pre><p>¡Y ya está! Ahora, cada vez que el usuario cambia uno de los valores en los campos editables se actualiza la vista. Del mismo modo, si cambiamos el valor de uno de los campos editables a través de una función, por ejemplo:</p><pre>final Handler handler = new Handler();<br>handler.postDelayed(() -&gt; {<br>    firstValue.setText(&quot;200&quot;);<br>}, 2000);</pre><p>se ejecutará la función <em>onNumberChanged()</em> después de 2 segundos y la vista se actualizará automáticamente con el resultado de la suma.</p><p>En este artículo os he enseñado cómo conseguir el efecto de <strong><em>two-way binding</em></strong> en una aplicación Android utilizando programación reactiva y Butter Knife para simplificar el código. El código completo del ejemplo está disponible <a href="https://github.com/beeva-alvarodelaserna/RxJava-Android-Samples/blob/master/app/src/main/java/com/morihacky/android/rxjava/fragments/DoubleBindingTextViewFragment.java"><strong>aquí</strong></a>.</p><p>Espero que os haya gustado. ¡Hasta la próxima!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=398f909ad18e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/beeva-labs/c%C3%B3mo-conseguir-el-double-binding-de-angularjs-en-android-398f909ad18e">Cómo conseguir el “double binding” de AngularJS en Android</a> was originally published in <a href="https://medium.com/beeva-labs">BEEVA Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Escogiendo un framework para desarrollo híbrido: Ionic VS React Native]]></title>
            <link>https://medium.com/beeva-labs/escogiendo-un-framework-para-desarrollo-h%C3%ADbrido-ionic-vs-react-native-e69406283549?source=rss-382dc75b2cf6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e69406283549</guid>
            <category><![CDATA[beeva-labs]]></category>
            <category><![CDATA[ionic]]></category>
            <category><![CDATA[hci]]></category>
            <category><![CDATA[knowledge]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Alvaro de la Serna Martínez]]></dc:creator>
            <pubDate>Mon, 29 May 2017 12:46:26 GMT</pubDate>
            <atom:updated>2018-03-01T17:16:02.680Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*mkoZ7NbXoyqri8MuImzaUQ.png" /><figcaption>ref: <a href="http://www.mobiloitte.com/blog/wp-content/uploads/2016/07/ionic-vs-react-native.png">http://www.mobiloitte.com/blog/wp-content/uploads/2016/07/ionic-vs-react-native.png</a></figcaption></figure><p>El desarrollo de aplicaciones híbridas ha aumentado considerablemente en los últimos años. Sin embargo, no todos los frameworks de desarrollo son igual de versátiles y hay veces en las que hay que decidirse por uno a la hora de desarrollar nuestra aplicación híbrida.</p><p>Si estás interesado en empezar a desarrollar aplicaciones híbridas, este artículo es para ti. En este post, desde el Mobility Lab de <a href="https://www.beeva.com/">BEEVA</a> os voy a presentar los dos frameworks para desarrollo híbrido más famosos: <strong>Ionic</strong> y <strong>React Native</strong>.</p><p>Antes de comenzar, ¿qué diferencias hay entre una aplicación nativa y una aplicación híbrida?</p><p>Las aplicaciones nativas:</p><ul><li>Son desarrolladas en el <strong>lenguaje requerido</strong> por la plataforma para la que se está desarrollando (Java para Android, Objective-C para iOS, etc.).</li><li>Presentan un <strong>comportamiento distinto</strong> en función de la plataforma (navegación, animaciones, etc.).</li><li><strong>No tienen restricciones</strong> para acceder a las capas nativas de los dispositivos (cámara, GPS, etc.).</li></ul><p>Por otro lado, las aplicaciones híbridas:</p><ul><li>Son esencialmente páginas <strong>web incrustadas</strong> en una aplicación móvil a través de un WebView.</li><li>Están desarrolladas usando HTML5, CSS y JavaScript.</li><li>Pueden ejecutar el mismo código independientemente de cuál sea la plataforma objetivo, aunque también cabe la posibilidad de usar código específico para cada plataforma objetivo.</li><li>Pueden acceder a alguna capa nativa de los dispositivos (cámara, GPS, etc.) usando plugins de <a href="http://phonegap.com/">PhoneGap</a> y <a href="https://cordova.apache.org/">Cordova</a>.</li></ul><p>Una vez presentado el concepto de aplicación híbrida, podemos hablar de Ionic y React Native.</p><p>Ionic nació en <strong>2013</strong>, creado por <strong>Drifty Co</strong>. Basado en <strong>AngularJS</strong>, utiliza tecnologías web para desarrollar y renderizar las aplicaciones y se apoya en PhoneGap y Cordova para acceder a funciones nativas de los dispositivos, y sigue el lema <em>“Write once, run everywhere”</em>. Esto significa que el <strong>mismo código</strong> se podrá ejecutar en <strong>todas las plataformas</strong> que se quiera, Ionic simplemente <strong>adaptará sus elementos</strong> a cada una de las plataformas a la hora de pintar elementos en la pantalla para dar una impresión “nativa”. Grandes marcas, como <strong>Baskin Robbins</strong>, <strong>Diesel</strong> y <strong>McDonald’s</strong> han optado por Ionic para desarrollar sus aplicaciones. La colección de aplicaciones más representativas desarrolladas con Ionic puede encontrarse <a href="http://showcase.ionicframework.com/apps/top">aquí</a>.</p><p>React Native nació en <strong>2015</strong>, creado por <strong>Facebook</strong>. Basado en <strong>React</strong>, utiliza <a href="https://facebook.github.io/react/docs/jsx-in-depth.html">JSX</a> para desarrollar y renderizar las aplicaciones. Al contrario que Ionic, React Native no permite utilizar el mismo código para todas las plataformas, sino que ofrece <strong>componentes para cada una</strong> de ellas y deja a los desarrolladores la responsabilidad de ver qué componentes se asemejan más al comportamiento nativo que se esperaría en cada caso. Por supuesto, toda la familia de aplicaciones de <strong>Facebook</strong> está desarrollada con este framework, pero también hay empresas grandes, como <strong>Tesla</strong>, que han desarrollado sus aplicaciones con React Native. La colección de aplicaciones más representativas desarrolladas con React Native puede encontrarse <a href="https://facebook.github.io/react-native/showcase.html">aquí</a>.</p><p>Estos frameworks no disponen de un IDE, pero a la hora de ver cómo va quedando la aplicación durante el desarrollo, ambos ofrecen un <strong>refresco automático</strong> de los cambios. Ionic permite previsualizar y lanzar la aplicación en un <strong>navegador</strong> web y React Native permite hacerlo en un <strong>dispositivo</strong> móvil o un <strong>emulador</strong>.<br>Es importante anotar que existen dos <strong>limitaciones</strong> al desarrollar en React Native: por un lado, y hasta que no actualicen las versiones, sólo se puede desarrollar aplicaciones Android con compatibilidad hasta el <strong>API 23</strong>; por otro lado, hay que configurar el entorno del proyecto en Android Studio para que sea compatible con <strong>Java 8</strong>. Podéis encontrar más información al respecto <a href="http://facebook.github.io/react-native/docs/getting-started.html">aquí</a>.</p><p>Ambos frameworks tienen <strong>comunidades</strong> bastante grandes (Ionic hereda la comunidad de AngularJS y React Native la de React) y <em>“markets”</em> propios de <strong><em>plugins</em></strong>. Esto es una ventaja enorme, ya que podremos encontrar un plugin para casi cualquier funcionalidad nativa que necesitemos. En ese sentido, a día de hoy Ionic ofrece una mayor cantidad de plugins disponibles es su <a href="https://market.ionic.io/plugins">market</a> que React Native en el <a href="https://react.parts/native">suyo</a>, dado que PhoneGap y Cordova existen desde hace mucho tiempo, pero como React Native también ofrece plugins para poder integrar PhoneGap y Cordova también podréis aprovecharos del esfuerzo de la comunidad de Ionic desde React Native.</p><p>A la vista de lo que hemos contado en este post, cualquiera de los dos frameworks podría ser una opción para empezar a desarrollar aplicaciones híbridas, así que para todos aquellos que habéis leído este post y aún no tenéis claro qué opción os conviene más me voy a mojar y voy a dar una recomendación para cada caso.</p><p>Yo recomendaría usar <strong>Ionic</strong> si has trabajado anteriormente con AngularJS y no te importa delegar parte de la lógica de estilos al propio framework, sólo quieres preocuparte de la lógica de negocio y hacer un sólo código. Por otro lado, yo recomendaría usar <strong>React Native</strong> si has trabajado con React o vienes de un desarrollo más nativo y te interesa más estudiar qué tipo de componente es el que mejor se adapta a tus necesidades.</p><p>Hasta aquí la comparativa. Ahora, ¡a hacer aplicaciones! Tanto si eres desarrollador y quieres empezar a hacer aplicaciones para móvil como si eres diseñador y quieres tener mayor independencia del equipo de desarrollo a la hora de ver funcionando tus diseños, Ionic y React Native deberían estar en tu punto de mira.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e69406283549" width="1" height="1" alt=""><hr><p><a href="https://medium.com/beeva-labs/escogiendo-un-framework-para-desarrollo-h%C3%ADbrido-ionic-vs-react-native-e69406283549">Escogiendo un framework para desarrollo híbrido: Ionic VS React Native</a> was originally published in <a href="https://medium.com/beeva-labs">BEEVA Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>