Java Code Examples for android.view.inputmethod.InputMethodManager

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project droidparts, under directory /extra/src/org/droidparts/util/ui/.

Source file: ViewUtils.java

  37 
vote

public static void setKeyboardVisible(View view,boolean visible){
  InputMethodManager imm=(InputMethodManager)view.getContext().getSystemService(INPUT_METHOD_SERVICE);
  if (visible) {
    imm.showSoftInput(view,0);
  }
 else {
    imm.hideSoftInputFromWindow(view.getWindowToken(),0);
  }
}
 

Example 2

From project cw-advandroid, under directory /Honeycomb/ActionMode/src/com/commonsware/android/actionmode/.

Source file: ActionModeDemo.java

  34 
vote

public boolean onEditorAction(TextView v,int actionId,KeyEvent event){
  if (event == null || event.getAction() == KeyEvent.ACTION_UP) {
    addWord(v);
    InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(v.getWindowToken(),0);
  }
  return (true);
}
 

Example 3

From project android_packages_apps_QuickSearchBox, under directory /src/com/android/quicksearchbox/.

Source file: SearchActivity.java

  33 
vote

/** 
 * If the input method is in fullscreen mode, and the selector corpus is All or Web, use the web search suggestions as completions.
 */
protected void updateInputMethodSuggestions(){
  InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
  if (imm == null || !imm.isFullscreenMode())   return;
  Suggestions suggestions=mSuggestionsAdapter.getSuggestions();
  if (suggestions == null)   return;
  SuggestionCursor cursor=suggestions.getPromoted();
  if (cursor == null)   return;
  CompletionInfo[] completions=webSuggestionsToCompletions(cursor);
  if (DBG)   Log.d(TAG,"displayCompletions(" + Arrays.toString(completions) + ")");
  imm.displayCompletions(mQueryTextView,completions);
}
 

Example 4

From project Anki-Android, under directory /src/com/ichi2/anki/.

Source file: MyAccount.java

  33 
vote

private void login(){
  InputMethodManager inputMethodManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  inputMethodManager.hideSoftInputFromWindow(mUsername.getWindowToken(),0);
  String username=mUsername.getText().toString();
  String password=mPassword.getText().toString();
  Log.i(AnkiDroidApp.TAG,"Username = " + username);
  Log.i(AnkiDroidApp.TAG,"Password = " + password);
  if (!"".equalsIgnoreCase(username) && !"".equalsIgnoreCase(password)) {
    Connection.login(loginListener,new Connection.Payload(new Object[]{username,password}));
  }
 else {
    mInvalidUserPassAlert.show();
  }
}
 

Example 5

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/voice/.

Source file: ImeTrigger.java

  33 
vote

/** 
 * Switches to Voice IME.
 */
public void startVoiceRecognition(String language){
  InputMethodManager inputMethodManager=getInputMethodManager(mInputMethodService);
  InputMethodInfo inputMethodInfo=getVoiceImeInputMethodInfo(inputMethodManager);
  if (inputMethodInfo == null) {
    return;
  }
  inputMethodManager.setInputMethodAndSubtype(mInputMethodService.getWindow().getWindow().getAttributes().token,inputMethodInfo.getId(),getVoiceImeSubtype(inputMethodManager,inputMethodInfo));
}
 

Example 6

From project cw-android, under directory /Menus/ActionBar/src/com/commonsware/android/actionbar/.

Source file: InflationDemo.java

  33 
vote

public boolean onEditorAction(TextView v,int actionId,KeyEvent event){
  if (event == null || event.getAction() == KeyEvent.ACTION_UP) {
    addWord(v);
    InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(v.getWindowToken(),0);
  }
  return (true);
}
 

Example 7

From project cw-omnibus, under directory /ActionBar/ActionBarDemo/src/com/commonsware/android/inflation/.

Source file: ActionBarDemoActivity.java

  33 
vote

@Override public boolean onEditorAction(TextView v,int actionId,KeyEvent event){
  if (event == null || event.getAction() == KeyEvent.ACTION_UP) {
    adapter.add(v.getText().toString());
    v.setText("");
    InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(v.getWindowToken(),0);
  }
  return (true);
}
 

Example 8

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/widget/.

Source file: SearchView.java

  32 
vote

public void run(){
  InputMethodManager imm=(InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
  if (imm != null) {
    showSoftInputUnchecked(SearchView.this,imm,0);
  }
}
 

Example 9

From project agit, under directory /agit/src/main/java/com/madgag/android/filterable/.

Source file: FilterWidgetSupport.java

  32 
vote

/** 
 * When the search is "committed" by the user, then hide the keyboard so the user can more easily browse the list of results.
 */
protected void clearSearchViewOnSubmit(){
  View searchView=searchMenuItem.getActionView();
  InputMethodManager imm=(InputMethodManager)searchView.getContext().getSystemService(INPUT_METHOD_SERVICE);
  Log.d(TAG,"clearSearchViewOnSubmit : " + searchView + " "+ imm);
  if (imm != null) {
    imm.hideSoftInputFromWindow(searchView.getWindowToken(),0);
  }
  searchView.clearFocus();
}
 

Example 10

From project android-thaiime, under directory /common/src/com/android/ex/editstyledtext/.

Source file: EditStyledText.java

  32 
vote

public void showSoftKey(int oldSelStart,int oldSelEnd){
  if (DBG) {
    Log.d(LOG_TAG,"--- showsoftkey");
  }
  if (!mEST.isFocused() || isSoftKeyBlocked()) {
    return;
  }
  mSkr.mNewStart=Selection.getSelectionStart(mEST.getText());
  mSkr.mNewEnd=Selection.getSelectionEnd(mEST.getText());
  InputMethodManager imm=(InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
  if (imm.showSoftInput(mEST,0,mSkr) && mSkr != null) {
    Selection.setSelection(getText(),oldSelStart,oldSelEnd);
  }
}
 

Example 11

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/controller/.

Source file: ListControllerOnKeyListener.java

  32 
vote

private boolean handleMenuKeyDown(View v,KeyEvent event){
  InputMethodManager imm=(InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
  if (event.getRepeatCount() >= LONGPRESS_REPEATS) {
    imm.showSoftInput(v,InputMethodManager.SHOW_FORCED);
    mCreatingSoftKeyboard=true;
    return true;
  }
  imm.hideSoftInputFromWindow(v.getWindowToken(),0);
  return false;
}
 

Example 12

From project androidtracks, under directory /src/org/sfcta/cycletracks/.

Source file: SaveTrip.java

  32 
vote

void activateSubmitButton(){
  final Button btnSubmit=(Button)findViewById(R.id.ButtonSubmit);
  final Intent xi=new Intent(this,ShowMap.class);
  btnSubmit.setEnabled(true);
  btnSubmit.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      TripData trip=TripData.fetchTrip(SaveTrip.this,tripid);
      trip.populateDetails();
      if (purpose.equals("")) {
        Toast.makeText(getBaseContext(),"You must select a trip purpose before submitting! Choose from the purposes above.",Toast.LENGTH_SHORT).show();
        return;
      }
      EditText notes=(EditText)findViewById(R.id.NotesField);
      String fancyStartTime=DateFormat.getInstance().format(trip.startTime);
      SimpleDateFormat sdf=new SimpleDateFormat("m");
      sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
      String minutes=sdf.format(trip.endTime - trip.startTime);
      String fancyEndInfo=String.format("%1.1f miles, %s minutes.  %s",(0.0006212f * trip.distance),minutes,notes.getEditableText().toString());
      trip.updateTrip(purpose,fancyStartTime,fancyEndInfo,notes.getEditableText().toString());
      trip.updateTripStatus(TripData.STATUS_COMPLETE);
      resetService();
      InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(v.getWindowToken(),0);
      Intent i=new Intent(getApplicationContext(),MainInput.class);
      startActivity(i);
      xi.putExtra("showtrip",trip.tripid);
      xi.putExtra("uploadTrip",true);
      startActivity(xi);
      SaveTrip.this.finish();
    }
  }
);
}
 

Example 13

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/.

Source file: LanguageSettings.java

  32 
vote

private void onCreateIMM(){
  InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  mInputMethodProperties=imm.getInputMethodList();
  mLastInputMethodId=Settings.Secure.getString(getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD);
  PreferenceGroup keyboardSettingsCategory=(PreferenceGroup)findPreference(KEY_KEYBOARD_SETTINGS_CATEGORY);
  int N=(mInputMethodProperties == null ? 0 : mInputMethodProperties.size());
  for (int i=0; i < N; ++i) {
    InputMethodInfo property=mInputMethodProperties.get(i);
    String prefKey=property.getId();
    CharSequence label=property.loadLabel(getPackageManager());
    boolean systemIME=isSystemIme(property);
    if (mHaveHardKeyboard || (N > 1 && !systemIME)) {
      CheckBoxPreference chkbxPref=new CheckBoxPreference(this);
      chkbxPref.setKey(prefKey);
      chkbxPref.setTitle(label);
      keyboardSettingsCategory.addPreference(chkbxPref);
      mCheckboxes.add(chkbxPref);
    }
    if (null != property.getSettingsActivity()) {
      PreferenceScreen prefScreen=new PreferenceScreen(this,null);
      String settingsActivity=property.getSettingsActivity();
      if (settingsActivity.lastIndexOf("/") < 0) {
        settingsActivity=property.getPackageName() + "/" + settingsActivity;
      }
      prefScreen.setKey(settingsActivity);
      prefScreen.setTitle(label);
      if (N == 1) {
        prefScreen.setSummary(getString(R.string.onscreen_keyboard_settings_summary));
      }
 else {
        CharSequence settingsLabel=getResources().getString(R.string.input_methods_settings_label_format,label);
        prefScreen.setSummary(settingsLabel);
      }
      keyboardSettingsCategory.addPreference(prefScreen);
    }
  }
}
 

Example 14

From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/utils/.

Source file: Utils.java

  32 
vote

public static OnShowListener getBrickDialogOnClickListener(final Context context,final EditText input){
  return new OnShowListener(){
    public void onShow(    DialogInterface dialog){
      InputMethodManager inputManager=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
      inputManager.showSoftInput(input,InputMethodManager.SHOW_IMPLICIT);
    }
  }
;
}
 

Example 15

From project cornerstone, under directory /frameworks/base/core/java/android/view/.

Source file: ViewRootImpl.java

  32 
vote

public static IWindowSession getWindowSession(Looper mainLooper){
synchronized (mStaticInit) {
    if (!mInitialized) {
      try {
        InputMethodManager imm=InputMethodManager.getInstance(mainLooper);
        sWindowSession=Display.getWindowManager().openSession(imm.getClient(),imm.getInputContext());
        mInitialized=true;
      }
 catch (      RemoteException e) {
      }
    }
    return sWindowSession;
  }
}
 

Example 16

From project dungbeetle, under directory /src/edu/stanford/mobisocial/dungbeetle/ui/fragments/.

Source file: AppsViewFragment.java

  32 
vote

public void onClick(View v){
  Editable editor=mStatusText.getText();
  String update=editor.toString();
  if (update.length() != 0) {
    editor.clear();
    Helpers.sendToFeed(getActivity(),StatusObj.from(update),mFeedUri);
  }
  InputMethodManager imm=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(mStatusText.getWindowToken(),0);
}
 

Example 17

From project examples_2, under directory /SearchView/search-view-lib/src/com/actionbarsherlock/widget/searchview/internal/.

Source file: CompatSearchView.java

  32 
vote

public void run(){
  InputMethodManager imm=(InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
  if (imm != null) {
    try {
      Class<?> clazz=InputMethodManager.class;
      Method method=clazz.getDeclaredMethod("showSoftInputUnchecked",int.class,ResultReceiver.class);
      method.invoke(imm,0,null);
    }
 catch (    Throwable ex) {
      imm.showSoftInput(CompatSearchView.this,0,null);
    }
  }
}
 

Example 18

From project fanfoudroid, under directory /src/com/ch_linghu/fanfoudroid/.

Source file: WriteActivity.java

  32 
vote

private void onSendSuccess(){
  if (dialog != null) {
    dialog.setMessage(getString(R.string.page_status_update_success));
    dialog.dismiss();
  }
  _reply_id=null;
  _repost_id=null;
  updateProgress(getString(R.string.page_status_update_success));
  enableEntry();
  updateProgress("");
  finish();
  InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(mTweetEdit.getEditText().getWindowToken(),0);
}
 

Example 19

From project filemanager, under directory /FileManager/src/org/openintents/filemanager/view/.

Source file: PathBar.java

  32 
vote

/** 
 * Use instead of  {@link #cd(String)} when in {@link Mode#MANUAL_INPUT}.
 * @param path The path to cd() to.
 * @return true if the cd succeeded.
 */
private boolean manualInputCd(String path){
  if (cd(path)) {
    InputMethodManager imm=(InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(getWindowToken(),0);
    switchToStandardInput();
    return true;
  }
 else {
    Log.w(TAG,"Input path does not exist or is not a folder!");
    return false;
  }
}
 

Example 20

From project GnucashMobile, under directory /GnucashMobile/src/org/gnucash/android/ui/transactions/.

Source file: NewTransactionFragment.java

  32 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
  InputMethodManager imm=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(mNameEditText.getApplicationWindowToken(),0);
switch (item.getItemId()) {
case R.id.menu_cancel:
    getSherlockActivity().getSupportFragmentManager().popBackStack();
  return true;
case R.id.menu_save:
saveNewTransaction();
return true;
default :
return false;
}
}
 

Example 21

From project KeyboardTerm, under directory /src/tw/kenshinn/keyboardTerm/.

Source file: AddressBookActivity.java

  32 
vote

private void connect(Host host){
  InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(((TextView)findViewById(R.id.quickConnect)).getWindowToken(),0);
  Intent intent=new Intent();
  intent.setClass(AddressBookActivity.this,TerminalActivity.class);
  intent.putExtra("host",host);
  Log.v(TAG,"" + host.getId());
  Toast.makeText(AddressBookActivity.this,host.getName(),Toast.LENGTH_SHORT).show();
  AddressBookActivity.this.startActivity(intent);
}
 

Example 22

From project LunaTerm, under directory /src/tw/loli/lunaTerm/.

Source file: AddressBookActivity.java

  32 
vote

private void connect(Host host){
  InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(((TextView)findViewById(R.id.quickConnect)).getWindowToken(),0);
  Intent intent=new Intent();
  intent.setClass(AddressBookActivity.this,TerminalActivity.class);
  intent.putExtra("host",host);
  Log.v(TAG,"" + host.getId());
  Toast.makeText(AddressBookActivity.this,host.getName(),Toast.LENGTH_SHORT).show();
  AddressBookActivity.this.startActivity(intent);
}
 

Example 23

From project mediaphone, under directory /src/ac/robinson/mediaphone/activity/.

Source file: TextActivity.java

  32 
vote

@Override public void onBackPressed(){
  InputMethodManager inputMethodManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  inputMethodManager.hideSoftInputFromWindow(((EditText)findViewById(R.id.text_view)).getWindowToken(),0);
  MediaItem textMediaItem=MediaManager.findMediaByInternalId(getContentResolver(),mMediaItemInternalId);
  saveCurrentText(textMediaItem);
  saveLastEditedFrame(textMediaItem != null ? textMediaItem.getParentId() : null);
  setResult(Activity.RESULT_OK);
  finish();
}
 

Example 24

From project MobiPerf, under directory /android/src/com/mobiperf/speedometer/.

Source file: MeasurementCreationActivity.java

  32 
vote

private void hideKyeboard(EditText textBox){
  if (textBox != null) {
    InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(textBox.getWindowToken(),0);
  }
}
 

Example 25

From project MyHeath-Android, under directory /actionbarlib/src/com/actionbarsherlock/widget/.

Source file: SearchViewSherlock.java

  32 
vote

public void run(){
  InputMethodManager imm=(InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
  if (imm != null) {
    imm.showSoftInput(null,0);
  }
}
 

Example 26

From project Notes, under directory /src/net/micode/notes/ui/.

Source file: NotesListActivity.java

  32 
vote

private void showSoftInput(){
  InputMethodManager inputMethodManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  if (inputMethodManager != null) {
    inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
  }
}
 

Example 27

From project ohmagePhone, under directory /src/org/ohmage/triggers/types/location/.

Source file: LocTrigSettingsActivity.java

  32 
vote

private void addNewCategory(){
  EditText et=(EditText)findViewById(R.id.trigger_text_add_categ);
  mDb.addCategory(et.getText().toString().trim());
  refreshList();
  InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(et.getWindowToken(),0);
  et.setText("");
}
 

Example 28

From project Ohmage_Phone, under directory /src/org/ohmage/triggers/types/location/.

Source file: LocTrigSettingsActivity.java

  32 
vote

private void addNewCategory(){
  EditText et=(EditText)findViewById(R.id.trigger_text_add_categ);
  mDb.addCategory(et.getText().toString().trim());
  refreshList();
  InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(et.getWindowToken(),0);
  et.setText("");
}
 

Example 29

From project onebusaway-android, under directory /src/com/joulespersecond/seattlebusbot/.

Source file: ArrivalsListHeader.java

  32 
vote

void endNameEdit(){
  mInNameEdit=false;
  mNameContainerView.setVisibility(View.VISIBLE);
  mEditNameContainerView.setVisibility(View.GONE);
  mDirectionView.setVisibility(View.VISIBLE);
  InputMethodManager imm=(InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(mEditNameView.getWindowToken(),0);
  refreshName();
}
 

Example 30

From project platform_frameworks_ex, under directory /common/java/com/android/ex/editstyledtext/.

Source file: EditStyledText.java

  32 
vote

public void showSoftKey(int oldSelStart,int oldSelEnd){
  if (DBG) {
    Log.d(LOG_TAG,"--- showsoftkey");
  }
  if (!mEST.isFocused() || isSoftKeyBlocked()) {
    return;
  }
  mSkr.mNewStart=Selection.getSelectionStart(mEST.getText());
  mSkr.mNewEnd=Selection.getSelectionEnd(mEST.getText());
  InputMethodManager imm=(InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
  if (imm.showSoftInput(mEST,0,mSkr) && mSkr != null) {
    Selection.setSelection(getText(),oldSelStart,oldSelEnd);
  }
}
 

Example 31

From project platform_packages_apps_browser, under directory /src/com/android/browser/.

Source file: AutoFillSettingsFragment.java

  32 
vote

private void closeEditor(){
  InputMethodManager imm=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(getView().getWindowToken(),0);
  if (getFragmentManager().getBackStackEntryCount() > 0) {
    getFragmentManager().popBackStack();
  }
 else {
    getActivity().finish();
  }
}
 

Example 32

From project platform_packages_apps_contacts, under directory /src/com/android/contacts/activities/.

Source file: ActionBarAdapter.java

  32 
vote

@Override public boolean onQueryTextSubmit(String query){
  if (mSearchView != null) {
    InputMethodManager imm=(InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm != null) {
      imm.hideSoftInputFromWindow(mSearchView.getWindowToken(),0);
    }
    mSearchView.clearFocus();
  }
  return true;
}
 

Example 33

From project QuasselDroid, under directory /src/com/iskrembilen/quasseldroid/gui/.

Source file: MainActivity.java

  32 
vote

@Override public void onPageSelected(int position){
  if (position == BUFFERS_POS) {
    BusProvider.getInstance().post(new UpdateReadBufferEvent());
  }
  InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(pager.getWindowToken(),0);
}
 

Example 34

From project rozkladpkp-android, under directory /src/org/tyszecki/rozkladpkp/.

Source file: RozkladPKP.java

  32 
vote

@Override public void onTabSelected(Tab tab,FragmentTransaction ft){
  if (tab.getPosition() == 0) {
    InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(mViewPager.getWindowToken(),0);
  }
  mViewPager.setCurrentItem(tab.getPosition());
}
 

Example 35

From project shoppinglist, under directory /ShoppingList/src/org/openintents/shopping/ui/dialog/.

Source file: EditItemDialog.java

  32 
vote

private void focus_field(EditText e,Boolean selectAll){
  InputMethodManager imm=(InputMethodManager)mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
  if (selectAll)   e.selectAll();
  if (e.requestFocus())   imm.showSoftInput(e,0);
  imm.toggleSoftInputFromWindow(e.getWindowToken(),0,0);
}
 

Example 36

From project Something-Awful-Android, under directory /application/src/com/ferg/awfulapp/.

Source file: PostReplyFragment.java

  32 
vote

private void leave(){
  if (getAwfulActivity() != null) {
    InputMethodManager imm=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(getView().getApplicationWindowToken(),0);
    getAwfulActivity().fragmentClosing(this);
  }
}
 

Example 37

From project Speedometer, under directory /android/src/com/google/wireless/speed/speedometer/.

Source file: MeasurementCreationActivity.java

  32 
vote

private void hideKyeboard(EditText textBox){
  if (textBox != null) {
    InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(textBox.getWindowToken(),0);
  }
}
 

Example 38

From project SWE12-Drone, under directory /catroid/src/at/tugraz/ist/catroid/utils/.

Source file: Utils.java

  32 
vote

public static OnShowListener getBrickDialogOnClickListener(final Context context,final EditText input){
  return new OnShowListener(){
    public void onShow(    DialogInterface dialog){
      InputMethodManager inputManager=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
      inputManager.showSoftInput(input,InputMethodManager.SHOW_IMPLICIT);
    }
  }
;
}
 

Example 39

From project TeclaAccess, under directory /source/src/ca/idi/tekla/.

Source file: TeclaSplash.java

  32 
vote

public void onFocusChange(View v,boolean hasFocus){
  getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE | WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
  InputMethodManager mImeManager=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
  mImeManager.toggleSoftInputFromWindow(mSplashText.getWindowToken(),InputMethodManager.SHOW_IMPLICIT,0);
  mImeManager.toggleSoftInputFromWindow(mSplashText.getWindowToken(),InputMethodManager.SHOW_IMPLICIT,0);
}
 

Example 40

From project android-joedayz, under directory /Proyectos/client/src/org/springframework/android/showcase/social/facebook/.

Source file: FacebookWallPostActivity.java

  31 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.facebook_wall_post_activity_layout);
  this.facebook=getApplicationContext().getConnectionRepository().findPrimaryConnection(Facebook.class).getApi();
  final Button button=(Button)findViewById(R.id.button_submit);
  button.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      InputMethodManager inputMethodManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
      EditText editText=(EditText)findViewById(R.id.edit_text_wall_post);
      inputMethodManager.hideSoftInputFromWindow(editText.getWindowToken(),0);
      new PostTweetTask().execute();
    }
  }
);
}
 

