Sending voice messages using 'Raise to speak' :-)

This commit is contained in:
B. Petersen
2017-03-03 19:20:25 +01:00
parent 10fcbdc81d
commit a7836eaded
8 changed files with 16 additions and 19 deletions
@@ -438,8 +438,17 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
{
// SEND AUDIO
int time_ms = 0;
if( params.get("mr_time_ms") != null ) {
time_ms = Integer.parseInt(params.get("mr_time_ms"));
if( params!=null && params.get("mr_time_ms") != null ) {
time_ms = Integer.parseInt(params.get("mr_time_ms")); // if possible, use a higher resolution
}
else {
for (int i = 0; i < document.attributes.size(); i++) {
TLRPC.DocumentAttribute a = document.attributes.get(i);
if (a instanceof TLRPC.TL_documentAttributeAudio) {
time_ms = a.duration * 1000;
break;
}
}
}
newMsg_id = mrChat.sendMedia(
@@ -1944,6 +1944,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
else if (id == NotificationCenter.messageSendError)
{
chatAdapter.notifyDataSetChanged();
AndroidUtilities.showErrorHint(getParentActivity());
}
else if (id == NotificationCenter.contactsDidLoaded)
{
@@ -98,7 +98,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
public SeekBarWaveformView(Context context) {
super(context);
seekBarWaveform = new SeekBarWaveform(context);
seekBarWaveform.setColors(0xffa2cef8, 0xffffffff, 0xffa2cef8);
seekBarWaveform.setColors(0xffffffff, Theme.MSG_AUDIO_SEEKBAR_DARK_COLOR, 0xffffffff);
seekBarWaveform.setDelegate(new SeekBar.SeekBarDelegate() {
@Override
public void onSeekBarDrag(float progress) {
@@ -915,21 +915,8 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
AnimatorSet.start();
}
private void sendMessage() {
if (parentFragment != null) {
String action;
TLRPC.Chat currentChat;
if ((int) dialog_id < 0) {
currentChat = MessagesController.getInstance().getChat(-(int) dialog_id);
/*if (currentChat != null && currentChat.participants_count > MessagesController.getInstance().groupBigSize) {
action = "bigchat_message";
} else*/ {
action = "chat_message";
}
} else {
action = "pm_message";
}
}
private void sendMessage()
{
if (audioToSend != null) {
MessageObject playing = MediaController.getInstance().getPlayingMessageObject();
if (playing != null && playing == audioToSendMessageObject) {
@@ -162,7 +162,7 @@ public class SeekBarWaveform {
float barCounter = 0;
int nextBarNum = 0;
paintInner.setColor(messageObject != null && !messageObject.isOutOwner() && messageObject.isContentUnread() && messageObject.messageOwner.to_id.channel_id == 0 ? outerColor : (selected ? selectedColor : innerColor));
paintInner.setColor(messageObject != null && !messageObject.isOutOwner() && messageObject.isContentUnread() ? outerColor : (selected ? selectedColor : innerColor));
paintOuter.setColor(outerColor);
int y = (height - AndroidUtilities.dp(14)) / 2;