diff --git a/README.md b/README.md index 0bc5663..2caac40 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ AndroidAudioRecorder.with(this) @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); - if (requestCode == RECORD_AUDIO) { + if (requestCode == 0) { if (resultCode == RESULT_OK) { // Great! User has recorded and saved the audio file } else if (resultCode == RESULT_CANCELED) { @@ -51,7 +51,7 @@ repositories { } dependencies { - compile 'com.github.adrielcafe:AndroidAudioRecorder:0.0.5' + compile 'com.github.adrielcafe:AndroidAudioRecorder:0.0.6' } ``` @@ -59,8 +59,9 @@ dependencies { - [X] Record audio - [X] Tint images to black when background color is too bright (thanks to [@prakh25](https://github.com/prakh25)) - [X] Wave visualization based on this [player concept](https://dribbble.com/shots/2369760-Player-Concept) +- [X] Play recorded audio - [ ] Pause audio -- [ ] Play recorded audio +- [ ] Skip silence ## Dependencies * [OmRecorder](https://github.com/kailash09dabhi/OmRecorder) diff --git a/app/build.gradle b/app/build.gradle index addea06..3645566 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,7 +21,7 @@ android { dependencies { compile 'com.android.support:appcompat-v7:24.1.1' compile project(':lib') -// compile 'com.github.adrielcafe:AndroidAudioRecorder:0.0.4' +// compile 'com.github.adrielcafe:AndroidAudioRecorder:0.0.6' } repositories { diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 2a54c93..086a883 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -4,5 +4,5 @@ #303F9F #FF4081 - #039BE5 + #7E57C2 \ No newline at end of file diff --git a/lib/src/main/java/cafe/adriel/androidaudiorecorder/AudioRecorderActivity.java b/lib/src/main/java/cafe/adriel/androidaudiorecorder/AudioRecorderActivity.java index e5aee18..ce3574b 100644 --- a/lib/src/main/java/cafe/adriel/androidaudiorecorder/AudioRecorderActivity.java +++ b/lib/src/main/java/cafe/adriel/androidaudiorecorder/AudioRecorderActivity.java @@ -52,7 +52,7 @@ public class AudioRecorderActivity extends AppCompatActivity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_audio_recorder); + setContentView(R.layout.aar_activity_audio_recorder); if(savedInstanceState != null) { filePath = savedInstanceState.getString(AndroidAudioRecorder.EXTRA_FILE_PATH); @@ -70,16 +70,16 @@ protected void onCreate(Bundle savedInstanceState) { getSupportActionBar().setBackgroundDrawable( new ColorDrawable(Util.getDarkerColor(color))); getSupportActionBar().setHomeAsUpIndicator( - getResources().getDrawable(R.drawable.ic_clear)); + getResources().getDrawable(R.drawable.aar_ic_clear)); } visualizerView = new GLAudioVisualizationView.Builder(this) .setLayersCount(1) .setWavesCount(6) - .setWavesHeight(R.dimen.wave_height) - .setWavesFooterHeight(R.dimen.footer_height) + .setWavesHeight(R.dimen.aar_wave_height) + .setWavesFooterHeight(R.dimen.aar_footer_height) .setBubblesPerLayer(20) - .setBubblesSize(R.dimen.bubble_size) + .setBubblesSize(R.dimen.aar_bubble_size) .setBubblesRandomizeSize(true) .setBackgroundColor(Util.getDarkerColor(color)) .setLayerColors(new int[]{color}) @@ -98,9 +98,9 @@ protected void onCreate(Bundle savedInstanceState) { playView.setVisibility(View.INVISIBLE); if(Util.isBrightColor(color)) { - getResources().getDrawable(R.drawable.ic_clear) + getResources().getDrawable(R.drawable.aar_ic_clear) .setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_ATOP); - getResources().getDrawable(R.drawable.ic_check) + getResources().getDrawable(R.drawable.aar_ic_check) .setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_ATOP); statusView.setTextColor(Color.BLACK); timerView.setTextColor(Color.BLACK); @@ -145,9 +145,9 @@ protected void onSaveInstanceState(Bundle outState) { @Override public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.audio_recorder, menu); + getMenuInflater().inflate(R.menu.aar_audio_recorder, menu); saveMenuItem = menu.findItem(R.id.action_save); - saveMenuItem.setIcon(getResources().getDrawable(R.drawable.ic_check)); + saveMenuItem.setIcon(getResources().getDrawable(R.drawable.aar_ic_check)); return super.onCreateOptionsMenu(menu); } @@ -219,7 +219,7 @@ public void restartRecording(View v){ saveMenuItem.setVisible(false); restartView.setVisibility(View.INVISIBLE); playView.setVisibility(View.INVISIBLE); - recordView.setImageResource(R.drawable.ic_rec); + recordView.setImageResource(R.drawable.aar_ic_rec); timerView.setText("00:00:00"); secondsElapsed = 0; } @@ -228,12 +228,12 @@ private void startRecording() { isRecording = true; saveMenuItem.setVisible(false); timerView.setText("00:00:00"); - statusView.setText(R.string.recording); + statusView.setText(R.string.aar_recording); statusView.setVisibility(View.VISIBLE); restartView.setVisibility(View.INVISIBLE); playView.setVisibility(View.INVISIBLE); - recordView.setImageResource(R.drawable.ic_stop); - playView.setImageResource(R.drawable.ic_play); + recordView.setImageResource(R.drawable.aar_ic_stop); + playView.setImageResource(R.drawable.aar_ic_play); visualizerHandler = new VisualizerHandler(); visualizerView.linkTo(visualizerHandler); @@ -256,8 +256,8 @@ private void stopRecording() { // TODO pause and restart recording before showing this button // restartView.setVisibility(View.VISIBLE); playView.setVisibility(View.VISIBLE); - recordView.setImageResource(R.drawable.ic_rec); - playView.setImageResource(R.drawable.ic_play); + recordView.setImageResource(R.drawable.aar_ic_rec); + playView.setImageResource(R.drawable.aar_ic_play); visualizerView.release(); @@ -289,9 +289,9 @@ public void run() { }); timerView.setText("00:00:00"); - statusView.setText(R.string.playing); + statusView.setText(R.string.aar_playing); statusView.setVisibility(View.VISIBLE); - playView.setImageResource(R.drawable.ic_pause); + playView.setImageResource(R.drawable.aar_ic_pause); startTimer(); } catch (Exception e){ @@ -302,7 +302,7 @@ public void run() { private void stopPlaying(){ statusView.setText(""); statusView.setVisibility(View.INVISIBLE); - playView.setImageResource(R.drawable.ic_play); + playView.setImageResource(R.drawable.aar_ic_play); if(player != null){ try { diff --git a/lib/src/main/res/drawable-hdpi/ic_check.png b/lib/src/main/res/drawable-hdpi/aar_ic_check.png similarity index 100% rename from lib/src/main/res/drawable-hdpi/ic_check.png rename to lib/src/main/res/drawable-hdpi/aar_ic_check.png diff --git a/lib/src/main/res/drawable-hdpi/ic_clear.png b/lib/src/main/res/drawable-hdpi/aar_ic_clear.png similarity index 100% rename from lib/src/main/res/drawable-hdpi/ic_clear.png rename to lib/src/main/res/drawable-hdpi/aar_ic_clear.png diff --git a/lib/src/main/res/drawable-mdpi/ic_check.png b/lib/src/main/res/drawable-mdpi/aar_ic_check.png similarity index 100% rename from lib/src/main/res/drawable-mdpi/ic_check.png rename to lib/src/main/res/drawable-mdpi/aar_ic_check.png diff --git a/lib/src/main/res/drawable-mdpi/ic_clear.png b/lib/src/main/res/drawable-mdpi/aar_ic_clear.png similarity index 100% rename from lib/src/main/res/drawable-mdpi/ic_clear.png rename to lib/src/main/res/drawable-mdpi/aar_ic_clear.png diff --git a/lib/src/main/res/drawable-xhdpi/ic_check.png b/lib/src/main/res/drawable-xhdpi/aar_ic_check.png similarity index 100% rename from lib/src/main/res/drawable-xhdpi/ic_check.png rename to lib/src/main/res/drawable-xhdpi/aar_ic_check.png diff --git a/lib/src/main/res/drawable-xhdpi/ic_clear.png b/lib/src/main/res/drawable-xhdpi/aar_ic_clear.png similarity index 100% rename from lib/src/main/res/drawable-xhdpi/ic_clear.png rename to lib/src/main/res/drawable-xhdpi/aar_ic_clear.png diff --git a/lib/src/main/res/drawable-xxhdpi/ic_check.png b/lib/src/main/res/drawable-xxhdpi/aar_ic_check.png similarity index 100% rename from lib/src/main/res/drawable-xxhdpi/ic_check.png rename to lib/src/main/res/drawable-xxhdpi/aar_ic_check.png diff --git a/lib/src/main/res/drawable-xxhdpi/ic_clear.png b/lib/src/main/res/drawable-xxhdpi/aar_ic_clear.png similarity index 100% rename from lib/src/main/res/drawable-xxhdpi/ic_clear.png rename to lib/src/main/res/drawable-xxhdpi/aar_ic_clear.png diff --git a/lib/src/main/res/drawable-xxxhdpi/ic_check.png b/lib/src/main/res/drawable-xxxhdpi/aar_ic_check.png similarity index 100% rename from lib/src/main/res/drawable-xxxhdpi/ic_check.png rename to lib/src/main/res/drawable-xxxhdpi/aar_ic_check.png diff --git a/lib/src/main/res/drawable-xxxhdpi/ic_clear.png b/lib/src/main/res/drawable-xxxhdpi/aar_ic_clear.png similarity index 100% rename from lib/src/main/res/drawable-xxxhdpi/ic_clear.png rename to lib/src/main/res/drawable-xxxhdpi/aar_ic_clear.png diff --git a/lib/src/main/res/drawable/ic_pause.png b/lib/src/main/res/drawable/aar_ic_pause.png similarity index 100% rename from lib/src/main/res/drawable/ic_pause.png rename to lib/src/main/res/drawable/aar_ic_pause.png diff --git a/lib/src/main/res/drawable/ic_play.png b/lib/src/main/res/drawable/aar_ic_play.png similarity index 100% rename from lib/src/main/res/drawable/ic_play.png rename to lib/src/main/res/drawable/aar_ic_play.png diff --git a/lib/src/main/res/drawable/ic_rec.png b/lib/src/main/res/drawable/aar_ic_rec.png similarity index 100% rename from lib/src/main/res/drawable/ic_rec.png rename to lib/src/main/res/drawable/aar_ic_rec.png diff --git a/lib/src/main/res/drawable/ic_restart.png b/lib/src/main/res/drawable/aar_ic_restart.png similarity index 100% rename from lib/src/main/res/drawable/ic_restart.png rename to lib/src/main/res/drawable/aar_ic_restart.png diff --git a/lib/src/main/res/drawable/ic_stop.png b/lib/src/main/res/drawable/aar_ic_stop.png similarity index 100% rename from lib/src/main/res/drawable/ic_stop.png rename to lib/src/main/res/drawable/aar_ic_stop.png diff --git a/lib/src/main/res/layout/activity_audio_recorder.xml b/lib/src/main/res/layout/aar_activity_audio_recorder.xml similarity index 93% rename from lib/src/main/res/layout/activity_audio_recorder.xml rename to lib/src/main/res/layout/aar_activity_audio_recorder.xml index fe7e712..da78e6e 100644 --- a/lib/src/main/res/layout/activity_audio_recorder.xml +++ b/lib/src/main/res/layout/aar_activity_audio_recorder.xml @@ -38,7 +38,7 @@ @@ -65,7 +65,7 @@ android:layout_margin="15dp" android:padding="10dp" android:scaleType="fitCenter" - android:src="@drawable/ic_rec" + android:src="@drawable/aar_ic_rec" android:onClick="toggleRecording" style="@style/Widget.AppCompat.Button.Borderless"/> @@ -79,7 +79,7 @@ android:layout_marginTop="50dp" android:padding="10dp" android:scaleType="fitCenter" - android:src="@drawable/ic_play" + android:src="@drawable/aar_ic_play" android:onClick="togglePlaying" style="@style/Widget.AppCompat.Button.Borderless"/> diff --git a/lib/src/main/res/menu/audio_recorder.xml b/lib/src/main/res/menu/aar_audio_recorder.xml similarity index 85% rename from lib/src/main/res/menu/audio_recorder.xml rename to lib/src/main/res/menu/aar_audio_recorder.xml index 95448a7..cdef0bc 100644 --- a/lib/src/main/res/menu/audio_recorder.xml +++ b/lib/src/main/res/menu/aar_audio_recorder.xml @@ -4,7 +4,7 @@ diff --git a/lib/src/main/res/values/dimens.xml b/lib/src/main/res/values/dimens.xml index 63fd275..5d77da5 100644 --- a/lib/src/main/res/values/dimens.xml +++ b/lib/src/main/res/values/dimens.xml @@ -1,6 +1,6 @@ - 60dp - 30dp - 200dp + 60dp + 30dp + 200dp \ No newline at end of file diff --git a/lib/src/main/res/values/strings.xml b/lib/src/main/res/values/strings.xml index 6a22cf0..53c5269 100644 --- a/lib/src/main/res/values/strings.xml +++ b/lib/src/main/res/values/strings.xml @@ -1,6 +1,6 @@ AndroidAudioRecorder - Save - Recording - Playing + Save + Recording + Playing \ No newline at end of file diff --git a/screenshots.png b/screenshots.png index 6e248a7..b1b2ed2 100644 Binary files a/screenshots.png and b/screenshots.png differ