Example 41

From project Android-Terminal-Emulator, under directory /src/jackpal/androidterm/.

Source file: Term.java

  31 
vote

@Override public void onPause(){
  super.onPause();
  SessionList sessions=mTermSessions;
  TermViewFlipper viewFlipper=mViewFlipper;
  viewFlipper.onPause();
  if (sessions != null) {
    sessions.removeCallback(this);
    WindowListAdapter adapter=mWinListAdapter;
    if (adapter != null) {
      sessions.removeCallback(adapter);
      sessions.removeTitleChangedListener(adapter);
      viewFlipper.removeCallback(adapter);
    }
  }
  if (AndroidCompat.SDK < 5) {
    mBackKeyPressed=false;
  }
  final IBinder token=viewFlipper.getWindowToken();
  new Thread(){
    @Override public void run(){
      InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(token,0);
    }
  }
.start();
}
 

Example 42

From project android-voip-service, under directory /src/main/java/org/linphone/.

Source file: FirstLoginActivity.java

  31 
vote

public void onClick(View v){
  if (login.getText() == null || login.length() == 0 || password.getText() == null || password.length() == 0) {
    toast(R.string.first_launch_no_login_password);
    return;
  }
  InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(),0);
  writePreference(R.string.pref_username_key,login.getText().toString());
  writePreference(R.string.pref_passwd_key,password.getText().toString());
  LinphoneManager.getInstance().initializePayloads();
  try {
    LinphoneManager.getInstance().initFromConf(getApplicationContext());
  }
 catch (  Throwable e) {
    Log.e(e,"Error while initializing from config in first login activity");
    toast(R.string.error);
    ;
  }
}
 

Example 43

From project android_packages_inputmethods_LatinIME, under directory /tests/src/com/android/inputmethod/latin/.

Source file: SubtypeLocaleTests.java

  31 
vote

@Override protected void setUp() throws Exception {
  super.setUp();
  final Context context=getContext();
  mRes=context.getResources();
  SubtypeLocale.init(context);
  final InputMethodManager imm=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
  for (  final InputMethodInfo imi : imm.getInputMethodList()) {
    if (imi.getPackageName().equals(PACKAGE)) {
      final int subtypeCount=imi.getSubtypeCount();
      for (int i=0; i < subtypeCount; ++i) {
        InputMethodSubtype subtype=imi.getSubtypeAt(i);
        if (subtype.getMode().equals("keyboard")) {
          mKeyboardSubtypes.add(subtype);
        }
      }
      break;
    }
  }
  assertNotNull("Can not find input method " + PACKAGE,mKeyboardSubtypes);
  assertTrue("Can not find keyboard subtype",mKeyboardSubtypes.size() > 0);
}
 

Example 44

From project beintoo-android-sdk, under directory /BeintooSDK/src/com/beintoo/activities/.

Source file: Friends.java

  31 
vote

private void initFindFriends(){
  RelativeLayout beintooBar=(RelativeLayout)findViewById(R.id.beintoobarsmall);
  beintooBar.setBackgroundDrawable(new BDrawableGradient(0,(int)(ratio * 40),BDrawableGradient.BAR_GRADIENT));
  TextView title=(TextView)findViewById(R.id.dialogTitle);
  title.setTextColor(Color.WHITE);
  title.setText(current.getContext().getString(R.string.friendFind));
  ImageView searchicon=new ImageView(current.getContext());
  searchicon.setImageResource(R.drawable.findfriend);
  EditText querytext=new EditText(current.getContext());
  LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.FILL_PARENT);
  lp.setMargins(10,0,0,0);
  querytext.setLayoutParams(lp);
  querytext.setHint(current.getContext().getString(R.string.friendFindeditsearch));
  querytext.setPadding((int)(ratio * 10),0,0,0);
  querytext.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
  querytext.setOnEditorActionListener(new EditText.OnEditorActionListener(){
    public boolean onEditorAction(    TextView v,    int actionId,    KeyEvent event){
      if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
        InputMethodManager imm=(InputMethodManager)current.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(v.getWindowToken(),0);
        loadSearchResults(v.getText().toString());
        return true;
      }
      return false;
    }
  }
);
  LinearLayout searchBar=new LinearLayout(current.getContext());
  searchBar.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT));
  searchBar.setOrientation(LinearLayout.HORIZONTAL);
  searchBar.setPadding(10,10,10,10);
  searchBar.addView(searchicon);
  searchBar.addView(querytext);
  searchBar.setBackgroundDrawable(new BDrawableGradient(0,(int)(ratio * 90),BDrawableGradient.GRAY_GRADIENT));
  LinearLayout searchlayout=(LinearLayout)findViewById(R.id.searchspace);
  searchlayout.addView(searchBar);
  searchlayout.addView(createSpacer(current.getContext(),1,1));
  searchlayout.addView(createSpacer(current.getContext(),2,1));
  searchlayout.setVisibility(LinearLayout.VISIBLE);
}
 

