show help button on certain error conditions in RTP session. fixes #3770
This commit is contained in:
parent
644ad99520
commit
b7f3b4333e
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_help"
|
||||||
|
android:icon="?attr/icon_help"
|
||||||
|
android:title="@string/help"
|
||||||
|
app:showAsAction="always"/>
|
||||||
|
</menu>
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.siacs.conversations;
|
package eu.siacs.conversations;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -35,6 +36,7 @@ public final class Config {
|
||||||
public static final String LOGTAG = BuildConfig.LOGTAG;
|
public static final String LOGTAG = BuildConfig.LOGTAG;
|
||||||
|
|
||||||
public static final Jid BUG_REPORTS = Jid.of("bugs@conversations.im");
|
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
|
public static final String DOMAIN_LOCK = null; //only allow account creation for this domain
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.siacs.conversations.ui;
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.PictureInPictureParams;
|
import android.app.PictureInPictureParams;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
@ -17,6 +18,8 @@ import android.support.annotation.RequiresApi;
|
||||||
import android.support.annotation.StringRes;
|
import android.support.annotation.StringRes;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Rational;
|
import android.util.Rational;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -81,6 +84,10 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
RtpEndUserState.CONNECTIVITY_LOST_ERROR,
|
RtpEndUserState.CONNECTIVITY_LOST_ERROR,
|
||||||
RtpEndUserState.RETRACTED
|
RtpEndUserState.RETRACTED
|
||||||
);
|
);
|
||||||
|
private static final List<RtpEndUserState> 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 String PROXIMITY_WAKE_LOCK_TAG = "conversations:in-rtp-session";
|
||||||
private static final int REQUEST_ACCEPT_CALL = 0x1111;
|
private static final int REQUEST_ACCEPT_CALL = 0x1111;
|
||||||
private WeakReference<JingleRtpConnection> rtpConnectionReference;
|
private WeakReference<JingleRtpConnection> rtpConnectionReference;
|
||||||
|
@ -124,6 +131,45 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
setSupportActionBar(binding.toolbar);
|
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) {
|
private void endCall(View view) {
|
||||||
endCall();
|
endCall();
|
||||||
}
|
}
|
||||||
|
@ -302,6 +348,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
updateButtonConfiguration(state);
|
updateButtonConfiguration(state);
|
||||||
updateStateDisplay(state);
|
updateStateDisplay(state);
|
||||||
updateProfilePicture(state);
|
updateProfilePicture(state);
|
||||||
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
|
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
|
||||||
}
|
}
|
||||||
|
@ -456,11 +503,12 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
updateStateDisplay(currentState, media);
|
updateStateDisplay(currentState, media);
|
||||||
updateButtonConfiguration(currentState, media);
|
updateButtonConfiguration(currentState, media);
|
||||||
updateProfilePicture(currentState);
|
updateProfilePicture(currentState);
|
||||||
|
invalidateOptionsMenu();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeWithTerminatedSessionState(final Account account, final Jid with, final JingleConnectionManager.TerminatedRtpSession terminatedRtpSession) {
|
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) {
|
if (terminatedRtpSession.state == RtpEndUserState.ENDED) {
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
|
@ -470,6 +518,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
updateButtonConfiguration(state);
|
updateButtonConfiguration(state);
|
||||||
updateStateDisplay(state);
|
updateStateDisplay(state);
|
||||||
updateProfilePicture(state);
|
updateProfilePicture(state);
|
||||||
|
updateCallDuration();
|
||||||
|
invalidateOptionsMenu();
|
||||||
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
|
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -956,6 +1006,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
updateButtonConfiguration(state, media);
|
updateButtonConfiguration(state, media);
|
||||||
updateVideoViews(state);
|
updateVideoViews(state);
|
||||||
updateProfilePicture(state, contact);
|
updateProfilePicture(state, contact);
|
||||||
|
invalidateOptionsMenu();
|
||||||
});
|
});
|
||||||
if (END_CARD.contains(state)) {
|
if (END_CARD.contains(state)) {
|
||||||
final JingleRtpConnection rtpConnection = requireRtpConnection();
|
final JingleRtpConnection rtpConnection = requireRtpConnection();
|
||||||
|
@ -1004,6 +1055,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
updateStateDisplay(state);
|
updateStateDisplay(state);
|
||||||
updateButtonConfiguration(state);
|
updateButtonConfiguration(state);
|
||||||
updateProfilePicture(state);
|
updateProfilePicture(state);
|
||||||
|
invalidateOptionsMenu();
|
||||||
});
|
});
|
||||||
resetIntent(account, with, state, actionToMedia(currentIntent.getAction()));
|
resetIntent(account, with, state, actionToMedia(currentIntent.getAction()));
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 476 B |
Binary file not shown.
After Width: | Height: | Size: 304 B |
Binary file not shown.
After Width: | Height: | Size: 585 B |
Binary file not shown.
After Width: | Height: | Size: 842 B |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -96,6 +96,7 @@
|
||||||
<attr name="icon_refresh" format="reference" />
|
<attr name="icon_refresh" format="reference" />
|
||||||
<attr name="icon_remove" format="reference" />
|
<attr name="icon_remove" format="reference" />
|
||||||
<attr name="icon_search" format="reference" />
|
<attr name="icon_search" format="reference" />
|
||||||
|
<attr name="icon_help" format="reference" />
|
||||||
<attr name="icon_secure" format="reference" />
|
<attr name="icon_secure" format="reference" />
|
||||||
<attr name="icon_settings" format="reference" />
|
<attr name="icon_settings" format="reference" />
|
||||||
<attr name="icon_share" format="reference" />
|
<attr name="icon_share" format="reference" />
|
||||||
|
|
|
@ -917,6 +917,7 @@
|
||||||
<string name="missed_call">Missed call</string>
|
<string name="missed_call">Missed call</string>
|
||||||
<string name="audio_call">Audio call</string>
|
<string name="audio_call">Audio call</string>
|
||||||
<string name="video_call">Video call</string>
|
<string name="video_call">Video call</string>
|
||||||
|
<string name="help">Help</string>
|
||||||
<string name="microphone_unavailable">Your microphone is unavailable</string>
|
<string name="microphone_unavailable">Your microphone is unavailable</string>
|
||||||
<string name="only_one_call_at_a_time">You can only have one call at a time.</string>
|
<string name="only_one_call_at_a_time">You can only have one call at a time.</string>
|
||||||
<string name="return_to_ongoing_call">Return to ongoing call</string>
|
<string name="return_to_ongoing_call">Return to ongoing call</string>
|
||||||
|
|
|
@ -114,6 +114,7 @@
|
||||||
</item>
|
</item>
|
||||||
<item name="icon_remove" type="reference">@drawable/ic_delete_black_24dp</item>
|
<item name="icon_remove" type="reference">@drawable/ic_delete_black_24dp</item>
|
||||||
<item name="icon_search" type="reference">@drawable/ic_search_white_24dp</item>
|
<item name="icon_search" type="reference">@drawable/ic_search_white_24dp</item>
|
||||||
|
<item name="icon_help" type="reference">@drawable/ic_help_white_24dp</item>
|
||||||
<item name="icon_secure" type="reference">@drawable/ic_lock_open_white_24dp</item>
|
<item name="icon_secure" type="reference">@drawable/ic_lock_open_white_24dp</item>
|
||||||
<item name="icon_settings" type="reference">@drawable/ic_settings_black_24dp</item>
|
<item name="icon_settings" type="reference">@drawable/ic_settings_black_24dp</item>
|
||||||
<item name="icon_share" type="reference">@drawable/ic_share_white_24dp</item>
|
<item name="icon_share" type="reference">@drawable/ic_share_white_24dp</item>
|
||||||
|
@ -267,6 +268,7 @@
|
||||||
</item>
|
</item>
|
||||||
<item name="icon_remove" type="reference">@drawable/ic_delete_white_24dp</item>
|
<item name="icon_remove" type="reference">@drawable/ic_delete_white_24dp</item>
|
||||||
<item name="icon_search" type="reference">@drawable/ic_search_white_24dp</item>
|
<item name="icon_search" type="reference">@drawable/ic_search_white_24dp</item>
|
||||||
|
<item name="icon_help" type="reference">@drawable/ic_help_white_24dp</item>
|
||||||
<item name="icon_secure" type="reference">@drawable/ic_lock_open_white_24dp</item>
|
<item name="icon_secure" type="reference">@drawable/ic_lock_open_white_24dp</item>
|
||||||
<item name="icon_settings" type="reference">@drawable/ic_settings_white_24dp</item>
|
<item name="icon_settings" type="reference">@drawable/ic_settings_white_24dp</item>
|
||||||
<item name="icon_share" type="reference">@drawable/ic_share_white_24dp</item>
|
<item name="icon_share" type="reference">@drawable/ic_share_white_24dp</item>
|
||||||
|
|
Loading…
Reference in New Issue