public void logIn() {
    s_username = editTextUsername.getText().toString().trim();
    s_password = editTextPassword.getText().toString().trim();

    dialog = ProgressDialog.show(MainActivity.this, "", "Checking your account...");

    if (databaseHandler.checkCredentials(s_username, s_password)) {

      // save it to sharedprefs
      credentials.setUserName(s_username, s_password, remember);

      if (checkInternetConnection()) {
        dialog.dismiss();
        updateDialog = ProgressDialog.show(MainActivity.this, "", "Checking for updates...");

        checkNeedUpdate();

      } else {
        Log.i("logIn", "NO INTERNET CONNECTION");
        dialog.dismiss();
        Intent intent = new Intent(getBaseContext(), SearchActivity.class);
        startActivity(intent);
      }

    } else {
      SimpleDialogFragment.createBuilder(this, getSupportFragmentManager())
          .setTitle("Incorrect Credentials")
          .setMessage("Username or  password you entered is incorrect. Please try again")
          .setCancelable(true)
          .show();
      dialog.dismiss();
    }
  }
  public void showContectionProgressDialog() {
    if (progressDialog != null) {
      progressDialog.show();
      progressDialog.setTitle(R.string.articles_pd_title);
      progressDialog.setMessage(this.getString(R.string.articles_pd_msg1));
    } else {
      progressDialog =
          ProgressDialog.show(
              this, getString(R.string.articles_pd_title), getString(R.string.articles_pd_msg1));

      progressDialog.setOnKeyListener(
          new OnKeyListener() {

            @Override
            public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
              if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
                dialog.cancel();
                if (gsdt != null) {
                  gsdt.cancel(false);
                  gsdt = null;
                }
              }
              return true;
            }
          });
    }
  }
  public void onClick(View v) {
    if (v.getId() == R.id.title_btn_left2) {
      finish();
    } else if (v.getId() == R.id.center_modifyword) {
      Intent intent = new Intent(UpdateInfo.this, UpdateMiMa.class);
      startActivity(intent);
      finish();
    } else if (v.getId() == R.id.title_btn_right2) {
      user = null;
      BookApp.setUser(null);
      Toast.makeText(UpdateInfo.this, "成功注销!", Toast.LENGTH_LONG).show();
      finish();
    } else if (v.getId() == R.id.updateInfo_over) {

      e = email.getText().toString();

      if (e.length() == 0) {
        Toast.makeText(UpdateInfo.this, "请输入邮箱!", Toast.LENGTH_LONG).show();
        return;
      }
      if (e.indexOf('@') == -1) {
        Toast.makeText(UpdateInfo.this, "请输入正确的邮箱!", Toast.LENGTH_LONG).show();
        return;
      }

      progress = ProgressDialog.show(UpdateInfo.this, "温馨提示", "正在修改信息...", true);
      progress.show();

      upInfoT = new UpdateInfoThread(UpdateInfo.this, handler, uid, token, e, null);
      upInfoT.start();
    }
  }
 @Override
 public void onClick(View v) {
   if (ConnectionUtils.isOnline(this)) {
     EditText txName = (EditText) registerDialog.findViewById(R.id.txName);
     EditText txSurname = (EditText) registerDialog.findViewById(R.id.txSurname);
     TextView txEmailAddress = (TextView) registerDialog.findViewById(R.id.txEmailAddress);
     EditText txUserName = (EditText) registerDialog.findViewById(R.id.txUserName);
     EditText txPass1 = (EditText) registerDialog.findViewById(R.id.txPass1);
     EditText txPass2 = (EditText) registerDialog.findViewById(R.id.txPass2);
     if (validRegisterForm(
         txEmailAddress.getText().toString(),
         txName.getText().toString(),
         txSurname.getText().toString(),
         txUserName.getText().toString(),
         txPass1.getText().toString(),
         txPass2.getText().toString())) {
       registerDialog.cancel();
       dialog = ProgressDialog.show(this, "", "Creating account", true);
       dialog.show();
       createAccount(
           txEmailAddress.getText().toString(),
           txName.getText().toString(),
           txSurname.getText().toString(),
           txUserName.getText().toString(),
           txPass1.getText().toString());
     }
   } else {
     Toast.makeText(this, "Sorry.No internet access available.", Toast.LENGTH_SHORT).show();
   }
 }
  public static ProgressDialog buildProgressDialog(Context context, boolean cancelble) {
    final ProgressDialog dialog =
        new ProgressDialog(context, ResourceUtils.getStyleId(context, "LoadingDialog"));
    // 设置window type
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_TOAST);
    } else {
      dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_PHONE);
    }

    try {
      if (context instanceof Activity) {
        if (!((Activity) context).isFinishing()) {
          dialog.show();
        }
      } else {
        dialog.show();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    dialog.setContentView(ResourceUtils.getLayoutId(context, "pj_layout_progressbar"));
    ImageView loading = (ImageView) dialog.findViewById(ResourceUtils.getId(context, "iv_loading"));
    AnimationDrawable anim = (AnimationDrawable) loading.getBackground();
    anim.start();
    dialog.setCancelable(cancelble);
    return dialog;
  }
  @Override
  protected void onStart() {
    PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
    wakelock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "no sleep");
    wakelock.acquire();

    if (CheckOutNet.isNetworkConnected(getApplicationContext())) {
      if (firstexecution == 0) {
        dialog =
            ProgressDialog.show(
                TechnicienActivity.this,
                getResources().getString(R.string.map_data),
                getResources().getString(R.string.msg_wait),
                true);
        new ConnexionTask().execute();
      }
    } else {
      if (firstexecution == 0) {
        dialog =
            ProgressDialog.show(
                TechnicienActivity.this,
                getResources().getString(R.string.map_data),
                getResources().getString(R.string.msg_wait),
                true);
        new OfflineTask().execute();
      }
    }

    super.onStart();
  }
 void loginDropbox() {
   if (dropbox.isAuthenticated()) {
     // If we're already authenticated, we don't need to get
     // the login info
     progress.show();
     dropbox.login(dropboxListener);
   } else {
     String email = dropboxEmail.getText().toString();
     if (email.length() < 5 || email.indexOf("@") < 0 || email.indexOf(".") < 0) {
       shake(dropboxEmail);
       dropboxEmail.requestFocus();
       showToast("Invalid e-mail");
       return;
     }
     String password = dropboxPass.getText().toString();
     if (password.length() < 6) {
       shake(dropboxPass);
       dropboxPass.requestFocus();
       showToast("Password too short");
       return;
     }
     // It's good to do Dropbox API (and any web API) calls
     // in a separate thread, so we don't get a force-close
     // due to the UI thread stalling.
     progress.show();
     dropbox.login(dropboxListener, email, password);
   }
 }
  private void getAccountInfo() {
    if (api.isAuthenticated()) {
      // If we're already authenticated, we don't need to get the login info

      dialog.show();
      LoginAsyncTask login = new LoginAsyncTask(this, null, null, getConfig(), dialog);
      login.execute();
    } else {

      String email = mLoginEmail.getText().toString();

      if (email.length() < 5 || email.indexOf("@") < 0 || email.indexOf(".") < 0) {
        showToast("Error, invalid e-mail");
        return;
      }

      String password = mLoginPassword.getText().toString();

      if (password.length() < 6) {
        showToast("Error, password too short");
        return;
      }

      // It's good to do Dropbox API (and any web API) calls in a separate thread,
      // so we don't get a force-close due to the UI thread stalling.

      dialog.show();
      LoginAsyncTask login = new LoginAsyncTask(this, email, password, getConfig(), dialog);
      login.execute();
    }
  }
    @Override
    protected void onPreExecute() {

      progressDialog = ProgressDialog.show(mActivity, "", "");
      progressDialog.setContentView(R.layout.progress_main);
      progressDialog.setCancelable(false);
      progressDialog.show();
    }
  public void onResume() {
    super.onResume();

    if (ContactCallLogStatus.contactSyncing())
      pdSC = ProgressDialog.show(BTSettings.this, "", "联系人同步中,请稍等。。。", false, true);
    if (ContactCallLogStatus.contactDeleting())
      pdCC = ProgressDialog.show(BTSettings.this, "", "正在清空联系人,请稍等。。。", false, true);
  }
