Added ability to seek voice messages from player alert.
This commit is contained in:
@@ -216,7 +216,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;
|
||||
}
|
||||
@@ -634,7 +634,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);
|
||||
}
|
||||
}
|
||||
@@ -737,7 +737,9 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
repeatButton.setBackgroundDrawable(Theme.createSelectorDrawable(getThemedColor(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();
|
||||
@@ -835,7 +837,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) {
|
||||
@@ -923,7 +925,9 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
prevButton.setBackgroundDrawable(Theme.createSelectorDrawable(getThemedColor(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);
|
||||
@@ -1047,7 +1051,9 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
nextButton.setBackgroundDrawable(Theme.createSelectorDrawable(getThemedColor(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] = likeButton = new ImageView(context);
|
||||
@@ -1662,7 +1668,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) {
|
||||
@@ -1941,7 +1947,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) {
|
||||
|
||||
@@ -648,7 +648,7 @@ public class FragmentContextView extends FrameLayout implements NotificationCent
|
||||
if (currentStyle == STYLE_AUDIO_PLAYER) {
|
||||
MessageObject messageObject = MediaController.getInstance().getPlayingMessageObject();
|
||||
if (fragment != null && messageObject != null) {
|
||||
if (messageObject.isMusic()) {
|
||||
if (messageObject.isMusic() || messageObject.isVoice()) {
|
||||
if (getContext() instanceof LaunchActivity) {
|
||||
fragment.showDialog(new AudioPlayerAlert(getContext(), resourcesProvider));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user