Improve encryption UI.
This commit is contained in:
parent
bba107f83d
commit
9f99d61a1f
9 changed files with 79 additions and 6 deletions
BIN
res/drawable/conf_not_secured.png
Normal file
BIN
res/drawable/conf_not_secured.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 873 B |
BIN
res/drawable/conf_secured.png
Normal file
BIN
res/drawable/conf_secured.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 838 B |
|
@ -33,6 +33,8 @@
|
||||||
<TextView android:id="@+id/status_label" style="@style/callee_status" />
|
<TextView android:id="@+id/status_label" style="@style/callee_status" />
|
||||||
<ImageView android:id="@+id/callee_status_paused" style="@style/callee_status" android:src="@drawable/conf_status_paused" />
|
<ImageView android:id="@+id/callee_status_paused" style="@style/callee_status" android:src="@drawable/conf_status_paused" />
|
||||||
<ImageView android:id="@+id/callee_status_inconf" style="@style/callee_status" android:src="@drawable/conf_status_inconf"/>
|
<ImageView android:id="@+id/callee_status_inconf" style="@style/callee_status" android:src="@drawable/conf_status_inconf"/>
|
||||||
|
<ImageView android:id="@+id/callee_status_secured" style="@style/callee_status" android:src="@drawable/conf_secured" android:visibility="gone"/>
|
||||||
|
<ImageView android:id="@+id/callee_status_not_secured" style="@style/callee_status" android:src="@drawable/conf_not_secured" android:visibility="gone"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,4 +39,9 @@
|
||||||
android:src="@drawable/conf_status_paused" />
|
android:src="@drawable/conf_status_paused" />
|
||||||
<ImageView android:id="@+id/callee_status_inconf" style="@style/callee_status"
|
<ImageView android:id="@+id/callee_status_inconf" style="@style/callee_status"
|
||||||
android:src="@drawable/conf_status_inconf" />
|
android:src="@drawable/conf_status_inconf" />
|
||||||
|
|
||||||
|
<ImageView android:id="@+id/callee_status_secured" style="@style/callee_status"
|
||||||
|
android:src="@drawable/conf_secured" android:visibility="gone"/>
|
||||||
|
<ImageView android:id="@+id/callee_status_not_secured" style="@style/callee_status"
|
||||||
|
android:src="@drawable/conf_not_secured" android:visibility="gone"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -63,5 +63,17 @@
|
||||||
<TextView android:text="@string/conf_choice_terminate" android:layout_gravity="center_vertical"
|
<TextView android:text="@string/conf_choice_terminate" android:layout_gravity="center_vertical"
|
||||||
android:layout_width="wrap_content" android:layout_height="wrap_content" />
|
android:layout_width="wrap_content" android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/encrypted" android:visibility="gone"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content">
|
||||||
|
<ImageView android:src="@drawable/conf_secured" android:layout_width="wrap_content" android:layout_height="wrap_content" />
|
||||||
|
<TextView android:id="@+id/authentication_token" android:layout_width="wrap_content" android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout android:id="@+id/unencrypted" android:visibility="gone"
|
||||||
|
android:layout_width="fill_parent" android:layout_height="wrap_content">
|
||||||
|
<ImageView android:src="@drawable/conf_not_secured" android:layout_width="wrap_content" android:layout_height="wrap_content" />
|
||||||
|
<TextView android:text="@string/not_encrypted" android:layout_width="wrap_content" android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
|
@ -1,6 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
|
<string name="authenticationTokenFormat">Authentication token is %s</string>
|
||||||
|
<string name="not_encrypted">Communication not encrypted</string>
|
||||||
|
|
||||||
<string name="waiting_for_startup">Starting up...</string>
|
<string name="waiting_for_startup">Starting up...</string>
|
||||||
<string name="couldnt_accept_call">An error occurred while accepting call</string>
|
<string name="couldnt_accept_call">An error occurred while accepting call</string>
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.linphone.LinphoneManagerWaitHelper.LinphoneManagerReadyListener;
|
import org.linphone.LinphoneManagerWaitHelper.LinphoneManagerReadyListener;
|
||||||
import org.linphone.LinphoneSimpleListener.LinphoneOnAudioChangedListener;
|
import org.linphone.LinphoneSimpleListener.LinphoneOnAudioChangedListener;
|
||||||
|
import org.linphone.LinphoneSimpleListener.LinphoneOnCallEncryptionChangedListener;
|
||||||
import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
|
import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
|
||||||
import org.linphone.LinphoneSimpleListener.LinphoneOnVideoCallReadyListener;
|
import org.linphone.LinphoneSimpleListener.LinphoneOnVideoCallReadyListener;
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
|
@ -69,6 +70,7 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
LinphoneOnAudioChangedListener,
|
LinphoneOnAudioChangedListener,
|
||||||
LinphoneOnVideoCallReadyListener,
|
LinphoneOnVideoCallReadyListener,
|
||||||
LinphoneOnCallStateChangedListener,
|
LinphoneOnCallStateChangedListener,
|
||||||
|
LinphoneOnCallEncryptionChangedListener,
|
||||||
Comparator<LinphoneCall>,
|
Comparator<LinphoneCall>,
|
||||||
OnClickListener {
|
OnClickListener {
|
||||||
|
|
||||||
|
@ -572,7 +574,8 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
LinphoneAddress address = call.getRemoteAddress();
|
LinphoneAddress address = call.getRemoteAddress();
|
||||||
String mainText = address.getDisplayName();
|
String mainText = address.getDisplayName();
|
||||||
String complText = address.getUserName();
|
String complText = address.getUserName();
|
||||||
if ((getResources().getBoolean(R.bool.show_full_remote_address_on_incoming_call))) {
|
if (Version.sdkAboveOrEqual(Version.API05_ECLAIR_20)
|
||||||
|
&& getResources().getBoolean(R.bool.show_full_remote_address_on_incoming_call)) {
|
||||||
complText += "@" + address.getDomain();
|
complText += "@" + address.getDomain();
|
||||||
}
|
}
|
||||||
TextView mainTextView = (TextView) v.findViewById(R.id.name);
|
TextView mainTextView = (TextView) v.findViewById(R.id.name);
|
||||||
|
@ -654,6 +657,16 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
removeFromConfButton.setOnClickListener(l);
|
removeFromConfButton.setOnClickListener(l);
|
||||||
addVideoButton.setOnClickListener(l);
|
addVideoButton.setOnClickListener(l);
|
||||||
|
|
||||||
|
if (Version.hasZrtp()) {
|
||||||
|
if (call.areStreamsEncrypted()) {
|
||||||
|
setVisibility(v, R.id.callee_status_secured, true);
|
||||||
|
setVisibility(v, R.id.callee_status_not_secured, false);
|
||||||
|
} else {
|
||||||
|
setVisibility(v, R.id.callee_status_secured, false);
|
||||||
|
setVisibility(v, R.id.callee_status_not_secured, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
v.setOnClickListener(new OnClickListener() {
|
v.setOnClickListener(new OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
View content = getLayoutInflater().inflate(R.layout.conf_choices_dialog, null);
|
View content = getLayoutInflater().inflate(R.layout.conf_choices_dialog, null);
|
||||||
|
@ -666,6 +679,20 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
enableView(content, R.id.pause, l,!isInConference && showPause);
|
enableView(content, R.id.pause, l,!isInConference && showPause);
|
||||||
enableView(content, R.id.resume, l, !isInConference && showResume);
|
enableView(content, R.id.resume, l, !isInConference && showResume);
|
||||||
enableView(content, R.id.terminate_call, l, true);
|
enableView(content, R.id.terminate_call, l, true);
|
||||||
|
|
||||||
|
if (Version.hasZrtp()) {
|
||||||
|
if (call.areStreamsEncrypted()) {
|
||||||
|
setVisibility(content, R.id.encrypted, true);
|
||||||
|
setVisibility(content, R.id.unencrypted, false);
|
||||||
|
TextView token = (TextView) content.findViewById(R.id.authentication_token);
|
||||||
|
String fmt = getString(R.string.authenticationTokenFormat);
|
||||||
|
token.setText(String.format(fmt, call.getAuthenticationToken()));
|
||||||
|
} else {
|
||||||
|
setVisibility(content, R.id.encrypted, false);
|
||||||
|
setVisibility(content, R.id.unencrypted, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -680,6 +707,7 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
pictureView.setVisibility(GONE);
|
pictureView.setVisibility(GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -882,6 +910,17 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
LinphoneActivity.instance().startVideoActivity();
|
LinphoneActivity.instance().startVideoActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCallEncryptionChanged(LinphoneCall call, boolean encrypted,
|
||||||
|
String authenticationToken) {
|
||||||
|
mHandler.post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
CalleeListAdapter adapter = (CalleeListAdapter) getListAdapter();
|
||||||
|
recreateActivity(adapter);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* public int compare(LinphoneCall c1, LinphoneCall c2) { if (c1 == c2)
|
* public int compare(LinphoneCall c1, LinphoneCall c2) { if (c1 == c2)
|
||||||
* return 0;
|
* return 0;
|
||||||
|
|
|
@ -1135,7 +1135,12 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
||||||
|
|
||||||
public void onCallEncryptionChanged(LinphoneCall call,
|
public void onCallEncryptionChanged(LinphoneCall call,
|
||||||
boolean encrypted, String authenticationToken) {
|
boolean encrypted, String authenticationToken) {
|
||||||
if (serviceListener != null) serviceListener.onCallEncryptionChanged(call, encrypted, authenticationToken);
|
if (serviceListener != null) {
|
||||||
|
serviceListener.onCallEncryptionChanged(call, encrypted, authenticationToken);
|
||||||
|
}
|
||||||
|
for (LinphoneOnCallEncryptionChangedListener l : getSimpleListeners(LinphoneOnCallEncryptionChangedListener.class)) {
|
||||||
|
l.onCallEncryptionChanged(call, encrypted, authenticationToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCallStateChanged(LinphoneCall call, State state,
|
public void onCallStateChanged(LinphoneCall call, State state,
|
||||||
|
|
|
@ -27,19 +27,26 @@ import android.media.MediaPlayer;
|
||||||
|
|
||||||
public interface LinphoneSimpleListener {
|
public interface LinphoneSimpleListener {
|
||||||
|
|
||||||
public static interface LinphoneServiceListener
|
public static interface LinphoneServiceListener extends
|
||||||
extends LinphoneOnGlobalStateChangedListener, LinphoneOnCallStateChangedListener {
|
LinphoneOnGlobalStateChangedListener,
|
||||||
|
LinphoneOnCallStateChangedListener,
|
||||||
|
LinphoneOnCallEncryptionChangedListener
|
||||||
|
{
|
||||||
void tryingNewOutgoingCallButCannotGetCallParameters();
|
void tryingNewOutgoingCallButCannotGetCallParameters();
|
||||||
void tryingNewOutgoingCallButWrongDestinationAddress();
|
void tryingNewOutgoingCallButWrongDestinationAddress();
|
||||||
void tryingNewOutgoingCallButAlreadyInCall();
|
void tryingNewOutgoingCallButAlreadyInCall();
|
||||||
void onRegistrationStateChanged(RegistrationState state, String message);
|
void onRegistrationStateChanged(RegistrationState state, String message);
|
||||||
void onRingerPlayerCreated(MediaPlayer mRingerPlayer);
|
void onRingerPlayerCreated(MediaPlayer mRingerPlayer);
|
||||||
void onDisplayStatus(String message);
|
void onDisplayStatus(String message);
|
||||||
void onCallEncryptionChanged(LinphoneCall call, boolean encrypted, String authenticationToken);
|
|
||||||
void onAlreadyInVideoCall();
|
void onAlreadyInVideoCall();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static interface LinphoneOnCallEncryptionChangedListener extends LinphoneSimpleListener {
|
||||||
|
void onCallEncryptionChanged(LinphoneCall call, boolean encrypted, String authenticationToken);
|
||||||
|
}
|
||||||
|
|
||||||
public static interface LinphoneOnGlobalStateChangedListener extends LinphoneSimpleListener {
|
public static interface LinphoneOnGlobalStateChangedListener extends LinphoneSimpleListener {
|
||||||
void onGlobalStateChanged(GlobalState state, String message);
|
void onGlobalStateChanged(GlobalState state, String message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue