Example usage for android.app ProgressDialog STYLE_SPINNER

List of usage examples for android.app ProgressDialog STYLE_SPINNER

Introduction

In this page you can find the example usage for android.app ProgressDialog STYLE_SPINNER.

Prototype

int STYLE_SPINNER

To view the source code for android.app ProgressDialog STYLE_SPINNER.

Click Source Link

Document

Creates a ProgressDialog with a circular, spinning progress bar.

Usage

From source file:com.psu.capstonew17.pdxaslapp.CreateCardActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_create_card);

    Button bttGetVideo;/*from w  w  w  .  jav  a 2  s  .co  m*/
    Button bttRecordVideo;
    ListView listView;

    //submit button should be invisible until a video has been imported.
    bttSubmit = (Button) findViewById(R.id.button_submit);
    bttSubmit.setText(R.string.button_submit);
    bttSubmit.setVisibility(View.GONE);
    bttSubmit.setOnClickListener(this);

    bttGetVideo = (Button) findViewById(R.id.buttonFromGallery);
    bttGetVideo.setOnClickListener(this);

    bttRecordVideo = (Button) findViewById(R.id.buttonRecordVideo);
    bttRecordVideo.setOnClickListener(this);

    progressDialog = new ProgressDialog(this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setMessage(getResources().getString(R.string.importing_video));
    progressDialog.setIndeterminate(true);
    progressDialog.setCanceledOnTouchOutside(false);

    editText = (EditText) findViewById(R.id.edit_text_video_answer);
    editText.setOnClickListener(this);

    videoView = (VideoView) findViewById(R.id.videoView_create_card);
    videoView.setVisibility(View.GONE);

    //get the list of all decks in the db
    deckList = ExternalDeckManager.getInstance(this).getDecks(null);
    if (deckList.size() > 0)
        findViewById(R.id.noDecksText).setVisibility(View.GONE);

    listRows = new ArrayList<>();
    //populate the list rows for the list view.
    for (int i = 0; i < deckList.size(); i++)
        listRows.add(new ListRow(deckList.get(i).getName(), false));

    //create the list view.
    listView = (ListView) findViewById(R.id.list_items);
    listView.setAdapter(new CustomArrayListAdapter(this, R.layout.list_row, listRows));
}

From source file:prgc.snct.sos.Activities.MapActivity2.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map2);

    locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
    locationManager.addGpsStatusListener(this);

    List<String> providers = locationManager.getProviders(true);
    for (String provider : providers) {
        locationManager.requestLocationUpdates(provider, 3000, 10, this);
    }//from ww  w.ja va2 s  .c  o m

    Button button = (Button) findViewById(R.id.button);
    button.setOnClickListener(this);

    //
    progressDialog = new ProgressDialog(this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setMessage("??......");
    progressDialog.hide();

    //?
    markerPoints = new ArrayList<LatLng>();

    SupportMapFragment mapfragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);

    gMap = mapfragment.getMap();

    if (gMap != null) {

        gMap.setMyLocationEnabled(true);

        //
        gMap.setOnMapClickListener(new OnMapClickListener() {
            @Override
            public void onMapClick(LatLng point) {

                //??
                if (markerPoints.size() > 1) {
                    markerPoints.clear();
                    gMap.clear();
                }

                markerPoints.add(point);

                options = new MarkerOptions();
                options.position(point);

                if (markerPoints.size() == 1) {
                    options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
                    //    options.icon(BitmapDescriptorFactory.fromResource(R.drawable.green));
                    options.title("A");

                } else if (markerPoints.size() == 2) {
                    options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
                    //  options.icon(BitmapDescriptorFactory.fromResource(R.drawable.red));
                    options.title("B");

                }

                gMap.addMarker(options);

                gMap.setOnMarkerClickListener(new OnMarkerClickListener() {
                    @Override
                    public boolean onMarkerClick(Marker marker) {
                        // TODO Auto-generated method stub

                        String title = marker.getTitle();
                        if (title.equals("A")) {
                            marker.setSnippet(info_A);

                        } else if (title.equals("B")) {
                            marker.setSnippet(info_B);
                        }

                        return false;
                    }
                });

                if (markerPoints.size() >= 2) {
                    //
                    routeSearch();
                }
            }
        });
    }
}

