List of usage examples for android.app ProgressDialog setCanceledOnTouchOutside
public void setCanceledOnTouchOutside(boolean cancel)
From source file:com.dcy.psychology.ChatActivity.java
/** * ????// w ww . j av a 2 s. c om * * @param username */ private void addUserToBlacklist(final String username) { final ProgressDialog pd = new ProgressDialog(this); pd.setMessage(getString(R.string.Is_moved_into_blacklist)); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { @Override public void run() { try { EMContactManager.getInstance().addUserToBlackList(username, false); runOnUiThread(new Runnable() { @Override public void run() { pd.dismiss(); Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_success, 0).show(); } }); } catch (EaseMobException e) { e.printStackTrace(); runOnUiThread(new Runnable() { @Override public void run() { pd.dismiss(); Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_failure, 0).show(); } }); } } }).start(); }
From source file:com.techscl.ichat.activity.ChatActivity.java
/** * ???// w ww.jav a2 s . com * * @param username */ private void addUserToBlacklist(final String username) { final ProgressDialog pd = new ProgressDialog(this); pd.setMessage(getString(R.string.Is_moved_into_blacklist)); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { EMContactManager.getInstance().addUserToBlackList(username, false); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); To.show(getString(R.string.Move_into_blacklist_success)); } }); } catch (EaseMobException e) { e.printStackTrace(); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); To.show(getString(R.string.Move_into_blacklist_failure)); } }); } } }).start(); }
From source file:cmu.cconfs.instantMessage.activities.ChatActivity.java
/** * ???//from w ww .ja va2 s. co m * * @param username */ private void addUserToBlacklist(final String username) { final ProgressDialog pd = new ProgressDialog(this); pd.setMessage(getString(R.string.Is_moved_into_blacklist)); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { EMContactManager.getInstance().addUserToBlackList(username, false); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_success, 0).show(); } }); } catch (EaseMobException e) { e.printStackTrace(); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_failure, 0).show(); } }); } } }).start(); }
From source file:cn.hbm.superwechat.activity.ChatActivity.java
/** * ???/*from www.ja va 2s. c o m*/ * * @param username */ private void addUserToBlacklist(final String username) { final ProgressDialog pd = new ProgressDialog(this); pd.setMessage(getString(R.string.Is_moved_into_blacklist)); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { EMContactManager.getInstance().addUserToBlackList(username, false); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_success, Toast.LENGTH_SHORT).show(); } }); } catch (EaseMobException e) { e.printStackTrace(); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_failure, Toast.LENGTH_SHORT).show(); } }); } } }).start(); }
From source file:cn.ucai.chatuidemo.activity.ChatActivity.java
/** * ???/*from www .j av a2 s .c o m*/ * * @param username */ private void addUserToBlacklist(final String username) { final ProgressDialog pd = new ProgressDialog(this); pd.setMessage(getString(R.string.Is_moved_into_blacklist)); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { EMContactManager.getInstance().addUserToBlackList(username, false); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_success, Toast.LENGTH_LONG).show(); } }); } catch (EaseMobException e) { e.printStackTrace(); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getApplicationContext(), R.string.Move_into_blacklist_failure, Toast.LENGTH_LONG).show(); } }); } } }).start(); }
From source file:cn.gen.superwechat.activity.ChatActivity.java
/** * ???/*from w w w. j a v a 2s . c o m*/ * * @param username */ private void addUserToBlacklist(final String username) { final ProgressDialog pd = new ProgressDialog(this); pd.setMessage(getString(cn.gen.superwechat.R.string.Is_moved_into_blacklist)); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { EMContactManager.getInstance().addUserToBlackList(username, false); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getApplicationContext(), cn.gen.superwechat.R.string.Move_into_blacklist_success, Toast.LENGTH_SHORT) .show(); } }); } catch (EaseMobException e) { e.printStackTrace(); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getApplicationContext(), cn.gen.superwechat.R.string.Move_into_blacklist_failure, Toast.LENGTH_SHORT) .show(); } }); } } }).start(); }
From source file:com.eason.marker.emchat.chatuidemo.activity.ChatActivity.java
/** * ???/*from w ww . j a v a 2s .c o m*/ * * @param username */ private void addUserToBlacklist(final String username) { final ProgressDialog pd = new ProgressDialog(this); pd.setMessage(getString(R.string.Is_moved_into_blacklist)); pd.setCanceledOnTouchOutside(false); pd.show(); new Thread(new Runnable() { public void run() { try { EMContactManager.getInstance().addUserToBlackList(username, false); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); GreenToast .makeText(getApplicationContext(), getResources().getString(R.string.Move_into_blacklist_success), 0) .show(); } }); } catch (EaseMobException e) { e.printStackTrace(); runOnUiThread(new Runnable() { public void run() { pd.dismiss(); GreenToast .makeText(getApplicationContext(), getResources().getString(R.string.Move_into_blacklist_failure), 0) .show(); } }); } } }).start(); }
From source file:com.grass.caishi.cc.activity.main.MainActivity.java
void logout() { final ProgressDialog pd = new ProgressDialog(MainActivity.this); String st = "..."; pd.setMessage(st);/*w w w . j a va 2s . c o m*/ pd.setCanceledOnTouchOutside(false); pd.show(); DemoHXSDKHelper.getInstance().logout(true, new EMCallBack() { @Override public void onSuccess() { MainActivity.this.runOnUiThread(new Runnable() { public void run() { pd.dismiss(); // ?? MainActivity.this.finish(); startActivity(new Intent(MainActivity.this, LoginActivity.class)); } }); } @Override public void onProgress(int progress, String status) { } @Override public void onError(int code, String message) { MainActivity.this.runOnUiThread(new Runnable() { @Override public void run() { // pd.dismiss(); Toast.makeText(MainActivity.this, "unbind devicetokens failed", Toast.LENGTH_SHORT).show(); } }); } }); }
From source file:com.dmsl.anyplace.UnifiedNavigationActivity.java
private void startNavigationTask(String id) { if (!NetworkUtils.isOnline(this)) { Toast.makeText(this, "No connection available!", Toast.LENGTH_SHORT).show(); return;//from w w w.j av a2 s .com } // show the info window for the destination marker Marker marker = visiblePois.getMarkerFromPoisModel(id); if (marker != null) { marker.showInfoWindow(); } final BuildingModel b = userData.getSelectedBuilding(); final String floor = userData.getSelectedFloorNumber(); class Status { Boolean task1 = false; Boolean task2 = false; } final Status status = new Status(); final ProgressDialog dialog; dialog = new ProgressDialog(this); dialog.setIndeterminate(true); dialog.setTitle("Plotting navigation"); dialog.setMessage("Please be patient..."); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(false); GeoPoint entrance = null; GeoPoint pos = userData.getPositionWifi(); if (pos == null) { // Find The nearest building entrance from the destination poi PoisModel _entrance = null; PoisModel dest = mAnyplaceCache.getPoisMap().get(id); double min = Double.MAX_VALUE; String currentFloor = userData.getSelectedFloorNumber(); for (PoisModel pm : mAnyplaceCache.getPoisMap().values()) { if (pm.floor_number.equalsIgnoreCase(currentFloor) && pm.is_building_entrance) { double distance = Math.abs(pm.lat() - dest.lat()) + Math.abs(pm.lng() - dest.lng()); if (min > distance) { _entrance = pm; min = distance; } } } if (_entrance != null) { entrance = new GeoPoint(_entrance.lat(), _entrance.lng()); } else { Toast.makeText(this, "No entrance found!", Toast.LENGTH_SHORT).show(); return; } } final GeoPoint entrancef = entrance; // Does not run if entrance==null or is near the building final AsyncTask<Void, Void, String> async1f = new NavDirectionsTask( new NavDirectionsTask.NavDirectionsListener() { @Override public void onNavDirectionsSuccess(String result, List<LatLng> points) { onNavDirectionsAboart(); if (!points.isEmpty()) { // points.add(new LatLng(entrancef.dlat, entrancef.dlon)); pathLineOutsideOptions = new PolylineOptions().addAll(points).width(10).color(Color.RED) .zIndex(100.0f); pathLineOutside = mMap.addPolyline(pathLineOutsideOptions); } } @Override public void onNavDirectionsErrorOrCancel(String result) { onNavDirectionsAboart(); // display the error cause Toast.makeText(getBaseContext(), result, Toast.LENGTH_SHORT).show(); } @Override public void onNavDirectionsAboart() { status.task1 = true; if (status.task1 && status.task2) dialog.dismiss(); else { // First task executed calls this clearLastNavigationInfo(); } } }, userData.getLocationGPSorIP(), entrance); // start the navigation task final AsyncTask<Void, Void, String> async2f = new NavRouteTask(new NavRouteTask.NavRouteListener() { @Override public void onNavRouteSuccess(String result, List<PoisNav> points) { onNavDirectionsAboart(); // set the navigation building and new points userData.setNavBuilding(b); userData.setNavPois(points); // handle drawing of the points handlePathDrawing(points); } @Override public void onNavRouteErrorOrCancel(String result) { onNavDirectionsAboart(); // display the error cause Toast.makeText(getBaseContext(), result, Toast.LENGTH_SHORT).show(); } public void onNavDirectionsAboart() { status.task2 = true; if (status.task1 && status.task2) dialog.dismiss(); else { // First task executed calls this clearLastNavigationInfo(); } } }, this, id, (pos == null) ? entrancef : pos, floor); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { async1f.cancel(true); async2f.cancel(true); } }); dialog.show(); async1f.execute(); async2f.execute(); }
From source file:xj.property.activity.HXBaseActivity.MainActivity.java
/** * ??dialog/*from w w w . j av a2 s . c om*/ */ private void showConflictDialog() { isConflictDialogShow = true; final UserInfoDetailBean detailBean = PreferencesUtil.getLoginInfo(getApplication()); username = detailBean.getUsername(); password = detailBean.getPassword(); final XJUserInfoBean bean = new XJUserInfoBean(); bean.setInfo(detailBean); if (xjpushManager != null) { xjpushManager.unregisterLoginedPushService(); } else { xjpushManager = new XJPushManager(this); xjpushManager.unregisterLoginedPushService(); } // boolean flag= PushManager.getInstance().unBindAlias(MainActivity.this, PreferencesUtil.getLoginInfo(MainActivity.this).getEmobId()); // Log.i("onion","flag"+flag); XjApplication.getInstance().logout(new EMCallBack() { @Override public void onSuccess() { runOnUiThread(new Runnable() { @Override public void run() { refreshUI(); refreshNewBangBiUI(); } }); } @Override public void onError(int i, String s) { } @Override public void onProgress(int i, String s) { } }); PreferencesUtil.Logout(MainActivity.this); if (!MainActivity.this.isFinishing()) { // clear up global variables try { final Dialog dialog = new Dialog(MainActivity.this, R.style.MyDialogStyle); dialog.setContentView(R.layout.dialog_conflict); TextView tv_cancle = (TextView) dialog.findViewById(R.id.tv_cancle); TextView tv_relogin = (TextView) dialog.findViewById(R.id.tv_relogin); tv_cancle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { conflictBuilder = null; dialog.dismiss(); index = 0; updateUnreadLabel(); startActivity(new Intent(MainActivity.this, MainActivity.class)); // finish(); } }); tv_relogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final ProgressDialog pd = new ProgressDialog(MainActivity.this, ProgressDialog.THEME_HOLO_LIGHT); pd.setCanceledOnTouchOutside(false); pd.setCancelable(false); pd.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { progressShow = false; } }); progressShow = true; pd.setMessage("..."); if (pd != null && !MainActivity.this.isFinishing()) pd.show(); //??? // getuser((int) detailBean.getCommunityId(),detailBean.getEmobId()); UserUtils.reLoginUser(MainActivity.this, username, password, new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case Config.LoginUserComplete: if (progressShow) pd.dismiss(); dialog.dismiss(); startActivity(new Intent(MainActivity.this, MainActivity.class)); isConflict = false; // boolean flag = PushManager.getInstance().bindAlias(MainActivity.this, PreferencesUtil.getLoginInfo(MainActivity.this).getEmobId()); PushManager.getInstance().turnOnPush(MainActivity.this); if (xjpushManager == null) { xjpushManager = new XJPushManager(getmContext()); } xjpushManager.registerLoginedPushService(); break; case Config.LoginUserFailure: if (progressShow && !MainActivity.this.isFinishing()) { pd.dismiss(); Toast.makeText(MainActivity.this, "?", Toast.LENGTH_SHORT) .show(); } break; default: pd.setMessage(".."); break; } } }); /* UserUtils.loginEMChat(MainActivity.this, username, bean, new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case Config.LoginUserComplete: if (progressShow) pd.dismiss(); dialog.dismiss(); UserUtils.appLogin(MainActivity.this,PushManager.getInstance().getClientid(MainActivity.this), PreferencesUtil.getLoginInfo(MainActivity.this).getUsername()); startActivity(new Intent(MainActivity.this, MainActivity.class)); isConflict=false; boolean flag= PushManager.getInstance().bindAlias(MainActivity.this, PreferencesUtil.getLoginInfo(MainActivity.this).getEmobId()); PushManager.getInstance().turnOnPush(MainActivity.this); break; case Config.LoginUserFailure: if (progressShow && !MainActivity.this.isFinishing()) { pd.dismiss(); Toast.makeText(MainActivity.this, "?", Toast.LENGTH_SHORT).show(); } break; default: pd.setMessage(".."); break; } } });*/ } }); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); dialog.setCancelable(false); dialog.show(); isConflict = true; } catch (Exception e) { EMLog.e(TAG, "---------color conflictBuilder error" + e.getMessage()); } } }