<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Application Library Engineering Group</title>
    <description>The latest articles on DEV Community by Application Library Engineering Group (@applibgroup).</description>
    <link>https://dev.to/applibgroup</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F823470%2F16852aeb-a045-428b-80f2-5e6a725a54e9.jpg</url>
      <title>DEV Community: Application Library Engineering Group</title>
      <link>https://dev.to/applibgroup</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/applibgroup"/>
    <language>en</language>
    <item>
      <title>Counter App in Open Harmony</title>
      <dc:creator>Application Library Engineering Group</dc:creator>
      <pubDate>Fri, 24 Jun 2022 06:39:06 +0000</pubDate>
      <link>https://dev.to/applibgroup/counter-app-in-open-harmony-1khe</link>
      <guid>https://dev.to/applibgroup/counter-app-in-open-harmony-1khe</guid>
      <description>&lt;p&gt;If you have been following our articles for a quite some time we have worked and introduced HarmonyOS and the importance of the library development. In this article the context would be expressed more in terms of Open Harmony, as the vision always align in delivering a unique user experience across different consumer devices and scenarios. &lt;/p&gt;

&lt;p&gt;Let me introduce what &lt;strong&gt;Open Harmony&lt;/strong&gt; is all about, let me describe Open Harmony in Simple terms &lt;strong&gt;"Open Harmony – the open-source project of the HarmonyOS operating system"&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Open Harmony downloadable source code can be found &lt;a href="https://gitee.com/openharmony" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In order to explain how application development really works, let's start with a simple &lt;strong&gt;counter application&lt;/strong&gt;. In this article we will be walking you through how to create, run and showcase the counter application. The complete code can be found &lt;a href="https://github.com/applib-learning/counter-app" rel="noopener noreferrer"&gt;here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx5srfqyaekm94bxlnvu1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx5srfqyaekm94bxlnvu1.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we understand the skeleton of the project structure, the set of basic files then creating any applications would be easy and will tend to avoid the initial common errors.&lt;/p&gt;

&lt;p&gt;Just a quick heads-up, in this article we are using Open Harmony API version 8, IDE version that I have followed while creating the below demo example in this article is DevEco Studio 3.0 Beta3(Build Version 3.0.0.900). &lt;/p&gt;

&lt;p&gt;Now let's move on to the setup process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. DevEco Studio&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here we would be using DevEco studio IDE which is designed exclusively to run HarmonyOS applications, if you haven’t installed one then you can get it from the official link with the SDK. Also, we have a step by step instructions for the environment setup available &lt;a href="https://developer.harmonyos.com/en/develop/deveco-studio" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Project Creation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once you have the DevEco Studio up running you can create a select a ”File” -&amp;gt; New -&amp;gt; New Project Option, then you are presented with multiple templates to choose from, select the template as shown below which is Empty Ability.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7zi5yj79fjbrt4a1otkm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7zi5yj79fjbrt4a1otkm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a next step, you will have to &lt;strong&gt;“Configure the Project”&lt;/strong&gt; with the project details as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fptlfh483zhr2dqjsnsm1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fptlfh483zhr2dqjsnsm1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provide the Application of your choice.&lt;/li&gt;
&lt;li&gt;Choose the Project type as "Application"&lt;/li&gt;
&lt;li&gt;Compile API needs to be 8&lt;/li&gt;
&lt;li&gt;UI syntax is Js&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The above details are good to go for now and click "&lt;strong&gt;Finish&lt;/strong&gt;".&lt;/p&gt;

&lt;p&gt;Below is the project structure created by default when you create an application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgfqgflv2sq6atovw15it.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgfqgflv2sq6atovw15it.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now moving onto the design aspects of the application since we have considered a &lt;strong&gt;simple counter app&lt;/strong&gt;. The counter contains a very basic components like &lt;strong&gt;increment&lt;/strong&gt;, &lt;strong&gt;decrement&lt;/strong&gt;, and &lt;strong&gt;display&lt;/strong&gt;, we can have few more features like reset etc. As mentioned previously the goal of this article is not to focus on the design aspects rather see how to build applications using Open Harmony and its details.&lt;/p&gt;

