File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
app/src/main/java/org/thunderdog/challegram Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -271,13 +271,25 @@ private boolean canAddContacts () {
271
271
return mode == MODE_NEW_CHAT || mode == MODE_CALL ;
272
272
}
273
273
274
+ @ Override
275
+ public boolean supportsBottomInset () {
276
+ return true ;
277
+ }
278
+
279
+ @ Override
280
+ protected void onBottomInsetChanged (int extraBottomInset , int extraBottomInsetWithoutIme , boolean isImeInset ) {
281
+ super .onBottomInsetChanged (extraBottomInset , extraBottomInsetWithoutIme , isImeInset );
282
+ Views .applyBottomInset (recyclerView , extraBottomInset );
283
+ }
284
+
274
285
@ SuppressWarnings ("ResourceType" )
275
286
@ Override
276
287
protected View onCreateView (Context context ) {
277
288
contentView = new FrameLayoutFix (context );
278
289
ViewSupport .setThemedBackground (contentView , ColorId .filling , this );
279
290
280
291
recyclerView = new SectionedRecyclerView (context );
292
+ Views .applyBottomInset (recyclerView , extraBottomInset );
281
293
recyclerView .setSectionedAdapter (adapter = new ContactsAdapter (recyclerView , this ));
282
294
recyclerView .addOnScrollListener (new RecyclerView .OnScrollListener () {
283
295
@ Override
Original file line number Diff line number Diff line change @@ -196,13 +196,17 @@ private void layoutSections () {
196
196
private final int scrollbarPadding = Screen .dp (9f );
197
197
private final int scrollbarMinHeight = Screen .dp (32f );
198
198
199
+ private int getScrollBarViewportHeight () {
200
+ return getMeasuredHeight () - getPaddingBottom ();
201
+ }
202
+
199
203
private void layoutScrollbar () {
200
204
if (adapter == null || adapter .getSectionCount () == 0 ) {
201
205
scrollbarEnabled = false ;
202
206
return ;
203
207
}
204
208
205
- final int totalHeight = getMeasuredHeight ();
209
+ final int totalHeight = getScrollBarViewportHeight ();
206
210
if (totalHeight <= 0 ) {
207
211
scrollbarEnabled = false ;
208
212
return ;
@@ -267,7 +271,7 @@ private float calculateScrollbarFactor () {
267
271
}
268
272
}
269
273
270
- return (float ) scrollY / (float ) (totalScrollY - getMeasuredHeight ());
274
+ return (float ) scrollY / (float ) (totalScrollY - getScrollBarViewportHeight ());
271
275
}
272
276
273
277
private final RectF bubbleRect = new RectF ();
@@ -340,7 +344,7 @@ private void closeScrollbar (boolean animated) {
340
344
private void moveScrollbar (float y ) {
341
345
float dy = y - lastScrollY ;
342
346
lastScrollY = y ;
343
- float scale = (float ) totalScrollY / (float ) getMeasuredHeight ();
347
+ float scale = (float ) totalScrollY / (float ) getScrollBarViewportHeight ();
344
348
int by = (int ) (dy * scale );
345
349
if (by != 0 ) {
346
350
scrollBy (0 , by );
You can’t perform that action at this time.
0 commit comments