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.pileproject.drive.util.fragment.ProgressDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    if (sProgressDialog != null) {
        return sProgressDialog;
    }/*from   ww  w . ja  v a2 s  .co m*/

    sProgressDialog = new ProgressDialog(getActivity());

    Bundle args = getArguments();

    String title = args.getString(KEY_TITLE);
    String message = args.getString(KEY_MESSAGE);

    if (!TextUtils.isEmpty(title)) {
        sProgressDialog.setTitle(title);
    }
    if (!TextUtils.isEmpty(message)) {
        sProgressDialog.setMessage(message);
    }

    sProgressDialog.setCanceledOnTouchOutside(false);
    sProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);

    return sProgressDialog;
}

From source file:com.fabernovel.alertevoirie.NewsActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_PROGRESS:
        ProgressDialog pd = new ProgressDialog(this);
        pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        pd.setIndeterminate(true);//from   w w  w  .  j a  v  a2  s .  c  om
        pd.setOnDismissListener(new OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                removeDialog(DIALOG_PROGRESS);
            }
        });

        pd.setOnCancelListener(new OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                AVService.getInstance(NewsActivity.this).cancelTask();
                finish();
            }
        });

        pd.setMessage(getString(R.string.ui_message_loading));
        return pd;

    default:
        return super.onCreateDialog(id);
    }
}

From source file:com.fabernovel.alertevoirie.ExistingIncidentsActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_PROGRESS:
        mPd = new ProgressDialog(this);
        mPd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        mPd.setIndeterminate(true);//from   w  w  w .  j  a  v  a2 s  . co  m
        mPd.setOnDismissListener(new OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                removeDialog(DIALOG_PROGRESS);
            }
        });
        mPd.setOnCancelListener(new OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                AVService.getInstance(ExistingIncidentsActivity.this).cancelTask();
                finish();
            }
        });
        mPd.setMessage(getString(R.string.ui_message_loading));
        return mPd;

    default:
        return super.onCreateDialog(id);
    }
}

From source file:net.vivekiyer.GAL.CorporateAddressBook.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_fragment);

    // Initialize preferences and the activesyncmanager
    mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    activeSyncManager = new ActiveSyncManager();

    // Create the progress bar
    progressdialog = new ProgressDialog(this);
    progressdialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressdialog.setCancelable(false);

    // Turn keystrokes into search
    setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);

    // Check if we have successfully connected to an Exchange
    // server before.
    // If not launch the config pane and query the user for
    // Exchange server settings
    if (!loadPreferences()) {
        CorporateAddressBook.showConfiguration(this);
    }//from w ww  .ja v a 2s .  c o m

    // Get the intent, verify the action and get the query
    // but not if the activity is being recreated (would cause a new search)
    if (savedInstanceState == null || !savedInstanceState.containsKey("mContacts")) { //$NON-NLS-1$
        final Intent intent = getIntent();
        onNewIntent(intent);
    }
}

From source file:com.einzig.ipst2.activities.PSListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    ThemeHelper.setSettingsTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pslist);
    ButterKnife.bind(this);
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    ActionBar ab = getSupportActionBar();
    if (ab != null)
        ab.setDisplayHomeAsUpEnabled(true);
    ThemeHelper.initActionBar(getSupportActionBar());
    dialog = new ProgressDialog(this);
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setIndeterminate(true);/*from ww w .ja  va 2 s .  c o  m*/
    dialog.setTitle(getString(R.string.getting_results));
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
    RANGE = getIntent().getExtras().getString(PORTAL_LIST_KEY_RANGE);
    TYPE = getIntent().getExtras().getString(PORTAL_LIST_KEY_TYPE);
    new PortalGrabber(this, RANGE, TYPE, db).execute();
}

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

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    feedName = getIntent().getStringExtra("feed_name");

    setContentView(R.layout.news);//from   ww w .  j  av  a  2 s . c o  m
    String message = getString(R.string.loading);
    mProgressDialog = UIUtils.showProgressDialog(this, null, message, true, true, null,
            ProgressDialog.STYLE_SPINNER, false);

    swipeContainer = (SwipeRefreshLayout) findViewById(R.id.swipeContainer);
    swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            if (!newsPlugin.getNews(true, false)) {
                swipeContainer.setRefreshing(false);
                resetUpdatesAvailable((NewsListAdapter) getAdapter(),
                        (Button) findViewById(R.id.updates_available));
            }
        }
    });

    swipeContainer.setColorSchemeColors(LookAndFeelConstants.getPrimaryColor(this),
            LookAndFeelConstants.getPrimaryIconColor(this));

    processIntent(getIntent(), true);
    mBottomSheetDialog = new BottomSheetDialog(this);
}

From source file:org.adaway.helper.ImportExportHelper.java

/**
 * After user selected file in file manager with openFile() the path of the selected file is
 * returned by onActivityResult in the corresponding activity.
 *
 * @param requestCode//from  w w  w .  j  a  v  a  2s.com
 * @param resultCode
 * @param data
 */
