Пример #1
1
  public boolean onOptionsItemSelected(MenuItem item) {

    super.onOptionsItemSelected(item);

    switch (item.getItemId()) {
      case 1:
        setDefaultValues();
        break;

      case Constants.LOGOUT:
        CoreComponent.LOGOUT_CALL = true;
        Log.i("logging out", "here");
        if (!NetworkCallRequirements.isNetworkAvailable(this)) {
          Log.i("got it", "the network info");
          ToastUI.showToast(getApplicationContext(), getString(string.networkunavailable));

        } else {
          Log.i(getClass().getSimpleName(), "logging out");
          ProgressDialogHelper.showProgressDialog(this, "", getString(string.loading));
          Log.i(getClass().getSimpleName(), URLList.getURL(Constants.LOGOUT));
          CoreComponent.logout(this);
        }
        break;
      case 2:
        Intent intent = new Intent(getApplicationContext(), PasswordReset.class);
        Log.i(getClass().getSimpleName(), "Starting activity for result");
        startActivity(intent);
        break;
    }

    return true;
  }
Пример #2
1
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch (item.getItemId()) {
      case R.id.home:
        Intent h = new Intent(this, Main.class);
        startActivity(h);
        break;
      case R.id.profile:
        Intent i = new Intent(this, DisplayUserInfo.class);
        startActivity(i);
        break;
      case R.id.contacts:
        Intent j = new Intent(this, CustomizedListView.class);
        startActivity(j);
        break;
      case R.id.about:
        Intent k = new Intent(this, DisplayAbout.class);
        startActivity(k);
        break;
      case R.id.settings:
        Intent l = new Intent(this, UserSettings.class);
        startActivity(l);
        break;

      case R.id.signOut:
        Intent m = new Intent(this, Login.class);
        finish();
        startActivity(m);
        break;
    }
    return true;
  }
Пример #3
1
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch (item.getItemId()) {
      case R.id.Edit_Contact:
        Button b = (Button) findViewById(R.id.button1);
        b.setVisibility(View.VISIBLE);
        name.setEnabled(true);
        name.setFocusableInTouchMode(true);
        name.setClickable(true);

        phone.setEnabled(true);
        phone.setFocusableInTouchMode(true);
        phone.setClickable(true);

        email.setEnabled(true);
        email.setFocusableInTouchMode(true);
        email.setClickable(true);

        street.setEnabled(true);
        street.setFocusableInTouchMode(true);
        street.setClickable(true);

        place.setEnabled(true);
        place.setFocusableInTouchMode(true);
        place.setClickable(true);

        return true;
      case R.id.Delete_Contact:
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder
            .setMessage(R.string.deleteContact)
            .setPositiveButton(
                R.string.yes,
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                    mydb.deleteContact(id_To_Update);
                    Toast.makeText(
                            getApplicationContext(), "Deleted Successfully", Toast.LENGTH_SHORT)
                        .show();
                    Intent intent =
                        new Intent(getApplicationContext(), com.example.myapp.MainActivity.class);
                    startActivity(intent);
                  }
                })
            .setNegativeButton(
                R.string.no,
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                    // User cancelled the dialog
                  }
                });
        AlertDialog d = builder.create();
        d.setTitle("Are you sure");
        d.show();

        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);

    switch (item.getItemId()) {
      case MENU_BG1:
        {
          // set BG Image
          Bitmap bg = BitmapFactory.decodeResource(getResources(), R.drawable.gradient_color1);
          if (bg != null) mSCanvas.setBackgroundImage(bg);
        }
        break;
      case MENU_BG2:
        {
          // set BG Image
          Bitmap bg = BitmapFactory.decodeResource(getResources(), R.drawable.gradient_color2);
          if (bg != null) mSCanvas.setBackgroundImage(bg);
        }
        break;
      case MENU_BG3:
        {
          // set BG Image
          Bitmap bg = BitmapFactory.decodeResource(getResources(), R.drawable.gradient_color3);
          if (bg != null) mSCanvas.setBackgroundImage(bg);
        }
        break;
      case MENU_CLEARALL:
        {
          mSCanvas.clearScreen();
        }
        break;
    }
    return true;
  }
Пример #5
1
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    super.onOptionsItemSelected(item);

    // SharedPreferences.Editor editor = prefs.edit();
    Intent intent;
    switch (item.getItemId()) {
      case android.R.id.home:
        // app icon in action bar clicked; go home
        finish();
        return true;
      case R.id.menuFile:
        intent = new Intent(getBaseContext(), FilePickerActivity.class);
        startActivityForResult(intent, 0);
        break;

      case (int) R.id.menuPrefs:
        intent = new Intent(this, WaveSettingsActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
        break;

      default:
        return false;
    }
    return true;
  }
Пример #6
1
 // 菜单响应
 public boolean onOptionsItemSelected(MenuItem item) {
   super.onOptionsItemSelected(item);
   switch (item.getItemId()) {
     case 0:
       ActivityManager.getInstance().exit();
   }
   return true;
 }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch (item.getItemId()) {
      case (R.id.viewProfile):
        Intent viewProfileIntent = new Intent(this, ViewProfileActivity.class);
        startActivity(viewProfileIntent);
        return true;
      case (R.id.changeProfilePic):
        Intent changeProfilePicIntent = new Intent(this, ProfileImageUploadActivity.class);
        startActivity(changeProfilePicIntent);
        return true;
      case (R.id.editPlan):
        Intent editPlanIntent = new Intent(this, EditPlanActivity.class);
        startActivity(editPlanIntent);
        return true;
      case (R.id.deletePlan):
        AlertDialog.Builder ad = new AlertDialog.Builder(this);
        ad.setTitle("Delete Plan confirmation");
        ad.setMessage("Are you sure about deleting this plan?");

        ad.setPositiveButton(
            "Yes",
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                String updateQuery =
                    "/deletePlan?planName="
                        + selectedPlan.replace(" ", "%20")
                        + "&groupName="
                        + selectedGroup.replace(" ", "%20");
                WebServiceClient restClient = new WebServiceClient(context);
                restClient.execute(new String[] {updateQuery});
                Intent homeIntent = new Intent(context, HomePlanActivity.class);
                startActivity(homeIntent);
              }
            });
        ad.setNegativeButton(
            "No",
            new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                // do nothing
              }
            });
        ad.show();
        return true;
      case (R.id.aboutUs):
        Intent aboutUsIntent = new Intent(this, AboutUsActivity.class);
        startActivity(aboutUsIntent);
        return true;
      default:
        return false;
    }
  }
Пример #8
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);

    int selected = item.getItemId();

    if (PREFERENCE_ITEM == selected) {
      Intent i = new Intent(this, Preferences.class);
      startActivityForResult(i, SHOW_PREFERENCES);
      return true;
    } else return false;
  }
Пример #9
0
 public boolean onOptionsItemSelected(MenuItem item) {
   super.onOptionsItemSelected(item);
   switch (item.getItemId()) {
     case R.id.tentang:
       Tentang.Launch(this);
       break;
     case android.R.id.home:
       NavUtils.navigateUpFromSameTask(this);
       return true;
   }
   return true;
 }
Пример #10
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   super.onOptionsItemSelected(item);
   switch (item.getItemId()) {
     case R.id.btn_new_todo:
       Intent intent = new Intent(TodosActivity.this, EditTodoActivity.class);
       startActivityForResult(intent, REQUEST_ADD_NEW);
       break;
     default:
       break;
   }
   return true;
 }
Пример #11
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   super.onOptionsItemSelected(item);
   switch (item.getItemId()) {
     case 0:
       startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
       return true;
     case 1:
       getResults.this.finish();
       return true;
   }
   return true;
 }
