mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 12:39:58 +01:00
Improve layout further
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
370f256088
commit
654c46edc4
@ -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();
|
||||
}
|
||||
|
||||
|
@ -423,7 +423,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
|
||||
}
|
||||
|
||||
if (getActivity() != null) {
|
||||
new KeyboardUtils(getActivity(), getView());
|
||||
new KeyboardUtils(getActivity(), getView(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user