Recording audio file is now supported.
This commit is contained in:
@@ -421,7 +421,8 @@ abstract class BaseChatActivity extends RuntimePermissionActivity implements Cha
|
||||
attachFromGalleryImageView.setVisibility(View.VISIBLE);
|
||||
|
||||
try {
|
||||
mMediaRecorder.stop(); // TODO: delete
|
||||
dialog.dismiss();
|
||||
mMediaRecorder.stop();
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -433,7 +434,6 @@ abstract class BaseChatActivity extends RuntimePermissionActivity implements Cha
|
||||
attachRecordAudioImageView.performClick();
|
||||
|
||||
final int x = (int) event.getRawX();
|
||||
int test = 0;
|
||||
|
||||
switch(event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
@@ -465,7 +465,11 @@ abstract class BaseChatActivity extends RuntimePermissionActivity implements Cha
|
||||
|
||||
countDownTimer.cancel();
|
||||
|
||||
mMediaRecorder.stop();
|
||||
try {
|
||||
mMediaRecorder.stop();
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Rect recordButtonRect = ViewUtils.getRectFromView(attachRecordAudioImageView);
|
||||
Rect abortButtonRect = ViewUtils.getRectFromView(abortRecordingImageView);
|
||||
@@ -473,6 +477,7 @@ abstract class BaseChatActivity extends RuntimePermissionActivity implements Cha
|
||||
if(recordButtonRect.intersect(abortButtonRect)) {
|
||||
if(!TextUtils.isEmpty(mAudioFilePath)) {
|
||||
File audioFile = new File(mAudioFilePath);
|
||||
|
||||
if(audioFile.exists()) {
|
||||
audioFile.delete();
|
||||
}
|
||||
@@ -504,16 +509,21 @@ abstract class BaseChatActivity extends RuntimePermissionActivity implements Cha
|
||||
|
||||
int newLeft = x - xDelta;
|
||||
|
||||
Log.d("ON_TOUCH", "new left margin: " + newLeft);
|
||||
|
||||
int buttonLeft = ViewUtils.getRectFromView(attachRecordAudioImageView).left;
|
||||
|
||||
if(buttonLeft > mDialogContainer.left && newLeft < mMaxMarginRight) {
|
||||
boolean isMovingToRight = layoutParams2.leftMargin > newLeft;
|
||||
boolean isMovingWithinBounds = buttonLeft > mDialogContainer.left && newLeft < mMaxMarginRight;
|
||||
|
||||
if(isMovingWithinBounds) {
|
||||
layoutParams2.leftMargin = newLeft;
|
||||
layoutParams2.rightMargin = 0;
|
||||
v.setLayoutParams(layoutParams2);
|
||||
|
||||
dialog.findViewById(R.id.dialogGridLayout).invalidate();
|
||||
|
||||
Log.d("ON_TOUCH", "button left: " + buttonLeft + "; newLeft: " + newLeft);
|
||||
} else {
|
||||
Log.d("ON_TOUCH", "not moving within bounds: buttonLeft: " + buttonLeft + "; left border: " + mDialogContainer.left);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user