コード例 #1
1
 public void hideIM() {
   InputMethodManager imm =
       (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
   View v = ((Activity) mContext).getCurrentFocus();
   if (v == null) imm.hideSoftInputFromWindow(null, 0);
   else imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
 }
コード例 #2
1
ファイル: SDLActivity.java プロジェクト: fcjailybo/asgp
    @Override
    public void handleMessage(Message msg) {
      Context context = getContext();
      if (context == null) {
        Log.e(TAG, "error handling message, getContext() returned null");
        return;
      }
      switch (msg.arg1) {
        case COMMAND_CHANGE_TITLE:
          if (context instanceof Activity) {
            ((Activity) context).setTitle((String) msg.obj);
          } else {
            Log.e(TAG, "error handling message, getContext() returned no Activity");
          }
          break;
        case COMMAND_TEXTEDIT_HIDE:
          if (mTextEdit != null) {
            mTextEdit.setVisibility(View.GONE);

            InputMethodManager imm =
                (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0);
          }
          break;

        default:
          if ((context instanceof SDLActivity)
              && !((SDLActivity) context).onUnhandledMessage(msg.arg1, msg.obj)) {
            Log.e(TAG, "error handling message, command is " + msg.arg1);
          }
      }
    }
コード例 #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // SharedPreferences pref = this.getSharedPreferences("example_list",MODE_PRIVATE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // System.out.println("onCreate");
    dbTools = new DBTools(this);

    // Initialize Components
    newTucEdit = (EditText) findViewById(R.id.newTucEdit);
    newTucOwner = (EditText) findViewById(R.id.newTucOwner);
    addTucButton = (ImageButton) findViewById(R.id.addTucButton);
    deleteAllButton = (Button) findViewById(R.id.deleteAllButton);
    updateAllButton = (Button) findViewById(R.id.updateAllButton);
    tucTableScrollView = (TableLayout) findViewById(R.id.tucTableScrollView);

    // Add ClickListeners to the buttons
    addTucButton.setOnClickListener(enterTucButtonListener);
    deleteAllButton.setOnClickListener(deleteTucsButtonListener);
    updateAllButton.setOnClickListener(updateTucsButtonListener);

    // Force the keyboard to close
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(newTucEdit.getWindowToken(), 0);
    imm.hideSoftInputFromWindow(newTucOwner.getWindowToken(), 0);

    if (savedInstanceState == null) {
      getSupportFragmentManager().beginTransaction().commit();
    }
  }
コード例 #4
0
 /** Fills the data with preset stuff/hints */
 public void fillDataEmpty() {
   RadioButton male = (RadioButton) findViewById(R.id.gender_male);
   RadioButton female = (RadioButton) findViewById(R.id.gender_female);
   RadioButton pounds = (RadioButton) findViewById(R.id.weight_lbs);
   RadioButton kgs = (RadioButton) findViewById(R.id.weight_kgs);
   male.setChecked(true);
   female.setChecked(false);
   pounds.setChecked(true);
   kgs.setChecked(false);
   EditText weight = (EditText) findViewById(R.id.weight_view);
   EditText deadlift_view = (EditText) findViewById(R.id.deadlift_view);
   EditText squat_view = (EditText) findViewById(R.id.squat_view);
   EditText bench_view = (EditText) findViewById(R.id.bench_view);
   weight.getText().clear();
   deadlift_view.getText().clear();
   squat_view.getText().clear();
   bench_view.getText().clear();
   weight.setHint("Weight");
   deadlift_view.setHint("Deadlift Max");
   squat_view.setHint("Squat Max");
   bench_view.setHint("Bench Max");
   InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(weight.getWindowToken(), 0);
   imm.hideSoftInputFromWindow(deadlift_view.getWindowToken(), 0);
   imm.hideSoftInputFromWindow(squat_view.getWindowToken(), 0);
   imm.hideSoftInputFromWindow(bench_view.getWindowToken(), 0);
   TextView output = (TextView) findViewById(R.id.output_view);
   output.setText(" ");
   output.setOnClickListener(null);
   setButtonsOnClick(male, female, pounds, kgs, weight, deadlift_view, squat_view, bench_view);
 }
コード例 #5
0
ファイル: ComposeActivity.java プロジェクト: CreaRo/DAWebmail
 @Override
 public void onPreSend() {
   Snackbar.make(et_content, getString(R.string.snackbar_sending), Snackbar.LENGTH_LONG).show();
   InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   mgr.hideSoftInputFromWindow(et_content.getWindowToken(), 0);
   mgr.hideSoftInputFromWindow(et_subject.getWindowToken(), 0);
   mgr.hideSoftInputFromWindow(et_to.getWindowToken(), 0);
 }
コード例 #6
0
 /** Read stuff from file then output it as the same so it's all hunky dory */
 public void fillDataStored() {
   RadioButton male = (RadioButton) findViewById(R.id.gender_male);
   RadioButton female = (RadioButton) findViewById(R.id.gender_female);
   RadioButton pounds = (RadioButton) findViewById(R.id.weight_lbs);
   RadioButton kgs = (RadioButton) findViewById(R.id.weight_kgs);
   if (stats.isMan) {
     male.setChecked(true);
   } else {
     female.setChecked(true);
   }
   if (stats.isKG) {
     kgs.setChecked(true);
   } else {
     pounds.setChecked(true);
   }
   EditText weight = (EditText) findViewById(R.id.weight_view);
   EditText deadlift_view = (EditText) findViewById(R.id.deadlift_view);
   EditText squat_view = (EditText) findViewById(R.id.squat_view);
   EditText bench_view = (EditText) findViewById(R.id.bench_view);
   weight.setText(String.valueOf(stats.weight));
   deadlift_view.setText(String.valueOf(stats.deadlift));
   squat_view.setText(String.valueOf(stats.squat));
   bench_view.setText(String.valueOf(stats.bench));
   InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(weight.getWindowToken(), 0);
   imm.hideSoftInputFromWindow(deadlift_view.getWindowToken(), 0);
   imm.hideSoftInputFromWindow(squat_view.getWindowToken(), 0);
   imm.hideSoftInputFromWindow(bench_view.getWindowToken(), 0);
   TextView output = (TextView) findViewById(R.id.output_view);
   DecimalFormat df = new DecimalFormat("#.###");
   StringBuilder outputString = new StringBuilder(1000);
   outputString.append(
       "Big 3 Total: " + df.format(stats.total) + "\nWilks Score: " + df.format(stats.wilksScore));
   try {
     String classification = stats.getClassifs();
     if (!classification.contains("Un-trained")) {
       outputString.append("\nClassification: " + stats.getClassifs());
     }
   } catch (Exception e) {
     Log.e("Wilks Calculator", "Error getting classifs", e);
   }
   output.setText(outputString.toString());
   output.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View v) {
           wilksPopup();
         }
       });
   setButtonsOnClick(male, female, pounds, kgs, weight, deadlift_view, squat_view, bench_view);
 }
コード例 #7
0
  /**
   * Attempts to sign in or register the account specified by the login form. If there are form
   * errors (invalid email, missing fields, etc.), the errors are presented and no actual login
   * attempt is made.
   */
  public void attemptLogin() {
    if (mAuthTask != null) {
      return;
    }

    // Reset errors.
    mAddressView.setError(null);
    mUsernameView.setError(null);
    mPasswordView.setError(null);

    // Store values at the time of the login attempt.
    String address = mAddressView.getText().toString();
    String username = mUsernameView.getText().toString();
    String password = mPasswordView.getText().toString();

    boolean cancel = false;
    View focusView = null;

    if (TextUtils.isEmpty(password)) {
      mPasswordView.setError(getString(R.string.error_invalid_password));
      focusView = mPasswordView;
      cancel = true;
    }

    if (TextUtils.isEmpty(username)) {
      mUsernameView.setError(getString(R.string.error_field_required));
      focusView = mUsernameView;
      cancel = true;
    }

    if (TextUtils.isEmpty(address)) {
      mAddressView.setError(getString(R.string.error_field_required));
      focusView = mAddressView;
      cancel = true;
    }

    if (cancel) {
      focusView.requestFocus();
    } else {
      InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(mAddressView.getWindowToken(), 0);
      imm.hideSoftInputFromWindow(mUsernameView.getWindowToken(), 0);
      imm.hideSoftInputFromWindow(mPasswordView.getWindowToken(), 0);

      showProgress(true);
      mAuthTask = new UserLoginTask(address, username, password);
      mAuthTask.execute((Void) null);
    }
  }
コード例 #8
0
ファイル: AndroidWebView.java プロジェクト: micrdy/fill-up
  /*
   * onKeyDown
   */
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (boundKeyCodes.contains(keyCode)) {
      if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
        sendJavascriptEvent("volumedownbutton");
        return true;
      } else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
        sendJavascriptEvent("volumeupbutton");
        return true;
      } else {
        return super.onKeyDown(keyCode, event);
      }
    } else if (keyCode == KeyEvent.KEYCODE_BACK) {
      return !(this.startOfHistory()) || isButtonPlumbedToJs(KeyEvent.KEYCODE_BACK);

    } else if (keyCode == KeyEvent.KEYCODE_MENU) {
      // How did we get here?  Is there a childView?
      View childView = this.getFocusedChild();
      if (childView != null) {
        // Make sure we close the keyboard if it's present
        InputMethodManager imm =
            (InputMethodManager)
                cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(childView.getWindowToken(), 0);
        cordova.getActivity().openOptionsMenu();
        return true;
      } else {
        return super.onKeyDown(keyCode, event);
      }
    }
    return super.onKeyDown(keyCode, event);
  }
