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.lauszus.dronedraw.DroneDrawActivity.java

private void uploadFileToDropbox(File file) {
    DbxClientV2 client;/*from   w w w  .  j  a  v  a 2s. c  o  m*/
    try {
        client = DropboxClientFactory.getClient();
    } catch (IllegalStateException e) {
        Toast.makeText(DroneDrawActivity.this, "Please setup your Dropbox account", Toast.LENGTH_SHORT).show();
        return;
    }

    final ProgressDialog dialog = new ProgressDialog(this);
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setCancelable(false);
    dialog.setMessage("Uploading to Dropbox");
    dialog.show();

    new UploadFileTask(client, new UploadFileTask.Callback() {
        @Override
        public void onUploadComplete(FileMetadata result) {
            dialog.dismiss();
            Toast.makeText(DroneDrawActivity.this, "Path uploaded to Dropbox", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onError(Exception e) {
            dialog.dismiss();
            if (D)
                Log.e(TAG, "Failed to upload file: ", e);
            Toast.makeText(DroneDrawActivity.this, "Failed to upload path to Dropbox", Toast.LENGTH_SHORT)
                    .show();
        }
    }).execute(Uri.fromFile(file).toString(), "");
}

From source file:org.deviceconnect.android.deviceplugin.host.setting.HostSettingFragment.java

/**
 * ??.//from   w w w.  j a  v a  2 s  . c  o m
 */
public void showProgressDialog() {
    if (mDialog != null) {
        return;
    }
    mDialog = new ProgressDialog(getActivity());
    mDialog.setTitle("?");
    mDialog.setMessage("Now Loading...");
    mDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mDialog.setCancelable(false);
    mDialog.show();
}

From source file:com.kaszubski.kamil.emmhelper.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    if (fragmentManager.findFragmentById(R.id.container) != null) {
        switch (fragmentManager.findFragmentById(R.id.container).getTag()) {
        case Constants.FRAGMENT_SEARCH:
            longTextTitleMode(false);/*from   w ww .j av  a2 s . co m*/
            setTitle(getString(R.string.application_list));
            getMenuInflater().inflate(R.menu.fragment_search, menu);
            SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
            searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search));
            searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
            searchView.setQueryHint(getString(R.string.query_hint));

            progressDialog = new ProgressDialog(this, ProgressDialog.STYLE_SPINNER);
            progressDialog.setMessage(getString(R.string.loading_packages));
            progressDialog.setIndeterminate(true);
            progressDialog.setCancelable(false);
            progressDialog.show();

            new LoadPackages().execute();

            break;
        case Constants.FRAGMENT_IP_FIND:
            longTextTitleMode(false);
            setTitle(getString(R.string.hostname_ips));
            getMenuInflater().inflate(R.menu.fragment_ip_finder, menu);
            break;
        case Constants.FRAGMENT_EXPORT:
            longTextTitleMode(true);
            break;
        case Constants.FRAGMENT_LICENSE_CHECK:
            longTextTitleMode(false);
            setTitle(getString(R.string.check_elm_key));
            break;
        }
    }
    return true;
}