Example 45

From project creamed_glacier_app_settings, under directory /src/com/android/settings/.

Source file: CryptKeeper.java

  31 
vote

private void passwordEntryInit(){
  mPasswordEntry=(EditText)findViewById(R.id.passwordEntry);
  mPasswordEntry.setOnEditorActionListener(this);
  mPasswordEntry.requestFocus();
  View imeSwitcher=findViewById(R.id.switch_ime_button);
  final InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  if (imeSwitcher != null && hasMultipleEnabledIMEsOrSubtypes(imm,false)) {
    imeSwitcher.setVisibility(View.VISIBLE);
    imeSwitcher.setOnClickListener(new OnClickListener(){
      public void onClick(      View v){
        imm.showInputMethodPicker();
      }
    }
);
  }
  mHandler.postDelayed(new Runnable(){
    @Override public void run(){
      imm.showSoftInputUnchecked(0,null);
    }
  }
,0);
  updateEmergencyCallButtonState();
}
 

Example 46

From project Gibberbot, under directory /src/info/guardianproject/otr/app/im/app/.

Source file: ContactListActivity.java

  31 
vote

@Override public boolean dispatchKeyEvent(KeyEvent event){
  int keyCode=event.getKeyCode();
  boolean handled=false;
  if (!mIsFiltering) {
    handled=mFilterView.dispatchKeyEvent(event);
    if (!handled && (KeyEvent.KEYCODE_BACK == keyCode) && (KeyEvent.ACTION_DOWN == event.getAction())) {
      showFilterView();
      handled=true;
    }
  }
 else {
    handled=mContactListView.dispatchKeyEvent(event);
    if (!handled && KeyEvent.KEYCODE_SEARCH == keyCode && (KeyEvent.ACTION_DOWN == event.getAction())) {
      InputMethodManager inputMgr=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
      inputMgr.toggleSoftInput(0,0);
      if (!mIsFiltering)       showFilterView();
      onSearchRequested();
    }
 else     if (!handled && isReadable(keyCode,event) && (KeyEvent.ACTION_DOWN == event.getAction())) {
      if (!mIsFiltering)       showFilterView();
      handled=mFilterView.dispatchKeyEvent(event);
    }
  }
  if (!handled) {
    handled=super.dispatchKeyEvent(event);
  }
  return handled;
}
 

Example 47

From project greenhouse-android, under directory /src/com/springsource/greenhouse/events/sessions/.

Source file: EventSessionRatingActivity.java

  31 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.event_session_rating);
  textViewCount=(TextView)this.findViewById(R.id.event_session_rating_count);
  textWatcher=new TextWatcher(){
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
      textViewCount.setText(String.valueOf(MAX_LENGTH - s.length()));
    }
    public void afterTextChanged(    Editable s){
    }
  }
;
  final EditText editText=(EditText)findViewById(R.id.event_session_rating_text);
  editText.addTextChangedListener(textWatcher);
  final Button submitButton=(Button)findViewById(R.id.event_session_rating_submit);
  submitButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      InputMethodManager inputMethodManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
      EditText editText=(EditText)findViewById(R.id.event_session_rating_text);
      inputMethodManager.hideSoftInputFromWindow(editText.getWindowToken(),0);
      submitRating();
    }
  }
);
  final Button selectStartButton=(Button)findViewById(R.id.event_session_rating_select_star);
  selectStartButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      showSelectStarRatingDialog();
    }
  }
);
}
 

Example 48

From project HapiPodcastJ, under directory /src/info/xuluan/podcast/.

Source file: SearchActivity.java

  31 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.addchannel);
  setTitle(getResources().getString(R.string.title_channels));
  mAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,mStrings);
  setListAdapter(mAdapter);
  getListView().setOnCreateContextMenuListener(this);
  mEditText=(EditText)findViewById(R.id.keywords);
  mEditText.addTextChangedListener(this);
  mPrevIntent=new Intent(this,PlayListActivity.class);
  mNextIntent=new Intent(this,ChannelsActivity.class);
  startInit();
  Button next=(Button)findViewById(R.id.ButtonNext);
  next.setEnabled(false);
  next.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      String str="&start=" + mStart;
      String url=getUrl();
      if (url != null) {
        start_search(url + str);
      }
    }
  }
);
  ImageButton start=(ImageButton)findViewById(R.id.ButtonStart);
  start.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      InputMethodManager m=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
      m.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT,InputMethodManager.HIDE_NOT_ALWAYS);
      m.hideSoftInputFromInputMethod(mEditText.getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);
      String str="&start=" + mStart;
      String url=getUrl();
      if (url != null) {
        start_search(url + str);
      }
    }
  }
);
  TabsHelper.setChannelTabClickListeners(this,R.id.channel_bar_search_button);
}
 

Example 49

From project Hax-Launcher, under directory /src/com/t3hh4xx0r/haxlauncher/.

Source file: Launcher.java

  31 
vote

/** 
 * We should remove this code when we remove all the dialog code. try { dismissDialog(DIALOG_CREATE_SHORTCUT); // Unlock the workspace if the dialog was showing } catch (Exception e) { // An exception is thrown if the dialog is not visible, which is fine } try { dismissDialog(DIALOG_RENAME_FOLDER); // Unlock the workspace if the dialog was showing } catch (Exception e) { // An exception is thrown if the dialog is not visible, which is fine }
 */
@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (Intent.ACTION_MAIN.equals(intent.getAction())) {
    closeSystemDialogs();
    boolean alreadyOnHome=((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
    Folder openFolder=mWorkspace.getOpenFolder();
    mWorkspace.exitWidgetResizeMode();
    if (alreadyOnHome && mState == State.WORKSPACE && !mWorkspace.isTouchActive() && openFolder == null) {
      mWorkspace.moveToDefaultScreen(true);
    }
    closeFolder();
    exitSpringLoadedDragMode();
    showWorkspace(alreadyOnHome);
    final View v=getWindow().peekDecorView();
    if (v != null && v.getWindowToken() != null) {
      InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(v.getWindowToken(),0);
    }
    if (!alreadyOnHome && mAppsCustomizeTabHost != null) {
      mAppsCustomizeTabHost.reset();
    }
  }
}
 

Example 50

From project HeLauncher, under directory /src/com/handlerexploit/launcher_reloaded/.

Source file: Launcher.java

  31 
vote

@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (Intent.ACTION_MAIN.equals(intent.getAction())) {
    closeSystemDialogs();
    mIsNewIntent=true;
    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) {
      if (!mWorkspace.isDefaultScreenShowing()) {
        if (mIndicator != null && !keepIndicatorOn)         mIndicator.setVisibility(View.GONE);
        mWorkspace.moveToDefaultScreen();
      }
      final View v=getWindow().peekDecorView();
      if (v != null && v.getWindowToken() != null) {
        InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(v.getWindowToken(),0);
      }
    }
  }
}
 

Example 51

From project ICS_LatinIME_QHD, under directory /tests/src/com/android/inputmethod/latin/.

Source file: SubtypeLocaleTests.java

  31 
vote

@Override protected void setUp() throws Exception {
  super.setUp();
  final Context context=getContext();
  mRes=context.getResources();
  SubtypeLocale.init(context);
  final InputMethodManager imm=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
  for (  final InputMethodInfo imi : imm.getInputMethodList()) {
    if (imi.getPackageName().equals(PACKAGE)) {
      final int subtypeCount=imi.getSubtypeCount();
      for (int i=0; i < subtypeCount; ++i) {
        InputMethodSubtype subtype=imi.getSubtypeAt(i);
        if (subtype.getMode().equals("keyboard")) {
          mKeyboardSubtypes.add(subtype);
        }
      }
      break;
    }
  }
  assertNotNull("Can not find input method " + PACKAGE,mKeyboardSubtypes);
  assertTrue("Can not find keyboard subtype",mKeyboardSubtypes.size() > 0);
}
 

Example 52

From project Jota-Text-Editor, under directory /src/jp/sblo/pandora/jota/text/.

Source file: EditText.java

  31 
vote

@Override public boolean dispatchKeyEventPreIme(KeyEvent event){
  int keycode=event.getKeyCode();
  int meta=(int)event.getMetaState();
  boolean alt=(meta & mShortcutMetaKey) != 0;
  if (alt && event.getAction() == KeyEvent.ACTION_DOWN) {
    if (doShortcut(keycode)) {
      if ((meta & KeyEvent.META_ALT_LEFT_ON) != 0 || (meta & KeyEvent.META_ALT_RIGHT_ON) != 0) {
        InputMethodManager imm=InputMethodManager.peekInstance();
        if (imm != null) {
          try {
            Class<?> c=imm.getClass();
            Field f=c.getDeclaredField("mCurId");
            f.setAccessible(true);
            String immId=(String)f.get(imm);
            if ("jp.co.omronsoft.iwnnime/.iWnnIME".equals(immId)) {
              imm.restartInput(this);
            }
          }
 catch (          Exception e) {
          }
        }
        TextKeyListener.resetMetaState((Spannable)getEditableText());
      }
      return true;
    }
  }
  return super.dispatchKeyEventPreIme(event);
}
 