Exemple #11
0
  private void callLoginWebservice(String emailMob, String pwd) {

    dialog = ProgressDialog.show(LoginActivity.this, "Loading", "Please wait...", true);
    dialog.show();
    LoginModel loginModel = new LoginModel();
    loginModel.setUserName(emailMob);
    loginModel.setPassword(pwd);
    loginModel.setDeviceId(gcmId);

    App.getClient()
        .authenticateUser(
            loginModel,
            new Callback<LoginModel>() {

              @Override
              public void success(LoginModel model, Response response) {

                dialog.dismiss();

                if (model.getStatus() && model.getData() != null) {

                  UserModel userModel = model.getData();

                  SPManager.save(SPManager.KEY_ACCESS_TOKEN, userModel.getAccessToken());

                  SPManager.save(SPManager.KEY_USERID, userModel.getId());

                  Intent intent = null;
                  if (SPManager.retriveBoolean(SPManager.KEY_LOGGED_IN)) {

                    intent = new Intent(LoginActivity.this, HomeActivity.class);

                  } else {

                    intent = new Intent(LoginActivity.this, ProfileActivity.class);

                    intent.putExtra(
                        ProfileActivity.TAG_ACTIVITY_SOURCE,
                        ProfileActivity.TAG_ACTIVITY_HOME_ACTIVITY);
                  }

                  startActivity(intent);
                  finish();
                } else {

                  smallToast(model.getMessage());
                }
              }

              @Override
              public void failure(RetrofitError error) {
                dialog.dismiss();
                error.printStackTrace();

                smallToast(getString(R.string.errorOccured));
              }
            });
  }
 @Click(R.id.btnSignIn)
 void clickOnSignIn() {
   if (ConnectionUtils.isOnline(this)) {
     dialog = ProgressDialog.show(this, "", "Loging in...", true);
     dialog.show();
     validateUser();
   } else {
     Toast.makeText(this, "Sorry.No internet access available.", Toast.LENGTH_SHORT).show();
   }
 }
 /**
  * 清空联系人
  *
  * @param v
  */
 public void clearContact(View v) {
   Log.d("goc", "clearContact");
   if (ContactCallLogStatus.contactSyncing()) {
     pdSC = ProgressDialog.show(BTSettings.this, "", "联系人同步中,请稍等。。。", false, true);
   } else if (Config.contactDeleting) {
     pdCC = ProgressDialog.show(BTSettings.this, "", "正在清空联系人,请稍等。。。", false, true);
   } else {
     showDialog("请确认要清空通讯录!", CLEAR_CONTACT);
   }
 }
 /**
  * 同步联系人
  *
  * @param v
  */
 public void syncContact(View v) {
   Log.d("goc", "syncContact");
   if (BTFileOperater.getAccStatus())
     if (ContactCallLogStatus.contactDeleting()) {
       pdSC = ProgressDialog.show(BTSettings.this, "", "联系人同步中,请稍等。。。", false, true);
     } else if (Config.contactDeleting) {
       pdCC = ProgressDialog.show(BTSettings.this, "", "正在清空联系人,请稍等。。。", false, true);
     } else {
       showDialog("请确认要同步通讯录!", SYNC_CONTACT);
     }
 }
  @Override
  protected Dialog onCreateDialog(int id) {
    if (id == ID_DIALOG_LOADING) {
      ProgressDialog dialog = ProgressDialog.show(this, "", LOADING_MAP, true);
      return dialog;
    } else if (id == ID_DIALOG_UPLOADING) {
      ProgressDialog dialog = ProgressDialog.show(this, "", UPLOADING_MAP, true);
      return dialog;
    }

    return super.onCreateDialog(id);
  }