From source file:com.adarshahd.indianrailinfo.donate.TrainDetails.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_details);
    mActivity = this;
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mDialog = new ProgressDialog(mActivity);
    mDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mDialog.setIndeterminate(true);/* w  w  w  . ja  v a 2 s. c o  m*/
    mDialog.show();
    mButtonAvailability = (Button) findViewById(R.id.id_btn_avail_next_7);
    if (savedInstanceState != null) {
        mDetails = savedInstanceState.getParcelable("LIST");
        if (mDetails == null) {
            return;
        }
        mFrameLayout = null;
        mFrameLayout = (FrameLayout) findViewById(R.id.id_fl_details);
        if (mDetails.getAction().equals(TrainEnquiry.FARE)) {
            getSupportActionBar().setTitle("Fare Details");
            mButtonAvailability.setVisibility(View.GONE);
            createTableLayoutTrainFare();
        }
        if (mDetails.getAction().equals(TrainEnquiry.AVAILABILITY)) {
            getSupportActionBar().setTitle("Availability Details");
            mButtonAvailability.setVisibility(View.VISIBLE);
            mButtonAvailability.setOnClickListener(this);
            createTableLayoutTrainAvailability();
        }
        return;
    }
    mFrameLayout = (FrameLayout) findViewById(R.id.id_fl_details);
    Intent intent = getIntent();
    mAction = intent.getStringExtra(TrainEnquiry.ACTION);
    if (mAction.equals(TrainEnquiry.FARE)) {
        getSupportActionBar().setTitle("Fare Details");
        mButtonAvailability.setVisibility(View.GONE);
        mTrainNumber = intent.getStringExtra(TrainEnquiry.TRAIN);
        mSrc = intent.getStringExtra(TrainEnquiry.SRC);
        mDst = intent.getStringExtra(TrainEnquiry.DST);
        mDay = intent.getStringExtra(TrainEnquiry.DAY_TRAVEL);
        mMonth = intent.getStringExtra(TrainEnquiry.MONTH_TRAVEL);
        mCls = intent.getStringExtra(TrainEnquiry.CLS);
        mAge = intent.getStringExtra(TrainEnquiry.AGE);
        new GetFare().execute();
        mDialog.setMessage("Fetching train fare . . .");
    }
    if (mAction.equals(TrainEnquiry.AVAILABILITY)) {
        getSupportActionBar().setTitle("Availability Details");
        mButtonAvailability.setVisibility(View.VISIBLE);
        mButtonAvailability.setOnClickListener(this);
        mTrainNumber = intent.getStringExtra(TrainEnquiry.TRAIN);
        mSrc = intent.getStringExtra(TrainEnquiry.SRC);
        mDst = intent.getStringExtra(TrainEnquiry.DST);
        mDay = intent.getStringExtra(TrainEnquiry.DAY_TRAVEL);
        mMonth = intent.getStringExtra(TrainEnquiry.MONTH_TRAVEL);
        mCls = intent.getStringExtra(TrainEnquiry.CLS);
        new GetAvail().execute();
        mDialog.setMessage("Fetching train availability . . .");
    }
}

From source file:maimeng.yodian.app.client.android.chat.activity.ShowBigImage.java

/**
 * /*from w w w . ja  v a2 s .c o  m*/
 * 
 * @param remoteFilePath
 */
private void downloadImage(final String remoteFilePath, final Map<String, String> headers) {
    String str1 = getResources().getString(R.string.Download_the_pictures);
    pd = new ProgressDialog(this);
    pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    pd.setCanceledOnTouchOutside(false);
    pd.setMessage(str1);
    pd.show();
    localFilePath = getLocalFilePath(remoteFilePath);
    final EMCallBack callback = new EMCallBack() {
        public void onSuccess() {

            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    DisplayMetrics metrics = new DisplayMetrics();
                    getWindowManager().getDefaultDisplay().getMetrics(metrics);
                    int screenWidth = metrics.widthPixels;
                    int screenHeight = metrics.heightPixels;

                    bitmap = ImageUtils.decodeScaleImage(localFilePath, screenWidth, screenHeight);
                    if (bitmap == null) {
                        image.setImageResource(default_res);
                    } else {
                        image.setImageBitmap(bitmap);
                        ImageCache.getInstance().put(localFilePath, bitmap);
                        isDownloaded = true;
                    }
                    if (pd != null) {
                        pd.dismiss();
                    }
                }
            });
        }

        public void onError(int error, String msg) {
            EMLog.e(TAG, "offline file transfer error:" + msg);
            File file = new File(localFilePath);
            if (file.exists() && file.isFile()) {
                file.delete();
            }
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    pd.dismiss();
                    image.setImageResource(default_res);
                }
            });
        }

        public void onProgress(final int progress, String status) {
            EMLog.d(TAG, "Progress: " + progress);
            final String str2 = getResources().getString(R.string.Download_the_pictures_new);
            runOnUiThread(new Runnable() {
                @Override
                public void run() {

                    pd.setMessage(str2 + progress + "%");
                }
            });
        }
    };

    EMChatManager.getInstance().downloadFile(remoteFilePath, localFilePath, headers, callback);

}

From source file:it.sasabz.android.sasabus.fragments.OnlineShowFragment.java

