@Override protected Dialog onCreateDialog(int id) { if (id == ID_DIALOG_MODERATING) { ProgressDialog loadingDialog = new ProgressDialog(CommentsActivity.this); if (commentList.checkedCommentTotal <= 1) { loadingDialog.setMessage(getResources().getText(R.string.moderating_comment)); } else { loadingDialog.setMessage(getResources().getText(R.string.moderating_comments)); } loadingDialog.setIndeterminate(true); loadingDialog.setCancelable(false); return loadingDialog; } else if (id == ID_DIALOG_REPLYING) { ProgressDialog loadingDialog = new ProgressDialog(CommentsActivity.this); loadingDialog.setMessage(getResources().getText(R.string.replying_comment)); loadingDialog.setIndeterminate(true); loadingDialog.setCancelable(false); return loadingDialog; } else if (id == ID_DIALOG_DELETING) { ProgressDialog loadingDialog = new ProgressDialog(CommentsActivity.this); if (commentList.checkedCommentTotal <= 1) { loadingDialog.setMessage(getResources().getText(R.string.deleting_comment)); } else { loadingDialog.setMessage(getResources().getText(R.string.deleting_comments)); } loadingDialog.setIndeterminate(true); loadingDialog.setCancelable(false); return loadingDialog; } return super.onCreateDialog(id); }
@Override public void handleMessage(Message msg) { if (mError == true) { return; } int max = msg.getData().getInt("max"); int total = msg.getData().getInt("counter"); int message = msg.getData().getInt("message"); if (max > 0) { mProgressDialog.setMax(max); // mLogHelper.deleteTableLog(); // fillData(); return; } if (message == 1) { mProgressDialog.setMessage(getResources().getString(R.string.downloading)); } else if (message == 2) { mProgressDialog.setMessage(getResources().getString(R.string.extracting)); } mProgressDialog.setProgress(total); if (total == -2) { // ERROR downloading template mProgressDialog.dismiss(); mError = true; showErrorDownloadMessage(); } else if (total == -1) { mProgressDialog.dismiss(); finalizeGetIndexingTemplate(); } }
@Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_FORGET_PASSWORD: LayoutInflater factory = LayoutInflater.from(this); final View forgetPwd = factory.inflate(R.layout.alert_dialog_forget_password, null); return new AlertDialog.Builder(UserLogin.this) .setIcon(R.drawable.star_big_on) .setTitle(R.string.forget_password) .setView(forgetPwd) .setPositiveButton( R.string.giveCall, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Intent myIntentDial = new Intent("android.intent.action.CALL", Uri.parse("tel:4006651000")); startActivity(myIntentDial); } }) .setNegativeButton( R.string.return_button, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) {} }) .create(); case DIALOG_PROTOCOL: return new AlertDialog.Builder(UserLogin.this) .setTitle(R.string.login_string_protocol) .setView(getView()) .setPositiveButton( R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) {} }) .setNegativeButton( R.string.xitongshezhi_check_off, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) {} }) .create(); // 网络连接提示框 2010/7/11 陈晨 case PROGRESS_VALUE: progressDialog = new ProgressDialog(this); progressDialog.setTitle("提示"); progressDialog.setMessage("网络连接中..."); progressDialog.setIndeterminate(true); progressDialog.setCancelable(true); return progressDialog; case PROGRESS: Dialog dialog = null; dialog = new ProgressDialog(this); ((ProgressDialog) dialog).setMessage("请求中,请稍等..."); return dialog; } // } return null; }
private static void beginShutdownSequence(Context context) { synchronized (sIsStartedGuard) { if (sIsStarted) { Log.d(TAG, "Shutdown sequence already running, returning."); return; } sIsStarted = true; } // throw up an indeterminate system dialog to indicate radio is // shutting down. ProgressDialog pd = new ProgressDialog(context); if (mReboot) { pd.setTitle(context.getText(com.android.internal.R.string.reboot_system)); pd.setMessage(context.getText(com.android.internal.R.string.reboot_progress)); } else { pd.setTitle(context.getText(com.android.internal.R.string.power_off)); pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress)); } pd.setIndeterminate(true); pd.setCancelable(false); pd.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG); pd.show(); sInstance.mContext = context; sInstance.mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); // make sure we never fall asleep again sInstance.mCpuWakeLock = null; try { sInstance.mCpuWakeLock = sInstance.mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG + "-cpu"); sInstance.mCpuWakeLock.setReferenceCounted(false); sInstance.mCpuWakeLock.acquire(); } catch (SecurityException e) { Log.w(TAG, "No permission to acquire wake lock", e); sInstance.mCpuWakeLock = null; } // also make sure the screen stays on for better user experience sInstance.mScreenWakeLock = null; if (sInstance.mPowerManager.isScreenOn()) { try { sInstance.mScreenWakeLock = sInstance.mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, TAG + "-screen"); sInstance.mScreenWakeLock.setReferenceCounted(false); sInstance.mScreenWakeLock.acquire(); } catch (SecurityException e) { Log.w(TAG, "No permission to acquire wake lock", e); sInstance.mScreenWakeLock = null; } } // start the thread that initiates shutdown sInstance.mHandler = new Handler() {}; sInstance.start(); }
@Override protected Dialog onCreateDialog(int id) { ProgressDialog dialog = new ProgressDialog(this); dialog.setCancelable(false); dialog.setIndeterminate(true); if (id == DIALOG_SET_SUBSCRIPTION_IN_PROGRESS) { dialog.setMessage(getResources().getString(R.string.switch_networkType_progress)); return dialog; } else if (id == DIALOG_DISABLE_CARD2_GSM_IN_PROGRESS) { dialog.setMessage(getResources().getString(R.string.disable_card2_gsm_progress)); return dialog; } return null; }
@Override public void onPageStarted(Context context, WebView view, String url, Bitmap favicon) { mDlg = new ProgressDialog(context); mDlg.setMessage("Loading..."); mDlg.show(); super.onPageStarted(context, view, url, favicon); }
@Override protected void onPreExecute() { super.onPreExecute(); pdia = new ProgressDialog(IlanAraActivity.this); pdia.setMessage("İlanlar Aranıyor..."); pdia.show(); }
private void showMapWithLocationClient() { progressDialog = new ProgressDialog(this); progressDialog.setCanceledOnTouchOutside(false); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setMessage("正在确定你的位置..."); progressDialog.setOnCancelListener( new OnCancelListener() { public void onCancel(DialogInterface arg0) { if (progressDialog.isShowing()) { progressDialog.dismiss(); } Log.d("map", "cancel retrieve location"); finish(); } }); progressDialog.show(); mLocClient = new LocationClient(this); mLocClient.registerLocationListener(myListener); LocationClientOption option = new LocationClientOption(); option.setOpenGps(true); // 打开gps // option.setCoorType("bd09ll"); //设置坐标类型 // Johnson change to use gcj02 coordination. chinese national standard // so need to conver to bd09 everytime when draw on baidu map option.setCoorType("gcj02"); option.setScanSpan(30000); option.setAddrType("all"); mLocClient.setLocOption(option); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSpinner = new ProgressDialog(getContext()); mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE); mSpinner.setMessage("Loading..."); mContent = new LinearLayout(getContext()); mContent.setOrientation(LinearLayout.VERTICAL); setUpTitle(); setUpWebView(); Display display = getWindow().getWindowManager().getDefaultDisplay(); final float scale = getContext().getResources().getDisplayMetrics().density; float[] dimensions = (display.getWidth() < display.getHeight()) ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE; addContentView( mContent, new FrameLayout.LayoutParams( (int) (dimensions[0] * scale + 0.5f), (int) (dimensions[1] * scale + 0.5f))); }
/** This function downloads the Splash Image from the Parse Table 'Splash' */ public void downloadSplashImage() { Log.e("downloadSplashImage", "downloadSplashImage"); dialog1.setMessage("Downloading Splash Image..."); ParseQuery<ParseObject> query = ParseQuery.getQuery("Splash"); query.whereEqualTo("username", Login.USERNAME); query.findInBackground( new FindCallback<ParseObject>() { public void done(List<ParseObject> objects, ParseException e) { if (e == null) { ParseFile myFile = objects.get(0).getParseFile("image"); myFile.getDataInBackground( new GetDataCallback() { public void done(byte[] data, ParseException e) { if (e == null) { // user the function writeFile() to create the file in the Internal Memory // the file name will be like someusername_splash.jpg writeFile(data, Login.USERNAME + "_splash.jpg"); // once the splash image is downloaded, we need to download the images for // the listview. downloadImages(); } else { Log.e("Something went wrong", "Something went wrong"); } } }); } else { Log.e("PARSE", "Error: " + e.getMessage()); } } }); }
private void initLoadingDialog() { if (progressDialog == null) { progressDialog = new ProgressDialog(this); progressDialog.setMessage(getString(R.string.settings_cuc_loading)); progressDialog.setCancelable(false); } }
/** * Shows a simple native progress dialog<br> * Subclass can override below two methods for custom dialogs- <br> * 1. showProgressDialog <br> * 2. removeProgressDialog * * @param bodyText */ public void showProgressDialog(String bodyText) { if (isFinishing()) { return; } if (mProgressDialog == null) { mProgressDialog = new ProgressDialog(BaseActivity.this); mProgressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mProgressDialog.setCancelable(false); mProgressDialog.setOnKeyListener( new Dialog.OnKeyListener() { @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_CAMERA || keyCode == KeyEvent.KEYCODE_SEARCH) { return true; // } return false; } }); } mProgressDialog.setMessage(bodyText); if (!mProgressDialog.isShowing()) { mProgressDialog.show(); } }
private void setVisibility(int visibility) { if (visibility == CONNECT_VIEW) { rootview.setVisibility(View.GONE); connect_button_view.setVisibility(View.VISIBLE); textViewShowTime.setVisibility(View.GONE); } else if (visibility == TREATMENT_SERVICE_NOT_FOUND) { rootview.setVisibility(View.VISIBLE); connect_button_view.setVisibility(View.GONE); buttonStartTime.setVisibility(View.GONE); textViewShowTime.setVisibility(View.GONE); mProgressBar.setVisibility(View.GONE); delayCheckBox.setVisibility(View.GONE); // create progressdialog while connecting to the services progressDialog = new ProgressDialog(this); // show message progressDialog.setMessage("Connecting to the services"); progressDialog.show(); } else if (visibility == TREATMENT_SERVICE_FOUND) { rootview.setVisibility(View.VISIBLE); connect_button_view.setVisibility(View.GONE); buttonStartTime.setVisibility(View.VISIBLE); mProgressBar.setVisibility(View.VISIBLE); delayCheckBox.setVisibility(View.VISIBLE); // dismiss the progressdialog progressDialog.dismiss(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.searchstore_layout); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Recibo la palabra de la activity anterior Bundle b = this.getIntent().getExtras(); // La paso a una variable String word = b.getString("SearchText"); result = (TextView) findViewById(R.id.empty_result); result.setVisibility(View.INVISIBLE); PDialog = new ProgressDialog(this); PDialog.setMessage(getString(R.string.searching)); PDialog.setIndeterminate(false); PDialog.setCancelable(false); PDialog.show(); ABar = getActionBar(); ABar.setDisplayHomeAsUpEnabled(true); snc = new SearchNetworkConnection(listener, this); ibnc = new InfoBuyNetworkConnection(this); ibnc.execute(new Configuration(this).getUserId()); snc.execute(word); }
public void processToken(String callbackUrl) { progressDialog.setMessage("Finalizing ..."); progressDialog.show(); final String verifier = getVerifier(callbackUrl); new Thread() { @Override public void run() { int what = 1; try { httpOauthprovider.retrieveAccessToken(httpOauthConsumer, verifier); accessToken = new AccessToken(httpOauthConsumer.getToken(), httpOauthConsumer.getTokenSecret()); configureToken(); User user = twitter.verifyCredentials(); session.storeAccessToken(accessToken, user.getName()); what = 0; } catch (Exception e) { e.printStackTrace(); } handler.sendMessage(handler.obtainMessage(what, 2, 0)); } }.start(); }
public void setProgressMessage(String message) { if (progressDialog != null) { progressDialog.setMessage(message); } else if (textView != null) { textView.setText(message); } }
private void initProgressDialog() { progressDialog = new ProgressDialog(context); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setMessage(message); progressDialog.setOnCancelListener(this); progressDialog.show(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_result); final ProgressDialog progressDialog; progressDialog = new ProgressDialog(ResultActivity.this); progressDialog.setMessage("Please wait..."); progressDialog.setCancelable(false); progressDialog.show(); Handler handler = new Handler(); handler.postDelayed( new Runnable() { public void run() { progressDialog.dismiss(); ImageView imageView = (ImageView) findViewById(R.id.imageView2); imageView.setImageResource(R.drawable.lol); TextView name = (TextView) findViewById(R.id.textView3); name.setText("{commonAtr: \"banana\" }"); // Brian Comment: Dummy for presentation } }, 5500); }
@Override protected void onPreExecute() { super.onPreExecute(); dialog.setMessage(getString(R.string.editor_uploading_image)); dialog.setCancelable(false); dialog.show(); }
private void progressDialogInitialization() { progressDialog = new ProgressDialog(this); progressDialog.setCancelable(false); progressDialog.setTitle("Loading ..."); progressDialog.setMessage("Please wait"); progressDialog.show(); }
@Override public void handleMessage(Message message) { Bundle bundle = message.getData(); if (bundle.containsKey("showProgressDialog")) { myProgressDialog = ProgressDialog.show(ScriptActivity.this, "Installing", "Loading", true); } else if (bundle.containsKey("setMessageProgressDialog")) { if (myProgressDialog.isShowing()) { myProgressDialog.setMessage(bundle.getString("setMessageProgressDialog")); } } else if (bundle.containsKey("dismissProgressDialog")) { if (myProgressDialog.isShowing()) { myProgressDialog.dismiss(); } } else if (bundle.containsKey("installSucceed")) { Toast toast = Toast.makeText(getApplicationContext(), "Install Succeed", Toast.LENGTH_LONG); toast.show(); } else if (bundle.containsKey("installFailed")) { Toast toast = Toast.makeText( getApplicationContext(), "Install Failed. Please check logs.", Toast.LENGTH_LONG); toast.show(); } }
@Override public void onResume() { super.onResume(); mProgressDialog.setMessage(getResources().getString(R.string.loading)); mProgressDialog.show(); // stage and commit changes to the current project Project p = AppContext.projectManager().getSelectedProject(); if (p != null) { p.commit( new Project.OnCommitComplete() { @Override public void success() { init(); mProgressDialog.dismiss(); } @Override public void error(Throwable e) { mProgressDialog.dismiss(); AppContext.context().showToastMessage(R.string.project_share_exception); finish(); } }); } else { init(); mProgressDialog.dismiss(); } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Context context = getActivity(); // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_training_detail, container, false); // Expandable Summary ExpandList = (ExpandableListView) view.findViewById(R.id.training_summary); Bundle bundle = getArguments(); String trainingCode = bundle.getString("trainingCode"); trainingUrl = String.format("http://eas.elephorm.com/api/v1/trainings/%1$s", trainingCode); training_title = (TextView) view.findViewById(R.id.training_title); training_video = (VideoView) view.findViewById(R.id.training_video); training_video.setMediaController(new MediaController(context)); // BOITE DE DIALOGUE pDialog = new ProgressDialog(getActivity()); pDialog.setMessage("Chargement..."); pDialog.setCancelable(false); makeJsonObjectRequest(); ExpandList.setOnChildClickListener( new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick( ExpandableListView expandableListView, View view, int parentPosition, int childPosition, long l) { String courseId = list.get(parentPosition).getItems().get(childPosition).getId(); Intent intent = new Intent(getActivity(), CourseActivity.class); intent.putExtra("courseId", courseId); intent.putExtra("trainingUrl", trainingUrl); startActivity(intent); return false; } }); training_video.start(); training_video.setOnCompletionListener( new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mediaPlayer) { System.out.println("C'est fini :("); saveHistory(); } }); return view; }
/** * @param activity that supports onCreateDialog({@link #PROGRESS_DIALOG}) and returns @param * progressdialog * @param progressDialog - it should be exactly the same as onCreateDialog * @return */ public void checkApplicationIsBeingInitialized(Activity activity, ProgressDialog progressDialog) { // start application if it was previously closed startApplication(); synchronized (OsmandApplication.this) { if (startDialog != null) { try { SpecialPhrases.setLanguage(this, osmandSettings); } catch (IOException e) { LOG.error("I/O exception", e); Toast error = Toast.makeText( this, "Error while reading the special phrases. Restart OsmAnd if possible", Toast.LENGTH_LONG); error.show(); } progressDialog.setTitle(getString(R.string.loading_data)); progressDialog.setMessage(getString(R.string.reading_indexes)); activity.showDialog(PROGRESS_DIALOG); startDialog.setDialog(progressDialog); } else if (startingWarnings != null) { showWarnings(startingWarnings, activity); } } }
public void sendVideo(View view) { if (TextUtils.isEmpty(localPath)) { EMLog.e("Recorder", "recorder fail please try again!"); return; } if (msc == null) msc = new MediaScannerConnection( this, new MediaScannerConnectionClient() { @Override public void onScanCompleted(String path, Uri uri) { EMLog.d(TAG, "scanner completed"); msc.disconnect(); progressDialog.dismiss(); setResult(RESULT_OK, getIntent().putExtra("uri", uri)); finish(); } @Override public void onMediaScannerConnected() { msc.scanFile(localPath, "video/*"); } }); if (progressDialog == null) { progressDialog = new ProgressDialog(this); progressDialog.setMessage("processing..."); progressDialog.setCancelable(false); } progressDialog.show(); msc.connect(); }
private void submitEssay() { final ProgressDialog progress = new ProgressDialog(CopyEssay.this); progress.setMessage(getString(R.string.please_wait_message)); progress.setProgressStyle(ProgressDialog.STYLE_SPINNER); progress.setCancelable(false); progress.show(); String t = title.getText().toString(); String s = subject.getText().toString(); ParseObject essay = new ParseObject("essays"); essay.put("title", t); essay.put("subject", s); essay.put("content", essay_txt.getText().toString()); essay.saveInBackground( new SaveCallback() { @Override public void done(com.parse.ParseException e) { if (e != null) { e.printStackTrace(); } else { progress.dismiss(); displaySnackbar(); Intent intent = new Intent(CopyEssay.this, HomeScreen.class); startActivity(intent); } } }); }
@Override protected void onPreExecute() { pd = new ProgressDialog(activity); pd.setMessage("Loading..."); pd.setIndeterminate(false); pd.show(); }
void showProgress(int msgId) { progress = new ProgressDialog(this); progress.setMessage(getString(msgId)); progress.setIndeterminate(true); progress.setCancelable(true); progress.setOnCancelListener(abortListener); final int msgId2 = msgId; progress.setButton( DialogInterface.BUTTON_POSITIVE, getString(R.string.background), new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int which) { // Cheat slightly: just launch home screen startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)); // Argh, can't prevent a dismiss at this point, so re-show it showProgress(msgId2); Toast.makeText(SGTPuzzles.this, R.string.bg_unreliable_warn, Toast.LENGTH_LONG).show(); } }); progress.setButton( DialogInterface.BUTTON_NEGATIVE, getString(android.R.string.cancel), handler.obtainMessage(MsgType.ABORT.ordinal())); progress.show(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSpinner = new ProgressDialog(getContext()); mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE); mSpinner.setMessage("Loading..."); requestWindowFeature(Window.FEATURE_NO_TITLE); mContent = new FrameLayout(getContext()); /* Create the 'x' image, but don't add to the mContent layout yet * at this point, we only need to know its drawable width and height * to place the webview */ createCrossImage(); /* Now we know 'x' drawable width and height, * layout the webivew and add it the mContent layout */ int crossWidth = mCrossImage.getDrawable().getIntrinsicWidth(); setUpWebView(crossWidth / 2); /* Finally add the 'x' image to the mContent layout and * add mContent to the Dialog view */ mContent.addView( mCrossImage, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); addContentView(mContent, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); }
@Override protected void onPreExecute() { super.onPreExecute(); // Shows Progress Bar Dialog and then call doInBackground method dialog.setMessage("Deleting database & archive files. Please wait..."); dialog.show(); }