├── .gitignore ├── .idea ├── .gitignore ├── .name ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── compiler.xml ├── gradle.xml ├── jarRepositories.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── alterpat │ │ └── voicerecorder │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── alterpat │ │ │ └── voicerecorder │ │ │ ├── Adapter.kt │ │ │ ├── BottomSheet.kt │ │ │ ├── ListingActivity.kt │ │ │ ├── MainActivity.kt │ │ │ ├── PlayerActivity.kt │ │ │ ├── PlayerWaveformView.kt │ │ │ ├── RecorderWaveformView.kt │ │ │ ├── db │ │ │ ├── AppDatabase.kt │ │ │ ├── AudioRecord.kt │ │ │ └── AudioRecordDAO.kt │ │ │ └── tools │ │ │ ├── Timer.kt │ │ │ └── TimerHandler.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── ic_back.xml │ │ ├── ic_backward.xml │ │ ├── ic_circle.xml │ │ ├── ic_circle_pressed.xml │ │ ├── ic_circle_selectable.xml │ │ ├── ic_circle_selectable_white.xml │ │ ├── ic_circle_white.xml │ │ ├── ic_close.xml │ │ ├── ic_delete.xml │ │ ├── ic_delete_disabled.xml │ │ ├── ic_delete_disabled2.xml │ │ ├── ic_delete_enabled.xml │ │ ├── ic_done.xml │ │ ├── ic_edit.xml │ │ ├── ic_edit_disabled.xml │ │ ├── ic_forward.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_list.xml │ │ ├── ic_list_selected.xml │ │ ├── ic_menu.xml │ │ ├── ic_pause.xml │ │ ├── ic_pause_circle.xml │ │ ├── ic_play.xml │ │ ├── ic_play_circle.xml │ │ ├── ic_record.xml │ │ ├── ic_search.xml │ │ └── ic_stop.xml │ │ ├── layout │ │ ├── activity_listing.xml │ │ ├── activity_main.xml │ │ ├── activity_player.xml │ │ ├── bottom_sheet.xml │ │ └── itemview_layout.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── alterpat │ └── voicerecorder │ └── ExampleUnitTest.kt ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── resources └── voice-recorder-app-demo.gif └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | Voice Recorder R&D -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | xmlns:android 17 | 18 | ^$ 19 | 20 | 21 | 22 |
23 |
24 | 25 | 26 | 27 | xmlns:.* 28 | 29 | ^$ 30 | 31 | 32 | BY_NAME 33 | 34 |
35 |
36 | 37 | 38 | 39 | .*:id 40 | 41 | http://schemas.android.com/apk/res/android 42 | 43 | 44 | 45 |
46 |
47 | 48 | 49 | 50 | .*:name 51 | 52 | http://schemas.android.com/apk/res/android 53 | 54 | 55 | 56 |
57 |
58 | 59 | 60 | 61 | name 62 | 63 | ^$ 64 | 65 | 66 | 67 |
68 |
69 | 70 | 71 | 72 | style 73 | 74 | ^$ 75 | 76 | 77 | 78 |
79 |
80 | 81 | 82 | 83 | .* 84 | 85 | ^$ 86 | 87 | 88 | BY_NAME 89 | 90 |
91 |
92 | 93 | 94 | 95 | .* 96 | 97 | http://schemas.android.com/apk/res/android 98 | 99 | 100 | ANDROID_ATTRIBUTE_ORDER 101 | 102 |
103 |
104 | 105 | 106 | 107 | .* 108 | 109 | .* 110 | 111 | 112 | BY_NAME 113 | 114 |
115 |
116 |
117 |
118 | 119 | 121 |
122 |
-------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android Voice Recorder [work in progress] 2 | 3 | A minimalist voice recorder for android using Kotlin with a live waveform reflecting voice amplitude. Using Android Room Library to store and query recods metadata. 4 | 5 | ## Demo 6 | 7 |

8 | App Demo 9 |

