Просмотр исходного кода

Improve layout further

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 6 лет назад
Родитель
Сommit
654c46edc4

+ 1 - 1
app/src/main/java/com/nextcloud/talk/controllers/CallsListController.java

@@ -471,7 +471,7 @@ public class CallsListController extends BaseController implements SearchView.On
             bottomSheet = new BottomSheet.Builder(getActivity()).setView(view).create();
         }
 
-        bottomSheet.setOnShowListener(dialog -> new KeyboardUtils(getActivity(), bottomSheet.getLayout()));
+        bottomSheet.setOnShowListener(dialog -> new KeyboardUtils(getActivity(), bottomSheet.getLayout(), true));
         bottomSheet.show();
     }
 

+ 1 - 1
app/src/main/java/com/nextcloud/talk/controllers/ChatController.java

@@ -423,7 +423,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
         }
 
         if (getActivity() != null) {
-            new KeyboardUtils(getActivity(), getView());
+            new KeyboardUtils(getActivity(), getView(), false);
         }
     }
 

+ 6 - 4
app/src/main/java/com/nextcloud/talk/utils/KeyboardUtils.java

@@ -31,6 +31,7 @@ import android.view.inputmethod.InputMethodManager;
 public class KeyboardUtils {
     private View decorView;
     private View contentView;
+    private boolean isUsedInBottomSheet;
     //a small helper to allow showing the editText focus
     ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
         @Override
@@ -44,9 +45,9 @@ public class KeyboardUtils {
 
             int diff = height - r.bottom;
 
-            if (diff > 0) {
-                // if the use-able screen height differs from the total screen height we assume that it shows a keyboard now
-                //check if the padding is 0 (if yes set the padding for the keyboard)
+            boolean shouldSetBottomPadding = (isUsedInBottomSheet && diff != 0) || (diff > 0);
+
+            if (shouldSetBottomPadding) {
                 if (contentView.getPaddingBottom() != diff) {
                     //set the padding of the contentView for the keyboard
                     contentView.setPadding(0, 0, 0,  diff);
@@ -61,9 +62,10 @@ public class KeyboardUtils {
         }
     };
 
-    public KeyboardUtils(Activity act, View contentView) {
+    public KeyboardUtils(Activity act, View contentView, boolean isUsedInBottomSheet) {
         this.decorView = act.getWindow().getDecorView();
         this.contentView = contentView;
+        this.isUsedInBottomSheet = isUsedInBottomSheet;
 
         decorView.getViewTreeObserver().addOnGlobalLayoutListener(onGlobalLayoutListener);
     }

+ 2 - 0
app/src/main/res/layout/controller_chat.xml

@@ -28,6 +28,7 @@
         android:id="@+id/messagesListView"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:paddingBottom="16dp"
         android:layout_above="@+id/messageInputView"
         app:incomingDefaultBubbleColor="@color/white_two"
         app:incomingDefaultBubblePressedColor="@color/white_two"
@@ -52,6 +53,7 @@
         app:outcomingTextSize="@dimen/chat_text_size"
         app:outcomingTimeTextColor="@color/warm_grey_four"
         app:outcomingTimeTextSize="12sp"
+        app:dateHeaderTextSize="13sp"
         app:textAutoLink="all"/>
 
     <com.webianks.library.PopupBubble