Пример #12
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    if (item.getItemId() == R.id.menu_alarm_list) {
      Intent intent = new Intent(this, AlarmListActivity.class);
      Uri data = Uri.parse("jk");
      intent.setData(data);
      startActivity(intent);
    } else if (item.getItemId() == R.id.menu_settings) {

    } else if (item.getItemId() == R.id.menu_about) {

    }
    return true;
  }
Пример #13
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   super.onOptionsItemSelected(item);
   switch (item.getItemId()) {
     case Menu.FIRST + 1:
       String URL = getResources().getString(R.string.helpurl);
       Uri uri = Uri.parse(URL);
       Intent intent2 = new Intent(Intent.ACTION_VIEW, uri);
       startActivity(intent2);
       finish();
       break;
     default:
   }
   return true;
 }
Пример #14
0
  @Override
  /** Event received when an Options menu item is selected. */
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);

    // Get the focused screen widget.
    ScreenWidget currentScreen = mMoSyncThread.getCurrentScreen();
    if (currentScreen != null) {
      EventQueue.getDefault()
          .postOptionsMenuItemSelected(currentScreen.getHandle(), item.getItemId());
      return true;
    }

    return false;
  }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   super.onOptionsItemSelected(item);
   switch (item.getItemId()) {
     case MENU_PREFERENCES:
       Class c =
           Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
               ? PreferenceActivity.class
               : FragmentPreferences.class;
       Intent i = new Intent(this, c);
       startActivityForResult(i, SHOW_PREFERENCES);
       return true;
   }
   return false;
 }
Пример #16
0
 public boolean onOptionsItemSelected(MenuItem item) {
   super.onOptionsItemSelected(item);
   Log.d(TAG, "select Menu Item");
   switch (item.getItemId()) {
     case MENU_ABOUT:
       openOptionsDialog();
       break;
     case MENU_US:
       Intent intent = new Intent();
       intent.setClass(Bmi.this, Us.class);
       startActivity(intent);
       // finish();
       break;
   }
   return true;
 }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    super.onOptionsItemSelected(item);

    switch (item.getItemId()) {
      case PCSDemoInfo.ITEM0:
        editNote.exit(EditActivity.this);
        break;
      case PCSDemoInfo.ITEM1:
        Toast.makeText(getApplicationContext(), "自由开发者,呵呵!", Toast.LENGTH_SHORT).show();
        break;
    }

    return true;
  }
Пример #18
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   super.onOptionsItemSelected(item);
   switch (item.getItemId()) {
     case 0:
       openSettingDlg();
       break;
     case 1:
       pluginManager.exec("Portal", "refresh");
       break;
     case 2:
       confirmExit();
       break;
   }
   return true;
 }
Пример #19
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   super.onOptionsItemSelected(item);
   switch (item.getItemId()) {
     case R.id.item1:
       Bundle dataBundle = new Bundle();
       dataBundle.putInt("id", 0);
       Intent intent =
           new Intent(
               getApplicationContext(), com.example.junghyeonkim.androidproject.MainScreen.class);
       intent.putExtras(dataBundle);
       startActivity(intent);
       return true;
     default:
       return super.onOptionsItemSelected(item);
   }
 }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   super.onOptionsItemSelected(item);
   switch (item.getItemId()) {
     case R.id.rate_us:
       MyAppRater.showRateDialog(this, null);
       break;
     case R.id.friend:
       try {
         Intent i = new Intent(Intent.ACTION_SEND);
         i.setType("text/plain");
         i.putExtra(Intent.EXTRA_SUBJECT, "HoroScope 2015: Android app");
         String sAux =
             "\n\n Hi,\nCurrently I am using this very good app so I recommend you this application\n\n";
         sAux =
             sAux
                 + "https://play.google.com/store/apps/details?id=com.appsbazaar.astrology&hl=en\n\n";
         i.putExtra(Intent.EXTRA_TEXT, sAux);
         startActivity(Intent.createChooser(i, "Shared via..."));
       } catch (Exception e) { // e.toString();
       }
       break;
     case R.id.more:
       // startActivity(new Intent(Intent.ACTION_VIEW,
       // Uri.parse("https://play.google.com/store/apps/developer?id=AppsBazaar")));
       Intent j = new Intent(getApplicationContext(), applist.MainActivity.class);
       startActivity(j);
       break;
     case R.id.feedback:
       Intent i = new Intent(getApplicationContext(), FeedActivity.class);
       startActivity(i);
       break;
     case R.id.about:
       Intent intent1 = new Intent(this, AboutActivity.class);
       startActivity(intent1);
       break;
     case R.id.disclaimer:
       Intent dis = new Intent(getApplicationContext(), Disclaimer.class);
       startActivity(dis);
       break;
     default:
       break;
   }
   return super.onOptionsItemSelected(item);
 }
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {

    super.onOptionsItemSelected(item);

    switch (item.getItemId()) {
      case R.id.item_favor:
        Intent intent = new Intent();
        intent.setClass(
            ActivitySearchLocalCitiesSpotCategory.this, ActivitySearchLocalCitiesFavor.class);
        startActivity(intent);
        return true;
      default:
        break;
    }

    return true;
  }
 /** Called when a menu item is selected. */
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   super.onOptionsItemSelected(item);
   switch (item.getItemId()) {
     case MEN_NEXT_PAGE:
       {
         nextPage();
         break;
       }
     case MEN_PREV_PAGE:
       {
         prevPage();
         break;
       }
     case MEN_GOTO_PAGE:
       {
         gotoPage();
         break;
       }
     case MEN_ZOOM_IN:
       {
         zoomIn();
         break;
       }
     case MEN_ZOOM_OUT:
       {
         zoomOut();
         break;
       }
     case MEN_BACK:
       {
         finish();
         break;
       }
     case MEN_CLEANUP:
       {
         HardReference.cleanup();
         break;
       }
   }
   return true;
 }
Пример #23
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    super.onOptionsItemSelected(item);
    switch (item.getItemId()) {
      case R.id.ABOUT:
        Intent intentAbout = new Intent("rahulapps.apihelp.Settings.AboutAPI");
        startActivity(intentAbout);
        break;

      case R.id.COMMENT:
        Intent intentComment = new Intent("rahulapps.apihelp.Settings.CommentAPI");
        startActivity(intentComment);
        break;

      case R.id.EXIT:
        finish();
        break;
    }
    return false;
  }
Пример #24
0
  // Deal with menu event
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    Log.v("menu", "onOptionsItemSelected " + item.getItemId());
    switch (item.getItemId()) {
      case MENU_EMAIL:
        try {

          Intent in1 = new Intent(this, com.mobiperf.lte.ui.About.class);
          startActivityForResult(in1, 0);
        } catch (ActivityNotFoundException e) {
          Toast.makeText(
                  getApplicationContext(),
                  "Please send us an email at [email protected]",
                  Toast.LENGTH_SHORT)
              .show();
        }
        break;
    }

    return true;
  }
Пример #25
0
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);

    switch (item.getItemId()) {
      case R.id.tmSummaryReturnFrmStock:
        {
          this.finish();
          Intent intent = new Intent(this, FrmStock.class);
          intent.putExtra(FrmStock.REQUSITION_LIST_SERIALIZABLE, this.requisitionList);
          intent.putExtra(UserDTO.USER_SERIALIZABLE, this.uDTO);
          startActivity(intent);
        }
        break;

      case R.id.tmSummaryReturnFrmRequisition:
        {
          this.finish();
          Intent intent = new Intent(this, FrmRequisition.class);
          intent.putExtra(FrmStock.REQUSITION_LIST_SERIALIZABLE, this.requisitionList);
          intent.putExtra(UserDTO.USER_SERIALIZABLE, this.uDTO);
          startActivity(intent);
        }
        break;

      case R.id.tmSummaryGenerateCSV:
        {
          this.showDialog(DIALOG_GENERATION_CSV);
        }
        break;

      case R.id.tmSummaryCancelRequisition:
        {
          this.showDialog(DIALOG_CANCEL);
        }
        break;
    }
    return super.onOptionsItemSelected(item);
  }