10 | 11 | ## Features 12 | 13 | - Record audio files 14 | - Control player speed 15 | - Rename and delete records 16 | - BottomSheetLayout to edit file names 17 | - Search bar with files filter 18 | 19 | ## Technologies 20 | 21 | - [Android Room Library]() to manage audio files locations and metadata 22 | - [Material Design]() 23 | 24 | # 🔗 Links 25 | 26 | [![youtube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/playlist?list=PLpZQVidZ65jPz-XIHdWi1iCra8TU9h_kU) I made a tutorial series on how to code it on my YouTube Channel, take a look 😁 27 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | compileSdkVersion 30 8 | buildToolsVersion "30.0.1" 9 | 10 | defaultConfig { 11 | applicationId "com.alterpat.voicerecorder" 12 | minSdkVersion 24 13 | targetSdkVersion 30 14 | versionCode 1 15 | versionName "1.0" 16 | 17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 18 | } 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | } 27 | 28 | dependencies { 29 | implementation fileTree(dir: "libs", include: ["*.jar"]) 30 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 31 | implementation 'androidx.core:core-ktx:1.3.2' 32 | implementation 'androidx.appcompat:appcompat:1.2.0' 33 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 34 | testImplementation 'junit:junit:4.12' 35 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 36 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 37 | 38 | 39 | implementation 'com.google.android.material:material:1.4.0-alpha02' 40 | 41 | def room_version = "2.2.6" 42 | 43 | implementation "androidx.room:room-runtime:$room_version" 44 | kapt "androidx.room:room-compiler:$room_version" 45 | 46 | // optional - Kotlin Extensions and Coroutines support for Room 47 | implementation "androidx.room:room-ktx:$room_version" 48 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/androidTest/java/com/alterpat/voicerecorder/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.alterpat.voicerecorder 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.alterpat.voicerecorder", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/alterpat/voicerecorder/Adapter.kt: -------------------------------------------------------------------------------- 1 | package com.alterpat.voicerecorder 2 | 3 | import android.util.Log 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import android.widget.CheckBox 8 | import android.widget.TextView 9 | import androidx.recyclerview.widget.RecyclerView 10 | import com.alterpat.voicerecorder.db.AudioRecord 11 | import java.text.SimpleDateFormat 12 | import java.util.* 13 | 14 | class Adapter(private var audioRecords: List, 15 | private val listener: OnItemClickListener) : RecyclerView.Adapter() { 16 | 17 | private var editMode = false 18 | 19 | interface OnItemClickListener { 20 | fun onItemClick(position: Int) 21 | fun onItemLongClick(position: Int) 22 | } 23 | 24 | inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), View.OnClickListener, View.OnLongClickListener { 25 | var filename : TextView = itemView.findViewById(R.id.filename) 26 | var fileMeta : TextView = itemView.findViewById(R.id.file_meta) 27 | var checkBox : CheckBox = itemView.findViewById(R.id.checkbox) 28 | 29 | init { 30 | itemView.setOnClickListener(this) 31 | itemView.setOnLongClickListener(this) 32 | } 33 | override fun onClick(p0: View?) { 34 | val position = adapterPosition // property of the recyclerview class 35 | if(position != RecyclerView.NO_POSITION) 36 | listener.onItemClick(position) 37 | } 38 | 39 | override fun onLongClick(p0: View?): Boolean { 40 | val position = adapterPosition // property of the recyclerview class 41 | if(position != RecyclerView.NO_POSITION) 42 | listener.onItemLongClick(position) 43 | return true 44 | } 45 | } 46 | 47 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { 48 | val view = LayoutInflater.from(parent.context).inflate(R.layout.itemview_layout, parent, false) 49 | return ViewHolder(view) 50 | } 51 | 52 | override fun getItemCount(): Int { 53 | return audioRecords.size 54 | } 55 | 56 | override fun onBindViewHolder(holder: ViewHolder, position: Int) { 57 | if(position != RecyclerView.NO_POSITION){ 58 | var audioRecord = audioRecords[position] 59 | holder.filename.text = audioRecord.filename 60 | val sdf = SimpleDateFormat("dd/MM/yy") 61 | val netDate = Date(audioRecord.date) 62 | val date =sdf.format(netDate) 63 | 64 | holder.fileMeta.text = "${audioRecord.duration} $date" 65 | 66 | Log.d("ListingTag", audioRecord.isChecked.toString()) 67 | 68 | if(editMode) { 69 | holder.checkBox.visibility = View.VISIBLE 70 | if (audioRecord.isChecked) 71 | holder.checkBox.isChecked = audioRecord.isChecked 72 | }else { 73 | holder.checkBox.visibility = View.GONE 74 | audioRecord.isChecked = false 75 | holder.checkBox.isChecked = false 76 | } 77 | } 78 | } 79 | 80 | fun setData(audioRecords: List){ 81 | this.audioRecords = audioRecords 82 | notifyDataSetChanged() 83 | } 84 | 85 | fun setEditMode(mode: Boolean){ 86 | editMode = mode 87 | notifyDataSetChanged() 88 | } 89 | 90 | fun isEditMode():Boolean{ 91 | return editMode 92 | } 93 | 94 | 95 | 96 | 97 | } -------------------------------------------------------------------------------- /app/src/main/java/com/alterpat/voicerecorder/BottomSheet.kt: -------------------------------------------------------------------------------- 1 | package com.alterpat.voicerecorder 2 | 3 | import android.content.Context 4 | import android.os.Bundle 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import android.view.WindowManager 9 | import android.view.inputmethod.InputMethodManager 10 | import android.widget.Button 11 | import com.google.android.material.bottomsheet.BottomSheetDialogFragment 12 | import com.google.android.material.textfield.TextInputEditText 13 | import java.io.File 14 | 15 | 16 | class BottomSheet: BottomSheetDialogFragment { 17 | 18 | // Step 1 - This interface defines the type of messages I want to communicate to my owner 19 | interface OnClickListener { 20 | // These methods are the different events and 21 | // need to pass relevant arguments related to the event triggered 22 | fun onCancelClicked() 23 | fun onOkClicked(filePath: String, filename: String) 24 | } 25 | 26 | // Step 2 - This variable represents the listener passed in by the owning object 27 | // The listener must implement the events interface and passes messages up to the parent. 28 | private lateinit var listener: OnClickListener 29 | 30 | private lateinit var filename: String 31 | private lateinit var dirPath: String 32 | 33 | constructor(dirPath: String, filename : String, listener: OnClickListener){ 34 | this.dirPath = dirPath 35 | this.filename = filename 36 | this.listener = listener 37 | } 38 | 39 | override fun onCreateView( 40 | inflater: LayoutInflater, 41 | container: ViewGroup?, 42 | savedInstanceState: Bundle? 43 | ): View? { 44 | var view = inflater.inflate(R.layout.bottom_sheet, container) 45 | var editText = view.findViewById(R.id.filenameInput) 46 | 47 | 48 | dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); 49 | 50 | 51 | // set edittext to filename 52 | filename = filename.split(".mp3")[0] 53 | editText.setText(filename) 54 | 55 | showKeyboard(editText) 56 | 57 | // deal with OK button 58 | view.findViewById