From source file:com.zirconi.huaxiaclient.TableActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.table_layout);

    dialog = new ProgressDialog(this);
    dialog.setTitle("");
    dialog.setMessage("");
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.show();/*from  w w w . j a  va2 s . co m*/
    SharedPreferences tmp = this.getSharedPreferences("LOGIN", MODE_PRIVATE);
    NUM = this.getIntent().getStringExtra("NUM");
    T_1 = new String[DAY_PER_WEEK];
    T_2 = new String[DAY_PER_WEEK];
    T_3 = new String[DAY_PER_WEEK];
    T_4 = new String[DAY_PER_WEEK];
    item_1 = new ArrayList<Map<String, String>>();
    item_2 = new ArrayList<Map<String, String>>();
    item_3 = new ArrayList<Map<String, String>>();
    item_4 = new ArrayList<Map<String, String>>();

    lv = (ListView) this.findViewById(R.id.table_lv_week);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, WEEK);

    lv.setAdapter(adapter);

    if (tmp.getBoolean("TEL", true)) {
        this.SERVER = SharedApplication.HTTP_TEL_ADDR;
    } else {
        this.SERVER = SharedApplication.HTTP_CER_ADDR;
    }

    FinalPAGE = SERVER + TABLE_PAGE + SharedApplication.STU_NUM + NUM + EXTRA;
    Log.d("FINALPAGE", FinalPAGE);
    TASK = new AsyncTable();
    TASK.execute(FinalPAGE);

    lv.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Log.d("POSITION", Integer.toString(position));
            switch (position) {
            case 0:
                Intent intent_1 = new Intent(TableActivity.this, DetailActivity.class);
                intent_1.putExtra("day", 0);
                startActivity(intent_1);
                break;
            case 1:
                Intent intent_2 = new Intent(TableActivity.this, DetailActivity.class);
                intent_2.putExtra("day", 1);
                startActivity(intent_2);
                break;
            case 2:
                Intent intent_3 = new Intent(TableActivity.this, DetailActivity.class);
                intent_3.putExtra("day", 2);
                startActivity(intent_3);
                break;
            case 3:
                Intent intent_4 = new Intent(TableActivity.this, DetailActivity.class);
                intent_4.putExtra("day", 3);
                startActivity(intent_4);
                break;
            case 4:
                Intent intent_5 = new Intent(TableActivity.this, DetailActivity.class);
                intent_5.putExtra("day", 4);
                startActivity(intent_5);
                break;
            case 5:
                Intent intent_6 = new Intent(TableActivity.this, DetailActivity.class);
                intent_6.putExtra("day", 5);
                startActivity(intent_6);
                break;
            case 6:
                Intent intent_7 = new Intent(TableActivity.this, DetailActivity.class);
                intent_7.putExtra("day", 6);
                startActivity(intent_7);
                break;
            }
        }
    });

}

From source file:com.softminds.matrixcalculator.OperationFragments.ExponentFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == 500) {
        ProgressDialog progressDialog = new ProgressDialog(getContext());
        progressDialog.setMessage(getString(R.string.Calculating));
        progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progressDialog.setIndeterminate(false);
        progressDialog.setCanceledOnTouchOutside(false);
        progressDialog.show();//from ww w. j a  va  2 s.c  om
        RunAndGetResult(Clicked_pos, data.getIntExtra("QWERTYUIOP", 0), progressDialog);
    }
}

