Code Monkey home page Code Monkey logo

voicerecordermvvm's Introduction

Voice Recording App : MVVM

A voice recording app for basic demonstration of latest best practices of Android.

  • Using : Kotlin, Navigation Components, Room Database (for caching), Lifescycle, Dependency Injection: HILT, Kotlin Coroutines, Android Material Components

Basic Code Explanation

  • targetSDK/compileSDK : Android 10, used flag requestLegacyExternalStorage for normal storage access. (Android 10 and above requires usage of ScopedStorage and MediaStore) these docs are helpful : DataStorage & Storage Updates

  • Hilt construction injection and field injection are used wherever required, through the AppModule, ActivityModule(AcitivityScoped), and DatabaseModule for Room. Hilt Documentation is a good source to get started.

  • Priamry DataType created for saving voice record is Record: with basically two properties one title and other is filePath linked to the voice recorded file. (third one is the id as a @PrimaryKey for Room Database)

  • AppDatabase extending RoomDatabase acts as the primary Database, implemented using the RoomDatabase.Callback for accessing data in background thread using coroutines. A basic guide for the same is this aticle by Ray Wenderlich, but is without DI.

  • Used new ListAdapter a better version of RecyclerView.Adapter imporoves use case for working with LiveData and Coroutines, by comparing the data that is already laoded. Beter Explanation here and this article by Ferdinand Bada. DiffUtil

  • Not all functions need to be suspend type, some tasks are better on main thread (playing/recording audio), while some tasks like accessing data from Database on background thread.

  • No Services used, the app is intended to work well on the foreground only.

  • Some other Helpfull links : ViewModels, ViewBinding

App Behaviour Explanation

Note: Please record at least 3-4 records to efficiently test the application

  • the first tab/screen is to record our voice from microphone, for which a name is required:

    1. Enter Name
    2. Press Record Button to start recording
    3. Recording started, press stop Button to stop current recording
    4. Your current recording is saved and will be visible in the list
  • the second screen/tab is the list of our recordings (App only)

    • List of our recordings is visible (if ever recorded something)
    • Play Button : plays when an item is clicked form the list, or if the shuffle is on and we click this button.
    • Next Button: Plays next record(in sequence/random) depending on the shuffle state. This plays a record, but if loop is ON the new played record will loop
    • Previous Button: Plays previous record(in sequence/random) depending on the shuffle state. This plays a record, but if loop is ON the new played record will loop. If a record is playing, it will restart the playing record.
    • Shuffle : Enables random song playing
    • Loop : Enables playing song to play again and again

voicerecordermvvm's People

Contributors

4shutosh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.