Пример #26
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch (item.getItemId()) {
      case R.id.menu_settings:
        Intent intent = new Intent();
        intent.setClass(this, NotificationSettingsActivity.class);
        this.startActivity(intent);
        break;
      case R.id.menu_exit:
        AlertDialog.Builder builder = new Builder(MainActivity.this);
        builder.setMessage(R.string.quite_alert);
        builder.setTitle(R.string.quite_title);

        builder.setPositiveButton(
            R.string.quite_positive,
            new OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                MainActivity.this.finish();
                MainActivity.this.serviceManager.stopService();
              }
            });

        builder.setNegativeButton(
            R.string.quite_negative,
            new OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
              }
            });

        builder.create().show();
    }
    return true;
  }
Пример #27
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch (item.getItemId()) {
      case R.id.help_view:
        final Dialog dialog = new Dialog(ClientActivity.this);
        dialog.setContentView(R.layout.dialog);
        dialog.setTitle("Instructions");
        dialog.setCancelable(true);
        TextView tv = (TextView) dialog.findViewById(R.id.TextView01);
        String a =
            "1. One person to select 'Start Session' option on the menu<br />"
                + "2. Rest to select 'Join Session' <br />"
                + "3. Start drawing<br />"
                + "4. Use Menu button to access 'Save', 'Reset Canvas', 'Cursor'"
                + "and 'Logout' options<br />"
                + "<p >"
                + "NOTE: <br />"
                + "* Back button on phone disabled. Logout from menu to exit app</p> ";
        Spanned txt = Html.fromHtml(a);
        tv.setText(txt);
        Button button = (Button) dialog.findViewById(R.id.Button01);
        button.setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View v) {
                // TODO Auto-generated method stub

                dialog.cancel();
                // finish();

              }
            });
        dialog.show();
        break;
      case R.id.save_item:
        rl.setDrawingCacheEnabled(true);
        // d.setDrawingCacheEnabled(true);
        Bitmap b = rl.getDrawingCache();
        try {
          if (!APP_FILE_PATH.exists()) {
            if (APP_FILE_PATH.mkdirs()) Log.d("DIR Created AT", String.valueOf(APP_FILE_PATH));
            else Log.d("DIR NOT Created AT", String.valueOf(APP_FILE_PATH));
          }
          final DateFormat formatter = new SimpleDateFormat("hh-mm-ss-SSS");
          String str =
              "/sdcard/CrowdInput/image_"
                  + formatter.format(Calendar.getInstance().getTime())
                  + ".jpg";
          b.compress(CompressFormat.JPEG, 95, new FileOutputStream(str));
          // b.compress(CompressFormat.JPEG, 95, new
          // FileOutputStream("/sdcard/CrowdInput/client"+fileno+".jpg"));
          handler.post(
              new Runnable() {
                @Override
                public void run() {

                  //                  	 //serverStatus.setText("Listening on IP: " + SERVERIP);
                  //           DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy
                  // hh:mm:ss.SSS");
                  Toast.makeText(
                          ClientActivity.this,
                          "Image saved in file : "
                              + "/sdcard/CrowdInput/image_"
                              + formatter.format(Calendar.getInstance().getTime())
                              + ".jpg",
                          Toast.LENGTH_LONG)
                      .show();
                  fileno++;
                }
              });

        } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        /*
        try {
        		b.compress(CompressFormat.JPEG, 95, new FileOutputStream("/sdcard/CrowdInput/client.jpg"));
        	} catch (FileNotFoundException e) {
        		// TODO Auto-generated catch block
        		e.printStackTrace();
        	}*/
        break;
      case R.id.erase_view:
        resetflag = 1;
        handler.post(
            new Runnable() {
              @Override
              public void run() {

                //               	 //serverStatus.setText("Listening on IP: " + SERVERIP);
                Toast.makeText(ClientActivity.this, "Canvas Reset", Toast.LENGTH_SHORT).show();
              }
            });
        // for(int i=0;i<_graphics.size();i++)
        //    _graphics.remove(i);
        //    path = new SPath();
        //    d.invalidate();
        /*Iterator it = _graphics.iterator();
        while(it.hasNext())
        	it.remove();*/

        for (Path p : _graphics) p.rewind();
        _graphics.clear();
        d.postInvalidate();

        // resetflag=0;
        break;
        /*
        for(int i=0;i<_graphics.size();i++)
               _graphics.remove(i);
        	//path.reset();
               path = new SPath();
               d.invalidate();
               break;*/
      case R.id.cursor:
        if (cursor_id % 2 == 0) {
          handler.post(
              new Runnable() {
                @Override
                public void run() {

                  //                   	 //serverStatus.setText("Listening on IP: " + SERVERIP);
                  Toast.makeText(ClientActivity.this, "Showing Cursor", Toast.LENGTH_SHORT).show();
                }
              });
          // create a new tranparent view for Cursor
          cv = new CursorView(this, getLocalIpAddress());
          Log.d("CURSOR", "working");
          cv.setBackgroundColor(Color.TRANSPARENT);
          rl.addView(cv);
        } else {
          handler.post(
              new Runnable() {
                @Override
                public void run() {

                  //                   	 //serverStatus.setText("Listening on IP: " + SERVERIP);
                  Toast.makeText(ClientActivity.this, "Exiting Cursor Mode", Toast.LENGTH_LONG)
                      .show();
                }
              });

          cv.deletefromIPlist();
          rl.removeView(cv);
        }
        cursor_id++;
        break;
      case R.id.exit:
        // android.os.Process.killProcess(android.os.Process.myPid());
        System.exit(1);
        break;
    }
    return true;
  }