Example 53

From project kumvandroid, under directory /src/com/ijuru/kumva/activity/.

Source file: SearchActivity.java

  31 
vote

/** 
 * Performs a dictionary search (called from event therefore must be public)
 * @param view the view
 */
private void doSearch(String query){
  if (suggestionsTask != null)   suggestionsTask.cancel(true);
  ListView listResults=(ListView)findViewById(R.id.listresults);
  listResults.setAdapter(definitionAdapter);
  setStatusMessage(null);
  EditText txtQuery=(EditText)findViewById(R.id.queryfield);
  ignoreTextChange=true;
  txtQuery.setText(query);
  ignoreTextChange=false;
  txtQuery.setSelection(query.length());
  InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(txtQuery.getWindowToken(),0);
  definitionAdapter.clear();
  KumvaApplication app=(KumvaApplication)getApplication();
  Dictionary activeDictionary=app.getActiveDictionary();
  if (activeDictionary != null) {
    progressDialog=ProgressDialog.show(this,getString(R.string.str_searching),getString(R.string.str_pleasewait));
    progressDialog.setCancelable(true);
    progressDialog.setOnCancelListener(this);
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
    Integer limit=Utils.parseInteger(prefs.getString("max_results","50"));
    int timeout=getResources().getInteger(R.integer.connection_timeout);
    search=activeDictionary.createSearch(timeout);
    search.setListener(this);
    search.execute(query,limit);
  }
 else   Dialogs.error(this,getString(R.string.err_nodictionary));
}
 

Example 54

From project PartyWare, under directory /android/src/edu/stanford/junction/sample/partyware/.

Source file: UpdateProfileActivity.java

  31 
vote

@Override public boolean onKeyUp(int keyCode,KeyEvent event){
  View ac1=mNameText;
  View ac2=mEmailText;
  if (keyCode == KeyEvent.KEYCODE_ENTER) {
    if (ac1.hasFocus()) {
      ac2.requestFocus();
      return true;
    }
 else     if (ac2.hasFocus()) {
      InputMethodManager inputManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
      inputManager.hideSoftInputFromWindow(ac2.getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);
      return true;
    }
  }
  return false;
}
 

Example 55

From project platform_frameworks_policies_base, under directory /phone/com/android/internal/policy/impl/.

Source file: PhoneWindow.java

  31 
vote

/** 
 * Called when the panel key is pushed down.
 * @param featureId The feature ID of the relevant panel (defaults to FEATURE_OPTIONS_PANEL}.
 * @param event The key event.
 * @return Whether the key was handled.
 */
public final boolean onKeyDownPanel(int featureId,KeyEvent event){
  final int keyCode=event.getKeyCode();
  if (event.getRepeatCount() == 0) {
    mPanelChordingKey=keyCode;
    mPanelMayLongPress=false;
    PanelFeatureState st=getPanelState(featureId,true);
    if (!st.isOpen) {
      if (getContext().getResources().getConfiguration().keyboard == Configuration.KEYBOARD_NOKEYS) {
        mPanelMayLongPress=true;
      }
      return preparePanel(st,event);
    }
  }
 else   if (mPanelMayLongPress && mPanelChordingKey == keyCode && (event.getFlags() & KeyEvent.FLAG_LONG_PRESS) != 0) {
    mPanelChordingKey=0;
    mPanelMayLongPress=false;
    InputMethodManager imm=(InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm != null) {
      mDecor.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
      imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
    }
  }
  return false;
}
 

Example 56

From project platform_packages_apps_launcher, under directory /src/com/android/launcher/.

Source file: Launcher.java

  31 
vote

@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (Intent.ACTION_MAIN.equals(intent.getAction())) {
    getWindow().closeAllPanels();
    mIsNewIntent=true;
    try {
      dismissDialog(DIALOG_CREATE_SHORTCUT);
      mWorkspace.unlock();
    }
 catch (    Exception e) {
    }
    try {
      dismissDialog(DIALOG_RENAME_FOLDER);
      mWorkspace.unlock();
    }
 catch (    Exception e) {
    }
    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) {
      if (!mWorkspace.isDefaultScreenShowing()) {
        mWorkspace.moveToDefaultScreen();
      }
      closeDrawer();
      final View v=getWindow().peekDecorView();
      if (v != null && v.getWindowToken() != null) {
        InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(v.getWindowToken(),0);
      }
    }
 else {
      closeDrawer(false);
    }
  }
}
 

Example 57

From project platform_packages_apps_settings, under directory /src/com/android/settings/inputmethod/.

Source file: InputMethodAndLanguageSettings.java

  31 
vote

@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,Preference preference){
  if (Utils.isMonkeyRunning()) {
    return false;
  }
  if (preference instanceof PreferenceScreen) {
    if (preference.getFragment() != null) {
    }
 else     if (KEY_CURRENT_INPUT_METHOD.equals(preference.getKey())) {
      final InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.showInputMethodPicker();
    }
  }
 else   if (preference instanceof CheckBoxPreference) {
    final CheckBoxPreference chkPref=(CheckBoxPreference)preference;
    if (!mHardKeyboardPreferenceList.isEmpty()) {
      for (int i=0; i < sHardKeyboardKeys.length; ++i) {
        if (chkPref == mHardKeyboardCategory.findPreference(sHardKeyboardKeys[i])) {
          System.putInt(getContentResolver(),sSystemSettingNames[i],chkPref.isChecked() ? 1 : 0);
          return true;
        }
      }
    }
    if (chkPref == mGameControllerCategory.findPreference("vibrate_input_devices")) {
      System.putInt(getContentResolver(),Settings.System.VIBRATE_INPUT_DEVICES,chkPref.isChecked() ? 1 : 0);
      return true;
    }
  }
  return super.onPreferenceTreeClick(preferenceScreen,preference);
}
 

Example 58

From project Playlist, under directory /src/edu/stanford/junction/sample/partyware/playlist/.

Source file: UpdateProfileActivity.java

  31 
vote

@Override public boolean onKeyUp(int keyCode,KeyEvent event){
  View ac1=mNameText;
  View ac2=mEmailText;
  if (keyCode == KeyEvent.KEYCODE_ENTER) {
    if (ac1.hasFocus()) {
      ac2.requestFocus();
      return true;
    }
 else     if (ac2.hasFocus()) {
      InputMethodManager inputManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
      inputManager.hideSoftInputFromWindow(ac2.getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);
      return true;
    }
  }
  return false;
}
 

Example 59

From project RA_Launcher, under directory /src/com/android/ra/launcher/.

Source file: Launcher.java

  31 
vote

@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (Intent.ACTION_MAIN.equals(intent.getAction())) {
    closeSystemDialogs();
    boolean alreadyOnHome=((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
    boolean allAppsVisible=isAllAppsVisible();
    if (!mWorkspace.isDefaultScreenShowing()) {
      mWorkspace.moveToDefaultScreen(alreadyOnHome && !allAppsVisible);
    }
    closeAllApps(alreadyOnHome && allAppsVisible);
    final View v=getWindow().peekDecorView();
    if (v != null && v.getWindowToken() != null) {
      InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
      imm.hideSoftInputFromWindow(v.getWindowToken(),0);
    }
  }
}
 

Example 60

From project RebeLauncher, under directory /src/com/dirtypepper/rebelauncher/.

Source file: Launcher.java

  31 
vote

@Override protected void onNewIntent(Intent intent){
  super.onNewIntent(intent);
  if (Intent.ACTION_MAIN.equals(intent.getAction())) {
    closeSystemDialogs();
    mIsNewIntent=true;
    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) {
      if (!isAllAppsVisible() || mHomeBinding == BIND_APPS)       fireHomeBinding(mHomeBinding,1);
      if (mHomeBinding != BIND_APPS) {
        closeDrawer(true);
      }
      final View v=getWindow().peekDecorView();
      if (v != null && v.getWindowToken() != null) {
        InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(v.getWindowToken(),0);
      }
    }
 else {
      closeDrawer(false);
    }
  }
}
 

Example 61

From project safe, under directory /Safe/src/org/openintents/safe/.

Source file: SearchFragment.java

  31 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  ViewGroup root=(ViewGroup)inflater.inflate(R.layout.search_fragment,null);
  frontdoor=new Intent(getActivity(),Safe.class);
  frontdoor.setAction(CryptoIntents.ACTION_AUTOLOCK);
  restartTimerIntent=new Intent(CryptoIntents.ACTION_RESTART_TIMER);
  etSearchCriteria=(EditText)root.findViewById(R.id.search_criteria);
  results=new ArrayList<SearchEntry>();
  Button goButton=(Button)root.findViewById(R.id.go_button);
  goButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View arg0){
      searchCriteria=etSearchCriteria.getText().toString().trim().toLowerCase();
      searchThreadStart();
    }
  }
);
  etSearchCriteria.setOnEditorActionListener(new TextView.OnEditorActionListener(){
    public boolean onEditorAction(    TextView v,    int actionId,    KeyEvent event){
      if (actionId == EditorInfo.IME_ACTION_SEARCH || event == null) {
        InputMethodManager imm=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.toggleSoftInput(0,0);
        searchCriteria=etSearchCriteria.getText().toString().trim().toLowerCase();
        searchThreadStart();
        return true;
      }
      return false;
    }
  }
);
  return root;
}
 

