From 21a3ea2189fd4016f5b6ed7d960437ac55d2f150 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Wed, 1 Apr 2020 16:06:09 -0400
Subject: [PATCH] conversation fragment: use activity type to know if in tablet
 mode

Change-Id: If3d2c4570348bbe7e978e89f94a9a0cef74156e4
---
 .../java/cx/ring/fragments/ConversationFragment.java     | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ring-android/app/src/main/java/cx/ring/fragments/ConversationFragment.java b/ring-android/app/src/main/java/cx/ring/fragments/ConversationFragment.java
index 94a695fa4..3c86847e8 100644
--- a/ring-android/app/src/main/java/cx/ring/fragments/ConversationFragment.java
+++ b/ring-android/app/src/main/java/cx/ring/fragments/ConversationFragment.java
@@ -23,6 +23,7 @@ import android.Manifest;
 import android.animation.LayoutTransition;
 import android.animation.ValueAnimator;
 import android.annotation.SuppressLint;
+import android.app.Activity;
 import android.content.ActivityNotFoundException;
 import android.content.ClipData;
 import android.content.ComponentName;
@@ -950,7 +951,7 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen
     }
 
     private void setupActionbar(CallContact contact) {
-        if (!this.isVisible()) {
+        if (!isVisible()) {
             return;
         }
 
@@ -963,17 +964,17 @@ public class ConversationFragment extends BaseSupportFragment<ConversationPresen
         String displayName = contact.getDisplayName();
         String identity = contact.getRingUsername();
 
-        if (DeviceUtils.isTablet(getContext())) {
+        Activity activity = getActivity();
+        if (activity instanceof HomeActivity) {
             Toolbar toolbar = getActivity().findViewById(R.id.main_toolbar);
             TextView title = toolbar.findViewById(R.id.contact_title);
             TextView subtitle = toolbar.findViewById(R.id.contact_subtitle);
             ImageView logo = toolbar.findViewById(R.id.contact_image);
 
-            if (!((HomeActivity) getActivity()).isConversationSelected()) {
+            if (!((HomeActivity) activity).isConversationSelected()) {
                 title.setText("");
                 subtitle.setText("");
                 logo.setImageDrawable(null);
-
                 return;
             }
 
-- 
GitLab