예제 #1
0
  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();
  }
예제 #2
0
 @Override
 protected Dialog onCreateDialog(int id) {
   switch (id) {
     case DIALOG_MAP_VERSION_UPDATE:
       AlertDialog.Builder builder = new AlertDialog.Builder(this);
       builder.setMessage(R.string.map_version_changed_info);
       builder.setPositiveButton(
           R.string.button_upgrade_osmandplus,
           new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
               Intent intent =
                   new Intent(
                       Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:net.osmand.plus"));
               try {
                 startActivity(intent);
               } catch (ActivityNotFoundException e) {
               }
             }
           });
       builder.setNegativeButton(
           R.string.default_buttons_cancel,
           new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialog, int which) {
               removeDialog(DIALOG_MAP_VERSION_UPDATE);
             }
           });
       return builder.create();
     case DIALOG_PROGRESS_LIST:
       ProgressDialog dialog = new ProgressDialog(this);
       dialog.setTitle(R.string.downloading);
       dialog.setMessage(getString(R.string.downloading_list_indexes));
       dialog.setCancelable(true);
       return dialog;
     case DIALOG_PROGRESS_FILE:
       ProgressDialogImplementation progress =
           ProgressDialogImplementation.createProgressDialog(
               DownloadIndexActivity.this,
               getString(R.string.downloading),
               getString(R.string.downloading_file),
               ProgressDialog.STYLE_HORIZONTAL,
               new DialogInterface.OnCancelListener() {
                 @Override
                 public void onCancel(DialogInterface dialog) {
                   makeSureUserCancelDownload(dialog);
                 }
               });
       progressFileDlg = progress.getDialog();
       progressFileDlg.setOnDismissListener(
           new DialogInterface.OnDismissListener() {
             @Override
             public void onDismiss(DialogInterface dialog) {
               downloadFileHelper.setInterruptDownloading(true);
             }
           });
       return progress.getDialog();
   }
   return null;
 }
예제 #3
0
 private void progressDialogInitialization() {
   progressDialog = new ProgressDialog(this);
   progressDialog.setCancelable(false);
   progressDialog.setTitle("Loading ...");
   progressDialog.setMessage("Please wait");
   progressDialog.show();
 }
 @Override
 public void onHttpStart(BaseProtocolData data) {
   mProgressDialog = new ProgressDialog(this);
   mProgressDialog.setTitle("Notice");
   mProgressDialog.setMessage("waiting...");
   mProgressDialog.show();
 }
  public void onButtonApplyClicked(View view) {
    if (printOrder.getPromoCode() != null) {
      // Clear promo code
      printOrder.clearPromoCode();
      updateViewsBasedOnPromoCodeChange();
    } else {
      // Apply promo code
      final ProgressDialog dialog = new ProgressDialog(this);
      dialog.setCancelable(false);
      dialog.setTitle("Processing");
      dialog.setMessage("Checking Code...");
      dialog.show();

      String promoCode = ((EditText) findViewById(R.id.edit_text_promo_code)).getText().toString();
      printOrder.applyPromoCode(
          promoCode,
          new ApplyPromoCodeListener() {
            @Override
            public void onPromoCodeApplied(PrintOrder order, BigDecimal discount) {
              dialog.dismiss();
              Toast.makeText(PaymentActivity.this, "Discount applied!", Toast.LENGTH_LONG).show();
              updateViewsBasedOnPromoCodeChange();
            }

            @Override
            public void onError(PrintOrder order, Exception ex) {
              dialog.dismiss();
              showErrorDialog(ex.getMessage());
            }
          });
    }
  }
예제 #6
0
 // Constructor
 public ServerRequests(Context context) {
   // Instantiate dialog progress
   progressDialog = new ProgressDialog(context);
   progressDialog.setCancelable(false);
   progressDialog.setTitle("Processing");
   progressDialog.setMessage("Please wait...");
 }
 @Override
 protected void onPreExecute() {
   super.onPreExecute();
   progress.setTitle("Creating a new vacation");
   progress.setMessage("Please wait...");
   progress.show();
 }
예제 #8
0
 public WSVerPerfil(Context context) {
   progressDialog = new ProgressDialog(context);
   progressDialog.setCancelable(false);
   progressDialog.setTitle("Processing");
   progressDialog.setMessage("Please wait...");
   // conexionIniciarSesion = new ConexionServerPHP(context);
 }
