@Override
 protected void onPreExecute() {
   pDialog = new SweetAlertDialog(context, SweetAlertDialog.PROGRESS_TYPE);
   pDialog.getProgressHelper().setBarColor(context.getResources().getColor(R.color.primary));
   pDialog.setTitleText("Loading");
   pDialog.setCancelable(false);
   pDialog.show();
 }
Пример #2
0
 @Override
 public void showProgress(String message) {
   mProgressdialog = new SweetAlertDialog(this, SweetAlertDialog.PROGRESS_TYPE);
   mProgressdialog.getProgressHelper().setBarColor(getResources().getColor(R.color.colorPrimary));
   mProgressdialog.setTitleText(message);
   mProgressdialog.setCancelable(false);
   mProgressdialog.show();
 }
 public void showLoadingDialog() {
   if (mLoadingDialog == null) {
     mLoadingDialog = new SweetAlertDialog(this, SweetAlertDialog.PROGRESS_TYPE);
     mLoadingDialog.setCancelable(false);
     mLoadingDialog.setTitleText("数据加载中...");
   }
   mLoadingDialog.show();
 }
Пример #4
0
 public void showErrorDialog(
     String title, String content, SweetAlertDialog.OnSweetClickListener listener) {
   mErrorDialog =
       new SweetAlertDialog(this, SweetAlertDialog.ERROR_TYPE)
           .setConfirmText("确定")
           .setTitleText(title)
           .setContentText(content)
           .setConfirmClickListener(listener);
   mErrorDialog.show();
 }
 @Override
 protected void onPreExecute() {
   super.onPreExecute();
   connection = new ConnectionDetector(context);
   prefs = AppPreferences.getInstance(context);
   pDialog = new SweetAlertDialog(context, SweetAlertDialog.PROGRESS_TYPE).setTitleText("Loading");
   pDialog.show();
   pDialog.setCancelable(false);
   pDialog.setCanceledOnTouchOutside(false);
 }
Пример #6
0
  public void showWarningDialog(
      String title, String content, SweetAlertDialog.OnSweetClickListener listener) {
    mWarningDialog =
        new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE)
            .setTitleText(title)
            .setContentText(content)
            .setConfirmText("确定")
            .setCancelText("取消")
            .setConfirmClickListener(listener);

    mWarningDialog.show();
  }
Пример #7
0
 @Override
 public void onClick(View view) {
   switch (view.getId()) {
     case R.id.btn_login:
       loading = Utils.showLoading(this);
       loading.show();
       String mail = etMail.getText().toString();
       String password = etPass.getText().toString();
       if (mail.length() > 0 && password.length() > 0) {
         login(mail, password);
       } else {
         showError("Verifier vos parametres de connection. \nmerci :)");
       }
       break;
     case R.id.btn_skip:
       goToFirst(null);
       break;
   }
 }
  protected void onPostExecute(String result) {
    super.onPostExecute(result);
    try {
      if (!result.equals("") && !result.equals("null") && result.equals("success")) {
        dialog =
            new SweetAlertDialog(context, SweetAlertDialog.SUCCESS_TYPE)
                .setTitleText("Successfully")
                .setContentText(myresult)
                .setConfirmText("ok")
                .setConfirmClickListener(
                    new SweetAlertDialog.OnSweetClickListener() {
                      @Override
                      public void onClick(SweetAlertDialog sDialog) {
                        Intent intent = new Intent(context, ApproveTimeSheet.class);
                        context.startActivity(intent);
                        ((Activity) context).finish();
                        dialog.dismiss();
                      }
                    });
        dialog.show();

        pDialog.dismiss();

      } else if (result.equals("fail")) {
        new SweetAlertDialog(context, SweetAlertDialog.NORMAL_TYPE)
            .setTitleText("Oops...")
            .setContentText(myresult)
            .show();
        pDialog.dismiss();

      } else if (!connection.isConnectingToInternet()) {

        new SweetAlertDialog(context, SweetAlertDialog.ERROR_TYPE)
            .setTitleText("Oops...")
            .setContentText("Internet Connection not available!")
            .show();
        pDialog.dismiss();
      } else {
        pDialog.dismiss();
        if (flag == 1) {
          flag = 0;
          dialog =
              new SweetAlertDialog(context, SweetAlertDialog.WARNING_TYPE)
                  .setTitleText("Oops")
                  .setContentText("Server Connection Problem.")
                  .setConfirmText("ok")
                  .setConfirmClickListener(
                      new SweetAlertDialog.OnSweetClickListener() {
                        @Override
                        public void onClick(SweetAlertDialog sDialog) {
                          Intent intent = new Intent(context, NavigationActivity.class);
                          context.startActivity(intent);
                          ((Activity) context).finish();

                          sDialog.dismiss();
                        }
                      });
          dialog.show();

        } else {
          dialog =
              new SweetAlertDialog(context, SweetAlertDialog.WARNING_TYPE)
                  .setTitleText("Oops")
                  .setContentText("Server Connection Problem.")
                  .setConfirmText("ok")
                  .setConfirmClickListener(
                      new SweetAlertDialog.OnSweetClickListener() {
                        @Override
                        public void onClick(SweetAlertDialog sDialog) {
                          Intent intent = new Intent(context, NavigationActivity.class);
                          context.startActivity(intent);
                          ((Activity) context).finish();

                          sDialog.dismiss();
                        }
                      });
          dialog.show();
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }