Esempio n. 1
0
  @SuppressWarnings("deprecation")
  public void alert(String msg) {

    final AlertDialog alertDialog = new AlertDialog.Builder(FriendList.this).create();

    // Setting Dialog Title
    alertDialog.setTitle("VoicIt");

    // Setting Dialog Message
    alertDialog.setMessage(msg);

    // Setting Icon to Dialog
    alertDialog.setIcon(R.drawable.ic_launcher);

    // Setting OK Button
    alertDialog.setButton(
        "OK",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {

            alertDialog.cancel();
          }
        });

    // Showing Alert Message
    alertDialog.show();
  }
 /**
  * Show a dialog to confirm exit download.
  *
  * @param message
  */
 private void pushToDialogOptions(String message) {
   alertDialog = new AlertDialog.Builder(DaisyReaderDownloadBooks.this).create();
   // Setting Dialog Title
   alertDialog.setTitle(R.string.error_title);
   // Setting Dialog Message
   alertDialog.setMessage(message);
   alertDialog.setCanceledOnTouchOutside(false);
   alertDialog.setCancelable(false);
   // Setting Icon to Dialog
   alertDialog.setIcon(R.raw.error);
   alertDialog.setButton(
       AlertDialog.BUTTON_NEGATIVE,
       DaisyReaderDownloadBooks.this.getString(R.string.no),
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int id) {
           mProgressDialog.show();
         }
       });
   alertDialog.setButton(
       AlertDialog.BUTTON_POSITIVE,
       DaisyReaderDownloadBooks.this.getString(R.string.yes),
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int id) {
           mTask.cancel(true);
         }
       });
   alertDialog.show();
 }
Esempio n. 3
0
  private void reportClass(final Class<?> clazz) {
    String msg = String.format("Incompatible %s", clazz.getName());
    XUtil.log(null, Log.WARN, msg);

    AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    alertDialog.setTitle(getString(R.string.app_name));
    alertDialog.setMessage(msg);
    alertDialog.setIcon(R.drawable.ic_launcher);
    alertDialog.setButton(
        AlertDialog.BUTTON_POSITIVE,
        "OK",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            sendClassInfo(clazz);
          }
        });
    alertDialog.setButton(
        AlertDialog.BUTTON_NEGATIVE,
        "Cancel",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
          }
        });
    alertDialog.show();
  }
Esempio n. 4
0
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_BACK)) {
      AlertDialog ExitAlert = new AlertDialog.Builder(this).create();
      ExitAlert.setTitle("Exit Jazeit");
      ExitAlert.setIcon(R.drawable.logo);
      ExitAlert.setMessage("Are you sure you want to exit the APP?");

      ExitAlert.setButton2(
          "Continue",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
              return;
            }
          });
      ExitAlert.setButton(
          "Exit App",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
              // finish();
              finish();
              return;
            }
          });
      ExitAlert.show();
    }

    return false;
  }
Esempio n. 5
0
        public void handleMessage(Message msg) {
          super.handleMessage(msg);

          if (loading != null) {
            loading.dismiss();
            loading = null;
          }

          if (msg.what == 0 || msg.what == 3) {
            errorDialog("Wrong password (or internal error)");
          } else if (msg.what == 2) {
            AlertDialog alert = new AlertDialog.Builder(CustomerActivity.this).create();
            alert.setTitle("Email not knwon");
            alert.setIcon(R.drawable.ic_launcher);
            alert.setButton(
                "Create Account",
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                    EditText e_email = (EditText) findViewById(R.id.editText1);
                    RegisterActivity.email = e_email.getText().toString();

                    Intent i = new Intent(CustomerActivity.this, RegisterActivity.class);
                    startActivity(i);
                  }
                });
            alert.setMessage("Do you want to register an account?");
            alert.show();
          } else {
            EditText e_email = (EditText) findViewById(R.id.editText1);
            APIHelper.auth_email = e_email.getText().toString();

            Intent i = new Intent(CustomerActivity.this, BookingsActivity.class);
            startActivity(i);
          }
        }
