Example usage for android.app ProgressDialog ProgressDialog

List of usage examples for android.app ProgressDialog ProgressDialog

Introduction

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

Prototype

public ProgressDialog(Context context) 

Source Link

Document

Creates a Progress dialog.

Usage

From source file:com.ntsync.android.sync.activities.VerifyPaymentProgressDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ProgressDialog dialog = new ProgressDialog(getActivity());
    dialog.setMessage(getText(R.string.shop_activity_verifyprogress));
    dialog.setIndeterminate(true);// ww  w .  j  av  a  2s .  c  om
    return dialog;
}

From source file:com.ame.armymax.SearchActivity.java

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

    context = this;
    DataUser.context = context;/*from   w  w w .  ja  va  2  s .c  o m*/
    aq = new AQuery(this);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setTitle("");

    query = getIntent().getStringExtra("query");

    searchBox = (BootstrapEditText) findViewById(R.id.room_name);
    searchBox.setText(query);

    searchButton = (Button) findViewById(R.id.search_button);
    searchButton.setVisibility(View.GONE);

    intent = new Intent(this, ProfileActivity.class);

    searchButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            query = searchBox.getEditableText().toString();

            if (!query.equals("")) {
                String resultUrl = "http://www.armymax.com/api/?action=search&txt=" + query
                        + "&startPoint=0&sizePage=50";
                ProgressDialog dialog = new ProgressDialog(context);
                dialog.setIndeterminate(true);
                dialog.setCancelable(true);
                dialog.setInverseBackgroundForced(false);
                dialog.setCanceledOnTouchOutside(true);
                dialog.setTitle("Finding ...");
                Log.e("searchurl", resultUrl);
                newSearch = true;
                aq.progress(dialog).ajax(resultUrl, JSONObject.class, context, "newSearchResultCb");

            }

        }
    });

    searchBox.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            query = searchBox.getEditableText().toString();

            if (!query.equals("")) {
                String resultUrl = "http://www.armymax.com/api/?action=search&txt=" + query
                        + "&startPoint=0&sizePage=20";

                ProgressDialog dialog = new ProgressDialog(context);
                dialog.setIndeterminate(true);
                dialog.setCancelable(true);
                dialog.setInverseBackgroundForced(false);
                dialog.setCanceledOnTouchOutside(true);
                dialog.setTitle("Finding ...");
                newSearch = true;
                Log.e("q", query);
                aq.ajax(resultUrl, JSONObject.class, context, "newSearchResultCb");
            }

        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub

        }

        @Override
        public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub

        }
    });

    String resultUrl = "http://www.armymax.com/api/?action=search&txt=" + query + "&startPoint=0&sizePage=50";
    aq.ajax(resultUrl, JSONObject.class, this, "searchResultCb");

}

From source file:com.smapley.vehicle.activity.SetActivity.java

private void updatePic(File file) {
    if (file != null) {
        ProgressDialog dialog = new ProgressDialog(this);
        dialog.setMessage("");
        RequestParams params = new RequestParams(Constant.URL_ADDPHOTO);
        params.addBodyParameter("ukey", (String) SP.getUser("ukey"));
        params.addBodyParameter("name", file);
        dialog.show();//from   w  w  w. ja va 2 s  .co  m
        x.http().post(params, new BaseCallback<Map>(dialog) {
            @Override
            public void success(Map result) {
                if (StringUtils.isNoneEmpty(result.get("filename").toString()))
                    x.image().bind(image, Constant.URL_IMG + result.get("filename"), circleImage);
            }
        });
    }

}

From source file:org.openbmap.activities.DialogPreferenceMaps.java

@Override
protected void onBindDialogView(View v) {
    super.onBindDialogView(v);
    groups = new SparseArray<>();
    ExpandableListView listView = (ExpandableListView) v.findViewById(R.id.list);
    mAdapter = new DialogPreferenceMapsListAdapter(getContext(), groups, this);
    listView.setAdapter(mAdapter);//from  w ww  . java 2  s .c  o m

    if (checkDialog == null || !checkDialog.isShowing()) {
        checkDialog = new ProgressDialog(getContext());
    }
    // retrieve online maps
    GetAvailableMapsTask data = new GetAvailableMapsTask();
    data.execute();
}

From source file:com.grass.caishi.cc.activity.main.SettingsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.getBoolean("isConflict", false))
        return;//w  w w. j  av  a  2 s .c  om
    dialog = new ProgressDialog(getActivity());
    dialog.setMessage("?...");
    DeviceUuidFactory uuid = new DeviceUuidFactory(getActivity());
    InitView();
    InitData(false);

}

From source file:com.uraroji.garage.android.arrraycopybench.MainActivity.java

private void startBench() {
    mResultTextView.setText("");

    final String arrayTypeStr = mArrayTypeSpinner.getSelectedItem().toString();
    final int arrayLength = Integer.parseInt(mArrayLengthSpinner.getSelectedItem().toString());
    final int benchTimes = Integer.parseInt(mBenchTimesSpinner.getSelectedItem().toString());

    final ProgressDialog dialog = new ProgressDialog(this);
    dialog.setMessage(getString(R.string.benchmarking));
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setCancelable(false);//from  w w w . jav a  2  s.  c om
    dialog.show();

    final Handler handler = new Handler();

    if (arrayTypeStr.equals("byte")) {
        final byte[] src = new byte[arrayLength];
        for (int i = 0; i < src.length; ++i) {
            src[i] = (byte) i;
        }

        new Thread(new Runnable() {
            @Override
            public void run() {
                BenchResult benchResult = null;

                benchResult = copyClone(src, benchTimes);
                showResult("clone", benchResult, handler);

                benchResult = copyArraycopy(src, benchTimes);
                showResult("System.arraycopy", benchResult, handler);

                benchResult = copyArraysCopyOf(src, benchTimes);
                showResult("Arrays.copyOf", benchResult, handler);

                benchResult = copyForLoop(src, benchTimes);
                showResult("for loop", benchResult, handler);

                benchResult = copyNative(src, benchTimes);
                showResult("native", benchResult, handler);

                dialog.dismiss();
            }
        }).start();
    } else if (arrayTypeStr.equals("short")) {
        final short[] src = new short[arrayLength];
        for (int i = 0; i < src.length; ++i) {
            src[i] = (short) i;
        }

        new Thread(new Runnable() {
            @Override
            public void run() {
                BenchResult benchResult = null;

                benchResult = copyClone(src, benchTimes);
                showResult("clone", benchResult, handler);

                benchResult = copyArraycopy(src, benchTimes);
                showResult("System.arraycopy", benchResult, handler);

                benchResult = copyArraysCopyOf(src, benchTimes);
                showResult("Arrays.copyOf", benchResult, handler);

                benchResult = copyForLoop(src, benchTimes);
                showResult("for loop", benchResult, handler);

                benchResult = copyNative(src, benchTimes);
                showResult("native", benchResult, handler);

                dialog.dismiss();
            }
        }).start();
    } else if (arrayTypeStr.equals("int")) {
        final int[] src = new int[arrayLength];
        for (int i = 0; i < src.length; ++i) {
            src[i] = (int) i;
        }

        new Thread(new Runnable() {
            @Override
            public void run() {
                BenchResult benchResult = null;

                benchResult = copyClone(src, benchTimes);
                showResult("clone", benchResult, handler);

                benchResult = copyArraycopy(src, benchTimes);
                showResult("System.arraycopy", benchResult, handler);

                benchResult = copyArraysCopyOf(src, benchTimes);
                showResult("Arrays.copyOf", benchResult, handler);

                benchResult = copyForLoop(src, benchTimes);
                showResult("for loop", benchResult, handler);

                benchResult = copyNative(src, benchTimes);
                showResult("native", benchResult, handler);

                dialog.dismiss();
            }
        }).start();
    } else if (arrayTypeStr.equals("long")) {
        final long[] src = new long[arrayLength];
        for (int i = 0; i < src.length; ++i) {
            src[i] = (long) i;
        }

        new Thread(new Runnable() {
            @Override
            public void run() {
                BenchResult benchResult = null;

                benchResult = copyClone(src, benchTimes);
                showResult("clone", benchResult, handler);

                benchResult = copyArraycopy(src, benchTimes);
                showResult("System.arraycopy", benchResult, handler);

                benchResult = copyArraysCopyOf(src, benchTimes);
                showResult("Arrays.copyOf", benchResult, handler);

                benchResult = copyForLoop(src, benchTimes);
                showResult("for loop", benchResult, handler);

                benchResult = copyNative(src, benchTimes);
                showResult("native", benchResult, handler);

                dialog.dismiss();
            }
        }).start();
    } else if (arrayTypeStr.equals("double")) {
        final double[] src = new double[arrayLength];
        for (int i = 0; i < src.length; ++i) {
            src[i] = (double) i;
        }

        new Thread(new Runnable() {
            @Override
            public void run() {
                BenchResult benchResult = null;

                benchResult = copyClone(src, benchTimes);
                showResult("clone", benchResult, handler);

                benchResult = copyArraycopy(src, benchTimes);
                showResult("System.arraycopy", benchResult, handler);

                benchResult = copyArraysCopyOf(src, benchTimes);
                showResult("Arrays.copyOf", benchResult, handler);

                benchResult = copyForLoop(src, benchTimes);
                showResult("for loop", benchResult, handler);

                benchResult = copyNative(src, benchTimes);
                showResult("native", benchResult, handler);

                dialog.dismiss();
            }
        }).start();
    } else if (arrayTypeStr.equals("Object")) {
        final Object[] src = new Object[arrayLength];
        for (int i = 0; i < src.length; ++i) {
            src[i] = new Object();
        }

        new Thread(new Runnable() {
            @Override
            public void run() {
                BenchResult benchResult = null;

                benchResult = copyClone(src, benchTimes);
                showResult("clone", benchResult, handler);

                benchResult = copyArraycopy(src, benchTimes);
                showResult("System.arraycopy", benchResult, handler);

                benchResult = copyArraysCopyOf(src, benchTimes);
                showResult("Arrays.copyOf", benchResult, handler);

                benchResult = copyForLoop(src, benchTimes);
                showResult("for loop", benchResult, handler);

                dialog.dismiss();
            }
        }).start();
    } else if (arrayTypeStr.equals("Byte")) {
        final Byte[] src = new Byte[arrayLength];
        for (int i = 0; i < src.length; ++i) {
            src[i] = new Byte((byte) i);
        }

        new Thread(new Runnable() {
            @Override
            public void run() {
                BenchResult benchResult = null;

                benchResult = copyClone(src, benchTimes);
                showResult("clone", benchResult, handler);

                benchResult = copyArraycopy(src, benchTimes);
                showResult("System.arraycopy", benchResult, handler);

                benchResult = copyArraysCopyOf(src, benchTimes);
                showResult("Arrays.copyOf", benchResult, handler);

                benchResult = copyForLoop(src, benchTimes);
                showResult("for loop", benchResult, handler);

                dialog.dismiss();
            }
        }).start();
    } else if (arrayTypeStr.equals("Integer")) {
        final Integer[] src = new Integer[arrayLength];
        for (int i = 0; i < src.length; ++i) {
            src[i] = new Integer((int) i);
        }

        new Thread(new Runnable() {
            @Override
            public void run() {
                BenchResult benchResult = null;

                benchResult = copyClone(src, benchTimes);
                showResult("clone", benchResult, handler);

                benchResult = copyArraycopy(src, benchTimes);
                showResult("System.arraycopy", benchResult, handler);

                benchResult = copyArraysCopyOf(src, benchTimes);
                showResult("Arrays.copyOf", benchResult, handler);

                benchResult = copyForLoop(src, benchTimes);
                showResult("for loop", benchResult, handler);

                dialog.dismiss();
            }
        }).start();
    } else if (arrayTypeStr.equals("Long")) {
        final Long[] src = new Long[arrayLength];
        for (int i = 0; i < src.length; ++i) {
            src[i] = new Long((long) i);
        }

        new Thread(new Runnable() {
            @Override
            public void run() {
                BenchResult benchResult = null;

                benchResult = copyClone(src, benchTimes);
                showResult("clone", benchResult, handler);

                benchResult = copyArraycopy(src, benchTimes);
                showResult("System.arraycopy", benchResult, handler);

                benchResult = copyArraysCopyOf(src, benchTimes);
                showResult("Arrays.copyOf", benchResult, handler);

                benchResult = copyForLoop(src, benchTimes);
                showResult("for loop", benchResult, handler);

                dialog.dismiss();
            }
        }).start();
    } else if (arrayTypeStr.equals("Double")) {
        final Double[] src = new Double[arrayLength];
        for (int i = 0; i < src.length; ++i) {
            src[i] = new Double((double) i);
        }

        new Thread(new Runnable() {
            @Override
            public void run() {
                BenchResult benchResult = null;

                benchResult = copyClone(src, benchTimes);
                showResult("clone", benchResult, handler);

                benchResult = copyArraycopy(src, benchTimes);
                showResult("System.arraycopy", benchResult, handler);

                benchResult = copyArraysCopyOf(src, benchTimes);
                showResult("Arrays.copyOf", benchResult, handler);

                benchResult = copyForLoop(src, benchTimes);
                showResult("for loop", benchResult, handler);

                dialog.dismiss();
            }
        }).start();
    } else {
        dialog.dismiss();
    }
}

