Example usage for android.view Window FEATURE_PROGRESS

List of usage examples for android.view Window FEATURE_PROGRESS

Introduction

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

Prototype

int FEATURE_PROGRESS

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

Click Source Link

Document

Flag for the progress indicator feature.

Usage

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

private void SolveQuestion() {

    SolvingIndex = false;/*from   www.  ja va 2s .c o m*/
    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  ww  .ja  va2  s.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 whether the horizontal progress bar in the title should be indeterminate (the circular
 * is always indeterminate)./*from   www.ja v  a2s.  c  o m*/
 * <p>
 * In order for the progress bar to be shown, the feature must be requested
 * via {@link #requestWindowFeature(int)}.
 * 
 * @param indeterminate Whether the horizontal progress bar should be indeterminate.
 */
public final void setProgressBarIndeterminate(boolean indeterminate) {
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS,
            indeterminate ? Window.PROGRESS_INDETERMINATE_ON : Window.PROGRESS_INDETERMINATE_OFF);
}

From source file:android.app.Activity.java

/**
 * Sets the progress for the progress bars in the title.
 * <p>/*  www.  j  a  va2 s  .  com*/
 * In order for the progress bar to be shown, the feature must be requested
 * via {@link #requestWindowFeature(int)}.
 * 
 * @param progress The progress for the progress bar. Valid ranges are from
 *            0 to 10000 (both inclusive). If 10000 is given, the progress
 *            bar will be completely filled and will fade out.
 */
public final void setProgress(int progress) {
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, progress + Window.PROGRESS_START);
}

From source file:android.app.Activity.java

/**
 * Sets the secondary progress for the progress bar in the title. This
 * progress is drawn between the primary progress (set via
 * {@link #setProgress(int)} and the background. It can be ideal for media
 * scenarios such as showing the buffering progress while the default
 * progress shows the play progress./*from  www .  j  a v  a 2  s. c om*/
 * <p>
 * In order for the progress bar to be shown, the feature must be requested
 * via {@link #requestWindowFeature(int)}.
 * 
 * @param secondaryProgress The secondary progress for the progress bar. Valid ranges are from
 *            0 to 10000 (both inclusive).
 */
public final void setSecondaryProgress(int secondaryProgress) {
    getWindow().setFeatureInt(Window.FEATURE_PROGRESS, secondaryProgress + Window.PROGRESS_SECONDARY_START);
}