From source file:thproject.test.com.myapplication.SongRecognitionActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_song_recognition);

    context = getApplicationContext();/*  ww  w .java2s  . c om*/

    //handler for events within activity
    handler = new Handler() {
        public void handleMessage(Message msg) {
            Bundle data = msg.getData();
            String artist = data.getString("artist");
            String album = data.getString("album");
            String action = data.getString("action");

            //First action occurs when no tabs are present, progress dialog shown
            if (action.compareTo("test") == 0) {
                Toast.makeText(getApplicationContext(), artist + " " + album, Toast.LENGTH_SHORT).show();
            }
            //Action to show our list of albums
            if (action.compareTo("albums") == 0) {
                showAlbumDialog();
            }
            //Action to show our list of tracks
            if (action.compareTo("tracks") == 0) {
                int index = data.getInt("albumIndex");
                GnAlbum selectedAlbum = albumObjects.get(index);
                showTracksDialog(selectedAlbum);
            }
            //Actino to begin scraping
            if (action.compareTo("scrape") == 0) {
                beginScraping();
            }
            //show progress
            if (action.compareTo("showprogress") == 0) {
                progressDialog = new ProgressDialog(SongRecognitionActivity.this);
                progressDialog.setMessage("Loading tab ");
                progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                progressDialog.show();
            }

            //hide progress
            if (action.compareTo("stopprogress") == 0) {
                progressDialog.hide();
            }

            //update progress
            if (action.compareTo("progresstext") == 0) {
                String text = data.getString("text");
                progressDialog.setMessage("Loading tab " + text);
            }

            //Action to exit this activity
            if (action.compareTo("exit") == 0) {
                Intent i;
                i = new Intent(SongRecognitionActivity.this, MainTabActivity.class);
                startActivity(i);
                finish();
            }
        }
    };
    //Executing asynchronous connection
    new gnSync().execute();

    //disable application icon from ActionBar, set up remaining attributes
    ActionBar actionBar = getActionBar();
    actionBar.hide();
}

From source file:postApp.ActivitiesView.MenuView.FragmentViews.PostitManagerView.ManagePostits.ManagePostitsView.java

/**
 * displays a progress dialog that says loading postits
 *//*from  w w  w.j  ava2s.com*/
public void Loading() {
    progress.setMessage("Loading Postits");
    progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progress.setIndeterminate(true);
    progress.show();
    progress.setCancelable(false);
    progress.setCanceledOnTouchOutside(false);
}

From source file:weavebytes.com.futureerp.activities.RegistrationActivity.java

public void SendRegRequest() {

    new AsyncTask<Void, Void, String>() {

        @Override//w w w .  ja  va2 s  .  c  om
        protected void onPreExecute() {
            super.onPreExecute();
            progress.setMessage("Please Wait..");
            progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            progress.setCancelable(true);
            progress.show();
        }

        @Override
        protected String doInBackground(Void... params) {

            HttpClient httpClient = new DefaultHttpClient();
            HttpPost httpPost = new HttpPost(Config.URL_REGISTER);

            List<NameValuePair> nameValuePair = new ArrayList<>();
            nameValuePair.add(new BasicNameValuePair("email", email));
            nameValuePair.add(new BasicNameValuePair("username", username));
            nameValuePair.add(new BasicNameValuePair("password", password));

            try {
                httpPost.setEntity(new UrlEncodedFormEntity(nameValuePair));

            } catch (UnsupportedEncodingException e) {
                return e + "";
            }
            try {
                HttpResponse response = httpClient.execute(httpPost);
                Log.d("Http Post Response:", response.toString());
                //Converting Response To JsonString
                return ConvertResponse_TO_JSON.entityToString(response.getEntity());
            } catch (ClientProtocolException e) {
                // Log exception
                e.printStackTrace();
            } catch (IOException e) {
                // Log exception
                e.printStackTrace();
            }
            return "Bad NetWork";
        }

        @Override
        protected void onPostExecute(String JsonString) {
            Toast.makeText(RegistrationActivity.this, JsonString, Toast.LENGTH_SHORT).show();
            JSONObject jsonobj = null;
            progress.dismiss();
            try {
                jsonobj = new JSONObject(JsonString);
                //Parsing JSON and Checking the error_code (username ot password are correct or not)

                if (jsonobj.getString("error").equals("0")) {

                    Intent intent = new Intent(RegistrationActivity.this, LoginActivity.class);
                    startActivity(intent);
                    finish();
                } else {
                    Toast.makeText(RegistrationActivity.this, "Failed to register", Toast.LENGTH_SHORT).show();

                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }.execute();
}

From source file:tv.loilo.promise.samples.progress.SampleProgressSpinnerDialogFragment.java

@NonNull
@Override// w w w  .  j ava 2 s  . c  om
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final ProgressDialog progressDialog = new ProgressDialog(getContext(), getTheme());
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setMessage("Loading...");
    progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {

        }
    });
    return progressDialog;
}

