Hide exit button from statusbar while in call

This commit is contained in:
Sylvain Berfini 2012-07-19 17:01:22 +02:00
parent dd85cada65
commit a3931bf307
4 changed files with 11 additions and 10 deletions

View file

@ -548,7 +548,7 @@ public class InCallActivity extends FragmentActivity implements
public void onCallEncryptionChanged(LinphoneCall call, boolean encrypted,
String authenticationToken) {
if (status != null) {
status.refreshEncryptionIcon();
status.refreshStatusItems();
}
}

View file

@ -969,7 +969,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
}
if (state == IncomingReceived || (state == state.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) {
if (state == IncomingReceived || (state == State.CallIncomingEarlyMedia && mR.getBoolean(R.bool.allow_ringing_while_early_media))) {
// Brighten screen for at least 10 seconds
WakeLock wl = mPowerManager.newWakeLock(
PowerManager.ACQUIRE_CAUSES_WAKEUP

View file

@ -40,7 +40,7 @@ public class StatusFragment extends Fragment {
private static StatusFragment instance;
private Handler mHandler = new Handler();
private Handler refreshHandler = new Handler();
private TextView statusText;
private TextView statusText, exit;
private ImageView statusLed, callQuality, encryption;
private SlidingDrawer drawer;
private Runnable mCallQualityUpdater;
@ -58,7 +58,8 @@ public class StatusFragment extends Fragment {
encryption = (ImageView) view.findViewById(R.id.encryption);
drawer = (SlidingDrawer) view.findViewById(R.id.statusBar);
view.findViewById(R.id.exit).setOnClickListener(new OnClickListener() {
exit = (TextView) view.findViewById(R.id.exit);
exit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
LinphoneActivity.instance().exit();
@ -191,7 +192,7 @@ public class StatusFragment extends Fragment {
if (isInCall) {
startCallQuality();
refreshEncryptionIcon();
refreshStatusItems();
// We are obviously connected
statusLed.setImageResource(R.drawable.led_connected);
@ -219,11 +220,12 @@ public class StatusFragment extends Fragment {
}
}
public void refreshEncryptionIcon() {
public void refreshStatusItems() {
LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
if (call != null && encryption != null) {
MediaEncryption mediaEncryption = call.getCurrentParamsCopy().getMediaEncryption();
exit.setVisibility(View.GONE);
encryption.setVisibility(View.VISIBLE);
if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.isAuthenticationTokenVerified())) {
@ -233,6 +235,8 @@ public class StatusFragment extends Fragment {
} else {
encryption.setImageResource(R.drawable.security_ko);
}
} else {
exit.setVisibility(View.VISIBLE);
}
}
}

View file

@ -8,7 +8,6 @@ import java.util.Set;
import org.linphone.Contact;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.Log;
import org.linphone.mediastream.Version;
import android.annotation.TargetApi;
@ -137,7 +136,6 @@ public class ApiFivePlus {
return list;
}
@TargetApi(11)
public static Cursor getContactsCursor(ContentResolver cr) {
String req = Data.MIMETYPE + " = '" + CommonDataKinds.Phone.CONTENT_ITEM_TYPE
+ "' AND " + CommonDataKinds.Phone.NUMBER + " IS NOT NULL";
@ -261,7 +259,6 @@ public class ApiFivePlus {
String username = address.getUserName();
String domain = address.getDomain();
String sipUri = username + "@" + domain;
Log.e("Looking for " + sipUri);
Cursor cursor = getSIPContactCursor(cr, sipUri);
Contact contact = getContact(cr, cursor, 0);