예제 #9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    adView = new AdView(this, AdSize.SMART_BANNER, "a152f84b0f4f9ed");
    LinearLayout adContainer = (LinearLayout) this.findViewById(R.id.adsContainer);
    adContainer.addView(adView);

    AdRequest adRequest = new AdRequest();
    Set<String> keywordsSet = new HashSet<String>();
    keywordsSet.add("game");
    keywordsSet.add("dating");
    keywordsSet.add("money");
    keywordsSet.add("girl");
    adRequest.addKeywords(keywordsSet);
    adRequest.addTestDevice("1B91DF7A13E674202332C251084C3ADA");
    adView.loadAd(adRequest);

    imageView = (ImageView) this.findViewById(R.id.imageView1);

    progressDialog = new ProgressDialog(this);
    progressDialog.setTitle("Download Image");
    progressDialog.setMessage("Downloading in progress...");
    progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    progressDialog.setProgress(0);
    progressDialog.setButton(
        DialogInterface.BUTTON_NEGATIVE, "Show Image", dialogInterfaceOnClickListener);

    Button downloadButton = (Button) findViewById(R.id.downloadButton);
    downloadButton.setOnClickListener(downloadButtonOnClickListener);
  }
  private void getNC() {
    List<NameValuePair> targVar = new ArrayList<NameValuePair>();
    targVar.add(
        Wenku8Interface.getNovelContent(currentAid, currentCid, GlobalConfig.getFetchLanguage()));

    final asyncNovelContentTask ast = new asyncNovelContentTask();
    ast.execute(targVar);

    pDialog = new ProgressDialog(parentActivity);
    pDialog.setTitle(getResources().getString(R.string.load_status));
    pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    pDialog.setCancelable(true);
    pDialog.setOnCancelListener(
        new OnCancelListener() {
          @Override
          public void onCancel(DialogInterface dialog) {
            // TODO Auto-generated method stub
            ast.cancel(true);
            pDialog.dismiss();
            pDialog = null;
          }
        });
    pDialog.setMessage(getResources().getString(R.string.load_loading));
    pDialog.setProgress(0);
    pDialog.setMax(1);
    pDialog.show();

    return;
  }
예제 #11
0
 private void configuraProgressDialog(Activity context) {
   progressDialog = new ProgressDialog(context);
   progressDialog.setCancelable(true);
   progressDialog.setMax(4);
   progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
   progressDialog.setTitle(R.string.janusmob_progresso_titulo);
 }
예제 #12
0
 protected void showProgress(String title, String message) {
   if (mProgress != null && !mProgress.isShowing()) {
     mProgress.setTitle(title);
     mProgress.setMessage(message);
     mProgress.show();
   }
 }
예제 #13
0
 @Override
 protected void onPreExecute() {
   pDialog = new ProgressDialog(EventActivity.this);
   pDialog.setTitle(R.string.sync_title);
   pDialog.setMessage(getString(R.string.sync_message));
   pDialog.show();
 }
예제 #14
0
 private void showProgressDialog() {
   ProgressDialog dialog = new ProgressDialog(AtyMain.this);
   dialog.setTitle("Progress Dialog");
   dialog.setMessage("Progress Dialog Message");
   dialog.setCancelable(true);
   dialog.show();
 }
예제 #15
0
 @Override
 protected void onPreExecute() {
   progress_dialog.setTitle(activity.getString(R.string.preparing_pass));
   progress_dialog.setMessage(activity.getString(R.string.please_wait));
   progress_dialog.show();
   super.onPreExecute();
 }
    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
      btDevice = getArguments().getParcelable(KEY_BLUETOOTH_DEVICE);
      getActivity()
          .getApplicationContext()
          .bindService(new Intent(getActivity(), MetaWearBleService.class), this, BIND_AUTO_CREATE);

      reconnectDialog = new ProgressDialog(getActivity());
      reconnectDialog.setTitle(getString(R.string.title_reconnect_attempt));
      reconnectDialog.setMessage(getString(R.string.message_wait));
      reconnectDialog.setCancelable(false);
      reconnectDialog.setCanceledOnTouchOutside(false);
      reconnectDialog.setIndeterminate(true);
      reconnectDialog.setButton(
          DialogInterface.BUTTON_NEGATIVE,
          getString(R.string.label_cancel),
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
              currentMwBoard.disconnect();
              getActivity().finish();
            }
          });

      return reconnectDialog;
    }
