Hello! I write application on fragments, with MVP from Moxy . In the implementation of only one activity, which is a container for all fragments.
When the application starts, the fragment with splash-screen is shown:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(LAYOUT); ButterKnife.bind(this); showSplashFragment(); } @Override public void showSplashFragment() { getSupportFragmentManager() .beginTransaction() .replace(R.id.ltContainer, SplashFragment.newInstance()) .commit(); } The essence of the problem is that the fragment appears only after half a second. Before that, just a white screen is shown. Has anyone come across this?
UPD: SlpashFragment
private static final int LAYOUT = R.layout.fragment_splash; //@formatter:off @InjectPresenter SplashPresenter splashPresenter; @BindView(R.id.tvTimeCounter) TextView tvTimeCounter; @BindView(R.id.progressBar) ProgressBar progressBar; //@formatter:on public static SplashFragment newInstance() { SplashFragment fragment = new SplashFragment(); Bundle args = new Bundle(); fragment.setArguments(args); return fragment; } @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { View view = inflater.inflate(LAYOUT, container, false); ButterKnife.bind(this, view); showSplashProgress(); splashPresenter.showFragment(); return view; } @Override public void showSplashProgress() { progressBar.setVisibility(View.VISIBLE); } @Override public void showAuthFragment() { ((MainActivity) getActivity()).showAuthFragment(); } @Override public void showMapFragment() { ((MainActivity) getActivity()).showMapFragment(); } @Override public void showReplayError() { // TODO: 22.11.2016 } }
showSplashFragment()method, add an entry to the log. This record will be displayed without delay? - post_zeewSplashPresenter. - post_zeew