コード例 #9
0
        public void run() {

          if (!isAuthenticated) {
            txtUsername.setEnabled(true);
            txtPassword.setEnabled(true);
            //                cbRem.setEnabled (true);
            btnSign.setEnabled(true);
            progressDialog.dismiss();
            new AlertDialog.Builder(LoginActivity.this)
                .setMessage("Login failed. Please try again.")
                .setNeutralButton(
                    "OK",
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                      }
                    })
                .show();
          } else {
            InputMethodManager imm =
                (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(txtPassword.getWindowToken(), 0);
            Intent loginIntent = new Intent(LoginActivity.this, HomeActivity.class);
            //                Intent loginIntent = new Intent (LoginActivity.this,
            //                        MessagesListActivity.class);
            LoginActivity.this.startActivity(loginIntent);
          }
        }
コード例 #10
0
 @Override
 public void onClick(View arg0) {
   // TODO Auto-generated method stub
   switch (arg0.getId()) {
     case R.id.bGo:
       String theWebsite = url.getText().toString();
       ourBrow.loadUrl(theWebsite);
       // Hiding the keyboard after using EditText
       InputMethodManager imm =
           (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
       imm.hideSoftInputFromWindow(url.getWindowToken(), 0);
       break;
     case R.id.bBack:
       if (ourBrow.canGoBack()) ourBrow.goBack();
       break;
     case R.id.bForward:
       if (ourBrow.canGoForward()) ourBrow.goForward();
       break;
     case R.id.bRefresh:
       ourBrow.reload();
       break;
     case R.id.bHistory:
       ourBrow.clearHistory();
       break;
   }
 }
コード例 #11
0
 // 统计处理点击
 @OnClick({
   R.id.topic_image,
   R.id.topic_add_layout,
   R.id.base_ll_right_btns,
   R.id.topic_category_text_view
 })
 private void clickEvent(View view) {
   switch (view.getId()) {
       // 头像点击
     case R.id.topic_image:
       showChoiceImageAlert();
       break;
       // 选择类型
     case R.id.topic_category_text_view:
       choiceCategory();
       break;
     case R.id.topic_add_layout:
       InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
       imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
       break;
     case R.id.base_ll_right_btns:
       // 完成
       createNewGroupFinish();
       break;
     default:
       break;
   }
 }
コード例 #12
0
 private void hideSoftInput(View v) {
   InputMethodManager manager =
       (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
   if (manager != null) {
     manager.hideSoftInputFromWindow(v.getWindowToken(), 0);
   }
 }
コード例 #13
0
 public void onClickBtn(View v) throws IOException {
   String searchTxt = edit.getText().toString();
   searchTxt.trim();
   View view = this.getCurrentFocus();
   if (view != null) {
     InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
     imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
   }
   if (!searchTxt.isEmpty()) {
     String temp = searchTxt;
     if (searchTxt.contains(" ")) {
       temp = searchTxt.replace(" ", "+");
     }
     searchTerm = temp;
     progress.show();
     SearchOnDailyMotion(temp, 1);
     searchOnYoutube(temp);
     SearchOnVimeo(temp);
     pageCount = 1;
     ShowMore = true;
     searchResults.clear();
   } else {
     Toast.makeText(context, "Please Enter Something", Toast.LENGTH_SHORT).show();
   }
 }
コード例 #14
0
ファイル: MainActivity.java プロジェクト: Adam140/LeanTasks
  /**
   * Adding new task
   *
   * @param view
   */
  @SuppressLint("SimpleDateFormat")
  public void onClick(View view) {

    switch (view.getId()) {
      case R.id.button_add:
        Task task = new Task();
        EditText text = (EditText) findViewById(R.id.edit_text_task);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
        task.setText(text.getText().toString());
        task.setCreatedDate(sdf.format(new Date()));
        task.setUpdatedDate(sdf.format(new Date()));
        task.setArchived(false);
        task.setChecked(false);
        System.out.println(user.getName());
        task.setUsername(user.getName());

        long id = table.tasks.create(task);
        task.setId(id);

        this.tasks.add(task);
        text.setText("");
        text.clearFocus();
        InputMethodManager inputManager =
            (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
        inputManager.hideSoftInputFromWindow(
            this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);

        break;
    }
  }
コード例 #15
0
 public void onSendBtn(View v) {
   String mess = messEt.getText().toString();
   if (!mess.equals("")) {
     SimpleDateFormat sf = new SimpleDateFormat("HH:mm");
     String time = sf.format(new Date());
     JSONObject data = new JSONObject();
     try {
       data.put("id", userID);
       data.put("gameID", gameID);
       data.put("uname", uname);
       data.put("time", time);
       data.put("mess", mess);
       data.put("role", role);
       data.put("mode", "chat");
     } catch (JSONException e) {
       e.printStackTrace();
     }
     LoginActivity.socket.emit("gameOn", data);
     messEt.setText("");
     messEt.clearFocus();
     View view = this.getCurrentFocus();
     if (view != null) {
       InputMethodManager imm =
           (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
       imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
     }
   }
 }
コード例 #16
0
 public void enableHousenumberView() {
   inputNotes.setCursorVisible(false);
   cursorVisible = false;
   InputMethodManager imm =
       (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(inputNotes.getWindowToken(), 0);
 }
コード例 #17
0
 private void hideInputMethod(View view) {
   final InputMethodManager imm =
       (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   if (imm != null && view != null) {
     imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
   }
 }
コード例 #18
0
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
      // TODO Auto-generated method stub
      DiemPhoBien d1 = (DiemPhoBien) parent.getAdapter().getItem(position);

      // MainActivity.fragmentManager
      // .beginTransaction()
      // .setCustomAnimations(R.animator.slide_in_from_right,
      // R.animator.slide_out_to_left)
      // .replace(
      // R.id.frame_container,
      // new BustDetailFragment(b.getName(), b.getNumber(),
      // b.getTime(), b.getFreq(), b.getGo(), b
      // .getBack(), "BusList", isSearch))
      // .commit();
      if (!isKeyboardOpen) {
        GoogleAnalytic.sendActiontracker(
            MainActivity.mTracker,
            "Danh sách điểm phổ biến Screen",
            "View Diem_Pho_Bien Item",
            "Diem_Pho_Bien Item: " + d1.getName());
        textSearch.setText("");
        d.clear();
        d.add(d1);
        adapter.notifyDataSetChanged();
      }
      InputMethodManager imm =
          (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(textSearch.getWindowToken(), 0);
      isKeyboardOpen = false;
    }
コード例 #19
0
 public void hideSoftKeyboard() {
   if (getCurrentFocus() != null) {
     InputMethodManager inputMethodManager =
         (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
     inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
   }
 }
コード例 #20
0
 /**
  * Hide soft keyboard (if no hardware keyboard).
  *
  * @param context the context
  * @param view the focused view
  */
 public static void hideKeyboard(Activity context, View view) {
   InputMethodManager imm =
       (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
   if (imm != null) {
     imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
   }
 }
コード例 #21
0
ファイル: FileDialog.java プロジェクト: showyoumuck/akoa_true
  /**
   * Define se o botao de SELECT e visivel.
   *
   * @param v
   */
  private void setSelectVisible(View v) {
    layoutCreate.setVisibility(View.GONE);
    layoutSelect.setVisibility(View.VISIBLE);

    inputManager.hideSoftInputFromWindow(v.getWindowToken(), 0);
    selectButton.setEnabled(false);
  }
コード例 #22
0
 private void hideSoftKeyboard() {
   View view = Register.this.getCurrentFocus();
   if (view != null) {
     InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
     imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
   }
 }
コード例 #23
0
 // 隐藏虚拟键盘
 public static void HideKeyboard(View v) {
   InputMethodManager imm =
       (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
   if (imm.isActive()) {
     imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0);
   }
 }
コード例 #24
0
 /**
  * @param activity the context of the activity
  * @brief methods for hiding the soft keyboard by forced
  */
 public static void hideSoftKeyboard(Activity activity) {
   if (activity.getCurrentFocus() != null) {
     InputMethodManager inputMethodManager =
         (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
     inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
   }
 }
コード例 #25
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.btn_title_bar_back:
       finish();
       break;
     case R.id.btn_send:
       send();
       break;
     case R.id.ll_input_root:
     case R.id.et_forward_content:
       faceKeyboard.setImageResource(R.drawable.happy_face);
       faceGrid.setVisibility(View.GONE);
       inputMethodManager.showSoftInput(replyContent, InputMethodManager.SHOW_IMPLICIT);
       break;
     case R.id.btn_face_keyboard:
       if (faceGrid.getVisibility() == View.GONE) { // 先关闭输入法,再打开表情面板
         faceKeyboard.setImageResource(R.drawable.keyboard);
         inputMethodManager.hideSoftInputFromWindow(
             getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
         faceGrid.setVisibility(View.VISIBLE);
       } else { // 先关闭面板,再打开输入法
         faceKeyboard.setImageResource(R.drawable.happy_face);
         faceGrid.setVisibility(View.GONE);
         inputMethodManager.showSoftInput(replyContent, InputMethodManager.SHOW_IMPLICIT);
       }
       break;
   }
 }
コード例 #26
0
 /**
  * @param show
  * @param InputMethodManagerFlags 0 for regular (good for regular hide). or can use something like
  *     InputMethodManager.SHOW_FORCED or InputMethodManager.SHOW_IMPLICIT
  */
 public void hideShowKeyboard(boolean show, int InputMethodManagerFlags) {
   if (inputMethodManager == null) inputMethodManager = superTextActivity.getInputMethodManager();
   if (show) inputMethodManager.showSoftInput(autoCompleteTextView, InputMethodManagerFlags);
   else
     inputMethodManager.hideSoftInputFromWindow(
         autoCompleteTextView.getWindowToken(), InputMethodManagerFlags);
 }
コード例 #27
0
 public static void hideSoftKeyboard(Activity activity) {
   InputMethodManager inputMethodManager =
       (InputMethodManager)
           activity.getApplicationContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
   inputMethodManager.hideSoftInputFromWindow(
       activity.getWindow().getDecorView().getRootView().getWindowToken(), 0);
 }
コード例 #28
0
ファイル: MenuCreator.java プロジェクト: siddharthlele/Resto
  /** *** CHECK FOR EMPTY FIELDS **** */
  private void checkEmpty() {

    /* HIDE THE KEYBOARD */
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(edtDishName.getWindowToken(), 0);

    /** GET THE REQUIRED DATA * */
    MEAL_NAME = edtDishName.getText().toString();
    MEAL_DESCRIPTION = edtDishDescription.getText().toString();
    MEAL_PRICE = edtDishPrice.getText().toString();

    if (MEAL_NAME.length() == 0) {
      inputDishName.setError("Menu / Dish name cannot be empty!");
      edtDishName.requestFocus();
    } else if (MEAL_DESCRIPTION.length() == 0) {
      inputDishDescription.setError("Please provide the Menu / Dish Description");
      edtDishDescription.requestFocus();
    } else if (MEAL_PRICE.length() == 0) {
      inputDishPrice.setError("The Menu / Dish needs to have a Price");
      edtDishPrice.requestFocus();
    } else {
      /* REMOVE THE ERRORS (IF SHOWN) */
      inputDishName.setErrorEnabled(false);
      inputDishDescription.setErrorEnabled(false);
      inputDishPrice.setErrorEnabled(false);

      /* CHECK FOR UNIQUE MENU / DISH NAME */
      new checkUniqueDishName().execute();
    }
  }
コード例 #29
0
 @Override
 public void setFocus(Context context) {
   // Hide the soft keyboard if it's showing.
   InputMethodManager inputManager =
       (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
   inputManager.hideSoftInputFromWindow(this.getWindowToken(), 0);
 }
コード例 #30
0
    public void handleLetterPress(
        KeyEvent event, int keyCode, Device.DeviceType mDeviceType, IBinder windowToken) {
      if (event.getKeyCode() == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_UP) {
        // ---Done/Enter button was pressed---
        InputMethodManager keyboard =
            (InputMethodManager)
                ApplicationContext.getInstance().getSystemService(Context.INPUT_METHOD_SERVICE);
        if (keyboard != null) {
          try {
            keyboard.hideSoftInputFromWindow(windowToken, 0);
          } catch (Exception e) {
            BugSenseHandler.sendExceptionMessage(
                "KeyBindings", "KeyEventHandlers.handleLetterPress", e);
            Crashlytics.setString("KeyBindings", "KeyEventHandlers.handleLetterPress");
            Crashlytics.logException(e);

            if (ApplicationContext.DEBUG_MODE) e.printStackTrace();
          }
        }
      } else if (event.getKeyCode() != KeyEvent.KEYCODE_MENU) {
        if (!SearchFragmentTab.ENGLISH_KBD_BACKSPACE) {
          if (mDeviceType == Device.DeviceType.Google_TV) {
            // *---Goog TV custom keys mappings!---
            handleGoogTvKeyPress(event, keyCode);
          } else {
            handleNonGoogTvKeyPress(event, keyCode);
          }
        } else {
          SearchFragmentTab.ENGLISH_KBD_BACKSPACE = false;
        }
      }
    }