Esempio n. 6
0
  public void alerta(String menssage) {

    AlertDialog alertDialog = new AlertDialog.Builder(Body.this).create();

    // Setting Dialog Title
    alertDialog.setTitle("¿ Sabias que ?");

    // Setting Dialog Message
    alertDialog.setMessage(menssage);

    // Setting Icon to Dialog
    alertDialog.setIcon(R.drawable.orgcorazon1);
    alertDialog.setCancelable(false);

    // Setting OK Button
    alertDialog.setButton(
        "OK",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            mp.stop();
          }
        });

    // Showing Alert Message
    alertDialog.show();
  }
 public void askToDownloadFileManager() {
   AlertDialog alertDialog =
       new AlertDialog.Builder(this).setMessage(R.string.install_file_chooser_message).create();
   alertDialog.setTitle(R.string.install_file_chooser_title);
   alertDialog.setIcon(android.R.drawable.ic_menu_info_details);
   alertDialog.setButton(
       getResources().getText(R.string.ok),
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int which) {
           Intent marketIntent =
               new Intent(
                   Intent.ACTION_VIEW, Uri.parse("market://details?id=lysesoft.andexplorer"));
           startActivity(marketIntent);
           return;
         }
       });
   alertDialog.setButton2(
       getResources().getText(R.string.cancel),
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int which) {
           // do nothing
         }
       });
   alertDialog.show();
   return;
 }
  /** Creates and displays dialog with the given errorMsg. */
  private void createErrorDialog(String errorMsg) {
    Collect.getInstance().getActivityLogger().logInstanceAction(this, "createErrorDialog", "show.");

    AlertDialog alertDialog = new AlertDialog.Builder(this).create();

    alertDialog.setIcon(android.R.drawable.ic_dialog_info);
    alertDialog.setTitle(getString(R.string.error_occured));
    alertDialog.setMessage(errorMsg);
    DialogInterface.OnClickListener errorListener =
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int i) {
            switch (i) {
              case DialogInterface.BUTTON_POSITIVE:
                Collect.getInstance()
                    .getActivityLogger()
                    .logInstanceAction(this, "createErrorDialog", "OK");
                FormController formController = Collect.getInstance().getFormController();
                formController.jumpToIndex(currentIndex);
                break;
            }
          }
        };
    alertDialog.setCancelable(false);
    alertDialog.setButton(getString(R.string.ok), errorListener);
    alertDialog.show();
  }
 private void quit(Boolean quitProgram) {
   if (quitProgram) {
     exit(1);
   } else {
     AlertDialog alert;
     AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
     alt_bld
         .setMessage(getString(R.string.done_watching_show))
         .setCancelable(false)
         .setPositiveButton(
             getString(R.string.yes),
             new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                 exit(2);
               }
             })
         .setNegativeButton(
             getString(R.string.no),
             new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                 exit(0);
               }
             });
     alert = alt_bld.create();
     alert.setTitle(showString);
     alert.setIcon(R.drawable.application_icon);
     alert.show();
   }
 }
