Search in sources :

Example 1 with StartupStageAdapter

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);
}
Also used : ListView(android.widget.ListView) StartupStageAdapter(com.odysee.app.adapter.StartupStageAdapter) ViewGroup(android.view.ViewGroup) PlayerView(com.google.android.exoplayer2.ui.PlayerView) RecyclerView(androidx.recyclerview.widget.RecyclerView) ListView(android.widget.ListView) NavigationBarView(com.google.android.material.navigation.NavigationBarView) ImageView(android.widget.ImageView) View(android.view.View) WebView(android.webkit.WebView) BottomNavigationView(com.google.android.material.bottomnavigation.BottomNavigationView) TextView(android.widget.TextView) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 WebView (android.webkit.WebView)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 PlayerView (com.google.android.exoplayer2.ui.PlayerView)1 BottomNavigationView (com.google.android.material.bottomnavigation.BottomNavigationView)1 NavigationBarView (com.google.android.material.navigation.NavigationBarView)1 StartupStageAdapter (com.odysee.app.adapter.StartupStageAdapter)1