Exemplo n.º 1
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);
 }
Exemplo n.º 2
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();
    }
  }
Exemplo n.º 3
0
 @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);
 }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
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);
    }
  }
Exemplo n.º 6
0
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.Go:
        String URL = inputURL.getText().toString();
        browser.loadUrl(URL);
        InputMethodManager inputMethodManager =
            (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        inputMethodManager.hideSoftInputFromInputMethod(inputURL.getWindowToken(), 0);
        break;

      case R.id.GoBK:
        if (browser.canGoBack()) browser.goBack();
        break;

      case R.id.GoFR:
        if (browser.canGoForward()) browser.goForward();
        break;

      case R.id.GoRF:
        browser.reload();
        break;

      case R.id.GoCR:
        browser.clearHistory();
        break;
    }
  }
Exemplo n.º 7
0
  private void sendMessage() {
    EditText messageTxt = (EditText) findViewById(R.id.txt);
    if (messageTxt.length() == 0) {
      return;
    }

    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(messageTxt.getWindowToken(), 0);

    ReliUser user = MainActivity.user;

    String s = messageTxt.getText().toString();
    final Message message = new Message(s, new Date(), user.getParseID(), user.getFullName());
    messagesList.add(message);
    chatAdapter.notifyDataSetChanged();
    messageTxt.setText(null);

    ParseObject po = new ParseObject(discussionTableName);
    po.put(Const.COL_MESSAGE_SENDER_ID, user.getParseID());
    po.put(Const.COL_MESSAGE_SENDER_NAME, user.getFullName());
    po.put(Const.COL_MESSAGE_CONTENT, s);
    po.saveEventually(
        new SaveCallback() {
          @Override
          public void done(ParseException e) {
            message.setStatus(
                (e == null) ? MessageStatus.STATUS_SENT : MessageStatus.STATUS_FAILED);

            chatAdapter.notifyDataSetChanged();
          }
        });
  }
Exemplo n.º 8
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);
          }
        }
Exemplo n.º 9
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;
   }
 }
Exemplo n.º 10
0
  /**
   * ACTION_DOWN: 表示用户开始触摸 ACTION_MOVE: 表示用户在移动(手指或者其他) ACTION_UP:表示用户抬起了手指 ACTION_CANCEL:表示手势被取消了
   */
  @Override
  public boolean onTouch(View v, MotionEvent event) {
    switch (event.getAction()) {
      case MotionEvent.ACTION_DOWN:
        System.out.println("ACTION_DOWN");
        imm.hideSoftInputFromWindow(contentEdit.getWindowToken(), 0);
        if ("".equals(contentEdit.getText().toString().trim())) {
          superId = -1;
          contentEdit.setHint("说几句吧");
          discussBtn.setText("评论");
          flag = true;
        }
        break;
      case MotionEvent.ACTION_MOVE:
        System.out.println(superId);
        break;
      case MotionEvent.ACTION_UP:
        System.out.println("ACTION_UP");
        break;
      case MotionEvent.ACTION_CANCEL:
        System.out.println("ACTION_CANCEL");
        break;
      default:
        break;
    }

    return super.onTouchEvent(event);
  }
Exemplo n.º 11
0
  @Override
  public boolean dispatchTouchEvent(MotionEvent event) {
    // BUG #57535
    // 【发帖】发帖页面键盘弹出后,如果这时点击手机的HOME键、电源键或其他输入键盘上手机自带按钮进入其他页面,再返回到发帖页面,输入键盘会隐藏,小键盘按钮会高亮显示
    if (isOpenComment) {
      if (event.getAction() == MotionEvent.ACTION_DOWN) {
        int[] l = {0, 0};
        mEditContent.getLocationInWindow(l);
        int left = l[0], top = l[1];
        int bottom = top + mEditContent.getHeight(), right = left + mEditContent.getWidth();
        System.out.println(
            "left:" + left + "; top:" + top + ";bottom:" + bottom + ";right:" + right);
        if (event.getX() > left
            && event.getX() < right
            && event.getY() > top
            && event.getY() < bottom) {
          mInputBar.showCommonInputBar();
          // return false;
        } else {
          InputMethodUtils.collapseSoftInputMethod(mContext, mEditContent.getWindowToken());
          // return true;
        }
      }
    }

    return super.dispatchTouchEvent(event);
  }
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.send_button:
        if (!validate())
          Toast.makeText(getBaseContext(), "Enter valid data!", Toast.LENGTH_LONG).show();
        else {
          new HttpAsyncPostTask()
              .execute(
                  "http://newzup.in/index.php/api/jsonpost/comment",
                  etComment.getText().toString(),
                  "" + this.post_id);

          // Add comment in current window
          models.add(
              new CommentModel(
                  0,
                  etComment.getText().toString(),
                  UserDataHolder.getInstance().getUsername(),
                  UserDataHolder.getInstance().getImgurl(),
                  0,
                  0));
          adapter.notifyDataSetChanged();

          // Hide keyboard
          etComment.setText("");
          InputMethodManager imm =
              (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
          imm.hideSoftInputFromWindow(etComment.getWindowToken(), 0);
        }
        break;
    }
    // Toast.makeText(getApplicationContext(), "Sending...", Toast.LENGTH_SHORT).show();
  }
