List of usage examples for android.app ProgressDialog ProgressDialog
public ProgressDialog(Context context)
From source file:com.njlabs.amrita.aid.gpms.ui.GpmsActivity.java
@Override public void init(Bundle savedInstanceState) { setupLayout(R.layout.activity_gpms_login, Color.parseColor("#009688")); rollNoEditText = (EditText) findViewById(R.id.roll_no); passwordEditText = (EditText) findViewById(R.id.pwd); AlertDialog.Builder builder = new AlertDialog.Builder(baseContext); builder.setMessage("Amrita University does not provide an API for accessing GPMS data. " + "So, if any changes are made to the GPMS Website, please be patient while I try to catch up.") .setCancelable(true).setIcon(R.drawable.ic_action_info_small) .setPositiveButton("Got it !", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel();//from w ww .j ava2 s. com hideSoftKeyboard(); showConnectToAmritaAlert(); } }); AlertDialog alert = builder.create(); alert.requestWindowFeature(Window.FEATURE_NO_TITLE); alert.show(); dialog = new ProgressDialog(baseContext); dialog.setIndeterminate(true); dialog.setCancelable(false); dialog.setInverseBackgroundForced(false); dialog.setCanceledOnTouchOutside(false); dialog.setMessage("Authenticating your credentials ... "); preferences = getSharedPreferences("gpms_prefs", Context.MODE_PRIVATE); String rollNo = preferences.getString("roll_no", ""); String encodedPassword = preferences.getString("password", ""); if (!rollNo.equals("")) { rollNoEditText.setText(rollNo); studentRollNo = rollNo; hideSoftKeyboard(); } else { SharedPreferences aumsPrefs = getSharedPreferences("aums_prefs", Context.MODE_PRIVATE); String aumsRollNo = aumsPrefs.getString("RollNo", ""); if (!aumsRollNo.equals("")) { rollNoEditText.setText(aumsRollNo); studentRollNo = aumsRollNo; hideSoftKeyboard(); } } if (!encodedPassword.equals("")) { passwordEditText.setText(Security.decrypt(encodedPassword, MainApplication.key)); hideSoftKeyboard(); } }
From source file:net.networksaremadeofstring.cyllell.Search.java
public void PerformSearch(final Boolean Crafted) { try {/*from w w w . j a va 2 s.c o m*/ threadCut = new Cuts(Search.this); dialog = new ProgressDialog(this); dialog.setTitle("Chef Search"); dialog.setMessage("Searching for: " + query + "\n\nPlease wait: Prepping Authentication protocols"); dialog.setIndeterminate(true); dialog.show(); Thread dataPreload = new Thread() { public void run() { try { JSONObject Nodes; handler.sendEmptyMessage(200); if (Crafted) { Nodes = threadCut.CraftedSearch(query, index); } else { Nodes = threadCut.Search(query, index); } handler.sendEmptyMessage(201); JSONArray rows = Nodes.getJSONArray("rows"); for (int i = 0; i < rows.length(); i++) { //Log.i("URI", ((JSONObject) rows.get(i)).getString("name")); listOfNodes.add(new Node(((JSONObject) rows.get(i)).getString("name"), "")); } handler.sendEmptyMessage(202); handler.sendEmptyMessage(0); } catch (Exception e) { Message msg = new Message(); Bundle data = new Bundle(); data.putString("exception", e.getMessage()); msg.setData(data); msg.what = 1; handler.sendMessage(msg); } return; } }; dataPreload.start(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:com.ad.mediasharing.ADUploadMediaTask.java
@SuppressWarnings("deprecation") protected void onPreExecute() { Intent intent = new Intent(); pendingIntent = PendingIntent.getActivity(mActivity, 0, intent, 0); contentTitle = "Uploading Story..."; CharSequence contentText = uploadProgress + "% complete"; // Show the notification progress if (isPreferenceProgressEnabled) { notification = new Notification(R.drawable.ic_launcher_ctv, contentTitle, System.currentTimeMillis()); notification.flags = notification.flags | Notification.FLAG_ONGOING_EVENT; notification.contentIntent = pendingIntent; notification.setLatestEventInfo(mActivity, contentTitle, contentText, pendingIntent); notificationManager.notify(NOTIFICATION_ID, notification); }/*from w w w.j a v a 2 s . com*/ // Show the alert progress bar if (isProgressBarEnabled) { pd = new ProgressDialog(mActivity); pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); pd.setMessage(contentTitle); pd.setCancelable(false); pd.show(); } }
From source file:com.njlabs.amrita.aid.aums.AumsActivity.java
@Override public void init(Bundle savedInstanceState) { setupLayout(R.layout.activity_aums, Color.parseColor("#e91e63")); rollNoEditText = (EditText) findViewById(R.id.roll_no); passwordEditText = (EditText) findViewById(R.id.pwd); List<String> campusDataSet = new LinkedList<>(Arrays.asList("Ettimadai", "Amritapuri", "Bangalore", "Mysore", "AIMS", "Business schools", "ASAS Kochi")); spinner = (MaterialSpinner) findViewById(R.id.spinner); spinner.setItems(campusDataSet);// w ww .j a v a2s . c om AlertDialog.Builder builder = new AlertDialog.Builder(baseContext); builder.setMessage("Amrita University does not provide an API for accessing AUMS data. " + "So, if any changes are made to the AUMS Website, please be patient while I try to catch up.") .setCancelable(true).setIcon(R.drawable.ic_action_info_small) .setPositiveButton("Got it !", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); hideSoftKeyboard(); } }); AlertDialog alert = builder.create(); alert.requestWindowFeature(Window.FEATURE_NO_TITLE); alert.show(); dialog = new ProgressDialog(baseContext); dialog.setIndeterminate(true); dialog.setCancelable(false); dialog.setInverseBackgroundForced(false); dialog.setCanceledOnTouchOutside(false); dialog.setMessage("Authenticating your credentials ... "); aumsPreferences = getSharedPreferences("aums_prefs", Context.MODE_PRIVATE); String rollNo = aumsPreferences.getString("RollNo", ""); String encodedPassword = aumsPreferences.getString("Password", ""); spinner.setSelectedIndex(aumsPreferences.getInt("server_ordinal", 0)); aums = new Aums(baseContext); if (!rollNo.equals("")) { ((EditText) findViewById(R.id.roll_no)).setText(rollNo); aums.studentRollNo = rollNo; hideSoftKeyboard(); } if (!encodedPassword.equals("")) { ((EditText) findViewById(R.id.pwd)).setText(Security.decrypt(encodedPassword, MainApplication.key)); hideSoftKeyboard(); } }
From source file:com.TomatoSauceStudio.OnTimeBirthdayPost.OnTimeBirthdayPost.java
/** Called when the activity is first created. */ @Override//from w w w .ja v a 2s .c om public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /** * Request custom title-bar so we can display our own messages. */ requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.main); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar); titleText = (TextView) findViewById(R.id.titlet); /** * Fix our orientation, the list looks best in Portrait and this way we * don't have to deal with orientation changes. */ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); /** * We will use this progress dialog throughout to display busy messages. */ pdialog = new ProgressDialog(this); pdialog.setIndeterminate(true); /** * Init Facebook objects. */ facebook = new Facebook(APP_SECRET); mAsyncRunner = new AsyncFacebookRunner(facebook); /** * Init DB. */ mDbHelper = new BirthdaysDbAdapter(this); mDbHelper.open(); /** * Init the geocoder that will help us map locations to longitude and thus approximate timezone. */ geocoder = new Geocoder(this, Locale.getDefault()); registerForContextMenu(getListView()); /** * Get existing access_token if any and skip authorization if possible. */ mPrefs = getPreferences(MODE_PRIVATE); String access_token = mPrefs.getString("access_token", null); long expires = mPrefs.getLong("access_expires", 0); if (access_token != null) { facebook.setAccessToken(access_token); } if (expires != 0) { facebook.setAccessExpires(expires); } /** * Request FB auth again only if current session is invalid, else proceed to * request info from FB. */ if (!facebook.isSessionValid()) { //Log.d("OnTimeBirthdayPost","Facebook session not valid. Redoing auth."); fbAuthWrapper(); } else { //Log.d("OnTimeBirthdayPost","Facebook session valid. Proceeding to requests"); makeFBRequests(); } }
From source file:com.aibasis.parent.ui.entrance.LoginActivity.java
/** * /*from w w w . j a v a 2s . c o m*/ * * @param view */ public void login(View view) { if (!CommonUtils.isNetWorkConnected(this)) { Toast.makeText(this, R.string.network_isnot_available, Toast.LENGTH_SHORT).show(); return; } currentUsername = usernameEditText.getText().toString().trim(); currentPassword = passwordEditText.getText().toString().trim(); if (TextUtils.isEmpty(currentUsername)) { Toast.makeText(this, R.string.User_name_cannot_be_empty, Toast.LENGTH_SHORT).show(); return; } if (TextUtils.isEmpty(currentPassword)) { Toast.makeText(this, R.string.Password_cannot_be_empty, Toast.LENGTH_SHORT).show(); return; } progressShow = true; final ProgressDialog pd = new ProgressDialog(LoginActivity.this); pd.setCanceledOnTouchOutside(false); pd.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { progressShow = false; } }); pd.setMessage(getString(R.string.Is_landing)); pd.show(); final long start = System.currentTimeMillis(); accountAPI.login(currentUsername, currentPassword, new RequestListener() { @Override public void onComplete(String result) { try { final LoginResult loginResult = LoginResult.parse(result); if (LoginResult.SUCCESS.equals(loginResult.getResult())) { // sdk?? EMChatManager.getInstance().login(loginResult.getEaseId(), loginResult.getEasePassword(), new EMCallBack() { @Override public void onSuccess() { if (!progressShow) { return; } // ????? DemoApplication.getInstance().setUserName(currentUsername); DemoApplication.getInstance().setPassword(currentPassword); DemoApplication.getInstance().setEaseId(loginResult.getEaseId()); DemoApplication.getInstance() .setEasePassword(loginResult.getEasePassword()); DemoApplication.getInstance().setParentId(loginResult.getParentId()); SharePreferenceUtil sharePreferenceUtil = new SharePreferenceUtil( LoginActivity.this); sharePreferenceUtil .setParentId(DemoApplication.getInstance().getParentId()); try { // ** ?logout??? // ** manually load all local groups and EMGroupManager.getInstance().loadAllGroups(); EMChatManager.getInstance().loadAllConversations(); // ?? initializeContacts(); } catch (Exception e) { e.printStackTrace(); // ????? runOnUiThread(new Runnable() { public void run() { pd.dismiss(); DemoHXSDKHelper.getInstance().logout(true, null); Toast.makeText(getApplicationContext(), R.string.login_failure_failed, Toast.LENGTH_SHORT) .show(); } }); return; } // ?nickname ios?nick boolean updatenick = EMChatManager.getInstance() .updateCurrentUserNick(DemoApplication.currentUserNick.trim()); if (!updatenick) { Log.e("LoginActivity", "update current user nick fail"); } if (!LoginActivity.this.isFinishing() && pd.isShowing()) { pd.dismiss(); } // ? Intent intent = new Intent(LoginActivity.this, MainActivity.class); startActivity(intent); finish(); } @Override public void onProgress(int progress, String status) { } @Override public void onError(final int code, final String message) { if (!progressShow) { return; } runOnUiThread(new Runnable() { public void run() { pd.dismiss(); Toast.makeText(getApplicationContext(), getString(R.string.Login_failed) + message, Toast.LENGTH_SHORT).show(); } }); } }); } else if (LoginResult.FAILED.equals(loginResult.getResult())) { { Toast.makeText(getApplicationContext(), getString(R.string.Login_failed), Toast.LENGTH_SHORT).show(); } } } catch (JSONException e) { e.printStackTrace(); } } @Override public void onAPIException(APIException exception) { } }); }
From source file:com.example.harish.b2bapplication.activity.ProfileFragment.java
public void updateProfile() { Log.d("TAG", "Update Pofile"); /* if (!validate()) { onProfileUpdateFailed("Validation Failed"); return;/*from ww w . j a v a 2s . co m*/ }*/ progressdialog = new ProgressDialog(getActivity()); progressdialog.setIndeterminate(false); progressdialog.setMessage("Updating Profile"); progressdialog.show(); // TODO: Implement your own signup logic here. new android.os.Handler().postDelayed(new Runnable() { public void run() { JSONObject temp1; JSONObject holder = new JSONObject(); JSONObject userObj = new JSONObject(); String s[] = new StoreAck().readFile(getContext().getApplicationContext()); String ack = s[0]; String userid = s[1]; try { // for updating profile Image holder.put("profile[profileImg]", getContext().getApplicationContext().getFilesDir() + "/" + "profileImg.jsp"); holder.put("filename", "profileImg.jpg"); holder.put("id", userid); // userObj.put("profile", holder); holder.put("lastname", lastname); holder.put("firstname", firstname); holder.put("nameoffirm", nameoffirm); holder.put("estyear", estyear); holder.put("website", website); holder.put("pan", pan); holder.put("tanvat", tanvat); holder.put("bankacc", bankacc); holder.put("billingaddress", billingaddress); holder.put("deliveryaddress", deliveryaddress); holder.put("id", userid); userObj.put("profile", holder); // Http Post for sign_in and receving token and wirting in internal storage String[] ip = getActivity().getResources().getStringArray(R.array.ip_address); HttpPost httpPost = new HttpPost(ip[0] + "api/v1/profiles/updateprofile"); httpPost.setEntity(new StringEntity(userObj.toString())); httpPost.addHeader("Authorization", "Token token=\"" + ack + "\""); httpPost.setHeader("Accept", "application/json"); httpPost.setHeader("Content-type", "application/json"); HttpResponse response = new DefaultHttpClient().execute(httpPost); Log.d("Http Post Response:", response.toString()); String json = EntityUtils.toString(response.getEntity()); temp1 = new JSONObject(json); Log.d("Response status >>>>>>>", temp1.toString()); if (temp1.has("success")) { if (temp1.getString("success").equals("true")) { Context c = getActivity().getApplicationContext(); new StoreAck().writeFile(c, temp1); progressdialog.dismiss(); onProfileUpdateSuccess(); } else { progressdialog.dismiss(); onProfileUpdateFailed(temp1.getString("Updation Failed")); } } else { progressdialog.dismiss(); onProfileUpdateFailed(temp1.getString("Updation Failed")); } } catch (IOException e) { e.printStackTrace(); progressdialog.dismiss(); // onSigninFailed("error"); } catch (JSONException e) { e.printStackTrace(); progressdialog.dismiss(); // onSigninFailed("error"); } catch (Exception e) { e.printStackTrace(); progressdialog.dismiss(); //onSigninFailed("error"); } } }, 3000); }
From source file:com.ntsync.android.sync.activities.CreatePwdProgressDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { ProgressDialog dialog = new ProgressDialog(getActivity()); dialog.setMessage(getText(R.string.keypwd_activity_createpwd)); dialog.setIndeterminate(true);// www .j a v a2 s . c om return dialog; }
From source file:com.example.android.location.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); progress = new ProgressDialog(this); progress.setCancelable(false);/*w w w .jav a 2s . c o m*/ progress.setMessage("Cargando..."); // Get handles to the UI view objects mLatLng = (TextView) findViewById(R.id.lat_lng); mAddress = (TextView) findViewById(R.id.address); mActivityIndicator = (ProgressBar) findViewById(R.id.address_progress); mConnectionState = (TextView) findViewById(R.id.text_connection_state); mConnectionStatus = (TextView) findViewById(R.id.text_connection_status); // Create a new global location parameters object mLocationRequest = LocationRequest.create(); /* * Set the update interval */ mLocationRequest.setInterval(LocationUtils.UPDATE_INTERVAL_IN_MILLISECONDS); // Use high accuracy mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); // Set the interval ceiling to one minute mLocationRequest.setFastestInterval(LocationUtils.FAST_INTERVAL_CEILING_IN_MILLISECONDS); // Note that location updates are off until the user turns them on mUpdatesRequested = false; // Open Shared Preferences mPrefs = getSharedPreferences(LocationUtils.SHARED_PREFERENCES, Context.MODE_PRIVATE); // Get an editor mEditor = mPrefs.edit(); /* * Create a new location client, using the enclosing class to * handle callbacks. */ mLocationClient = new LocationClient(this, this, this); }
From source file:com.wheelermarine.publicAccessSites.Updater.java
@Override protected void onPreExecute() { // Setup the progress dialog box. progress = new ProgressDialog(context); progress.setTitle("Updating public accesses..."); progress.setMessage("Please wait."); progress.setCancelable(false);/* w w w .jav a2 s.c o m*/ progress.setIndeterminate(true); progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); progress.show(); }