Example usage for android.view Window PROGRESS_VISIBILITY_ON

List of usage examples for android.view Window PROGRESS_VISIBILITY_ON

Introduction

In this page you can find the example usage for android.view Window PROGRESS_VISIBILITY_ON.

Prototype

int PROGRESS_VISIBILITY_ON

To view the source code for android.view Window PROGRESS_VISIBILITY_ON.

Click Source Link

Document

Flag for setting the progress bar's visibility to VISIBLE.

Usage

From source file:ca.spencerelliott.mercury.Changesets.java

public void refreshChangesets() {
    //Set up the window to show the progress dialog in the title bar
    this.getWindow().setFeatureInt(Window.PROGRESS_VISIBILITY_ON, 1);
    this.getWindow().setFeatureInt(Window.FEATURE_PROGRESS, 0);
    this.setProgressBarVisibility(true);

    //Create a new thread to process all the data in the background
    startThread();//w  ww. ja v  a2 s  . c  om
}

From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java

@Override
public void setProgressBarVisibility(boolean visible) {
    if (DEBUG)//  w  ww .  ja  va 2s. c  o  m
        Log.d(TAG, "[setProgressBarVisibility] visible: " + visible);

    setFeatureInt(Window.FEATURE_PROGRESS,
            visible ? Window.PROGRESS_VISIBILITY_ON : Window.PROGRESS_VISIBILITY_OFF);
}

From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java

@Override
public void setProgressBarIndeterminateVisibility(boolean visible) {
    if (DEBUG)/*from  w  w w  .  java  2  s  .  c  om*/
        Log.d(TAG, "[setProgressBarIndeterminateVisibility] visible: " + visible);

    setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
            visible ? Window.PROGRESS_VISIBILITY_ON : Window.PROGRESS_VISIBILITY_OFF);
}

From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java

private void updateProgressBars(int value) {
    IcsProgressBar circularProgressBar = getCircularProgressBar(true);
    IcsProgressBar horizontalProgressBar = getHorizontalProgressBar(true);

    final int features = mFeatures;//getLocalFeatures();
    if (value == Window.PROGRESS_VISIBILITY_ON) {
        if ((features & (1 << Window.FEATURE_PROGRESS)) != 0) {
            int level = horizontalProgressBar.getProgress();
            int visibility = (horizontalProgressBar.isIndeterminate() || level < 10000) ? View.VISIBLE
                    : View.INVISIBLE;
            horizontalProgressBar.setVisibility(visibility);
        }//from  w ww  . jav  a  2 s .c  om
        if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0) {
            circularProgressBar.setVisibility(View.VISIBLE);
        }
    } else if (value == Window.PROGRESS_VISIBILITY_OFF) {
        if ((features & (1 << Window.FEATURE_PROGRESS)) != 0) {
            horizontalProgressBar.setVisibility(View.GONE);
        }
        if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0) {
            circularProgressBar.setVisibility(View.GONE);
        }
    } else if (value == Window.PROGRESS_INDETERMINATE_ON) {
        horizontalProgressBar.setIndeterminate(true);
    } else if (value == Window.PROGRESS_INDETERMINATE_OFF) {
        horizontalProgressBar.setIndeterminate(false);
    } else if (Window.PROGRESS_START <= value && value <= Window.PROGRESS_END) {
        // We want to set the progress value before testing for visibility
        // so that when the progress bar becomes visible again, it has the
        // correct level.
        horizontalProgressBar.setProgress(value - Window.PROGRESS_START);

        if (value < Window.PROGRESS_END) {
            showProgressBars(horizontalProgressBar, circularProgressBar);
        } else {
            hideProgressBars(horizontalProgressBar, circularProgressBar);
        }
    } else if (Window.PROGRESS_SECONDARY_START <= value && value <= Window.PROGRESS_SECONDARY_END) {
        horizontalProgressBar.setSecondaryProgress(value - Window.PROGRESS_SECONDARY_START);

        showProgressBars(horizontalProgressBar, circularProgressBar);
    }
}

From source file:lewa.support.v7.app.ActionBarActivityDelegateBase.java

/**
 * Progress Bar function. Mostly extracted from PhoneWindow.java
 *//*from ww w  .ja  v a2  s.c o m*/