Esempio n. 10
0
  /**
   * Creates a dialog with the given message. Will exit the activity when the user preses "ok" if
   * shouldExit is set to true.
   *
   * @param errorMsg
   * @param shouldExit
   */
  private void createErrorDialog(String errorMsg, final boolean shouldExit) {

    Collect.getInstance().getActivityLogger().logAction(this, "createErrorDialog", "show");

    mAlertDialog = new AlertDialog.Builder(this).create();
    mAlertDialog.setIcon(android.R.drawable.ic_dialog_info);
    mAlertDialog.setMessage(errorMsg);
    DialogInterface.OnClickListener errorListener =
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int i) {
            switch (i) {
              case DialogInterface.BUTTON_POSITIVE:
                Collect.getInstance()
                    .getActivityLogger()
                    .logAction(this, "createErrorDialog", shouldExit ? "exitApplication" : "OK");
                if (shouldExit) {
                  finish();
                }
                break;
            }
          }
        };
    mAlertDialog.setCancelable(false);
    mAlertDialog.setButton(getString(R.string.ok), errorListener);
    mAlertDialog.show();
  }
  private void createAlertDialog(String message) {
    Collect.getInstance().getActivityLogger().logAction(this, "createAlertDialog", "show");

    mAlertDialog = new AlertDialog.Builder(this).create();
    mAlertDialog.setTitle(getString(R.string.upload_results));
    mAlertDialog.setMessage(message);
    DialogInterface.OnClickListener quitListener =
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int i) {
            switch (i) {
              case DialogInterface.BUTTON_POSITIVE: // ok
                Collect.getInstance()
                    .getActivityLogger()
                    .logAction(this, "createAlertDialog", "OK");
                // always exit this activity since it has no interface
                mAlertShowing = false;
                finish();
                break;
            }
          }
        };
    mAlertDialog.setCancelable(false);
    mAlertDialog.setButton(getString(R.string.ok), quitListener);
    mAlertDialog.setIcon(android.R.drawable.ic_dialog_info);
    mAlertShowing = true;
    mAlertMsg = message;
    mAlertDialog.show();
  }
  protected void performCheckin() {

    JSONObject checkin = null;
    String errorMsg = null;
    try {
      ACSClient sdk = DemoApplication.getSdk();
      Map<String, Object> data = new HashMap<String, Object>();
      try {
        data.put("place_id", place.getString("id"));
      } catch (JSONException e) {
        e.printStackTrace();
      }

      CCResponse response =
          sdk.sendRequest("checkins/create.json", CCRequestMethod.POST, data, false);

      JSONObject responseJSON = response.getResponseData();
      CCMeta meta = response.getMeta();
      if ("ok".equals(meta.getStatus())
          && meta.getCode() == 200
          && "createCheckin".equals(meta.getMethod())) {
        JSONArray checkins = null;
        try {
          checkins = responseJSON.getJSONArray("checkins");
          checkin = checkins.getJSONObject(0);
          listOfCheckin.add(0, checkin);
        } catch (JSONException e) {
          e.printStackTrace();
        }
        showCheckins();
      } else {
        errorMsg = meta.getMessage();
      }

    } catch (ACSClientError e) {
      errorMsg = e.getMessage();
    } catch (IOException e) {
      e.printStackTrace();
    }

    if (errorMsg != null) {
      AlertDialog alertDialog = new AlertDialog.Builder(this).create();
      alertDialog.setTitle("Checkin Failed");
      alertDialog.setMessage(errorMsg);
      alertDialog.setButton(
          "OK",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
              // here you can add functions
              dialog.dismiss();
            }
          });
      alertDialog.setIcon(R.drawable.icon);
      alertDialog.show();
    }
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (Constants.IS_LOGGABLE) {
      Log.i(Constants.LOG_TAG, "Selected menu item id: " + String.valueOf(item.getItemId()));
    }
    switch (item.getItemId()) {
      case R.id.btnUncheckAll:
        AlertDialog dialog = new AlertDialog.Builder(this).create();
        dialog.setTitle("Confirmation");
        dialog.setMessage("Are you sure you want to uncheck all of the boxes below?");
        dialog.setCancelable(false);
        dialog.setButton(
            DialogInterface.BUTTON_POSITIVE,
            "Yes",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int buttonId) {
                if (lvPackages == null
                    || lvPackages.getAdapter() == null
                    || ((packageAdapter) lvPackages.getAdapter()).selected == null) {
                  // something went wrong
                  return;
                }
                ((packageAdapter) lvPackages.getAdapter()).selected.clear();
                lvPackages.invalidateViews();
              }
            });
        dialog.setButton(
            DialogInterface.BUTTON_NEGATIVE,
            "No",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int buttonId) {
                // do nothing!
              }
            });
        dialog.setIcon(android.R.drawable.ic_dialog_alert);
        dialog.show();

        return true;
      case R.id.btnSave:
        finish();
        return true;
      case R.id.btnDonate:
        Intent i = new Intent(Intent.ACTION_VIEW);
        i.setData(Uri.parse(Constants.DONATION_URL));
        startActivity(i);
        return true;
      case R.id.btnSettings:
        Intent settings = new Intent(this, SettingsActivity.class);
        startActivity(settings);
        return true;
    }
    return super.onOptionsItemSelected(item);
  }
