Skip to content

Commit

Permalink
0.0.6
Browse files Browse the repository at this point in the history
Refactoring resources
  • Loading branch information
adrielcafe committed Aug 18, 2016
1 parent aa4fd8a commit ac190da
Show file tree
Hide file tree
Showing 24 changed files with 35 additions and 34 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -51,16 +51,17 @@ repositories {
}
dependencies {
compile 'com.github.adrielcafe:AndroidAudioRecorder:0.0.5'
compile 'com.github.adrielcafe:AndroidAudioRecorder:0.0.6'
}
```

## TODO
- [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)
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>

<color name="recorder_bg">#039BE5</color>
<color name="recorder_bg">#7E57C2</color>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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})
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
Expand All @@ -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();

Expand Down Expand Up @@ -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){
Expand All @@ -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 {
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/footer_height"
android:layout_height="@dimen/aar_footer_height"
android:layout_alignParentBottom="true">

<ImageButton
Expand All @@ -51,7 +51,7 @@
android:layout_marginTop="50dp"
android:padding="10dp"
android:scaleType="fitCenter"
android:src="@drawable/ic_restart"
android:src="@drawable/aar_ic_restart"
android:onClick="restartRecording"
android:visibility="invisible"
style="@style/Widget.AppCompat.Button.Borderless"/>
Expand All @@ -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"/>

Expand All @@ -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"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<item
android:id="@+id/action_save"
android:title="@string/save"
android:title="@string/aar_save"
android:visible="false"
app:showAsAction="always"/>

Expand Down
6 changes: 3 additions & 3 deletions lib/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="wave_height">60dp</dimen>
<dimen name="bubble_size">30dp</dimen>
<dimen name="footer_height">200dp</dimen>
<dimen name="aar_wave_height">60dp</dimen>
<dimen name="aar_bubble_size">30dp</dimen>
<dimen name="aar_footer_height">200dp</dimen>
</resources>
6 changes: 3 additions & 3 deletions lib/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="app_name" translatable="false">AndroidAudioRecorder</string>
<string name="save">Save</string>
<string name="recording">Recording</string>
<string name="playing">Playing</string>
<string name="aar_save">Save</string>
<string name="aar_recording">Recording</string>
<string name="aar_playing">Playing</string>
</resources>
Binary file modified screenshots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ac190da

Please sign in to comment.