List of usage examples for android.app ProgressDialog ProgressDialog
public ProgressDialog(Context context)
From source file:com.imalu.alyou.activity.MySettingActivity.java
public void modifySetting(View v) { final ProgressDialog pd = new ProgressDialog(MySettingActivity.this); pd.setCanceledOnTouchOutside(false); nickname = (EditText) findViewById(R.id.nickname); final String name = nickname.getText().toString(); ModifyUserRequest userInfo = new ModifyUserRequest(); userInfo.setName(name);/*w ww. j a v a 2 s . c om*/ userInfo.setRealname(name); userInfo.setPhoneNum(AlUApplication.getMyInfo().getPhoneNum()); userInfo.setPassword(AlUApplication.getMyInfo().getPassword()); NetManager.execute(NetManager.MODIFY_USER_REQUEST_OPERATION, userInfo, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { try { pd.dismiss(); Log.e("login_check", " response:" + response.toString()); OperationResponse operationRes = new OperationResponse(); operationRes.setJsonObject(response); AlUApplication.getMyInfo().setUsername(name); } catch (Exception e) { e.printStackTrace(); } finish(); } @Override public void onFailure(int statusCode, Header[] headers, final String responseString, Throwable throwable) { runOnUiThread(new Runnable() { public void run() { //pd.dismiss(); Toast.makeText(getApplicationContext(), ": " + responseString, 0).show(); } }); } }); }
From source file:ie.programmer.catcher.browser.AsyncTasks.AsyncMoveTask.java
@Override protected void onPreExecute() { if (mSourceFile == null) return;//from w w w. ja va2s . co m //Skip the rest of this method if the user doesn't want a progress dialog. if (!mShowProgress) return; pd = new ProgressDialog(mContext); pd.setCancelable(false); pd.setIndeterminate(false); pd.setTitle(R.string.move); pd.setMessage(mContext.getResources().getString(R.string.moving) + " " + mSourceFile.getName()); pd.setButton(DialogInterface.BUTTON_NEUTRAL, mContext.getResources().getString(R.string.run_in_background), new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { pd.dismiss(); } }); pd.show(); if (mMoveInterface != null) mMoveInterface.preMoveStartSync(); }
From source file:ie.programmer.catcher.browser.AsyncTasks.AsyncCopyTask.java
@Override protected void onPreExecute() { if (mSourceFile == null) return;//from w ww .ja v a2 s . com //Skip the rest of this method if the user doesn't want a progress dialog. if (!mShowProgress) return; pd = new ProgressDialog(mContext); pd.setCancelable(false); pd.setIndeterminate(false); pd.setTitle(R.string.copy); pd.setMessage(mContext.getResources().getString(R.string.copying) + " " + mSourceFile.getName()); pd.setButton(DialogInterface.BUTTON_NEUTRAL, mContext.getResources().getString(R.string.run_in_background), new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { pd.dismiss(); } }); pd.show(); if (mCopyInterface != null) mCopyInterface.preCopyStartSync(); }
From source file:com.huison.DriverAssistant_Web.util.LoginHelper.java
public static void login(final BaseActivity activity, final String username, final String password, final boolean autoLogin) { Log.i(TAG, "call login func:" + username + "/" + password); ctx = activity;// www.ja v a 2 s . co m UmengEventSender.sendEvent(activity, UmengEventTypes.login); final ProgressDialog pd = new ProgressDialog(activity); pd.setMessage(activity.getString(R.string.logging_wait)); pd.show(); AsyncHttpClient client = activity.getAsyncHttpClient(); RequestParams params = new RequestParams(); try { JSONObject p = new JSONObject(); p.put("mobile", username); p.put("password", password); p.put("method", "login"); p.put("version", activity.getVersionName()); p.put("devicetype", "android"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date curDate = new Date(System.currentTimeMillis()); String time = formatter.format(curDate); p.put("time", time); Log.i(TAG, "request parameters: " + p.toString()); String data = Util.DesJiaMi(p.toString(), "czxms520"); Log.i(TAG, "post data:" + data); params.put("data", data); } catch (Exception e) { activity.showMessageBox(activity.getString(R.string.wrong_profile)); Log.e(TAG, e.getMessage()); e.printStackTrace(); return; } // params.put("xml", BaseActivity.getXML(map)); Log.i(TAG, "AsyncHttpClient post:" + BaseActivity.REQUESTURL); client.post(BaseActivity.REQUESTURL, params, new JsonHttpResponseHandler() { @Override public void onDispatchSuccess(int statusCode, Header[] headers, String result) { Log.i(TAG, "onDispatchSuccess: " + result); pd.dismiss(); try { Log.i(TAG, "decrypting..."); result = Util.decrypt(result, "czxms520"); Log.v(TAG, "result decrypted :" + result); JSONObject jo = new JSONObject(result); String code = jo.getString("code"); String msg = getJSONValueAsString(jo, "message"); if (code.equals("0")) { jo = new JSONObject(jo.getString("data")); // String loginTime = getJSONValueAsString(jo, "LastLogin"); // String lastLoginTime = getJSONValueAsString(jo, "LastLogin"); // SESSIONKEY /* * String sessionKey = getJSONValueAsString( jo, * "sessionkey"); */ // String urlHead = getJSONValueAsString(jo, "PhotoUrl"); String photoUrl = getJSONValueAsString(jo, "PhotoUrl"); String phone = getJSONValueAsString(jo, "Mobile"); Boolean vip = false; if (String.valueOf(jo.getInt("Vip")).equals("1")) { vip = true; } else { vip = false; } Env.isLogined = BaseActivity.isLogined = true; Log.v(TAG, ":1"); activity.markLogin(phone, phone, password, autoLogin, "", loginTime, lastLoginTime, vip); if (!photoUrl.equals("")) { String finalHeadUrl = URLDecoder.decode(photoUrl, "utf-8"); BaseActivity.setUserHeadUrl(finalHeadUrl); BaseActivity.setUserHeadDrawable(null); } else { BaseActivity.setUserHeadUrl(""); BaseActivity.setUserHeadDrawable(null); } // sendMsg(ConfigActivity.thiz,0); // start HomeActivity.now_mobile = phone; // end // // Log.v("", "kk" + phone); LoginActivity.instance.finish(); Util.saveFile(phone, Environment.getExternalStorageDirectory() + "/xmsphone.txt"); SharedPreferences.Editor sharedata = activity.getSharedPreferences("MyData", 0).edit(); sharedata.putString("isJZMM_czxms", "true"); sharedata.commit(); Log.i(TAG, ":2"); sendMsg(0); sendMsg(ConfigActivity.thiz, 2); activity.finish(); } else { Log.e(TAG, "server notify failed: error:" + msg); LoginActivity.pw.setText(""); activity.showMessageBox(msg); } } catch (JSONException e) { Log.e(TAG, "login error" + Log.getStackTraceString(e)); e.printStackTrace(); activity.showMessageBox(activity.getText(R.string.server404)); } catch (Exception e) { Log.e(TAG, Log.getStackTraceString(e)); //e.printStackTrace(); activity.showMessageBox(",."); } } @Override public void onFailureAnyway(int statusCode, Header[] headers, Throwable throwable, BaseBinaryResponse jsonResponse) { Log.i(TAG, "onFailureAnyway: " + statusCode); pd.dismiss(); activity.showMessageBox(activity.getText(R.string.server404)); } @Override public void onSuccessAnyway(int statusCode, Header[] headers, BaseBinaryResponse jsonResponse) { Log.i(TAG, "onSuccessAnyway: " + statusCode); } }); TimeCounter.countTime(activity, pd); }
From source file:com.paramedic.mobshaman.fragments.HistoriaClinicaFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { pDialog = new ProgressDialog(getActivity()); pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); return super.onCreateView(inflater, container, savedInstanceState); }
From source file:com.example.maproot.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ///*w w w . java2 s . c om*/ 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(); //?? LatLng location = new LatLng(33.590205, 130.419238); LatLng e_l = new LatLng(33.590638, 130.412498); gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, 15)); MarkerOptions options = new MarkerOptions(); MarkerOptions end = new MarkerOptions(); options.position(location); options.title("??"); options.snippet(location.toString()); end.position(e_l); end.title("??"); end.snippet(e_l.toString()); // ? gMap.addMarker(options); gMap.addMarker(end); }
From source file:com.openerp.util.OEBinaryDownloadHelper.java
public void downloadBinary(int id, OEDatabase db, Context context) { Log.d(TAG, "OEBinaryDownloadHelper->downloadBinary()"); mContext = context;/*from w ww.j av a2 s.c om*/ try { if (OpenERPServerConnection.isNetworkAvailable(mContext)) { mProgressDialog = new ProgressDialog(mContext); mProgressDialog.setMessage("Downloading..."); mProgressDialog.setIndeterminate(true); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); mProgressDialog.setCancelable(true); downloadTask = new DownloadTask(db); downloadTask.execute(id); } else { Toast.makeText(mContext, "Unable to connect server !", Toast.LENGTH_LONG).show(); } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.psaravan.filebrowserview.lib.AsyncTasks.AsyncMoveTask.java
@Override protected void onPreExecute() { if (mSourceFile == null) return;//ww w . j a v a 2 s . co m //Skip the rest of this method if the user doesn't want a progress dialog. if (!mShowProgress) return; pd = new ProgressDialog(mContext); pd.setCancelable(false); pd.setIndeterminate(false); pd.setTitle(R.string.move); pd.setMessage(mContext.getResources().getString(R.string.moving) + " " + mSourceFile.getName()); pd.setButton(DialogInterface.BUTTON_NEUTRAL, mContext.getResources().getString(R.string.run_in_background), new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { pd.dismiss(); } }); pd.show(); if (mMoveInterface != null) mMoveInterface.preMoveStartSync(); }
From source file:com.psaravan.filebrowserview.lib.AsyncTasks.AsyncCopyTask.java
@Override protected void onPreExecute() { if (mSourceFile == null) return;/*w w w.j a va 2 s . c o m*/ //Skip the rest of this method if the user doesn't want a progress dialog. if (!mShowProgress) return; pd = new ProgressDialog(mContext); pd.setCancelable(false); pd.setIndeterminate(false); pd.setTitle(R.string.copy); pd.setMessage(mContext.getResources().getString(R.string.copying) + " " + mSourceFile.getName()); pd.setButton(DialogInterface.BUTTON_NEUTRAL, mContext.getResources().getString(R.string.run_in_background), new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { pd.dismiss(); } }); pd.show(); if (mCopyInterface != null) mCopyInterface.preCopyStartSync(); }
From source file:com.example.flashcards.oauth.ImportFromGoogleTask.java
@Override protected void onPreExecute() { super.onPreExecute(); mProgressDialog = new ProgressDialog(mActivity); mProgressDialog.setTitle("Loading"); mProgressDialog.setMessage("Pokejte ne se provede import..."); mProgressDialog.show();//from ww w .java2s .com }