kishan-dada / panoramagl-android

Automatically exported from code.google.com/p/panoramagl-android
0 stars 0 forks source link

Add a spinner while loading a panorama (or loading image, or progress bar) #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There is no loading feedback while loading a new panorama. It is kind of hard 
to implement a image on top of the panorama while it's loading because it 
defaults to use the Main (UI) Thread.

I had to create (in noobish Java, I'm new to it) a delayed method to wait until 
the image appears, e.g.:

private static int cIdx = 0;

private void loadPanoramaFromJSON( int index, ImageView loadingFeedback)
{
        loadingFeedback.setAlpha(255);
        cIdx = index;

        final Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
          @Override
          public void run() {
              loadPano(cIdx);
          }
        }, 100);
}

private void loadPano(int index)
{
        PLILoader loader = null;
                if(index == 0)
                loader = new PLJSONLoader(this, "res://raw/json_saguao");
            else if(index == 1)
                loader = new PLJSONLoader(this, "res://raw/json_domooff");
            else if(index == 2)
                loader = new PLJSONLoader(this, "res://raw/json_domoon");
            this.load(loader);

             final Handler handler = new Handler();
               handler.postDelayed(new Runnable() {
               @Override
               public void run() {
                    ImageView loadingFeedback = (ImageView) findViewById(R.id.loadView);
                        loadingFeedback.setAlpha(0);
               }
             }, 600); 
}

Original issue reported on code.google.com by ca...@papricacomunicacao.com.br on 30 Apr 2013 at 9:11

GoogleCodeExporter commented 9 years ago
This feautere was added in PanoramaGL 0.2 beta, you can use the method 
showProgressBar to show the progress bar and hideProgressBar, and to use with 
JSON protocol the load method has an parameter showProgressBar.

Original comment by javbae...@gmail.com on 12 Sep 2013 at 12:04