예제 #17
0
 private ProgressDialog getFilterDialog(Context context) {
   if (progressDialog == null) {
     progressDialog = new ProgressDialog(context);
     progressDialog.setTitle("Applying Filter");
   }
   return progressDialog;
 }
예제 #18
0
 // menu item save claim
 public void saveClaim(MenuItem menu) {
   progress = new ProgressDialog(this);
   progress.setTitle("Connecting");
   progress.setCanceledOnTouchOutside(false);
   progress.setMessage("Wait while the server connects and saves your information");
   new LoadingOnlineRecordTask().execute();
 }
예제 #19
0
 public static void showProgressDialog(Context context) {
   dialog = new ProgressDialog(context);
   dialog.setIcon(R.drawable.app_icon);
   dialog.setTitle(R.string.app_name);
   dialog.setMessage("请等候,数据加载中……");
   dialog.show();
 }
예제 #20
0
 private void fetchCarData() {
   final ProgressDialog progressDialog = new ProgressDialog(Home.this);
   progressDialog.setTitle("Please Wait..");
   progressDialog.setMessage("Loading...");
   progressDialog.setCancelable(false);
   progressDialog.show();
   new MyAppAsyncTask(
           new CarModel(),
           AppConstant.CAR_DETAILS,
           new HashMap<String, String>(),
           new IAsynTaskCallBack() {
             @Override
             public void responceFromAsynTask(final JSONRoot result) {
               runOnUiThread(
                   new Runnable() {
                     @Override
                     public void run() {
                       progressDialog.dismiss();
                       if (result == null) {
                         return;
                       }
                       CarModel model = (CarModel) result;
                       tvTotalCars.setText(model.getCars().size() + "");
                       listDataTemp.addAll(model.getCars());
                       adapter.notifyDataSetChanged();
                     }
                   });
             }
           })
       .execute();
 }
예제 #21
0
        public void onItemClick(
            android.widget.AdapterView<?> arg0, View arg1, int arg2, long arg3) {
          String info = arg2 + ""; // ((TextView) arg1).getText().toString();
          /* 	//listview3 cdd1=new listview3(info,getActivity());
          	Bundle arg=new Bundle();
          arg.putString("Menu",info);

          cdd1.getWindow().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#40000000")));
          cdd1.show();
          Window window = cdd1.getWindow();
          window.setLayout(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

          */
          // Toast.makeText(getApplicationContext(), info, 3000).show();
          arg2--;
          if (arg2 == -1) {
            Intent i = new Intent(getActivity(), AdharScan.class);
            mProgressDialog = new ProgressDialog(getActivity());
            mProgressDialog.setTitle("Location");
            mProgressDialog.setMessage("Fetching...");
            mProgressDialog.setIndeterminate(false);
            mProgressDialog.show();

            startActivity(i);
            mProgressDialog.dismiss();
          }
          if (arg2 == 0) {
            Intent i = new Intent(getActivity(), hospitals.class);
            startActivity(i);
          }
          if (arg2 == 1) {
            Intent i = new Intent(getActivity(), MainSecond.class);
            startActivity(i);
          }
          if (arg2 == 2) {
            Intent i = new Intent(getActivity(), Tax.class);
            startActivity(i);
          }
          if (arg2 == 7) {
            Intent i = new Intent(getActivity(), Right_to_informtion.class);
            startActivity(i);
          }
          if (arg2 == 3) {
            Intent i = new Intent(getActivity(), allindiapincode.class);
            startActivity(i);
          }
          if (arg2 == 4) {
            Intent i = new Intent(getActivity(), bloodbank.class);
            startActivity(i);
          }

          if (arg2 == 5) {
            Intent i = new Intent(getActivity(), mygpsact.class);
            startActivity(i);
          }
          if (arg2 == 6) {
            Intent i = new Intent(getActivity(), mineral_mineral_lease.class);
            startActivity(i);
          }
        }