/** Called with the activity is first created. */
@Override/*ww  w  . java2s  .  c  o  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (!XMLRequest.haveNetworkConnection()) {
        Toast.makeText(getContext(), R.string.no_network_connection, Toast.LENGTH_LONG).show();
        getFragmentManager().popBackStack();
        return null;
    }
    result = inflater.inflate(R.layout.connection_listview_layout, container, false);

    if (list == null && request == null) {
        progress = new ProgressDialog(getContext());
        progress.setMessage(getResources().getText(R.string.waiting));
        progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progress.setCancelable(false);
        progress.show();

        request = new XMLConnectionRequestList(from, to, datetime, this);
        request.execute();
    } else {
        progress = null;
        fillData(list);
    }
    listview = (ListView) result.findViewById(android.R.id.list);
    listview.setOnItemClickListener(this);
    Button later = (Button) result.findViewById(R.id.later);
    Button earlier = (Button) result.findViewById(R.id.earlier);

    later.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            progress = new ProgressDialog(getContext());
            progress.setMessage(getResources().getText(R.string.waiting));
            progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            progress.setCancelable(false);
            progress.show();
            isLater = true;
            XMLForwardScroll forward = new XMLForwardScroll(list, getThis());
            forward.execute();

        }
    });

    earlier.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            progress = new ProgressDialog(getContext());
            progress.setMessage(getResources().getText(R.string.waiting));
            progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            progress.setCancelable(false);
            progress.show();
            isEarlier = true;
            XMLBackwardScroll backward = new XMLBackwardScroll(list, getThis());
            backward.execute();

        }
    });

    Button favorites = (Button) result.findViewById(R.id.favorite);
    favorites.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            SQLiteDatabase favdb = new FavoritenDB(getActivity()).getReadableDatabase();
            Favorit favorit = new Favorit(from.getName(), to.getName());
            if (favorit.insert(favdb)) {
                Toast.makeText(getActivity(), R.string.favorit_add, Toast.LENGTH_LONG).show();
            }
            favdb.close();

        }
    });

    return result;
}

From source file:com.tsroad.map.poisearch.PoiKeywordSearchActivity.java

/**
 * //from w ww. jav  a2 s .c o m
 */
private void showProgressDialog() {
    if (progDialog == null)
        progDialog = new ProgressDialog(this);
    progDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progDialog.setIndeterminate(false);
    progDialog.setCancelable(false);
    progDialog.setMessage("?:\n" + keyWord);
    progDialog.show();
}

From source file:com.urcera.android.ttsearch.TTS_ListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list);//from   w  w  w .ja v  a2 s . c o  m

    // Retrieve the data passed by the intent from MainActivity

    Intent intent = getIntent(); // Capture the intent that started this activity
    if (intent != null) // Confirms if this activity was started through an intent
    {
        String data = intent.getStringExtra(TTS_MainActivity.DATA); // Data from MainActivity
        if (data != null) // Checks if data has value
        {
            query = data; // Assigns to query the data value received from MainActivity
        }

        String myLatitude = intent.getStringExtra(TTS_MainActivity.LAT); // Latitude from MainActivity
        if (myLatitude != null) // Checks if myLatitude has value
        {
            gpsLatitude = myLatitude; // Assigns to gpsLatitude the value received from MainActivity
        } else {
            gpsLatitude = LAT_DEF; // Assigns to gpsLatitude a default value
        }

        String myLongitude = intent.getStringExtra(TTS_MainActivity.LON); // Longitude from MainActivity
        if (myLongitude != null) // Checks if myLongitude has value
        {
            gpsLongitude = myLongitude; // Assigns to gpsLongitude the value received from MainActivity
        } else {
            gpsLongitude = LON_DEF; // Assigns to gpsLongitude a default value
        }
    }

    // >>>>>>>>>> To work on the mobile device until I enable AsyncTask <<<<<<<<<<<<
    //StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitNetwork().build();
    //StrictMode.setThreadPolicy(policy);

    // Configures the progress dialog that is displayed while downloading the JSON
    dialog = new ProgressDialog(this);
    dialog.setTitle("Progreso");
    dialog.setMessage("Descargando ...");
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setCancelable(true);

    // Downloads JSON and generates the list
    new bgTask().execute();

}

From source file:com.robotsandpencils.walkthrough.presentation.main.WalkThroughActivity.java

@Override
public void showProgress() {
    LayoutTheme layoutTheme = mWalkThroughManager.getLayoutConfiguration().getLayoutTheme();
    String message = getString(layoutTheme.getProgressMessage());

    if (layoutTheme.useVerticalProgressDialog()) {
        View view = View.inflate(this, R.layout.vertically_centered_progress_dialog, null);
        TextView progressMessage = (TextView) view.findViewById(R.id.progress_message);
        progressMessage.setText(message);
        progress = ProgressDialog.show(this, null, null, true);
        progress.setContentView(view);/*from  ww w .  ja v a2  s.c om*/
    } else {
        progress = new ProgressDialog(this);
        progress.setMessage(message);
        progress.setIndeterminate(false);
        progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progress.show();
    }

    if (progress.getWindow() != null) {
        progress.getWindow().setBackgroundDrawable(layoutTheme.getProgressBackground());
    }
}