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 doForgetPassword(View view) {
   SimpleDialogFragment.createBuilder(this, getSupportFragmentManager())
       .setTitle("Forgot your password?")
       .setMessage(
           "Please contact the site administrator to change your password:\[email protected]")
       .setPositiveButtonText("Close")
       .show();
 }
Ejemplo n.º 3
0
 private void showPromptDialog(final int position) {
   SimpleDialogFragment.createBuilder(getActivity(), getActivity().getSupportFragmentManager())
       .setTitle(getString(R.string.delete_xiu_galary))
       .setMessage(getString(R.string.delete_xiu_message_prompt))
       .setPositiveButtonText(android.R.string.ok)
       .setNegativeButtonText(android.R.string.cancel)
       .setPositiveListener(
           new IPositiveButtonDialogListener() {
             @Override
             public void onPositiveButtonClicked(int requestCode) {
               final XiuInfo xiuInfo = mAdapter.getItem(position);
               mXiuInfos.remove(xiuInfo);
               GlobalDataHolder.getInstance(getActivity()).removeXiuSubInfosByXiuInfo(xiuInfo);
               mAdapter.notifyDataSetChanged();
             }
           })
       .setTag("xiu_delete_prompt")
       .showSinglton();
 }