private void updateProgressBars(int value) {
    ProgressBarICS circularProgressBar = getCircularProgressBar();
    ProgressBarICS horizontalProgressBar = getHorizontalProgressBar();

    if (value == Window.PROGRESS_VISIBILITY_ON) {
        if (mFeatureProgress) {
            int level = horizontalProgressBar.getProgress();
            int visibility = (horizontalProgressBar.isIndeterminate() || level < 10000) ? View.VISIBLE
                    : View.INVISIBLE;
            horizontalProgressBar.setVisibility(visibility);
        }
        if (mFeatureIndeterminateProgress) {
            circularProgressBar.setVisibility(View.VISIBLE);
        }
    } else if (value == Window.PROGRESS_VISIBILITY_OFF) {
        if (mFeatureProgress) {
            horizontalProgressBar.setVisibility(View.GONE);
        }
        if (mFeatureIndeterminateProgress) {
            circularProgressBar.setVisibility(View.GONE);
        }
    } else if (value == Window.PROGRESS_INDETERMINATE_ON) {
        horizontalProgressBar.setIndeterminate(true);
    } else if (value == Window.PROGRESS_INDETERMINATE_OFF) {
        horizontalProgressBar.setIndeterminate(false);
    } else if (Window.PROGRESS_START <= value && value <= Window.PROGRESS_END) {
        // We want to set the progress value before testing for visibility
        // so that when the progress bar becomes visible again, it has the
        // correct level.
        horizontalProgressBar.setProgress(value - Window.PROGRESS_START);

        if (value < Window.PROGRESS_END) {
            showProgressBars(horizontalProgressBar, circularProgressBar);
        } else {
            hideProgressBars(horizontalProgressBar, circularProgressBar);
        }
    }
}

From source file:org.smilec.smile.student.CourseList.java

