List of usage examples for android.app ProgressDialog setCanceledOnTouchOutside
public void setCanceledOnTouchOutside(boolean cancel)
From source file:Main.java
public static ProgressDialog makeProgressDialog(Context ctx) { ProgressDialog p = new ProgressDialog(ctx); p.setCancelable(false);/*from w w w. j a v a 2 s. c om*/ p.setCanceledOnTouchOutside(false); p.setProgressStyle(ProgressDialog.STYLE_SPINNER); p.setIndeterminate(true); return p; }
From source file:Main.java
public static ProgressDialog createDialog(Context ct) { ProgressDialog progressDialog; progressDialog = new ProgressDialog(ct); progressDialog.setIndeterminate(true); progressDialog.setCancelable(true);//from ww w . java 2 s.c o m progressDialog.setCanceledOnTouchOutside(true); return progressDialog; }
From source file:Main.java
public static ProgressDialog getCustomProgressDialog(Context context, String content, boolean canceledOnTouchOutside, int dialogTheam) { ProgressDialog progressDialog = dialogTheam == 0 ? new ProgressDialog(context) : new ProgressDialog(context, dialogTheam); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setMessage(content);//w w w. j a va 2 s.com progressDialog.setIndeterminate(true); progressDialog.setCanceledOnTouchOutside(canceledOnTouchOutside); return progressDialog; }
From source file:com.huison.DriverAssistant_Web.util.LoginHelper.java
public static void register(final BaseActivity activity, final String username, final String phone, final String password, final String tjrphone, final String yzm) { UmengEventSender.sendEvent(activity, UmengEventTypes.register); final ProgressDialog pd = new ProgressDialog(activity); pd.setMessage("..."); pd.setCanceledOnTouchOutside(false); pd.setCancelable(false);/*from w w w .j a va2 s. co m*/ pd.show(); /* * Map<String, String> map = new HashMap<String, String>(); * map.put("sessionkey", BaseActivity.getSESSIONKEY()); * map.put("userid", username); map.put("mob", phone); * map.put("passwork", password); map.put("version", * activity.getVersionName()); map.put("imei", * DeviceUniqueIdentifier.getIMEIorMEID(activity)); map.put("imsi", * DeviceUniqueIdentifier.getIMSI(activity)); map.put("mac", * DeviceUniqueIdentifier.getMacAddress(activity)); map.put("channel", * getChannel(activity)); map.put("referee", tjrphone); map.put("Lng", ; * map.put("Lat", HomeActivity.gps_jdHomeActivity.gps_wd)); * map.put("Code", yzm); */ AsyncHttpClient client = activity.getAsyncHttpClient(); RequestParams params = new RequestParams(); /* * params.put("action", REGISTER_ACTION); params.put("xml", * BaseActivity.getXML(map)); */ try { JSONObject p = new JSONObject(); p.put("mobile", phone); p.put("password", password); p.put("method", "register"); p.put("version", activity.getVersionName()); p.put("devicetype", "android"); p.put("channel", getChannel(activity)); p.put("imei", DeviceUniqueIdentifier.getIMEIorMEID(activity)); p.put("imsi", "android" + DeviceUniqueIdentifier.getIMSI(activity)); p.put("lat", Env.latitude); p.put("lng", Env.longitude); p.put("mac", DeviceUniqueIdentifier.getMacAddress(activity)); p.put("referee", tjrphone); p.put("username", username); p.put("code", yzm); 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.v("JSON", p.toString()); String data = Util.DesJiaMi(p.toString(), "czxms520"); params.put("data", data); } catch (Exception e) { e.printStackTrace(); } client.post(BaseActivity.REQUESTURL, params, new JsonHttpResponseHandler() { @Override public void onDispatchSuccess(int statusCode, Header[] headers, String result) { Log.v("", "1"); pd.dismiss(); try { result = Util.decrypt(result, "czxms520"); Log.v("JSON", result); JSONObject jo = new JSONObject(result); String code = jo.getString("code"); /* * boolean registerFlag = getJSONValueAsString(jo, "code") * .equals("0"); */ String msg = getJSONValueAsString(jo, "message"); if (code.equals("0")) { String data = jo.getString("data"); jo = new JSONObject(data); /* * registerFlag = getJSONValueAsString(jo, "logincode") * .equals("0"); */ // msg = getJSONValueAsString(jo, "loginmessage"); /* * String passwordMD5 = getJSONValueAsString( jo, * "pass"); */ /* * // String breakRuleRemind = * getJSONValueAsString( jo, "wzxx"); // String * changeLicenseRemind = getJSONValueAsString( jo, * "hzxx"); // String examineRemind = * getJSONValueAsString(jo, "nsxx"); */ // vip /* * boolean isVip = getJSONValueAsString(jo, "Vip") * .equals("true"); // String * blackPointUpdateTime = getJSONValueAsString( jo, * "wzhdtime"); // String toolUpdateTime = * getJSONValueAsString( jo, "sygjtime"); // * String favorUpdateTime = getJSONValueAsString( jo, * "yhtime"); */ /* * boolean isVip = getJSONValueAsString(jo, "Vip") * .equals("true"); */ // 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; } Log.v("VIP", String.valueOf(vip)); activity.markLogin(phone, phone, password, true, "", 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); } try { pd.dismiss(); } catch (Exception e) { e.printStackTrace(); } sendMsg(ConfigActivity.thiz, 0); activity.finish(); } else { activity.showMessageBox(msg); } } catch (JSONException e) { e.printStackTrace(); // activity.markLogout(); // sendMsg(activity,1); activity.showMessageBox(activity.getText(R.string.server404)); Log.e("register error", Log.getStackTraceString(e)); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); activity.showMessageBox(""); } } @Override public void onFailureAnyway(int statusCode, Header[] headers, Throwable throwable, BaseBinaryResponse jsonResponse) { Log.v("C", "1"); pd.dismiss(); activity.showMessageBox(activity.getText(R.string.server404)); } @Override public void onSuccessAnyway(int statusCode, Header[] headers, BaseBinaryResponse jsonResponse) { pd.dismiss(); Log.v("A", "1"); } }); Log.v("B", "1"); TimeCounter.countTime(activity, pd); }
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 w w .j av a2s . c o m*/ 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:com.douncoding.noe.ui.component.ProgressDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { ProgressDialog dialog = new ProgressDialog(getActivity()); dialog.setMessage(getArguments().getString(KEY_TITLE)); dialog.setIndeterminate(true);//from w w w . j a va 2 s. c om dialog.setCancelable(false); dialog.setCanceledOnTouchOutside(false); return dialog; }
From source file:com.akalizakeza.apps.ishusho.activity.ProgressDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { ProgressDialog dialog = new ProgressDialog(getActivity(), getTheme()); dialog.setMessage(getArguments().getString(KEY_TITLE)); dialog.setIndeterminate(true);//from w ww. j a v a 2s . com dialog.setCancelable(false); dialog.setCanceledOnTouchOutside(false); return dialog; }
From source file:com.github.yuukis.businessmap.app.ProgressDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { boolean cancelable = getArguments().getBoolean(CANCELABLE, false); setCancelable(cancelable);/*from ww w .ja v a2 s .co m*/ String title = getArguments().getString(TITLE); String message = getArguments().getString(MESSAGE); ProgressDialog dialog = new ProgressDialog(getActivity()); dialog.setTitle(title); dialog.setMessage(message); dialog.setIndeterminate(false); dialog.setCanceledOnTouchOutside(false); dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setMax(getArguments().getInt(MAX)); return dialog; }
From source file:id.nci.stm_9.ProgressDialogFragment.java
/** * Creates dialog/* w ww . ja v a 2 s. c om*/ */ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Activity activity = getActivity(); ProgressDialog dialog = new ProgressDialog(activity); dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setCancelable(false); dialog.setCanceledOnTouchOutside(false); int messageId = getArguments().getInt(ARG_MESSAGE_ID); int style = getArguments().getInt(ARG_STYLE); dialog.setMessage(getString(messageId)); dialog.setProgressStyle(style); // Disable the back button OnKeyListener keyListener = new OnKeyListener() { @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { return true; } return false; } }; dialog.setOnKeyListener(keyListener); return dialog; }
From source file:org.thialfihar.android.apg.ui.dialog.ProgressDialogFragment.java
/** * Creates dialog// ww w. j a va 2 s .c om */ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Activity activity = getActivity(); ProgressDialog dialog = new ProgressDialog(activity); dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setCancelable(false); dialog.setCanceledOnTouchOutside(false); String message = getArguments().getString(ARG_MESSAGE); int style = getArguments().getInt(ARG_STYLE); boolean cancelable = getArguments().getBoolean(ARG_CANCELABLE); dialog.setMessage(message); dialog.setProgressStyle(style); if (cancelable) { dialog.setButton(DialogInterface.BUTTON_NEGATIVE, activity.getString(R.string.progress_cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); } // Disable the back button OnKeyListener keyListener = new OnKeyListener() { @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { return true; } return false; } }; dialog.setOnKeyListener(keyListener); return dialog; }