浏览代码

Improve settings & Update webrtc stuff

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 7 年之前
父节点
当前提交
a49cab9b84

+ 14 - 12
app/src/main/java/com/nextcloud/talk/activities/CallActivity.java

@@ -612,19 +612,21 @@ public class CallActivity extends AppCompatActivity {
 
     private void gotRemoteStream(MediaStream stream) {
         //we have remote video stream. add to the renderer.
-        final VideoTrack videoTrack = stream.videoTracks.getFirst();
-        AudioTrack audioTrack = stream.audioTracks.getFirst();
-        runOnUiThread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    remoteRenderer = new VideoRenderer(fullScreenVideoView);
-                    videoTrack.addRenderer(remoteRenderer);
-                } catch (Exception e) {
-                    e.printStackTrace();
+        if (stream.videoTracks.size() == 1 && stream.audioTracks.size() == 1) {
+            final VideoTrack videoTrack = stream.videoTracks.get(0);
+                    AudioTrack audioTrack = stream.audioTracks.get(0);
+            runOnUiThread(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        remoteRenderer = new VideoRenderer(fullScreenVideoView);
+                        videoTrack.addRenderer(remoteRenderer);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
                 }
-            }
-        });
+            });
+        }
 
     }
 

+ 10 - 2
app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java

@@ -108,6 +108,9 @@ public class SettingsController extends BaseController {
     @BindView(R.id.display_name_text)
     TextView displayNameTextView;
 
+    @BindView(R.id.base_url_text)
+    TextView baseUrlTextView;
+
     @BindView(R.id.settings_remove_account)
     MaterialStandardPreference removeAccountButton;
 
@@ -138,6 +141,8 @@ public class SettingsController extends BaseController {
     @Inject
     UserUtils userUtils;
 
+    private UserEntity userEntity;
+
     private OnPreferenceValueChangedListener<String> proxyTypeChangeListener;
     private OnPreferenceValueChangedListener<Boolean> proxyCredentialsChangeListener;
 
@@ -204,8 +209,11 @@ public class SettingsController extends BaseController {
 
         versionInfo.setSummary("v" + BuildConfig.VERSION_NAME);
 
-        UserEntity userEntity = userUtils.getCurrentUser();
+        userEntity = userUtils.getCurrentUser();
         if (userEntity != null) {
+
+            baseUrlTextView.setText(userEntity.getBaseUrl());
+
             reauthorizeButton.setOnClickListener(view14 -> {
                 reauthorizeButton.setEnabled(false);
                 getParentController().getRouter().pushController(RouterTransaction.with(
@@ -251,7 +259,7 @@ public class SettingsController extends BaseController {
             hideProxyCredentials();
         }
 
-        UserEntity userEntity = userUtils.getCurrentUser();
+        userEntity = userUtils.getCurrentUser();
         if (userEntity != null) {
             // Awful hack
             if (userEntity.getDisplayName() != null) {

+ 11 - 2
app/src/main/res/layout/controller_settings.xml

@@ -63,13 +63,22 @@
                 android:layout_height="wrap_content"
                 android:layout_below="@id/avatar_image"
                 android:layout_centerHorizontal="true"
-                android:layout_margin="@dimen/margin_between_elements"/>
+                android:layout_marginTop="@dimen/margin_between_elements"/>
+
+            <TextView
+                android:id="@+id/base_url_text"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_below="@id/display_name_text"
+                android:layout_centerHorizontal="true"
+                android:layout_margin="4dp"/>
+
 
             <com.yarolegovich.mp.MaterialStandardPreference
                 android:id="@+id/settings_switch"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_below="@id/display_name_text"
+                android:layout_below="@id/base_url_text"
                 android:tag="switchAccountButton"
                 apc:mp_title="@string/nc_settings_switch_account"/>