Fix top inset for module list.

pull/27/head
Fox2Code 3 years ago
parent 19eccebb7a
commit 943d4c32c6

@ -207,6 +207,7 @@ public class MainActivity extends CompatActivity implements SwipeRefreshLayout.O
progressIndicator.setVisibility(View.GONE); progressIndicator.setVisibility(View.GONE);
searchView.setEnabled(true); searchView.setEnabled(true);
setActionBarBackground(null); setActionBarBackground(null);
updateScreenInsets(getResources().getConfiguration());
}); });
moduleViewListBuilder.appendRemoteModules(); moduleViewListBuilder.appendRemoteModules();
moduleViewListBuilder.applyTo(moduleList, moduleViewAdapter); moduleViewListBuilder.applyTo(moduleList, moduleViewAdapter);
@ -243,8 +244,8 @@ public class MainActivity extends CompatActivity implements SwipeRefreshLayout.O
this.swipeRefreshLayout.setProgressViewOffset(false, this.swipeRefreshLayout.setProgressViewOffset(false,
swipeRefreshLayoutOrigStartOffset + combinedBarsHeight, swipeRefreshLayoutOrigStartOffset + combinedBarsHeight,
swipeRefreshLayoutOrigEndOffset + combinedBarsHeight); swipeRefreshLayoutOrigEndOffset + combinedBarsHeight);
this.moduleViewListBuilder.setHeaderPx( this.moduleViewListBuilder.setHeaderPx(Math.max(statusBarHeight,
actionBarHeight + CompatDisplay.dpToPixel(8)); combinedBarsHeight - CompatDisplay.dpToPixel(12)));
this.moduleViewListBuilder.setFooterPx( this.moduleViewListBuilder.setFooterPx(
bottomInset + this.searchCard.getHeight()); bottomInset + this.searchCard.getHeight());
this.searchCard.setRadius(this.searchCard.getHeight() / 2F); this.searchCard.setRadius(this.searchCard.getHeight() / 2F);

@ -230,11 +230,20 @@ public class CompatActivity extends AppCompatActivity {
Log.e(TAG, "Failed to call getSupportActionBar", e); Log.e(TAG, "Failed to call getSupportActionBar", e);
compatActionBar = null; // Allow fallback to builtin actionBar. compatActionBar = null; // Allow fallback to builtin actionBar.
} }
View customView = null;
if (compatActionBar != null) { if (compatActionBar != null) {
return compatActionBar.isShowing() ? compatActionBar.getHeight() : 0; return compatActionBar.isShowing() || ((customView =
compatActionBar.getCustomView()) != null &&
customView.getVisibility() == View.VISIBLE) ?
Math.max(customView == null ? 0 : customView.getHeight(),
compatActionBar.getHeight()) : 0;
} else { } else {
android.app.ActionBar actionBar = this.getActionBar(); android.app.ActionBar actionBar = this.getActionBar();
return actionBar != null && actionBar.isShowing() ? actionBar.getHeight() : 0; return actionBar != null && (actionBar.isShowing() || ((
customView = actionBar.getCustomView()) != null &&
customView.getVisibility() == View.VISIBLE)) ?
Math.max(customView == null ? 0 : customView.getHeight(),
actionBar.getHeight()) : 0;
} }
} }

Loading…
Cancel
Save