Example 62

From project SOCIETIES-SCE-Services, under directory /3rdPartyServices/DisasterManagement/iDisaster/src/com/disaster/idisaster/.

Source file: DisasterCreateActivity.java

  31 
vote

/** 
 * onClick is called when button is clicked because the OnClickListener is assigned to the button
 */
public void onClick(View view){
  if (disasterNameView.getText().length() == 0) {
    InputMethodManager mgr=(InputMethodManager)getSystemService(this.INPUT_METHOD_SERVICE);
    mgr.hideSoftInputFromWindow(disasterNameView.getWindowToken(),0);
    Toast.makeText(this,getString(R.string.toastDisasterName),Toast.LENGTH_LONG).show();
    return;
  }
 else   if (disasterDescriptionView.getText().length() == 0) {
    InputMethodManager mgr=(InputMethodManager)getSystemService(this.INPUT_METHOD_SERVICE);
    mgr.hideSoftInputFromWindow(disasterDescriptionView.getWindowToken(),0);
    Toast.makeText(this,getString(R.string.toastDisasterDescription),Toast.LENGTH_LONG).show();
    return;
  }
 else {
    disasterName=disasterNameView.getText().toString();
    disasterDescription=disasterDescriptionView.getText().toString();
    boolean disasterCreationCode=false;
    if (disasterCreationCode) {
      AlertDialog.Builder alertBuilder=new AlertDialog.Builder(this);
      alertBuilder.setMessage(getString(R.string.disasterCreateDialog)).setCancelable(false).setPositiveButton(getString(R.string.dialogOK),new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int id){
          disasterNameView.setText(getString(R.string.emptyText));
          disasterNameView.setHint(getString(R.string.loginUserNameHint));
          return;
        }
      }
);
      AlertDialog alert=alertBuilder.create();
      alert.show();
      return;
    }
    iDisasterApplication.getInstance().disasterNameList.add(disasterName);
    iDisasterApplication.getInstance().disasterAdapter.notifyDataSetChanged();
    Toast.makeText(this,"Debug: " + disasterName + " "+ disasterDescription,Toast.LENGTH_LONG).show();
    InputMethodManager mgr=(InputMethodManager)getSystemService(this.INPUT_METHOD_SERVICE);
    mgr.hideSoftInputFromWindow(disasterNameView.getWindowToken(),0);
    finish();
  }
}
 

Example 63

From project spring-android-samples, under directory /spring-android-facebook-client/src/org/springframework/android/facebookclient/.

Source file: FacebookWallPostActivity.java

  31 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.facebook_wall_post_activity_layout);
  this.facebook=getApplicationContext().getConnectionRepository().findPrimaryConnection(Facebook.class).getApi();
  final Button button=(Button)findViewById(R.id.button_submit);
  button.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      InputMethodManager inputMethodManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
      EditText editText=(EditText)findViewById(R.id.edit_text_wall_post);
      inputMethodManager.hideSoftInputFromWindow(editText.getWindowToken(),0);
      new PostTweetTask().execute();
    }
  }
);
}
 

Example 64

From project StegDroid, under directory /src/uk/ac/cam/tfmw2/stegdroid/.

Source file: StegDroid.java

  31 
vote

@Override public void onClick(View v){
switch (v.getId()) {
case R.id.p1Next:
    messageString=messageBox.getText().toString();
  InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(messageBox.getWindowToken(),0);
updatePage(2);
break;
case R.id.p2Next:
next.setEnabled(false);
source=SOURCE_FILE;
embedThread et=new embedThread();
et.start();
loadingDialog=ProgressDialog.show(StegDroid.this,"",getString(R.string.loader_embedding_data),true);
}
}
 

Example 65

From project TABuss, under directory /src/org/ubicompforall/BusTUC/Main/.

Source file: Homescreen.java

  31 
vote

@Override protected void onPreExecute(){
  InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(textView.getWindowToken(),0);
  if (sms)   Toast.makeText(context,"Venter p? svar...",Toast.LENGTH_LONG).show();
  myDialog=ProgressDialog.show(context,"Loading","Vent nu!");
  myDialog.setCancelable(true);
  myDialog.setOnCancelListener(new OnCancelListener(){
    @Override public void onCancel(    DialogInterface dialog){
      finish();
      System.exit(0);
    }
  }
);
  textView.setEnabled(false);
  goButton.setEnabled(false);
}
 

Example 66

From project titanium_modules, under directory /beintoosdk/mobile/android/src/com/beintoo/activities/.

Source file: Friends.java

  31 
vote

private void initFindFriends(){
  RelativeLayout beintooBar=(RelativeLayout)findViewById(current.getContext().getResources().getIdentifier("beintoobarsmall","id",current.getContext().getPackageName()));
  beintooBar.setBackgroundDrawable(new BDrawableGradient(0,(int)(ratio * 40),BDrawableGradient.BAR_GRADIENT));
  TextView title=(TextView)findViewById(current.getContext().getResources().getIdentifier("dialogTitle","id",current.getContext().getPackageName()));
  title.setTextColor(Color.WHITE);
  title.setText(current.getContext().getString(current.getContext().getResources().getIdentifier("friendFind","string",current.getContext().getPackageName())));
  ImageView searchicon=new ImageView(current.getContext());
  searchicon.setImageResource(current.getContext().getResources().getIdentifier("findfriend","drawable",current.getContext().getPackageName()));
  EditText querytext=new EditText(current.getContext());
  LinearLayout.LayoutParams lp=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.FILL_PARENT);
  lp.setMargins(10,0,0,0);
  querytext.setLayoutParams(lp);
  querytext.setHint(current.getContext().getString(current.getContext().getResources().getIdentifier("friendFindeditsearch","string",current.getContext().getPackageName())));
  querytext.setPadding((int)(ratio * 10),0,0,0);
  querytext.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
  querytext.setOnEditorActionListener(new EditText.OnEditorActionListener(){
    public boolean onEditorAction(    TextView v,    int actionId,    KeyEvent event){
      if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
        InputMethodManager imm=(InputMethodManager)current.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(v.getWindowToken(),0);
        loadSearchResults(v.getText().toString());
        return true;
      }
      return false;
    }
  }
);
  LinearLayout searchBar=new LinearLayout(current.getContext());
  searchBar.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT));
  searchBar.setOrientation(LinearLayout.HORIZONTAL);
  searchBar.setPadding(10,10,10,10);
  searchBar.addView(searchicon);
  searchBar.addView(querytext);
  searchBar.setBackgroundDrawable(new BDrawableGradient(0,(int)(ratio * 90),BDrawableGradient.GRAY_GRADIENT));
  LinearLayout searchlayout=(LinearLayout)findViewById(current.getContext().getResources().getIdentifier("searchspace","id",current.getContext().getPackageName()));
  searchlayout.addView(searchBar);
  searchlayout.addView(createSpacer(current.getContext(),1,1));
  searchlayout.addView(createSpacer(current.getContext(),2,1));
  searchlayout.setVisibility(LinearLayout.VISIBLE);
}
 

Example 67

From project TL-android-app, under directory /tlandroidapp/src/org/opensourcetlapp/tl/.

Source file: SearchFragment.java

  31 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (db == null)   db=new DBHelper(getActivity());
  if (null == savedInstanceState && null != mSavedOutState) {
    savedInstanceState=mSavedOutState;
  }
  mInstanceAlreadySaved=false;
  if (savedInstanceState != null) {
    postInfoList=savedInstanceState.getParcelableArrayList("search");
    dialogItem=savedInstanceState.getInt("dialogItem");
    username=savedInstanceState.getString("username");
  }
  instance=this;
  View view=inflater.inflate(R.layout.search,container,false);
  search=(EditText)view.findViewById(R.id.search);
  progressBar=(ProgressBar)view.findViewById(R.id.progressBar);
  search.setOnKeyListener(new OnKeyListener(){
    @Override public boolean onKey(    View v,    int keyCode,    KeyEvent event){
      if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
        InputMethodManager imm=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(search.getWindowToken(),0);
        postInfoList=new ArrayList<PostInfo>();
        progressBar.setVisibility(View.VISIBLE);
        handler=new SearchHandler(progressBar);
        page=1;
        new Thread((Runnable)instance).start();
        return true;
      }
      return false;
    }
  }
);
  return view;
}
 

Example 68

From project TodoBento, under directory /src/mobisocial/bento/todo/ui/.