From source file:export.UploadManager.java

public UploadManager(Activity activity) {
    this.activity = activity;
    this.context = activity;
    mDBHelper = new DBHelper(activity);
    mDB = mDBHelper.getWritableDatabase();
    mSpinner = new ProgressDialog(activity);
    mSpinner.setCancelable(false);/*w w  w  .  java2s.  c  o  m*/
}

From source file:de.Maxr1998.xposed.maxlock.ui.settings.appslist.AppsListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = new RelativeLayout(getActivity());
    if (finalList == null || finalList.isEmpty()) {
        progressDialog = new ProgressDialog(getActivity());
        progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        progressDialog.setCanceledOnTouchOutside(false);
        progressDialog.setCancelable(true);
        progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
            @Override//from  w  w w. ja  va 2 s .  co  m
            public void onCancel(DialogInterface dialogInterface) {
                task.cancel(true);
            }
        });
        progressDialog.show();
        if (task == null)
            task = new SetupAppList();
        if (!task.getStatus().equals(AsyncTask.Status.RUNNING))
            task.execute();
    } else {
        setup();
    }
    return rootView;
}

From source file:com.piusvelte.taplock.client.core.TapLockToggle.java

@Override
protected void onResume() {
    super.onResume();
    mProgressDialog = new ProgressDialog(this);
    mProgressDialog.setTitle(R.string.title_toggle);
    mProgressDialog.setMessage(mProgressMessage);
    mProgressDialog.setCancelable(true);
    mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override/*  www . ja va  2s  .  c  o m*/
        public void onCancel(DialogInterface dialog) {
            finish();
        }
    });
    mProgressDialog.setButton(getString(R.string.close), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (mServiceInterface != null) {
                try {
                    mServiceInterface.cancelRequest();
                } catch (RemoteException e) {
                    Log.e(TAG, e.toString());
                }
            }
            dialog.cancel();
        }
    });
    mProgressDialog.show();
    mDevices.clear();
    final SharedPreferences sp = getSharedPreferences(KEY_PREFS, MODE_PRIVATE);
    Set<String> devices = sp.getStringSet(KEY_DEVICES, null);
    if (devices != null) {
        for (String device : devices) {
            try {
                mDevices.add(new JSONObject(device));
            } catch (JSONException e) {
                Log.e(TAG, e.toString());
            }
        }
    }
    // start the service before binding so that the service stays around for faster future connections
    startService(TapLock.getPackageIntent(this, TapLockService.class));
    bindService(TapLock.getPackageIntent(this, TapLockService.class), this, BIND_AUTO_CREATE);
}

From source file:com.aokp.romcontrol.github.tasks.DisplayProjectsListTask.java

protected void onPreExecute() {
    // start with a clean view, always
    mFavProjects.removeAll();//from  w w w. j a  v a2s. c o m
    mCategory.removeAll();
    mPrefsList.removeAll(mPrefsList);
    mCategory.setTitle(mContext.getString(R.string.loading_projects));
    mCategory.setOrderingAsAdded(false);
    mFavPackagesStorage = new FavPackagesStorage();
    if (mFavPackagesStorage.getFavProjects().size() > 0) {
        mPreferenceScreen.addPreference(mFavProjects);
    } else {
        mPreferenceScreen.removePreference(mFavProjects);
    }
    if (mProgressDialog == null) {
        mProgressDialog = new ProgressDialog(mAlertDialog.getContext());
        ImageView imageView = new ImageView(mContext);
        imageView.setImageResource(R.drawable.octacat);
        mProgressDialog.show();
        mProgressDialog.setContentView(R.layout.github_octacat);
    }
}