render contact’s avatar during incoming call
This commit is contained in:
parent
187dff3df9
commit
23d1ee5e41
|
@ -37,6 +37,7 @@ import eu.siacs.conversations.entities.Account;
|
||||||
import eu.siacs.conversations.entities.Contact;
|
import eu.siacs.conversations.entities.Contact;
|
||||||
import eu.siacs.conversations.services.AppRTCAudioManager;
|
import eu.siacs.conversations.services.AppRTCAudioManager;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
|
import eu.siacs.conversations.ui.util.AvatarWorkerTask;
|
||||||
import eu.siacs.conversations.utils.PermissionUtils;
|
import eu.siacs.conversations.utils.PermissionUtils;
|
||||||
import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection;
|
import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection;
|
||||||
import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection;
|
import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection;
|
||||||
|
@ -248,6 +249,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
RtpEndUserState state = RtpEndUserState.valueOf(extraLastState);
|
RtpEndUserState state = RtpEndUserState.valueOf(extraLastState);
|
||||||
updateButtonConfiguration(state);
|
updateButtonConfiguration(state);
|
||||||
updateStateDisplay(state);
|
updateStateDisplay(state);
|
||||||
|
updateProfilePicture(state);
|
||||||
}
|
}
|
||||||
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
|
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
|
||||||
}
|
}
|
||||||
|
@ -361,6 +363,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
updateVideoViews(currentState);
|
updateVideoViews(currentState);
|
||||||
updateStateDisplay(currentState);
|
updateStateDisplay(currentState);
|
||||||
updateButtonConfiguration(currentState);
|
updateButtonConfiguration(currentState);
|
||||||
|
updateProfilePicture(currentState);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reInitializeActivityWithRunningRapSession(final Account account, Jid with, String sessionId) {
|
private void reInitializeActivityWithRunningRapSession(final Account account, Jid with, String sessionId) {
|
||||||
|
@ -427,6 +430,20 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateProfilePicture(final RtpEndUserState state) {
|
||||||
|
if (state == RtpEndUserState.INCOMING_CALL || state == RtpEndUserState.ACCEPTING_CALL) {
|
||||||
|
final boolean show = getResources().getBoolean(R.bool.show_avatar_incoming_call);
|
||||||
|
if (show) {
|
||||||
|
binding.contactPhoto.setVisibility(View.VISIBLE);
|
||||||
|
AvatarWorkerTask.loadAvatar(getWith(), binding.contactPhoto, R.dimen.publish_avatar_size);
|
||||||
|
} else {
|
||||||
|
binding.contactPhoto.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
binding.contactPhoto.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Set<Media> getMedia() {
|
private Set<Media> getMedia() {
|
||||||
return requireRtpConnection().getMedia();
|
return requireRtpConnection().getMedia();
|
||||||
}
|
}
|
||||||
|
@ -720,6 +737,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
updateStateDisplay(state);
|
updateStateDisplay(state);
|
||||||
updateButtonConfiguration(state);
|
updateButtonConfiguration(state);
|
||||||
updateVideoViews(state);
|
updateVideoViews(state);
|
||||||
|
updateProfilePicture(state);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Log.d(Config.LOGTAG, "received update for other rtp session");
|
Log.d(Config.LOGTAG, "received update for other rtp session");
|
||||||
|
@ -762,6 +780,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
runOnUiThread(() -> {
|
runOnUiThread(() -> {
|
||||||
updateStateDisplay(state);
|
updateStateDisplay(state);
|
||||||
updateButtonConfiguration(state);
|
updateButtonConfiguration(state);
|
||||||
|
updateProfilePicture(state);
|
||||||
});
|
});
|
||||||
resetIntent(account, with, state, actionToMedia(currentIntent.getAction()));
|
resetIntent(account, with, state, actionToMedia(currentIntent.getAction()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,22 @@
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_above="@+id/button_row"
|
||||||
|
android:layout_below="@id/app_bar_layout"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
android:id="@+id/contact_photo"
|
||||||
|
android:layout_width="@dimen/publish_avatar_size"
|
||||||
|
android:layout_height="@dimen/publish_avatar_size"
|
||||||
|
app:riv_corner_radius="@dimen/incoming_call_radius" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<org.webrtc.SurfaceViewRenderer
|
<org.webrtc.SurfaceViewRenderer
|
||||||
android:id="@+id/local_video"
|
android:id="@+id/local_video"
|
||||||
|
@ -93,13 +109,14 @@
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:alpha="0.7"
|
|
||||||
android:layout_margin="8dp"
|
android:layout_margin="8dp"
|
||||||
|
android:alpha="0.7"
|
||||||
android:src="@drawable/ic_mic_off_black_24dp"
|
android:src="@drawable/ic_mic_off_black_24dp"
|
||||||
android:tint="@color/white"
|
android:tint="@color/white"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
android:id="@+id/button_row"
|
||||||
android:layout_width="288dp"
|
android:layout_width="288dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="publish_avatar_top_margin">16dp</dimen>
|
<dimen name="publish_avatar_top_margin">16dp</dimen>
|
||||||
<dimen name="publish_avatar_size">128dp</dimen>
|
<dimen name="publish_avatar_size">128dp</dimen>
|
||||||
|
<dimen name="incoming_call_radius">64dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="publish_avatar_top_margin">24dp</dimen>
|
<dimen name="publish_avatar_top_margin">24dp</dimen>
|
||||||
<dimen name="publish_avatar_size">192dp</dimen>
|
<dimen name="publish_avatar_size">192dp</dimen>
|
||||||
|
<dimen name="incoming_call_radius">96dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
4
src/main/res/values-land/bools.xml
Normal file
4
src/main/res/values-land/bools.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<bool name="show_avatar_incoming_call">false</bool>
|
||||||
|
</resources>
|
4
src/main/res/values/bools.xml
Normal file
4
src/main/res/values/bools.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<bool name="show_avatar_incoming_call">true</bool>
|
||||||
|
</resources>
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
<dimen name="publish_avatar_top_margin">8dp</dimen>
|
<dimen name="publish_avatar_top_margin">8dp</dimen>
|
||||||
<dimen name="publish_avatar_size">96dp</dimen>
|
<dimen name="publish_avatar_size">96dp</dimen>
|
||||||
|
<dimen name="incoming_call_radius">48dp</dimen>
|
||||||
<dimen name="avatar_on_status_message">32dp</dimen>
|
<dimen name="avatar_on_status_message">32dp</dimen>
|
||||||
<dimen name="avatar">48dp</dimen>
|
<dimen name="avatar">48dp</dimen>
|
||||||
<dimen name="avatar_on_details_screen_size">56dp</dimen>
|
<dimen name="avatar_on_details_screen_size">56dp</dimen>
|
||||||
|
|
Loading…
Reference in a new issue