Пример #28
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   int itemId = item.getItemId();
   if (itemId == actionBarHomeId) itemId = R.id.other;
   switch (itemId) {
     case R.id.other:
       startChooser();
       break;
     case R.id.settings:
       startActivity(new Intent(this, PrefsActivity.class));
       break;
     case R.id.newgame:
       startNewGame();
       break;
     case R.id.restart:
       restartEvent();
       break;
     case R.id.undo:
       sendKey(0, 0, 'u');
       break;
     case R.id.redo:
       sendKey(0, 0, 'r');
       break;
     case R.id.solve:
       solveEvent();
       break;
     case R.id.custom:
       configIsCustom = true;
       configEvent(CFG_SETTINGS);
       break;
     case R.id.specific:
       configIsCustom = false;
       configEvent(CFG_DESC);
       break;
     case R.id.seed:
       configIsCustom = false;
       configEvent(CFG_SEED);
       break;
     case R.id.about:
       about();
       break;
     case R.id.contents:
       showHelp("index");
       break;
     case R.id.thisgame:
       showHelp(helpTopic);
       break;
     case R.id.website:
       startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.website_url))));
       break;
     case R.id.email:
       tryEmailAuthor(this, null);
       break;
     case R.id.load:
       new FilePicker(this, storageDir, false).show();
       break;
     case R.id.save:
       new FilePicker(this, storageDir, true).show();
       break;
     default:
       final int id = item.getItemId();
       if (gameTypes.get(id) != null) {
         showProgress(R.string.changing_type);
         gameView.clear();
         Log.d(TAG, "preset: " + id + ": " + gameTypes.get(id));
         (worker =
                 new Thread("presetGame") {
                   public void run() {
                     presetEvent(id);
                     handler.sendEmptyMessage(MsgType.DONE.ordinal());
                   }
                 })
             .start();
       } else super.onOptionsItemSelected(item);
       break;
   }
   return true;
 }