public static void onActivityResultHandleImport(final Context context, int requestCode, int resultCode,
        Intent data) {

    // if request is from import
    if (requestCode == REQUEST_CODE_IMPORT && resultCode == Activity.RESULT_OK && data != null
            && data.getData() != null) {

        final Uri result = data.getData();
        Log.d(Constants.TAG, "File manager Uri: " + result.toString());

        // do it in AsyncTask without blocking the user interface thread
        AsyncTask<Void, Void, Void> importListsTask = new AsyncTask<Void, Void, Void>() {
            private ProgressDialog mApplyProgressDialog;

            @Override
            protected Void doInBackground(Void... unused) {
                THashSet<String> blacklist = null;
                THashSet<String> whitelist = null;
                THashMap<String, String> redirectionList = null;
                try {
                    InputStream is = context.getContentResolver().openInputStream(result);
                    BufferedReader reader = new BufferedReader(new InputStreamReader(is));

                    HostsParser parser = new HostsParser(reader, true, true);
                    blacklist = parser.getBlacklist();
                    whitelist = parser.getWhitelist();
                    redirectionList = parser.getRedirectionList();

                    is.close();
                } catch (FileNotFoundException e) {
                    Log.e(Constants.TAG, "File not found!", e);
                } catch (IOException e) {
                    Log.e(Constants.TAG, "IO Exception", e);
                }

                ProviderHelper.importBlacklist(context, blacklist);
                ProviderHelper.importWhitelist(context, whitelist);
                ProviderHelper.importRedirectionList(context, redirectionList);

                // return nothing as type is Void
                return null;
            }

            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                mApplyProgressDialog = new ProgressDialog(context);
                mApplyProgressDialog.setMessage(context.getString(R.string.import_dialog));
                mApplyProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                mApplyProgressDialog.setCancelable(false);
                mApplyProgressDialog.show();
            }

            @Override
            protected void onPostExecute(Void unused) {
                super.onPostExecute(unused);
                mApplyProgressDialog.dismiss();
            }
        };

        importListsTask.execute();
    }
}

From source file:com.kkbox.toolkit.app.KKActivityDelegate.java

public void onPostResume() {
    if (!KKService.isRunning()) {
        serviceLoadingDialog = new ProgressDialog(activity);
        serviceLoadingDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        serviceLoadingDialog.setMessage(activity.getString(R.string.loading));
        serviceLoadingDialog.setIndeterminate(true);
        serviceLoadingDialog.setCanceledOnTouchOutside(false);
        serviceLoadingDialog.setCancelable(false);
        serviceLoadingDialog.show();/*from w  ww .j ava 2 s.  co  m*/
    }
    KKService.attachListener(serviceListener);
}

From source file:it.sasabz.android.sasabus.InfoActivity.java

/**
 * fills the list_view with the modes which are offered to the user
 *///ww w .ja va 2  s. c o m
public void fillData() {
    SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(this);
    int infocity = Integer.parseInt(shared.getString("infos", "0"));

    progdial = new ProgressDialog(this);

    progdial.setMessage(getResources().getText(R.string.waiting));
    progdial.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progdial.setCancelable(false);
    progdial.show();

    InformationList info = new InformationList(this);
    info.execute(Integer.valueOf(infocity));
}

From source file:io.github.pwlin.cordova.plugins.pdialog.PDialog.java

/**
 * Initializing the progress dialog and set various parameters
 * /*  w w w .ja  v a  2 s  .  c  o m*/
 * @param rawArgs
 * @see https://github.com/pwlin/cordova-plugin-pdialog/blob/master/README.md
 */
private void init(final String rawArgs) {
    final CordovaInterface cordova = this.cordova;
    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            if (PDialog.pDialogObj != null) {
                PDialog.pDialogObj.dismiss();
                PDialog.pDialogObj = null;
            }
            JSONObject argsObj = null;
            try {
                argsObj = new JSONObject(rawArgs);
            } catch (JSONException e) {
                // e.printStackTrace();
            }

            int theme = 5; // ProgressDialog.THEME_DEVICE_DEFAULT_LIGHT
            if (argsObj.has("theme")) {
                String themeArg = null;
                try {
                    themeArg = argsObj.getString("theme");
                } catch (JSONException e) {
                    // e.printStackTrace();
                }
                if ("TRADITIONAL".equals(themeArg)) {
                    theme = 1; // ProgressDialog.THEME_TRADITIONAL
                } else if ("DEVICE_DARK".equals(themeArg)) {
                    theme = 4; // ProgressDialog.THEME_DEVICE_DEFAULT_DARK
                }
                if ("HOLO_DARK".equals(themeArg)) {
                    theme = 2; // ProgressDialog.THEME_HOLO_DARK
                }
                if ("HOLO_LIGHT".equals(themeArg)) {
                    theme = 3; // ProgressDialog.THEME_HOLO_LIGHT
                }
            }

            int style = ProgressDialog.STYLE_SPINNER;
            if (argsObj.has("progressStyle")) {
                try {
                    if ("HORIZONTAL".equals(argsObj.getString("progressStyle"))) {
                        style = ProgressDialog.STYLE_HORIZONTAL;
                    }
                } catch (JSONException e) {
                    // e.printStackTrace();
                }
            }

            boolean cancelable = true;
            if (argsObj.has("cancelable")) {
                try {
                    if (argsObj.getBoolean("cancelable") == false) {
                        cancelable = false;
                    }
                } catch (JSONException e) {
                    // e.printStackTrace();
                }
            }

            String title = "";
            if (argsObj.has("title")) {
                try {
                    title = argsObj.getString("title");
                } catch (JSONException e) {
                    // e.printStackTrace();
                }
            }

            String message = "";
            if (argsObj.has("message")) {
                try {
                    message = argsObj.getString("message");
                } catch (JSONException e) {
                    // e.printStackTrace();
                }
            }

            PDialog.pDialogObj = new ProgressDialog(cordova.getActivity(), theme);
            PDialog.pDialogObj.setProgressStyle(style);
            PDialog.pDialogObj.setCancelable(cancelable);
            PDialog.pDialogObj.setCanceledOnTouchOutside(cancelable);
            PDialog.pDialogObj.setTitle(title);
            PDialog.pDialogObj.setMessage(message);
            PDialog.pDialogObj.show();
        };
    };
    this.cordova.getActivity().runOnUiThread(runnable);
}