diff --git a/src/conversations/res/menu/activity_rtp_session.xml b/src/conversations/res/menu/activity_rtp_session.xml
new file mode 100644
index 000000000..540a9def9
--- /dev/null
+++ b/src/conversations/res/menu/activity_rtp_session.xml
@@ -0,0 +1,11 @@
+
+
+
\ No newline at end of file
diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java
index 68a158d98..f22561722 100644
--- a/src/main/java/eu/siacs/conversations/Config.java
+++ b/src/main/java/eu/siacs/conversations/Config.java
@@ -1,6 +1,7 @@
package eu.siacs.conversations;
import android.graphics.Bitmap;
+import android.net.Uri;
import java.util.Collections;
import java.util.List;
@@ -35,6 +36,7 @@ public final class Config {
public static final String LOGTAG = BuildConfig.LOGTAG;
public static final Jid BUG_REPORTS = Jid.of("bugs@conversations.im");
+ public static final Uri HELP = Uri.parse("https://help.conversations.im");
public static final String DOMAIN_LOCK = null; //only allow account creation for this domain
diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java
index 848c447a1..a11f5b053 100644
--- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java
@@ -3,6 +3,7 @@ package eu.siacs.conversations.ui;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.PictureInPictureParams;
+import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -17,6 +18,8 @@ import android.support.annotation.RequiresApi;
import android.support.annotation.StringRes;
import android.util.Log;
import android.util.Rational;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;
@@ -81,6 +84,10 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
RtpEndUserState.CONNECTIVITY_LOST_ERROR,
RtpEndUserState.RETRACTED
);
+ private static final List STATES_SHOWING_HELP_BUTTON = Arrays.asList(
+ RtpEndUserState.APPLICATION_ERROR,
+ RtpEndUserState.CONNECTIVITY_ERROR
+ );
private static final String PROXIMITY_WAKE_LOCK_TAG = "conversations:in-rtp-session";
private static final int REQUEST_ACCEPT_CALL = 0x1111;
private WeakReference rtpConnectionReference;
@@ -124,6 +131,45 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
setSupportActionBar(binding.toolbar);
}
+ @Override
+ public boolean onCreateOptionsMenu(final Menu menu) {
+ getMenuInflater().inflate(R.menu.activity_rtp_session, menu);
+ final MenuItem help = menu.findItem(R.id.action_help);
+ help.setVisible(isHelpButtonVisible());
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ private boolean isHelpButtonVisible() {
+ try {
+ return STATES_SHOWING_HELP_BUTTON.contains(requireRtpConnection().getEndUserState());
+ } catch (IllegalStateException e) {
+ final Intent intent = getIntent();
+ final String state = intent != null ? intent.getStringExtra(EXTRA_LAST_REPORTED_STATE) : null;
+ if (state != null) {
+ return STATES_SHOWING_HELP_BUTTON.contains(RtpEndUserState.valueOf(state));
+ } else {
+ return false;
+ }
+ }
+ }
+
+ public boolean onOptionsItemSelected(final MenuItem item) {
+ if (item.getItemId() == R.id.action_help) {
+ launchHelpInBrowser();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ private void launchHelpInBrowser() {
+ final Intent intent = new Intent(Intent.ACTION_VIEW, Config.HELP);
+ try {
+ startActivity(intent);
+ } catch (final ActivityNotFoundException e) {
+ Toast.makeText(this, R.string.no_application_found_to_open_link, Toast.LENGTH_LONG).show();
+ }
+ }
+
private void endCall(View view) {
endCall();
}
@@ -302,6 +348,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
updateButtonConfiguration(state);
updateStateDisplay(state);
updateProfilePicture(state);
+ invalidateOptionsMenu();
}
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
}
@@ -456,11 +503,12 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
updateStateDisplay(currentState, media);
updateButtonConfiguration(currentState, media);
updateProfilePicture(currentState);
+ invalidateOptionsMenu();
return false;
}
private void initializeWithTerminatedSessionState(final Account account, final Jid with, final JingleConnectionManager.TerminatedRtpSession terminatedRtpSession) {
- Log.d(Config.LOGTAG,"initializeWithTerminatedSessionState()");
+ Log.d(Config.LOGTAG, "initializeWithTerminatedSessionState()");
if (terminatedRtpSession.state == RtpEndUserState.ENDED) {
finish();
return;
@@ -470,6 +518,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
updateButtonConfiguration(state);
updateStateDisplay(state);
updateProfilePicture(state);
+ updateCallDuration();
+ invalidateOptionsMenu();
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
}
@@ -956,6 +1006,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
updateButtonConfiguration(state, media);
updateVideoViews(state);
updateProfilePicture(state, contact);
+ invalidateOptionsMenu();
});
if (END_CARD.contains(state)) {
final JingleRtpConnection rtpConnection = requireRtpConnection();
@@ -1004,6 +1055,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
updateStateDisplay(state);
updateButtonConfiguration(state);
updateProfilePicture(state);
+ invalidateOptionsMenu();
});
resetIntent(account, with, state, actionToMedia(currentIntent.getAction()));
}
diff --git a/src/main/res/drawable-hdpi/ic_help_white_24dp.png b/src/main/res/drawable-hdpi/ic_help_white_24dp.png
new file mode 100644
index 000000000..5664f9532
Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_help_white_24dp.png differ
diff --git a/src/main/res/drawable-mdpi/ic_help_white_24dp.png b/src/main/res/drawable-mdpi/ic_help_white_24dp.png
new file mode 100644
index 000000000..db699622b
Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_help_white_24dp.png differ
diff --git a/src/main/res/drawable-xhdpi/ic_help_white_24dp.png b/src/main/res/drawable-xhdpi/ic_help_white_24dp.png
new file mode 100644
index 000000000..2d11cf47a
Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_help_white_24dp.png differ
diff --git a/src/main/res/drawable-xxhdpi/ic_help_white_24dp.png b/src/main/res/drawable-xxhdpi/ic_help_white_24dp.png
new file mode 100644
index 000000000..d49181785
Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_help_white_24dp.png differ
diff --git a/src/main/res/drawable-xxxhdpi/ic_help_white_24dp.png b/src/main/res/drawable-xxxhdpi/ic_help_white_24dp.png
new file mode 100644
index 000000000..8eb7241da
Binary files /dev/null and b/src/main/res/drawable-xxxhdpi/ic_help_white_24dp.png differ
diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml
index 48a4733b9..1f78fb09b 100644
--- a/src/main/res/values/attrs.xml
+++ b/src/main/res/values/attrs.xml
@@ -96,6 +96,7 @@
+
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index a6d951b56..75d839f0b 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -917,6 +917,7 @@
Missed call
Audio call
Video call
+ Help
Your microphone is unavailable
You can only have one call at a time.
Return to ongoing call
diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml
index 3a19be555..50262913f 100644
--- a/src/main/res/values/themes.xml
+++ b/src/main/res/values/themes.xml
@@ -114,6 +114,7 @@
- @drawable/ic_delete_black_24dp
- @drawable/ic_search_white_24dp
+ - @drawable/ic_help_white_24dp
- @drawable/ic_lock_open_white_24dp
- @drawable/ic_settings_black_24dp
- @drawable/ic_share_white_24dp
@@ -267,6 +268,7 @@
- @drawable/ic_delete_white_24dp
- @drawable/ic_search_white_24dp
+ - @drawable/ic_help_white_24dp
- @drawable/ic_lock_open_white_24dp
- @drawable/ic_settings_white_24dp
- @drawable/ic_share_white_24dp