Пример #29
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   super.onOptionsItemSelected(item);
   if (item.getItemId() == MENU_ITEM_HELP) {
     startActivity(new Intent(this, Help.class));
   }
   if (item.getItemId() == MENU_ITEM_PREFERENCES) {
     startActivity(new Intent(this, Settings.class));
   }
   if (item.getItemId() == MENU_ITEM_HISTORY) {
     Log.d(tag, "" + game.game);
   }
   if (item.getItemId() == MENU_ITEM_REPLAY) {
     GameView old = game;
     newgame();
     Log.d(tag, "replay # moves : " + old.game.moves.size());
     game.replay(old.game.moves);
   }
   if (item.getItemId() == MENU_ITEM_BACK) {
     List<Move> moves = game.game.moves;
     int length = moves.size();
     if (length >= 4) {
       length -= 4;
     }
     moves = moves.subList(0, length);
     newgame();
     Log.i(tag, "replay # moves : " + length);
     game.replay(moves);
   }
   if (item.getItemId() == MENU_ITEM_NEW) {
     new AlertDialog.Builder(this)
         .setMessage(rs.getString(R.string.new_game) + "?")
         .setCancelable(false)
         .setPositiveButton(
             R.string.yes,
             new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int which) {
                 newgame();
               }
             })
         .setNegativeButton(
             R.string.no,
             new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                 dialog.cancel();
               }
             })
         .create()
         .show();
   }
   if (item.getItemId() == MENU_ITEM_THINK) {
     think(0);
   }
   if (item.getItemId() == MENU_ITEM_PASS_TURN) {
     turn = (turn + 1) % 4;
     game.showPieces(turn);
     game.invalidate();
   }
   if (item.getItemId() == MENU_ITEM_FLIP) {
     PieceUI piece = game.selected;
     if (piece != null) piece.flip();
   }
   return false;
 }
Пример #30
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    super.onOptionsItemSelected(item);
    switch (item.getItemId()) {
      case R.id.menubar:
        View mm = findViewById(R.id.menubar);
        PopupMenu popm = new PopupMenu(Pat.this, mm);
        popm.getMenuInflater().inflate(R.menu.menubar, popm.getMenu());
        popm.show();
        popm.setOnMenuItemClickListener(
            new PopupMenu.OnMenuItemClickListener() {

              @Override
              public boolean onMenuItemClick(MenuItem item) {
                // TODO Auto-generated method stub
                switch (item.getItemId()) {
                  case R.id.menurest:
                    Intent i = new Intent(Pat.this, Rest.class);
                    startActivity(i);
                    break;
                  case R.id.menupat:
                    Intent i1 = new Intent(Pat.this, Pat.class);
                    startActivity(i1);
                    break;
                  case R.id.menucafe:
                    Intent i11 = new Intent(Pat.this, Cafes.class);
                    startActivity(i11);
                    break;
                  case R.id.menuice:
                    Intent i12 = new Intent(Pat.this, Ice.class);
                    startActivity(i12);
                    break;
                }
                return false;
              }
            });
        break;
      case R.id.settings:
        View mn = findViewById(R.id.settings);
        PopupMenu popm1 = new PopupMenu(Pat.this, mn);
        popm1.getMenuInflater().inflate(R.menu.settingsbar, popm1.getMenu());
        popm1.show();
        popm1.setOnMenuItemClickListener(
            new PopupMenu.OnMenuItemClickListener() {

              @Override
              public boolean onMenuItemClick(MenuItem item) {
                // TODO Auto-generated method stub
                switch (item.getItemId()) {
                  case R.id.menurate:
                    String url = "https://play.google.com/store/apps/details?id=com.resturant.me";
                    Intent i1 = new Intent(Intent.ACTION_VIEW);
                    i1.setData(Uri.parse(url));
                    startActivity(i1);
                    break;
                  case R.id.menucreates:
                    Intent i = new Intent(Pat.this, Names.class);
                    startActivity(i);
                    break;
                  case R.id.menucontact:
                    String url1 = "https://www.facebook.com/3rfnyKFS";
                    Intent i11 = new Intent(Intent.ACTION_VIEW);
                    i11.setData(Uri.parse(url1));
                    startActivity(i11);
                    break;
                }
                return false;
              }
            });
        break;
    }

    return true;
  }