From source file:com.example.shuhei.googlemaproute.MapsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);

    ////from w  w  w .  j ava  2  s  . c o  m
    progressDialog = new ProgressDialog(this);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setMessage("......");
    progressDialog.hide();

    //?
    markerPoints = new ArrayList<LatLng>();
    markerPoints2 = new ArrayList<LatLng>();

    SupportMapFragment mapfragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    SupportMapFragment mapfragment2 = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map2);

    gMap = mapfragment.getMap();
    gMap2 = mapfragment2.getMap();

    //??
    LatLng latLng = new LatLng(34.71985, 135.234388);
    gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 13));
    gMap2.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 13));

    if (gMap != null) {

        gMap.setMyLocationEnabled(true);

        gMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {
            @Override
            public void onCameraChange(CameraPosition cameraPosition) {
                gMap2.animateCamera(CameraUpdateFactory.zoomTo(gMap.getCameraPosition().zoom));
            }
        });

        //
        gMap.setOnMapClickListener(new OnMapClickListener() {
            @Override
            public void onMapClick(LatLng point) {

                //??
                if (markerPoints.size() > 1) {
                    markerPoints.clear();
                    gMap.clear();
                    map1sw = false;
                }

                markerPoints.add(point);

                options = new MarkerOptions();
                options.position(point);

                if (markerPoints.size() == 1) {
                    options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
                    // options.icon(BitmapDescriptorFactory.fromResource(R.drawable.green));
                    options.title("A");

                } else if (markerPoints.size() == 2) {
                    options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
                    //options.icon(BitmapDescriptorFactory.fromResource(R.drawable.red));
                    options.title("B");

                }

                gMap.addMarker(options);

                gMap.setOnMarkerClickListener(new OnMarkerClickListener() {
                    @Override
                    public boolean onMarkerClick(Marker marker) {
                        // TODO Auto-generated method stub

                        String title = marker.getTitle();
                        if (title.equals("A")) {
                            marker.setSnippet(info_A);

                        } else if (title.equals("B")) {
                            marker.setSnippet(info_B);
                        }

                        return false;
                    }
                });

                if (markerPoints.size() >= 2) {
                    map1sw = true;
                    //
                    routeSearch();

                }
            }
        });
    }

    if (gMap2 != null) {

        gMap2.setMyLocationEnabled(true);

        //
        gMap2.setOnMapClickListener(new OnMapClickListener() {
            @Override
            public void onMapClick(LatLng point) {

                //??
                if (markerPoints2.size() > 1) {
                    markerPoints2.clear();
                    gMap2.clear();
                    map2sw = true;
                }

                markerPoints2.add(point);

                options2 = new MarkerOptions();
                options2.position(point);

                if (markerPoints2.size() == 1) {
                    options2.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
                    // options.icon(BitmapDescriptorFactory.fromResource(R.drawable.green));
                    options2.title("A");

                } else if (markerPoints2.size() == 2) {
                    options2.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
                    //options.icon(BitmapDescriptorFactory.fromResource(R.drawable.red));
                    options2.title("B");

                }

                gMap2.addMarker(options2);

                gMap2.setOnMarkerClickListener(new OnMarkerClickListener() {
                    @Override
                    public boolean onMarkerClick(Marker marker) {
                        // TODO Auto-generated method stub

                        String title = marker.getTitle();
                        if (title.equals("A")) {
                            marker.setSnippet(info_A2);

                        } else if (title.equals("B")) {
                            marker.setSnippet(info_B2);
                        }

                        return false;
                    }
                });

                if (markerPoints2.size() >= 2) {
                    //
                    map2sw = true;
                    routeSearch2();
                }
            }
        });
    }

    seekBar = (SeekBar) findViewById(R.id.SeekBar01);

    seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            // ???????
            //tv1.setText("Current Value:"+progress);
            Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.map);
            fragment.getView().setAlpha((float) seekBar.getProgress() / (float) 10.0);
        }

        public void onStartTrackingTouch(SeekBar seekBar) {
            // ???????
        }

        public void onStopTrackingTouch(SeekBar seekBar) {
            // ???????
        }
    });
}

