use of com.odysee.app.adapter.StartupStageAdapter in project odysee-android by OdyseeTeam.
the class MainActivity method renderStartupFailed.
private void renderStartupFailed(List<StartupStage> startupStages) {
ListView listView = findViewById(R.id.startup_stage_error_listview);
StartupStageAdapter adapter = new StartupStageAdapter(this, startupStages);
listView.setAdapter(adapter);
// Add 1 pixel to listview height
int listHeight = Math.round(getResources().getDisplayMetrics().density);
for (int i = 0; i < startupStages.size(); i++) {
View item = adapter.getView(i, null, listView);
item.measure(0, 0);
listHeight += item.getMeasuredHeight();
}
// Properly set listview height by adding all seven items and the divider heights
// and the additional 1 pixel so no vertical scroll bar is shown
ViewGroup.LayoutParams params = listView.getLayoutParams();
params.height = listHeight + (listView.getCount() + 1) * listView.getDividerHeight();
listView.setLayoutParams(params);
listView.invalidate();
listView.requestLayout();
findViewById(R.id.splash_view_loading_container).setVisibility(View.GONE);
findViewById(R.id.splash_view_error_container).setVisibility(View.VISIBLE);
}
Aggregations