Esempio n. 14
0
 /**
  * Displays an `alert box' to the user, with a single button labeled `Ok'.
  *
  * @param context the context under which the alert should displayed
  * @param title the title of the alert
  * @param msg the message body of the alert
  */
 public static void alert(Context context, String title, String msg) {
   AlertDialog alertDialog = new AlertDialog.Builder(context).create();
   alertDialog.setTitle(title);
   alertDialog.setMessage(msg);
   alertDialog.setButton(
       "Ok",
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int which) {}
       });
   alertDialog.setIcon(R.drawable.icon);
   alertDialog.show();
 }
  public static void MostrarAlertDialog(Context context, String mensaje, int tipoIcono) {

    AlertDialog alertDialog;

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder
        .setCancelable(false)
        .setPositiveButton(
            "Aceptar",
            new DialogInterface.OnClickListener() {

              public void onClick(DialogInterface dialog, int id) {

                dialog.cancel();
              }
            });

    alertDialog = builder.create();
    alertDialog.setMessage(mensaje);

    if (tipoIcono == 1) {

      alertDialog.setIcon(android.R.drawable.ic_dialog_alert);
      alertDialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
      alertDialog.setTitle("Atencion");
      alertDialog.setFeatureDrawableResource(
          Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_alert);
    }

    if (tipoIcono == 2) {

      alertDialog.setIcon(android.R.drawable.ic_dialog_info);
      alertDialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
      alertDialog.setTitle("Mensaje");
      alertDialog.setFeatureDrawableResource(
          Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_info);
    }

    alertDialog.show();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_stack_interactive);

    dialogInit = new AlertDialog.Builder(StackInteractive.this).create();
    dialogInit.setMessage(
        "In this activity you have to build a stack by drag and drop.\nClick on Insert Item(Push). \nNow select the color buttons drag it and drop to the stack box present into right side with black boundary.");
    dialogInit.setIcon(R.drawable.information);

    dialogInit.setButton(
        DialogInterface.BUTTON_POSITIVE,
        "Ok... I got it...!",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface arg0, int arg1) {
            // TODO Auto-generated method stub
            return;
          }
        });
    dialogInit.show();

    btnPush = (Button) findViewById(R.id.btnPush);
    btnPop = (Button) findViewById(R.id.btnPop);
    btnReturn = (ImageButton) findViewById(R.id.btnReturn);
    btnPop.setEnabled(false);

    findViewById(R.id.imageButton1).setOnTouchListener(this);
    findViewById(R.id.imageButton2).setOnTouchListener(this);
    findViewById(R.id.imageButton3).setOnTouchListener(this);
    findViewById(R.id.imageButton4).setOnTouchListener(this);
    findViewById(R.id.imageButton5).setOnTouchListener(this);
    findViewById(R.id.imageButton6).setOnTouchListener(this);
    findViewById(R.id.imageButton7).setOnTouchListener(this);
    findViewById(R.id.imageButton8).setOnTouchListener(this);

    findViewById(R.id.layout_stack).setOnDragListener(this);
    findViewById(R.id.layout_stackItem).setOnDragListener(this);

    btnPush.setOnClickListener(this);
    btnPop.setOnClickListener(this);
    btnReturn.setOnClickListener(this);

    findViewById(R.id.imageButton1).setEnabled(false);
    findViewById(R.id.imageButton2).setEnabled(false);
    findViewById(R.id.imageButton3).setEnabled(false);
    findViewById(R.id.imageButton4).setEnabled(false);
    findViewById(R.id.imageButton5).setEnabled(false);
    findViewById(R.id.imageButton6).setEnabled(false);
    findViewById(R.id.imageButton7).setEnabled(false);
    findViewById(R.id.imageButton8).setEnabled(false);
  }
