{"id":18858661,"url":"https://github.com/zagum/speechrecognitionview","last_synced_at":"2025-04-04T08:09:40.799Z","repository":{"id":5753969,"uuid":"53840280","full_name":"zagum/SpeechRecognitionView","owner":"zagum","description":"\"Google Now\" style animation for Speech Recognizer.","archived":false,"fork":false,"pushed_at":"2019-05-11T04:36:35.000Z","size":748,"stargazers_count":484,"open_issues_count":1,"forks_count":103,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-03-28T07:09:35.327Z","etag":null,"topics":["android","material-ui","recognition","speech-recognizer","style-animation"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zagum.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-14T08:46:45.000Z","updated_at":"2025-03-03T13:16:05.000Z","dependencies_parsed_at":"2022-08-17T21:25:22.711Z","dependency_job_id":null,"html_url":"https://github.com/zagum/SpeechRecognitionView","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zagum%2FSpeechRecognitionView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zagum%2FSpeechRecognitionView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zagum%2FSpeechRecognitionView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zagum%2FSpeechRecognitionView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zagum","download_url":"https://codeload.github.com/zagum/SpeechRecognitionView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247142074,"owners_count":20890653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","material-ui","recognition","speech-recognizer","style-animation"],"created_at":"2024-11-08T04:14:16.847Z","updated_at":"2025-04-04T08:09:40.772Z","avatar_url":"https://github.com/zagum.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"SpeechRecognitionView\n======================\n\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-SpeechRecognitionView-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/3518)\n[![Release](https://jitpack.io/v/zagum/SpeechRecognitionView.svg)](https://jitpack.io/#zagum/SpeechRecognitionView)\n\n\"Google Now\" style animation for [Speech Recognizer][1].\n\n![image](https://raw.githubusercontent.com/zagum/SpeechRecognitionView/master/art/speechrecognitionview.gif)\n\n\nCompatibility\n-------------\n\nThis library is compatible from API 15 (Android 4.0.3).\n\n\nDownload\n--------\n\n\nAdd it in your root build.gradle at the end of repositories:\n\n```groovy\nallprojects {\n    repositories {\n        ...\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\n\nAdd the dependency\n\n```groovy\ndependencies {\n    compile 'com.github.zagum:SpeechRecognitionView:1.2.2'\n}\n```\n\n\nUsage\n-----\n\n* Xml file:\n\nSimply add view to your layout:\n\n``` xml\n\u003ccom.github.zagum.speechrecognitionview.RecognitionProgressView\n\tandroid:id=\"@+id/recognition_view\"\n\tandroid:layout_width=\"wrap_content\"\n\tandroid:layout_height=\"wrap_content\"\n\tandroid:layout_gravity=\"center\"/\u003e\n```\n* Initialization:\n\nInit speech recognizer:\n``` java\nSpeechRecognizer speechRecognizer = SpeechRecognizer.createSpeechRecognizer(context);\n```\n\nInit RecognitionProgressView:\n``` java\nRecognitionProgressView recognitionProgressView = (RecognitionProgressView) findViewById(R.id.recognition_view);\nrecognitionProgressView.setSpeechRecognizer(speechRecognizer);\nrecognitionProgressView.setRecognitionListener(new RecognitionListenerAdapter() {\n        @Override\n        public void onResults(Bundle results) {\n\t        showResults(results);\n        }\n});\n```\n\nWhen SpeechRecognizer and RecognitionProgressView inited, use your speech recognizer as usual:\n``` java\nlisten.setOnClickListener(new View.OnClickListener() {\n\t@Override\n\tpublic void onClick(View v) {\n\t\tstartRecognition();\n\t}\n});\n\nprivate void startRecognition() {\n\tIntent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);\n\tintent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getPackageName());\n\tintent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);\n\tspeechRecognizer.startListening(intent);\n}\n```\n\nStart and stop RecognitionProgressView animation:\n``` java\nrecognitionProgressView.play();\n\nrecognitionProgressView.stop();\n```\n\n* Customization:\n\nSet custom colors: \n``` java\nint[] colors = {\n\t\tContextCompat.getColor(this, R.color.color1),\n\t\tContextCompat.getColor(this, R.color.color2),\n\t\tContextCompat.getColor(this, R.color.color3),\n\t\tContextCompat.getColor(this, R.color.color4),\n\t\tContextCompat.getColor(this, R.color.color5)\n};\nrecognitionProgressView.setColors(colors);\n```\n\nSet custom bars heights: \n``` java\nint[] heights = {60, 76, 58, 80, 55};\nrecognitionProgressView.setBarMaxHeightsInDp(heights);\n```\n\nSet custom circle radius/spacing between circles/idle animation amolitude size/rotation animation radius: \n``` java\nrecognitionProgressView.setCircleRadiusInDp(2);\nrecognitionProgressView.setSpacingInDp(2);\nrecognitionProgressView.setIdleStateAmplitudeInDp(2);\nrecognitionProgressView.setRotationRadiusInDp(10);\n```\nDon't forget to add permission to your AndroidManifest.xml file\n``` xml\n\u003cuses-permission android:name=\"android.permission.RECORD_AUDIO\"/\u003e\n```\n\n\n* Warning\n\nFrom [Android Documentation](http://developer.android.com/reference/android/speech/RecognitionListener.html#onRmsChanged(float))\nFor ```java public abstract void onRmsChanged (float rmsdB)``` callback ```There is no guarantee that this method will be called.```, \nso if this callback does not return values the Bars animation will be skipped. \n\nI found some hack to make it working every time you want to start speech recognition:\n``` java\nlisten.setOnClickListener(new View.OnClickListener() {\n\t@Override\n\tpublic void onClick(View v) {\n\t\tstartRecognition();\n\t\trecognitionProgressView.postDelayed(new Runnable() {\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\tstartRecognition();\n\t\t\t}\n\t\t}, 50);\n\t}\n});\n```\n\n\nLicense\n-------\n\n    Copyright 2016 Evgenii Zagumennyi\n    \n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n    \n    http://www.apache.org/licenses/LICENSE-2.0\n    \n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n\n[1]: http://developer.android.com/intl/ru/reference/android/speech/SpeechRecognizer.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzagum%2Fspeechrecognitionview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzagum%2Fspeechrecognitionview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzagum%2Fspeechrecognitionview/lists"}