void SwitchLayoutPhase(LayoutPhase phase) { if (View != null) { AnimationExtensions.SetupAutoSceneTransition((ViewGroup)View); } loadingLayout.Visibility = ViewStates.Invisible; refreshLayout.Visibility = ViewStates.Invisible; loginLayout.Visibility = ViewStates.Invisible; if (phase != LayoutPhase.Loading && refreshLayout != null && refreshLayout.Refreshing) { refreshLayout.Refreshing = false; } switch (phase) { case LayoutPhase.List: refreshLayout.Visibility = ViewStates.Visible; break; case LayoutPhase.Loading: // Either the adapter has no elements and we show our dedicated loadscreen if (refreshLayout == null || adapter == null || (adapter.ItemCount == 0 && !refreshLayout.Refreshing)) { loadingLayout.Visibility = ViewStates.Visible; } // Or we use refresh layout spinner to notify we are refreshing else { refreshLayout.Visibility = ViewStates.Visible; // We need a delay here to avoid animation collision new Handler().PostDelayed(() => refreshLayout.Refreshing = true, 500); } break; case LayoutPhase.Login: loginLayout.Visibility = ViewStates.Visible; break; } currentLayoutPhase = phase; }
void SwitchLayoutPhase (LayoutPhase phase) { if (View != null) AnimationExtensions.SetupAutoSceneTransition ((ViewGroup)View); loadingLayout.Visibility = ViewStates.Invisible; refreshLayout.Visibility = ViewStates.Invisible; loginLayout.Visibility = ViewStates.Invisible; if (phase != LayoutPhase.Loading && refreshLayout != null && refreshLayout.Refreshing) refreshLayout.Refreshing = false; switch (phase) { case LayoutPhase.List: refreshLayout.Visibility = ViewStates.Visible; break; case LayoutPhase.Loading: // Either the adapter has no elements and we show our dedicated loadscreen if (refreshLayout == null || adapter == null || (adapter.ItemCount == 0 && !refreshLayout.Refreshing)) loadingLayout.Visibility = ViewStates.Visible; // Or we use refresh layout spinner to notify we are refreshing else { refreshLayout.Visibility = ViewStates.Visible; // We need a delay here to avoid animation collision new Handler ().PostDelayed (() => refreshLayout.Refreshing = true, 500); } break; case LayoutPhase.Login: loginLayout.Visibility = ViewStates.Visible; break; } currentLayoutPhase = phase; }