Exemple #16
0
 @Override
 public void surfaceCreated(SurfaceHolder holder) {
   super.surfaceCreated(holder);
   // load the model
   // this is done here, to assure the surface was already created, so that the preview can be
   // started
   // after loading the model
   if (model == null) {
     waitDialog = ProgressDialog.show(this, "", "loading...", true);
     waitDialog.show();
     new ModelLoader().execute();
   }
 }
  /*========================================================
  Sync Library*/
  private void startSync() {
    if (ComicLibrary.startSync(this)) {
      if (mProgress != null) {
        if (!mProgress.isShowing()) {
          mProgress.show(this, "Library Syncing", "", true);
          return;
        } // if
      } // if

      mProgress = ProgressDialog.show(this, "Library Syncing", "", true);
    } else {
      Toast.makeText(this, "Sync did not start", Toast.LENGTH_SHORT).show();
    } // if
  } // func
  @Override
  protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);

    dialog =
        ProgressDialog.show(
            GetUserPosition.this, "", "Trying to get your position. Please wait...", true);

    // Define a listener that responds to location updates
    locationListener =
        new LocationListener() {
          public void onLocationChanged(Location location) {
            if (timerTask.cancel()) {
              locationManager.removeUpdates(locationListener);
              dialog.dismiss();
              Toast.makeText(GetUserPosition.this, "User location retrieved!", 2).show();
              Intent result = new Intent();
              result.putExtra("location", location);
              setResult(USER_POSITION_RETRIEVED, result);
              finish();
            }
          }

          public void onStatusChanged(String provider, int status, Bundle extras) {}

          public void onProviderEnabled(String provider) {}

          public void onProviderDisabled(String provider) {}
        };

    // Register the listener with the Location Manager to receive location
    // updates
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);

    dialog.show();
    timer = new Timer();

    timerTask =
        new TimerTask() {
          @Override
          public void run() {
            locationNotRetrieved();
          }
        };

    timer.schedule(timerTask, 60000);
  }
  private void processLogin() {

    final ProgressDialog pd =
        ProgressDialog.show(LoginScreen.this, "Please wait", "Fetching user data", false);
    String push =
        String.format("%s/%s", edName.getText().toString(), edPassword.getText().toString());
    new CallWebService(Constants.API_LOGIN + push, CallWebService.TYPE_JSONOBJECT) {
      @Override
      public void response(String response) {

        pd.dismiss();
        Functions.logD("Response Login", response);
        User currentUser = new GsonBuilder().create().fromJson(response, User.class);

        if (currentUser.loginState.success.equalsIgnoreCase("1")) {

          Functions.displayMessage(LoginScreen.this, "Login Successfull");
          PrefUtils.setUser(LoginScreen.this, currentUser);
          Functions.fireIntent(LoginScreen.this, AddArtWorkScreen.class);
          PrefUtils.setLogin(LoginScreen.this, true);
          finish();

        } else {
          Functions.displayMessage(LoginScreen.this, "Login Failed");
        }
      }

      @Override
      public void error(VolleyError error) {
        pd.dismiss();
        Functions.displayMessage(LoginScreen.this, error.getMessage());
      }
    }.start();
  }
 @Override
 public void onPreExecute() {
   Resources res = getResources();
   mProgressDialog =
       ProgressDialog.show(
           CardBrowser.this, "", res.getString(R.string.saving_changes), true);
 }
  @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();
    }
  }
  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();
  }