private void SolveQuestion() {

    SolvingIndex = false;//  w  ww  .  j  av  a 2 s .  com
    issolvequestion = 0;
    // 1st screen
    curwebview = webviewQ;
    curcategory = category_arr[1];
    scene_number = 1;

    setTitle(curcategory + "   1/" + LAST_SCENE_NUM);
    setContentView(R.layout.question);

    curwebview = (WebView) findViewById(R.id.webviewQ);
    rgb02 = (RadioGroup) findViewById(R.id.rgroup02);
    rgb03 = (RadioGroup) findViewById(R.id.rgroup03);
    ratingbar = (RatingBar) findViewById(R.id.ratingbarQ);
    curwebview.clearCache(true);

    setWebviewFontSize(curwebview);

    // zoom
    //curwebview.getSettings().setBuiltInZoomControls(true);
    /*
    zoomControls = (ZoomControls) findViewById(R.id.zoomcontrols);
    zoomControls.setOnZoomInClickListener(new View.OnClickListener() {
     public void onClick(View v) {
    curwebview.zoomIn();
     }
    });
    zoomControls.setOnZoomOutClickListener(new View.OnClickListener() {
             
     public void onClick(View v) {
    curwebview.zoomOut();
     }
    });
    zoomControls.hide();
    *//*
       final GestureDetector gestureDetector = new GestureDetector(getApplicationContext(), new GestureDetector.SimpleOnGestureListener() {
         @Override
         public boolean onDoubleTap(MotionEvent e) {
         String url = curwebview.getUrl();
          Log.d("**APP**", "Double Tap event url:"+url);
          if (curwebview!=null && curwebview.canGoBack() && url.endsWith(".jpg")) 
         {
             //zoomControls.hide();
            curwebview.goBack();
         }
                     
          return false;              
         }
               
         @Override
         public boolean onDown(MotionEvent e) {
         String url = curwebview.getUrl();
          Log.d("**APP**", "onDown event url:"+url);
          if (curwebview!=null && url.endsWith(".jpg")) 
         {
             //zoomControls.show();
         }
          return false;
         }
       });
       gestureDetector.setIsLongpressEnabled(true);
               
       curwebview.setOnTouchListener(new OnTouchListener(){
                
         public boolean onTouch(View v, MotionEvent event) {
          return gestureDetector.onTouchEvent(event);
         }
               
       });*/
    // zoom

    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);

    curwebview.setWebChromeClient(new WebChromeClient() {
        public void onProgressChanged(WebView view, int progress) {
            // Make the bar disappear after URL is loaded, and changes
            // string to Loading...
            CourseList.this.setTitle(getString(R.string.loading));
            CourseList.this.setProgress(progress * 100); // Make the bar
            // disappear
            // after URL is
            // loaded
            // Restore the app name after finish loading
            if (progress == 100)
                CourseList.this.setTitle(curcategory + "   " + scene_number + " /" + LAST_SCENE_NUM);
        }
    });

    initialize_AnswerRatingArray_withDummyValues();

    showScene();

    checkCurrentAnswers();

    // reset button (delete previous answer)
    Button resetB = (Button) findViewById(R.id.resetQ);
    resetB.setOnClickListener(new Button.OnClickListener() {
        public void onClick(View v) {
            rgb02.clearCheck();
            //rgb03.clearCheck();
            ratingbar.setRating(new Float(0));
        }
    });

    // previous button
    Button prevB = (Button) findViewById(R.id.prevQ);
    prevB.setOnClickListener(new Button.OnClickListener() {
        public void onClick(View v) {
            if (scene_number > 1) {

                int temp = saveCurrentAnswers();
                showPreviousScene();
                checkCurrentAnswers();
            }
        }
    });

    // next button
    Button nextB = (Button) findViewById(R.id.nextQ);
    nextB.setOnClickListener(new Button.OnClickListener() {
        public void onClick(View v) {
            if (scene_number != LAST_SCENE_NUM) {

                int temp1 = saveCurrentAnswers();
                if (temp1 == 2) {
                    showNextScene();
                    checkCurrentAnswers();
                } else {
                    //Toast.makeText(CourseList.this,getString(R.string.insert_error), Toast.LENGTH_SHORT).show();
                    showToast(getString(R.string.insert_error));
                }

            } else {

                int temp1 = saveCurrentAnswers(); // save the last answer

                if (temp1 == 2) {
                    Builder adb = new AlertDialog.Builder(CourseList.this);
                    adb.setTitle(curcategory);
                    adb.setMessage(getString(R.string.submit_q));
                    adb.setPositiveButton(getString(R.string.submit_btn),
                            new DialogInterface.OnClickListener() {

                                public void onClick(DialogInterface arg0, int arg1) {

                                    student.submit_answer_to_teacher(answer_arr, rating_arr);

                                    // Log.d(APP_TAG,
                                    // "answer_arr[0]="+answer_arr.get(0));
                                    // Log.d(APP_TAG,
                                    // "answer_arr[1]="+answer_arr.get(1));

                                    show_todo_view();
                                    selarridx = 0;
                                    SolvingIndex = true;

                                }
                            });

                    adb.setNegativeButton(getString(R.string.Cancel), null);
                    AlertDialog d = adb.show();
                    smile.overrideFonts(activity, d.findViewById(android.R.id.content));
                } else {
                    /*Toast.makeText(CourseList.this,
                          getString(R.string.insert_error), Toast.LENGTH_SHORT)
                          .show();*/
                    showToast(getString(R.string.insert_error));
                }
            }
        }
    });

}

From source file:android.app.Activity.java

/**
 * Sets the visibility of the progress bar in the title.
 * <p>//w w w . j a  v  a2s  .c o  m
 * In order for the progress bar to be shown, the feature must be requested
 * via {@link #requestWindowFeature(int)}.
 * 
 * @param visible Whether to show the progress bars in the title.
 */
public final void setProgressBarVisibility(boolean visible) {
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS,
            visible ? Window.PROGRESS_VISIBILITY_ON : Window.PROGRESS_VISIBILITY_OFF);
}

From source file:android.app.Activity.java

/**
 * Sets the visibility of the indeterminate progress bar in the title.
 * <p>//from  w w  w .  jav a  2  s  . com
 * In order for the progress bar to be shown, the feature must be requested
 * via {@link #requestWindowFeature(int)}.
 *
 * @param visible Whether to show the progress bars in the title.
 */
public final void setProgressBarIndeterminateVisibility(boolean visible) {
    getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
            visible ? Window.PROGRESS_VISIBILITY_ON : Window.PROGRESS_VISIBILITY_OFF);
}