Exemplo n.º 13
0
  // Only allowed in MODE_VIEW_TASK and MODE_VERIFICATION
  public void checkAnswer(byte aScore) {
    if (mTask.getScore() < aScore) {
      mTask.setScore(aScore);
      updateStatus();
    }

    if (aScore >= mTask.getMaxScore()) {
      new ResultsOpenHelper(getActivity())
          .setTaskFinished(
              getCalculateActivity().getUserId(),
              getCalculateActivity().getLessonId(),
              mTask.getId());

      if (getCalculateActivity().getMode() == CalculateActivity.MODE_VIEW_TASK) {
        Toast.makeText(getActivity(), R.string.correct, Toast.LENGTH_SHORT).show();

        InputMethodManager imm =
            (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(mAnswerEditText.getWindowToken(), 0);

        getCalculateActivity().nextPage();
      }
    } else {
      if (getCalculateActivity().getMode() == CalculateActivity.MODE_VIEW_TASK) {
        Toast.makeText(getActivity(), R.string.not_correct, Toast.LENGTH_SHORT).show();
      }
    }

    if (getCalculateActivity().getMode() == CalculateActivity.MODE_VERIFICATION) {
      getCalculateActivity().getHandler().sendEmptyMessage(CalculateActivity.NEXT_AND_VERIFY);
    }
  }
 public void hideKeyboard() {
   if (getActivity() == null) return;
   isKeyboardHidden = true;
   InputMethodManager imm =
       (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
 }
Exemplo n.º 15
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.question);

    EditText textBox = (EditText) findViewById(R.id.editTextPkmName);

    InputMethodManager imm =
        (InputMethodManager) getSystemService(QuestionActivity.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(textBox.getWindowToken(), 0);

    SharedPreferences settings = getSharedPreferences(Constants.SETTINGS, 0);
    int id = settings.getInt(Constants.POKEMON, 1);

    pokemon = getPokemonByIdFromDb(id);

    ImageView imgPkm = (ImageView) findViewById(R.id.imgPokemon);
    int pkmImgId =
        getResources()
            .getIdentifier(
                pokemon.getImage1() + "_2", "drawable", getBaseContext().getPackageName());
    imgPkm.setImageResource(pkmImgId);

    // Button Back
    Button btnBack = (Button) findViewById(R.id.btnBack);
    btnBack.setOnClickListener(this);

    // Button Check
    Button btnCheck = (Button) findViewById(R.id.btnCheck);
    btnCheck.setOnClickListener(this);

    // Button Next
    Button btnNext = (Button) findViewById(R.id.btnNext);
    btnNext.setOnClickListener(this);
  }
Exemplo n.º 16
0
  public void buttonOkClicked(View view) {
    String inputValue = input.getText().toString();
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(input.getWindowToken(), 0);

    output.setText(c2l.convertIt(inputValue, resources));
  }
Exemplo n.º 17
0
        @Override
        public void onClick(View view) {
          // TODO Auto-generated method stub
          switch (view.getId()) {
            case R.id.tv_cancel_create_room:
              mIMM.hideSoftInputFromWindow(mCreateRoom.getWindowToken(), 0);

              mCreateRoom.setVisibility(View.GONE);
              mRoomCancel.setVisibility(View.GONE);
              mGetRoom.setVisibility(View.VISIBLE);
              break;

            case R.id.btn_get_room:
              mRoomCancel.setVisibility(View.VISIBLE);
              mCreateRoom.setVisibility(view.VISIBLE);
              mCreateRoom.setText("");

              mCreateRoom.setFocusable(true);
              mCreateRoom.setFocusableInTouchMode(true);
              mCreateRoom.requestFocus();
              mIMM.showSoftInput(mCreateRoom, 0);
              mCreateRoom.setOnEditorActionListener(editorActionListener);

              break;

            default:
              break;
          }
        }
Exemplo n.º 18
0
 @Override
 public void onPause() {
   super.onPause();
   mName = mNameEditText.getText().toString();
   InputMethodManager imm =
       (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(mNameEditText.getWindowToken(), 0);
 }
Exemplo n.º 19
0
  public void onStop() {
    super.onStop();

    // hide soft keyboard
    InputMethodManager imm =
        (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(createTagEdit.getWindowToken(), 0);
  }
Exemplo n.º 20
0
 private void hideSoftKeyboard() {
   if (getActivity().getCurrentFocus() != null
       && getActivity().getCurrentFocus() instanceof EditText) {
     InputMethodManager imm =
         (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
     imm.hideSoftInputFromWindow(etLocation.getWindowToken(), 0);
   }
 }
Exemplo n.º 21
0
 @Override
 public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
   InputMethodManager imm =
       (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(
       mSearchText.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
   return false;
 }
Exemplo n.º 22
0
 private void setKeyboardVisibilityForUrl(boolean visible) {
   InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   if (visible) {
     imm.showSoftInput(mUrlTextView, InputMethodManager.SHOW_IMPLICIT);
   } else {
     imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0);
   }
 }
Exemplo n.º 23
0
 @Override
 public void finish() {
   InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(filterName.getWindowToken(), 0);
   super.finish();
   AndroidUtilities.callOverridePendingTransition(
       this, R.anim.slide_right_in, R.anim.slide_right_out);
 }
Exemplo n.º 24
0
 public static void closeSoft(final EditText editText) {
   // editText.setFocusable(false);
   InputMethodManager inputManager =
       (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
   inputManager.hideSoftInputFromWindow(editText.getWindowToken(), 0);
   // inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED,
   // InputMethodManager.HIDE_IMPLICIT_ONLY);
 }
Exemplo n.º 25
0
  @Override
  public void onClick(View v) {
    Intent i;

    EditText textBox = (EditText) findViewById(R.id.editTextPkmName);
    InputMethodManager imm =
        (InputMethodManager) getSystemService(QuestionActivity.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(textBox.getWindowToken(), 0);

    SharedPreferences settings = getSharedPreferences(Constants.SETTINGS, 0);
    int dificult = settings.getInt(Constants.DIFFICULTY, 2);

    switch (v.getId()) {
      case R.id.btnCheck:
        String pkmName = textBox.getText().toString().toLowerCase().trim();

        if (pkmName.length() == 0) return;

        Log.d("Pokemon ans", pkmName);
        Log.d("Pokemon", pokemon.getName());

        TextView txtAnswer = (TextView) findViewById(R.id.txtAnswer);
        if (pkmName.compareTo(pokemon.getName().toLowerCase()) == 0) {
          txtAnswer.setText("Correct");
          txtAnswer.setTextColor(Color.rgb(0, 200, 0));

          ImageView imgPkm = (ImageView) findViewById(R.id.imgPokemon);
          int pkmImgId =
              getResources()
                  .getIdentifier(
                      pokemon.getImage1() + "_1", "drawable", getBaseContext().getPackageName());
          imgPkm.setImageResource(pkmImgId);

          if (dificult > pokemon.getResp()) {
            updateRespPokemonFromDb(dificult, pokemon.getNumber());
          }
        } else {
          txtAnswer.setText("Wrong\nTry again");
          txtAnswer.setTextColor(Color.rgb(200, 0, 0));
        }

        LinearLayout rl1 = (LinearLayout) findViewById(R.id.QuestLayout);
        rl1.setVisibility(View.INVISIBLE);

        LinearLayout rl2 = (LinearLayout) findViewById(R.id.ansLayout);
        rl2.setVisibility(View.VISIBLE);

        break;

      case R.id.btnBack:
      case R.id.btnNext:
        i = new Intent(this, PokemonSelectActivity.class);
        startActivityForResult(i, Constants.PLAYBUTTON);
        finish();
        break;
    }
  }
Exemplo n.º 26
0
  private void hideSoftKeyboard() {
    InputMethodManager inputManager =
        (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

    if (ed1.getText().length() > 0) {
      inputManager.hideSoftInputFromWindow(ed1.getWindowToken(), 0);
    }
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  }
Exemplo n.º 27
0
  /** Invoked when the 'Go' button is clicked */
  public void doVoipTest(View view) {
    EditText txtView = (EditText) this.findViewById(R.id.txtServerIp);
    this.serverIp = txtView.getText().toString();
    InputMethodManager imm =
        (InputMethodManager) this.getSystemService(Service.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(txtView.getWindowToken(), 0);

    this.runExample();
  }
Exemplo n.º 28
0
 @Override
 public void TweetLoaderCallbacks(Status result, Loader<Status> paramLoader) {
   getLoaderManager().destroyLoader(paramLoader.getId()); // ツイートしたら破棄
   // ソフトキー外す
   InputMethodManager imm =
       (InputMethodManager) getSherlockActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(twTx.getWindowToken(), 0);
   ((TextView) getSherlockActivity().findViewById(R.id.editText)).setText("");
 }
Exemplo n.º 29
0
  public static void showKeyboard(EditText target) {
    target.requestFocus();
    InputMethodManager imm =
        (InputMethodManager) target.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

    // Either show it once
    imm.showSoftInput(target, InputMethodManager.SHOW_FORCED);

    // Or toggle it twice with forced and hide with not force
    imm.toggleSoftInputFromWindow(
        target.getWindowToken(),
        InputMethodManager.SHOW_FORCED,
        InputMethodManager.HIDE_NOT_ALWAYS);
    imm.toggleSoftInputFromWindow(
        target.getWindowToken(),
        InputMethodManager.SHOW_FORCED,
        InputMethodManager.HIDE_NOT_ALWAYS);
  }
 public void hideKeyboard() {
   getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
   InputMethodManager inputManager =
       (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
   if (inputManager != null && textNickName != null) {
     inputManager.hideSoftInputFromWindow(
         textNickName.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
   }
 }