From source file:com.mobicage.rogerthat.GetLocationActivity.java

@Override
protected void onServiceBound() {
    T.UI();//  www  .j  a v  a  2 s.co  m
    setContentView(R.layout.get_location);

    mProgressDialog = new ProgressDialog(this);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mProgressDialog.setMessage(getString(R.string.updating_location));
    mProgressDialog.setCancelable(true);
    mProgressDialog.setCanceledOnTouchOutside(true);
    mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialog) {
            T.UI();
            if (mLocationManager != null) {
                try {
                    mLocationManager.removeUpdates(mLocationListener);
                } catch (SecurityException e) {
                    L.bug(e); // Should never happen
                }
            }
        }
    });
    mProgressDialog.setMax(10000);

    mUseGPS = (CheckBox) findViewById(R.id.use_gps_provider);
    mGetCurrentLocationButton = (Button) findViewById(R.id.get_current_location);
    mAddress = (EditText) findViewById(R.id.address);
    mCalculate = (Button) findViewById(R.id.calculate);

    mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
    if (mLocationManager == null) {
        mGetCurrentLocationButton.setEnabled(false);
    } else {
        mUseGPS.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked && !mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
                    new AlertDialog.Builder(GetLocationActivity.this).setMessage(R.string.gps_is_not_enabled)
                            .setPositiveButton(R.string.yes, new SafeDialogInterfaceOnClickListener() {
                                @Override
                                public void safeOnClick(DialogInterface dialog, int which) {
                                    Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                                    startActivityForResult(intent, TURNING_ON_GPS);
                                }
                            }).setNegativeButton(R.string.no, new SafeDialogInterfaceOnClickListener() {
                                @Override
                                public void safeOnClick(DialogInterface dialog, int which) {
                                    mUseGPS.setChecked(false);
                                }
                            }).create().show();
                }
            }
        });

        mGetCurrentLocationButton.setOnClickListener(new SafeViewOnClickListener() {
            @Override
            public void safeOnClick(View v) {
                T.UI();
                if (mService.isPermitted(Manifest.permission.ACCESS_FINE_LOCATION)) {
                    getMyLocation();
                } else {
                    ActivityCompat.requestPermissions(GetLocationActivity.this,
                            new String[] { Manifest.permission.ACCESS_FINE_LOCATION },
                            PERMISSION_REQUEST_ACCESS_FINE_LOCATION);
                }
            }
        });
    }

    mCalculate.setOnClickListener(new SafeViewOnClickListener() {
        @Override
        public void safeOnClick(View v) {
            final ProgressDialog pd = new ProgressDialog(GetLocationActivity.this);
            pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            pd.setMessage(getString(R.string.updating_location));
            pd.setCancelable(false);
            pd.setIndeterminate(true);
            pd.show();
            final String addressText = mAddress.getText().toString();
            mService.postOnIOHandler(new SafeRunnable() {
                @Override
                protected void safeRun() throws Exception {
                    Geocoder geoCoder = new Geocoder(GetLocationActivity.this, Locale.getDefault());
                    try {
                        List<Address> addresses = geoCoder.getFromLocationName(addressText, 5);
                        if (addresses.size() > 0) {
                            Address address = addresses.get(0);
                            final Location location = new Location("");
                            location.setLatitude(address.getLatitude());
                            location.setLongitude(address.getLongitude());
                            mService.postOnUIHandler(new SafeRunnable() {
                                @Override
                                protected void safeRun() throws Exception {
                                    pd.dismiss();
                                    mLocation = location;
                                    showMap();
                                }
                            });
                            return;
                        }
                    } catch (IOException e) {
                        L.d("Failed to geo code address " + addressText, e);
                    }
                    mService.postOnUIHandler(new SafeRunnable() {
                        @Override
                        protected void safeRun() throws Exception {
                            pd.dismiss();
                            UIUtils.showLongToast(GetLocationActivity.this,
                                    getString(R.string.failed_to_lookup_address));
                        }
                    });
                }
            });
        }
    });
}