Source file: TodoDetailFragment.java

  31 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  mTodoUuid=getActivity().getIntent().getStringExtra(EXTRA_TODO_UUID);
  mRootView=(ViewGroup)inflater.inflate(R.layout.fragment_todo_detail,container);
  mTitle=(EditText)mRootView.findViewById(R.id.todo_title);
  mDescription=(EditText)mRootView.findViewById(R.id.todo_description);
  mDescription.setOnEditorActionListener(new EditText.OnEditorActionListener(){
    @Override public boolean onEditorAction(    TextView v,    int actionId,    KeyEvent event){
      if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
        Log.d(TAG,"onEditorAction");
        v.clearFocus();
        InputMethodManager mgr=(InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        mgr.hideSoftInputFromWindow(mDescription.getWindowToken(),0);
        return true;
      }
      return false;
    }
  }
);
  mImageView=(ImageView)mRootView.findViewById(R.id.todo_image);
  if (mTodoUuid != null) {
    mTodoItem=mManager.getTodoListItem(mTodoUuid);
    if (mTodoItem != null) {
      mTitle.setText(mTodoItem.title);
      mDescription.setText(mTodoItem.description);
      if (mTodoItem.hasImage) {
        mImageView.setImageBitmap(mManager.getTodoBitmap(mTodoItem.uuid,IMG_WIDTH,IMG_HEIGHT,0));
        mImageView.setVisibility(View.VISIBLE);
      }
 else {
        mImageView.setVisibility(View.GONE);
      }
    }
  }
  return mRootView;
}
 

Example 69

From project Twook, under directory /src/com/nookdevs/twook/activities/.

Source file: SettingsActivity.java

  31 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final Resources res=getResources();
  NAME=res.getText(R.string.app_name).toString() + res.getText(R.string.title_separator).toString() + res.getText(R.string.settings_title).toString();
  setContentView(R.layout.settings);
  final InputMethodManager imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
  imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
  txtPin=(EditText)findViewById(R.id.pin);
  txtPin.setOnKeyListener(credentialsListener);
  WebView engine=(WebView)findViewById(R.id.web_frame);
  engine.setOnKeyListener(credentialsListener);
  engine.getSettings().setJavaScriptEnabled(true);
  Settings settings=Settings.getSettings(this);
  ConfigurationBuilder confBuilder=settings.getConfiguration();
  Configuration conf=confBuilder.build();
  mAuth=new OAuthAuthorization(conf);
  TextView validation=(TextView)findViewById(R.id.validation);
  try {
    RequestToken requestToken=mAuth.getOAuthRequestToken();
    Log.d(TAG,"Request token: " + requestToken.toString());
    Log.d(TAG,"Sending user to " + requestToken.getAuthorizationURL());
    engine.loadUrl(requestToken.getAuthorizationURL());
    Log.d(TAG,"Will authorize to " + conf.getOAuthAccessTokenURL());
  }
 catch (  TwitterException excep) {
    validation.setText("Unknown error: " + excep.getMessage());
  }
}
 

Example 70

From project android_packages_apps_TouchWiz30Launcher, under directory /src/com/sec/android/app/twlauncher/.

Source file: Launcher.java

  29 
vote

private boolean acceptFilter(){
  boolean flag;
  if (!((InputMethodManager)getSystemService("input_method")).isFullscreenMode())   flag=true;
 else   flag=false;
  return flag;
}
 

Example 71

From project facebook-android-sdk, under directory /examples/Hackbook/src/com/facebook/android/.

Source file: FQLQuery.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mHandler=new Handler();
  setContentView(R.layout.fql_query);
  LayoutParams params=getWindow().getAttributes();
  params.width=LayoutParams.FILL_PARENT;
  params.height=LayoutParams.FILL_PARENT;
  getWindow().setAttributes((android.view.WindowManager.LayoutParams)params);
  mFQLQuery=(EditText)findViewById(R.id.fqlquery);
  mFQLOutput=(TextView)findViewById(R.id.fqlOutput);
  mSubmitButton=(Button)findViewById(R.id.submit_button);
  mSubmitButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      ((InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(mFQLQuery.getWindowToken(),0);
      dialog=ProgressDialog.show(FQLQuery.this.activity,"",FQLQuery.this.activity.getString(R.string.please_wait),true,true);
      String query=mFQLQuery.getText().toString();
      Bundle params=new Bundle();
      params.putString("method","fql.query");
      params.putString("query",query);
      Utility.mAsyncRunner.request(null,params,new FQLRequestListener());
    }
  }
);
}
 

Example 72

From project frameworks_opt, under directory /inputmethodcommon/java/com/android/inputmethodcommon/.

Source file: InputMethodSettingsImpl.java

  29 
vote

/** 
 * Initialize internal states of this object.
 * @param context the context for this application.
 * @param prefScreen a PreferenceScreen of PreferenceActivity or PreferenceFragment.
 * @return true if this application is an IME and has two or more subtypes, false otherwise.
 */
public boolean init(final Context context,final PreferenceScreen prefScreen){
  mContext=context;
  mImm=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
  mImi=getMyImi(context,mImm);
  if (mImi == null || mImi.getSubtypeCount() <= 1) {
    return false;
  }
  mSubtypeEnablerPreference=new Preference(context);
  mSubtypeEnablerPreference.setOnPreferenceClickListener(new OnPreferenceClickListener(){
    @Override public boolean onPreferenceClick(    Preference preference){
      final CharSequence title=getSubtypeEnablerTitle(context);
      final Intent intent=new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
      intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID,mImi.getId());
      if (!TextUtils.isEmpty(title)) {
        intent.putExtra(Intent.EXTRA_TITLE,title);
      }
      intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP);
      context.startActivity(intent);
      return true;
    }
  }
);
  prefScreen.addPreference(mSubtypeEnablerPreference);
  updateSubtypeEnabler();
  return true;
}
 

Example 73

From project framework_base_policy, under directory /src/com/android/internal/policy/impl/.

Source file: PasswordUnlockScreen.java

  29 
vote

/** 
 * Method adapted from com.android.inputmethod.latin.Utils
 * @param imm The input method manager
 * @param shouldIncludeAuxiliarySubtypes
 * @return true if we have multiple IMEs to choose from
 */
private boolean hasMultipleEnabledIMEsOrSubtypes(InputMethodManager imm,final boolean shouldIncludeAuxiliarySubtypes){
  final List<InputMethodInfo> enabledImis=imm.getEnabledInputMethodList();
  int filteredImisCount=0;
  for (  InputMethodInfo imi : enabledImis) {
    if (filteredImisCount > 1)     return true;
    final List<InputMethodSubtype> subtypes=imm.getEnabledInputMethodSubtypeList(imi,true);
    if (subtypes.isEmpty()) {
      ++filteredImisCount;
      continue;
    }
    int auxCount=0;
    for (    InputMethodSubtype subtype : subtypes) {
      if (subtype.isAuxiliary()) {
        ++auxCount;
      }
    }
    final int nonAuxCount=subtypes.size() - auxCount;
    if (nonAuxCount > 0 || (shouldIncludeAuxiliarySubtypes && auxCount > 1)) {
      ++filteredImisCount;
      continue;
    }
  }
  return filteredImisCount > 1 || imm.getEnabledInputMethodSubtypeList(null,false).size() > 1;
}
 

Example 74

From project Gingerbread-Keyboard, under directory /src/com/android/inputmethod/latin/.

Source file: LatinIME.java

  29 
vote

private void showOptionsMenu(){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setCancelable(true);
  builder.setIcon(R.drawable.ic_dialog_keyboard);
  builder.setNegativeButton(android.R.string.cancel,null);
  CharSequence itemSettings=getString(R.string.english_ime_settings);
  CharSequence itemInputMethod=getString(R.string.selectInputMethod);
  builder.setItems(new CharSequence[]{itemInputMethod,itemSettings},new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface di,    int position){
      di.dismiss();
switch (position) {
case POS_SETTINGS:
        launchSettings();
      break;
case POS_METHOD:
    ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).showInputMethodPicker();
  break;
}
}
}
);
builder.setTitle(mResources.getString(R.string.english_ime_input_options));
mOptionsDialog=builder.create();
Window window=mOptionsDialog.getWindow();
WindowManager.LayoutParams lp=window.getAttributes();
lp.token=mKeyboardSwitcher.getInputView().getWindowToken();
lp.type=WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
window.setAttributes(lp);
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
mOptionsDialog.show();
}
 

Example 75

From project packages_apps_Calendar, under directory /src/com/android/calendar/event/.

Source file: EditEventFragment.java

  29 
vote

@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  mContext=activity;
  mHelper=new EditEventHelper(activity,null);
  mHandler=new QueryHandler(activity.getContentResolver());
  mModel=new CalendarEventModel(activity,mIntent);
  mInputMethodManager=(InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
  mUseCustomActionBar=!Utils.getConfigBool(mContext,R.bool.multiple_pane_config);
}
 

Example 76

From project PinyinIME, under directory /src/com/android/inputmethod/pinyin/.

Source file: PinyinIME.java

  29 
vote

