Esempio n. 1
0
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    // Shortcuts that work no matter what is selected

    if (
    // TODO - when we move to android 2.0, uncomment this.
    // android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR &&

    keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 && K9.manageBack()) {
      // Take care of calling this method on earlier versions of
      // the platform where it doesn't exist.
      onBackPressed();
      return true;
    }

    switch (keyCode) {
      case KeyEvent.KEYCODE_Q:
        // case KeyEvent.KEYCODE_BACK:
        {
          onAccounts();
          return true;
        }

      case KeyEvent.KEYCODE_S:
        {
          onEditAccount();
          return true;
        }

      case KeyEvent.KEYCODE_H:
        {
          Toast toast = Toast.makeText(this, R.string.folder_list_help_key, Toast.LENGTH_LONG);
          toast.show();
          return true;
        }

      case KeyEvent.KEYCODE_1:
        {
          setDisplayMode(FolderMode.FIRST_CLASS);
          return true;
        }
      case KeyEvent.KEYCODE_2:
        {
          setDisplayMode(FolderMode.FIRST_AND_SECOND_CLASS);
          return true;
        }
      case KeyEvent.KEYCODE_3:
        {
          setDisplayMode(FolderMode.NOT_SECOND_CLASS);
          return true;
        }
      case KeyEvent.KEYCODE_4:
        {
          setDisplayMode(FolderMode.ALL);
          return true;
        }
    } // switch

    return super.onKeyDown(keyCode, event);
  } // onKeyDown
                public boolean onKey(DialogInterface dialoginterface, int i, KeyEvent keyevent)
                {
                    boolean flag;
                    Log.d("smali", "Lcom/samsung/sec/mtv/ui/channelguide/MtvUiFragReservationList$ReservationDetail$3;->onKey(Landroid/content/DialogInterface;ILandroid/view/KeyEvent;)Z");
                    flag = true;
                    i;
                    JVM INSTR tableswitch 4 4: default 32
                //                               4 38;
                       goto _L1 _L2
_L1:
                    flag = false;
_L4:
                    return flag;
_L2:
                    if(keyevent.getAction() == flag && Log.d(ReservationDetail.this) != null)
                        Log.d(ReservationDetail.this).dismiss();
                    if(true) goto _L4; else goto _L3
Esempio n. 3
0
  @Override
  public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
    Log.d(TAG, "onEditorAction: actionId: " + actionId + ", keyEvent: " + keyEvent);

    if ((actionId == EditorInfo.IME_ACTION_DONE)
        || ((keyEvent != null) && (keyEvent.getKeyCode() == KeyEvent.KEYCODE_ENTER))) {
      Log.d(TAG, "onEditorAction: IME_ACTION_DONE || KEYCODE_ENTER");
      String input = textView.getText().toString().trim();

      if (input.length() > 0) {
        String result = "";

        try {
          result += calculator.calculate(input);
        } catch (Exception e) {
          result = "no result (" + e.getMessage() + ")";
        }

        if (listAdapter.getCount() > 0) {
          listAdapter.add("");
        }

        listAdapter.add(input + " =");
        if (input.indexOf("@") > -1) {
          listAdapter.add(calculator.getEquation() + " =");
        }
        listAdapter.add(result);
        listAdapter.notifyDataSetChanged();

        inputView.endBatchEdit();
        inputView.setText("");
        hideKeyboard();
      }
    }

    return false;
  }