diff --git a/app/src/main/java/com/nextcloud/talk/controllers/CallsListController.java b/app/src/main/java/com/nextcloud/talk/controllers/CallsListController.java index 0cf29333f..df516b6da 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/CallsListController.java +++ b/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(); } diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java b/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java index 84296f171..34837cce4 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ChatController.java +++ b/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); } } diff --git a/app/src/main/java/com/nextcloud/talk/utils/KeyboardUtils.java b/app/src/main/java/com/nextcloud/talk/utils/KeyboardUtils.java index abd584987..e4d599698 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/KeyboardUtils.java +++ b/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); } diff --git a/app/src/main/res/layout/controller_chat.xml b/app/src/main/res/layout/controller_chat.xml index 06c68122e..597f4287b 100644 --- a/app/src/main/res/layout/controller_chat.xml +++ b/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"/>