<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Maha Kanagaraj on Medium]]></title>
        <description><![CDATA[Stories by Maha Kanagaraj on Medium]]></description>
        <link>https://medium.com/@maha21.kanagaraj?source=rss-03c44a83e975------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*FSPRklrtYeuqWNtm</url>
            <title>Stories by Maha Kanagaraj on Medium</title>
            <link>https://medium.com/@maha21.kanagaraj?source=rss-03c44a83e975------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 11:46:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@maha21.kanagaraj/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Integrating Google ML Kit in Flutter (Text Recognition + Translation) — Full Android & iOS Setup…]]></title>
            <link>https://medium.com/@maha21.kanagaraj/integrating-google-ml-kit-in-flutter-text-recognition-translation-full-android-ios-setup-03380608416d?source=rss-03c44a83e975------2</link>
            <guid isPermaLink="false">https://medium.com/p/03380608416d</guid>
            <category><![CDATA[google-ml-kit]]></category>
            <dc:creator><![CDATA[Maha Kanagaraj]]></dc:creator>
            <pubDate>Mon, 05 May 2025 07:17:16 GMT</pubDate>
            <atom:updated>2025-05-05T07:17:16.653Z</atom:updated>
            <content:encoded><![CDATA[<h3>Integrating Google ML Kit in Flutter (Text Recognition + Translation) — Full Android &amp; iOS Setup Guide (2025)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TbVkGmB92k9BpSWPiwC46w.png" /></figure><p>Flutter makes it easy to build cross-platform apps, but integrating platform-specific ML features like <strong>Google ML Kit</strong> — especially on both Android and iOS — can get tricky. I recently built a text scan and translate app using:</p><ul><li>google_mlkit_text_recognition</li><li>google_mlkit_translation</li></ul><p>Here’s a step-by-step guide with all fixes I applied.</p><h4>Plugin Versions (Stable — May 2025)</h4><p>In your pubspec.yaml, use:</p><pre>dependencies:<br>  google_mlkit_text_recognition: ^0.13.0<br>  google_mlkit_translation: ^0.10.1</pre><p>Make sure both are from compatible MLKit core versions (6.0.0).</p><h4>Android Setup</h4><h4>🔧 android/build.gradle</h4><pre>buildscript {<br>    dependencies {<br>        classpath(&quot;com.android.tools.build:gradle:8.1.0&quot;)<br>    }<br>}</pre><h4>android/app/build.gradle.kts</h4><pre>android {<br>    namespace = &quot;com.example.myapp&quot;<br>    compileSdk = 34<br><br>    defaultConfig {<br>        minSdk = 21<br>        targetSdk = 34<br>    }<br><br>    buildTypes {<br>        release {<br>            minifyEnabled = true<br>            shrinkResources = true<br>            proguardFiles(<br>                getDefaultProguardFile(&quot;proguard-android-optimize.txt&quot;),<br>                &quot;proguard-rules.pro&quot;<br>            )<br>        }<br>    }<br><br>    compileOptions {<br>        sourceCompatibility = JavaVersion.VERSION_11<br>        targetCompatibility = JavaVersion.VERSION_11<br>    }<br><br>    kotlinOptions {<br>        jvmTarget = &quot;11&quot;<br>    }<br>}</pre><h4>🔐 Android ProGuard Rules</h4><p>If not present, create this file:</p><p>android/app/proguard-rules.pro:</p><pre># Google ML Kit<br>-keep class com.google.mlkit.** { *; }<br>-dontwarn com.google.mlkit.**<br><br># Flutter internals<br>-keep class io.flutter.plugin.** { *; }<br>-keep class io.flutter.embedding.** { *; }<br><br># Firebase (optional)<br>-keep class com.google.firebase.** { *; }<br>-dontwarn com.google.firebase.**</pre><h4>iOS Setup (CocoaPods Conflict Fix)</h4><p>In your ios/Podfile, make sure to:</p><h4>Set platform and force MLKitCore version:</h4><pre>platform :ios, &#39;12.0&#39;<br><br>post_install do |installer|<br>  installer.pods_project.targets.each do |target|<br>    flutter_additional_ios_build_settings(target)<br><br>    target.build_configurations.each do |config|<br>      config.build_settings[&#39;EXCLUDED_ARCHS[sdk=iphonesimulator*]&#39;] = &#39;arm64&#39;<br>    end<br>  end<br><br>  # Fix MLKitCore version mismatch<br>  installer.pod_targets.each do |pod|<br>    if pod.name.include?(&quot;GoogleMLKit/Translate&quot;)<br>      pod.specification.dependency &quot;GoogleMLKit/MLKitCore&quot;, &quot;= 6.0.0&quot;<br>    end<br>  end<br>end</pre><h4>Common Errors You Might Face</h4><p><strong>❌ Missing MLKitCore version</strong></p><p>✅ Fix: Force MLKitCore version in Podfile under post_install block.</p><p><strong>❌ </strong><strong>Namespace not specified</strong></p><p>✅ Fix: Add a namespace = &quot;your.package.name&quot; line in your build.gradle.kts or build.gradle.</p><p><strong>❌ </strong><strong>resource android:attr/lStar not found</strong></p><p>✅ Fix: Downgrade compileSdk from 35 to <strong>34</strong> in build.gradle.kts.</p><p><strong>❌ </strong><strong>IllegalArgumentException jdkImage</strong></p><p>✅ Fix: Clear Gradle cache:</p><pre>./gradlew clean<br>rm -rf ~/.gradle/caches</pre><p><strong>❌ Missing classes during R8 shrink (e.g. </strong><strong>TextRecognizerOptions)</strong></p><p>✅ Fix: Add necessary <strong>ProGuard rules</strong> to proguard-rules.pro:</p><pre>-keep class com.google.mlkit.** { *; }<br>-dontwarn com.google.mlkit.**</pre><h4>Final Build Commands</h4><pre>flutter clean<br>flutter pub get<br>flutter build apk --release<br>flutter build ios --release</pre><p>If you’re integrating <strong>Text Recognition</strong> and <strong>Translation</strong> via ML Kit in Flutter, expect some initial friction due to platform-specific constraints. Once you align your versions and settings correctly, it’s smooth sailing.</p><p>Happy Coding !!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03380608416d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[End-to-End Testing and CI/CD Integration: Automating the Complete Workflow for QuotesApp]]></title>
            <link>https://medium.com/@maha21.kanagaraj/end-to-end-testing-and-ci-cd-integration-automating-the-complete-workflow-for-quotesapp-d0f09f35aa88?source=rss-03c44a83e975------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0f09f35aa88</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[e2e-testing]]></category>
            <category><![CDATA[android-testing]]></category>
            <category><![CDATA[espresso]]></category>
            <category><![CDATA[automation-testing]]></category>
            <dc:creator><![CDATA[Maha Kanagaraj]]></dc:creator>
            <pubDate>Sun, 04 May 2025 14:53:17 GMT</pubDate>
            <atom:updated>2025-05-04T14:53:17.912Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OnL0X3PNV5UlV3uXVAj0HQ.png" /></figure><p>In our final installment of the QuotesApp testing series, we bring everything together with End-to-End (E2E) testing and CI/CD integration. In this article, we’ll simulate a full user journey — from launching the app to retrieving data and interacting with the UI — to validate that every layer of our application works flawlessly. We’ll also walk through setting up a Continuous Integration pipeline (using GitHub Actions as an example) to automatically run our tests, ensuring code quality and reducing test flakiness.</p><blockquote><strong>What is End-to-End Testing?</strong></blockquote><p>End-to-End testing validates complete workflows by testing the app as a whole. Rather than verifying isolated components, E2E tests simulate real user journeys — from app launch to final interaction — to ensure that all layers (UI, ViewModel, Repository, and even network simulation) work in harmony. With E2E tests, we catch issues that might be missed with unit or integration tests alone.</p><blockquote>Project Directory Structure</blockquote><p>Before we dive into the code, here’s an overview of the relevant project directories, including our main source files and Android UI test files (E2E tests):</p><pre>QuotesApp/<br>└── app/<br>    ├── src/<br>    │   ├── main/<br>    │   │   ├── java/com/maha/quotesapp/<br>    │   │   │   ├── data/<br>    │   │   │   │   ├── model/<br>    │   │   │   │   │   └── Quote.kt<br>    │   │   │   │   └── repository/<br>    │   │   │   │       └── ContentRepository.kt<br>    │   │   │   ├── network/<br>    │   │   │   │   ├── RetrofitInstance.kt<br>    │   │   │   │   └── QuotesService.kt<br>    │   │   │   ├── ui/<br>    │   │   │   │   ├── MainActivity.kt<br>    │   │   │   │   ├── adapter/<br>    │   │   │   │   │   └── QuotesAdapter.kt<br>    │   │   │   │   └── viewmodel/<br>    │   │   │   │       └── ContentViewModel.kt<br>    │   │   └── res/<br>    │   │       ├── layout/<br>    │   │       │   ├── activity_main.xml<br>    │   │       │   ├── item_quote.xml<br>    │   │       │   └── neumorphic_bg.xml<br>    │   │       ├── values/<br>    │   │       │   ├── colors.xml<br>    │   │       │   └── styles.xml<br>    │   │       └── font/<br>    │   │           └── courgette_font.ttf<br>    └── androidTest/<br>        └── java/com/maha/quotesapp/ui/<br>            └── MainActivityE2ETest.kt</pre><p>Our end-to-end tests reside in the androidTest folder where Espresso and other UI test tools help simulate real user interactions.</p><blockquote><strong>End-to-End Testing with Espresso</strong></blockquote><p>For our E2E tests, we use Espresso to simulate user interactions such as launching the app, verifying UI components, scrolling through the RecyclerView, and performing clicks.</p><pre>// File: app/src/androidTest/java/com/maha/quotesapp/ui/MainActivityE2ETest.kt<br><br>package com.maha.quotesapp.ui<br><br>import androidx.test.espresso.Espresso.onView<br>import androidx.test.espresso.action.ViewActions.click<br>import androidx.test.espresso.action.ViewActions.scrollTo<br>import androidx.test.espresso.contrib.RecyclerViewActions<br>import androidx.test.espresso.matcher.ViewMatchers.*<br>import androidx.test.ext.junit.rules.ActivityScenarioRule<br>import androidx.test.ext.junit.runners.AndroidJUnit4<br>import com.maha.quotesapp.R<br>import org.hamcrest.Matchers.allOf<br>import org.junit.Rule<br>import org.junit.Test<br>import org.junit.runner.RunWith<br><br>// Specify that we are using the AndroidJUnit4 test runner<br>@RunWith(AndroidJUnit4::class)<br>class MainActivityE2ETest {<br><br>    // Launch MainActivity before running each test case<br>    @get:Rule<br>    val activityRule = ActivityScenarioRule(MainActivity::class.java)<br><br>    @Test<br>    fun testLaunchMainActivityAndVerifyToolbar() {<br>        // Check if the Material Toolbar with centered title &quot;QuotesApp&quot; is displayed on launch.<br>        onView(allOf(withParent(withId(R.id.topAppBar)), withText(&quot;QuotesApp&quot;)))<br>            .check(matches(isDisplayed()))<br>        <br>        // Note: Verification of status bar color is typically done in integration tests, <br>        // but here we assume the Activity setup is correct when the toolbar is visible.<br>    }<br><br>    @Test<br>    fun testRecyclerViewPresenceAndScrolling() {<br>        // Verify that the RecyclerView (rvQuotes) is visible on the screen.<br>        onView(withId(R.id.rvQuotes))<br>            .check(matches(isDisplayed()))<br>        <br>        // Simulate scrolling through the RecyclerView to position 5.<br>        // Adjust the position as necessary if your data set is larger.<br>        onView(withId(R.id.rvQuotes))<br>            .perform(RecyclerViewActions.scrollToPosition&lt;androidx.recyclerview.widget.RecyclerView.ViewHolder&gt;(5))<br>    }<br><br>    @Test<br>    fun testUserInteractionOnRecyclerViewItem() {<br>        // Simulate a user click on the first item in the RecyclerView.<br>        // This action might trigger a transition or show a detail dialog.<br>        onView(withId(R.id.rvQuotes))<br>            .perform(<br>                RecyclerViewActions.actionOnItemAtPosition&lt;androidx.recyclerview.widget.RecyclerView.ViewHolder&gt;(<br>                    0, click()<br>                )<br>            )<br>        <br>        // Further assertions can be added here to verify post-click behavior<br>        // such as checking for the display of a detail view, a dialog, etc.<br>    }<br>}</pre><blockquote>Explanation:</blockquote><ul><li><strong>ActivityScenarioRule:</strong> This rule launches MainActivity for each test, ensuring the Activity is set up properly for testing.</li><li><strong>Toolbar Verification:</strong> We use a combination of matchers (allOf and withParent) to assert that a view within the toolbar displays the title &quot;QuotesApp&quot;.</li><li><strong>RecyclerView Tests:</strong> We check that the RecyclerView is displayed and simulate scrolling to verify that items (quote cards) are rendered and can be scrolled.</li><li><strong>User Interaction Simulation:</strong> Simulating a click on a RecyclerView item mimics common user behavior and verifies that the app responds appropriately.</li></ul><blockquote><strong>CI/CD Integration with GitHub Actions</strong></blockquote><p>Once our tests are written and working locally, it’s essential to automate their execution using a Continuous Integration pipeline. This ensures that every code change is validated against our test suite, keeping our app stable.</p><p>Below is an example GitHub Actions workflow (YAML) file that runs both unit and instrumentation tests on each push.</p><pre># File: .github/workflows/android-ci.yml<br><br>name: Android CI<br><br>on:<br>  push:<br>    branches: [ main ]<br>  pull_request:<br>    branches: [ main ]<br><br>jobs:<br>  build:<br>    name: Build and Test<br>    runs-on: ubuntu-latest<br><br>    steps:<br>      - name: Checkout Code<br>        uses: actions/checkout@v2<br><br>      - name: Set up JDK 11<br>        uses: actions/setup-java@v2<br>        with:<br>          distribution: &#39;temurin&#39;<br>          java-version: &#39;11&#39;<br><br>      - name: Cache Gradle packages<br>        uses: actions/cache@v2<br>        with:<br>          path: |<br>            ~/.gradle/caches<br>            ~/.gradle/wrapper<br>          key: ${{ runner.os }}-gradle-${{ hashFiles(&#39;**/*.gradle*&#39;, &#39;**/gradle-wrapper.properties&#39;) }}<br><br>      - name: Build Debug APK and Run Unit Tests<br>        run: ./gradlew assembleDebug test<br><br>      - name: Run Instrumentation Tests on Firebase Test Lab<br>        run: ./gradlew connectedAndroidTest<br>        # Note: For local runners, connectedAndroidTest might require an emulator.<br>        # Alternatively, you can integrate Firebase Test Lab to run Android tests in the cloud.<br>      <br>      # Optionally upload test results and APKs as artifacts.<br>      - name: Upload Test Results<br>        uses: actions/upload-artifact@v2<br>        with:<br>          name: test-results<br>          path: app/build/test-results/</pre><blockquote><strong>Explanation</strong>:</blockquote><ul><li><strong>Trigger Conditions:</strong> The workflow runs on every push or pull request to the main branch.</li><li><strong>Setup Steps:</strong></li><li><strong>Checkout Code:</strong> Retrieve the repository code.</li><li><strong>Set up JDK 11:</strong> Configures the Java environment.</li><li><strong>Cache Gradle:</strong> Caches Gradle dependencies to speed up builds.</li><li><strong>Build and Test Steps:</strong></li><li><strong>Assemble the APK and Run Unit Tests:</strong> Runs the command ./gradlew assembleDebug test to build the app and execute unit tests.</li><li><strong>Run Instrumentation Tests:</strong> The ./gradlew connectedAndroidTest command runs UI tests on connected devices or emulators (or integrates with Firebase Test Lab for cloud testing).</li><li><strong>Artifact Upload (Optional):</strong> Uploads test results which can be reviewed later.</li></ul><p>This CI configuration ensures that every code change is automatically validated against our test suite, helping maintain code quality and catching regressions early.</p><blockquote><strong>Conclusion</strong></blockquote><p>End-to-End testing and automatic CI/CD integration are crucial for delivering a robust, user-friendly app. Through our combined Espresso tests, we have simulated real user interactions — verifying that every layer of the QuotesApp, from UI components to backend logic, works in harmony. With integration into GitHub Actions, our tests run automatically on each commit, ensuring continuous quality and reducing flakiness in production.</p><p>Thank you for following our series on testing the QuotesApp. Stay tuned for more insights and advanced techniques, and happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0f09f35aa88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UI Testing with Espresso: Elevating the User Experience in QuotesApp]]></title>
            <link>https://medium.com/@maha21.kanagaraj/ui-testing-with-espresso-elevating-the-user-experience-in-quotesapp-80e1bc818933?source=rss-03c44a83e975------2</link>
            <guid isPermaLink="false">https://medium.com/p/80e1bc818933</guid>
            <category><![CDATA[android-test-automation]]></category>
            <category><![CDATA[ui-test-automation]]></category>
            <category><![CDATA[espresso]]></category>
            <category><![CDATA[ui-testing]]></category>
            <category><![CDATA[espresso-testing]]></category>
            <dc:creator><![CDATA[Maha Kanagaraj]]></dc:creator>
            <pubDate>Sun, 04 May 2025 05:58:37 GMT</pubDate>
            <atom:updated>2025-05-04T05:58:37.207Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*meoFFu2TD95XOzUmpCRvow.png" /></figure><p>Now that our backend logic is solid and our MVVM components integrate perfectly, it’s time to ensure that our users get the best experience possible. In this article, we’ll cover UI testing using Espresso. We’ll validate that our MainActivity launches correctly, that the Material Toolbar (with its centered title) and status bar display proper pastel colors, that our RecyclerView shows neatly laid-out quote cards (with their neumorphic-inspired design and global Courgette font), and that user interactions like swipes and clicks behave as expected.</p><blockquote>Project Directory Overview</blockquote><pre>QuotesApp/<br>└── app/<br>    ├── src/<br>    │   ├── main/<br>    │   │   ├── java/com/maha/quotesapp/<br>    │   │   │   ├── data/<br>    │   │   │   │   ├── model/<br>    │   │   │   │   │   └── Quote.kt<br>    │   │   │   │   └── repository/<br>    │   │   │   │       └── ContentRepository.kt<br>    │   │   │   ├── network/<br>    │   │   │   │   ├── RetrofitInstance.kt<br>    │   │   │   │   └── QuotesService.kt<br>    │   │   │   ├── ui/<br>    │   │   │   │   ├── MainActivity.kt<br>    │   │   │   │   ├── adapter/<br>    │   │   │   │   │   └── QuotesAdapter.kt<br>    │   │   │   │   └── viewmodel/<br>    │   │   │   │       └── ContentViewModel.kt<br>    │   │   └── res/<br>    │   │       ├── layout/<br>    │   │       │   ├── activity_main.xml<br>    │   │       │   ├── item_quote.xml<br>    │   │       │   └── neumorphic_bg.xml<br>    │   │       ├── values/<br>    │   │       │   ├── colors.xml<br>    │   │       │   └── styles.xml<br>    │   │       └── font/<br>    │   │           └── courgette_font.ttf<br>    ├── test/           # Unit tests<br>    └── androidTest/<br>        └── java/com/maha/quotesapp/ui/<br>            └── MainActivityUITest.kt</pre><p>The UI tests reside in the androidTest folder. We’ll be using Espresso along with the AndroidX test framework to simulate real user interaction on this layout.</p><h4>What Are We Testing?</h4><p>In our UI tests, we aim to verify three main aspects:</p><ol><li><strong>Launching MainActivity:</strong> Ensure that the Material Toolbar is displayed correctly with the centered title (“QuotesApp”) and that the status bar color matches our pastel primary color.</li><li><strong>RecyclerView Functionality:</strong> Confirm that the RecyclerView is visible; simulate scrolling to verify that our beautifully designed (neumorphic-inspired) quote cards render as expected.</li><li><strong>User Interactions:</strong> Replicate common user actions like clicks and swipes on a RecyclerView item to validate responsiveness and UI behavior.</li></ol><p>Below is our Espresso test file — MainActivityUITest.kt — with detailed comments explaining each step.</p><pre>// File: app/src/androidTest/java/com/maha/quotesapp/ui/MainActivityUITest.kt<br><br>package com.maha.quotesapp.ui<br><br>import androidx.test.core.app.ActivityScenario<br>import androidx.test.espresso.Espresso.onView<br>import androidx.test.espresso.action.ViewActions.click<br>import androidx.test.espresso.action.ViewActions.scrollTo<br>import androidx.test.espresso.contrib.RecyclerViewActions<br>import androidx.test.espresso.matcher.ViewMatchers.*<br>import androidx.test.ext.junit.rules.ActivityScenarioRule<br>import androidx.test.ext.junit.runners.AndroidJUnit4<br>import com.maha.quotesapp.R<br>import org.hamcrest.Matchers.allOf<br>import org.junit.Rule<br>import org.junit.Test<br>import org.junit.runner.RunWith<br><br>// Use the AndroidJUnit4 test runner<br>@RunWith(AndroidJUnit4::class)<br>class MainActivityUITest {<br><br>    // Launch MainActivity with activity rule for UI tests.<br>    @get:Rule<br>    val activityRule = ActivityScenarioRule(MainActivity::class.java)<br><br>    @Test<br>    fun checkToolbarAndStatusBar() {<br>        // Verify Material Toolbar: Check that the toolbar has the title &quot;QuotesApp&quot;<br>        onView(allOf(withParent(withId(R.id.topAppBar)), withText(&quot;QuotesApp&quot;)))<br>            .check(matches(isDisplayed()))<br>        <br>        // Note: To verify status bar color, we can obtain the activity instance and compare color values.<br>        // This task is more suited for integration tests using Robolectric.<br>        // Here, we assume that MainActivity sets the status bar color as part of its initialization.<br>    }<br><br>    @Test<br>    fun checkRecyclerViewIsDisplayedAndScrollable() {<br>        // Verify that the RecyclerView is displayed on screen<br>        onView(withId(R.id.rvQuotes))<br>            .check(matches(isDisplayed()))<br><br>        // Simulate scrolling to the first item in the RecyclerView<br>        onView(withId(R.id.rvQuotes))<br>            .perform(RecyclerViewActions.scrollToPosition(0))<br>    }<br><br>    @Test<br>    fun performUserInteractionOnRecyclerViewItem() {<br>        // Simulate a click on the first item of the RecyclerView<br>        // This action represents a typical user tapping on a quote card<br>        onView(withId(R.id.rvQuotes))<br>            .perform(<br>                RecyclerViewActions.actionOnItemAtPosition&lt;androidx.recyclerview.widget.RecyclerView.ViewHolder&gt;(0, click())<br>            )<br>        <br>        // Additional checks could include verifying that a new Activity or Dialog is displayed (if applicable)<br>        // For this demo, we simply simulate the click.<br>    }<br>}</pre><h4>Explaining the Test Code</h4><ul><li><strong>ActivityScenarioRule:</strong> This rule automatically launches MainActivity before each test, ensuring that the Activity is in the proper lifecycle state.</li><li><strong>Toolbar Verification:</strong> The onView with combined matchers (allOf and withParent) checks that a descendant within the top toolbar has the exact text &quot;QuotesApp&quot;. <em>Note: Checking the status bar color typically requires an integration test with Robolectric; here we focus on UI components visible on the screen.</em></li><li><strong>RecyclerView Tests:</strong> We first verify that the RecyclerView is displayed. Then, using RecyclerViewActions, we simulate scrolling to the first item in the list. This confirms that the layout is correctly populated and that the scrolling functionality is intact.</li><li><strong>User Interaction Simulation:</strong> The click action on the first item in the RecyclerView simulates a common user action. In a complete app, this might navigate to a detail screen or bring up additional information. For our test, it confirms that the user interaction is registered.</li></ul><h4>Conclusion</h4><p>UI testing with Espresso ensures that the user experience in QuotesApp is flawless — from the initial launch to everyday interactions. By automating tests for the Material Toolbar’s correctness, ensuring the RecyclerView functions smoothly, and simulating user interactions, we gain confidence that our app will perform as intended in the hands of users.</p><p>Stay tuned for the next article in our series, where we take on End-to-End Testing and CI/CD Integration to further automate and secure your app’s quality.</p><p>Happy testing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80e1bc818933" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integration Testing with Robolectric: Bringing Android Components Together]]></title>
            <link>https://medium.com/@maha21.kanagaraj/integration-testing-with-robolectric-bringing-android-components-together-37e3f96d5638?source=rss-03c44a83e975------2</link>
            <guid isPermaLink="false">https://medium.com/p/37e3f96d5638</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[integration-testing]]></category>
            <category><![CDATA[roboelectric]]></category>
            <category><![CDATA[android-testing]]></category>
            <category><![CDATA[mvvm]]></category>
            <dc:creator><![CDATA[Maha Kanagaraj]]></dc:creator>
            <pubDate>Mon, 21 Apr 2025 23:24:43 GMT</pubDate>
            <atom:updated>2025-04-21T23:24:43.880Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9BTCxEE0-h-sm4D67-fvw.png" /></figure><p>Integration testing is like a rehearsal before the big performance. It’s the stage where all Android components — our activities, view models, and repositories — come together to ensure that they work seamlessly as one.</p><h4>What Is Integration Testing?</h4><p>Integration testing focuses on verifying that different modules or layers of an application work in harmony. Unlike unit tests that isolate a single component, integration tests check that the interactions between components are correct. For our QuotesApp, we want to ensure that:</p><ul><li>The <strong>Repository</strong> correctly fetches data from the API (or a simulated API) even when run within an Android-like environment.</li><li>The <strong>ViewModel</strong> properly loads data from the Repository and propagates that data via LiveData to the UI.</li></ul><p>By simulating the Android runtime, integration tests provide confidence that your app’s core logic — and its interaction with the framework — is rock solid.</p><h4>Why Integration Testing with Robolectric?</h4><p>While unit tests verify the behavior of isolated components, integration tests check if the components work well together in an environment similar to a real device. Robolectric is a powerful tool because it:</p><p><strong>Simulates the Android Runtime:</strong> Run your Android code on the JVM without needing an emulator.</p><p><strong>Speeds Up Testing:</strong> Execute tests faster compared to running on device or emulator.</p><p><strong>Bridges Gaps:</strong> Allows you to test how your Repository and ViewModel handle Android framework dependencies and lifecycles.</p><p>Let’s see this in action!</p><h4>Testing Our MVVM Components in an Android Environment</h4><p>For integration testing, we usually want to run parts of our real code (like our ViewModel logic) in an environment that mimics the behavior of Android. For example:</p><ul><li><strong>Repository:</strong> Instead of using a completely mocked service, we can provide a dummy implementation that returns controlled data.</li><li><strong>ViewModel:</strong> We verify that the LiveData it exposes is updated correctly when the Repository returns data.</li></ul><p>This not only tests our business logic but also how it integrates with Android’s threading and lifecycle mechanisms.</p><pre>QuotesApp/<br>└── app/<br>    ├── src/<br>    │   ├── main/<br>    │   │   ├── java/com/maha/quotesapp/<br>    │   │   │   ├── data/<br>    │   │   │   │   ├── model/<br>    │   │   │   │   │   └── Quote.kt<br>    │   │   │   │   └── repository/<br>    │   │   │   │       └── ContentRepository.kt<br>    │   │   │   ├── network/<br>    │   │   │   │   ├── RetrofitInstance.kt<br>    │   │   │   │   └── QuotesService.kt<br>    │   │   │   ├── ui/<br>    │   │   │   │   ├── MainActivity.kt<br>    │   │   │   │   ├── adapter/<br>    │   │   │   │   │   └── QuotesAdapter.kt<br>    │   │   │   │   └── viewmodel/<br>    │   │   │   │       └── ContentViewModel.kt<br>    │   │   └── res/<br>    │   │       ├── layout/<br>    │   │       │   ├── activity_main.xml<br>    │   │       │   ├── item_quote.xml<br>    │   │       │   └── neumorphic_bg.xml<br>    │   │       ├── values/<br>    │   │       │   ├── colors.xml<br>    │   │       │   └── styles.xml<br>    │   │       └── font/<br>    │   │           └── courgette_font.ttf<br>    ├── test/<br>    │   ├── java/com/maha/quotesapp/<br>    │   │   ├── ui/<br>    │   │   │   ├── MainActivityIntegrationTest.kt<br>    │   │   │   └── viewmodel/<br>    │   │   │       └── ContentViewModelIntegrationTest.kt<br>    └── androidTest/</pre><h4>Integration Test Code Examples</h4><p>Below are two integration test examples: one for testing the MainActivity’s UI elements and another for testing the ViewModel’s LiveData updates using a dummy repository.</p><h4>Testing MainActivity with Robolectric</h4><p>This test ensures that our MainActivity sets up the toolbar correctly and that the status bar color matches our theme. <em>File:</em>MainActivityIntegrationTest.kt</p><pre>package com.maha.quotesapp.ui<br><br>import androidx.appcompat.widget.Toolbar<br>import com.maha.quotesapp.R<br>import org.junit.Assert.assertEquals<br>import org.junit.Test<br>import org.robolectric.Robolectric<br>import org.robolectric.annotation.Config<br>import org.robolectric.RobolectricTestRunner<br>import org.junit.runner.RunWith<br><br>// Use RobolectricTestRunner to simulate Android runtime on the JVM<br>@RunWith(RobolectricTestRunner::class)<br>@Config(sdk = [28])<br>class MainActivityIntegrationTest {<br><br>    @Test<br>    fun testToolbarTitleAndStatusBar() {<br>        // Launch the MainActivity using Robolectric<br>        val activity = Robolectric.buildActivity(MainActivity::class.java)<br>            .setup()    // Simulates onCreate() &amp; lifecycle events<br>            .get()<br><br>        // Retrieve the toolbar from the activity&#39;s layout<br>        val toolbar = activity.findViewById&lt;Toolbar&gt;(R.id.topAppBar)<br>        <br>        // Check if the toolbar title is correctly set<br>        assertEquals(&quot;QuotesApp&quot;, toolbar.title)<br>        <br>        // Retrieve the expected pastel primary color from resources<br>        val expectedStatusBarColor = activity.resources.getColor(R.color.pastel_primary)<br>        <br>        // Verify the status bar color matches the expected color<br>        // (Assumed to be set in MainActivity)<br>        assertEquals(expectedStatusBarColor, activity.window.statusBarColor)<br>    }<br>}</pre><h4>Testing the ViewModel with a Dummy Repository</h4><p>In this test, we simulate data fetching using a dummy implementation of the QuotesService and ensure the ViewModel updates its LiveData accordingly. <em>File: </em>ContentViewModelIntegrationTest.kt</p><pre>package com.maha.quotesapp.ui.viewmodel<br><br>import androidx.arch.core.executor.testing.InstantTaskExecutorRule<br>import com.maha.quotesapp.data.model.Quote<br>import com.maha.quotesapp.data.repository.ContentRepository<br>import com.maha.quotesapp.network.QuotesService<br>import kotlinx.coroutines.test.runTest<br>import org.junit.Assert.assertEquals<br>import org.junit.Rule<br>import org.junit.Test<br>import org.robolectric.RobolectricTestRunner<br>import org.robolectric.annotation.Config<br>import org.junit.runner.RunWith<br><br>// Use RobolectricTestRunner to incorporate Android components for integration testing<br>@RunWith(RobolectricTestRunner::class)<br>@Config(sdk = [28])<br>class ContentViewModelIntegrationTest {<br><br>    // This rule makes LiveData execute each task synchronously<br>    @get:Rule<br>    val instantExecutorRule = InstantTaskExecutorRule()<br><br>    // Dummy implementation of QuotesService to simulate API behavior:<br>    private val dummyQuotesService = object : QuotesService {<br>        override suspend fun getQuotes(): List&lt;Quote&gt; = emptyList()<br>        override suspend fun getMultipleRandomQuotes(count: Int): List&lt;Quote&gt; =<br>            listOf(Quote(&quot;Integration Test Quote&quot;, &quot;Test Author&quot;))<br>        override suspend fun getQuoteByLength(minLength: Int, maxLength: Int, count: Int): List&lt;Quote&gt; = emptyList()<br>        override suspend fun getQuoteByAuthor(author: String): List&lt;Quote&gt; = emptyList()<br>        override suspend fun getQuoteByTag(tags: String): List&lt;Quote&gt; = emptyList()<br>    }<br><br>    // Create a repository with the dummy service<br>    private val repository = ContentRepository(dummyQuotesService)<br><br>    // Create an instance of our ViewModel using the dummy repository<br>    private val viewModel = ContentViewModel(repository)<br><br>    @Test<br>    fun integrationTest_loadQuotesUpdatesLiveData() = runTest {<br>        // Act: Trigger the ViewModel method to load quotes<br>        viewModel.loadQuotes()<br><br>        // Access the LiveData value and assert that it contains the dummy quote<br>        val quotes = viewModel.quotes.value ?: emptyList()<br>        // Check that exactly one quote is returned<br>        assertEquals(1, quotes.size)<br>        // Verify that the quote text matches the expected output<br>        assertEquals(&quot;Integration Test Quote&quot;, quotes[0].quote)<br>        // Verify that the author matches the expected output<br>        assertEquals(&quot;Test Author&quot;, quotes[0].author)<br>    }<br>}</pre><p>Integration testing with Robolectric is a powerful approach to ensure that your Android app’s components work together — without needing to run on a physical device or emulator. In our QuotesApp, these tests validate:</p><ul><li>The proper setup of UI components in MainActivity.</li><li>The seamless integration of the Repository and ViewModel, ensuring that LiveData updates occur as expected.</li></ul><p>By simulating the Android runtime on the JVM, we can catch integration issues early and build more reliable, maintainable applications.</p><p>Stay tuned for our next article, where we explore <strong>UI testing with Espresso</strong>, automating user interactions to verify that every visual element in your app works flawlessly.</p><p>Happy testing, and keep coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37e3f96d5638" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Unit Testing in MVVM: Repository and ViewModel]]></title>
            <link>https://medium.com/@maha21.kanagaraj/mastering-unit-testing-in-mvvm-repository-and-viewmodel-ad486f741abb?source=rss-03c44a83e975------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad486f741abb</guid>
            <category><![CDATA[android-testing]]></category>
            <category><![CDATA[mockk]]></category>
            <category><![CDATA[mockito]]></category>
            <category><![CDATA[junit-5]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Maha Kanagaraj]]></dc:creator>
            <pubDate>Mon, 14 Apr 2025 06:52:25 GMT</pubDate>
            <atom:updated>2025-04-14T06:54:42.556Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to the <strong>QuotesApp</strong> testing series! In this article, we’ll dive into the art of unit testing the Repository and ViewModel components of our MVVM architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uFRnxr-3tljt6UDaDInm3g.png" /></figure><p>Unit testing is like giving your app a health check — it ensures that each component is working perfectly on its own. In the <strong>QuotesApp</strong>, Unit testing is the process of verifying individual components of your app to ensure they behave as expected in isolation. By detecting issues early, unit testing makes debugging easier, reduces bugs, and ensures that your app is robust and reliable.</p><blockquote><strong>Why Unit Testing Matters</strong></blockquote><p>Imagine your Repository is fetching quotes from an API. What happens if the API fails? Or if the data returned is empty? Unit testing lets you simulate these scenarios and verify that your Repository handles them gracefully. Similarly, the ViewModel processes data and exposes it to the UI via LiveData. Unit testing ensures that the ViewModel reacts correctly to changes and updates the UI seamlessly.</p><blockquote><strong>Tools of the Trade</strong></blockquote><p>To write effective unit tests, we’ll use:</p><ul><li><strong>JUnit:</strong> For writing test cases and assertions.</li><li><strong>MockK:</strong> A Kotlin-friendly mocking library to simulate dependencies.</li><li><strong>kotlinx-coroutines-test:</strong> For testing asynchronous code.</li></ul><blockquote><strong>Project Directory Structure</strong></blockquote><p>Here’s how the QuotesApp is organized:</p><pre>QuotesApp/<br>└── app/<br>    ├── src/<br>    │   ├── main/<br>    │   │   ├── java/com/maha/quotesapp/<br>    │   │   │   ├── data/<br>    │   │   │   │   ├── model/<br>    │   │   │   │   │   └── Quote.kt<br>    │   │   │   │   └── repository/<br>    │   │   │   │       └── ContentRepository.kt<br>    │   │   │   ├── network/<br>    │   │   │   │   ├── RetrofitInstance.kt<br>    │   │   │   │   └── QuotesService.kt<br>    │   │   │   ├── ui/<br>    │   │   │   │   ├── MainActivity.kt<br>    │   │   │   │   ├── adapter/<br>    │   │   │   │   │   └── QuotesAdapter.kt<br>    │   │   │   │   └── viewmodel/<br>    │   │   │   │       └── ContentViewModel.kt<br>    │   │   └── res/<br>    │   │       ├── layout/<br>    │   │       │   ├── activity_main.xml<br>    │   │       │   ├── item_quote.xml<br>    │   │       │   └── neumorphic_bg.xml<br>    │   │       ├── values/<br>    │   │       │   ├── colors.xml<br>    │   │       │   └── styles.xml<br>    │   │       └── font/<br>    │   │           └── courgette_font.ttf<br>    ├── test/<br>    │   ├── java/com/maha/quotesapp/<br>    │   │   ├── repository/<br>    │   │   │   └── ContentRepositoryTest.kt<br>    │   │   └── viewmodel/<br>    │   │       └── ContentViewModelTest.kt<br>    └── androidTest/</pre><h4>Setting Up Your Test Environment</h4><blockquote>Adding Dependencies</blockquote><p>To enable unit testing, make sure your module’s build.gradle file includes the required dependencies:</p><pre>dependencies {<br>    // JUnit for test cases<br>    testImplementation &#39;junit:junit:4.13.2&#39;<br><br>    // Mocking libraries<br>    testImplementation &#39;org.mockito:mockito-core:4.11.0&#39;<br>    testImplementation &#39;io.mockk:mockk:1.13.3&#39;<br><br>    // Kotlin coroutines test utilities<br>    testImplementation &quot;org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4&quot;<br>}</pre><blockquote><strong>Testing the Repository</strong></blockquote><p>The Repository is responsible for fetching data from the API. Let’s test its fetchQuotes() method.</p><p><strong>Code Example: ContentRepository</strong></p><pre>package com.maha.quotesapp.data.repository<br><br>import com.maha.quotesapp.data.model.Quote<br>import com.maha.quotesapp.network.QuotesService<br>class ContentRepository(private val quotesService: QuotesService) {<br>    // Fetches a list of quotes from the API<br>    suspend fun fetchQuotes(): List&lt;Quote&gt; {<br>        return try {<br>            // Call the API to fetch 20 random quotes<br>            quotesService.getMultipleRandomQuotes(20)<br>        } catch (e: Exception) {<br>            // If an exception occurs (e.g., network error), return an empty list<br>            emptyList()<br>        }<br>    }</pre><p><strong>Test Example: ContentRepositoryTest</strong></p><pre>package com.maha.quotesapp.repository<br><br>import com.maha.quotesapp.data.repository.ContentRepository<br>import com.maha.quotesapp.data.model.Quote<br>import com.maha.quotesapp.network.QuotesService<br>import io.mockk.coEvery<br>import io.mockk.mockk<br>import kotlinx.coroutines.test.runTest<br>import org.junit.Assert.assertEquals<br>import org.junit.Assert.assertTrue<br>import org.junit.Test<br><br>class ContentRepositoryTest {<br><br>    // Mocked QuotesService for simulating API behavior<br>    private val mockQuotesService = mockk&lt;QuotesService&gt;()<br><br>    // Repository instance using the mocked service<br>    private val repository = ContentRepository(mockQuotesService)<br><br>    @Test<br>    fun `fetchQuotes returns quotes when service succeeds`() = runTest {<br>        // Arrange: Mock the API response to return a list of quotes<br>        val mockQuotes = listOf(<br>            Quote(&quot;Quote 1&quot;, &quot;Author 1&quot;),<br>            Quote(&quot;Quote 2&quot;, &quot;Author 2&quot;)<br>        )<br>        // Simulate a successful API call<br>        coEvery { mockQuotesService.getMultipleRandomQuotes(20) } returns mockQuotes<br><br>        // Act: Call the fetchQuotes() method<br>        val result = repository.fetchQuotes()<br><br>        // Assert: Verify that the returned list matches the mock response<br>        assertEquals(mockQuotes, result)<br>    }<br><br>    @Test<br>    fun `fetchQuotes returns empty list when service fails`() = runTest {<br>        // Arrange: Simulate an API failure by throwing an exception<br>        coEvery { mockQuotesService.getMultipleRandomQuotes(20) } throws Exception(&quot;Network error&quot;)<br><br>        // Act: Call the fetchQuotes() method<br>        val result = repository.fetchQuotes()<br><br>        // Assert: Verify that the result is an empty list<br>        assertTrue(result.isEmpty())<br>    }<br>}</pre><blockquote><strong>Testing the ViewModel</strong></blockquote><p>The ViewModel processes data from the Repository and exposes it via LiveData. Let’s test its loadQuotes() method.</p><p><strong>Code Example: ContentViewModel</strong></p><pre>package com.maha.quotesapp.ui.viewmodel<br><br>import androidx.lifecycle.*<br>import com.maha.quotesapp.data.model.Quote<br>import com.maha.quotesapp.data.repository.ContentRepository<br>import kotlinx.coroutines.launch<br><br>class ContentViewModel(private val repository: ContentRepository) : ViewModel() {<br><br>    // Private LiveData to hold the list of quotes<br>    private val _quotes = MutableLiveData&lt;List&lt;Quote&gt;&gt;()<br><br>    // Public LiveData for exposing the data to the UI<br>    val quotes: LiveData&lt;List&lt;Quote&gt;&gt; = _quotes<br><br>    // Loads quotes from the repository and updates the LiveData<br>    fun loadQuotes() {<br>        // Launch a coroutine in the ViewModel&#39;s scope<br>        viewModelScope.launch {<br>            // Fetch quotes and post the result to LiveData<br>            _quotes.value = repository.fetchQuotes()<br>        }<br>    }<br>}</pre><p><strong>Test Example: ContentViewModelTest</strong></p><pre>package com.maha.quotesapp.viewmodel<br><br>import androidx.arch.core.executor.testing.InstantTaskExecutorRule<br>import com.maha.quotesapp.data.repository.ContentRepository<br>import com.maha.quotesapp.data.model.Quote<br>import com.maha.quotesapp.ui.viewmodel.ContentViewModel<br>import io.mockk.coEvery<br>import io.mockk.mockk<br>import kotlinx.coroutines.test.runTest<br>import org.junit.Assert.assertEquals<br>import org.junit.Rule<br>import org.junit.Test<br><br>class ContentViewModelTest {<br><br>    // Ensures LiveData changes are tested synchronously<br>    @get:Rule<br>    val instantExecutorRule = InstantTaskExecutorRule()<br><br>    // Mocked Repository for simulating data fetching behavior<br>    private val mockRepository = mockk&lt;ContentRepository&gt;()<br><br>    // ViewModel instance using the mocked Repository<br>    private val viewModel = ContentViewModel(mockRepository)<br><br>    @Test<br>    fun `loadQuotes updates LiveData when repository succeeds`() = runTest {<br>        // Arrange: Mock the repository to return a list of quotes<br>        val mockQuotes = listOf(<br>            Quote(&quot;Quote 1&quot;, &quot;Author 1&quot;),<br>            Quote(&quot;Quote 2&quot;, &quot;Author 2&quot;)<br>        )<br>        // Simulate a successful fetch<br>        coEvery { mockRepository.fetchQuotes() } returns mockQuotes<br><br>        // Act: Call the loadQuotes() method<br>        viewModel.loadQuotes()<br><br>        // Assert: Verify that the LiveData value matches the mock response<br>        assertEquals(mockQuotes, viewModel.quotes.value)<br>    }<br><br>    @Test<br>    fun `loadQuotes sets empty LiveData when repository fails`() = runTest {<br>        // Arrange: Simulate a failure in the repository<br>        coEvery { mockRepository.fetchQuotes() } throws Exception(&quot;Network error&quot;)<br><br>        // Act: Call the loadQuotes() method<br>        viewModel.loadQuotes()<br><br>        // Assert: Verify that the LiveData value is empty<br>        assertEquals(emptyList&lt;Quote&gt;(), viewModel.quotes.value)<br>    }<br>}</pre><blockquote><strong>Explanation of the Tests</strong></blockquote><ol><li><strong>Mocking Dependencies:</strong> We use MockK to simulate the behavior of external dependencies (e.g., QuotesService, ContentRepository). This ensures that tests are isolated and focused on the component being tested.</li><li><strong>Coroutine Testing:</strong> The runTest function from kotlinx-coroutines-test allows us to execute coroutine-based code in a controlled environment, making it easier to test asynchronous functions.</li><li><strong>LiveData Testing:</strong> The InstantTaskExecutorRule ensures that LiveData updates happen synchronously, allowing us to assert changes in real-time.</li><li><strong>Assertions:</strong> We use assertEquals to compare the actual and expected results, and assertTrue to validate specific conditions (e.g., an empty list).</li></ol><blockquote><strong>Best Practices for Unit Testing</strong></blockquote><ol><li><strong>Test in Isolation:</strong> Mock dependencies to isolate the component being tested.</li><li><strong>Cover Edge Cases:</strong> Test scenarios like empty responses, errors, and unusual data.</li><li><strong>Use Descriptive Names:</strong> Name tests clearly, e.g., fetchQuotes returns quotes when service succeeds.</li><li><strong>Run Tests Frequently:</strong> Integrate tests into your development workflow</li></ol><p>Stay tuned for the next article in the series, where we’ll dive into <strong>Integration Testing with Robolectric</strong>, simulating the Android runtime to test component interactions.</p><p>Happy testing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad486f741abb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building QuotesApp with MVVM:]]></title>
            <link>https://medium.com/@maha21.kanagaraj/building-quotesapp-with-mvvm-8ae9116c4b16?source=rss-03c44a83e975------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ae9116c4b16</guid>
            <category><![CDATA[real-world-example]]></category>
            <category><![CDATA[mvvm-databinding]]></category>
            <category><![CDATA[mvvm-architecture]]></category>
            <category><![CDATA[android-testing]]></category>
            <category><![CDATA[android-test-automation]]></category>
            <dc:creator><![CDATA[Maha Kanagaraj]]></dc:creator>
            <pubDate>Mon, 14 Apr 2025 06:18:10 GMT</pubDate>
            <atom:updated>2025-04-14T06:19:46.250Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we’ll walk you through the project structure, present every class and XML layout (including a custom Material Toolbar with a centered title, pastel colors, and neumorphic-inspired MaterialCardViews), and provide the Gradle configuration required to build the app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1z_Gb2yJcBX-y4PRceT6Hw.png" /></figure><h4>Project Overview</h4><p>The <strong>QuotesApp</strong> fetches motivational quotes from a remote API (hosted at https://quoteslate.vercel.app/) and displays them using a modern, visually appealing interface. Our architecture is divided into four layers:</p><ul><li><strong>Model:</strong> Represents our data — a simple Quote object.</li><li><strong>Repository:</strong> Handles all data retrieval operations from our remote API.</li><li><strong>ViewModel:</strong> Exposes the data to the UI using LiveData.</li><li><strong>View:</strong> Comprises our UI components (an Activity, RecyclerView, etc.), which are styled with Material Components and custom designs.</li></ul><h4>Project Structure</h4><p>Below is an example of the project structure for the <strong>QuotesApp</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WWGZQxL5p6LWxVVKJronCg.png" /></figure><h4>Gradle Configuration</h4><p>Below is an example of the module-level build.gradle file for <strong>QuotesApp</strong>. This file configures the Android build, enables Data Binding, and adds dependencies for Retrofit, Gson, Material Components, Lifecycle libraries (ViewModel, LiveData), RecyclerView, custom fonts, and testing libraries (JUnit, Robolectric, Espresso).</p><pre>apply plugin: &#39;com.android.application&#39;<br>apply plugin: &#39;kotlin-android&#39;<br>apply plugin: &#39;kotlin-kapt&#39;<br><br>android {<br>    compileSdkVersion 33<br><br>    defaultConfig {<br>        applicationId &quot;com.maha.quotesapp&quot;<br>        minSdkVersion 21<br>        targetSdkVersion 33<br>        versionCode 1<br>        versionName &quot;1.0&quot;<br><br>        testInstrumentationRunner &quot;androidx.test.runner.AndroidJUnitRunner&quot;<br>    }<br><br>    buildFeatures {<br>        dataBinding true<br>    }<br><br>    compileOptions {<br>        sourceCompatibility JavaVersion.VERSION_1_8<br>        targetCompatibility JavaVersion.VERSION_1_8<br>    }<br><br>    kotlinOptions {<br>        jvmTarget = &quot;1.8&quot;<br>    }<br>}<br><br>dependencies {<br>    // Kotlin standard library<br>    implementation &quot;org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version&quot;<br><br>    // AndroidX core libraries<br>    implementation &#39;androidx.core:core-ktx:1.9.0&#39;<br>    implementation &#39;androidx.appcompat:appcompat:1.6.1&#39;<br>    implementation &#39;com.google.android.material:material:1.8.0&#39;<br>    implementation &#39;androidx.constraintlayout:constraintlayout:2.1.4&#39;<br>    <br>    // Retrofit and Gson for network calls<br>    implementation &#39;com.squareup.retrofit2:retrofit:2.9.0&#39;<br>    implementation &#39;com.squareup.retrofit2:converter-gson:2.9.0&#39;<br>    <br>    // OkHttp for HTTP client<br>    implementation &#39;com.squareup.okhttp3:okhttp:4.10.0&#39;<br><br>    // Lifecycle components for MVVM<br>    implementation &quot;androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1&quot;<br>    implementation &quot;androidx.lifecycle:lifecycle-livedata-ktx:2.5.1&quot;<br>    <br>    // RecyclerView library<br>    implementation &#39;androidx.recyclerview:recyclerview:1.3.0&#39;<br><br>    // Unit Testing<br>    testImplementation &#39;junit:junit:4.13.2&#39;<br>    testImplementation &quot;org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4&quot;<br>    testImplementation &quot;org.robolectric:robolectric:4.9&quot;<br><br>    // Instrumented UI testing with Espresso<br>    androidTestImplementation &#39;androidx.test.ext:junit:1.1.5&#39;<br>    androidTestImplementation &#39;androidx.test.espresso:espresso-core:3.5.1&#39;<br>}</pre><p>Ensure that the $kotlin_version variable is set in your project-level build.gradle file.</p><h4>Code Walkthrough</h4><h4>Model:</h4><blockquote>Quote.kt</blockquote><pre>package com.maha.quotesapp.data.model<br><br>data class Quote(<br>    val quote: String,<br>    val author: String<br>)</pre><p>This simple data class represents a single motivational quote.</p><h4>Network Layer</h4><blockquote>RetrofitInstance.kt</blockquote><pre>package com.maha.quotesapp.network<br><br>import com.maha.quotesapp.data.repository.QuotesService<br>import okhttp3.OkHttpClient<br>import retrofit2.Retrofit<br>import retrofit2.converter.gson.GsonConverterFactory<br><br>object RetrofitInstance {<br>    private const val QUOTES_BASE_URL = &quot;https://quoteslate.vercel.app/&quot;<br>    <br>    private val okHttpClient = OkHttpClient.Builder().build()<br><br>    private val quotesRetrofit: Retrofit by lazy {<br>        Retrofit.Builder()<br>            .client(okHttpClient)<br>            .baseUrl(QUOTES_BASE_URL)<br>            .addConverterFactory(GsonConverterFactory.create())<br>            .build()<br>    }<br><br>    val quotesService: QuotesService by lazy {<br>        quotesRetrofit.create(QuotesService::class.java)<br>    }<br>}</pre><p>This singleton configures Retrofit with the base URL, an OkHttp client, and a Gson converter, exposing a QuotesService instance.</p><blockquote>QuotesService.kt</blockquote><pre>package com.maha.quotesapp.network<br><br>import com.maha.quotesapp.data.model.Quote<br>import retrofit2.http.GET<br>import retrofit2.http.Query<br><br>interface QuotesService {<br>    @GET(&quot;api/quotes/random&quot;)<br>    suspend fun getQuotes(): List&lt;Quote&gt;<br><br>    @GET(&quot;/api/quotes/random&quot;)<br>    suspend fun getMultipleRandomQuotes(@Query(&quot;count&quot;) count: Int): List&lt;Quote&gt;<br><br>    @GET(&quot;/api/quotes/random&quot;)<br>    suspend fun getQuoteByLength(<br>        @Query(&quot;minLength&quot;) minLength: Int,<br>        @Query(&quot;maxLength&quot;) maxLength: Int,<br>        @Query(&quot;count&quot;) count: Int<br>    ): List&lt;Quote&gt;<br><br>    @GET(&quot;/api/quotes/random&quot;)<br>    suspend fun getQuoteByAuthor(@Query(&quot;author&quot;) author: String): List&lt;Quote&gt;<br><br>    @GET(&quot;/api/quotes/random&quot;)<br>    suspend fun getQuoteByTag(@Query(&quot;tags&quot;) tags: String): List&lt;Quote&gt;<br>}</pre><p>This interface defines our API endpoints and corresponding query parameters.</p><h4>Repository:</h4><blockquote>ContentRepository.kt</blockquote><pre>package com.maha.quotesapp.data.repository<br><br>import com.maha.quotesapp.data.model.Quote<br>import com.maha.quotesapp.network.QuotesService<br><br>class ContentRepository(private val quotesService: QuotesService) {<br>    suspend fun fetchQuotes(): List&lt;Quote&gt; {<br>        return try {<br>            quotesService.getMultipleRandomQuotes(20)<br>        } catch (e: Exception) {<br>            emptyList()<br>        }<br>    }<br>}</pre><p>The repository abstracts data retrieval and error handling from the API.</p><h4>ViewModel:</h4><blockquote>ContentViewModel.kt</blockquote><pre>package com.maha.quotesapp.ui.viewmodel<br><br>import androidx.lifecycle.*<br>import com.maha.quotesapp.data.model.Quote<br>import com.maha.quotesapp.data.repository.ContentRepository<br>import kotlinx.coroutines.launch<br><br>class ContentViewModel(private val repository: ContentRepository) : ViewModel() {<br><br>    private val _quotes = MutableLiveData&lt;List&lt;Quote&gt;&gt;()<br>    val quotes: LiveData&lt;List&lt;Quote&gt;&gt; = _quotes<br><br>    private val _loading = MutableLiveData&lt;Boolean&gt;()<br>    val loading: LiveData&lt;Boolean&gt; = _loading<br><br>    private val _error = MutableLiveData&lt;String?&gt;()<br>    val error: LiveData&lt;String?&gt; = _error<br><br>    fun loadQuotes() {<br>        viewModelScope.launch {<br>            _loading.value = true<br>            try {<br>                _quotes.value = repository.fetchQuotes()<br>            } catch (e: Exception) {<br>                _error.value = e.localizedMessage<br>            } finally {<br>                _loading.value = false<br>            }<br>        }<br>    }<br>}</pre><p>This ViewModel fetches quotes from the repository and exposes them using LiveData.</p><h4>UI Components</h4><h4>MainActivity</h4><pre>package com.maha.quotesapp.ui<br><br>import android.os.Bundle<br>import androidx.appcompat.app.AppCompatActivity<br>import androidx.core.content.ContextCompat<br>import androidx.databinding.DataBindingUtil<br>import androidx.lifecycle.ViewModelProvider<br>import androidx.recyclerview.widget.LinearLayoutManager<br>import com.maha.quotesapp.R<br>import com.maha.quotesapp.data.repository.ContentRepository<br>import com.maha.quotesapp.databinding.ActivityMainBinding<br>import com.maha.quotesapp.network.QuotesService<br>import com.maha.quotesapp.network.RetrofitInstance<br>import com.maha.quotesapp.ui.adapter.QuotesAdapter<br>import com.maha.quotesapp.ui.viewmodel.ContentViewModel<br><br>class MainActivity : AppCompatActivity() {<br><br>    private lateinit var binding: ActivityMainBinding<br>    private lateinit var viewModel: ContentViewModel<br>    private lateinit var quotesAdapter: QuotesAdapter<br><br>    override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)<br>        <br>        // Inflate layout using Data Binding.<br>        binding = DataBindingUtil.setContentView(this, R.layout.activity_main)<br>        <br>        // Set up Material Toolbar (with centered title using app:titleCentered=&quot;true&quot; in XML)<br>        setSupportActionBar(binding.topAppBar)<br>        <br>        // Set status bar color to match pastel primary (courtesy of our pastel theme)<br>        window.statusBarColor = ContextCompat.getColor(this, R.color.pastel_primary)<br>        <br>        // Setup RecyclerView.<br>        quotesAdapter = QuotesAdapter()<br>        binding.rvQuotes.apply {<br>            layoutManager = LinearLayoutManager(this@MainActivity)<br>            adapter = quotesAdapter<br>        }<br>        <br>        // Use the real QuotesService instance from RetrofitInstance.<br>        val quotesService: QuotesService = RetrofitInstance.quotesService<br>        val repository = ContentRepository(quotesService)<br>        <br>        // Initialize the ViewModel.<br>        viewModel = ViewModelProvider(this, object : ViewModelProvider.Factory {<br>            @Suppress(&quot;UNCHECKED_CAST&quot;)<br>            override fun &lt;T : androidx.lifecycle.ViewModel&gt; create(modelClass: Class&lt;T&gt;): T {<br>                return ContentViewModel(repository) as T<br>            }<br>        }).get(ContentViewModel::class.java)<br>        <br>        // Observe LiveData and update UI.<br>        viewModel.quotes.observe(this) { quotes -&gt;<br>            quotesAdapter.updateData(quotes)<br>        }<br>        <br>        // Trigger loading of quotes.<br>        viewModel.loadQuotes()<br>    }<br>}</pre><p>MainActivity sets the custom Material Toolbar (with a centered title), updates the status bar color to match, and binds data via the ViewModel.</p><h4>QuotesAdapter</h4><pre>package com.maha.quotesapp.ui.adapter<br><br>import android.view.LayoutInflater<br>import android.view.ViewGroup<br>import androidx.recyclerview.widget.RecyclerView<br>import com.maha.quotesapp.data.model.Quote<br>import com.maha.quotesapp.databinding.ItemQuoteBinding<br><br>class QuotesAdapter(<br>    private var items: List&lt;Quote&gt; = emptyList()<br>) : RecyclerView.Adapter&lt;QuotesAdapter.QuoteViewHolder&gt;() {<br><br>    inner class QuoteViewHolder(private val binding: ItemQuoteBinding) :<br>        RecyclerView.ViewHolder(binding.root) {<br>        fun bind(item: Quote) {<br>            binding.tvQuote.text = item.quote<br>            binding.tvAuthor.text = item.author<br>        }<br>    }<br><br>    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QuoteViewHolder {<br>        val binding = ItemQuoteBinding.inflate(<br>            LayoutInflater.from(parent.context),<br>            parent,<br>            false<br>        )<br>        return QuoteViewHolder(binding)<br>    }<br><br>    override fun onBindViewHolder(holder: QuoteViewHolder, position: Int) {<br>        holder.bind(items[position])<br>    }<br><br>    override fun getItemCount(): Int = items.size<br><br>    fun updateData(newItems: List&lt;Quote&gt;) {<br>        items = newItems<br>        notifyDataSetChanged()<br>    }<br>}</pre><p>The adapter binds each Quote to its view using our custom layout.</p><h4>Layouts</h4><blockquote>activity_main.xml</blockquote><p>This layout features a Material Toolbar with a centered title and a CoordinatorLayout to enable scrolling.</p><pre>&lt;layout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;&gt;<br>    &lt;data&gt;<br>        &lt;!-- No bound variables for this layout --&gt;<br>    &lt;/data&gt;<br>    &lt;androidx.coordinatorlayout.widget.CoordinatorLayout<br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;match_parent&quot;&gt;<br>        <br>        &lt;!-- Custom Material Toolbar with centered title --&gt;<br>        &lt;com.google.android.material.appbar.MaterialToolbar<br>            android:id=&quot;@+id/topAppBar&quot;<br>            android:layout_width=&quot;match_parent&quot;<br>            android:layout_height=&quot;?attr/actionBarSize&quot;<br>            android:background=&quot;?attr/colorPrimary&quot;<br>            android:elevation=&quot;4dp&quot;<br>            app:title=&quot;QuotesApp&quot;<br>            app:titleCentered=&quot;true&quot;<br>            app:titleTextColor=&quot;@android:color/white&quot;<br>            app:theme=&quot;@style/Widget.Toolbar.Pastel&quot;<br>            app:popupTheme=&quot;@style/ThemeOverlay.MaterialComponents.Light&quot;<br>            app:navigationIcon=&quot;@drawable/ic_menu&quot; /&gt;<br>        <br>        &lt;!-- RecyclerView to display the list of quotes --&gt;<br>        &lt;androidx.recyclerview.widget.RecyclerView<br>            android:id=&quot;@+id/rvQuotes&quot;<br>            android:layout_width=&quot;match_parent&quot;<br>            android:layout_height=&quot;match_parent&quot;<br>            android:layout_margin=&quot;16dp&quot;<br>            app:layout_behavior=&quot;@string/appbar_scrolling_view_behavior&quot;<br>            android:paddingTop=&quot;?attr/actionBarSize&quot; /&gt;<br>    &lt;/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;<br>&lt;/layout&gt;</pre><blockquote>item_quote.xml</blockquote><pre>&lt;layout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;&gt;<br>    &lt;data&gt;<br>        &lt;!-- Optionally bind a Quote object here --&gt;<br>    &lt;/data&gt;<br>    &lt;com.google.android.material.card.MaterialCardView<br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;wrap_content&quot;<br>        android:layout_margin=&quot;16dp&quot;<br>        app:cardCornerRadius=&quot;20dp&quot;<br>        app:cardElevation=&quot;12dp&quot;<br>        android:background=&quot;@drawable/neumorphic_bg&quot;<br>        app:strokeWidth=&quot;0dp&quot;&gt;<br>        <br>        &lt;LinearLayout<br>            android:layout_width=&quot;match_parent&quot;<br>            android:layout_height=&quot;wrap_content&quot;<br>            android:background=&quot;@color/white&quot;<br>            android:orientation=&quot;vertical&quot;<br>            android:padding=&quot;24dp&quot;&gt;<br>            <br>            &lt;TextView<br>                android:id=&quot;@+id/tvQuote&quot;<br>                android:layout_width=&quot;match_parent&quot;<br>                android:layout_height=&quot;wrap_content&quot;<br>                android:paddingBottom=&quot;16dp&quot;<br>                android:gravity=&quot;center&quot;<br>                android:text=&quot;Sample Quote&quot;<br>                android:textColor=&quot;@android:color/black&quot;<br>                android:textSize=&quot;20sp&quot;<br>                android:fontFamily=&quot;@font/courgette_font&quot; /&gt;<br>            <br>            &lt;TextView<br>                android:id=&quot;@+id/tvAuthor&quot;<br>                android:layout_width=&quot;match_parent&quot;<br>                android:layout_height=&quot;wrap_content&quot;<br>                android:gravity=&quot;end&quot;<br>                android:text=&quot;— Author&quot;<br>                android:textColor=&quot;@android:color/darker_gray&quot;<br>                android:textSize=&quot;16sp&quot;<br>                android:fontFamily=&quot;@font/courgette_font&quot; /&gt;<br>        &lt;/LinearLayout&gt;<br>    &lt;/com.google.android.material.card.MaterialCardView&gt;<br>&lt;/layout&gt;</pre><blockquote>neumorphic_bg.xml</blockquote><pre>&lt;!-- File: app/src/main/res/layout/neumorphic_bg.xml --&gt;<br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;layer-list xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;<br>    <br>    &lt;!-- Bottom dark shadow --&gt;<br>    &lt;item android:bottom=&quot;4dp&quot; android:right=&quot;4dp&quot;&gt;<br>        &lt;shape android:shape=&quot;rectangle&quot;&gt;<br>            &lt;solid android:color=&quot;@color/nm_dark_shadow&quot; /&gt;<br>            &lt;corners android:radius=&quot;16dp&quot; /&gt;<br>        &lt;/shape&gt;<br>    &lt;/item&gt;<br><br>    &lt;!-- Top light shadow --&gt;<br>    &lt;item android:top=&quot;4dp&quot; android:left=&quot;4dp&quot;&gt;<br>        &lt;shape android:shape=&quot;rectangle&quot;&gt;<br>            &lt;solid android:color=&quot;@color/nm_light_shadow&quot; /&gt;<br>            &lt;corners android:radius=&quot;16dp&quot; /&gt;<br>        &lt;/shape&gt;<br>    &lt;/item&gt;<br><br>    &lt;!-- Main background layer --&gt;<br>    &lt;item&gt;<br>        &lt;shape android:shape=&quot;rectangle&quot;&gt;<br>            &lt;solid android:color=&quot;@color/nm_background&quot; /&gt;<br>            &lt;corners android:radius=&quot;16dp&quot; /&gt;<br>        &lt;/shape&gt;<br>    &lt;/item&gt;<br>    <br>&lt;/layer-list&gt;</pre><h4>Theme and Color Customization</h4><p>Below is an example of a pastel-inspired color palette along with neumorphic colors:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;resources&gt;<br>    &lt;!-- Pastel Color Palette --&gt;<br>    &lt;color name=&quot;pastel_background&quot;&gt;#FFF8F0&lt;/color&gt;<br>    &lt;color name=&quot;pastel_primary&quot;&gt;#A8DADC&lt;/color&gt;<br>    &lt;color name=&quot;pastel_primary_variant&quot;&gt;#457B9D&lt;/color&gt;<br>    &lt;color name=&quot;pastel_secondary&quot;&gt;#F4A261&lt;/color&gt;<br>    &lt;color name=&quot;pastel_accent&quot;&gt;#E76F51&lt;/color&gt;<br><br>    &lt;!-- Neumorphic colors (kept for shadow effects) --&gt;<br>    &lt;color name=&quot;nm_background&quot;&gt;#E0E5EC&lt;/color&gt;<br>    &lt;color name=&quot;nm_light_shadow&quot;&gt;#FFFFFF&lt;/color&gt;<br>    &lt;color name=&quot;nm_dark_shadow&quot;&gt;#A3B1C6&lt;/color&gt;<br>    <br>    &lt;!-- Standard colors --&gt;<br>    &lt;color name=&quot;white&quot;&gt;#FFFFFF&lt;/color&gt;<br>    &lt;color name=&quot;black&quot;&gt;#000000&lt;/color&gt;<br>&lt;/resources&gt;</pre><blockquote>styles.xml</blockquote><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;resources&gt;<br>    &lt;!-- Base application theme with Pastel Colors and Courgette Font --&gt;<br>    &lt;style name=&quot;AppTheme&quot; parent=&quot;Theme.MaterialComponents.DayNight.NoActionBar&quot;&gt;<br>        &lt;item name=&quot;android:windowBackground&quot;&gt;@color/pastel_background&lt;/item&gt;<br>        &lt;item name=&quot;colorPrimary&quot;&gt;@color/pastel_primary&lt;/item&gt;<br>        &lt;item name=&quot;colorPrimaryVariant&quot;&gt;@color/pastel_primary_variant&lt;/item&gt;<br>        &lt;item name=&quot;colorSecondary&quot;&gt;@color/pastel_secondary&lt;/item&gt;<br>        &lt;item name=&quot;colorAccent&quot;&gt;@color/pastel_accent&lt;/item&gt;<br>        &lt;!-- Set Courgette as the default font family --&gt;<br>        &lt;item name=&quot;android:fontFamily&quot;&gt;@font/courgette_font&lt;/item&gt;<br>    &lt;/style&gt;<br><br>    &lt;!-- Custom Toolbar Style --&gt;<br>    &lt;style name=&quot;Widget.Toolbar.Pastel&quot; parent=&quot;Widget.MaterialComponents.Toolbar.Primary&quot;&gt;<br>        &lt;item name=&quot;android:background&quot;&gt;@color/pastel_primary&lt;/item&gt;<br>        &lt;item name=&quot;titleTextAppearance&quot;&gt;@style/TextAppearance.App.Toolbar.Title&lt;/item&gt;<br>    &lt;/style&gt;<br><br>    &lt;!-- Text Appearance for Toolbar Title using Courgette --&gt;<br>    &lt;style name=&quot;TextAppearance.App.Toolbar.Title&quot; parent=&quot;TextAppearance.Widget.AppCompat.Toolbar.Title&quot;&gt;<br>        &lt;item name=&quot;android:textColor&quot;&gt;@android:color/white&lt;/item&gt;<br>        &lt;item name=&quot;android:textSize&quot;&gt;20sp&lt;/item&gt;<br>        &lt;item name=&quot;android:fontFamily&quot;&gt;@font/courgette_font&lt;/item&gt;<br>    &lt;/style&gt;<br><br>    &lt;!-- Default Text Appearance --&gt;<br>    &lt;style name=&quot;TextAppearance.App.Default&quot; parent=&quot;TextAppearance.AppCompat.Body1&quot;&gt;<br>        &lt;item name=&quot;android:fontFamily&quot;&gt;@font/courgette_font&lt;/item&gt;<br>    &lt;/style&gt;<br>&lt;/resources&gt;</pre><h4>Conclusion</h4><p>In this article, we built the <strong>QuotesApp</strong> using the MVVM pattern with a stunning UI that includes:</p><ul><li>A pastel-themed design with custom colors.</li><li>A Material Toolbar featuring a centered title, a matching status bar, and a custom icon.</li><li>Neumorphic-inspired MaterialCardViews with layered shadows.</li><li>A global custom font (Courgette) applied throughout the app.</li><li>A complete Gradle configuration and detailed project structure.</li></ul><p>This comprehensive setup ensures that your QuotesApp is modular, testable, and visually appealing. In upcoming articles, we’ll explore various testing strategies—from unit tests and integration tests (with Robolectric) to UI tests (with Espresso) and end-to-end testing in your CI/CD pipeline.</p><p>Feel free to clone this project, experiment with the code, and adapt it to your needs. Happy coding</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ae9116c4b16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Code to Confidence: Testing Your Android MVVM Application Like a Pro]]></title>
            <link>https://medium.com/@maha21.kanagaraj/from-code-to-confidence-testing-your-android-mvvm-application-like-a-pro-e441d9d7b04f?source=rss-03c44a83e975------2</link>
            <guid isPermaLink="false">https://medium.com/p/e441d9d7b04f</guid>
            <category><![CDATA[android-unit-testing]]></category>
            <category><![CDATA[mockitotesting]]></category>
            <category><![CDATA[espresso-testing]]></category>
            <category><![CDATA[real-world-application]]></category>
            <category><![CDATA[android-testing]]></category>
            <dc:creator><![CDATA[Maha Kanagaraj]]></dc:creator>
            <pubDate>Wed, 09 Apr 2025 04:14:23 GMT</pubDate>
            <atom:updated>2025-04-09T05:02:12.357Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a8T4-PRLJjgQFQdHvZOrKQ.png" /></figure><p>In today’s fast-paced development world, <strong>Automated Testing</strong> is essential to ensure an application’s reliability, maintainability, and overall quality. In this series, we build a simple Quotes app using the MVVM (Model–View–ViewModel) pattern and explore various testing strategies — from unit tests to integration, UI, and end-to-end tests. Throughout the series, you’ll see how each type of test contributes to a robust codebase.</p><h4>Building the QuotesApp with MVVM: Series Overview on Testing</h4><p>In this series, we will cover everything from the initial introduction of our app built with the MVVM architecture to various testing strategies including unit, integration, UI, and end-to-end testing. The series is designed to ensure that the app is robust, maintainable, and delivers a seamless user experience.</p><p>Below is a detailed overview of the series along with an explanation of the app’s architecture, technology stack, and project structure.</p><h4>What is the Quotes App?</h4><p>The <strong>QuotesApp</strong> is designed to deliver motivational quotes from a remote API, providing users with daily inspiration. The app features a modern and elegant user interface with a pastel color scheme, a custom Material Toolbar with a centered title and matching status bar, neumorphic-inspired MaterialCardViews, and the Courgette font applied globally.</p><p>The app fetches quotes using Retrofit and follows a well-defined design pattern that separates the app’s core components, making it easier to test and maintain.</p><h4>Technology Stack Overview</h4><p>The QuotesApp leverages several modern libraries and frameworks to deliver a robust and visually appealing experience:</p><ul><li><strong>Kotlin:</strong> Chosen for its concise syntax and modern features.</li><li><strong>Android Jetpack Components:</strong> Including ViewModel, LiveData, and Data Binding, which facilitate reactive programming and clean architecture.</li><li><strong>Retrofit and OkHttp:</strong> For type-safe network communication and efficient HTTP requests.</li><li><strong>Material Components:</strong> Used to implement a modern UI with a custom Material Toolbar, pastel themes, and neumorphic card styles.</li><li><strong>Custom Fonts:</strong> The app uses the Courgette font throughout for a unique and stylish look.</li></ul><h3>Series Roadmap</h3><p>This testing series is divided into several parts, each diving deep into a particular layer of testing:</p><ol><li><strong>Introduction and App Overview:</strong> We begin by presenting the QuotesApp built with MVVM, explaining the project structure, technology stack (Kotlin, Android Jetpack, Retrofit, Data Binding), and component interactions.</li><li><strong>Unit Testing the MVVM Components:</strong> This article focuses on writing unit tests for the Repository and ViewModel. We will use fakes and mocks to isolate the business logic, covering tools like JUnit, Mockito/MockK, and coroutine testing utilities.</li><li><strong>Integration Testing with Robolectric:</strong> Integration tests ensure that the Android components work together correctly. Using Robolectric, we simulate the Android runtime on the JVM to test how the Repository and ViewModel interact with Android framework components.</li><li><strong>UI Testing with Espresso:</strong> After ensuring that the lower layers work as expected, we will write UI tests using Espresso. These tests will validate that the MainActivity displays the RecyclerView correctly, that the Material Toolbar appears as designed, and that user interactions are handled properly.</li><li><strong>End-to-End Testing and CI/CD Integration:</strong> Finally, we simulate complete user journeys through the app and discuss how to integrate these tests into a CI/CD pipeline using tools like GitHub Actions or Jenkins. This article covers challenges, best practices, and strategies to reduce test flakiness in production.</li></ol><h4>Let’s Get Started!</h4><p>This series will take you step-by-step from understanding the app’s architecture to ensuring its quality through comprehensive testing. With the foundation established in our introductory articles, you will soon dive into detailed testing strategies that cover unit tests, integration tests, UI tests, and end-to-end tests.</p><p>Each article is designed to build upon the previous one, providing a complete roadmap for mastering testing in Android. By the end of this series, you will have a robust understanding of how to produce high-quality, reliable applications.</p><p>Stay tuned for the first article on <strong>Introduction and App Overview</strong>, where we will explore the QuotesApp’s technical foundation, project structure, and component interactions in detail.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e441d9d7b04f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhanced Material Bottom Navigation Bar in Android]]></title>
            <link>https://medium.com/@maha21.kanagaraj/enhanced-material-bottom-navigation-bar-in-android-134feb250198?source=rss-03c44a83e975------2</link>
            <guid isPermaLink="false">https://medium.com/p/134feb250198</guid>
            <dc:creator><![CDATA[Maha Kanagaraj]]></dc:creator>
            <pubDate>Mon, 17 Mar 2025 04:04:05 GMT</pubDate>
            <atom:updated>2025-03-17T04:04:05.889Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Custom Color, Background, &amp; Vector Drawable Selectors for Selected and Unselected States</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*_cjeeh6_mnozgIHvN-o2pA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*jTgLfDpk1uslavTdPHDZbw.png" /></figure><p>Navigation is the backbone of any well-designed app, and a sleek Bottom Navigation Bar is a must-have for modern mobile experiences.With Material Design’s intuitive framework, you can build a bar that’s not only functional but also stylish, incorporating custom colors, backgrounds, and even dynamic icons that change based on user interaction. Let’s dive into how you can create and customize your very own Material Bottom Navigation Bar, step-by-step.</p><pre>&lt;!-- res/layout/activity_main.xml --&gt;<br>&lt;com.google.android.material.bottomnavigation.BottomNavigationView<br>    android:id=&quot;@+id/bottom_navigation_view&quot;<br>    android:layout_width=&quot;match_parent&quot;<br>    android:layout_height=&quot;wrap_content&quot;<br>    android:layout_gravity=&quot;bottom&quot;<br>    app:itemIconSize=&quot;25dp&quot;<br>    app:menu=&quot;@menu/bottom_nav_menu&quot;<br>    app:itemIconTint=&quot;@color/bottom_nav_icon_color&quot;<br>    app:itemTextColor=&quot;@color/bottom_nav_text_color&quot;<br>    android:background=&quot;@drawable/bottom_nav_background&quot;/&gt;</pre><h4>Creating Custom Color Selectors</h4><p>To provide visual feedback on selection, create color state lists. These selectors change the color of your icons and text depending on whether an item is checked (selected) or not.</p><ol><li><strong>Icon Color Selector</strong> Create res/color/bottom_nav_icon_color.xml:</li></ol><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;<br>    &lt;!-- When selected --&gt;<br>    &lt;item android:color=&quot;@color/colorPrimary&quot; android:state_checked=&quot;true&quot;/&gt;<br>    &lt;!-- Default state --&gt;<br>    &lt;item android:color=&quot;@color/colorSecondary&quot;/&gt;<br>&lt;/selector&gt;</pre><p><strong>2. Text Color Selector</strong> Create res/color/bottom_nav_text_color.xml:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;<br>    &lt;!-- When selected --&gt;<br>    &lt;item android:color=&quot;@color/colorPrimary&quot; android:state_checked=&quot;true&quot;/&gt;<br>    &lt;!-- Default state --&gt;<br>    &lt;item android:color=&quot;@color/colorSecondary&quot;/&gt;<br>&lt;/selector&gt;</pre><p>For example:</p><pre>&lt;color name=&quot;colorPrimary&quot;&gt;#6200EE&lt;/color&gt; &gt; <br>&lt;color name=&quot;colorSecondary&quot;&gt;#828282&lt;/color&gt; &gt;</pre><p>These files automatically update your Bottom Navigation Bar items when the user interacts with them.</p><h4>Designing a Custom Drawable Background</h4><p>A modern Bottom Navigation Bar often features a custom background — perhaps with rounded corners or a subtle shadow — to give it a floating appearance. Create a drawable resource with your desired styling.</p><p><strong>Create </strong>res/drawable/bottom_nav_background.xml<strong>:</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    android:shape=&quot;rectangle&quot;&gt;<br>    &lt;!-- Solid fill color; change or include transparency as needed --&gt;<br>    &lt;solid android:color=&quot;#F8F8F8&quot;/&gt;<br>    &lt;!-- Rounded corners for a softer appearance --&gt;<br>    &lt;corners android:radius=&quot;16dp&quot;/&gt;<br>    &lt;!-- Optional padding for inner content spacing --&gt;<br>    &lt;padding<br>        android:left=&quot;8dp&quot;<br>        android:top=&quot;8dp&quot;<br>        android:right=&quot;8dp&quot;<br>        android:bottom=&quot;8dp&quot; /&gt;<br>&lt;/shape&gt;</pre><p>This drawable is applied as the background of the Bottom Navigation Bar, ensuring it stands out against your app’s content.</p><h4>Using Vector Drawable Selectors for Icons</h4><p>While color selectors are great for tinting, sometimes you want the icon itself to change based on state. For example, you might have a filled icon when selected and just an outline when unselected. This can be achieved by using a selector drawable that lists different vector drawables for each state.</p><h4>Step 1: Create Vector Drawables</h4><p>Since the png image cant be used as a icon for the bottom navigation menu icons we need to convert the .PNG image into .SVG using any online coverter for example like (<a href="https://www.freeconvert.com/svg-converter">freeconvert.com</a>)and convert the .SVG imagetype into drawable in android studio as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iWAVGq9DH2HfiW5gPgDs9g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uOqn9pR03Gphg5-rfupr3g.png" /></figure><p>Assume you have two vector drawables:</p><ul><li>res/drawable/ic_home_selected.xml</li><li>res/drawable/ic_home_unselected.xml</li></ul><p>These represent the home icon’s two states.</p><h4>Step 2: Create the Icon Selector</h4><p>Create a new XML in the drawable folder, e.g., res/drawable/ic_home_selector.xml:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;<br>    &lt;!-- Selected state: show the filled icon --&gt;<br>    &lt;item android:drawable=&quot;@drawable/ic_home_selected&quot; android:state_checked=&quot;true&quot;/&gt;<br>    &lt;!-- Unselected state: show the outline icon --&gt;<br>    &lt;item android:drawable=&quot;@drawable/ic_home_unselected&quot;/&gt;<br>&lt;/selector&gt;</pre><h4>Step 3: Use the Selector in Your Menu</h4><p>Now, update your menu XML to make use of the selector for the home item.</p><p><strong>Example: </strong>res/menu/bottom_nav_menu.xml<strong>:</strong></p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;menu xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;<br>    &lt;item<br>        android:id=&quot;@+id/navigation_home&quot;<br>        android:icon=&quot;@drawable/ic_home_selector&quot;<br>        android:title=&quot;Home&quot;/&gt;<br>    &lt;item<br>        android:id=&quot;@+id/navigation_dashboard&quot;<br>        android:icon=&quot;@drawable/ic_dashboard_selector&quot;<br>        android:title=&quot;Dashboard&quot;/&gt;<br>    &lt;item<br>        android:id=&quot;@+id/navigation_notifications&quot;<br>        android:icon=&quot;@drawable/ic_notifications_selector&quot;<br>        android:title=&quot;Notifications&quot;/&gt;<br>&lt;/menu&gt;</pre><p>Repeat the process for each icon in your Bottom Navigation Bar. By leveraging vector drawable selectors, your icons will automatically switch between the filled and outline versions depending on the user’s selection.</p><h4>Integrating Everything in Kotlin</h4><p>Kotlin: MainActivity.kt</p><pre>import android.os.Bundle<br>import androidx.appcompat.app.AppCompatActivity<br>import androidx.navigation.findNavController<br>import androidx.navigation.ui.NavigationUI<br>import com.google.android.material.bottomnavigation.BottomNavigationView<br>import your.package.name.R<br><br>class MainActivity : AppCompatActivity() {<br>    override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)<br>        setContentView(R.layout.activity_main)<br><br>        // Reference the BottomNavigationView<br>        val bottomNavigationView = findViewById&lt;BottomNavigationView&gt;(R.id.bottom_navigation_view)<br><br>        // Set up navigation with NavController<br>        val navController = findNavController(R.id.nav_host_fragment)<br>        NavigationUI.setupWithNavController(bottomNavigationView, navController)<br>    }<br>}</pre><h4>Key Points in the Code</h4><ol><li><strong>BottomNavigationView Reference:</strong> The BottomNavigationView is retrieved using findViewById and matched with the corresponding ID in your layout file (R.id.bottom_navigation_view).</li><li><strong>Navigation Setup:</strong> The NavController is obtained using the ID of the FragmentContainerView (i.e., the navigation host). The NavigationUI.setupWithNavController method automatically links the BottomNavigationView with the navigation graph for seamless navigation.</li></ol><p>With these steps, you’ve crafted a stunning, functional Bottom Navigation Bar that enhances your app’s usability and style. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=134feb250198" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Launching Your App Screens for Free on Both Play Store and App Store with Studio App Mockup]]></title>
            <link>https://medium.com/@maha21.kanagaraj/launching-your-app-screens-for-free-on-both-play-store-and-app-store-with-studio-app-mockup-9aed7147f9c0?source=rss-03c44a83e975------2</link>
            <guid isPermaLink="false">https://medium.com/p/9aed7147f9c0</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Maha Kanagaraj]]></dc:creator>
            <pubDate>Tue, 19 Nov 2024 08:49:24 GMT</pubDate>
            <atom:updated>2024-11-19T08:49:24.584Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mX6K1c-OMpBida8nWpzh-Q.png" /></figure><p><a href="https://studio.app-mockup.com/"><strong>Studio App Mockup</strong></a> is a powerful, free tool that allows developers and designers to create stunning app screens and launch them on both the Play Store and App Store effortlessly. In this article, we’ll explore how to use Studio App Mockup to bring your app ideas to life and share them with the world.</p><h4>What is Studio App Mockup?</h4><p>Studio App Mockup is an intuitive and user-friendly design tool that helps you create high-fidelity mockups for your mobile apps. With its drag-and-drop interface, pre-designed templates, and extensive library of UI elements, you can create professional-quality <strong>app screens for free</strong> and get them ready for launch on both the <strong>Play Store</strong> and the <strong>App Store</strong>.</p><h4>Step 1: Sign Up and Log In</h4><p>First, sign up for a free account on Studio App Mockup and log in to access the design dashboard.</p><h4>Step 2: Create a New Project</h4><p>Once you’re logged in, click on the “Create New Project” button. Choose the platform (iOS or Android) for which you want to design your app screens and select a suitable template or start from scratch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tBgwsONHPAY_SDU_tI_FYg.png" /></figure><h4>Step 3: Design Your App Screens</h4><p>Studio App Mockup provides a variety of pre-designed templates and UI elements that you can use to design your app screens. Here’s how to get started:</p><ol><li><strong>Add UI Elements</strong>: Drag and drop UI elements like buttons, text fields, images, and icons onto your canvas. Customize their properties, such as size, color, and font, to match your design vision.</li><li><strong>Create Multiple Screens</strong>: Design multiple app screens to demonstrate the user flow. You can easily link screens together to create a prototype that simulates user interactions.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MFhtSByKDXWbQ9tK0Wh92A.png" /></figure><ol><li><strong>Use Grids and Guides</strong>: Utilize grids and guides to ensure that your UI elements are perfectly aligned and spaced. This helps maintain a consistent and professional look throughout your app.</li></ol><h4>Step 4: Preview and Test</h4><p>After designing your app screens, you can preview and test your mockup to see how it looks and feels. Studio App Mockup allows you to create interactive prototypes that mimic real user interactions, giving you a clear idea of how your app will function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xvbyS0pAD0n98Y6v7dMxeg.png" /></figure><h4>Step 5: Export and Share</h4><p>Once you’re satisfied with your design, you can export your mockups in various formats <strong>(PNG, JPEG, PDF)</strong> and share them with your team or clients for feedback. Studio App Mockup also supports direct integration with collaboration tools like Slack and Trello, making it easy to incorporate feedback and iterate on your designs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Cq7OYioE3qROY9uE4hYwg.png" /></figure><p>By following the steps outlined in this article, you can bring your app to life and share it with the world on both the Play Store and App Store.</p><p>Happy designing and launching!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9aed7147f9c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplify and Manage the Dependency in Kotlin using libs.versions.toml file]]></title>
            <link>https://medium.com/@maha21.kanagaraj/simplify-and-manage-the-dependency-in-kotlin-using-libs-versions-toml-file-2a3f3e10252b?source=rss-03c44a83e975------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a3f3e10252b</guid>
            <dc:creator><![CDATA[Maha Kanagaraj]]></dc:creator>
            <pubDate>Sun, 10 Nov 2024 09:22:54 GMT</pubDate>
            <atom:updated>2024-11-10T09:22:54.814Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve ever found yourself tangled in a web of dependencies while working on a Kotlin project, you know the pain of managing multiple version numbers scattered across your build.gradle files. Enter the libs.versions.toml file — a game-changer for simplifying and centralizing dependency management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZKRwlAXXwf6fhPhnKpMJbQ.png" /></figure><h3>What is libs.versions.toml?</h3><p>The libs.versions.toml file is part of Gradle&#39;s new feature called <strong>Version Catalogs</strong>. It allows you to define all your dependency versions in one place, ensuring consistency across your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*dWFYEES9J6WvffhS1UNdng.png" /><figcaption>libs file under gradle folder</figcaption></figure><h3>Why Use libs.versions.toml?</h3><ul><li><strong>Centralized Management</strong>: Define all versions in a single file.</li><li><strong>Consistency</strong>: Ensure all modules in a multi-module project use the same dependency versions.</li><li><strong>Ease of Updates</strong>: Update version numbers in one place.</li></ul><h3>How to Set It Up</h3><p>Let’s walk through the steps to set up libs.versions.toml in your Kotlin project.</p><h3>Step 1: Create or Update libs.versions.toml</h3><p>First, you’ll need to create a libs.versions.toml file if it doesn&#39;t already exist. This file should be placed in the gradle directory of your project.</p><p>Here’s an example of how you can define versions and dependencies:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oz1yksPcV_RoUDKaOvBhOg.png" /><figcaption>Define Version number of Dependcency in “versions” section</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffGgYiyV5sADQ6W1NRqqJA.png" /><figcaption>Defining dependency in “Libraries” section</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*64WvNrRAVsaHe_rLGikKCA.png" /><figcaption>For adding Plugins in the “plugins” section</figcaption></figure><h3>Step 2: Apply Plugins and Dependencies in build.gradle.kts</h3><p>Now, you can apply the plugins and dependencies defined in libs.versions.toml in your module-level build.gradle.kts file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TWmylHkLu0fMCr5fyCuNeA.png" /><figcaption>Adding Plugins in gradle file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*V9p3gMk3w-Le7lI9BmKuRg.png" /><figcaption>Adding Dependencies in gradle file</figcaption></figure><h3>Step 3: Synchronize and Rebuild</h3><p>After making these changes, don’t forget to clean and rebuild your project to ensure the new configurations are applied correctly:</p><ol><li><strong>Clean Project</strong>: Build -&gt; Clean Project</li><li><strong>Rebuild Project</strong>: Build -&gt; Rebuild Project</li><li><strong>Synchronize Gradle Files</strong></li></ol><p>By using the libs.versions.toml file, you can drastically simplify your dependency management process, maintain consistency across your project, and make updates easier. This centralized approach not only makes your build files cleaner but also saves you a lot of headaches in the long run.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a3f3e10252b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>