Esempio n. 17
0
  private void popDialog(final String bn) {

    AlertDialog alertDialog = new AlertDialog.Builder(this).create();

    alertDialog.setTitle(bn);
    alertDialog.setButton(
        AlertDialog.BUTTON_POSITIVE,
        "Get Routes",
        new DialogInterface.OnClickListener() {

          public void onClick(DialogInterface dialog, int id) {
            // broadcast send message
            broadcastMsg(bn);

            // hide keyboard
            imm.hideSoftInputFromWindow(ATV.getWindowToken(), 0);

            // update the times in db
            dbh.updateQueryTimesIntoDatabase(bn);

            // refresh the lists
            initData();
          }
        });

    alertDialog.setButton(
        AlertDialog.BUTTON_NEUTRAL,
        "Info",
        new DialogInterface.OnClickListener() {

          public void onClick(DialogInterface dialog, int id) {
            // hide keyboard
            imm.hideSoftInputFromWindow(ATV.getWindowToken(), 0);

            // ----
          }
        });
    alertDialog.setButton(
        AlertDialog.BUTTON_NEGATIVE,
        "Cancel",
        new DialogInterface.OnClickListener() {

          public void onClick(DialogInterface dialog, int id) {
            // hide keyboard
            imm.hideSoftInputFromWindow(ATV.getWindowToken(), 0);
            // ---
          }
        });
    alertDialog.setIcon(R.drawable.ic_launcher);
    alertDialog.show();
  }
Esempio n. 18
0
 public void errorDialog(String message) {
   AlertDialog alert = new AlertDialog.Builder(RegisterActivity.this).create();
   alert.setTitle("Whoops...");
   alert.setMessage(message);
   alert.setIcon(R.drawable.ic_launcher);
   alert.setButton(
       "Ok",
       new DialogInterface.OnClickListener() {
         public void onClick(DialogInterface dialog, int which) {
           dialog.cancel();
         }
       });
   alert.show();
 }
Esempio n. 19
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch (item.getItemId()) {
      case R.id.menu_exit:
        final AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
        alt_bld.setMessage(R.string.exit);
        alt_bld.setCancelable(false);
        alt_bld.setPositiveButton(
            R.string.yes,
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                // Action for 'Yes' Button
                finish();
                return;
              }
            });
        alt_bld.setNegativeButton(
            R.string.no,
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {
                //  Action for 'NO' Button
                dialog.cancel();
              }
            });

        AlertDialog alert = alt_bld.create();
        alert.setIcon(R.drawable.icon);
        alert.show();
        return true;

      case R.id.menu_code:
        final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
        emailIntent.setType("text/html");
        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, R.string.subject);
        emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(m_server.getMail()));
        LaunchActivity.this.startActivity(Intent.createChooser(emailIntent, ""));

        return true;
      case R.id.menu_map:
        Intent myMapIntent = new Intent(LaunchActivity.this, WebMapActivity.class);
        myMapIntent.putExtra("CODE", m_code);
        LaunchActivity.this.startActivity(myMapIntent);

        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
  public void webServiceConnectionProblem() {
    AlertDialog alertDialog = new AlertDialog.Builder(this).create();

    alertDialog.setTitle("Error");
    alertDialog.setMessage("Web service is not available, try again later");
    alertDialog.setIcon(android.R.drawable.presence_offline);
    alertDialog.setButton(
        "OK",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            finish();
          }
        });

    alertDialog.show();
  }
Esempio n. 21
0
  private void alertView(String Title, String message, Context context) {
    final AlertDialog dialog = new AlertDialog.Builder(context).create();

    dialog.setTitle(Title);
    dialog.setIcon(R.drawable.exclamation5);
    dialog.setMessage(message);

    dialog.setButton(
        AlertDialog.BUTTON_NEUTRAL,
        "Ok",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialoginterface, int i) {
            dialoginterface.dismiss();
          }
        });
    dialog.show();
  }