Exemple #23
0
  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
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.btn_sub:
       String extend_msg = et_extend_msg.getText().toString();
       String refund_amount = et_pay_price.getText().toString();
       if (Double.valueOf(refund_amount) > Double.valueOf(goods_pay_price)) {
         Toast.makeText(E3_Activity_Returns.this, "金额输入错误", Toast.LENGTH_LONG).show();
       } else {
         loadingPDialog.show();
         HttpUtils.refund(
             res, order_id, rec_id, refund_type, refund_amount, goods_num, extend_msg);
       }
       break;
     case R.id.ll_check_1:
       check_1.setChecked(true);
       check_2.setChecked(false);
       refund_type = "1";
       break;
     case R.id.ll_check_2:
       check_2.setChecked(true);
       check_1.setChecked(false);
       refund_type = "2";
       break;
     case R.id.iv_back:
       this.finish();
       break;
     default:
       break;
   }
 }
        @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();
          }
        }
Exemple #26
0
 @Override
 protected void onPreExecute() {
   super.onPreExecute();
   dialog.setMessage(getString(R.string.editor_uploading_image));
   dialog.setCancelable(false);
   dialog.show();
 }
  @Override
  public void touzhuIssue(String issue) {
    // TODO Auto-generated method stub
    betAndGift.setBatchcode(issue);
    progressdialog = UserCenterDialog.onCreateDialog(this);
    progressdialog.show();
    // 加入是否改变切入点判断 陈晨 8.11
    Thread t =
        new Thread(
            new Runnable() {
              String str = "00";

              @Override
              public void run() {
                str = BetAndGiftInterface.getInstance().betOrGift(betAndGift);
                try {
                  JSONObject obj = new JSONObject(str);
                  String msg = obj.getString("message");
                  String error = obj.getString("error_code");
                  handler.handleMsg(error, msg);
                  isNoIssue(handler, obj);
                } catch (JSONException e) {
                  e.printStackTrace();
                }
                progressdialog.dismiss();
              }
            });
    t.start();
  }
 @Override
 protected void onPreExecute() {
   super.onPreExecute();
   pdia = new ProgressDialog(IlanAraActivity.this);
   pdia.setMessage("İlanlar Aranıyor...");
   pdia.show();
 }