public void showOptionsMenu(){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setCancelable(true);
  builder.setIcon(R.drawable.app_icon);
  builder.setNegativeButton(android.R.string.cancel,null);
  CharSequence itemSettings=getString(R.string.ime_settings_activity_name);
  CharSequence itemInputMethod=getString(com.android.internal.R.string.inputMethod);
  builder.setItems(new CharSequence[]{itemSettings,itemInputMethod},new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface di,    int position){
      di.dismiss();
switch (position) {
case 0:
        launchSettings();
      break;
case 1:
    InputMethodManager.getInstance(PinyinIME.this).showInputMethodPicker();
  break;
}
}
}
);
builder.setTitle(getString(R.string.ime_name));
mOptionsDialog=builder.create();
Window window=mOptionsDialog.getWindow();
WindowManager.LayoutParams lp=window.getAttributes();
lp.token=mSkbContainer.getWindowToken();
lp.type=WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
window.setAttributes(lp);
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
mOptionsDialog.show();
}
 

Example 77

From project platform_packages_apps_calendar, under directory /src/com/android/calendar/event/.

Source file: EditEventFragment.java

  29 
vote

@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  mContext=activity;
  mHelper=new EditEventHelper(activity,null);
  mHandler=new QueryHandler(activity.getContentResolver());
  mModel=new CalendarEventModel(activity,mIntent);
  mInputMethodManager=(InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
  mUseCustomActionBar=!Utils.getConfigBool(mContext,R.bool.multiple_pane_config);
}
 

Example 78

From project QuotaForAndroid, under directory /Quota/src/com/southfreo/quota/activities/.

Source file: PinEntry.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.pinentry);
  butOK=(Button)findViewById(R.id.okbutt);
  pinTxt=(EditText)findViewById(R.id.pinDisplay);
  header=(TextView)findViewById(R.id.headertxt);
  butOK.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      CheckPin();
    }
  }
);
  pinmode=getIntent().getIntExtra(MODE_OP,MODE_CREATE);
  if (pinmode == MODE_CREATE) {
    pin_submode=SUBMODE_ENTERPIN;
  }
 else   if (pinmode == MODE_VALIDATE) {
    cpin=SlotManager.getInstance().pinCode;
    pin_submode=SUBMODE_VALIDATEPIN;
  }
 else   if (pinmode == MODE_CHANGE) {
    cpin=SlotManager.getInstance().pinCode;
    pin_submode=SUBMODE_VALIDATEPIN;
  }
  pinTxt.setSingleLine();
  pinTxt.setInputType(InputType.TYPE_CLASS_PHONE);
  PasswordTransformationMethod transMethod=new PasswordTransformationMethod();
  pinTxt.setTransformationMethod(transMethod);
  mgr=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  mgr.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
  pinTxt.setOnEditorActionListener(new TextView.OnEditorActionListener(){
    @Override public boolean onEditorAction(    TextView v,    int actionId,    KeyEvent event){
      if (actionId == EditorInfo.IME_ACTION_DONE) {
        CheckPin();
      }
      return false;
    }
  }
);
}
 

Example 79

From project roboguice, under directory /roboguice/src/main/java/roboguice/config/.

Source file: RoboModule.java

  29 
vote

/** 
 * Configure this module to define Android related bindings.<br /> <br /> If you want to provide your own bindings, you should <strong>NOT</strong> override this method, but rather create a  {@link Module} implementationand add it to the configuring modules by overriding {@link roboguice.application.RoboApplication#addApplicationModules(List)}.<br />
 */
@SuppressWarnings("unchecked") @Override protected void configure(){
  bindScope(ContextScoped.class,contextScope);
  bind(ContextScope.class).toInstance(contextScope);
  bind(Context.class).toProvider(throwingContextProvider).in(ContextScoped.class);
  bind(Activity.class).toProvider(ActivityProvider.class);
  bind(AssetManager.class).toProvider(AssetManagerProvider.class);
  bind(SharedPreferences.class).toProvider(SharedPreferencesProvider.class);
  bind(Resources.class).toProvider(ResourcesProvider.class);
  bind(ContentResolver.class).toProvider(ContentResolverProvider.class);
  bind(EventManager.class).toInstance(eventManager);
  for (Class<?> c=application.getClass(); c != null && Application.class.isAssignableFrom(c); c=c.getSuperclass())   bind((Class<Object>)c).toInstance(application);
  bind(LocationManager.class).toProvider(new SystemServiceProvider<LocationManager>(Context.LOCATION_SERVICE));
  bind(WindowManager.class).toProvider(new SystemServiceProvider<WindowManager>(Context.WINDOW_SERVICE));
  bind(LayoutInflater.class).toProvider(new SystemServiceProvider<LayoutInflater>(Context.LAYOUT_INFLATER_SERVICE));
  bind(ActivityManager.class).toProvider(new SystemServiceProvider<ActivityManager>(Context.ACTIVITY_SERVICE));
  bind(PowerManager.class).toProvider(new SystemServiceProvider<PowerManager>(Context.POWER_SERVICE));
  bind(AlarmManager.class).toProvider(new SystemServiceProvider<AlarmManager>(Context.ALARM_SERVICE));
  bind(NotificationManager.class).toProvider(new SystemServiceProvider<NotificationManager>(Context.NOTIFICATION_SERVICE));
  bind(KeyguardManager.class).toProvider(new SystemServiceProvider<KeyguardManager>(Context.KEYGUARD_SERVICE));
  bind(SearchManager.class).toProvider(new SystemServiceProvider<SearchManager>(Context.SEARCH_SERVICE));
  bind(Vibrator.class).toProvider(new SystemServiceProvider<Vibrator>(Context.VIBRATOR_SERVICE));
  bind(ConnectivityManager.class).toProvider(new SystemServiceProvider<ConnectivityManager>(Context.CONNECTIVITY_SERVICE));
  bind(WifiManager.class).toProvider(new SystemServiceProvider<WifiManager>(Context.WIFI_SERVICE));
  bind(InputMethodManager.class).toProvider(new SystemServiceProvider<InputMethodManager>(Context.INPUT_METHOD_SERVICE));
  bind(SensorManager.class).toProvider(new SystemServiceProvider<SensorManager>(Context.SENSOR_SERVICE));
  bind(TelephonyManager.class).toProvider(new SystemServiceProvider<TelephonyManager>(Context.TELEPHONY_SERVICE));
  bindListener(Matchers.any(),resourceListener);
  bindListener(Matchers.any(),extrasListener);
  bindListener(Matchers.any(),viewListener);
  if (preferenceListener != null)   bindListener(Matchers.any(),preferenceListener);
  if (eventManager.isEnabled())   bindListener(Matchers.any(),new ObservesTypeListener(contextProvider,eventManager));
  requestInjection(eventManager);
  requestStaticInjection(Ln.class);
  requestStaticInjection(RoboThread.class);
  requestStaticInjection(RoboAsyncTask.class);
}
 

Example 80

From project SqueezeControl, under directory /src/com/squeezecontrol/.

Source file: AbstractMusicBrowserActivity.java

  29 
vote

public void init(){
  mInputMethodManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  if (getCachedAdapter() != null) {
    setListAdapter(getCachedAdapter());
  }
 else {
    setListAdapter(createListAdapter());
  }
  setTitle("Loading...");
  ServiceUtils.bindToService(this,new SqueezeServiceConnection(){
    @Override public void onServiceConnected(    SqueezeService service){
      mService=service;
      mBrowser=service.getBroker().getMusicBrowser();
      startLoaderThread();
      onServiceBound(service);
    }
  }
);
  final ListView list=getListView();
  list.setFocusable(true);
  list.setItemsCanFocus(true);
  list.setTextFilterEnabled(true);
  list.setOnScrollListener(this);
  registerForContextMenu(list);
  mFilter=new Filter(){
    @Override protected FilterResults performFiltering(    CharSequence constraint){
      setQueryString(constraint.toString());
      return new FilterResults();
    }
    @Override protected void publishResults(    CharSequence constraint,    FilterResults results){
    }
  }
;
  getListAdapter().setFilter(mFilter);
}
 

Example 81

From project TiVo-Commander, under directory /src/com/arantius/tivocommander/.

Source file: Remote.java

  29 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  MindRpc.init(this);
  setContentView(R.layout.remote);
  setTitle("Remote");
  getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  mEditText=(EditText)findViewById(R.id.keyboard_activator);
  mEditText.addTextChangedListener(mTextWatcher);
  mInputManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
  mVibrator=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
}
 

Example 82

From project vanilla, under directory /src/org/kreed/vanilla/.

Source file: LibraryActivity.java

  29 
vote

private void setSearchBoxVisible(boolean visible){
  mSearchBoxVisible=visible;
  mSearchBox.setVisibility(visible ? View.VISIBLE : View.GONE);
  if (mControls != null) {
    mControls.setVisibility(visible || (mState & PlaybackService.FLAG_NO_MEDIA) != 0 ? View.GONE : View.VISIBLE);
  }
 else   if (mActionControls != null) {
    ViewParent parent=mActionControls.getParent();
    if (parent != null)     parent=parent.getParent();
    if (parent != null && parent instanceof ViewGroup) {
      ViewGroup ab=(ViewGroup)parent;
      if (ab.getChildCount() == 1) {
        ab.setVisibility(visible ? View.GONE : View.VISIBLE);
      }
    }
  }
  if (visible) {
    mTextFilter.requestFocus();
    ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).showSoftInput(mTextFilter,0);
  }
}