Esempio n. 22
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.show_location);

    lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    ll = new MyLocationListener();

    Criteria crit = new Criteria();
    provider = lm.getBestProvider(crit, false);
    Location location = lm.getLastKnownLocation(provider);

    final boolean gpsEnabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);

    lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 20000, 20, ll);

    if (!gpsEnabled) {
      AlertDialog alertDialog = new AlertDialog.Builder(this).create();
      alertDialog.setTitle("GPS is disabled!");
      alertDialog.setMessage("Open settings?");
      alertDialog.setButton(
          -3,
          "OK",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
              startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
              // not sure how to refresh the activity, so finish this activity and go back to main
              //  when the user user clicks back from the settings page
              finish();
            }
          });
      alertDialog.setIcon(R.drawable.ic_launcher);
      alertDialog.show();
    } else {
      try {
        if (location != null) {
          ll.onLocationChanged(location);
        }

        finish();

      } catch (Exception e) {
        System.out.println("derp:::: " + e);
      }
    }
  }
  public void noConnection() {
    AlertDialog alertDialog = new AlertDialog.Builder(this).create();

    alertDialog.setTitle("Info");
    alertDialog.setMessage(
        "Internet not available, Check your internet connectivity and try again");
    alertDialog.setIcon(android.R.drawable.presence_offline);
    alertDialog.setButton(
        "OK",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            finish();
          }
        });

    alertDialog.show();
  }
Esempio n. 24
0
  /**
   * @param message - Το μήνυμα
   * @info Συνάρτηση εμφάνισης μυνήματος σφάλματος
   * @details Συνάρτηση εμφάνισης μυνήματος σφάλματος
   */
  public void showConnectionAlertMessage(Activity actAcontext, String title, String message) {

    AlertDialog alertDialog = new AlertDialog.Builder(actAcontext).create();

    alertDialog.setTitle(title);
    alertDialog.setMessage(message);
    alertDialog.setIcon(R.drawable.tick);

    // Setting OK Button
    alertDialog.setButton(
        "OK",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {}
        });

    // Showing Alert Message
    alertDialog.show();
  }
Esempio n. 25
0
  public static void ShowMessage(Activity activity, String message) {
    AlertDialog alertDialog = new AlertDialog.Builder(activity).create();

    alertDialog.setTitle("Message");
    alertDialog.setCanceledOnTouchOutside(false);
    alertDialog.setIcon(android.R.drawable.ic_dialog_alert);
    alertDialog.setMessage(message);
    alertDialog.setButton(
        AlertDialog.BUTTON_NEUTRAL,
        "OK",
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
          }
        });

    alertDialog.show();
  }
 private void showPushDialog(String title, final String message) {
   AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
   alt_bld
       .setMessage(message)
       .setCancelable(false)
       .setPositiveButton(
           "OK",
           new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int id) {
               dialog.cancel();
               messageContent = "";
             }
           });
   AlertDialog alert = alt_bld.create();
   alert.setTitle(title);
   alert.setIcon(AlertDialog.BUTTON_POSITIVE);
   alert.show();
 }
