Beispiel #1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    switch (item.getItemId()) {
      case R.id.action_settings:
        return true;
      case R.id.action_logout:
        session.logoutUser();
        Intent i = new Intent(MainActivity.this, LoginRegisterActivity.class);
        startActivity(i);
        Toast.makeText(MainActivity.this, "Logged Out Successfully", Toast.LENGTH_SHORT).show();
        return true;
    }

    return super.onOptionsItemSelected(item);
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    if (id == R.id.action_logout) // Logout
    {
      name_sex_session.logoutUser();
      location_session.logoutUser();
    }

    if (id == R.id.action_feedback) // Feedback
    {
      final String appPackageName =
          getPackageName(); // getPackageName() from Context or Activity object
      try {
        startActivity(
            new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
      } catch (android.content.ActivityNotFoundException anfe) {
        startActivity(
            new Intent(
                Intent.ACTION_VIEW,
                Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
      }
    }

    if (id == R.id.action_share) // Share
    {
      Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
      startActivity(Intent.createChooser(sharingIntent, "Share via"));
    }

    if (id == R.id.action_about) // About
    {

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

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

      // Setting Dialog Message
      alertDialog.setMessage(
          "Aurum Health App is your personal healthcare assistant, that brings you the location of nearby hospitals along with their details. Aurum also helps you to track or map a disease based on the various symptoms."
              + "\n\nDevelopers:\n\nPrasang Sharma\[email protected]"
              + "\n\nShreyans Sheth\[email protected]"
              + "\n\nAniket Joshi\[email protected]"
              + "\n\nFuture:\n\nUnder future prospects of this project, we would like to harness Aurum Health App with Big Data Analysis. We believe that by collecting large chunks of data from Aurum App related to various diagnosis that it performs, and then analysing this valuable data on the grounds of health related issues according to geographical location, sex and age, could possibly emerge as a major asset in the field of health care Industry.");

      // if User clicks Accept
      alertDialog.setPositiveButton(
          "Ok",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {}
          });

      alertDialog.show();
    }

    if (id == R.id.action_disclaimer) // Disclaimer
    {

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

      // Setting Dialog Title
      alertDialog.setTitle("Disclaimer. Legal Notice.");

      // Setting Dialog Message
      alertDialog.setMessage(
          "\n"
              + "Users kindly understand that this app is meant for educational purpose only. This application is NOT meant for SELF DIAGNOSIS. The results provided by this app are not a legal advice. This app maps various symptoms to their PROBABLE diseases or cause. Actual disease may vary depending on various conditions. This method is not the best means of diagnosis. Please visit a registered doctor in case you require a medical assistance or help.\n\nThe result generated based on the information given by the user is only for informative and indicative purposes. Therefore, the developers make no warranties whatsoever nor is responsible for damages of any kind regarding the use of this app or any decision made by the user.\n");

      // if User clicks Accept
      alertDialog.setPositiveButton(
          "Ok",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {}
          });

      alertDialog.show();
    }

    return super.onOptionsItemSelected(item);
  }