&lt;p&gt;By the end of this article you will have successfully built a counter app application as shown below and the entire code is available &lt;a href="https://github.com/Applib-Learning/Counter-App" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffubcgc6m356crn7suc6f.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffubcgc6m356crn7suc6f.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We just have 3 buttons "Increment", "Decrement" and the "Reset" button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftlrcll1u5qszs3e4oayi.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftlrcll1u5qszs3e4oayi.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the front end we use the HarmonyOS Markup Language (HML). The &lt;strong&gt;HarmonyOS Markup Language&lt;/strong&gt; (HML) is an HTML-like language that allows you to build pages based on components and events. Pages built using HML have advanced capabilities such as logic control, data binding, event binding, loop rendering, and conditional rendering.&lt;/p&gt;

&lt;p&gt;More info about HarmonyOS Markup Language (HML) can be found &lt;a href="https://developer.harmonyos.com/en/docs/documentation/doc-guides/js-framework-syntax-hml-0000000000611413" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now let's start crafting the buttons and we will use the below code in index.htm and this can be found in the path &lt;br&gt;
..//MainAbility/pages/index.htm&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  &amp;lt;div style="justify-content: center;"&amp;gt;
        &amp;lt;button class="signs" type="circle" icon="/common/images/plus.png" on:click="add"&amp;gt;&amp;lt;/button&amp;gt;
        &amp;lt;text class="text"&amp;gt;{{count}}&amp;lt;/text&amp;gt;
        &amp;lt;button class="signs" type="circle" icon="/common/images/minus.png" on:click="subtract"&amp;gt;&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;

    &amp;lt;div&amp;gt;
        &amp;lt;button type="capsule" value="Reset Counter" style="margin: 20px;" on:click="reset"&amp;gt;&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you would like to add some styling factors then you can find the index.css in the same path as in index.htm&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
}
.signs{
    margin: 10px;
}

.text{
    font-size: 50px;
    padding-left: 100px;
    padding-right: 100px;
    margin: 30px;
    border: dimgray;
    border-radius: 5px;
    border-width: 5;
}

@media screen and (device-type: phone) and (orientation: landscape) {
    .title {
        font-size: 60px;
    }
}