예제 #22
0
  private void fetchApiHits() {

    final ProgressDialog progressDialog = new ProgressDialog(Home.this);
    progressDialog.setTitle("Please Wait..");
    progressDialog.setMessage("Loading...");
    progressDialog.setCancelable(false);
    progressDialog.show();
    new MyAppAsyncTask(
            new ApiHitModel(),
            AppConstant.API_HIT_COUNT,
            new HashMap<String, String>(),
            new IAsynTaskCallBack() {
              @Override
              public void responceFromAsynTask(final JSONRoot result) {
                runOnUiThread(
                    new Runnable() {
                      @Override
                      public void run() {
                        progressDialog.dismiss();
                        if (result == null) {
                          return;
                        }
                        ApiHitModel model = (ApiHitModel) result;
                        tvTotalApi.setText(model.getApi_hits());
                      }
                    });
              }
            })
        .execute();
  }
  private void payWithExistingCard(PayPalCard card) {
    final ProgressDialog dialog = new ProgressDialog(this);
    dialog.setCancelable(false);
    dialog.setTitle("Processing");
    dialog.setMessage("One moment");
    dialog.show();

    card.chargeCard(
        paypalEnvironment,
        printOrder.getCost(printOrder.getCurrencyCode()),
        getPayPalCurrency(printOrder.getCurrencyCode()),
        "",
        new PayPalCardChargeListener() {
          @Override
          public void onChargeSuccess(PayPalCard card, String proofOfPayment) {
            dialog.dismiss();
            submitOrderForPrinting(proofOfPayment);
            card.saveAsLastUsedCard(PaymentActivity.this);
          }

          @Override
          public void onError(PayPalCard card, Exception ex) {
            dialog.dismiss();
            showErrorDialog(ex.getMessage());
          }
        });
  }
예제 #24
0
 public void startWaiting() {
   Logger.d("startWaiting");
   mAutoLoginWaitingDlg = new ProgressDialog(this);
   stopWaiting();
   mAutoLoginWaitingDlg.setTitle("自动登录中...");
   mAutoLoginWaitingDlg.show();
 }
예제 #25
0
 @Override
 protected void onProgressUpdate(String... item) {
   // ((ArrayAdapter)getListAdapter()).add(item[0]);
   dialog.setTitle("Downloading contents");
   dialog.setMessage("Please wait......");
   dialog.show();
 }
예제 #26
0
 public static ProgressDialog wait(Context context, String msg) {
   ProgressDialog dialog = new ProgressDialog(context);
   // 设置进度条风格,风格为圆形,旋转�?
   dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
   // 设置ProgressDialog 标题
   dialog.setTitle(msg);
   // 设置ProgressDialog 提示信息
   // dialog.setMessage("圆形进度�?);
   // 设置ProgressDialog 标题图标
   dialog.setIcon(android.R.drawable.ic_dialog_map);
   // 设置ProgressDialog 的一个Button
   /*
    * dialog.setButton("确定", new ProgressDialog.OnClickListener(){
    *
    * @Override public void onClick(DialogInterface dialog, int which) {
    *
    * } });
    */
   // 设置ProgressDialog 的进度条是否不明�?
   dialog.setIndeterminate(false);
   // 设置ProgressDialog 是否可以按�?回按键取�?
   dialog.setCancelable(true);
   // 显示
   dialog.show();
   return dialog;
 }
예제 #27
0
  /**
   * @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);
      }
    }
  }
예제 #28
0
 public ServerRequest(Context context) {
   progressDialog = new ProgressDialog(context);
   progressDialog.setCancelable(false);
   progressDialog.setTitle("Processing");
   progressDialog.setMessage("Please wait...");
   Log.d("login", "server request class created");
 }
예제 #29
0
 public UpdateAsyncTask(Context c, @NonNull Set<String> apps) {
   selectedApps = apps;
   progressDialog = new ProgressDialog(c);
   progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
   progressDialog.setTitle(R.string.updating);
   sharingUri = Utils.getSharingUri(FDroidApp.repo);
 }
예제 #30
0
  @Override
  protected Dialog onCreateDialog(int id, Bundle args) {
    final ProgressDialog dialog = new ProgressDialog(this.getParent());
    dialog.setTitle("Please Wait...");
    dialog.setIndeterminate(true);
    dialog.setMessage(String.valueOf(strProgressMessage));
    dialog.setCancelable(true);
    dialog.setOnCancelListener(
        new DialogInterface.OnCancelListener() {
          public void onCancel(DialogInterface dialog) {
            Log.i("LOCATOR", "user cancelling authentication");
          }
        });

    dialog.setOnKeyListener(
        new DialogInterface.OnKeyListener() {
          @Override
          public boolean onKey(DialogInterface arg0, int keyCode, KeyEvent event) {
            // TODO Auto-generated method stub
            if (((keyCode == KeyEvent.KEYCODE_SEARCH) || (keyCode == KeyEvent.KEYCODE_MENU))) {
              return true;
            }
            return false;
          }
        });
    mProgressDialog = dialog;
    return dialog;
  }