Conjunto ProgressBar antes de procesar el contenido completo

loveubae:

Tengo un reciclador que recibe información de una modificación. Quiero que la barra de progreso que se activa hasta que el proceso completo de esta información. (Tal vez el momento de la visibilidad de la barra de progreso o algo más)

Yo uso la barra de progreso personalizada - https://github.com/ybq/Android-SpinKit

public void retrofitView() {
    ProgressBar progressBar;
    progressBar = findViewById(R.id.ProgressBar_MainActivity);
    DoubleBounce doubleBounce = new DoubleBounce();
    progressBar.setIndeterminateDrawable(doubleBounce);
    progressBar.setVisibility(View.VISIBLE);
    Call<List<Restaurants>> call = RetrofitClient.apiService.getRestaurants();
    call.enqueue(new Callback<List<Restaurants>>() {
        @Override
        public void onResponse(Call<List<Restaurants>> call, Response<List<Restaurants>> response) {
            restaurantRecyclerInit(response.body());
        }

        @Override
        public void onFailure(Call<List<Restaurants>> call, Throwable t) {
            Toast.makeText(MainActivity.this, "ddd", Toast.LENGTH_SHORT).show();
        }
    });
}
Ashish:

Utilice el código siguiente le ayudará a

public void retrofitView() {
    ProgressBar progressBar;
    progressBar = findViewById(R.id.ProgressBar_MainActivity);
    DoubleBounce doubleBounce = new DoubleBounce();
    progressBar.setIndeterminateDrawable(doubleBounce);
    progressBar.setVisibility(View.VISIBLE);
    Call<List<Restaurants>> call = RetrofitClient.apiService.getRestaurants();
    call.enqueue(new Callback<List<Restaurants>>() {
        @Override
        public void onResponse(Call<List<Restaurants>> call, Response<List<Restaurants>> response) {
            progressBar.setVisibility(View.GONE); //This will make your progress bar visibility off after data load successfully
            restaurantRecyclerInit(response.body());
        }

        @Override
        public void onFailure(Call<List<Restaurants>> call, Throwable t) {
            progressBar.setVisibility(View.GONE); // Same here also
            Toast.makeText(MainActivity.this, "ddd", Toast.LENGTH_SHORT).show();
        }
    });
}

Supongo que te gusta

Origin http://43.154.161.224:23101/article/api/json?id=205018&siteId=1
Recomendado
Clasificación