aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-04-01 23:57:00 +0200
committerChristian Schneppe <christian@pix-art.de>2018-04-01 23:57:00 +0200
commitca16b910e14f269d4def0d6c57f966b981bf8759 (patch)
tree9fce5b3b1ee55457b46cded902f8ba946053cf8e /src/main/java/de/pixart/messenger/ui
parentd423752b17cb9b30d5c7606689b863a2b4153f89 (diff)
audio player now requests permission when hitting play
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationActivity.java4
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java7
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java10
3 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
index 53f3b0a14..adfbde7c7 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
@@ -99,6 +99,7 @@ public class ConversationActivity extends XmppActivity implements OnConversation
public static final String EXTRA_IS_PRIVATE_MESSAGE = "pm";
public static final String ACTION_DESTROY_MUC = "de.pixart.messenger.DESTROY_MUC";
public static final int REQUEST_OPEN_MESSAGE = 0x9876;
+ public static final int REQUEST_PLAY_PAUSE = 0x5432;
private boolean showLastSeen = false;
@@ -350,6 +351,9 @@ public class ConversationActivity extends XmppActivity implements OnConversation
refreshUiReal();
ConversationFragment.openPendingMessage(this);
break;
+ case REQUEST_PLAY_PAUSE:
+ ConversationFragment.startStopPending(this);
+ break;
}
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index ef2910ab3..9425a4eb5 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -478,6 +478,13 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
return null;
}
+ public static void startStopPending(Activity activity) {
+ ConversationFragment fragment = findConversationFragment(activity);
+ if (fragment != null) {
+ fragment.messageListAdapter.startStopPending();
+ }
+ }
+
public static void downloadFile(Activity activity, Message message) {
ConversationFragment fragment = findConversationFragment(activity);
if (fragment != null) {
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
index 37dd32b4c..9f09531e1 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -1,6 +1,7 @@
package de.pixart.messenger.ui.adapter;
import android.Manifest;
+import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -71,6 +72,7 @@ import de.pixart.messenger.persistance.FileBackend;
import de.pixart.messenger.services.AudioPlayer;
import de.pixart.messenger.services.MessageArchiveService;
import de.pixart.messenger.services.NotificationService;
+import de.pixart.messenger.ui.ConversationActivity;
import de.pixart.messenger.ui.ConversationFragment;
import de.pixart.messenger.ui.ShowFullscreenMessageActivity;
import de.pixart.messenger.ui.XmppActivity;
@@ -197,6 +199,10 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
this.mOnContactPictureLongClickedListener = listener;
}
+ public Activity getActivity() {
+ return activity;
+ }
+
public void setOnQuoteListener(OnQuoteListener listener) {
this.onQuoteListener = listener;
}
@@ -1058,6 +1064,10 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
audioPlayer.stop();
}
+ public void startStopPending() {
+ audioPlayer.startStopPending();
+ }
+
public void openDownloadable(Message message) {
if (ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ConversationFragment.registerPendingMessage(activity, message);