@media screen and (device-type: tablet) and (orientation: landscape) {
    .title {
        font-size: 100px;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now moving to the js part which is actual functionality part giving some life to &lt;strong&gt;increment&lt;/strong&gt; and &lt;strong&gt;decrement&lt;/strong&gt; buttons. We need to add the event handlers here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default {
    data: {
        count: 0
    },
    onInit() {

    },
    add(){
        this.count = this.count + 1;
    },
    subtract(){
        if(this.count &amp;gt; 0){
            this.count = this.count - 1;
        }
        else{
            this.count = 0;
        }
    },
    reset(){
        this.count = 0;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The complete code can be found &lt;a href="https://github.com/Applib-Learning/Counter-App" rel="noopener noreferrer"&gt;here&lt;/a&gt;. This is a simple example to demonstrate how to start with Open harmony in DevEco Studio and develop a counter application here.&lt;/p&gt;

&lt;p&gt;Since now you know the basic drill, I think it's time to expand your horizon in building a bit complex applications. Please feel leave your comments below if you have tried building any applications with the repo details, we would love to see it.&lt;/p&gt;

&lt;p&gt;For more exciting libraries to develop your app, peep into third-party-components at &lt;a href="https://gitee.com/openharmony-tpc" rel="noopener noreferrer"&gt;OpenHarmony-TPC&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you still want to explore on the HarmonyOS then do check out the articles about HarmonyOS &lt;a href="https://www.harmonyos.com/en/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To know more about the development work happening on harmony application layer, and even be part of the exciting stuff, watch this space of &lt;a href="https://github.com/applibgroup" rel="noopener noreferrer"&gt;Application Library Engineering Group&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>javascript</category>
      <category>libraries</category>
    </item>
    <item>
      <title>How to progress with Dottedprogressbar in HarmonyOS</title>
      <dc:creator>Application Library Engineering Group</dc:creator>
      <pubDate>Wed, 11 May 2022 03:06:31 +0000</pubDate>
      <link>https://dev.to/applibgroup/how-to-progress-with-dottedprogressbar-in-harmonyos-10ac</link>
      <guid>https://dev.to/applibgroup/how-to-progress-with-dottedprogressbar-in-harmonyos-10ac</guid>
      <description>&lt;p&gt;A progress bar is a graphical control element used to visualize the progression of an extended computer operation. Visualization, indications, representations are the terms used to confirm a action irrespective of whether it is successful or failed.&lt;/p&gt;

&lt;p&gt;Now the key factor is how you would like to illustrate the progress bar, whether is it with animations, just text based or shapes, simple indicators etc. Well, it totally depends on the customer requirements or the theme of the app.&lt;/p&gt;

&lt;p&gt;The image shown below is one of the most common type of indicator.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzun12qhf0szeyjzcfead.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzun12qhf0szeyjzcfead.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sometime app requires you to indicate the progression level and change based on the status like shown below which is also one of the type.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr0xk0m84vxkk8cpc1ae6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr0xk0m84vxkk8cpc1ae6.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since progress bar is one of the basic and commonly used component in App, then how about making it reusable and defining a library out of it and customize it as when required.&lt;/p&gt;

&lt;p&gt;One such library is &lt;strong&gt;dottedprogressbar&lt;/strong&gt; library and we will see in this article more about the library, customize it and how to use the library in HarmonyOS application.&lt;/p&gt;

&lt;p&gt;In the article our focus is on a particular type of progressbar which is &lt;strong&gt;dottedprogressbar&lt;/strong&gt; which consist of custom elements or color to configure dots.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Circle Indicator&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Create Circle Indicators for your beautiful application between the two pages (Screen)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc1aai09pg4qno77f4746.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc1aai09pg4qno77f4746.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ViewPager with Tab Title Dot Indicators&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ViewPager is common among mobile developers, It is a group of multiple views connecting to each other with swipe effect.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0b32k9v34a5ptjubu9p5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0b32k9v34a5ptjubu9p5.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;let's see how to use *&lt;em&gt;dottedprogressbar *&lt;/em&gt; in your HarmonyOS Mobile App and process or the setup required.&lt;/p&gt;

&lt;p&gt;If you are new to *HarmonyOS * then do checkout the articles about HarmonyOS &lt;a href="https://www.harmonyos.com/en/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;More info on the dottedprogressbar library can be found &lt;a href="https://gitee.com/HarmonyOS-tpc/dotted-progress-bar" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step by Step Implementation&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. DevEco Studio&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here we would be using DevEco studio IDE which is designed exclusively to run HarmonyOS applications, if you haven't installed one then you can get it from the official link with the SDK. Also, we have a step by step instructions for the environment setup available &lt;a href="https://developer.harmonyos.com/en/develop/deveco-studio" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;2.Project Creation&lt;/em&gt;&lt;br&gt;
Once you have the DevEco Studio up running you can create a select a **"File" -&amp;gt; New -&amp;gt; New Project Option, **then you are presented with multiple templates to choose from, select the template as shown below which is Empty Ability.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F85340nr2u415744dkqob.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F85340nr2u415744dkqob.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a next step you will have to "Configure the Project" with the project details, path and ensure to select&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Language as Java and&lt;/li&gt;
&lt;li&gt;API version to 5 &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8dv06xderiapzvyc0ma1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8dv06xderiapzvyc0ma1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the initial setup you are ready to start working on the application.&lt;/p&gt;

&lt;p&gt;*3.Dependency *&lt;/p&gt;

&lt;p&gt;Next add the dottedprogressbar Dependency, in order to use the library in your HarmonyOS mobile app, you need to first install it by adding the below dependency in your entry/build.gradle file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dependencies {
    implementation fileTree(dir: 'libs', include: ['*.har'])
    implementation 'io.openharmony.tpc.thirdlib:dotted-progress-bar:1.0.0'
           }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Define layout via XML&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now it is time to add the layout details in &lt;strong&gt;ability_main.xml&lt;/strong&gt; as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;com.trncic.library.DottedProgressBar
        ohos:id="$+id:progress"
        ohos:width="match_parent"
        ohos:height="match_parent"
        ohos:padding="30vp"
        app:activeDot="$media:active_dot"
        app:dotSize="29vp"
        app:inactiveDot="$media:inactive_dot"
        app:jumpingSpeed="670"
        app:spacing="15vp" /&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;List of few xml attributes that are supported in DottedProgressBar.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;activeDot - applies to the image of the dotted progress bar&lt;/li&gt;
&lt;li&gt;dotSize - size in dp of the dots(by default it is 16dp)&lt;/li&gt;
&lt;li&gt;inactiveDot - which is of imagetype and it is used to apply the image of the inactive dotted-progress-bar&lt;/li&gt;
&lt;li&gt;Jumping speed - Indicates speed between the dots.&lt;/li&gt;
&lt;li&gt;spacing - spacing between dots which is in dp.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Customize programmatically via Java API&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
   DottedProgressBar progressBar = (DottedProgressBar) findComponentById(ResourceTable.Id_progress);
   progressBar.startProgress();
   progressBar.stopProgress();  

            }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below are some of the support &lt;strong&gt;public API's&lt;/strong&gt;  listed below.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;startProgress()&lt;/li&gt;
&lt;li&gt;stopProgress()&lt;/li&gt;
&lt;li&gt;onDraw(Component component, Canvas canvas)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;private DottedProgressBar bar;
private boolean isInProgress;

 @Override
    protected void onStop() {
        super.onStop();
        stopProgress();
    }

    public void stopProgress() {
        isInProgress = false;
        bar.stopProgress();
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwytze6b4wuoqf2x2yvik.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwytze6b4wuoqf2x2yvik.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's add some customization to the dottedprogressbar and see that in effect.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;com.trncic.library.DottedProgressBar
   ohos:id="$+id:progress"
   ohos:width="match_parent"
   ohos:height="match_parent"
   ohos:padding="30vp"
   app:activeDot="$color:red"
   app:dotSize="25vp"
   app:inactiveDot="$color:black"
   app:jumpingSpeed="670"
   app:spacing="15vp" /&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above code I have changed the active and inactive colors and below is the outcome of it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtxpm2dtjdx1bpqmxzo7.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtxpm2dtjdx1bpqmxzo7.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this article you must have got a glimpse of dottedprogressbar library in HarmonyOS, how to customize and implement it. &lt;/p&gt;

&lt;p&gt;The entire code is available here for your reference &lt;a href="https://github.com/applibgroup/Dottedprogressbar" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Hope you enjoyed it and please post your queries in the comment section and would be glad to answer it.&lt;/p&gt;

</description>
      <category>progressbar</category>
      <category>library</category>
      <category>harmonyos</category>
      <category>java</category>
    </item>
    <item>
      <title>Introduction to Flexbox Layout in HarmonyOS</title>
      <dc:creator>Application Library Engineering Group</dc:creator>
      <pubDate>Tue, 22 Mar 2022 03:37:46 +0000</pubDate>
      <link>https://dev.to/applibgroup/introduction-to-flexbox-layout-in-harmonyos-4p83</link>
      <guid>https://dev.to/applibgroup/introduction-to-flexbox-layout-in-harmonyos-4p83</guid>
      <description>&lt;p&gt;While building application, layouts play a vital role in defining the structure for a user interface in your app. Layouts is more like a base on which components are laid over it and following some guidelines makes it more efficient and aesthetic the User.&lt;/p&gt;

&lt;p&gt;Now lets dwell into Flexbox layout, here the word "Flex" stands for Flexible, in the sense it adapts to the environment or conditions. Similarly if the items is flex it flexes to different sizes to fill the space or environment.&lt;/p&gt;

&lt;p&gt;Lets consider a simple example to start with, lets consider a series of blocks and you can see based on the screen size the blocks are flexible to adaptive based on the environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl4us21xybc7udx8p1apb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl4us21xybc7udx8p1apb.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucljn4sop8b0u42rlyqk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucljn4sop8b0u42rlyqk.png" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9g5wi5srfmm1s3xz3xf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9g5wi5srfmm1s3xz3xf.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Here we are using Flexbox Layout library and how it is similar to CSS Flexible Box Layout Module and how to implement in the HarmonyOS. Also we will cover the steps involved to enjoy the feature of flexbox.&lt;/p&gt;

&lt;p&gt;Let's view some of the features&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating Flexbox Layout with Flex Direction in ROW, &lt;strong&gt;ROW_REVERSE, COLUMN and COLUMN_REVERSE&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Creating Flexbox Layout with Flex Wrap as &lt;strong&gt;NO_WRAP, WRAP and WRAP_REVERSE.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Creating Flexbox Layout with Justify Content as &lt;strong&gt;FLEX_START, FLEX_END, CENTER, SPACE_BETWEEN, SPACE_AROUND and SPACE_EVENLY&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Creating Flexbox Layout with Align Items as &lt;strong&gt;FLEX_START, FLEX_END, CENTER, BASELINE, and STRETCH&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Creating Flexbox Layout with Align Content as &lt;strong&gt;FLEX_START, FLEX_END, CENTER, SPACE_BETWEEN, SPACE_AROUND and STRETCH&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Updating attributes of Child view with order value.&lt;/li&gt;
&lt;li&gt;Updating attributes of Child view with flex grow and flex shrink values.&lt;/li&gt;
&lt;li&gt;Updating attributes of Child view with flex basis percent value.&lt;/li&gt;
&lt;li&gt;Updating attributes of Child view with width, height along with minimum and maximum values.&lt;/li&gt;
&lt;li&gt;Updating attributes of Child view with wrap before.&lt;/li&gt;
&lt;li&gt;Updating attributes of Child view with Align Self as &lt;strong&gt;AUTO, FLEX_START, FLEX_END, CENTER, BASELINE, and STRETCH&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;let's see how to use Flexbox in your HarmonyOS Mobile App and process or setup required.&lt;/p&gt;

&lt;p&gt;If you are new to *&lt;em&gt;HarmonyOS *&lt;/em&gt; then do checkout the articles about HarmonyOS here.&lt;/p&gt;

&lt;p&gt;More info on the Flexbox Layout library can be found &lt;a href="https://github.com/applibgroup/flexbox-layout" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Step by Step Implementation
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1.DevEco Studio&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here we would be using DevEco studio IDE which is designed exclusively to run HarmonyOS applications, if you haven't installed one then you can get it from the official link with the SDK. Also, we have a step by step instructions for the environment setup available &lt;a href="https://developer.harmonyos.com/en/develop/deveco-studio" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.Project Creation&lt;/strong&gt;&lt;br&gt;
Once you have the DevEco Studio up running you can create a select a **"File" -&amp;gt; New -&amp;gt; New Project Option, **then you are presented with multiple templates to choose from, select the template as shown below which is Empty Ability.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcgsqzz7iauo2jo0vg57u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcgsqzz7iauo2jo0vg57u.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a next step you will have to "&lt;strong&gt;Configure the Project&lt;/strong&gt;" with the project details, path and ensure to select&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Language as Java and&lt;/li&gt;
&lt;li&gt;API version to 5 &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnz44c4wbqwd5o5koi9sn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnz44c4wbqwd5o5koi9sn.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the initial setup you are ready to start working on the application.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;3.Dependency *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Next add the Flexbox layout Dependency, in order to use the library in your HarmonyOS mobile app, you need to first install it by adding the below dependency in your entry/build.gradle file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpztksvnzkregjpo7wsdx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpztksvnzkregjpo7wsdx.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Define layout via XML
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;com.google.harmony.flexbox.FlexboxLayout
        ohos:id="$+id:flexbox"
        ohos:height="match_parent"
        ohos:width="match_parent"&amp;gt;
        &amp;lt;Text
            ohos:id="$+id:text_1"
            ohos:height="80vp"
            ohos:width="110vp"
            ohos:background_element="$graphic:flex_item_background"
            ohos:text_alignment="center"
            ohos:text="1"
            ohos:text_size="20fp" /&amp;gt;
        &amp;lt;Text
            ohos:id="$+id:text_2"
            ohos:height="80vp"
            ohos:width="140vp"
            ohos:background_element="$graphic:flex_item_background"
            ohos:text_alignment="center"
            ohos:text="2"
            ohos:text_size="20fp" /&amp;gt;
        &amp;lt;Text
            ohos:id="$+id:text_3"
            ohos:height="80vp"
            ohos:width="110vp"
            ohos:background_element="$graphic:flex_item_background"
            ohos:text_alignment="center"
            ohos:text="3"
            ohos:text_size="20fp" /&amp;gt;
&amp;lt;/com.google.harmony.flexbox.FlexboxLayout&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;and access from code like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FlexboxLayout flexLayout = ((FlexboxLayout) findComponentById(ResourceTable.Id_flexbox));
// To set Flex Direction
flexLayout.setFlexDirection(ROW);
...
// set other properties
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Lets create Flexbox Layout will be  created with flex direction in row mode.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FlexboxLayout flexLayout = ((FlexboxLayout) findComponentById(ResourceTable.Id_flexbox));
// To set Flex Direction
flexLayout.setFlexDirection(ROW);
// ... other required properties
flexLayout.refresh();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2kbhzbugpez6eu5um159.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2kbhzbugpez6eu5um159.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Flexbox Layout will be created with flex wrap in wrap mode.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FlexboxLayout flexLayout = ((FlexboxLayout) findComponentById(ResourceTable.Id_flexbox));
// To set Flex Wrap
flexLayout.setFlexWrap(WRAP);
// ... other required properties
flexLayout.refresh();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffqqtyc6hswqptm34jslq.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffqqtyc6hswqptm34jslq.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Flexbox Layout will be created with flex wrap in wrap and justify content with start
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FlexboxLayout flexLayout = ((FlexboxLayout) findComponentById(ResourceTable.Id_flexbox));
flexLayout.setFlexWrap(WRAP);
// To set Justify Content
flexLayout.setJustifyContent(FLEX_START);
// ... other required properties
flexLayout.refresh();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftdr2ep575j5obndzycbb.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftdr2ep575j5obndzycbb.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Align items with flex start.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FlexboxLayout flexLayout = ((FlexboxLayout) findComponentById(ResourceTable.Id_flexbox));
flexLayout.setFlexWrap(WRAP);
// To set align items
flexLayout.setAlignItems(FLEX_START);
// ... other required properties
flexLayout.refresh();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4i8m967nf5cgxkyxpn7q.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4i8m967nf5cgxkyxpn7q.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;AlignContent for the FlexboxLayout
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FlexboxLayout flexLayout = ((FlexboxLayout) findComponentById(ResourceTable.Id_flexbox));
flexLayout.setFlexWrap(WRAP);
// To set align Content
flexLayout.setAlignContent(FLEX_START);
// ... other required properties
flexLayout.refresh();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0p9uv85j05nf3rd8unhw.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0p9uv85j05nf3rd8unhw.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By now you must have got an idea how to use Flexbox Layout in HarmonyOS and how to add variations like Align, Wrap, direction factors and how the layout changed.&lt;/p&gt;

&lt;p&gt;More info on the Flexbox library can be found &lt;a href="https://github.com/applibgroup/flexbox-layout" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>java</category>
    </item>
    <item>
      <title>A Guide to Lottie in HarmonyOS</title>
      <dc:creator>Application Library Engineering Group</dc:creator>
      <pubDate>Tue, 08 Mar 2022 09:42:12 +0000</pubDate>
      <link>https://dev.to/applibgroup/a-guide-to-lottie-in-harmonyos-53aj</link>
      <guid>https://dev.to/applibgroup/a-guide-to-lottie-in-harmonyos-53aj</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;I can hardly imagine any application without animations, fancy designs, at least there is one component on the screen which is interactive. This boils down to one aspect which is the &lt;strong&gt;User Experience&lt;/strong&gt; which is key factor to be considered while designing apps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmfyx072pdfeqco41u6ai.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmfyx072pdfeqco41u6ai.gif" alt="Animation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;User experience encompasses of all aspects of the end-user’s interaction with the company, its services, and its products&lt;br&gt;
 — Don Norman, Cognitive Scientist &amp;amp; User Experience Architect&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As a developer the vital role is in Architecting, deriving the functionalities and many more on top of this focusing on the design aspects becomes tedious.&lt;/p&gt;

&lt;p&gt;Thanks to libraries like Lottie which is a full-fledged one such library to provide Animation effortlessly in your application with few initial setup.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdygzbqlzzswtsxgixq61.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdygzbqlzzswtsxgixq61.gif" alt="Lottie"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Lottie
&lt;/h2&gt;

&lt;p&gt;If you haven't heard about Lottie, then let's understand what is this library and its features.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Lottie is a library that can be used on website or mobile application for adding animations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is a one stop solution for animation and it’s perfect for developers as you just have to add a few lines of code and you are good to go, isn’t it amazing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lottie is a library for Android, iOS, Web, and Windows that parses Adobe After Effects animations exported as json with &lt;a href="https://github.com/airbnb/lottie-web" rel="noopener noreferrer"&gt;Bodymovin&lt;/a&gt; and renders them natively on mobile and on the web!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More info on Lottie can be found &lt;a href="https://airbnb.io/lottie/#/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkznajd144qbwu9d3hfk3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkznajd144qbwu9d3hfk3.gif" alt="Lottie"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Are we using Lottie just for animation or does it have more features with this pack, I have listed few of them below.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create, edit, and ship in a few clicks.&lt;/li&gt;
&lt;li&gt;We can eliminate long codes, just implement the animation and the rest is taken take by the library.&lt;/li&gt;
&lt;li&gt;Compatible with all browsers.&lt;/li&gt;
&lt;li&gt;It is seemingly ease to use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is an ideal choice to create an engaging user experience with animations then Lottie is the go to library or tool.&lt;/p&gt;




&lt;p&gt;Since we have gathered loads of information about Lottie, now let's see how to use Lottie in your &lt;strong&gt;HarmonyOS Mobile App&lt;/strong&gt; and process or setup required.&lt;/p&gt;

&lt;p&gt;If you are new to **HarmonyOS **then do checkout the articles about HarmonyOS &lt;a href="https://medium.com/application-library-engineering-group/why-harmonyos-52777e74637e" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;More info on the Lottie library can be found &lt;a href="https://github.com/applibgroup/Lottie-ohos" rel="noopener noreferrer"&gt;here &lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step by Step Implementation
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1.DevEco Studio
&lt;/h2&gt;

&lt;p&gt;Here we would be using &lt;strong&gt;DevEco studio&lt;/strong&gt; IDE which is designed exclusively to run HarmonyOS applications, if you haven't installed one then you can get it from the official link with the SDK. Also, we have a step by step instructions for the environment setup available &lt;a href="https://developer.harmonyos.com/en/develop/deveco-studio" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2.Project Creation
&lt;/h2&gt;

&lt;p&gt;Once you have the DevEco Studio up running you can create a select a **"File" -&amp;gt; New -&amp;gt; New Project Option, **then you are presented with multiple templates to choose from, select the template as shown below which is Empty Ability.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73c1ysleikb673xru1rx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73c1ysleikb673xru1rx.png" alt="DevEcoStudio"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a next step you will have to "&lt;strong&gt;Configure the Project&lt;/strong&gt;" with the project details, path and ensure to select &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Language as Java and&lt;/li&gt;
&lt;li&gt;API version to 5&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0dbud4nw00dn85rwwlb5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0dbud4nw00dn85rwwlb5.png" alt="Project creation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the initial setup you are ready to start working on the application.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.Dependency
&lt;/h2&gt;

&lt;p&gt;Next add the Lottie Dependency, in order to use the library in your HarmonyOS mobile app, you need to first install it by adding the below dependency in your entry/build.gradle file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dependencies {
    implementation fileTree(dir: 'libs', include: ['*.har'])
    implementation 'io.openharmony.tpc.thirdlib:lottie-ohos:1.0.4'
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4.Network settings
&lt;/h2&gt;

&lt;p&gt;Navigate to resources -&amp;gt; config.json and add the below lines of code to access internet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "app": {
    "bundleName": "com.airbnb.lottie.demo",
    "vendor": "airbnb",
    "version": {
      "code": 1000000,
      "name": "1.0.0"
    }
  },
  "deviceConfig": {},
  "module": {
    "package": "com.airbnb.lottie.demo",
    "name": ".Lottie",
    "reqCapabilities": [
      "video_support"
    ],
    "deviceType": [
      "default",
      "tablet"
    ],
    "distro": {
      "deliveryWithInstall": true,
      "moduleName": "entry",
      "moduleType": "entry",
      "installationFree" : true
    },
    "abilities": [
      {
        "skills": [
          {
            "entities": [
              "entity.system.home"
            ],
            "actions": [
              "action.system.home"
            ]
          }
        ],
        "orientation": "portrait",
        "name": "com.airbnb.lottie.demo.MainAbility",
        "icon": "$media:icon",
        "description": "$string:mainability_description",
        "label": "$string:app_name",
        "type": "page",
        "launchType": "standard"
      }
    ],
    "reqPermissions": [
      {
        "name": "ohos.permission.INTERNET",
        "reason": "get right",
        "usedScene": {
          "ability": [
            "com.airbnb.lottie.demo.MainAbility"
          ],
          "when": "always"
        }
      }
    ]
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;In HarmonyOS loading Lottie animations are simple and this requires 3 step process as listed below.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The String URL — The URL is passed as parameter to the setFilename() function which needs to be loaded.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Repeat Count — Passed setRepeatCount the function.Lottie library should display animation according to the repetition count specified.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Target — Passed through the setAnimationData() function. This parameter will represent the LottieAnimationView components and Targets where your Lottie animation is assumed to be displayed in.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;6.Implementation - Here we are loading an Lottie json found on the internet in an LottieAnimationView component:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;let's define the layout file, you can find the layout by navigating to the below path &lt;strong&gt;"entry" -&amp;gt; src-&amp;gt; resources -&amp;gt;base -&amp;gt; layout -&amp;gt;animation_slice.xml&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;DirectionalLayout
    xmlns:ohos="http://schemas.huawei.com/res/ohos"
    ohos:height="match_parent"
    ohos:width="match_parent"
    ohos:alignment="center"
    ohos:orientation="vertical"&amp;gt;

    &amp;lt;com.airbnb.lottie.LottieAnimationView
        ohos:id="$+id:animationView"
        ohos:width="match_parent"
        ohos:height="match_parent"/&amp;gt;
&amp;lt;/DirectionalLayout&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NOTE: the LottieAnimationView are present in the resource/raw folder, you can refer this &lt;a href="https://github.com/applibgroup/Lottie-ohos/tree/main/entry/src/main/resources/rawfile" rel="noopener noreferrer"&gt;link &lt;/a&gt;for further details.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Get the reference to LottieAnimationView Component
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//Initialize LottieAnimationView Component

     LottieAnimationView lv = (LottieAnimationView)rootLayout.findComponentById(ResourceTable.Id_animationView);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  8.Loading lottieJson present in server
&lt;/h2&gt;

&lt;p&gt;Now that you have the reference of the LottieAnimationView component, you can write code to load animation into LottieAnimationView component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;private void initLottieViews(String string, String bundleKey, int repeatCount) {
        L.setTraceEnabled(true);
        LottieAnimationView lv = (LottieAnimationView)rootLayout.findComponentById(ResourceTable.Id_animationView);
        lv.setContentPosition((float)50.0,(float)50.0);
        LottieAnimationViewData data = new LottieAnimationViewData();
        if(bundleKey.equals(KEY_JSON_STRING) &amp;amp;&amp;amp; string!=null) {
            data.setFilename(string);
        }
        else {
            data.setUrl(string);
        }
        data.setRepeatCount(repeatCount);
        data.autoPlay = true;
        lv.setAnimationData(data);
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can find the above code &lt;a href="https://github.com/applibgroup/Lottie-ohos/blob/main/entry/src/main/java/com/airbnb/lottie/slice/AnimationSlice.java" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;List of public APIs for app-developer&lt;br&gt;
The public methods below will help us to operate on the component at runtime.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;setContentPosition(float x, float y)&lt;/li&gt;
&lt;li&gt;setAnimationData(LottieAnimationViewData data)&lt;/li&gt;
&lt;li&gt;setRepeatCount(int count)&lt;/li&gt;
&lt;li&gt;setFilename(String name)&lt;/li&gt;
&lt;li&gt;setUrl(String url)&lt;/li&gt;
&lt;li&gt;setResId(int id)&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;Now let's see couple examples of loading Animation from different Source.&lt;/p&gt;
&lt;h2&gt;
  
  
  1. Loading Lottie animation from folder.
&lt;/h2&gt;

&lt;p&gt;In this example we will load the Lottie animation which is stored in the res/raw folder. you can refer this &lt;a href="https://github.com/applibgroup/Lottie-ohos/tree/main/entry/src/main/resources/rawfile" rel="noopener noreferrer"&gt;link &lt;/a&gt;for further details.&lt;/p&gt;

&lt;p&gt;Layout.xml:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;lt;com.airbnb.lottie.LottieAnimationView
        ohos:id="$+id:animationView"
        ohos:width="match_parent"
        ohos:height="match_parent"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Java Slice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LottieAnimationViewData data = new LottieAnimationViewData();
data.setUrl(string);
data.setRepeatCount(repeatCount);
data.autoPlay = true;
lv.setAnimationData(data);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj4jzt8uhr3wl26w64kms.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj4jzt8uhr3wl26w64kms.gif" alt="Example"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Loading Lottie from URL&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can refer &lt;a href="https://github.com/applibgroup/Lottie-ohos/blob/main/entry/src/main/java/com/airbnb/lottie/slice/UrlLoadSlice.java" rel="noopener noreferrer"&gt;here &lt;/a&gt;how is the URL loaded and used.&lt;/p&gt;

&lt;p&gt;Layout.xml:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;com.airbnb.lottie.LottieAnimationView
        ohos:id="$+id:animationView"
        ohos:width="match_parent"
        ohos:height="match_parent"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Java Slice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LottieAnimationViewData data = new LottieAnimationViewData();
         data.setUrl(stringURL);
        data.setRepeatCount(repeatCount);
        data.autoPlay = true;
        lv.setAnimationData(data);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdqypsvlbi2cm0djefbfs.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdqypsvlbi2cm0djefbfs.gif" alt="Example"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;So in this post you must have got a understanding how user &lt;br&gt;
experience play a vital role and how Lottie comes to rescue in giving this wonderful full pack collection of amazing animations.&lt;/p&gt;

&lt;p&gt;Later on we also saw how we could implement Lottie animations in HarmonyOS easily from URL or locally stored.&lt;/p&gt;

&lt;p&gt;More info on the Lottie library can be found &lt;a href="https://github.com/applibgroup/Lottie-ohos" rel="noopener noreferrer"&gt;here &lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>java</category>
      <category>distributedsystems</category>
    </item>
  </channel>
</rss>