Exemple #29
0
  /**
   * @param context
   * @param isShowMsg �Ƿ���ʾ��ʾ��Ϣ
   */
  public void checkAppUpdate(Context context, final boolean isShowMsg, Handler hanlder, int what) {
    Log.d("tag", "wmz:checkAppUpdate");
    this.mContext = context;
    getCurrentVersion();
    if (isShowMsg) {
      if (mProDialog == null)
        mProDialog = ProgressDialog.show(mContext, null, "ProgressDialog...", true, true);
      else if (mProDialog.isShowing()
          || (latestOrFailDialog != null && latestOrFailDialog.isShowing())) return;
    }

    final Handler mHandler =
        new Handler() {
          public void handleMessage(Message msg) {

            if (msg.what == 1) {
              Log.d("tag", "wmz:1");
              if (msg.obj == null) return;

            } else if (isShowMsg) {
              showLatestOrFailDialog(DIALOG_TYPE_FAIL);
            }
          }
        };

    mCheckVersionUrl = "http://192.168.1.148:8080/Demo/CheckVersion";
    // ConnectServerManager.checkVersion(mCheckVersionUrl, hanlder, what);
    new Thread(mCheckVersionRunnable).start();
  }
  private void versionUpdata() {
    if (ForwardNetState.getInstance().isNetworkConnected(AboutJiaYuActivity.this)) {
      DataRequestVolley dataRequestVolley =
          new DataRequestVolley(
              HttpMethod.POST,
              MerchantHttpUrl.VERSION_UPDATE,
              versionListener,
              versionErrorListener) {
            @Override
            protected Map<String, String> getParams() throws AuthFailureError {
              // TODO Auto-generated method stub
              Map<String, String> map = new HashMap<String, String>();
              map.put("version_code", "1");
              map.put("device", "android");
              map.put("type", "2");

              return map;
            }
          };
      pd = new ProgressDialog(AboutJiaYuActivity.this);
      pd = ProgressDialog.show(AboutJiaYuActivity.this, "", "");
      RequestQueueSingleton.getInstance(AboutJiaYuActivity.this)
          .addToRequestQueue(dataRequestVolley);
    } else {
      Toast.makeText(AboutJiaYuActivity.this, MerchantMessage.CODE_800, Toast.LENGTH_SHORT).show();
    }
  }