1
0
mirror of https://github.com/MGislv/NekoX.git synced 2024-07-04 11:13:36 +00:00

Added ability to seek voice messages from player alert

(cherry picked from commit cedb04c644f666a8ff910e956f6b99b18058e3ba)
This commit is contained in:
23rd 2021-02-07 05:13:57 +03:00 committed by 世界
parent 2b7a6229fc
commit 2dd69697cb
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
2 changed files with 12 additions and 6 deletions

View File

@ -199,7 +199,7 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
}
rewindingProgress = currentProgress;
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
if (messageObject != null && messageObject.isMusic()) {
if (messageObject != null && (messageObject.isMusic() || messageObject.isVoice())) {
if (!MediaController.getInstance().isMessagePaused()) {
MediaController.getInstance().getPlayingMessageObject().audioProgress = rewindingProgress;
}
@ -622,7 +622,7 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
MediaController.getInstance().seekToProgress(MediaController.getInstance().getPlayingMessageObject(), progress);
}
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
if (messageObject != null && messageObject.isMusic()) {
if (messageObject != null && (messageObject.isMusic() || messageObject.isVoice())) {
updateProgress(messageObject);
}
}
@ -701,7 +701,9 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
if (Build.VERSION.SDK_INT >= 21) {
repeatButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_listSelector), 1, AndroidUtilities.dp(18)));
}
if (!messageObject.isVoice()) {
bottomView.addView(repeatButton, LayoutHelper.createFrame(48, 48, Gravity.LEFT | Gravity.TOP));
}
repeatButton.setOnClickListener(v -> {
updateSubMenu();
repeatButton.toggleSubMenu();
@ -799,7 +801,7 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
}
rewindingProgress = currentProgress;
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
if (messageObject != null && messageObject.isMusic()) {
if (messageObject != null && (messageObject.isMusic() || messageObject.isVoice())) {
updateProgress(messageObject);
}
if (rewindingState == -1 && pressedCount > 0) {
@ -881,7 +883,9 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
if (Build.VERSION.SDK_INT >= 21) {
prevButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_listSelector), 1, AndroidUtilities.dp(22)));
}
if (!messageObject.isVoice()) {
bottomView.addView(prevButton, LayoutHelper.createFrame(48, 48, Gravity.LEFT | Gravity.TOP));
}
prevButton.setContentDescription(LocaleController.getString("AccDescrPrevious", R.string.AccDescrPrevious));
buttons[2] = playButton = new ImageView(context);
@ -999,7 +1003,9 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
if (Build.VERSION.SDK_INT >= 21) {
nextButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_listSelector), 1, AndroidUtilities.dp(22)));
}
if (!messageObject.isVoice()) {
bottomView.addView(nextButton, LayoutHelper.createFrame(48, 48, Gravity.LEFT | Gravity.TOP));
}
nextButton.setContentDescription(LocaleController.getString("Next", R.string.Next));
buttons[4] = optionsButton = new ActionBarMenuItem(context, null, 0, iconColor);
@ -1528,7 +1534,7 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
}
} else if (id == NotificationCenter.messagePlayingProgressDidChanged) {
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
if (messageObject != null && messageObject.isMusic()) {
if (messageObject != null && (messageObject.isMusic() || messageObject.isVoice())) {
updateProgress(messageObject);
}
} else if (id == NotificationCenter.musicDidLoad) {
@ -1807,7 +1813,7 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
private void updateTitle(boolean shutdown) {
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
if (messageObject == null && shutdown || messageObject != null && !messageObject.isMusic()) {
if (messageObject == null && shutdown || messageObject != null && !(messageObject.isMusic() || messageObject.isVoice())) {
dismiss();
} else {
if (messageObject == null) {

View File

@ -478,7 +478,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
if (currentStyle == 0) {
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
if (fragment != null && messageObject != null) {
if (messageObject.isMusic()) {
if (messageObject.isMusic() || messageObject.isVoice()) {
fragment.showDialog(new AudioPlayerAlert(getContext()));
} else {
long dialog_id = 0;