Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit 943d4c3

Browse files
committed
Fix top inset for module list.
1 parent 19ecceb commit 943d4c3

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

app/src/main/java/com/fox2code/mmm/MainActivity.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ public void commonNext() {
207207
progressIndicator.setVisibility(View.GONE);
208208
searchView.setEnabled(true);
209209
setActionBarBackground(null);
210+
updateScreenInsets(getResources().getConfiguration());
210211
});
211212
moduleViewListBuilder.appendRemoteModules();
212213
moduleViewListBuilder.applyTo(moduleList, moduleViewAdapter);
@@ -243,8 +244,8 @@ private void updateScreenInsets(Configuration configuration) {
243244
this.swipeRefreshLayout.setProgressViewOffset(false,
244245
swipeRefreshLayoutOrigStartOffset + combinedBarsHeight,
245246
swipeRefreshLayoutOrigEndOffset + combinedBarsHeight);
246-
this.moduleViewListBuilder.setHeaderPx(
247-
actionBarHeight + CompatDisplay.dpToPixel(8));
247+
this.moduleViewListBuilder.setHeaderPx(Math.max(statusBarHeight,
248+
combinedBarsHeight - CompatDisplay.dpToPixel(12)));
248249
this.moduleViewListBuilder.setFooterPx(
249250
bottomInset + this.searchCard.getHeight());
250251
this.searchCard.setRadius(this.searchCard.getHeight() / 2F);

app/src/main/java/com/fox2code/mmm/compat/CompatActivity.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,20 @@ public int getActionBarHeight() {
230230
Log.e(TAG, "Failed to call getSupportActionBar", e);
231231
compatActionBar = null; // Allow fallback to builtin actionBar.
232232
}
233+
View customView = null;
233234
if (compatActionBar != null) {
234-
return compatActionBar.isShowing() ? compatActionBar.getHeight() : 0;
235+
return compatActionBar.isShowing() || ((customView =
236+
compatActionBar.getCustomView()) != null &&
237+
customView.getVisibility() == View.VISIBLE) ?
238+
Math.max(customView == null ? 0 : customView.getHeight(),
239+
compatActionBar.getHeight()) : 0;
235240
} else {
236241
android.app.ActionBar actionBar = this.getActionBar();
237-
return actionBar != null && actionBar.isShowing() ? actionBar.getHeight() : 0;
242+
return actionBar != null && (actionBar.isShowing() || ((
243+
customView = actionBar.getCustomView()) != null &&
244+
customView.getVisibility() == View.VISIBLE)) ?
245+
Math.max(customView == null ? 0 : customView.getHeight(),
246+
actionBar.getHeight()) : 0;
238247
}
239248
}
240249

0 commit comments

Comments
 (0)