Esempio n. 27
0
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    final File f = mFileHolder.getFile();
    final View v = from(getActivity()).inflate(R.layout.dialog_details, null);
    final ViewGroup container = (ViewGroup) v.findViewById(R.id.details_container);

    boolean isDirectory = f.isDirectory();
    String folderStr = getString(R.string.details_type_folder);
    String otherStr = getString(R.string.details_type_other);
    String perms =
        (f.canRead() ? "R" : "-") + (f.canWrite() ? "W" : "-") + (canExecute(f) ? "X" : "-");
    String mimeType = mFileHolder.getMimeType();

    String typeValue = isDirectory ? folderStr : (f.isFile() ? mimeType : otherStr);
    String hiddenValue = getString(f.isHidden() ? R.string.yes : R.string.no);
    String lastModifiedValue = mFileHolder.getFormattedModificationDate(getActivity()).toString();

    addSizeDetailsItem(container);
    addDetailsItem(container, R.string.details_type, typeValue);
    if (isDirectory) {
      addDetailsItem(container, R.string.details_items, valueOf(f.list().length));
    } else if (isImage(mimeType)) {
      addResolutionDetailsItem(container);
    }
    addDetailsItem(container, R.string.details_lastmodified, lastModifiedValue);
    addDetailsItem(container, R.string.details_hidden, hiddenValue);
    addDetailsItem(container, R.string.details_permissions, perms);

    AlertDialog dialog =
        new AlertDialog.Builder(getActivity())
            .setTitle(mFileHolder.getName())
            .setView(v)
            .setPositiveButton(
                android.R.string.ok,
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    dismiss();
                  }
                })
            .create();
    dialog.setIcon(tintIcon(mFileHolder.getIcon()));
    return dialog;
  }
  /**
   * Display a dialog warning the user that goodreads authentication is required; gives them the
   * options: 'request now', 'more info' or 'cancel'.
   */
  public void sendBooksToGoodreads() {

    if (!checkCanSendToGoodreads()) return;

    // Get the title
    final AlertDialog alertDialog =
        new AlertDialog.Builder(this)
            .setTitle(R.string.send_books_to_goodreads)
            .setMessage(R.string.send_books_to_goodreads_blurb)
            .create();

    alertDialog.setIcon(android.R.drawable.ic_menu_info_details);
    alertDialog.setButton(
        DialogInterface.BUTTON_POSITIVE,
        getResources().getString(R.string.send_updated),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            alertDialog.dismiss();
            AdministrationFunctions.this.sendToGoodreads(true);
          }
        });

    alertDialog.setButton(
        DialogInterface.BUTTON_NEUTRAL,
        getResources().getString(R.string.send_all),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            alertDialog.dismiss();
            AdministrationFunctions.this.sendToGoodreads(false);
          }
        });

    alertDialog.setButton(
        DialogInterface.BUTTON_NEGATIVE,
        getResources().getString(R.string.cancel),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            alertDialog.dismiss();
          }
        });

    alertDialog.show();
  }
Esempio n. 29
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    final AlertDialog.Builder obj = new AlertDialog.Builder(this);
    final AlertDialog.Builder obj1 = new AlertDialog.Builder(this);
    final AlertDialog.Builder obj2 = new AlertDialog.Builder(this);

    obj.setMessage("hi.. i will call u latter... \n" + "i am in meeting!!!")
        .setCancelable(false)
        .setPositiveButton(
            "send sms",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int id) {

                AlertDialog alert1 = obj1.create();
                // Title for AlertDialog
                alert1.setTitle("Message has been sent!!!");

                alert1.show();
              }
            })
        .setNegativeButton(
            "Ignore",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int anything) {
                //  Action for ‘NO’ Button
                AlertDialog alert2 = obj2.create();
                // Title for AlertDialog
                alert2.setTitle("Message has been saved ...");
                alert2.setIcon(R.drawable.index);
                alert2.show();
              }
            });

    AlertDialog alert = obj.create();
    // Title for AlertDialog
    alert.setTitle("Hey.. i made a call to u \n" + "But u dint respond...\n");
    // Icon for AlertDialog
    alert.setIcon(R.drawable.images);
    alert.show();
  }
Esempio n. 30
0
  /**
   * Display a dialog warning the user that goodreads authentication is required; gives them the
   * options: 'request now', 'more info' or 'cancel'.
   */
  public static int goodreadsAuthAlert(final Context context) {
    // Get the title
    final AlertDialog alertDialog =
        new AlertDialog.Builder(context)
            .setTitle(R.string.authorize_access)
            .setMessage(R.string.goodreads_action_cannot_blah_blah)
            .create();

    alertDialog.setIcon(android.R.drawable.ic_menu_info_details);
    alertDialog.setButton(
        DialogInterface.BUTTON_POSITIVE,
        context.getResources().getString(R.string.ok),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            alertDialog.dismiss();
            GoodreadsRegister.requestAuthorization(context);
          }
        });

    alertDialog.setButton(
        DialogInterface.BUTTON_NEUTRAL,
        context.getResources().getString(R.string.tell_me_more),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            alertDialog.dismiss();
            Intent i = new Intent(context, GoodreadsRegister.class);
            context.startActivity(i);
          }
        });

    alertDialog.setButton(
        DialogInterface.BUTTON_NEGATIVE,
        context.getResources().getString(R.string.cancel),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            alertDialog.dismiss();
          }
        });

    alertDialog.show();
    return 0;
  }