<?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[SuperShare - Medium]]></title>
        <description><![CDATA[At SuperShare, we’re re-imagining what a truly social internet looks like. Here we try to share how we think about the product, growth, engineering, design, and org building challenges we face while navigating the quirky and ever changing maze that is consumer social. - Medium]]></description>
        <link>https://medium.com/supershare-blog?source=rss----24bd058bceaa---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>SuperShare - Medium</title>
            <link>https://medium.com/supershare-blog?source=rss----24bd058bceaa---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 19:55:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/supershare-blog" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a CI/CD pipeline for Android apps using GitHub actions.]]></title>
            <link>https://medium.com/supershare-blog/building-a-ci-cd-pipeline-for-android-apps-using-github-actions-f0fbf537c7a9?source=rss----24bd058bceaa---4</link>
            <guid isPermaLink="false">https://medium.com/p/f0fbf537c7a9</guid>
            <category><![CDATA[continuous-deployment]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Mukesh Solanki]]></dc:creator>
            <pubDate>Tue, 11 Oct 2022 12:31:53 GMT</pubDate>
            <atom:updated>2022-10-11T12:31:53.145Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*iWkMyYsSxocaK3i64JLJKA.png" /></figure><p>Since its debut in November of 2019, GitHub Actions has demonstrated its dependability in a production setting. GitHub actions ultimately allow us to establish a workflow for our apps to automatically build, test, and deploy them, just like many other CI/CD systems.</p><p>The integration of GitHub Actions with GitHub is one of its best features. With the help of GitHub Actions, we can automate the procedure for repositories that are already hosted on GitHub without the need for any additional tools. Your code is on GitHub, your CI/CD is running on GitHub, and if you’d like, you can also have your distribution there. Now that you know what Github actions are let&#39;s dive into using it to build our own android app.</p><h3>The Config File</h3><p>Like any other CI/CD tool Github Actions also uses a config file (usually a .yml ) that it uses to understand what actions it needs to perform. These files are kept under .github/workflowsfolder. Here is a simple illustration of how they appear</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c46118fb412b6fddebf789711d8a6b0d/href">https://medium.com/media/c46118fb412b6fddebf789711d8a6b0d/href</a></iframe><p>Overwhelming. I know. Let’s break it down into steps so you understand what’s happening in this config file.</p><h3>Workflow Trigger</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/55526efc9455ce154dfcbdc68bf3cffd/href">https://medium.com/media/55526efc9455ce154dfcbdc68bf3cffd/href</a></iframe><p>This small little step tells the Github actions when the workflow needs to execute. In our example, the workflow is triggered when some pull request is opened to the develop branch. There are a bunch of other triggers that your try to find the perfect setup for your workflow. You can find them <a href="https://docs.github.com/en/actions/using-workflows/triggering-a-workflow">here</a>.</p><h3>Jobs</h3><p>Jobs are the different steps that would be executed sequentially to test, build and deploy the project. Let’s dive deep into each one of these steps.</p><h4>Env Setup</h4><p>To set up our environment, we must first define what os we would be using to build our app. Since we are building an Android app, using ubuntu should be good enough. We can do this by using the build step likewise.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8465601af5e6e172682e1f456025718c/href">https://medium.com/media/8465601af5e6e172682e1f456025718c/href</a></iframe><p>Now we will define the actual steps we want to execute.</p><h4>Checkout</h4><p>We’ll use Checkout v2 from our first Action to do a git checkout of our repository. This is to pull the latest code and checkout to the branch that triggered the workflow.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b6f21e7cf509240380de80f75952b1ad/href">https://medium.com/media/b6f21e7cf509240380de80f75952b1ad/href</a></iframe><h4>Permissions</h4><p>For us to generate a build using the command line we would need to provide gradelw with the required permission to execute.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d2e7b08394b18c2f1bd65784f6ea570f/href">https://medium.com/media/d2e7b08394b18c2f1bd65784f6ea570f/href</a></iframe><h4>Static code Analysis &amp; Running test</h4><p>We may want to run a variety of tests or analysis tools on our CI/CD infrastructure. Thankfully, we can execute our Gradle commands directly with GitHub actions. It is simple to launch, for example, our tests or Detekt by directly invoking the pertinent Gradle command</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/85623d213a241557df929d1c4fcd88d8/href">https://medium.com/media/85623d213a241557df929d1c4fcd88d8/href</a></iframe><p>Additionally, we may use GitHub Actions to execute our Espresso Tests. We will present android-emulator-runner by Reactive Circus, one of the activities that enable us to activate them</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bfc99f45cf0ddcfc79a293015e0d9200/href">https://medium.com/media/bfc99f45cf0ddcfc79a293015e0d9200/href</a></iframe><h4>Building the app.</h4><p>Now the step we all have been waiting for actually building the app. Every project starts with gathering all of our artifacts for distribution and/or upload. Android has a unique feature, and that is the ability to produce many APKs/AABs based on our Flavor or BuildTypes. Depending on your team structure, some of them are relevant and some of them are less relevant. Fortunately, we can run Gradle instructions directly and produce the necessary amount of artifacts. To run our Gradle command. One illustration is as follows</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c108092eb22c5c091887e538bd6d070/href">https://medium.com/media/6c108092eb22c5c091887e538bd6d070/href</a></iframe><h4>Signing Artifacts</h4><p>The next logical step in producing our Android artifact is signing it so that it can be installed on a device. We will use the old trusty r0adkll to sign our app.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c20be15d52aca8581c220b20fec6295/href">https://medium.com/media/1c20be15d52aca8581c220b20fec6295/href</a></iframe><p>Here are some additional details to help you understand what each line in the above snippet means.</p><p>The sign-android-release Action is used by the “Sign AAB” task. This is rather simple for the APK/AAB to be signed, we must give the key-related details.</p><ul><li>releaseDirectory — The actual directory where the artifact would exist when built. You can get this path by building the app locally on your system and getting the path to the apk or aab from your project root.</li><li>signingKeyBase64 — Encode your signing key as base64 and store it in GitHub secrets. You can check <a href="https://docs.github.com/en/actions/security-guides/encrypted-secrets">this</a> on how to add GitHub secrets.</li><li>alias — Our alias that was provided while generating the signing key.</li><li>keyStorePassword — Our keystore password that was provided while generating the signing key.</li><li>keyPassword — Our key password that was provided which generating the signing key.</li></ul><h4>Converting AABs to APKs (optional)</h4><p>We might want to test our release builds before we publish them to PlayStore. Since installing an aab is a cumbersome task we can convert them to an apk using the buildtool action created by yours truly.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d681f829bc0d961a19d842a62e80a30/href">https://medium.com/media/7d681f829bc0d961a19d842a62e80a30/href</a></iframe><h4>Archiving Artifacts</h4><p>Once our apks and aabs are built and signed we might want to save them on GitHub as a release and also maybe post them to slack or another communication tool to indicate to the QA about the release generated.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/90f2f3ff39cbe9a76fe1559dec980b89/href">https://medium.com/media/90f2f3ff39cbe9a76fe1559dec980b89/href</a></iframe><p>In the code block, we find the apps, aabs and mapping files of our freshly generated release and then zip them up in a nice clean package so the folks accessing these don’t need to go hunting individually for each file.</p><h4>Creating a release</h4><p>The ability to create a Release directly in GitHub itself, which we can then utilise to distribute our artifacts, is an intriguing feature supplied by GitHub. For instance, have a look at the Release page for Timber version 5.0.1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNYGgxlz8FhawBJ_qiTD8w.png" /></figure><p>These releases may each include a variety of artifacts, such as source code, documentation, etc. Additionally, it is possible to produce a CHANGELOG or release-specific notes. The fact that this is automatically created by the entire process, is undoubtedly helpful. The portion that will make the release on GitHub is this one.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac4fc55f532fa74771494b2e27cf5e13/href">https://medium.com/media/ac4fc55f532fa74771494b2e27cf5e13/href</a></iframe><h4>Notifying the team</h4><p>We use Slack as our primary tool for communication. One good thing to do would be to send out a nice little message to the team about what was just released. We also attach the zip file created earlier to a slack channel dedicated to builds.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cbd7ffe8f6ab0ea48fa17e3bdb2e21fc/href">https://medium.com/media/cbd7ffe8f6ab0ea48fa17e3bdb2e21fc/href</a></iframe><p>Feel free to drop a clap or comment or reach out to me on <a href="https://www.linkedin.com/in/mukeshsolanki/">LinkedIn</a>, <a href="https://twitter.com/_mukeshsolanki_">Twitter</a>, <a href="https://www.mukeshsolanki.com/">Website</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0fbf537c7a9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/supershare-blog/building-a-ci-cd-pipeline-for-android-apps-using-github-actions-f0fbf537c7a9">Building a CI/CD pipeline for Android apps using GitHub actions.</a> was originally published in <a href="https://medium.com/supershare-blog">SuperShare</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Will A.I. make creative professionals obsolete?]]></title>
            <link>https://medium.com/supershare-blog/will-a-i-make-creative-professionals-obsolete-a34b1d7c0619?source=rss----24bd058bceaa---4</link>
            <guid isPermaLink="false">https://medium.com/p/a34b1d7c0619</guid>
            <category><![CDATA[art]]></category>
            <category><![CDATA[creativity]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Rishi Jain]]></dc:creator>
            <pubDate>Mon, 03 Oct 2022 05:33:25 GMT</pubDate>
            <atom:updated>2022-10-03T05:33:25.829Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nu338CVgdJY1893ax9eJcA.png" /></figure><h3>Artificially modeling human creativity is incredibly hard</h3><p>Until recently creative fields were considered to be immune to any form of automation or artificial intervention. Unlike other conventional fields where the processes can more or less be standardized, the act of creation offers a complete antithesis. It is iterative, organic, and in most cases downright messy.</p><p><strong>Creating something that stirs humans at a visceral level requires cultural context, intuition, and ingenuity. There is no standard formula. No recipe. Artists/designers often use the phrase “trust the process” to bring some semblance of certainty into a process that’s largely vague.</strong> It almost feels like being on the edge of chaos. Introducing an element of certainty inadvertently ends up removing the element of creativity. You always start from a blank canvas and get thrown into the deep end.</p><p>Moreover, the success of artistic output is non-binary. It depends to a large degree on the emotions it evokes in people, and how it makes them feel. Not only is this tricky to quantify, but even the emotional responses aren’t consistent.</p><p>OpenAI took up this challenge with their ground-breaking text-to-image research project DALL·E in early 2021. It stemmed from a simple idea — instead of machine learning algorithms automatically captioning images (a technology that’s been around since 2015), what if we flipped the logic to generate images from natural language descriptions?</p><p>This idea inspired breakthrough AI research, and the systems that followed DALL·E are nothing short of a glimpse into the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LqYe98Vj724eWu8w.jpg" /><figcaption>An image generated by DALL·E 2. Text prompt: “An astronaut lounging in a tropical resort in space in a vaporwave style”</figcaption></figure><p><strong>DALL·E 2, Midjourney, Stable Diffusion, etc. allow users to input a text prompt and generate photorealistic images in mere seconds. Most of these systems are still in beta, but the generated images are already at a level of fidelity that makes them indistinguishable from the works of professional artists.</strong></p><blockquote>AI systems available today can combine concepts, attributes and styles. They can make realistic edits, generate variations of an image, add or remove elements all while taking shadows, reflections, and textures into account!</blockquote><p>This really puts things into perspective. For artists/designers, it is both empowering and scary. It shakes our sense of security and makes us wonder…</p><h3>Do humans overestimate their creative ability?</h3><p>Creativity has long been romanticized as this divine gift endowed upon a select few. In moments of creative brilliance artists, poets, musicians, scientists, and the likes are known to conjure innovative ideas out of thin air.</p><p>In essence, however, creativity is not as fanciful. In my opinion, it is a function of a person’s knowledge and experience. <strong>Creativity manifests itself in a person’s ability to synthesize known information in novel ways.</strong></p><p>From this viewpoint, creativity isn’t necessarily a scarce resource. On the contrary, it is quite abundant. Everyone can be and is creative. It is like a muscle that can be trained. The training involves building a large mental library of concepts and being open to diverse experiences.</p><h3>Modeling Creativity</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QjA--fwC1WlVhaG1" /><figcaption>Photo by <a href="https://unsplash.com/@cadop?utm_source=medium&amp;utm_medium=referral">Mathew Schwartz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Once we demystify creativity and break it down into its constituents, it starts becoming clearer how AI can be modeled to facilitate humans in their creative pursuits.</p><p>To begin with, text-to-image models are trained on hundreds of millions of images along with their descriptions (alt text) scraped from the internet. Through deep learning, the system is able to learn the relationship between objects and their natural language terms.</p><p>For an AI system, every image is an arrangement of pixels. It perceives images very differently than humans. Every time the model encounters an image with let’s say a “shoe” descriptor, it validates its existing model, checks for new attributes, and improves its overall understanding of what metrics constitute a “shoe” by plotting the object’s location in a mathematical space.</p><p><strong>As this process is repeated for a diverse set of images, the AI model becomes increasingly complex and grows into a “multi-dimensional latent space”. To put things into perspective, this space is a classification of objects on criteria so extensive that humans don’t even perceive these differences through their senses.</strong></p><p>The image generation process starts with a text prompt that directs the system to a specific location in its latent space. Each point in the latent space can have up to 500 coordinates and is a recipe for a potential image. Through an iterative process called Diffusion, the AI system approximates a new image based on the text prompt that makes sense to humans.</p><p><strong>Because the model has been exposed to such a huge repository of data, it has started showing signs of contextual understanding.</strong> It understands that “shoes” are worn on the “feet”; that they are used for activities like “running”; If the prompt says “A person tying their shoes”, the model understands that the user is referring to tying “shoelaces” even when that specific term is missing from the prompt.</p><p>The fascinating part is that the generated images aren’t simply being recycled from the training data set. The program is able to create completely new image compositions from the text prompt!</p><blockquote>“AI models have the capacity to see the totality of the entire recorded human experience. They can emulate every famous designer, every art style and every scene in all of recorded history. It has a larger catalogue of all cultural, historical and artistic movements than any human will ever possess in their mind.” - John Mauriello</blockquote><h3>Democratizing art</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fW3GV5ZaHGqy6-bO" /><figcaption>Photo by <a href="https://unsplash.com/@belchev?utm_source=medium&amp;utm_medium=referral">Dimitar Belchev</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>The distinct advantage of text-to-image AI systems stems from their ability to supplement human craftsmanship. Never in the past have non-artists been able to express themselves creatively.</strong> <strong>Their imagination was always sort of trapped in their minds.</strong> In this aspect, prompting is a game-changer. It acts as a huge enabler for people who haven’t spent years honing a craft or learning a technical skill. Once this technology goes mainstream, it might lead to an explosion in high-fidelity creative output, and that’s amazing!</p><p>But will AI systems eventually become advanced enough to completely remove the human element in artistic endeavors and make craftsmanship redundant? I don’t think so. <strong>Going by historical trends, every time a technological advancement has threatened to kill craftsmanship, it ends up making hand-crafted products more desirable.</strong> And this time it would be no different. Craftsmanship is anti-fragile.</p><p>Concept artists, illustrators, and graphic designers who have worked in the industry for years, and understand the nuances of their craft already see this as “one of those” events. <strong>Once synthetic images have saturated the market and the hype has died down, AI systems would default back to being just another set of tools in the artists&#39; toolbox, that enable them to do what they do best, more effectively.</strong></p><h3>Staying relevant</h3><p>In the long term, staying relevant is less about taking specific steps and more about building a mental framework that helps us stay curious and embrace change.</p><p>If we consider graphic design as an umbrella term for various kinds of digital art, most of it has more to do with applied logic and visual problem solving rather than mastering a tool and creating standalone pretty images.</p><p><strong>AI systems are here to stay, and hungry to disrupt. They would trigger both positive and negative long-range consequences that no person would be able to accurately predict.</strong></p><p>As creatives, if we try moving up the value chain, and build a distinguished preference for our unique points of view, we can potentially position ourselves to take advantage of many such technological advancements, and stand a chance to ride the next big wave of creativity, without being left behind.</p><p>Please free to drop a clap, leave your thoughts in the comments, or reach out to me on <a href="https://www.linkedin.com/in/rishijain297/">LinkedIn</a>, <a href="https://twitter.com/RishiUX">Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a34b1d7c0619" width="1" height="1" alt=""><hr><p><a href="https://medium.com/supershare-blog/will-a-i-make-creative-professionals-obsolete-a34b1d7c0619">Will A.I. make creative professionals obsolete?</a> was originally published in <a href="https://medium.com/supershare-blog">SuperShare</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is GSAP a better alternative for high-performing JavaScript Animation?]]></title>
            <link>https://medium.com/supershare-blog/is-gsap-a-better-alternative-for-high-performing-javascript-animation-6c392944da14?source=rss----24bd058bceaa---4</link>
            <guid isPermaLink="false">https://medium.com/p/6c392944da14</guid>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[gsap]]></category>
            <category><![CDATA[css3]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Karri Jayanth]]></dc:creator>
            <pubDate>Mon, 03 Oct 2022 05:32:44 GMT</pubDate>
            <atom:updated>2022-10-03T05:32:43.943Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TPdRdwbrhDVLBeAmq-7ulw.jpeg" /></figure><p>If you want to include animations on your website, CSS3 is an excellent option. But as animation keeps getting more complex, implementing it gets much more difficult and time-consuming.</p><p>At SuperShare, we wanted to efficiently use animations to enhance the user experience for our viewers. However, CSS3 was not able to handle the complexity due to which we had to resort to GSAP which made our lives so much easier</p><h3><strong>But what is GSAP?</strong></h3><p>the developers of GSAP describe it as the “Swiss army knife” of JavaScript animation and I can’t dare to disagree. A robust high-performing JavaScript animation library that is unlike monolithic frameworks which dictate how you structure your apps.</p><p>It animates anything JavaScript can touch (CSS properties, canvas library objects, SVG, React, Vue, Angular, generic objects, whatever) and solves countless browser inconsistencies, all with blazing speed (up to 20x faster than jQuery), including automatic GPU-acceleration of transforms.</p><p>How different is it?</p><p>Let’s consider an example in the form of a simple pulse animation:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fembed%2Fpreview%2FbGvzLyw%3Fdefault-tabs%3Dcss%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DbGvzLyw&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fpen%2FbGvzLyw&amp;image=https%3A%2F%2Fshots.codepen.io%2Fsmiley4%2Fpen%2FbGvzLyw-512.jpg%3Fversion%3D1661046040&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/e005c79b34aa451b7c23e15abfbbe62c/href">https://medium.com/media/e005c79b34aa451b7c23e15abfbbe62c/href</a></iframe><p>With CSS I used keyframes to specify the style change that happens in percentage</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5106b9808a95b1470080fe28a08139ba/href">https://medium.com/media/5106b9808a95b1470080fe28a08139ba/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fembed%2Fpreview%2FQWmYmwg%3Fdefault-tabs%3Dcss%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DQWmYmwg&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fpen%2FQWmYmwg&amp;image=https%3A%2F%2Fshots.codepen.io%2Fsmiley4%2Fpen%2FQWmYmwg-512.jpg%3Fversion%3D1660986835&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e20edee43df8900a7e9fa0ed2e39250/href">https://medium.com/media/3e20edee43df8900a7e9fa0ed2e39250/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fedc5b3783505250628c3fded135f9c8/href">https://medium.com/media/fedc5b3783505250628c3fded135f9c8/href</a></iframe><p>With GSAP, I did not have to worry about browser inconsistency because it is already taken care of, but this is still very simple.</p><p>So I introduced some complexity to this pulse.</p><p>I considered a scenario where we have one pulse which animates over a time period of 5s and a second pulse that has a delay of 2s and animates over a time period of 3s. Having a total animation time of 5s.</p><p>With CSS3 we code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d757a623bc607370b1f17474b5138b7/href">https://medium.com/media/7d757a623bc607370b1f17474b5138b7/href</a></iframe><p>But this doesn’t quite work. Animation delay property makes the animation delay only once. It is inoperable. It stops working from the next iteration cycle.</p><p>So we take that into account and quickly do a small fix here. Delay is a part of animation as well. So animation time 3secs + delay time 2secs should be considered. The above code looks like this after this fix:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aaf64b4f1c4079eebe71df967ada4282/href">https://medium.com/media/aaf64b4f1c4079eebe71df967ada4282/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fembed%2Fpreview%2FZExwRXK%3Fdefault-tabs%3Dcss%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DZExwRXK&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fpen%2FZExwRXK&amp;image=https%3A%2F%2Fshots.codepen.io%2Fsmiley4%2Fpen%2FZExwRXK-512.jpg%3Fversion%3D1661049067&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/affadcce5a9bc3eb93a052055a2188ff/href">https://medium.com/media/affadcce5a9bc3eb93a052055a2188ff/href</a></iframe><p>Now the keyframes run for 5 secs. To ensure that the keyframes run for 3 secs, we make it so that the animation occurs in 3/5th of the total time or 60% of the time.</p><p>We fix our keyframes for the second pulse with code :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ee58e590ea645398b1b37823e213655/href">https://medium.com/media/0ee58e590ea645398b1b37823e213655/href</a></iframe><p>Here’s the final solution, thank me later :)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fembed%2Fpreview%2FVwXgRBe%3Fdefault-tabs%3Dcss%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DVwXgRBe&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fpen%2FVwXgRBe&amp;image=https%3A%2F%2Fshots.codepen.io%2Fsmiley4%2Fpen%2FVwXgRBe-512.jpg%3Fversion%3D1661049839&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/997b0f8ab8883684f835ff28ae9a033d/href">https://medium.com/media/997b0f8ab8883684f835ff28ae9a033d/href</a></iframe><p>Imagine a situation where we have to add multiple pulses each with its own time delay. Calculating keyframes for each pulse would be hectic.</p><p>But to achieve a similar effect using GSAP, the only update we need to add is a repeatDelay function 👉</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b080c931bfb91f8482faad084ab9b8c/href">https://medium.com/media/3b080c931bfb91f8482faad084ab9b8c/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fembed%2Fpreview%2FqBogvJB%3Fdefault-tabs%3Dcss%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DqBogvJB&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fpen%2FqBogvJB&amp;image=https%3A%2F%2Fshots.codepen.io%2Fsmiley4%2Fpen%2FqBogvJB-512.jpg%3Fversion%3D1661051217&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d035ab6d440d039220362fe7a635a55/href">https://medium.com/media/0d035ab6d440d039220362fe7a635a55/href</a></iframe><p>Not having to keep doing calculations for time delay and having an inbuild function that takes of browser consistency saves a lot of time.</p><p>Let us explore another example with VanillaJS this time:</p><p>In this example, we have a video pip that is draggable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*ksKuIYCsVuNvS51jCCMncA.gif" /></figure><p>Below is the example imitating the functionality of a draggable video pip using vanillaJS.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fembed%2Fpreview%2FvYRPvBK%3Fdefault-tabs%3Djs%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DvYRPvBK&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fpen%2FvYRPvBK&amp;image=https%3A%2F%2Fshots.codepen.io%2Fsmiley4%2Fpen%2FvYRPvBK-512.jpg%3Fversion%3D1661226018&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c6e4b39481cf5b77e7f9560155d2e72/href">https://medium.com/media/9c6e4b39481cf5b77e7f9560155d2e72/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad5bc7902a9ba5f6e7446d5708d6d147/href">https://medium.com/media/ad5bc7902a9ba5f6e7446d5708d6d147/href</a></iframe><p>In the above code, we have an eventlistener on mousemove where we get left and top coordinates which are then used to update the container position. We also consider removing listeners on mouseup.</p><p>The same effect can be brought with GSAP very easily without having to handle eventlisteners.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fembed%2Fpreview%2FpoLYqeq%3Fdefault-tabs%3Dcss%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DpoLYqeq&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fsmiley4%2Fpen%2FpoLYqeq&amp;image=https%3A%2F%2Fshots.codepen.io%2Fsmiley4%2Fpen%2FpoLYqeq-512.jpg%3Fversion%3D1661225972&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/78956570f703ee7e20a5f90c81d1ada2/href">https://medium.com/media/78956570f703ee7e20a5f90c81d1ada2/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/23bab3720cef151d95f4cc5c78fd3caf/href">https://medium.com/media/23bab3720cef151d95f4cc5c78fd3caf/href</a></iframe><p>With significantly less code we achieve similar results. It is also very easy to add extra controls like axis locking, drag resistance, and edge resistance using GSAP draggable. Making it superior for handling animations.</p><p>GSAP maintains compatibility with most browsers, is entirely flexible, highly performant, and easy to code. It sure is the swiss knife of the javascript animations for me.</p><p>If you’re new to this library or just browsing for alternatives, we at SuperShare urge you to dive into it because it has been an awesome experience for us using it so far.</p><p>Feel free to drop a comment or reach out to me on <a href="https://www.linkedin.com/in/jayanth-karri-31210ab0/">Linkedin</a> or <a href="https://twitter.com/kj4_Smiley">Twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c392944da14" width="1" height="1" alt=""><hr><p><a href="https://medium.com/supershare-blog/is-gsap-a-better-alternative-for-high-performing-javascript-animation-6c392944da14">Is GSAP a better alternative for high-performing JavaScript Animation?</a> was originally published in <a href="https://medium.com/supershare-blog">SuperShare</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[We started Peer-Reviewing and there is no going back.]]></title>
            <link>https://medium.com/supershare-blog/we-started-peer-reviewing-and-there-is-no-going-back-2f44223a13b6?source=rss----24bd058bceaa---4</link>
            <guid isPermaLink="false">https://medium.com/p/2f44223a13b6</guid>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[peer-review]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[code-review]]></category>
            <dc:creator><![CDATA[Mukesh Solanki]]></dc:creator>
            <pubDate>Mon, 03 Oct 2022 05:31:01 GMT</pubDate>
            <atom:updated>2022-10-03T05:31:01.097Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I0nFamcaBtivoE5e04ukCw.png" /></figure><p>Code review is the process in which developers critique each other&#39;s work after it has been done, I used to groan every time people talked about code reviews. I mean why wouldn&#39;t I? The tests had been set up, QA had approved them, and the product owners were happy. Code review was undoubtedly merely the process of looking for issues by definition.</p><p>Peer review on the other hand is designed to assess the validity, quality, and often the originality of the work. Its ultimate purpose is to maintain the integrity of the code by filtering out invalid or poor-quality code.</p><p>Peer review is one of the most effective tools for promoting best practices inside a product, a team, an organization, and beyond. Code review is beneficial because it promotes standards and standard awareness. Peer review, however, is even more effective.</p><h3>What&#39;s the problem with Code Review?</h3><p>Code review often takes place after the coding is finished, after all the errors have been made and the time has been wasted. A final review is crucial but delaying the review process might lead a team to accept a poor solution for the sake of expediency. It might seem like twice as much work getting to the solution even when there is time to switch directions.</p><h3>How is Peer review effective?</h3><h4>The Mindset</h4><p>Peer review helps your company develop a culture of high-quality software. Although I use the word “company,” I believe peer review’s scope might be considerably broader. It will benefit your project, your company, and the border community if you can persuade people to adopt a software quality attitude. The most crucial thing you can do for your team, in the long run, is to inspire people to adopt a pro-quality mentality.</p><h4>Knowledge Sharing</h4><p>If management is careless, the developers will inevitably build knowledge silos. Over time, this system will be self-sustaining since each region will be the responsibility of only one developer, who will write code with its unique thoughts and design rather than reusing ideas from other parts of the system. As a result, collaboration becomes a myth, maintenance costs soar, and satisfaction plummets.</p><p>Peer review offers the perfect setting for knowledge exchange across silo barriers. Reviewing the work of developers who are experts in a field is an option for those who aren’t. Although this may not be ideal for finding bugs, peer review is also about talking and asking questions. Even if you can, do it at each other’s desks. The reviewer must have a clear understanding of how that portion of the system operates after finishing.</p><p>As a result, silos eventually fall apart, and we forget how they were created in the first place. Even when that one particular team member is away on vacation, the project may still move forward. When one region of the code is improved, other portions of the code start to follow.</p><h4>Push devs to improve their skills</h4><p>Peer review shouldn’t be a one-way street where experts only critique rookies’ work. I see no problem with doing it the other way around. You have senior members on your team, so that they may mentor the less experienced members. With Peer reviews, junior developers get the chance to evaluate the work of experienced developers through peer review. They may talk about and comprehend the choices made by others while also learning more about a new aspect of development. It could even demonstrate to prospective team members those challenging ideas and raising concerns is acceptable.</p><h3>Where does Peer review fit in?</h3><p>Peer review should start before a single line of code is written. A developer should ask another developer about their strategy before beginning any code (this is in addition to consulting with non-technical members of the team). Early feedback gathering can prevent a lot of headaches in the future. Although several check-ins are welcomed, the final check becomes less thorough and more of a skim.</p><h3>Should code review be replaced by Peer Review?</h3><p>Hell no, you should continue doing code reviews as well. It helps maintain standardization and pushes everyone to follow good coding practices. Peer reviews by no means should not replace code reviews but instead should be an add-on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*DQ8PL3-KMlKkp_FOJMFeCw.jpeg" /></figure><p>Feel free to drop a clap or comment or reach out to me on <a href="https://www.linkedin.com/in/mukeshsolanki/">LinkedIn</a>, <a href="https://twitter.com/_mukeshsolanki_">Twitter</a>, <a href="https://www.mukeshsolanki.com/">Website</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f44223a13b6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/supershare-blog/we-started-peer-reviewing-and-there-is-no-going-back-2f44223a13b6">We started Peer-Reviewing and there is no going back.</a> was originally published in <a href="https://medium.com/supershare-blog">SuperShare</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I ended my 10 year old relationship with GSON?]]></title>
            <link>https://medium.com/supershare-blog/why-i-ended-my-10-year-old-relationship-with-gson-49fbdc3c2f27?source=rss----24bd058bceaa---4</link>
            <guid isPermaLink="false">https://medium.com/p/49fbdc3c2f27</guid>
            <category><![CDATA[songs]]></category>
            <category><![CDATA[moshi]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[kotlin-serialization]]></category>
            <dc:creator><![CDATA[Mukesh Solanki]]></dc:creator>
            <pubDate>Mon, 15 Aug 2022 03:32:58 GMT</pubDate>
            <atom:updated>2022-09-12T12:47:04.504Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7hxhbfOSVLske2JONQYrAA.jpeg" /></figure><p>I have been creating Android applications for about 10 ten years or so now. I have blindly utilised Gson for serialisation and deserialization in every single small or large Android app I have produced. Gson appeared to be perfect and almost know what I was thinking. But it’s now time to say goodbye and move to Moshi.</p><p>So let’s check how Gson is doing right now before we discuss why Moshi is a superior alternative and how we should switch to using it</p><ol><li>Gson was a library created by Google using java to serialize and deserialize an object.</li><li>Gson has a huge number of methods making you hit your dex limit fast.</li><li>Gson uses reflection to serialize and deserialize objects.</li><li>There is no support for default values when using Gson.</li></ol><h3>So if not for Gson, then who?</h3><p><strong>Enter Moshi!!</strong></p><p>Moshi is a modern JSON library written in Kotlin and Java as per their repo. But what makes them modern? Let’s find out.</p><ol><li>Moshi is fast!</li><li>Square’s Moshi can be seen as GSON’s replacement because it has a cleaner and simpler API and an architecture that makes greater use of the Okio library for improved speed. Because it includes Kotlin-aware extensions, it is also the most Kotlin-friendly library you can use to parse JSON files.</li><li>Moshi respects default values.</li><li>Moshi would assign the provided default values when reading JSON that was missing a field, preventing unintentional null pointer errors at runtime.</li><li>Code Generation.</li><li>Moshi has a feature that uses an annotation processor to generate code at build time and does not rely on reflection.</li></ol><h3>Okay but I have a legacy project with Gson used all over the place. What do I do?</h3><p>Migrating to Moshi from Gson is very easy.</p><ol><li>Integrate Moshi from the read me page <a href="https://github.com/square/moshi">here</a>.</li><li>Replace SerializedName with Json so this @SerializedName(“username”) val userName: String? will change to <a href="http://twitter.com/Json">@Json</a>(“username”) val userName: String? if you are using Moshi</li><li>Annotate Data classes with <a href="http://twitter.com/JsonClass">@JsonClass</a>(generateAdapter = true) to allow code generation.</li><li>Replace your from and to Json methods to use Moshi so gson.fromJson(jsonString, class) will change to moshi.adapter(class).fromJson(jsonString)</li><li>Replace the retrofit converter factory so GsonConverterFactory.create() will be replaced with MoshiConverterFactory.create() and retrofit should be able to convert everything properly</li></ol><h4>And that’s pretty much it. You have successfully replaced Gson with Moshi.</h4><p>Feel free to drop a clap or comment or reach out to me on <a href="https://www.linkedin.com/in/mukeshsolanki/">LinkedIn</a>, <a href="https://twitter.com/_mukeshsolanki_">Twitter</a>, <a href="https://www.mukeshsolanki.com/">Website</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49fbdc3c2f27" width="1" height="1" alt=""><hr><p><a href="https://medium.com/supershare-blog/why-i-ended-my-10-year-old-relationship-with-gson-49fbdc3c2f27">Why I ended my 10 year old relationship with GSON?</a> was originally published in <a href="https://medium.com/supershare-blog">SuperShare</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jetpack Compose and the conundrum of selecting a suitable architecture.]]></title>
            <link>https://medium.com/supershare-blog/jetpack-compose-and-the-conundrum-of-selecting-a-suitable-architecture-e9156900f380?source=rss----24bd058bceaa---4</link>
            <guid isPermaLink="false">https://medium.com/p/e9156900f380</guid>
            <category><![CDATA[mvvm]]></category>
            <category><![CDATA[mvi]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <dc:creator><![CDATA[Atri Tripathi]]></dc:creator>
            <pubDate>Mon, 08 Aug 2022 04:41:25 GMT</pubDate>
            <atom:updated>2022-08-08T04:41:25.857Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*OT4J6X5y_vrm5_5xpCUDKw.png" /></figure><p>Jetpack Compose is a modern and declarative UI framework developed by Google for Android to effectually replace the older View-based imperative UI system, which demands an excessive amount of ceremonial setup to render even simple UI elements on the screen.</p><p>The promise of Jetpack Compose lies in its ability to simplify UI development by allowing us to define, more or less, <em>“what”</em> rather than <em>“how”</em> it is to be rendered — declarative over imperative.</p><p>At <a href="https://ssup.co/">SuperShare</a>, we’re rewriting our Android app natively from scratch using the latest tech, libraries, design patterns, feature sets and frameworks that Google offers. And one of the primary decisions we had to take at the onset was selecting a suitable mobile software architecture — MVVM or MVI.</p><blockquote>The other famous architectures like MVC, MVP and Mobius (close contender) had other blatant and severe shortcomings, which we were already aware of; hence they weren’t in our consideration from the beginning.</blockquote><p>We were aware that our decision would have an impact on the application for its entire lifetime, which also, in a way, justified our predicament. We had to tread carefully with this decision and thoroughly weigh our biases on one or the other architecture.</p><p>Moreover, our UI layer had to be written entirely using Jetpack Compose, and the tricky thing with it is that, unlike the View system, Jetpack Compose is built and works using the concept of <em>State-Machine. </em>It operates and relies on a delicate and measured dance between the <em>State</em> changes and the <em>Events</em> that trigger them.</p><p>In simpler words, we had to rethink, adjust and accommodate our way of writing UI code from a mutation-friendly, less contractual and more flexible world to a more purist’s immutability, pure functions, and <em>“state-flows-down, events-flow-up” </em>way of seeing the world.</p><p>The following sections delineate our precise observation of the characteristic strengths and weaknesses of both the architectures and then our final verdict.</p><h3>MVVM</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*9toLHWBZgRrUKv56TrdIkA.png" /></figure><ul><li>MVVM stands for <em>Model-View-ViewModel </em>architecture.</li><li>It was adopted by Google as the standard architecture for developing Android apps several years ago, and they still stand by it.</li><li>It’s a development on the MVP pattern, where it replaces the Interface and its modifications between the View and Presenter with a Pub-Sub/Observer pattern between the View and ViewModel.</li><li>Its strongest suit offering is the lifecycle-aware ViewModel and the ability to have granular control over each UI component using Compose friendly state-holder variables, preferably in the ViewModels, that is decoupled from the screen’s state.</li></ul><h3>MVI</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*bWqpooOt_Xbx9oqfcLSOFg.png" /></figure><ul><li>MVI stands for Model-View-Intent architecture.</li><li>It is a reactive architecture that was developed in public and had strong backing from the developer community.</li><li>It was developed as an alternative for Android taking inspiration from <em>Redux, </em>a state-machined-based JavaScript library for the Web.</li><li>Its strongest suit is that it abides by purist’s principles of writing code, wherein entities and objects are immutable, and therefore they become good representatives of State, and any Event/Intent that wants to change the State does so, not by directly changing the value, but by creating a copy of the object using special functions called <em>Reducers</em>. This keeps the code resilient, thread-safe and testable.</li></ul><h3>Verdict</h3><p>We chose MVVM.</p><p>Now, I agree that on the envelope, reading the above bullet points, it may seem quite evident that MVI should be a clear yes and the way to go, given the fact that it clearly mimics Jetpack Compose in its <em>state-machine-based </em>operational behaviour. And to be honest, we were very split and closely considering this point too.</p><p>But what made MVVM win the bid had to do with two points:</p><ol><li>MVVM still has and probably in the near future will continue to have a strong backing as the standard architecture for Android app development from Google.</li><li>The fact that MVI was developed for Android as inspiration from Redux for JavaScript seemed an overkill, in lieu of the fact that although it might’ve made sense in JavaScript to have proper state management by funnelling your state changes through central <em>Reducer</em> functions because the language itself suffers from a lack of strict typing system, it didn’t really make sense for us with Java/Kotlin, because they do have strict typing system, and therefore a centralised funnelling may or may not have been good to have, but it was never really a necessity.</li></ol><p>The last thing to be mentioned here is that some developers have tried using a mix of both the architectures — where the central structural scaffolding is provided by MVVM, and only the cosmetic layer between the ViewModel and the View with Jetpack Compose is taken care of by a simplified and neutered down version of MVI’s extensive rigmarole.</p><p>Only time will tell how it all really plays out as Jetpack Compose matures.</p><p>Thank you for your precious time.<br>If you liked what you read, please hit the <em>Clap</em> button to your heart’s content, and <em>Follow</em> if you’d like to stay in the loop.</p><p>Best<br>Atri</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9156900f380" width="1" height="1" alt=""><hr><p><a href="https://medium.com/supershare-blog/jetpack-compose-and-the-conundrum-of-selecting-a-suitable-architecture-e9156900f380">Jetpack Compose and the conundrum of selecting a suitable architecture.</a> was originally published in <a href="https://medium.com/supershare-blog">SuperShare</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The fascinating dance of Lottie Android with ViewPager2 and then some.]]></title>
            <link>https://medium.com/supershare-blog/the-fascinating-dance-of-lottie-android-with-viewpager2-and-then-some-d5ce9b6be518?source=rss----24bd058bceaa---4</link>
            <guid isPermaLink="false">https://medium.com/p/d5ce9b6be518</guid>
            <category><![CDATA[onboarding]]></category>
            <category><![CDATA[viewpager2]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[lottie]]></category>
            <dc:creator><![CDATA[Atri Tripathi]]></dc:creator>
            <pubDate>Sat, 09 Apr 2022 19:51:03 GMT</pubDate>
            <atom:updated>2022-04-09T19:51:02.923Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*GoZAN_yopeouKEPVoWZAxQ.png" /></figure><p>Lottie is one of those perplexing tools in a developer’s toolbox which defy the age-old notion that animations are hard to build, maintain and execute. It is a library for Android, iOS, Web, and Windows that parses Adobe After Effects animations exported as JSON with Bodymovin, renders them natively and makes it easy to work with complex animations.</p><p>ViewPager2, on the other hand, is an improved version of the ViewPager library that offers enhanced functionality and allows transitions between one entire screen to another and are regularly found in UIs like setup wizards or slideshows.</p><p>This article deals with an anecdotal case study of how we had set about to create a User OnBoarding flow, which uses Lottie Animations coupled with ViewPager2’s ability to provide granular control over screen transitions, and allowed us to create a rich and delightful onboarding experience for the user.</p><h3>First things first</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*Qcc-mfZdBrRqL5kx093Etw.gif" /><figcaption>SuperShare User Onboarding Flow</figcaption></figure><p>As you can see from the design above, this is the current user onboarding flow built by the Android team at SuperShare, using just Lottie Animations, ViewPager2, some clever maths, and lots of coffee. It’s pretty clear that the GIF is only for representation, and its frame rate isn’t indicative of the actual performance of the app.</p><blockquote>On a real device, this animation plays at a sweet full-frame 60fps.</blockquote><p>For the sake of brevity and to keep things as simple and to the point, we won’t cover the boilerplate-y, housekeeping, and regular stuff such as adding library dependencies, setting up ViewPager2, adding Lottie Animations Views to some Layout XML, etc. We’ll skip directly to the meaty, exciting and fun parts.</p><h3>Without further ado, let’s dive in.</h3><p>From the design above, you can see that the onboarding flow revolves around three major pieces,</p><ol><li>Lottie animation playback, looping and frame control at a granular level</li><li>Background colour transitions between black, white and yellow</li><li>Synchronisation of UI elements like navbar and screen indicator with the scroll movement</li></ol><p>Let’s go through them one at a time.</p><h3>Lottie animation playback.</h3><p>The Lottie animation you see on each screen is two separate Lotties, conveniently named Primary and Secondary Lotties. The Primary Lottie is the large text that appears first in the background. The Secondary Lottie is the dynamic window that slides or fades in at the lower half of the screen after a certain period.</p><p>One of the challenges to implementing this behaviour was that the Secondary Lottie has two parts to it, and when it enters the canvas, say we split its frames into sections A -&gt; B -&gt; C, the Lottie has to playback the frames A -&gt; B once, and then immediately switch to an infinite loop between the frames B -&gt; C.</p><p>Another minor challenge was to synchronise the playback of Secondary Lottie animation, from a pre-specified frame of the ParentLottie, and reset this logic on every transition to a new page.</p><p>The data structure that we use to represent the Lottie based onboarding data:</p><pre>data class LottieOnBoarding(<br>    val versionNumber: Long,<br>    val parentLottie: ParentLottie,<br>    val childLotties: List&lt;ChildLottie&gt;,<br>    val windowColors: List&lt;ColorTuple&gt;,<br>    val proceedTexts: List&lt;String&gt;,<br>) {<br>    var totalPages = windowColors.size<br>    var lottieFormat: LottieFormat = LottieFormat.JSON<br><br>    data class ParentLottie(<br>        val url: String,<br>        val entry: FrameTuple,<br>        val pages: List&lt;FrameTuple&gt;,<br>        val exit: FrameTuple,<br>    )<br><br>    data class ChildLottie(<br>        val url: String,<br>        val entry: FrameTuple,<br>        val loop: FrameTuple<br>    )<br><br>    data class FrameTuple(<br>        val startFrame: Int,<br>        val endFrame: Int<br>    )<br>       <br>    data class ColorTuple(<br>        val background: String,<br>        val accent: String<br>    )<br><br>    enum class LottieFormat {<br>        JSON, DOT_LOTTIE<br>    }<br>}</pre><p>We begin by setting up the logic to handle screen or page scroll transitions by registering an OnPageChangeCallabacklistener and implementing its methods on the instance of our ViewPager.</p><pre>private fun setupPageScrollTransitions(<br>    totalTransitions: Int,<br>    colors: List&lt;ColorTuple&gt;,<br>    lottieFormat: LottieFormat<br>) {<br>    onBoardingViewPager.registerOnPageChangeCallback(object : OnPageChangeCallback() {<br>        override fun onPageScrolled(<br>            position: Int,<br>            positionOffset: Float,<br>            positionOffsetPixels: Int<br>        ) {<br>            handleBackgroundColorTransitions(<br>                colors = colors,<br>                position = position,<br>                positionOffset = positionOffset,<br>                totalTransitions = totalTransitions<br>            )</pre><pre>            handleParentLottieTransitions(<br>                position = position,<br>                positionOffset = positionOffset,<br>                totalTransitions = totalTransitions<br>            )</pre><pre>            handleChildLottieTransitions(<br>                positionOffset = positionOffset<br>            )</pre><pre>            handleNavBarTransitions(<br>                colors = colors,<br>                position = position,<br>                positionOffset = positionOffset,<br>                totalTransitions = totalTransitions<br>            )<br>        }</pre><pre>        override fun onPageSelected(position: Int) {<br>            setupClickListeners(position, totalTransitions)<br>            if (isEntryAnimationPlayed) {<br>                playChildLottie(<br>                    onBoardingData.childLotties[position],<br>                    lottieFormat<br>                )<br>            }<br>            showBottomNavBar()<br>        }</pre><pre>        override fun onPageScrollStateChanged(state: Int) {<br>            if (state == ViewPager2.SCROLL_STATE_IDLE) {<br>                binding.viewpagerIndicator.visibility = View.VISIBLE<br>                binding.textViewProceed.visibility = View.VISIBLE<br>                binding.proceedButton.visibility = View.VISIBLE<br>            }<br>        }<br>    })<br>}</pre><p>This OnPageChangeCallback listener is at the core of our logic to synchronise the horizontal finger based scroll movement with the progression or regression of our individual Lottie frames.</p><p>It provides us with three useful methods to override:</p><ol><li>onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) This method is called every time there is a scroll event on the screen. Out of the three parameters available here, position and possitionOffset are most useful in our case. The position parameter varies from the 0 → (n - 1) where n is the number of pages initialised in the ViewPager and holds the current page that is entirely visible, whereas the positionOffset parameter varies within the floating range 0.0 → 1.0 and holds the current fractional offset value from the left edge of the device as the user scrolls on the screen. This value varies from 0.0 → 1.0 as the user scrolls from Right → Left, and 1.0 → 0.0 otherwise.</li><li>onPageSelected(position: Int) This method is called when the screen or page has completed its scroll, and subsequently the position parameter holds the page number which varies from the 0 → (n - 1) where n is the number of pages initialised in the ViewPager. We personally used it to setup click listeners for the navbar elements, and also to control their visibility.</li><li>onPageScrollStateChanged(state: Int) This method is called whenever the scrolling state for the page undergoes a change. The three possible states are SCROLL_STATE_IDLE, SCROLL_STATE_DRAGGING and SCROLL_STATE_SETTLING. Again, we’ve used this to uniquely control the visibility of the navbar elements.</li></ol><p>This is how we control Parent Lottie transitions relative to the degree of page scroll.</p><pre>private fun handleParentLottieTransitions(<br>    position: Int,<br>    positionOffset: Float,<br>    totalTransitions: Int<br>) {<br>    if (position in 0 until totalTransitions <br>        &amp;&amp; isEntryAnimationPlayed) {<br>        binding.lottieParent.frame = lerp(<br>            onBoardingData.parentLottie<br>                          .pages[position]<br>                          .startFrame<br>                          .toFloat(),<br>            onBoardingData.parentLottie<br>                          .pages[position]<br>                          .endFrame<br>                          .toFloat()<br>                          .minus(1),<br>            positionOffset<br>       ).apply(::floor).toInt()<br>    }<br>}</pre><p>The handleParentLottieTransitions() method is called on every scroll event with the current position and positionOffset values as parameters. Here, we also check if the current page position is between 0 and the total pages defined in ViewPager, and the initial bit of the entry animation has played. If this is true, we update the frame property of the parent’s LottieView using a lerp() function, as given below:</p><pre>fun lerp(firstValue: Float, secondValue: Float, amount: Float): Float {<br>    return (secondValue - firstValue) * amount + firstValue<br>}</pre><p>The lerp() function essentially performs a <strong>Linear Interpolation</strong> between two values, using a third value to specify the amount to interpolate between these two values. An amount nearer to 0.1 would mean that the final value is nearer to the firstValue, and nearer to 0.9 means that the value is nearer to the secondValue.</p><p>Subsequently, the normal playback of the Parent Lottie, say on a button press is as follows:</p><pre>private fun playParentLottieForJson(parentLottie: ParentLottie) {<br>    binding.lottieParent.apply {<br>        LottieCompositionFactory.fromUrl(requireContext(), parentLottie.url)<br>            .addListener { composition -&gt;<br>                setComposition(composition)<br>                setMinAndMaxFrame(<br>                    parentLottie.entry.startFrame,<br>                    parentLottie.entry.endFrame.minus(1)<br>                )<br>                addAnimatorUpdateListener {<br>                    it.doOnEnd {<br>                        setMinAndMaxFrame(<br>                            parentLottie.entry.startFrame,<br>                            parentLottie.exit.endFrame<br>                        )<br>                        isEntryAnimationPlayed = true<br>                        playChildLottie(<br>                            onBoardingData.childLotties[0],<br>                            onBoardingData.lottieFormat<br>                        )<br>                    }<br>                }<br>                playAnimation()<br>            }.addFailureListener { e -&gt; e.printStackTrace() }<br>    }<br>}</pre><p>As its quite self-evident that ParentLottie is data model class which has properties such as url of the Lottie, start and end frames modelled as a FrameTuple for both entry and exit sections of the animation, and a list of pages or screens in-between modelled as a List&lt;FrameTuple&gt;.</p><p>We begin by using LottieCompositionFactory to load the Lottie from a url hosted on a network, and add a callback listener to await and set its composition. This is followed by setting the min and max frames of the Lottie, to the startFrame and endFrame of the entry section. Finally, at the end of playback of this section, we again reset the minand max frames to cover the entire range of the Lottie animation, and also initiate playback of that screen’s specific Child Lottie.</p><p>Similarly, the playback of Child Lottie is handled as follows</p><pre>private fun playChildLottieForJson(childLottie: ChildLottie) {<br>        binding.lottieChild.apply {<br>            cancelAnimation()<br>            LottieCompositionFactory.fromUrl(requireContext(), childLottie.url)<br>                .addListener { composition -&gt;<br>                    setComposition(composition)<br>                    setMinAndMaxFrame(<br>                        childLottie.entry.startFrame,<br>                        childLottie.loop.endFrame<br>                    )<br>                    addAnimatorUpdateListener {<br>                        if (frame == childLottie.entry.endFrame.minus(1)) {<br>                            removeAllUpdateListeners()<br>                            setMinAndMaxFrame(<br>                                childLottie.loop.startFrame,<br>                                childLottie.loop.endFrame<br>                            )<br>                            repeatCount = LottieDrawable.INFINITE<br>                        }<br>                    }<br>                    playAnimation()<br>                }.addFailureListener { e -&gt; e.printStackTrace() }<br>        }<br>    }</pre><p>Here, too the handling is very similar to how Parent Lottie is handled, except a few differences like we call cancelAnimation() at the top to terminate any existing Child Lottie that might be playing from the previous screen. Additionally, we add an update listener and inside it we check if the current frame is the endFrame of the entry section for Child Lottie, and if it is, we remove the update listeners to prevent any potential memory leaks, and unnecessary GC collections.</p><p>More importantly, we reset the min and max frames to startFrame and endFrame of the loop section of Child Lottie, and set the repeatCount property of the Lottie view to LottieDrawable.INFINITE.</p><h3>Background colour transitions.</h3><pre>private fun handleBackgroundColorTransitions(<br>    colors: List&lt;ColorTuple&gt;,<br>    position: Int,<br>    positionOffset: Float,<br>    totalTransitions: Int<br>) {<br>    binding.viewpagerUserOnboarding.apply {<br>        when (position) {<br>            in 0 until totalTransitions -&gt; {<br>                ArgbEvaluatorCompat().evaluate(<br>                    positionOffset,<br>                    Color.parseColor(colors[position].background),<br>                    Color.parseColor(colors[position + 1].background)<br>                ).apply(::setBackgroundColor)<br>            }<br>            else -&gt; setBackgroundColor(Color.parseColor(colors[colors.size - 1].background))<br>        }<br>    }<br>}</pre><p>The smooth background colour transition between, Black, White and Yellow, and the transitory colours in-between are calculated using ArgbEvaluatorCompat class available as part of the Android Material library.</p><h3>Synchronisation of UI elements with scroll.</h3><p>The visibility, alpha, and translation behaviour of the UI elements like the Page Indicator and the text in the Navbar are controlled using two appropriately name methods — showBottomNavBar() and hideBottomNavBar() given as follows:</p><pre>private fun showBottomNavBar(): AnimatorSet {<br>    binding.apply {<br>        viewpagerIndicator.visibility = View.VISIBLE<br>        textViewProceed.visibility = View.VISIBLE<br>        proceedButton.visibility = View.VISIBLE<br>    }</pre><pre>    val indicatorTranslateAnim = binding.viewpagerIndicator.translateY(from = 200f, to = 0f)<br>    val indicatorAlphaAnim = binding.viewpagerIndicator.transformAlpha(from = 0f, to = 1f)</pre><pre>    val proceedTextTranslateAnim = binding.textViewProceed.translateY(from = 200f, to = 0f)<br>    val proceedTextAlphaAnim = binding.textViewProceed.transformAlpha(from = 0f, to = 1f)</pre><pre>    val proceedButtonTranslateAnim = binding.proceedButton.translateY(from = 200f, to = 0f)<br>    val proceedButtonAlphaAnim = binding.proceedButton.transformAlpha(from = 0f, to = 1f)</pre><pre>    return showNavBarAnimatorSet.apply {<br>        play(indicatorTranslateAnim).with(indicatorAlphaAnim)<br>        play(indicatorAlphaAnim).with(proceedTextTranslateAnim)<br>        play(proceedTextTranslateAnim).with(proceedTextAlphaAnim)<br>        play(proceedButtonTranslateAnim).with(proceedButtonAlphaAnim)</pre><pre>        duration = 500L<br>        startDelay = 1000L<br>        interpolator = DecelerateInterpolator()<br>        start()<br>    }<br>}</pre><pre>private fun hideBottomNavBar(): AnimatorSet {<br>    val indicatorTranslateAnim = binding.viewpagerIndicator.translateY(from = 0f, to = 200f)<br>    val indicatorAlphaAnim = binding.viewpagerIndicator.transformAlpha(from = 1f, to = 0f)</pre><pre>    val proceedTextTranslateAnim = binding.textViewProceed.translateY(from = 0f, to = 200f)<br>    val proceedTextAlphaAnim = binding.textViewProceed.transformAlpha(from = 1f, to = 0f)</pre><pre>    val proceedButtonTranslateAnim = binding.proceedButton.translateY(from = 0f, to = 200f)<br>    val proceedButtonAlphaAnim = binding.proceedButton.transformAlpha(from = 1f, to = 0f)</pre><pre>    return hideNavBarAnimatorSet.apply {<br>        play(indicatorTranslateAnim).with(indicatorAlphaAnim)<br>        play(indicatorAlphaAnim).with(proceedTextTranslateAnim)<br>        play(proceedTextTranslateAnim).with(proceedTextAlphaAnim)<br>        play(proceedButtonTranslateAnim).with(proceedButtonAlphaAnim)</pre><pre>        duration = 200L<br>        interpolator = AccelerateInterpolator()<br>        start()<br>    }<br>}</pre><pre>// Extension functions to handle translation and alpha<br>fun View.translateY(from: Float, to: Float): ObjectAnimator =<br>    ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, from, to)</pre><pre>fun View.transformAlpha(from: Float, to: Float): ObjectAnimator =<br>    ObjectAnimator.ofFloat(this, View.ALPHA, from, to)</pre><p>The implementation is pretty straight forward with the usage of ObjectAnimator to control the Y-axis translation and Alpha channel transformation of the Navbar UI elements, which are handled using the extension functions translateY() and transformAlpha() on the View class.</p><p>This brings us to the end, where we saw how Lottie Animations working with JSON files, coupled with ViewPager and some clever maths can allow us to create powerful and elegant animations so easily.</p><p>If you liked the article please show some love by clicking ♥ and sharing with your friends. You can follow me on <a href="https://twitter.com/AtriTripathi">Twitter</a> or hit me up on <a href="https://www.linkedin.com/in/atritripathi/">LinkedIn</a> if you want to get in touch.</p><p>Ciao!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5ce9b6be518" width="1" height="1" alt=""><hr><p><a href="https://medium.com/supershare-blog/the-fascinating-dance-of-lottie-android-with-viewpager2-and-then-some-d5ce9b6be518">The fascinating dance of Lottie Android with ViewPager2 and then some.</a> was originally published in <a href="https://medium.com/supershare-blog">SuperShare</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>